On Tue, Aug 08, 2000 at 11:36:38PM +0200, Bart Lateur wrote:
> My idea is: "Don't do it". Let me point to just one example: CGI.pm.

[ snip ]

> This is a bug waiting to happen. Suppose you call it as a function, but
> with a literal string:
> 
>       $x = param('x');        # Will work
>       $cgi = param('CGI');    # Oops! Major goof here!
> 
> It will barf on the latter, because the sub "self_or_default" will think
> it is called as a class method, but it isn't.

But that's the *only* string for which it screws up.  Does CGI.pm not
document that you can't have a parameter named 'CGI'?

> Lesson to be learned: this is a bug caused by poor design. 

Perhaps.  But I believe that all of the modules provided as part of
the standard perl distribution should have both procedural and OO
interfaces where possible.  CGI.pm does this in the best way the
author knew how.  In perl 6 we'll (hopefully!) have Damian Conway's
want() that'll make it a little easier  :-)

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to