http://qs321.pair.com?node_id=737194


in reply to newbie and perl/web development

My copy of "Learning Perl" has stuff about CGI, in chapter 19. It's an old edition, but still.

Here's a really quick lesson on how to do web pages with Perl:

  1. First, understand HTML
  2. Write a perl script which outputs HTML
  3. Put print "Content-type: text/html\n\n"; before any other output.
  4. Put it on a web server
  5. chmod it so it's executable
  6. Go to its URL

I'm being a bit facetious, but clearly that point 1. there is something of a big issue.

What you should do, as soon as you've got the absolute basics, like the above, out of the way, is to learn a templating module. I'd recommend HTML::Template, which has never let me down. I've wondered if I might outgrow it and need to use another module, but every time I've wanted to do something, it's been there in the documentation. And of course you'll need to understand the basics of CGI.pm as well.

The normal progression of someone doing web pages with perl is "lots of crappy print statements; lots of crappy HEREDOCs; use of a templating module." -- do yourself a favour and skip/spend as little time as possible on, those first two.



Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...