cleverett has asked for the wisdom of the Perl Monks concerning the following question:
B.pm:package A; sub foo { print "xyzzy\n"; } 1;
and C.pm:package B; use base 'A'; 1;
and now set up a 'test.pl':package C; use base 'B'; 1;
Run it and you get:#!/usr/bin/perl require 'C.pm'; C::foo();
22. perl test.pl
Can't locate object method "foo" via package "C" at C.pm line 5.
Why doesn't it find the sub foo in 'A.pm'? I must be making a newbie mistake, but for the life of me I can't see what.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Inheritance strangeness
by Joost (Canon) on Sep 08, 2004 at 07:58 UTC | |
Re: Inheritance strangeness
by Zaxo (Archbishop) on Sep 08, 2004 at 07:57 UTC | |
Re: Inheritance strangeness
by BUU (Prior) on Sep 08, 2004 at 07:49 UTC | |
by cleverett (Friar) on Sep 08, 2004 at 07:52 UTC | |
by PodMaster (Abbot) on Sep 08, 2004 at 07:57 UTC | |
by Zed_Lopez (Chaplain) on Sep 08, 2004 at 07:59 UTC | |
Re: Inheritance strangeness
by cleverett (Friar) on Sep 08, 2004 at 08:07 UTC | |
by adamk (Chaplain) on Sep 08, 2004 at 12:41 UTC | |
Re: Inheritance strangeness
by cleverett (Friar) on Sep 08, 2004 at 07:48 UTC |