Mojolicious::Lite

Ovid on 2009-07-29T09:21:05

This blog post makes Mojolicious::Lite look very interesting. The fact that it has no dependencies makes it even more compelling. It's the sort of thing one could more easily attract new developers with. Can you imagine rewriting my old CGI course with something like this? Or maybe a way to introduce new users to Perl? There are many excellent Perl frameworks out there which I would, nonetheless, hesitate to start new users on. Just trying to set up CPAN can be difficult for them; working through even one test failure is often too much. For people who want to jump in and learn "Web programming", though, this might work.

See what happened? Sebastian was trying to communicate the benefits of his software to a potential consumer and it piqued my curiosity. You know what that's called? Marketing. It may have a different end goals and customers, but it's still marketing.

Yes, folks, blog posts are often marketing, whether deliberate or not. If you blog about your breakfast, it's probably not marketing, but if you're a chef, it might very well be. Marketing is not something you can discreetly identify. Heck, I've lived for quite some time with someone who has directed marketing at a number of companies around the world. One of my best friends used to do marketing for Waggener Edstrom, Microsoft's PR firm (or maybe former firm. Don't know). While I'm hardly an expert in marketing, I've been amazed at a lot of the clever stuff they've come up with and it's a far, far cry from the "waste of time" that some people are calling it.

Marketing isn't just ads. It's not just articles in newspapers. It's not just viral videos. It's not just guys walking around in crazy costumes handing out leaflets. It's also people touting their latest Web framework in their blogs. It's people teaching classes about Perl 5. It's people giving talks at users groups about software testing. It's word of mouth. It's anything you want it to be, so long as you connect producers and consumers and get your message out there. I find it hilarious that many of the people decrying marketing are, in fact, marketing themselves (even though they don't know it).


More Sinatra's offsprings in Perl?

oz on 2009-07-29T13:38:28

Heh. Sukria released Dancer at about the same time on the CPAN, and the two packages do roughly the same thing.

Too bad they did not communicate on the matter a little bit earlier. The two projects look like really fun alternatives to ruby's Sinatra. :)

http://search.cpan.org/user/sukria/Dancer-0_0.99/lib/Dancer.pm

Re:More Sinatra's offsprings in Perl?

melo on 2009-07-30T11:41:26

Actually they did know about Dancer.

After the Dancer release to github, vti wrote a dancer clone using Mojo. Eventually he re-wrote it using Mojolicious, and that was the spark that ignited Mojolicious::Lite development.

Best regards,

Re:More Sinatra's offsprings in Perl?

sukria on 2009-08-02T22:23:43

Hello, to be frank, reading this makes me sick.

So it seems, they actually came on GitHub, found out Dancer, and just fork it? Whithout even taking five minutes to send me an email about that?

Marketblogging about it then smells like arrongance to me, as they don't even take the time to quote the origin of their work.

What is the purpose of such a behaviour? Splitting the Perl community in small groups that work one against the other?

I really don't understand. I'm surprised to see how big some egos are...

Anyways, just for the record, I'm clearly not in the mood of stopping Dancer's development just because of a new-born fork project. I will continue working on it, with the help of whoever wants to join, and the leading idea will be to write a nice Perl framework, with dependencies when it makes sense (which seems to be the first point of divergence between Dancer and Mojolicous::Lite).

So if some people here want to contrinute to the original Perl port of Sinatra, this is where it takes place: http://github.com/sukria/Dancer

Re:More Sinatra's offsprings in Perl?

ask on 2009-08-03T22:57:07

Uh, that's a little unfair. I've been using Mojo since November last year and it from the git log you only put Dancer on github a few weeks ago.

Mojolicious::Lite is just a variant on the Mojolicious code to allow you to have apps in one file, like you have in Dancer. It's not a fork.

Re:More Sinatra's offsprings in Perl?

sukria on 2009-08-04T12:13:42

Quoting the previous message:

Actually they did know about Dancer.

After the Dancer release to github, vti wrote a dancer clone using Mojo.

