Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Watch the value of hash key in perldebug

by BillKSmith (Prior)
on Nov 26, 2020 at 19:09 UTC ( #11124267=note: print w/replies, xml ) Need Help??


in reply to Re: Watch the value of hash key in perldebug
in thread Watch the value of hash key in perldebug

I suspect that the OP is unmarshalling Marshalling a hash from a file. Appending a package name would seem to defeat the idea. A typeglob assignment allows both packages to share the variable name.
use strict; use warnings; BEGIN{ push @ARGV, \'$hash{key}{key}{key} = "value"' if (!@ARGV); } our %hash; my $file_name = $ARGV[0]; Some::Module::some_sub($file_name); print $hash{key}{key}{key}, "\n"; package Some::Module; sub some_sub{ our %hash; *hash = *main::hash; my $fname = shift; open my $fh, '<', $fname or die "cannot open input"; my $string = <$fh>; eval $string; my $debug = 'foo'; # Just a place for debug to stop. }
Bill

Replies are listed 'Best First'.
Re^3: Watch the value of hash key in perldebug
by LanX (Cardinal) on Nov 26, 2020 at 19:14 UTC
    Don't you think that's an overkill for the purpose of a watch expression for debugging?

    And a simple package Target::Package; directive inside the sub should have a similar effect - if marshalling was the intention - without the need of aliasing.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      I have coded my understanding of the original program, using a package to simulate one of the modules. My only contribution was to 'export' the hash with a symbol table assignment. Had I used a true module, I could have used the normal export mechanism. I did not think of that. This simulation was not able to duplicate the debug problem. Perhaps frogsausage can use this as start to demo that problem.
      Bill
        Ok now I understand, thanks for the effort. :)

        But I doubt that the OP will help us clarify his problem, he's been here several times again without giving further feedback.

        And I have no clue where Devel::Symdump comes into the picture, it's not a part of standard perldebug.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2021-04-17 00:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?