|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Re: OO-call bug uncovered & autovivified functions: defined? exists?by ysth (Canon) |
| on Oct 29, 2007 at 02:25 UTC ( [id://647781]=note: print w/replies, xml ) | Need Help?? |
|
What do you mean by autovivify? Autovivification in the traditional sense (dereferencing something undefined and having the appropriate type of reference be automatically generated) doesn't seem to apply to code dereferences. But you seem to be talking about named subs, not code references at all?
exists can indeed be used on subs; go back and reread the documentation. It takes the form exists &foo or exists &{foo}, where foo is the name of a sub (sans sigil) or a simple scalar variable containing a code reference or (2nd form only) an arbitrary expression yielding a code reference. Update: just read through your code example. IMO there are no bugs there; you are created an undefined sub KA::boom. Such a sub takes precedence over a parent's boom. This can be useful in the case of a class using AUTOLOAD:
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||