Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Two argument bless sometimes ignores the class name?by !1 (Hermit) |
on Jan 15, 2005 at 06:42 UTC ( [id://422468]=note: print w/replies, xml ) | Need Help?? |
Hmm, this seems to be a trick with bless. At least that's all I can deduce from this snippet:
Haven't seen anything about this in any of the docs but the behavior is consistent since at least 5.6.1. Update: Even more curious...
I think there are some compile-time vs runtime considerations that must be made. Update part 2: As far as I understand it, when you bless a reference, the blessed reference will get a pointer to the stash designated by the string you pass as the second parameter. The blessed reference never actually gets the string passed as the second parameter. What ref actually returns is the name on the stash to which the reference points. Thus since Bar points to Foo's stash, you will always get Foo when you bless with Bar.
In Section
Seekers of Perl Wisdom
|
|