in reply to Watch the value of hash key in perldebug

> I have a (very large) piece of code with many modules ...

> ... $hash is defined as our

But probably in different packages?

update

Maybe try w $PKG::hash->{key}{key}{key} but with the PKG from the module were the change happens.

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

Replies are listed 'Best First'.
Re^2: Watch the value of hash key in perldebug
by BillKSmith (Prior) on Nov 26, 2020 at 19:09 UTC
    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
      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