Had I not been at work, I might have nearly fallen off my seat laughing as I read item #3 in You Used Perl to Write WHAT?! on page 2. You see, the author is taking about where Perl is good and bad, and he says "there are some uses that just aren't right." That' followed by a list of items. Here's number three.
As a Web scripting language: One of the earliest usages of perl, as the Web evolved, was for CGI programming webpages. As a result, perl has some pretty strong packages for dealing with Web forms. There is also support for embedding perl into HTML in the same way the Java is embedded into JSP pages.
However, I would argue that more modern Web scripting languages, such as PHP and Ruby on Rails, offer more out-of-the-box Web support and a cleaner integration into the webpage experience. You should especially avoid using perl for traditional CGI-style form processing; this code tends to be hard to read and maintain because the HTML ends up inlined inside the perl code.
Uhm, WHAT?!
Now maybe it's the fact that I started coding in Perl about 12 years ago. Or maybe it's the fact that I've used it quite successfully in various web projects over the years. But suggesting that Perl isn't a good web scripting language is rather laughable.
Seriously.
Now, if you're starting from scratch and looking to learn a new language primarily for building web applications, that's one thing. Sure, look at PHP, Ruby, Python, and whatever else can do the job. But the author seems to be saying that it's worth learning yet another language simply for building web applications.
That's messed up.
Have a look around CPAN and at the web frameworks that exist around Perl and mod_perl. Heck, some of them have been around a long time and are quite mature. Saying that Perl "has some pretty strong packages for dealing with Web forms" doesn't really capture the true state of things.
I think programming language battles are as dumb as the next person, so I generally try to avoid them. But when I see stuff like this, it's hard to keep my mouth shut.
As for the claim that traditional CGI-style form processing being hard to read and maintain... WHAT?! There's nothing hard about separating the HTML from the code.
Okay, enough of my griping...
Thanks to the folks at TechCzar for translating my tech blog posts and including them in their blog network.
Posted by jzawodn at January 25, 2008 01:02 PM
Yeah, I got a little ticked off at that article. To claim that Ruby on Rails is okay, but Perl isn't seemed a little misinformed. No one really did web programming in Ruby before Rails. If it's frameworks he wants, maybe he should look at Catalyst? ;)
A reevaluation of perl is long overdue. Javascript has made a comeback. I think perl is due one too. I was at a talk Tim Bunce gave last year where he showed some perl DBI code in some slides. The code looked beautful. Someone in the audience asked "What programming language is that?". "That's perl." replied Tim in his unassuming way. People who make a living from perl don't make a fuss about how it makes them 'happier' or how beautiful their code is. They just go about their business being productive and writing code that works.
You've pretty much summed up the thoughts I had when reading the article.
I've seen more HTML and program code inlined together in PHP then I've ever seen in Perl ... and Ruby On Rails isn't a scripting language, its a framework that would be better compared to Catalyst (which is, frankly, awesome).
I agree, there's no limit to which programming language when it comes to building web applications. In fact, erlang is starting to get some attention for web applications -- check out yaws (http://yaws.hyber.org). He should try reading erlang codes, which coming from a verbose world is really a challenge.
There's also a recent talk about making a web app in about 600 lines of code with RoR, check out this web post, http://www.codinghorror.com/blog/archives/001043.html, by Jeff Atwood at http://www.codinghorror.com.
For web framework, the word "mature" is a disadvantage.
The author is entirely correct.
Only masochists and Yahoos would even consider using Perl for a web based project in this day and age. (Although the two are not mutually exclusive.)
The differences between Perl, Python, PHP, Ruby, etc are practically non-existent. Picking one over the other for reasons other than your existing code, available talent, etc is bad business sense.
One of the things I've never understood is the "religion" of Ruby, and especially Rails-- being the one true way of doing things-- and you ignore that other people have been doing the same for years.
When it comes to people talking about web development, I often think about the scale of their work. How many millions of dollars has been through your web application? If you were using this alone as a measure of a programming language for web development, I'd expect Java has a significant lead :)
The religious aspect of Ruby, and the constant reminders of "one true path" are a strategy to get Ruby into enterprises. Java was once pushed with similar things, but now there 50 Java frameworks and "enterprises" are feeling the heat in terms of complexity and cost.
The church of Ruby will fix all that.
I question this guy's street creds when he mentions PHP. Ever try to maintain or modify someone else's PHP application? Talk about a nightmarish encounter of readability. Is it such a good idea someone with no experience with no development background can pick up something like PHP? Also talking about Perl coming around full circle take a look at the feature set supported and the ideas surrounding Groovy and Grails. I am thinking Groovy, with its closures, flexible typing and support for lists and hashes is Perl reborn. Kinda funny to see all the Java developers glomming on to it these days. While I love working in Perl it does have some rough edges which made me go a different direction with my development. However I still use it to make my life easier though I haven't bothered to look into Parrot.
I totally agree with you here. I think that Perl is still a fantastic language, and I use it daily. I have also been forced to write PHP but I will still choose Perl for most everything I can.
Seems like all of the new webapps are getting written in PHP and Ruby, we need to write some good ones in Perl!
I've written web apps with Perl using both the older CGI, and the newer "embedded" Perl (Perlscript) in ASP (which can be done in Windows or non-Windows; non-Windows would be with Apache, using the ASP module for Apache). I quickly found the Perlscript with ASP to be much easier to code and maintain that the Perl CGI.
I think in a lot of situations Perl is a great tool, and especially for common web tasks. Web scraping, dealing with feeds, all that stuff, it's just very mature and well updated for it.
As an example, and I'm not saying PHP is great but it's what I use, I probably spent a month dealing with some cURL multi-exec library capacity issues, eventually solved in a new version of the PHP library for cURL. Perl's was months and months ahead on implementation, and other languages outside of C were even further behind than PHP.
Anyway, whatever gets things done. As for maintaining other people's code, I'd rather not do it in any language. I did it with Perl for a medical insurance corporation for records transfer into some HP3000 job queue and it was the least enjoyable job I've ever had. No offense, Providence Health Systems :) it looked easier than the COBOL on everyone else's screens.
Among the many laughable assertions I read in that piece, to dismiss Perl because of the cluttering of HTML intermixed with code then go one to praise PHP, had to take the cake.
There is a lot of ancient CGI code on the net responsible for this attitude. Perl is the duct-tape of the Internet, and like duct-tape it often holds together some really scary contraptions. OOP resolved this, and now PHP is nowhere near as stable or as clean as well written Perl. The trick is _finding_ the well written Perl.