in reply to Defining a package inside my script?
If you're going to move the contents of modules into programs, you ought to change:
my $thingy = new MyModule ( 'thing2' ); # do not use... to:
my $thingy = MyModule->new( 'thing2' );As you've seen, the order of compilation and execution often matters. When you use this syntax to call class methods, you're relying on a specific compilation order of declarations which may not be the case; it's better to disambiguate by making the invocant obvious.
|
|---|