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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: When I use "can"
by eserte (Deacon) on Apr 06, 2004 at 16:45 UTC | |
|
Re: When I use "can"
by liz (Monsignor) on Apr 07, 2004 at 11:45 UTC | |
by ysth (Canon) on Apr 08, 2004 at 10:20 UTC | |
|
Re: When I use "can"
by dws (Chancellor) on Apr 06, 2004 at 19:46 UTC | |
by hardburn (Abbot) on Apr 06, 2004 at 21:18 UTC | |
|
Re: When I use "can"
by hv (Prior) on Apr 08, 2004 at 13:53 UTC | |
|
Re: When I use "can"
by tilly (Archbishop) on Apr 07, 2004 at 15:20 UTC | |
|
Re: When I use "can"
by Beechbone (Friar) on Apr 18, 2004 at 00:52 UTC |