Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: why is a 2-argument bless not working in my situation

by Hofmator (Curate)
on Mar 31, 2004 at 09:00 UTC ( [id://341256]=note: print w/replies, xml ) Need Help??


in reply to Re: why is a 2-argument bless not working in my situation
in thread why is a 2-argument bless not working in my situation

However, Perl is not psychic. So, when you see most constructors ending with:   bless $self, $class; $self is not modified.
This is wrong, $self is modified. Try e.g. this:
sub foo { my $self = {}; bless $self, 'Bar'; return $self; } print "isa Bar.\n" if foo()->isa('Bar');

-- Hofmator

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://341256]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-25 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found