Skip to Content

How the web was lost Syndicate content

Dave Sherohman's picture

There was a time when Perl, operating through CGI, ruled the web as king of dynamic sites. Things have changed quite a bit since then. Perl has grown to become a much stronger language, but it has also fallen from favor and lingers in the broader software development community's eye primarily as a whipping boy to be brought out only as a source of horror.

How did this happen?

We do have a legacy of poorly-structured, obfuscated, insecure Perl 4 code to overcome, which doesn't help matters any. This is being addressed by the "Modern Perl" and "Enlightened Perl" camps, including the Enlightened Perl Iron Man Challenge which I am participating in, and their efforts to show that it's not only possible, but easy to write well-structured, maintainable, elegant code in Perl 5. CPAN provides us a wealth of development frameworks, reusable objects, and everything else that today's developers expect to find in a language, and Modern/Enlightened Perl encourage heavy use of them.

Unfortunately, this is solving the wrong problem.

Despite the near-ritualized expressions of disgust that so often come about in conjunction with any mention of Perl programming, I do not believe that the cruftiness of older Perl code was the primary cause of the language's fall from grace. As evidence, I cite its primary replacement, which still dominates web-based applications today: PHP. Very, very few of the standard complaints about how awful Perl (supposedly) is are not also true of PHP, plus PHP has its own layers of issues, yet it remains widely used and is not reviled nearly so widely nor so vocally as Perl.

If it wasn't cleaner syntax/improved readability/better object-orientation that allowed PHP to usurp Perl, then what was it?

Ease of use for the casual user. For someone who just set up an account at Random WebHosts, Inc. and wants to make himself a blog. Note also that, in this case, "ease of use" mostly means "ease of installation". This is why Modern/Enlightened Perl is unlikely to succeed at getting Perl to be used more widely - and may even prove counterproductive.

Within the Modern/Enlightened Perl sphere, there has been a recent discussion of long dependency chains and whether they're a good thing or a bad thing. dagolden has argued that dependency chains are fine, so long all the pieces work correctly, in his post Dependencies don’t matter — but stability does. Dave Rolsky has taken an even stronger position, proclaiming that Dependencies Rule (and that anyone who disagrees with him is a "whiner").

They're both completely right, within the context of Perl developers. If you are writing the code yourself and deploying it on machines that you or your company/client control completely, then it's great to be able to pull in a ton of already-written, well-tested code that you don't have to create or debug yourself. Even if you don't have full control of the server, you can still install CPAN modules as a non-root user, at least so long as you have access to a shell (and a compiler if any of the modules use XS).

But what about that casual user? He doesn't control the server. If he has shell access, there's a good chance he may not know it. Even if he does, he doesn't know how to do a CPAN install, regardless of whether he's root or not.

If that user is presented with the options of "Unzip the WordPress archive into your web root directory, create a database, load up this page to configure it, and you're done!" or "Cross your fingers and hope your web host already has these 57 dependencies installed. If not, install them all on your local machine, then make these configuration changes and ftp them to your web host, which should work unless one or more of them uses XS, in which case you'll also need to get command-line access to a machine with a C compiler capable of building binaries for your host's OS and CPU architecture. Then you can start on actually installing this application...", then which one is he going to pick?

In the vast majority of cases, it doesn't matter how much better, cleaner, or shinier the Catalyst/Moose/DBIx::Class/CPAN-kitchen-sink-based Perl application might be, he's going to go with the PHP option instead because he can install it quickly and easily with a good level of confidence that it will just work. Even if his web host already has all of the dependencies available, he's more likely to know up front that PHP and MySQL are installed than that Perl and MySQL and Catalyst and Moose and... are. If he doesn't know, he's probably going to check the short list first and not bother digging into the long list when he sees that everything on the short one is there.

Modern/Enlightened Perl and extensive code reuse (with the resulting dependency chains) are great for producing solid code targeted to Perl developers and enthusiasts or their employers/clients. But the goal of returning Perl to a position of being widely used and respected by those outside of the Perl community requires a focus on ease of installation and use, which means self-contained code with a minimum of dependencies.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Better packaging and installation

Anonymous's picture

While in general I agree with your point I think the solution should be in better packaging. So on one hand it is OK that a Catalyst reuses half of CPAN if there is also a package - possibly including already compiled C libraries - that contains all the dependencies.

re: Better packaging and installation

Dave Sherohman's picture

So long as it's packaging that's accessible to the guy who's using a budget web host that only allows ftp access, then I think that would be an excellent solution to the problem of using modern features (and the dependencies they bring) while also remaining usable by the widest possible audience. XS modules would remain a problem, unless OS/platform-specific packages are provided, but my impression is that they're relatively few and far between anyhow.

re: Better packaging and installation

Anonymous's picture

I agree that installation is more painful than it should be. The tools are finally settling into something that can make this much easier than i t is now. Things like local-lib mean that developers could create a snapshot tarball similar to the way WebGUI or MovableType install their "base" now. This won't solve the binary issue in a cross platform way, but I think getting a reasonable set of extended Core modules that are a standard Web stack would help. The EPO has a project to define just a set of modules, the target audience is web-companies but the stack could easily cross over into a hosted environment. What the Perl community really lacks though are people with the energy to actually sort out how to use the tools we have, or figure out what tools are missing, to accomplish these goals. I'm giving a talk at YAPC about the EPO's Extended Core, and I know Matt Trout and Mark Keating will both be talking about these issues from the EPO's point of view, it would be really wonderful if we could point to work you (or someone like you) has done and say "Here's a project that is solving this, and he could use some help!".

