in reply to debug at compile time
There's a lot of error-handling I've skipped, both in the definition of can() and the "expanded code" ($obj->can('method')->(ARGS)). The point is, you can modify @ISA at any time; there is no compile-time method resolution.sub can { my ($self, $meth) = @_; my $class = ref $self || $self; my $subref = *{$class . '::' . $meth}{CODE}; return $subref if defined $subref; for (@{$class . '::ISA'}) { $subref = $_->can($meth); return $subref if defined $subref; } return undef; }
|
|---|