in reply to Re^3: Is "ref($class) || $class" a bad thing?
in thread Is "ref($class) || $class" a bad thing?
I'm surprised nobody has mentioned called_as_method from Devel::Caller.
use Devel::Caller qw( called_as_method ); sub new { croak "must call new as method" unless called_as_method(0); ... };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re^5: Is "ref($class) || $class" a bad thing?
by merlyn (Sage) on Jul 20, 2004 at 13:32 UTC | |
by adrianh (Chancellor) on Jul 20, 2004 at 16:46 UTC |