There are really two aspects to that question, which can and should be dealt with separately:
-
There are many web-servers out there (including tiny Perl programs...), and many ways to deploy apps on those servers (FastCGI, mod_perl, etc.) It is highly desirable to be able to switch horses in mid-stream; hence the benefits of software-interface layers such as Plack. (“Design your app for Plack, and you can reconfigure Plack without having highly-pervasive changes in your application.”)
-
Within the application itself, there is usually “a whole lot of treasure-chest and only a little treasure.” The chest is basically the same no matter what goes inside, so obtain a suitable chest “off the shelf.” Hence application frameworks, such as Catalyst (and dozens of others). Always try to avoid doing something that has already been done. You want to be able to confine your interests strictly to what is actually different about your application.
This approach has a subtle added benefit: it introduces a disciplined, and somewhat distant, perspective upon your own work.
| |
Pick one and run with it :) if target PSGI/Plack, you can switch servers at any time with no code changes | [reply] |
Check out Catalyst. There are tutorials that include REST.
As the other reply indicates, the server that hosts it doesn't matter since the framework is abstracted from it. | [reply] |
thanks for the responses both
I had wondered if using a framework was the best way to go or if people tended to roll there own.
I had a look at dancer, i will look at catalyst as well cheers.
Is there a way of running the perl resources in an existing perl environment rather than a perl env being created, the code run then thrown away which is how i understand cgi works.
thanks.
| [reply] |
I find Catalyst to be more "glue logic" and "abstraction layer" and gives me all the benefit of rolling my own: I choose what to use! It just provides a nice way to tie everything together, and a cool testing environment.
Dancer is more "use what they provided".
I think you are asking about not running the script every time a request comes in, but leaving it running and handling requests. For sure; modperl is the granddaddy of that. "fastcgi" is the current approach. All that is explained in Catalyst tutorials.
| [reply] |