This is a fork, please. Mojolicious was there long ago, I never said the opposite.
But Mojolicious::Lite, it has been directly inspired by my work on Dancer. I don't blame the fork itself, afterall it's how things happen in free software.

But would it be difficult to quote Dancer somewhere, just in order to give a bit of credit to my work?

This is a fork, and an impolite one. Now, I wish good luck to the Mojolicious folks, at least this story gave me enough motivation to build up a website for Dancer.

Re:More Sinatra's offsprings in Perl?

sukria on 2010-07-05T11:24:19

OK, so as Sebastian has just said on Twitter that this is a "gloriously stupid comment", I'd like precise the full story so anybody who comes here can see he's altering the reality (as he previously did with Class::DBI).

Mojolicious::Lite has been a rewrite of a module named "Rocker", previously written by Viacheslav Tykhanovskyi. Viacheslav told me he was inspired by Dancer and then started to write Rocker.

Then Sebastian came and refactored Rocker into Mojolicious::Lite. Even if Sebastian is not aware of it, Dancer was the seed of Mojo::Lite, in the first place.

I have a pretty good relationship with Viacheslav, and he's as sorry as I am for all this public war Sebastian tries to run between Dancer and Mojo.

I won't reply to his attacks anymore, and I'd be very happy if Dancer and Mojo could live peacefully together. There is room for both projects, no need to fight, it's just useless and makes the community look childish. Spending so much energy in spreading hateful messages does clearly not help the Perl community to look good.

Marketing

frew on 2009-07-29T14:12:49

I agree that posts with content are a form of marketing, and this one that I am commenting on is fine as it points at a useful module. It's just all the meta about how we need a marketer that bothers me. I'm fine when people talk about that and pursue hiring a marketer or whatever, but just talk about marketing is, at least to me, not helpful.

Really?

autarch on 2009-07-29T14:25:59

The fact that it has no dependencies makes it even more compelling.

Really? You honestly think that a webapp framework should also ship with its own object system, its own cookie parser, its own HTTP server, its own HTTP header system, and to top it off, its own new templating system!

I look at Mojo and can only think that it represents the height of foolish arrogance, and I for one am repelled by it.

Catalyst is far from perfect, but at least the Catalyst developers can concentrate on building a web framework rather than reinventing all the underlying bits.

Re:Really?

gizmo_mathboy on 2009-07-29T18:32:32

What's wrong with a framework that has such a low barrier to entry?

As Ovid wrote, there is very little required to use it. It's almost like baby talk for a Perl web framework.

What would be wrong with getting to learn about frameworks with Mojolicious::Lite and when you understand them, try to move to the more complete and "grown up" Catalyst.

