[NBLUG/talk] I hate perl. :-)

Troy Arnold troy at zenux.net
Wed May 31 16:32:32 PDT 2006

On Wed, May 31, 2006 at 01:39:21PM -0700, Lincoln Peters wrote:
> I'm surprised that, in the 2 days or so since this discussion began, 
> nobody has made reference to the virtues of the Perl DBI 
> <http://dbi.perl.org/>.  In the database class I took this Spring at 
> SSU, I figure that the entire mess of JSP and Java code I had to write 
> for my front-end application could have been done in less than 100 lines 
> of Perl code.
> Although to be fair, I've been told that there is now a DBI for PHP, 
> which could reduce the amount of code even further, but I haven't tried 
> to use it (I need to learn PHP first!).

I've mentioned this before, but I like the adodb database abstraction
layer: <http://phplens.com/adodb/>

The documentation is fairly complete, but also fairly messy.
Some handy methods include:
    Executes the SQL and returns the first field of the first row. 

    Executes the SQL and returns the first row as an array.

    CacheGetRow([$secs2cache,] $sql)
    Similar to above Get* functions, except that the recordset is serialized
    and cached in the $ADODB_CACHE_DIR directory for $secs2cache seconds. Good
    for speeding up queries on rarely changing data.

That should give a taste of the kind of convenience methods included.
Adodb supports query caching, bind parameters (placeholders), and has
a nice session store backend.

> (Why would anyone use JSP over Perl or PHP?  I don't know; I've heard 
> arguments that JSP is faster, but the way I see it, if you're trying to 
> justify the use of anything based on Java for reasons of performance, 
> then something is horribly wrong!)

Well, with JSP you have possibility of having a persistent  application
that completely skips the whole dynamic compilation phase.  You also have
the advantage (esp. as compared to PHP) of a much more consistent and
organized language.  Basically Java is a designed language vs. the
grown/hacked on mess of inconsistency that PHP is.

-t (who despite that wonderful testimonial still writes gobs of PHP)

More information about the talk mailing list