in reply to code ref confusion
#!perl C::A->thing(); # prints "C::A"; C::B->thing(); # prints "C::B"; package C::A; sub thing { print shift; } package C::B; use base 'C::A';
There is a bug in your code:
will set $self to the number of arguments to the anonymous sub, so this will not be what you want.my $self = @_; #2
#3 $self->{bla} - $self will be the $self created when the argument to Class::B->do_things is called. Where that is, I can't tell, because there is no definition of Class::B->do_things in this code.
By the way, none of the variables are in package Class::B, because lexicals are not bound to classes anyway.
Hope this helps
Joost
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: code ref confusion
by CassJ (Sexton) on Jun 30, 2004 at 12:22 UTC |