[Wolves] Perl and CGI Books

sparkes sparkes at westmids.biz
Mon Nov 29 19:46:01 GMT 2004

Mo Awkati wrote:
> Hi 
> I bought a "in easy steps" book on PERL and got very
> interested in it. Can anyone recommend some good books
> for a beginner on PERL and CGI? I have noted from
> looking at the reviews on Amazon that some books
> assume you are using windows and others Linux, I
> obviously want Linux! :-)
BBBIIIIIIGIGGGGG anti CGI rant from someone who programs cgi and 
understands why it's a *very* bad idea for most situations.

while learning Perl is a pretty cool thing to do (I would prefer you 
said Python ;-) but Perl will do) unless you already know Perl I 
wouldn't suggest writting CGI in it.

In fact I wouldn't recommend writing *any* CGI in *any* language unless 
you already know what you are doing.  CGI allows you to open some 
massive holes in your server and Perl allows you to make those massive 
holes very, very useful to naughty people ;-)

If you want to do some web programming and don't already have a strong 
language and understand the problems of CGI I would suggest PHP.  It's a 
nasty hack of a language but mod_php is pretty much defacto in the web 
world and won't let you open up quite so many holes (at least not these 

It's not a great language for learning programming (but nor is Perl) but 
it will allow you learn how to do things without having your site played 
with like SCO's was today.  In fact I'd go so far as to say it's worse 
than BASIC was for teaching programming and I used to teach it ;-)  but 
it won't allow you to shoot yourself in the foot like CGI, well CGIis 
more like offering your gun to anyone on the street and letting them 
take potshots at anyone that takes their fancy.  Python is probably a 
better language to learn programing as it's pretty pure and allows you 
learn good habits but as (If I remember correctly) you already know a 
little programming you already have your own bad habits and both Perl 
and Python will let you keep them as well ;-)

Perl can be programmed very well but most of the examples you see on the 
internet are just quick hacks built on top of quicker hacks (this is one 
of perls strong points) and won't allow you to learn how to program 
well.  It will teach you a hell of a lot about unix like systems and 
scripting and if you want to maintain a bunch of servers it is still an 
excellent language to learn (because not only does it do everything, but 
someone has already written the everything script for you and you can 
just modify it).  So unless you are already a Perl hacker or an admin 
who wants to work more efficently (thus leaving more time for irc, games 
and updating your bofh excuse file) I would avoid Perl as a pure 
learning exercise.  That said we have some excellent Perl coders on the 
list who can help so you won't be on your own if you follow the path of 
the camel (very smelly and not as funny as the way of the python :P )

PHP code examples can be bloody awful.  Avoid 99.9% of all /large/ 
programs you see and look at some of the smaller projects to see how 
they work.  Hopefully the person who wrote them will have a clue and you 
will learn something.  PHP programmers are like BASIC programmers in the 
70's and 80's, some are very good but most are like dog turd on your 
shoe.  But it is very safe in a controlled web environment and CGI is 
not safe 99.99% of the time.

Python is just cool but the chances are your web host won't support it 
and there isn't a lot of small web projects out there to learn from so 
if web based stuff is something you want to do leave Python for another 
time.  If you just want to learn programming diveintopython.org (and 
dead tree version) and 'how to think like a computer scientist' python 
edition (google will find it) are both excellent intro's to the language 
and could be a good start into programming.

So CGI bad, Perl could be good for you, python might be good for you. 
PHP won't be good for you but will be your bitch.

one last time.


No scratch that


nope still not right....


that's better ;-)

there are millions of examples of why not to do CGI :-) and not that 
many why to do it ;-)

that said it shouldn't matter if it's windows server based or unix 
server based Perl is a pretty cross platform language (in most cases, 
you can do pretty much anything in perl these days so lots of it isn't 
cross platform) and the C in CGI stands for common so it should work the 
same on all platforms.  At least as far as learning how things work it 
will.  So which ever book takes your fancy should get you up and running.

> cheers
> Mo


<davee> "Sparkes, the Pete Best of LugRadio"

More information about the Wolves mailing list