Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: use of "use X"

by bbfan (Novice)
on Jan 18, 2012 at 04:52 UTC ( #948478=note: print w/replies, xml ) Need Help??


in reply to use of "use X"

Thanks for the suggestions folks. No luck finding a solution; am thinking it may not be possible. Although this works:

use if (1 == 1), warnings => qw(all);

am thinking that an eval on $debug *requires* the compiler, therefore compiler directives like "strict, warnings, diagnostics, etc." cannot be loaded in this manner (however, I'm often wrong). For more, see:

http://www.perlmonks.org/?node_id=323606

Replies are listed 'Best First'.
Re^2: use of "use X"
by quester (Vicar) on Jan 18, 2012 at 06:50 UTC

    I think what you were looking for is

    $ perl -E 'BEGIN {our $debug = 1;} use if $debug // 0, warnings; say u +ndef' Use of uninitialized value in say at -e line 1.

    although I would be inclined to go with an environment variable instead, to avoid having to edit the source code:

    $ debug=1 perl -E 'use if $ENV{debug} // 0, warnings; say undef' Use of uninitialized value in say at -e line 1.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-06-26 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (83 votes). Check out past polls.

    Notices?