Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: indirect object in camel book

by Anarion (Hermit)
on Oct 06, 2001 at 00:46 UTC ( [id://117149]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to indirect object in camel book

What anybody noticed of my post is the last line:
"if i dont use a typeglob on the prototype it works"
This calls the method of CGI
#!/usr/bin/perl -w use strict; use CGI; my $query=new CGI; sub new($) { print "Ouch!!\n"} my $query2=new CGI;

Then, I dont understand how is called a function or another depending of the definition of the prototype.

$anarion=\$anarion;

s==q^QBY_^=,$_^=$[x7,print


Replies are listed 'Best First'.
Re: Re: indirect object in camel book
by BrentDax (Hermit) on Oct 06, 2001 at 03:41 UTC
    It's because * in a prototype is used for a filehandle. Quick, what does this do:
    open MYCLASS, "$filename"; print MYCLASS; #print to MYCLASS or call MYCLASS->print?
    How about this?
    sub new(*) {...} open MYCLASS, $filename; new MYCLASS; #main::new(*MYCLASS) or MYCLASS->new?
    And this?
    sub new(*) {...} open CGI, $filename; new CGI; #main::new(*CGI) or CGI->new?
    In all those (except the first) it calls main::new, passing it the filehandle. And since filehandles autovivify, you don't even need to have it open()ed.

    =cut
    --Brent Dax
    There is no sig.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://117149]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.