in reply to Who am I? Inheritance question
That $class will be the invoking class, not necessarily the __PACKAGE__ where generally_useful lives. This works for constructors.sub generally_useful { my $class = shift; # ... }
If the method is an instance method, it will be more like:
sub instance_meth { my $self = shift; my $class = ref $self; }
Phil
Update: Added instance method example.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Who am I? Inheritance question
by dragonchild (Archbishop) on Mar 16, 2006 at 22:08 UTC | |
by diotalevi (Canon) on Mar 16, 2006 at 23:26 UTC | |
by dragonchild (Archbishop) on Mar 17, 2006 at 03:30 UTC | |
by diotalevi (Canon) on Mar 17, 2006 at 06:09 UTC | |
by dragonchild (Archbishop) on Mar 17, 2006 at 12:23 UTC | |
| |
by adrianh (Chancellor) on Mar 17, 2006 at 13:37 UTC |