Below is an excellent argument for Catalyst by Octavian Rasnita, in reply to a question on LinkedIn:

Been using catalyst for two months+ now for minor things, and was wondering, why should I prefer catalyst (Perl) over some other similar PHP framework?

Minor edits by Dan Dascalescu.

Argument for the Catalyst framework

Catalyst is better than any other web framework, and much better than all PHP frameworks, but it depends on what you mean by "best".

Catalyst is very flexible, much more flexible even than Ruby on Rails, more flexible than Python frameworks and also much more flexible than PHP frameworks. It allows using any templating system, more than one, or no templates at all; it allows using any ORM that can be used in a Perl program or no ORM at all; it allows using any form processor or no form processor at all.

Some people doesn't like the flexibility because they want their programs to be understood very fast by any newbie in programming. Perl and Catalyst make a developer very productive, but the learning curve is longer than for simpler frameworks.

The Catalyst framework can be used to create UTF-8 aware applications very easily and clearly, something that's not so easy in other languages or with other frameworks.

Catalyst applications include their own web server that can be used for development much more easily than using a web server like Apache, nginx or lighttpd.

A Catalyst application can be ran as a CGI program, with mod_perl, FastCGI or even with its internal web server.

Catalyst applications are written in Perl, so you can use the tens of thousands of modules from CPAN in your app for free. It's very easy to install the modules from, using the cpan, cpanplus or cpanminus programs, but it's somewhat more difficult to install Perl modules on a web server where you don't have the root access you do on your own server or VPS. There are, however, solutions (see the shared hosting and local::lib entries in the Advent Calendar).

Catalyst has the most flexible, the most complete and the most easy to use dispatching mechanism. You don't need to specify the mappings from an URL to the targetted action as some PHP and Python frameworks require, but you can use more types of dispatching in the same application, from the very simple (and most frequently used) to the very complex ones that even let you run more actions for one request.

There are very many helper modules for Catalyst you can install from CPAN (search for Catalyst and CatalystX on that allow you to localize the application, to use a form processor, ORM, or JavaScript libraries, to generate JSON feeds, and too many others to list.

You can localize your application by using gettext .po files, Perl modules, or by using a table with translations from your database. You can even localize the words that appear in the URLs used in your app.

Catalyst offers very clear ways to define the URLs in your templates, so they will work even if one day you will configure your web server to have the application listen not to the root dir (/) but only to a certain directory under it (like /old-site/).

Perl offers you the necessary modules for creating content in the database not as HTML, but as Textile, Markdown or even BBCode (the markup used by phpBB).

In Catalyst frameworks the prefered ORM is DBIx::Class, which is an extraordinary ORM that can do very many things that the ORMS available in Ruby on Rails, Python or PHP frameworks don't even dream to do. Of course, its disadvantage is that even though it has a very clear and large documentation, it is harder to learn than other ORMS. Yet after learning it, the productivity increases very much and the code becomes much clearer. I have written large applications without a single SQL select ... from ... query, by using just DBIx::Class and I've used some very complex queries.

There are many types of base view modules you can install from CPAN that will generate the result of your application as HTML, or some that let you use different templating systems, or some that generate .csv or .xls files or other formats without any line of code.

As I said, Catalyst is very flexible and can use many modules from CPAN, and each of those modules offers you aditional benefits that won't be listed here.

When you create a Catalyst app from the command line, MyApp also creates some helper scripts that allow you to test it, to run its own web server, or to create other controllers, views and models, along with test scripts for them. Perl offers very simple and powerful testing modules that can help you create test programs with very few lines of code and Catalyst offer some aditional modules that can be used specially for testing a Catalyst app.

I've tested many PHP frameworks and all of them are very poor. Some of them don't help the developer by creating a detailed application structure, some can use just a single templating system, or just one ORM, and the ORM code examples I've seen were too low-level and not very elegant, as well as very limited.

Some PHP frameworks require the developer to define the mapping from URLs to actions in a special file, so the maintenance becomes harder, because after making some changes in the application, the changes might need to be made in the mapping file.

Form processors? I don't even know if I've seen form processors for PHP. They can be used for generating the forms, to define the constraints, the validators, the filters, special types of elements that can be composed from more HTML elements - and all this without a single line of Perl code, only by using configuration files. Configuration files that can have any format you like, like JSON, Perl hashes, Apache httpd.conf-like, YAML or others.

Catalyst offers very many (too many) plugins that can be used for authentication, authorization, caching, sending email, and many other things. You can use them with some settings in the application's configuration file and you can authenticate your visitors even without using any line of Perl code at all. And that authentication can be cookie-based or URL-based, the stored set of users can be taken from a database, or configuration files, or from Apache .htaccess files, or based on LDAP or other custom sources. And you can do all these things even without writing SQL code at all, even if you use one or more databases in your application.

I wrote these things only from memory, but I'm sure that if I'd look at a Catalyst-based app I would remember much more. But search for Catalyst on and you will see many more modules offering other features.

My tags:
Popular tags:
Powered by Catalyst
Powered by MojoMojo Hosted by Shadowcat - Managed by Nordaaker