in reply to Re^2: This can't happen, can it?
in thread This can't happen, can it?
Because can (in class form) does respect inheritance, while a fully specified function name (like foo::bar) does not respect inheritance. Look at the following reduced code:
package Parent; sub foo { print "foo in parent(@_)\n"; }; sub bar { print "bar in parent(@_)\n"; }; package Child; @ISA = qw(Parent); sub foo { print "foo in child(@_)\n"; }; package main; eval { Child::foo(); }; warn $@ if $@; eval { Child->foo(); }; warn $@ if $@; eval { Child::bar(); }; warn $@ if $@; eval { Child->bar(); }; warn $@ if $@;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: This can't happen, can it?
by henrylaxen (Novice) on Feb 21, 2006 at 17:39 UTC |