http://www.perlmonks.org?node_id=379356

guha has asked for the wisdom of the Perl Monks concerning the following question:

I am writing tests for a module Child which inherits from Parent, and have run into a oddity which I can't grasp.

These modules are part of a larger framework and it is pretty difficult to strip it down to a non-working snippet of code.

However these are the facts before the crime:

my $o = Child->new; print ref($o); #Child print $o->isa('Child'); # 1 print $o->isa('Parent'); # 1 print join(':', @Child::ISA) # Parent my $method = 'testSign'; my $code = $o->can($method); print $code; # CODE(0x20d5b94)

Either of

$o->$method()
or
$o->$code()

emits the following error
Undefined subroutine &ClientChild::testSign called at program.t line nnn.

The testSign method is only defined in the Parent class.

So whats going on, to me it looks like inheritance does not occur even though the prerequsites seem fulfilled.

Hints, ptrs, wild shots in the dark greatly appreciated!

perl -v #AS-635

update: Thanks adrianh & ysth for spotting my transcription error.

Sort of Solved:Added a method Fubar to Parent. And tested with that, and now it worked. So obviously there was something special with the testSign name. A little searching revealed the testSign was referenced in Child like so

my %_init_mems = ( Password => \&testPassword, Sign => \&testSign, Name => \&testNameX2, Titel => \&testStrX, );

I'm not sure but does this act as a declaration for sub testSign in Child namespace ala ysth's and Ovid's suggestions?

But in that case the testSign in Child ought to have been invoked as a method instead ?