http://qs321.pair.com?node_id=644222


in reply to both base and sub class in same file

This is happening because base ends up requireing Foo, which in turns ends up doing Foo.pm, since it hasn't been donerequired yet ...

Update 2: The safeguard is in require, of course. ikegami++. The workaround below is still useful for those "executable modules", but unnecessary for most purposes.

(Oh, and for completeness, use happens at compile time, and so is run even with the -c option.)

Update: A workaround: Add a $VERSION variable to Foo, as this prevents base from trying to load it again:

package Foo; our $VERSION = 0.001; sub test { } 1; package Bar; use base Foo; sub test2 { } 1;

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!