Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Catalyst and Handel

by domje (Novice)
on Jun 17, 2013 at 09:40 UTC ( #1039317=perlquestion: print w/ replies, xml ) Need Help??
domje has asked for the wisdom of the Perl Monks concerning the following question:

Hello again, Monks!

My apologies in advance for being tangential. I've had too much coffee and not enough working code today!

So I finally stepped up to a framework and decided to do Catalyst for a project I'm currently working on. It's been pretty sweet thus far, really liking it. Although it seems to be lacking in popularity...Sidebar: is Dancer the thing? I know frameworks in PHP seem to be all-the-rage right now but I grew up on perl and don't really want to let it go, you know? I feel like the whole Ruby on Rails thing kind of blew over and I'd hate to just jump on a fad framework :p

But I digress.

My question is in setting up Handel. I followed along with the tutorial and built up a bare framework with nothing else in it but Handel. After hours of head scratching I figured out that the misbehavior was in how the helper script sets up the controllers. Specifically what should be "index" page (i.e. mywebsite/cart) is written as:

sub default : Local { ... }

When that URL is hit though you get the Root controllers default method saying page not found. If the first line is rewritten as:

sub index :Path :Args(0) { ... }

it seems to function just fine.

My question is: have I overlooked something? Did something change in Catalyst since the helpers were written that has caused this behavior? More curiosity now that I've goten it "working" than anything else.

And again, what's up with the scarce tutorials and such? Is Catalyst a dying framework???

Thanks, yall! --dom

Comment on Catalyst and Handel
Select or Download Code
Re: Catalyst and Handel
by Corion (Pope) on Jun 17, 2013 at 10:50 UTC

    While I can't comment on your technical problems with Catalyst, I can comment on your view of Dancer:

    And again, what's up with the scarce tutorials and such? Is Catalyst a dying framework???

    At least personally, I have the same sentiment about Dancer, namely that very few people seem to be actively using Dancer, or at least, actively contributing to Dancer, or blogging about their experiences. I am using Dancer for some toy projects, and while it works for the simple things I want from it, and certainly has much less conceptual overhead than Catalyst, I too often encounter bugs within Dancer that make me wonder why nobody is aggravated at them and fixing them before me.

    I have to note that I'm still using Dancer 1 and not the new, shiny version, Dancer2. Maybe the mainstream development has moved to that already.

    As a potential alternative, which seems fairly feature-equivalent, have a look at Mojolicious too.

    I consider both, Dancer and Mojolicious different from Catalyst as the two do not need the concept of Model to provide a start.

Re: Catalyst and Handel
by talexb (Canon) on Jun 17, 2013 at 19:25 UTC

    I used Dancer two years back for an API, and it performed admirably. I also met the current maintainer at last year's YAPC::NA, and told him I loved the platform.

    Really, selecting a tool is a weird business, but what works for me is some combination of the following factors:

    • Is it documented? (And to me, that means, can you install the module and, using just the documentation, more or less get the examples working?)
    • Is it fairly recent? (This doesn't always mean anything -- Template::Toolkit is my favourite templating system, was was last updated over a year ago, but I can assure you that it's a fine package. On the other hand, if it's fairly recent, but has only been updated once, it may not yet be seasoned enough for prime time. Again, there are exceptions -- Miyagawa writes awesome code.)
    • Is there a user community? (For me, this means is there an IRC channel -- mailing lists work too, but I prefer the immediacy of IRC. Personal preference.)
    • Have you heard of any of the people attached to the project? (Catalyst is used by mst and his gang, which suggests both that it's supported, and going to be around for a while.)
    • Are there any questions about it on Perlmonks?

    And I may well try out Dancer2 -- while Dancer was wonderful, now that I'm getting back into a period of study and reflection, I should do that with the latest tools.

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re: Catalyst and Handel
by Your Mother (Canon) on Jun 17, 2013 at 21:34 UTC
    My question is: have I overlooked something? Did something change in Catalyst since the helpers were written that has caused this behavior? More curiosity now that I've goten it "working" than anything else.

    The behavior of the index/default stuff changed significantly between 5.7 and 5.8, IIRC. Since Cat is on 5.9 it's a bit hazy. It's probably just an oversight on playing catch-up since the change was made before the most recent version of Handel was released. You might file a ticket if have time.

    Catalyst is a solid and very deep framework that won't disappear soon and unless you are doing websockets or something it won't stop you from doing whatever you like. That said, it's not maintained well enough right now for its size (so I say). Most of the major core players have moved on and community activity has been lower for about 3 years. Might be expected for a mature kit. I have been using Catalyst in personal sites for 8 years and production code for 6; total of something like 15 applications. I doubt I will ever write another based in Catalyst though; not for myself anyway. And this snippet from the Test::Mojo doc gives a peek at the why-

    use Test::More; use Test::Mojo; my $t = Test::Mojo->new('MyApp'); # HTML/XML $t->get_ok('/welcome')->status_is(200)->text_is('div#message' => 'Hell +o!'); # JSON $t->post_ok('/search.json' => form => {q => 'Perl'}) ->status_is(200) ->header_is('Server' => 'Mojolicious (Perl)') ->json_is('/results/4/title' => 'Perl rocks!'); # WebSocket $t->websocket_ok('/echo') ->send_ok('hello') ->message_ok ->message_is('echo: hello') ->finish_ok; done_testing();

    Writing tests for Mojo is so easy it's goofy and it neatly fits with actual Mojo code. Tests for Catalyst are easy on one hand but they, in my view, are disjointed from Catalyst code and are difficult and arcane to do anything outside the beaten path.

    I've come to believe that solid tests are the only way for an application to outlast the initial developer's infatuation with the project. Mojo also recaptures the clear brevity I so love about Perl.

    Sidenote: Catalyst's biggest selling point has always been flexibility -- it's Ruby on Rails without having pre-laid *all* the rails. And one of the most attractive parts here was deployment flexibility. Plack/PSGI has mostly slain that beast.

    Dancer isn't the only other game in town either. There are several microframeworks and others at a similar level like Amon2. There's nothing wrong with looking around and sampling as many as you like.

      This was very helpful. Thank you! I've been looking in the direction of mojolicious lately. I have to get this app out yesterday so I won't be doing mojo on a real world project any time soon but definitely will be playing with it more. On the one hand I'm loving the at we are in where we can use Ajax to offload a lot of work and make smarter views. And web sockets will be great down the road. But I'm happy with a solid framework that easily provides building blocks like sessions and such at this point! Anywho. Thanks again!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1039317]
Approved by Happy-the-monk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-09-02 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls