http://qs321.pair.com?node_id=900860


in reply to Catalyst or Dancer?

I haven't used catalyst other than following a tutorial or two but I have used Dancer and can provide some impressions of that.

First, it's route definition code is really nice. It's really really easy to define routes and it's really easy to run a local development server and start making progress right away. It doesn't provide the same level of functionality as catalyst (it's much smaller and has less plugins). For me that's a good thing.

There are some things about it I don't like. First of all, the way it provides all functionality through "keywords" like "template" (and plugins do the same thing, DBIC is "schema"). In all their documentation they have these keywords that look like barewords (no sigil) but are treated as objects, references, etc. What they really are is functions that have prototypes (so you don't need to use parentheses) that return references (to objects, hashes, etc.). I've been programming perl for a really long time and it's difficult to get used to that style. In fact I generally pull them out as vars at the beginning of my functions so I can use them in a more regular way. Like my $schema = schema(); Here's a more specific example, here's how you access request parameters:

return "Hello " . params->{name};

I would much prefer a $params object where I can say $params->name() or a $params hashref where I can say $params->{name}. So I end up saying my $params = params(); and getting said hashref so I don't have to look at unhighlighted "barewords" everywhere.

The setup in Dancer is tied to YAML which I'm not a fan of but I don't have to touch it often so it doesn't bother me too much.

The logging interface is pretty limited. There are plugins that you can use to get different logging but it's still a pain. The problem is that application-level stuff goes to one log (say development.log) but messages about syntax errors and other crashes goes to the logging mechanism of whatever thing you're running the server as (plack, apache, etc.). This means I have to tail more than one log during development to see what is going on.

The mailing list is generally helpful although every dozen or so questions that go through seem to go unanswered.

The development process there is cumbersome and it's difficult to get even simple changes approved (and merged in). They are using github in this complicated way where they develop against "devel" branch but then when they are on the verge of release everyone has to stop using "devel" and use something else for some period of time. It would make more sense to just branch devel into a release branch so development can continue on "devel."

There is no way to set session timeouts dynamically (you have one setting in the conf file and that's it). Makes it difficult to have a "remember me" checkbox on login pages.

I think were it up to me I'd take the route handling stuff alone and plug in my own modules (and by "my own" I mean picking the ones I like from CPAN) for logging, development server, templates, sessions, db, etc.

It is actually now possible to only import some "keywords" (those prototyped functions that return references) and not others. This has made it easier to use some of the Dancer-provided functions in other modules. This wasn't possible when I started my project so I had already worked around that by using my own logging modules and whatnot.

Replies are listed 'Best First'.
Re^2: Catalyst or Dancer?
by Anonymous Monk on Apr 22, 2011 at 23:15 UTC

    Thanks for all the detailed info, saberworks!