I agree with EPO's goal of an

Anonymous's picture

I agree with EPO's goal of an extended core. It's a good project.

There is a tool already that essentially provides methods to create and use what you call a snapshot tarball. It's PAR and uses the zip format instead of tar.gz. Maybe if PAR support was available out of the box, part of the problem would go away.

It's more likely to be

Dave Sherohman's picture

It's more likely to be someone like me than me in the "between now and YAPC" timeframe, as my coding time is currently going towards a company with their own servers, so I can use the full Modern/Enlightened Perl approach without having to worry about installability on budget web hosts. The next time I get into a project where that's a concern, though, I'll definitely take a closer look at local::lib and, if there isn't already someone doing it, see what I can come up with in the way of a good packaging system for that kind of situation.

Coming from someone that

Anonymous's picture

Coming from someone that wrote an editor which takes up 2-3 gigabytes with dependencies of half of CPAN and whose all binary packages are either broken or just don't work I would be wary of any of your advice Gabor , just sit down , go hide somewhere and start learning to code.

Coming form someone that

Anonymous's picture

... doesn't even reply with their real name, this kind of criticism is less than pointless.

Do we want to replace PHP?

Anonymous's picture

There's a large world beyond the casual user. How many casual developers use Java? Very few, but it's still one of the most popular languages. I think that's the niche we should be targetting. I know people have been predicting Java's demise for some time, but it can't last forever. And it's reasonably likely a dynamic language will replace it.

I'm not suggesting we ignore the problems of the casual users. I just don't think we should optimise for them.

Casual Java developers

Dave Sherohman's picture

You're spot-on about the casual Java developers. It would be a huge boost to the Perl community if we were able to draw them in and Modern/Enlightened Perl is likely to be a key piece of making that possible.

But I'm not aware of anyone writing (server-side) Java that's aimed at technically-unsophisticated users who are going to just walk away from anything that takes more than three steps to install.

I don't see long dependency chains or semi-involved install processes as an issue for the audience that's being targeted by Java, but, if Perl is to get back to being as widespread as it was back in the day, we also need to make it accessible to the much broader casual user audience. I suppose my position comes down to yet another case of TIMTOWTDI: There are times to use half of CPAN to get all the power available in the hands of those who know Perl, but there are also times to back off and avoid dependencies (especially non-pure-Perl dependencies) so that those who don't know Perl will still be able to easily use it.

Barriers for new users

Anonymous's picture

Lack of documentations adds another "pita" on why it's hard to attract new users(advanced the user base) to Perl, I tried to search something for my pet project, I got Catalyst(well documented but hard to install) at least for my stage, Mojo/Mojolicious(easy to install don't have a lot of deps but don't have a decent docs geared for a new users, I'm hopeful grant will be finish).

This is just constructive criticism, as myself I didn't do anything to help.

I started out writing in C.

Anonymous's picture

I started out writing in C. I worked with a PHD candidate who kept telling me - forget "C" - you need to check out Perl. I did, and immediately quit writing C progs and shell scripts to glue it all together - this was a long time ago. These days I'm forced to used PHP because the company I work for thinks it's better than Perl. What it is - is a sub-basic language that you can put out a cattle call for programmers and get a big response. I was hired as a Perl programmer but quickly learned they were "moving away" from it. One look at the existing code and I knew why. A few months in and I learned that the Perl progammers that wrote the non-functioning Perl code were in charge of the PHP development. Then the economy went to hell. Now I'm just filling a seat - looking something better.

Anyone who would consider PHP for a critical application is an idiot.

Uh, no

Anonymous's picture

First of all, PHP has *vastly* superior OO support. Perl's is just a slight step above what C provides (i.e. the ability to make your own virtual tables, and make your code conventions use them).

Second of all, there is just need for perl. Anything perl can do some other language already does better. I know learning perl was really hard and that makes you fear learning something new, but get over that fear. Most any modern language can be learned in a vastly shorter time than it takes to learn perl, so stop trying to stick in the past. Just learn a modern language and see how much easier programming can be.

I have a bad feeling about this...

Dave Sherohman's picture

I can't escape the feeling that I really shouldn't bother to reply to this, but... Have you read chromatic's series about roles in Moose? Or even just about Moose itself? It's a very solid OO implementation with features (such as roles) which are present in very few, if any, other languages.

You are also wrong to assume that Perl programmers "fear learning something new". Most of us, including all of the top-tier Perl programmers, are polyglots, not language purists.

And, no, learning Perl wasn't "really hard". Learning Perl was really fun, as is using it. The only language I've ever had nearly as much fun working with was Scheme, but I never quite figured out how to make it do anything useful, so it fell by the wayside.

Mojo does well on the dependency front.

Anonymous's picture

Perl has always been about allowing for more than one way, and there are people who are mindful of the challenges that dependency-heavy projects can bring and are purposefully writing lightweight code with minimal dependencies to address this.

Here are a few examples on the web framework front:

Mojo (by Sebastian Riedel) does a really good job at minimizing non-core dependencies. I don't think it even has any. I also feel that it is cleanly written, and I intend to write an adapter so that my own framework can work on top of it.

My own framework, Squatting has only one non-core dependency that is absolutely required and that's Class::C3::Componentised. However, I made it so that doing a CPAN install will pull in a bit more, because there are a few modules that I like to have around. On the bright side, the core of my framework is less than 4K of code.

Those who are looking for lightweight alternatives are encouraged to have a look. Remember: there's more than one way to do it, especially in Perl.

Post new comment