Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Overriding CORE::GLOBAL::warn/die

by greengaroo (Hermit)
on Sep 21, 2012 at 18:19 UTC ( #994965=note: print w/ replies, xml ) Need Help??


in reply to Overriding CORE::GLOBAL::warn/die

Try this:

my $ref = { 'key' => 'value' }; print Dumper $ref; use Data::Dumper; print Dumper $ref;

Basically, the first "print Dumper" fails and the second works fine.

My guess is you are confused by this statement in the documentation for use: Because use takes effect at compile time, it doesn't respect the ordinary flow control of the code being compiled. In particular, putting a use inside the false branch of a conditional doesn't prevent it from being processed.

The way I understand it is even if the "use" statements are processed at compile time, it doesn't mean the module functions become omnipresent. It will respect the order in which the statements are written: from top to bottom.

In your case, the "use warn" is processed at compile time but when you do your first warn statement, the module's "warn" function is not available yet.

Now, my question to you is, why does it mater? Is there something specific that you are trying to achieve and for that you need to "use" your module somewhere else, after you actually use its functions?

Please enlighten us!

There are no stupid questions, but there are a lot of inquisitive idiots.


Comment on Re: Overriding CORE::GLOBAL::warn/die
Download Code
Re^2: Overriding CORE::GLOBAL::warn/die
by clueless newbie (Friar) on Sep 21, 2012 at 19:01 UTC

    I'm merely attempting to debug some code that makes use of a CORE::GLOBAL::die to "rat out" the offending code. It sometimes fails and I wished to know why.

      We may be of more help if you post the code you are trying to debug. Please expose your problem, we'll give it a try.

      There are no stupid questions, but there are a lot of inquisitive idiots.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (15)
As of 2014-07-25 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (174 votes), past polls