in reply to Re: Inheritance in Perl5
in thread Inheritance in Perl5
Perl tends to like its packages defined before they're used.
Indeed, this is why the Perl 5 parser creates namespaces and installs subroutines into those name spaces at compilation time.
Except for code which creates an object in a BEGIN block before the parser has even read the class package declaration, this order does not matter. The OP's question is similar to:
ok( foo(), 10, 'foo() should return value of $bar' ); my $bar = 10; sub foo { return $bar }
|
|---|