On Tue, Aug 11, 2009 at 05:45, Jenn G.<practicalp...@gmail.com> wrote:
> On Tue, Aug 11, 2009 at 2:33 PM, Uri Guttman<u...@stemsystems.com> wrote:
>>>>>>> "JG" == Jenn G <practicalp...@gmail.com> writes:
>>
>>  JG> When I create a package, and call its methods by both object way and
>>  JG> function (exported) way, how to avoid the conflict in arguments
>>  JG> passing?
>>
>> why are you trying to do OO and procedural calls on the same subs? it
>> makes no sense. how will a procedural find the 'object' the method style
>> is going to use for its data? there is a technique for using procedural
>> calls with a singleton object but that requires you assume only one
>> object of that type ever. i don't think you seem to want that.
>>
>
> Really? Hmm, see these below:
>
> # perl -e 'use CGI qw/header/; print header()'
> Content-Type: text/html; charset=ISO-8859-1
>
> # perl -e 'use CGI; my $q=CGI->new; print $q->header'
> Content-Type: text/html; charset=ISO-8859-1
snip

The reason CGI has a procedural interface is because so much code was
written using it before the OO interface was designed.  It is a
backwards compatibility layer.  If you are writing a new module, you
have no backwards compatibility needs, so don't clutter up your code
with a secondary interface (unless you have a really good reason you
haven't shared yet).

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to