From alias's Heayy100 Jifty has a dependency of 188 modules and Catalyst isn't in the Top100 so I can only guess (I'll take a WAG and say 100). Which is easier for the beginner to take a stab at to install?

TIMTOWTDI. There are better ways to do it but we all have to crawl, hell, even roll around aimlessly, before we can walk or run. We don't denigrate people for using baby perl. We do encourage them to use better tools as they get better. It's not like it's Matt's Script Archive for goodness sake.

Don't harsh their buzz, man. :-)

Re:Really?

zby on 2009-07-29T20:34:56

The problem with it is that it leads to even further fragmentation. Because of the no dependencies rule we get not just another web framework - but a whole lot of new, in bulk most probably simplistic, modules that duplicate functionality of available CPAN libraries.

And once people start coding to it they will not en masse 'move to the more complete and ...' alternatives - this never happens. So this will stay and the simplistic nature will quickly be replaced by more complete and complex implementations and they'll become dependencies of whole lot of other libraries.

Of course this is not bad in any absolute sense - but it reinforces the trend that is not productive.

Re:Really?

Ovid on 2009-07-29T21:03:59

You know, that's kind of how PHP started out. They've kicked our tail on what was our home turf in the 90s. And let's face it, Sebastian is not exactly a newbie. And I remember how people told Adam Kennedy that he was wasting his time trying to parse Perl -- sometimes people produce great things when trying to do more than we think they should :)

Re:Really?

zby on 2009-07-30T12:12:39

OK - but isn't it sad that they rewrite everything? I mean coudn't they get some co-maintanance or something to make sure that the prereqs behave as they want and ship them with their code instead of writing their own versions?

I am waiting for the promised Mojo docs for a deeper analysis - but from what I've seen it has a better API than Catalyst - it looks like there was at least some effort put into designing it. So I am not against Mojo as a whole - I am only concerned about that no-dependency policy.

Re:Really?

chromatic on 2009-07-31T18:24:14

... isn't it sad that they rewrite everything?

Rewriting in and of itself isn't necessarily bad. Rewriting poorly, ignoring discoveries of art about what does and doesn't work, and fumbling through well-avoided mistakes is bad.

Re:Really?

zby on 2009-08-01T08:54:00

When the policy is 'no dependencies' - i.e. 'rewrite everything that is not in core' - then there is much chance that some of those bad things will happen. And beside those obvious step backs - I still maintain that duplication of effort - i.e. of rewriting something in a way that is neither worse nor better - this is still sad - it means something failed in the CPAN ecosystem.

Re:Really?

Ovid on 2009-08-01T10:03:00

Something failed in the CPAN a long time ago. Having too much choice between modules (sometimes equally good and sometimes equally bad) means that there's been some serious fragmentation. This is one case where having CPAN so large has not been a benefit.

Re:Really?

zby on 2009-08-01T15:26:08

I would like to see if Sebastian agrees here.

Re:Really?

zby on 2009-07-29T20:14:05

That sure was an angry note. I share much of your analysis - but this kind of polarizing does not bring us closer to any resolution.

Re:Really?

jrockway on 2009-07-29T23:11:41

Apparently people can't install modules if they have dependencies, but they can install modules if they don't have dependencies. I don't really get it.

But anyway, reinvention aside, Mojolicious::Lite is basically the same tired CGI.pm ideas repackaged as new syntax. Great for blogging (like so many ideas from the Ruby community), but not so great for solving problems web application developers actually have.

Re:Really?

Alias on 2009-07-30T04:31:49

> Apparently people can't install modules if they have dependencies, but they can install modules if they don't have dependencies. I don't really get it.

There's a large community of people in the world who don't know Perl, and have a simple FTP-upload shared hosting account.

What these people NEED is a zip file they can unroll into their local dreamweaver/whatever directory, tweak a config file or some well commented lines in the script header, and then FTP upload to their website.

That is EXACTLY the reason that PHP succeeded, it let people who weren't programmers deploy simple zipped applications and then they could transition into simple crude development on an already working site, and then they spooled up from there.

What being zero-dependency means is that you can take a simple CGI script with some pure perl libraries, put it into a zip file with a copy of Mojolicious::Lite, and then let people download it.

Those people can unzip the package, tweak a config file, and then upload it to their shared hosting, and it will work.

Re:Really?

gizmo_mathboy on 2009-07-30T05:30:08

Exactly.

I don't mean to say that having a lot of dependencies is bad, it's just daunting sometimes to figure things out.

I'm not afraid of them nor am I fully embracing them either.

Adam and others are working hard to get a more reliable dependency chain, but as Adam mentioned simplicity counts for a significant amount.

Barrier to entry is important.

Re:Really?

Aristotle on 2009-09-08T01:00:01

No, that’s not what being zero-dependency means. It’s only what being pure-Perl means.

Re:Really?

Ovid on 2009-07-30T06:44:08

There's a big difference between "installing" a module and unpacking it in a directory. Almost anyone can do the latter.

And I can't agree with your comments comparing Mojolicious::Lite to CGI.pm. I'm very familiar with the latter module and it doesn't, out of the box, support this:

# /foo/*
get '/foo/:bar' => sub {
    my $self = shift;
    my $bar  = $self->stash('bar');
    $self->render(text => "Our :bar placeholder matched $bar");
};

# /*something/foo
get '/(:bar)something/foo' => sub {
    my $self = shift;
    my $bar  = $self->stash('bar');
    $self->render(text => "Our :bar placeholder matched $bar");
};

CGI.pm is pretty much for reading Web data, playing with cookies and building HTML. It's not for dispatching. Oh, and one thing I like about Mojolicious and don't like about Catalyst:

# look ma, no hashref!
my $bar  = $self->stash('bar');

People who want to learn Web programming and maybe learn a bit of Perl may very well Mojolicious::Lite a fantastic starting point. As for whether or not it solves larger problems, I can't say as I don't know enough about its capabilities, but I'm very surprised at some of the harsh reactions against it.

Re:Really?

melo on 2009-07-30T11:47:04

BTW. I use both and will keep using both, but I strongly prefer Mojolicious dispatcher and routes system.

But, yes, I would much prefer have it all based on Moose.

As for the other complaints, you hit and miss on them. The Mojo HTTP framework is MUCH better than any other on CPAN, from a spec-compliance point of view. Maybe thats not something that yo care about, thats ok, but it is a fact.

Re:Really?

autarch on 2009-07-30T22:14:54

And was it really impossible to work with existing authors to improve their modules? No, of course not, and it's obvious SRI had no interest in doing so.

Re:Really?

Ovid on 2009-07-31T08:17:53

I won't comment one way or another on what Sebastian's done because I honestly don't know his motivations, but I have a touch of sympathy for his position here. I can't tell you how many times I've discovered two things:

  1. They built a wheel for a car and I need one for a motorcycle but I'm criticized for "reinventing the wheel", even though the available wheel's won't fit my vehicle.
  2. They built a wheel for a car and it has a flat, so I point out that it's punctured, offer to patch it, offer to jack the car up, whatever. Months later, the crickets are still chirping.

Sometimes it's OK to reinvent, to play around, to experiment. Whatever your opinion vis-a-vis Sebastian Riedel is, he has every right to go and do his own thing. I don't understand why you're being so harsh about this. Life's too short. Let it go, dude :)

