Ask HN: Web Frameworks for Perl
Have any of you Perl programmers out there used Catalyst as a framework? What do you like and dislike about it? Any other frameworks you would recommend?
Most of the Perl programming I've done has just been gluing together modules like CGI and DBI on my own. I've thought about using a formal framework, and Catalyst seems to be the Perl framework of choice.
29 comments
[ 2.8 ms ] story [ 58.3 ms ] threadPersonally, I also glue together CGI, DBI, etc., and I have no desire to use a framework. Why do you? Is something in particular cumbersome?
I'm using a homebrew haskell framework now, happs with StringTemplate for the view.
http://strawberryperl.com/ http://search.cpan.org/~drolsky/Moose-0.61/lib/Moose.pm
forget catalyst at least for a little while. perl moose makes oop perl a little bit easier, however it should go without saying; understand perl oop first.
http://www.p3rl.org/OOP
if you're using perl cgi and dbi, these are two the best modules written i think. lots to learn in there, keep looking.
Uh, why?
> using perl cgi and dbi, these are two the best modules written i think
No. CGI.pm is universally regarded as bloated.
Catalyst has a somewhat steep learning curve and perhaps invites you to waste time evaluating alternative modules for functionality. It's not "opinionated" and you can choose very different subsystems to get the same job done. The upside is that Catalyst is probably the most powerful web framework out there. DBIx::Class is the most feature-full ORM out there, for one point (trounces ActiveRecord).
Titanium is much, much simpler and has the advantages that entails. You'll be up and running with Titanium in a day. It's a better option for the rare/occasional web app developer (like me).
I have about 12 years of Perl CGI stuff for different projects (most of which is still running) but I started to feel geek envy a few years ago when the world decided that you were not cool without AJAX. I looked into Java EE and realized I just was not an "enterprise" person and then at the different PHP frameworks before doing by first Rails app using Hobo. I have to say that was remarkably fun and easy to put together but I'm still not completely happy about having to run a cluster of mongrels and having to coordinate them with Apache. (That might not be the cool way to deploy Rails apps now, mea culpa.)
CGI::Appplication and Titanium (including modules like HTML::Template and HTML::FillInForm) are simple to use, work with all of the authentication stuff that I interface with, and scale perfectly for the number of users that I typically have.
You'll see some names here of sites that use it that you'll recognize: http://www.masonhq.com/?MasonPoweredSites (Amazon.com being one of the most notable).
In this scope it's just another view like http://search.cpan.org/perldoc?Catalyst::View::TT , http://search.cpan.org/perldoc?Catalyst::View::XSLT or others http://search.cpan.org/search?query=Catalyst::View::
(It is also handy for abstracting away mod_perl2, CGI, and FastCGI with a uniform interface.)
I really like the extensibility of Catalyst. It's a very Perlish framework. It's not opinionated. There are many ways to do things, and if something doesn't work how you want it to, you can easily write a module to do it yourself. It's designed to be an extensible framework, instead of all-in-one, as many others are. For example, it was trivial to get all the appropriate ORM magic working with my existing databases with DBIx::Class. Catalyst really does keep models, views, and controllers separate. In many other frameworks I've looked at, there are things as absurd as requirements on how your DB tables are named.
Another amazing web framework for Perl that doesn't get much media attention is Jifty. Jifty is absurdly powerful and has scary dark magic, but it's negligibly documented. Jifty is really my choice for all-in-one perl web framework. It does everything for you, and then some. One feature that impressed me is that you can describe your dynamic actions in perl code, and Jifty will automatically fall back to loading a new page with the modification if your browser doesn't support javascript, but will do inplace dynamic updates if you do. Graceful degradation built in. I can competently use all of my Jifty apps from elinks or my old treo. It's still rather opinionated, though.
But really the more imporatant part of the decision is what templating and ORM to use. I have a blog post on that: http://perlalchemy.blogspot.com/2008/10/progress.html .
From time to time we factor out common code into modules on top of Catalyst. Everything else is just application code.
Catalyst is super nice for fast development and/or prototyping of web applications and has all the flexibility you need.
Don't think u can go wrong with any of the established ones on that list. However two new kids on the block thats worth casting your eyes over are Squatting (http://search.cpan.org/dist/Squatting/) and Mojolicious (http://mojolicious.org/).
I'm currently enjoying using/playing with Squatting. Its a Microframework (inspired by Camping by _why) and you may find it a good first step from CGI apps.
/I3az/