The Long Death of CGI.pm

CGI.pm has been removed from the core Perl distribution. From 5.22, it is no longer included in a standard Perl installation.

There are good technical reasons for this. CGI is a dying technology. In 2015, there are far better ways to write web applications in Perl. We don’t want to be seen to encourage the use of a technology which no-one should be using.

This does lead to a small problem for us though. There are plenty of web hosting providers out there who don’t have particularly strong Perl support. They will advertise that they support Perl, but that’s just because they know that Perl comes as a standard part of the operating system that they run on their servers. They won’t do anything to change their installation in any way. Neither you nor I would use a hosting company that works like that – but plenty of people do.

The problem comes when these companies start to deploy an operating system that includes Perl 5.22. All of a sudden, those companies will stop including CGI.pm on their servers. And while we don’t want to encourage people to use CGI.pm (or, indeed, the CGI protocol itself) we need to accept that there are thousands of sites out there that have been happily using software based on CGI.pm for years and the owners of these sites will at some point change hosting providers or upgrade their service plan and end up on a server that has Perl 5.22 and doesn’t have CGI.pm. And their software will break.

I’ve always assumed that this problem is some time in the future. As far as I can see, the only mainstream Linux distribution that currently includes Perl 5.22 is Fedora 23. And you’d need to be pretty stupid to run a web hosting business on any version of Fedora. Fedora is a cutting edge distribution with no long term support. Versions of Fedora are only supported for about a year after their release.

So the problem is in the future, but it is coming. At some point Perl 5.22 or one of its successors will make it into Red Hat Enterprise Linux. And at that point we have a problem.

Or so I thought. But that’s not the case. The problem is here already. Not because of Perl 5.22 (that’s still a year or two in the future for most of these web hosting companies) but because of Red Hat.

Red Hat, like pretty much everyone, include Perl in their standard installation. If you install any Linux distribution based on Red Hat, then the out of the box installation includes an RPM called “perl”. But it’s not really what you would recognise as Perl. It’s a cut down version of Perl. They have stripped out many parts of Perl that they consider non-essential. And those parts include CGI.pm.

This change in the way they package Perl started with RHEL 6 – which comes with Perl 5.10. And remember it’s not just RHEL that is affected. There are plenty of other distributions that use RHEL as a base – Centos, Scientific Linux, Cloud Linux and many, many more.

So if someone uses a server running RHEL 6 or greater (or another OS that is based on RHEL 6 or greater) and the hosting company have not taken appropriate action, then that server will not have CGI.pm installed.

What is the “appropriate action” you ask. Well it’s pretty simple. Red Hat also make another RPM available that contains the whole Perl distribution. So bringing the Perl up to scratch on a RHEL host is as simple as running:

yum install perl-core

That will work on a server running RHEL 6 (which has Perl 5.10) and RHEL 7 (which has Perl 5.16). On a future version of RHEL which includes Perl 5.22 or later, that obviously won’t work as CGI.pm won’t be part of the standard Perl installation and therefore won’t be included in “perl-core”. At that point it will still be a good idea to install “perl-core” (to get the rest of the installation that you are missing) but to get CGI.pm, you’ll need to run:

yum install perl-CGI

So this is a plea to people who are running web hosting services using Red Hat style Linux distributions. Please ensure that your servers are running a complete Perl installation by running the “yum” command above.

All of which brings me to this blog post that Marc Lehmann wrote a couple of days ago. Marc found a web site which no longer worked because it had been moved to a new server which had a newer version of Perl – one that didn’t include CGI.pm. Marc thinks that the Perl 5 Porters have adopted a cavalier approach to backward compatibility and that the removal of CGI.pm is a good example of the problems they are causing. He therefore chose to interpret the problems this site was having as being caused by p5p’s approach to backward compatibility and the removal of CGI.pm.

This sounded unlikely to me. As I said above, it would be surprising if any web hosting company was using 5.22 at this point. So, I did a little digging. I found that the site was hosted by BlackNight solutions and that their web says that their servers run Perl 5.8. At the same time, Lee Johnson, the current maintainer of CGI.pm, got in touch with the web site’s owner who confirmed what I had worked out was correct.

