|Just another Perl shrine|
Re^2: Is "ref($class) || $class" a bad thing?by stvn (Monsignor)
|on Jul 12, 2004 at 16:55 UTC||Need Help??|
But, I must take exception with one of the conclusions you're implying. The error in line 14 is caused by the fact that your new() method isn't verifying that it was actually passed anything.
I know thats why its happening, you know why its happening, but does Joe-Perl-Newbie know why? Maybe, maybe not. The error message given points back to the $foo->test line, which it not the actual source of the issue. IMO, its just adds to the insidiousness of this.
As for a way to solve this, code-wise, I am currently toying with using this:
It works (or rather doesn't work) in all the following conditions:
As well as works correctly when inherited. I am trying to think of other ways it might get used/abused to see how well it holds up. Any thoughts are appreciated.
But, we're just getting stupid. :-)
I know, isn't it fun ;-P