Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: determine the variable causing the error: Use of uninitialized value

by marinersk (Priest)
on Apr 14, 2017 at 04:42 UTC ( [id://1187910]=note: print w/replies, xml ) Need Help??


in reply to Re^2: determine the variable causing the error: Use of uninitialized value
in thread determine the variable causing the error: Use of uninitialized value

Thank you -- That was the closest thing I could come up with, so I should trust my instincts more.

So --

Since you didn't mention one, I presume there isn't an evalequivalent which does catch warnings?

  • Comment on Re^3: determine the variable causing the error: Use of uninitialized value
  • Download Code

Replies are listed 'Best First'.
Re^4: determine the variable causing the error: Use of uninitialized value
by kcott (Archbishop) on Apr 14, 2017 at 05:22 UTC

    You could use

    { local $SIG{__WARN__} = sub { ... }; eval { ... }; }

    to trap the warning and do something special with it. However, I can't see that helping with identifying uninitialised values.

    There's example code in perlvar: %SIG.

    — Ken

Re^4: determine the variable causing the error: Use of uninitialized value
by karlgoethebier (Abbot) on Apr 14, 2017 at 13:02 UTC
    "...catch warnings?"

    With use warnings FATAL => qw(uninitialized); it works with eval as well as with Try::Tiny. As AnomalousMonk suggested.

    «The Crux of the Biscuit is the Apostrophe»

    Furthermore I consider that Donald Trump must be impeached as soon as possible

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-19 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found