if(ref($me) && UNIVERSAL::isa($me,'my_class_name')) {
If you're doing a functional call, then there's no reason for the 'ref($me) &&' in that expression, though I think you get a warning on earlier versions of perl (not sure how early) if '$me' is undefined, so you might say:
Then again, you could just leave out the first part and turn off warnings locally :-)if(defined($me) && UNIVERSAL::isa($me,'my_class_name')) {
Update: Correction by tye duly noted.
If I could transfer all the votes/XP from this node to yours I would...(maybe it could be a feature that our overworked fearless leader could implement someday :)
In reply to Re: Re: Re: Re: OO Perl: calling a constructor within a class
by runrig
in thread OO Perl: calling a constructor within a class
by fx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |