Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: Using guards for script execution?

by afoken (Chancellor)
on Mar 01, 2017 at 08:56 UTC ( [id://1183251]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    BEGIN { require Module; Module->import( LIST ); }
    
  2. or download this
    use Module ();
    
  3. or download this
    BEGIN { require Module }
    
  4. or download this
    #!/usr/bin/perl
    
    ...
    }
    
    print "***** See? No code in LoadMe is executed! *****\n";
    
  5. or download this
    package LoadMe;
    
    ...
    print "LoadMe: Module initialisation\n";
    system "echo Perl is fully working and can run arbitary code, includin
    +g external programs";
    1; # or any other non-false value
    
  6. or download this
    /tmp/use-demo>perl demo.pl
    >>> About to execute 'use LoadMe;' <<<
    ...
    Good bye cruel world
    
    /tmp/use-demo>
    
  7. or download this
    /tmp/use-demo>perl -cw demo.pl
    >>> About to execute 'use LoadMe;' <<<
    ...
    LoadMe.pm syntax OK
    
    /tmp/use-demo>
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-16 11:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found