Later yesterday I had a conversation with @BlackNight on Twitter. They told me that their hosts all ran Cloud Linux (which is based on RHEL) and that new servers were being provisioned using Cloud Linux 6 (which is based on RHEL 6).

So it seems clear what has happened here. The site was running on an older server which was running Cloud Linux 5. That includes Perl 5.8 and predates Red Hat removing CGI.pm from the “perl” RPM. It then moved to a new host running Cloud Linux 6 which is based on RHEL 6 and doesn’t include CGI.pm in the default installation. So what the site’s owner said is true, he moved to a new host with a newer version of Perl (that new version of Perl was 5.10!) but it wasn’t the new version of Perl that caused the problems, it was the new version of the operating system or, more specifically, the change in  the way that Red Hat (and its derivatives) packaged Perl.

Marc is right that when Perl 5.22 hits the web hosting industry we’ll lose CGI.pm from a lot a web servers. You can make your own mind up on how important that is and whether or not you share Marc’s other opinions on how p5p is steering Perl. But he’s wrong to assume that, in this instance, the problem was caused by anything that p5p have done. In this instance, the problem was caused by Red Hat’s Perl packaging policy and was compounded by a hosting company who didn’t know that upgrading their servers to Cloud Linux 6 would remove CGI.pm.

RHEL 6 was released five years ago. I suspect it’s pretty mainstream in the web hosting industry by now. So CGI.pm will already have disappeared from a large number of web servers. I wonder why we haven’t seen a tsunami of complaints?

Update: More discussion on Reddit and Hacker News.

LPW Slides

A more detailed write-up of the LPW will follow in the next few days. But in the meantime, here are the slides to the three talks I gave.

 

 

London Perl Workshop 2015

This time next week we will all be enjoying the London Perl Workshop. I thought it was worth looking at what the day has in store.

As always (well, except that one time when they had no power) the LPW will take place at the Cavendish Campus of the University of Westminster. I’m told there are exams or something like that taking place on the same day, so it’s important to follow the signs when you get there or you might end up in the wrong place being forced to take an exam.

The workshop starts at 9am, but registration queues can be quite long, so I’d recommend getting there half an hour or so earlier than that. If you get lucky and register quickly, then why not look for an organiser and volunteer to help out for a while.

You’ll want to be in the main room for the welcome address at 9am – just in case there’s any important news about the day. But the talks start at 9:10.

My ‎Modern Perl Web Development‎ course starts then. Hopefully it will be in my usual classroom. Alteratively, Andrew Solomon’s Crash course on Perl, the Universe and Everything‎ starts at the same time and goes on much longer. Or you might want to see some shorter courses. If I wasn’t running my training, I’d want to see Tom Hukins talking about ‎Escaping Insanity‎ and Rick Deller on Developing Your Brand – from a job seeker , Business to sole contractor/consultant‎ – he assures me that his slides are no longer the shocking pink he has used in previous years.

At 11:00 there’s a coffee break sponsored by Evozon. My training finishes at that point, so I’m free to see a few talks. Unfortunately, I want to see all of the talks in the next slot. I suspect I’ll end up seeing Neil Bowers’ Boosting community engagement with CPAN‎ and Smylers’ ‎Don’t Do That: Code Interface Mistakes to Avoid‎, but I could well be tempted into Aaron Crane’s Write-once data: writing Perl like Haskell‎ instead. Or, back on the workshop track, there’s Dominic Humphries on From can to can’t: An intro to functional programming. Just before lunch, I think I’ll see Neil Bowers again. This time he’s talking about Dependencies and the River of CPAN.

After lunch there’s another session where I want to see everything. I’d love to see Stevan Little talking about his latest iteration of the p5-mop, but I suspect I’ll end up seeing Leon Brocard on Making your website seem faster‎ followed by Kaitlyn Parkhurst on Project Management For The Solo Developer. Dominic’s functional programming workshop continues after lunch and is joined by John Davies and Martin Berends talking about Parallel Processing Performed Properly in Perl on Pi‎.

