require Module; Module -> import (args...) if Module -> can ("import");
sub AUTOLOAD { ... for my $class (@ISA) { if ($class -> can ("AUTOLOAD")) { no strict 'refs'; my $auto = $class . "::AUTOLOAD"; $$auto = $AUTOLOAD; $self -> $auto (@_); last; } } }
(Yeah, it can fail with multiple inheritance, but that's because there's no standard way for an AUTOLOAD to signal it couldn't deal with call.)
# For single inheritance. sub new { if (@ISA && $ISA [0] -> can ("new")) { return shift -> SUPER::new (@_) } else { return bless \(my $foo) => shift; } }
Abigail
In reply to When I use "can" by Abigail-II
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |