johnnywang has asked for the wisdom of the Perl Monks concerning the following question:
which I can then run "perl Foo.pm", but I can't "use" it in other scripts because the "main" section will get executed. I guess one way to ask is whether a package can know how it is used? Thanks# file Foo.pm package Foo; sub foo{ print "foo called\n"; } # the following are testing code package main; Foo::foo(); 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Modules containing test code in the same file
by BrowserUk (Patriarch) on Jan 07, 2005 at 09:01 UTC | |
|
Re: Modules containing test code in the same file
by eyepopslikeamosquito (Archbishop) on Jan 07, 2005 at 09:20 UTC | |
|
Re: Modules containing test code in the same file
by dimar (Curate) on Jan 07, 2005 at 17:31 UTC |