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 TomDLux (Vicar)
on Jan 18, 2012 at 01:57 UTC ( #948455=note: print w/replies, xml ) Need Help??


in reply to use of "use X"

By the way, you need to hide the 'use module' within an eval, to control whether it happens or not, or else use the module 'if' ( use if CONDITION, MODULE => ARGS ).

As Occam said: Entia non sunt multiplicanda praeter necessitatem.

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

    Using eval would delay the directive to runtime, but it needs to be active at runtime to affect code.

    >perl -e"eval 'use warnings; 1' or die $@; print undef;" >perl -e"use warnings; print undef;" Use of uninitialized value in print at -e line 1.

    And you can't wrap it in a BEGIN because that would introduce a lexical scope.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948455]
help
Chatterbox?
[marioroy]: `bash -c "clang --version 2>/dev/null"`
[choroba]: Sane people don't use csh
[marioroy]: the 1>&2 will work, not shown
[marioroy]: sorry, did not know which if cmd.exe or unix (bash)
[choroba]: csh considered harmful
[erix]: no, I'm using bash :)
[marioroy]: :)
[marioroy]: I use the default and happens to be bash
[erix]: heh, I like the "Resolved" (Christiansen is really funny)
Discipulus is makita a reincarnation of grinder?

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2017-03-23 08:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (285 votes). Check out past polls.