bikeNomad has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; package A; sub A { print "A::A $_[0]\n" } package B; @B::ISA = 'A'; $B::A = "i'm \$B::A\n\n"; package main; A->A; B->A; # calls A::A print $B::A; *{B::A} = sub { print "B::A $_[0]\n" }; # works fine A->A; B->A; # now calls B::A print $B::A; undef &{B::A}; A->A; # Why doesn't it just call A::A here because of inheritance? B->A; # Not a CODE reference at noinherit.pl line 27. print $B::A;
Now, I'm certain that I'm just missing something elementary, but could someone point me in the right direction? I only want to delete my definition of &B::A so it'll go back to inheriting from &A::A. And I don't want to clobber $B::A in the process.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Undefining subroutines and inheritance
by chromatic (Archbishop) on Jun 29, 2001 at 00:09 UTC | |
|
Re: Undefining subroutines and inheritance
by japhy (Canon) on Jun 29, 2001 at 00:25 UTC | |
|
Re: Undefining subroutines and inheritance
by bbfu (Curate) on Jun 28, 2001 at 23:52 UTC | |
by bikeNomad (Priest) on Jun 29, 2001 at 00:25 UTC | |
by bbfu (Curate) on Jun 29, 2001 at 02:44 UTC | |
by dragonchild (Archbishop) on Jun 28, 2001 at 23:55 UTC | |
|
Re: Undefining subroutines and inheritance
by bikeNomad (Priest) on Jun 29, 2001 at 01:02 UTC | |
|
(tye)Re: Undefining subroutines and inheritance
by tye (Sage) on Jun 29, 2001 at 01:07 UTC | |
|
Re: Undefining subroutines and inheritance
by dragonchild (Archbishop) on Jun 28, 2001 at 23:52 UTC |