CassJ has asked for the wisdom of the Perl Monks concerning the following question:
Update: misunderstanding was somewhere else, this bit isn't the problem at all. Forget it!
I'm trying to understand what a bit of code is doing and I've got myself in a knot. In class A, there is a method that calls a class method of class B, with a code ref as an argument. Something like:
So, which class do the $selfs in the call to do_things actually refer to?#in class A sub do_stuff{ my $self = shift; #1 Class::B->do_things(sub{ my $self = @_; #2 my $blah = Class::C->blah({ arg1=>$self->{blah}, #3 arg2=>self->{wibble} }) }) }
Thanks for any help!
Cass
</returns to banging head off desk>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: code ref confusion
by Joost (Canon) on Jun 30, 2004 at 11:57 UTC | |
by CassJ (Sexton) on Jun 30, 2004 at 12:22 UTC |