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 (Pope)
on Dec 09, 2019 at 15:19 UTC ( #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
Node Status?
node history
Node Type: note [id://11109880]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2020-08-10 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (56 votes). Check out past polls.

    Notices?