[Melbourne-pm] perl, CGI and php questions

Timothy S. Nelson wayland at wayland.id.au
Mon Aug 25 18:10:45 PDT 2008

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 

 	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


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

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-

More information about the Melbourne-pm mailing list