Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Using perl module if env is enabled

by Corion (Patriarch)
on Dec 09, 2019 at 15:19 UTC ( [id://11109880]=note: print w/replies, xml ) Need Help??


in reply to Using perl module if env is enabled

See use. use Foo::Bar; is basically BEGIN { require Foo::Bar; }. If you want some conditional logic, you can put that into the BEGIN block as well:

BEGIN { if( $ENV{USE_XYZ}) { require Foo::Bar; Foo::Bar->import(); } }

The if module wraps that simple case already:

use if $ENV{USE_XYZ}, 'Foo::Bar';

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found