develooper Front page | perl.perl5.porters | Postings from May 2013 is dead, long live

Thread Previous | Thread Next
Aristotle Pagaltzis
May 27, 2013 23:20
Subject: is dead, long live
Message ID:
Hi Johan,

* Johan Vromans <> [2013-05-26 21:25]:
> Aristotle Pagaltzis <> writes:
> > ... where did you get the idea to look into CGI in 2013? Not from
> > any recent “web dev 101” intro.
> True, my generation grew up with CGI. As a matter of fact,
> I co-authored one of the very first books on using Perl on the web in
> 1995.
> So apparently your main point against is that the ancient
> knowledge of the CGI protocol is lost?

my point is actually two-fold:

• CGI is not the same as You don’t have to be using if
  you are doing CGI – many of us have done it with nothing in the past,
  or you can use something else than to do CGI.

• CGI is not the only deployment option and indeed if you are running
  a web app rather than adding a guestbook or some such into a mostly
  static web site, then it’s certainly not the best one. But it remains
  *a* deployment option that can sometimes be easier than others.

In both of these senses, Plack has you covered.

It also has a much better factored design. It doesn’t do HTML, by itself
it doesn’t even do query string parsing – but it does ship with classes
that will take care of that part for you if you wish. And the APIs there
all around take care to avoid repeating the mistakes that made.

> If I'd want a trivial web app that shows me yesterday's SinFest comic,
> I'd use and 10-20 lines of Perl code. It would work on every
> web host that has Perl. What would be your approach?

You can write a script using Plack that you can then deploy as a CGI –
as one among any number of deployment options. I would be unsurprised to
find Plack was faster than under those circumstances, in fact, as
the latter is quite a dog really. (Performance was a major selling point
for CGI::Simple back in the day… hoo boy those were the times. Party in
the Perl Monks chatterbox all night long…)

Have I mentioned that it’s drop dead cool to be able to wrap middlewares
around your CGI script, just like that? Instead of fiddly hacking with
webserver configs or trying to make ugly monkey-patch extensions
work right when you combine them, you drop a line or two in your script,
like in any other PSGI app, and presto, you’re off to the races.

It’s all so, so, so much better and cleaner and saner than ever
could be. Why would we be so cruel as to foist that relic on any newbie?
By all means, keep writing CGI scripts, but do yourself a favour, let
the bygones be bygones and join us in the future. It’s a bright
day out here.

Aristotle Pagaltzis // <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About