The big talk after the next short break is going to be Matt Trout on A decade of dubious decisions‎ but it’s another I’ll miss as I’m talking about Conference Driven Publishing‎ in another room during the second half of it. During the first half I’d recommend Steve Mynott’s Perl 6 Grammars‎.  But, I saw him practice it at a recent London Perl Mongers technical meeting, so I’ll be seeing Andrew Solomon explaining How to grow a Perl team‎. In the workshop stream, Christian Jaeger will be covering Functional Programming on Perl‎.

Then there’s another coffee break (this time sponsored by Perl Careers) and then we’re into the last few sessions. In the first you have a choice between Jeff Goff on From Regular Expressions to Parsing JavaScript: Learn Perl6 Grammars‎ and Theo van Hoesel on ‎Dancer2 REST assured‎. I think I’ll be in Theo’s talk.

These are followed by Jonathan Worthington’s keynote – The end of the beginning‎ and the lightning talks. It will, no doubt, be a great end to a fabulous day.

The London Perl Workshop is always a great day a learning about Perl and catching up with old friends. And because of the brilliant sponsors, it doesn’t cost the attendees a penny.

If you’re going to be near London next weekend and you have any interest in Perl, then why not register and come along?

Here’s a brief video of last year’s workshop.

Training Courses – More Details

Last week I mentioned the public training courses that I’ll be running in London next February. A couple of people got in touch and asked if I had more details of the contents of the courses. That makes sense of course, I don’t expect people to pay £300 for a days training without knowing a bit about the syllabus.

So here are details of the first two courses (the Moose one and the DBIx::Class one). I hope to have details of the others available by next weekend.

Object Oriented Programming with Perl and Moose

  • Introduction to Object Oriented programming
  • Overview of Moose
  • Object Attributes
  • Subclasses
  • Object construction
  • Data types
  • Delegation
  • Roles
  • Meta-programming
  • Further information

Database Programming with Perl and DBIx::Class

  • Brief introduction to relational databases
  • Introduction to databases and Perl
    • DBI
    • ORM
  • Schema Classes
  • Basic DB operations
    • CRUD
  • Advanced queries
    • Ordering, joining, grouping
  • Extending DBIC
  • Further information

If you have any further questions, please either ask them in the comments or email me (I’m dave at this domain).

And if I’ve sold you on the idea of these courses, the booking page is now open.

Public Training in London – February 2016

For several years I’ve been running an annual set of public training courses in London in conjunction with FLOSS UK (formerly known as UKUUG). For various scheduling reasons, we didn’t get round to running any this year, but we have already made plans for next year.

I’ll be running five days of training in central London from 8th – 12th February. The courses will take place at the Ambassador’s Hotel on Upper Woburn Place. Full details are in the process of appearing on the FLOSS UK web site, but the booking page doesn’t seem to be live yet, so I can’t tell you how much it will cost.

We’re doing something a little different this year. In previous years, I’ve been running two generic two-day courses – one on intermediate Perl and one on advanced Perl. This year we’re running a number of shorter but more focussed courses. The complete list is:

  • Object Oriented Programming with Perl and Moose (Mon 8th Feb)
  • Database Programming with Perl and DBIx::Class (Tue 9th Feb)
  • An Introduction to Testing Perl Programs (Wed 10th Feb)
  • Modern Web Programming with Perl (two day course – Thu/Fri 11th/12th Feb)

This new approach came out of some feedback we’ve received from attendees over the last couple of years. I’m hoping that by offering this shorter courses, people will be able to take more of a “mix and match” approach and will select courses that better fit their requirements. Of course, if you’re interested, there’s no reason why you shouldn’t come to all five days.

I’ll update this page when I know how much the courses will cost and how you can book. But please put these dates in your calendar.

Update: And less than 24 hours after publishing this blog post, the booking page has gone live.

Places are £300 a day (so £600 for the two-day course on web programming) and there’s a special offer of £1,320 for the full week.

Prices are cheaper (by £90 a day) for members. And given that an annual individual membership costs £35, that all sounds like a bit of a no-brainer to me.