Perl in Web Development [closed]
I have heard a lot about using Perl in web development for CGI scripts but are they still widely used today? From a development (Not an Administrative) point of view, is it worth learning? What would be an example of something that is better handled in Perl than PHP?
Thanks
My answer is that CGI is obsolete and you shouldn’t learn web programming in Perl in combination with CGI. There’s a very nice web framework called Mojolicious, that could be a fun way to get started with web programming in Perl. Once you want to deploy your application to a server, you can use PSGI to interface between the server and your app. Dotcloud seems to be a promising, hassle-free host for such apps.
As for the PHP vs. Perl question, that’s hard to answer without causing a flamewar. For me, Perl is much more mature and better thought-out ecosystem. Opinions may vary.
Don't bother with CGI in any language (Perl, C, etc) but look at modern web frameworks. And in this area Perl is fully loaded:
- Dancer
- Catalyst
- Mojolicious
- WebNano
And since they all use PSGI you can deploy them on any server such as FastCGI, Apache/mod_perl, nginx and as legacy CGI scripts. There are also Perl specific application servers like Starman, Corona, Tatsumaki, etc.
While making subjective predicates here, is not the best idea, I can only argue with some job offer sites (as you can see, than perl still lead):
- indeed
- simplyhired
At the other side, "CGI" is archaic. Now perl developers use Plack (PSGI) and similar techniques.
I'd venture to say that nothing new is done with Perl/CGI scripts today, but there probably are a good number of legacy sites that are still implemented with Perl/CGI.
From a development point of view, I'd say it's worth spending a day or two learning CGI with Perl (provided you already know Perl). I say this because CGI (Common Gateway Interface) with Perl will expose you to the underpinnings of the web (namely HTTP POST, GET, Request Variables, Server Environment Variables). With Perl/CGI, you get to manipulate these things directly, and that hands-on ability is helpful when dealing with any of today's modern frameworks.
精彩评论