[Melbourne-pm] perl, CGI and php questions

John Thornton jdthornton at ozemail.com.au
Mon Aug 25 20:50:11 PDT 2008


Tim
    That's interesting

    The issue of a "best" programming language for the beginner to start off
with is always a contentious area.

    In the old HSC in Victoria [early to mid 80s before the VCE arrived] the
math A/B subjects had a tutorial/command list of Pascal at the back of the
math text book. I know this from fishing a math A/B book from a hop shop
bin. I am NOT that old!!!!!

    When I was at school there was a short computer unit where Basic was
taught and I absolutely hated the language. All those Go to,If then
things...to me they were so primitive and boring. 

    From what I have read Python is the most fashionable language for
beginners to program with these days. Basic is frowned upon for teaching
beginners "bad habits" whatever they may be. But I will take Perl!

   John     

-----Original Message-----
From: wayland at gwalcmai.nelson.org.au [mailto:wayland at gwalcmai.nelson.org.au]
On Behalf Of Timothy S. Nelson
Sent: Tuesday, 26 August 2008 11:11 AM
To: John Thornton
Cc: melbourne-pm at pm.org
Subject: Re: [Melbourne-pm] perl, CGI and php questions

On Sat, 23 Aug 2008, John Thornton wrote:

>
>       [1] No disrespect to perl, but why are jobsites like SEEK dominated
> by jobs in php programming in web programming?

 	Another thing no-one has mentioned; once you've learned Perl well, 
it's easier to go to other languages.  IIRC, someone mentioned earlier that 
Python had only one correct way to do it, which is their One True Python
Way. 
Most programming languages are like this to a certain extent.  Perl's motto,

on the other hand, is "There's more than one way to do it".  This means that

you can pick the most appropriate for the job, your skills, and the like. 
Because Perl is like this (and has everything in except the kitchen sink), 
it's easier to go to other languages; they all seem like cut-down versions
of 
Perl (cut down in different ways).

 	This flexibility of Perl has both advantages and disadvantages. 
Because not all the features are needed (even though they are available),
the 
learning curve is only marginally higher than with other languages such as
PHP 
and Python -- I'd estimate a few extra hours a month if you were doing 40 
hours of Perl a week (ie. not that much extra).

 	OTOH, note that I said learning curve -- you'd get all that time
back, 
and more, after a while, because, at least in my experience, Perl is the 
language that helps you go from idea to finished program the quickest; this
is 
coding time, rather than learning time, and this is where you're saving
time.

>       [2] If I make a correct script in another language, php, Java etc,
do
> I save it to the same cgi-bin that worked for perl? That is, assuming that
> again it is intended for browser formatting.

 	To expand on what someone else said, there are two main ways of
doing 
Web Programming; the CGI way, and the Apache Module way.  With the CGI way, 
Apache finds the CGI file, and runs it like any other program, and then
sends 
the output back to the browser.  So it can be written in any language, but
it 
needs to produce headers as well as content (ie. "Content-type" as well as 
HTML).

 	The Apache Module way involves getting extra modules for Apache,
such 
as mod_perl and mod_php.  Each module only works with one specific language,

but it tends to be more efficient in its use of resources.  mod_php also has
a 
templating system built in, whereas mod_perl doesn't.  Perl, though, has a 
number of templating systems that you can use (ie. it's good to have both 
mod_perl and the templating system; while each can be used separately, it's 
generally more useful to combine them).  As I've mentioned before, the 
templating system I favour is HTML::Mason.

 	So, here's a summary of my recommendations:

Both models: Apache, perl

CGI model: CGI module, easier setup, but more programming effort

Apache module model: mod_perl, HTML::Mason module; more setup, but easier
 	programming

 	HTH,


---------------------------------------------------------------------
| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: wayland at wayland.id.au    | I am                           |
---------------------------------------------------------------------

----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- 
PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----


More information about the Melbourne-pm mailing list