For some reason I have a problem with inheritance if the derived object
using full namespace for the base object in the ISA.

In the following, B derives from A.  The directory structure is such
that A.pm lives in the same directory as B.pm

A.pm
--------
#!/usr/local/bin/perl
package A;
sub foo { print STDOUT "A::foo\n"; }
sub bar { print STDOUT "A::bar\n"; }
1;


B.pm
--------
#!/usr/local/bin/perl
package B;
our @ISA=qw(A);
sub foo { print STDOUT "B::foo\n"; }
1;


Running the following code

        #!/usr/local/bin/perl
        use Root::A;
        use Root::B;
        A->foo(); 
        A->bar();
        B->foo();
        B->bar();

produces as expected

        A::foo
        A::bar
        B::foo
        A::bar


But, if we change the inheritance line in B.pm to
   our @ISA=qw(Root::B);

we get

        A::foo
        A::bar
        B::foo
        Can't locate object method "bar" via package "B" at app.pl line
10.



What gives?

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to