Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Help requested to find the cause of an "uninitialized value" message

by Anonymous Monk
on Jan 24, 2022 at 15:30 UTC ( [id://11140799]=note: print w/replies, xml ) Need Help??


in reply to Help requested to find the cause of an "uninitialized value" message

Slightly different perspective: the error says to me that eval $dumper produces undef. This could be because $dumper is undef, but it could also be because $dumper is something like $VAR1 = undef. You say you check for $VAR1=, but have you checked what is on the right-hand side of the equals sign?

My personal suspicion is that the data are getting lost in the transfer between tasks, but I have no evidence at all to support that. Intermittent failures are hell to diagnose.

Replies are listed 'Best First'.
Re^2: Help requested to find the cause of an "uninitialized value" message
by andyok (Novice) on Jan 25, 2022 at 14:30 UTC
    Thank you for your thoughts.

    Following a few smaller-test-cases, and reading through all the comments provided, I think I now understand the nature of the error-message ...
    ... and as you suggest, that the result of eval $dumper is null which when evaluated within %{ .... } is therefore attempting to de-reference a null value.

    So yes, I can check to see if %info = %{ eval $dumper } results in an empty %info which I can then use as a trigger for a break-point or for some printing of some extra information.
    Thank you for your thoughts and time.
    Andrew

      You might want to check the results of eval $dumper before you try to use them as a hash reference. Something like

      my $hash_ref = eval $dumper;
      if ( ! defined $hash_ref ) {
          # You got undef. Handle it as appropriate
      } elsif ( 'HASH' eq ref $hash_ref ) {
          # You actually got a hash ref. Handle it.
      } else {
          # You got something, but not a hash ref.
          # You don't say this has happened to you, but
          # when troubleshooting, paranoia is justified.
      }
      

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-26 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found