Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Initialized Variable getting Uninitialized Warning

by pryrt (Abbot)
on Feb 27, 2019 at 18:15 UTC ( [id://1230627]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Initialized Variable getting Uninitialized Warning
in thread Initialized Variable getting Uninitialized Warning

exception => undef

ikegami pointed out the likely culprit. But if you hadn't seen that, then what you just said is the opposite of what I would do after reading >>"Uninitialized" really means "has undef for value"<< in ikegami's first post. My recommendation would have been to figure out why the exception-key's value was being set to undef, not intentionally force it to undef.

To do that here, I would have made a print statement (This is step#2 from Basic debugging checklist)

printf STDERR "ref=%s, exception->{exception}=%s\n", $exception, $exception->{exception}//'<undef>';

... and placed it right before the return($exception) in your subroutine and just after the my $exception = EcomImportUtilities::ageCheck(...). This would have shown you that it was properly defined in the sub, but the hashref wasn't getting into the local $my exception at all, which would have pointed you toward ikegami's conclusion that the conditional-my was what was messing with you -- or, at least, you could have asked "why is $exception a proper hashref in the sub, and not after the subroutine-call?", at which point, ikegami would have chimed in.

Hope this helps you for future debugging


(edit: move the step#2 comment to subsequent paragraph, where it fits better)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-23 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found