|We don't bite newbies here... much|
Foo is not a Bar, why?by liz (Monsignor)
|on Dec 18, 2003 at 15:23 UTC||Need Help??|
A discussion on p5p the past day, lead me to a new insight that I would like to share with you. An insight that attempting to reduce a problem to a single set of lines, may sometimes backfire on you.
The problem can be shown by running the following lines:
You might wonder why does not produce the expected "$foo is a Bar" string.
It actually was Hugo van der Sanden on p5p who gave the solution, so I can't take any credit for that. The reason why: @Foo::ISA = qw(Bar) doesn't get executed until after the print with the ->isa check is executed. So at that time, the Foo package was indeed not yet inheriting from Bar.
As I said on p5p, this is when you realize that objects are bolted onto Perl 5.
And thus ends my meditation for today.