in reply to Defining a package inside my script?
The order in which you run things is different. Normally, the module is executed when it is loaded (by use). Now it's executed after your print statements. I wrap my inlined packages with BEGIN, which makes it more like use.
#!/usr/bin/perl -w use strict; BEGIN { package MyModule; ... } my $thingy = new MyModule ( 'thing2' ); print "yeah!\n" if $thingy->is_thing(); print "boo!\n" unless $thingy->is_thing();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Defining a package inside my script?
by Plankton (Vicar) on Jan 31, 2009 at 00:19 UTC |