in reply to What package is the method in?
This doesn't catch cases where a method is dealt with by an AUTOLOAD function.my @classes = ref $foo; my $method = "do_stuff"; while (@classes) { my $class = shift @classes; no strict 'refs'; if (defined &{"${class}::${method}"}) { say $class; exit; } unshift @classes, @{"${class}::ISA"}; } say "Not found";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What package is the method in?
by ikegami (Patriarch) on May 14, 2010 at 14:15 UTC |