[LWN Logo]
[Timeline]
From: "Tommy Butler" <tommy@atrixnet.com>
Newsgroups: comp.lang.perl.moderated
Subject: Calling all OO heads. W3.pm needs you.
Date: Fri, 29 Dec 2000 12:39:36 -0800

Hey, Perl Hackers.  Here's one to chew on:

DAVE CROSS -
> I've seen probably hundreds of CGI param parsing functions over the last
> four years. Of that number I can remember about five that didn't have a
> serious bug in them (generally the multi-valued parameter bug or a subtle
> varient). If reimplementing basic functionality like this is such a good
> idea, then why do so many people get it wrong time and time again?

The more often you do something, the more chances you give yourself to botch
it up I guess.

JEFF PINYAN -
> The few lines of code does the job THIS time.  Then you try to use it
> another similar case, but maybe it won't work correctly there.  So you
> need to beef it up a bit.  With CGI queries, I'd say a handful of people
> know what they're doing, and have actually read documentation on how it
> works.  Sure, you could write code that reads a GET query.  And one that
> reads a POST query.  And then wonder why neither seems to work with a file
> upload.  And then try to munge something else up.  But CGI.pm knows what
> it's doing -- it's kid-tested, mother-approved.

Sure is.  Tried and true.  But...

$BILL LUKEBERT -
> In my case, I don't want that humongous module loaded just for parsing and
> I do a couple of special things in my parsing that are not in CGI.  Also
> I don't consider my code any more home-grown than Lincoln's code and much
> more specific to my needs. :)

DAVE CROSS -
> ...but surely you must agree that reuseable code is a good idea?

"Laziness, impatience and hubris" 2 out of 3. -Yep. The average perl hacker
would.  So what's the solution here?

DAVE CROSS -
> If you've got a better (or faster or lighter
> or more flexible) piece of code for parsing CGI parameters, why not bundle
> it up into a module so that you can reuse it in all of your scripts
> without cut-and-paste.

Ok.  Why not...  'Cause you know, just the other day I was thinking, "this
might be fun."  So I started writing W3.pm to accomplish exactly those
objectives which you just read above in Dave's suggestion.  But I'm a fairly
limited person all by myself.  I was hoping that we might all make this a
team effort -- kind of like SETI, MOZILLA, or Apache but on a smaller scale
(after all, that *is* the point.)  I'm gonna make the code, and any
accompanying files for W3.pm available at
ftp://tommybutler.com/pub/perl/modules/W3.zip with the hopes that you OO
heads out there like JAPHY take a shine to the idea and help me out.

Now W3.pm does some pretty cool stuff.  So far it gives you the ability to
use embedded perl in templates you create too.  It needs help though, both
in the documentation area, and in the code itself.  For example, just as
Dave mentioned, I still haven't given it the power to read multi-part form
data for uploads.  See a working version of the code at
http://tommybutler.com/cgi-bin/testW3.cgi/virtual/path/info/right_here?hi=1;
foo=my%20second%20param&bar=yet+another;tommy=me...&alpaca=a+camel;Larry=a+g
ood%20guy


        - tommy, yetanother.perlhacker@atrixnet.com


AND JUST FOR FUN...

DAVE CROSS -
> I don't believe that modules are a cure-all...

Sure they are!  My modules will take 10 pounds off your flabby tummy in less
than 30 days or your money back!  And they're FREE!  They prevent male
pattern baldness, take the dog on walks, keep you cool in summer, warm in
winter -- They cure cancer, and remove warts!  They will even make you
irresistable to women ( or men... depending on which way you go )!  But
wait, there's more!

When you 'use' one of my modules in the next 30 minutes, we'll through in a
free set of ginsu knives!  You heard right!  A 50 dollar value for FREE when
you do{} it NOW!