Re:Really?

autarch on 2009-07-31T23:01:13

My issue is more with you promoting this as a good Perl example.

SRI can do whatever he wants, and should feel free to experiment and have fun.

But his marketing, while good from a marketing perspective, is a turn-off to me because it ignores all the existing solutions.

Re:Really?

vek on 2009-07-30T20:44:56

I think you're missing the target audience for this though. Let's be honest, whether you like the language or not, PHP ate our lunch here. Users can just upload some files in a directory on their web server, and it "just works".

In an enterprisey environment would I want Catalyst? Sure. But are users with their cheap hosting plans going to be able to install a Catalyst app? Prolly not.

Re:Really?

ask on 2009-08-03T23:02:48

Most of the "reinventing" is very thoughtfully done - and in surprisingly little code.

The template thing is indeed a little silly; but it's a very simple template module and Mojolicious has extensive support for plugging in other "renderers" (a bunch already exist on CPAN).

It's all trade-offs (of course).

With Catalyst there's a good deal of "having to learn the underlying bits" to really understand what's going on. In Mojo there's less code and it's more internally consistent.

(That being said, I do think it'd be nicer if Mojo used Moose instead of its own very basic base class).

By any other name...

phillipadsmith on 2009-07-29T15:36:28

"See what happened? Sebastian was trying to communicate the benefits of his software to a potential consumer and it piqued my curiosity. You know what that's called? Marketing. It may have a different end goals and customers, but it's still marketing."

+1

"Marketing isn't just ads. It's not just articles in newspapers. It's not just viral videos. It's not just guys walking around in crazy costumes handing out leaflets. It's also people touting their latest Web framework in their blogs. It's people teaching classes about Perl 5. It's people giving talks at users groups about software testing. It's word of mouth. It's anything you want it to be, so long as you connect producers and consumers and get your message out there. I find it hilarious that many of the people decrying marketing are, in fact, marketing themselves (even though they don't know it)."

Pinko Marketing. It works.