Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: Re: OO Perl: calling a constructor within a classby gbarr (Monk) |
on Sep 26, 2001 at 20:49 UTC ( [id://114860]=note: print w/replies, xml ) | Need Help?? |
In general using this code can cause an error, unless you can be sure that if $me is a reference that it is a blessed reference.
It is this that led to people doing if(ref($me) && UNIVERSAL::isa($me,'my_class_name')) { which is ugly, IMO. The Scalar::Util package, that as of 5.7.2 is part of the perl distribution, contains a sub blessed() to get around this if(blessed($me) && $me->isa('my_class_name')) {
In Section
Seekers of Perl Wisdom
|
|