Re: [ILUG] developerWorks article...

From: Peter Heslin (Peter.Heslin at domain ucd.ie)
Date: Mon 15 May 2000 - 11:04:17 IST


On Sun, May 14, 2000 at 05:42:39PM +0100, kevin lyda wrote:
> for those of you interested in learning how to do scripting on linux,
> see here:
>
> http://www-4.ibm.com/software/developer/library/script-survey/
>
> while it's focusing on cgi a lot is applicable to everyday stuff. note
> at the bottom that there are some links to other scripting tutorials
> including two on bash.

Given that the author presents for comparison the same operations as
written in five different languages, it's inevitable that he is not as
skilled in some as in others, but there are some real oddities there,
and I would be wary of selecting a scripting language based on these
examples.

In Python he rightly uses the cgi module to parse the form elements,
but in Perl he writes up a homemade routine rather than using the CGI
module, which is just as standard a part of Perl as cgi is in Python.
He then gives the helpful suggestion that you should merrily
cut-and-paste his own ad hoc solution into every one of your Perl cgi
scripts. Pushing cargo-cult code on newbies instead of a standard, well
documented and very robust module seems unhelpful.

Under the heading `Task 5' he says that some languages (Python, Perl)
are suitable for reading all of the lines of a file into an array at
once, while others (Tcl, Java, PHP) are `better suited' to reading a
file line-by-line. I cannot see the rationale for this distinction at
all. For example, the author gives the impression of being unaware of the very
common Perl idiom for chunkwise reading: while (<IN>) { ... }. He
does not mention the issue of scalability, which is surely the most
important difference between these two styles of file access.

Peter



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:08 GMT