Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Dual personality: Module and script

by tachyon (Chancellor)
on Aug 03, 2004 at 15:07 UTC ( [id://379682]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package MyModule;
    
    ...
    CHECK{ print $MOD_CALL ? "Called as a module\n" : "Called as a script\
    +n" }
    
    1;
    
  2. or download this
    if ( @ARGV ) {
        print "I'm a script!\n";
    ...
      exit 0;
    }
    # only get to here if you we are a module
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://379682]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-25 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found