Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by andyok (Novice)
on Jan 25, 2022 at 14:30 UTC ( [id://11140849]=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re^3: Help requested to find the cause of an "uninitialized value" message
by Anonymous Monk on Jan 25, 2022 at 18:32 UTC

    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://11140849]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found