Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

about X command (display variables) in perl debugger

Tags:

debugging

perl

I am wondering how the big X command works in Perl debugger. So I have the following silly.pl script:

#!/usr/bin/perl -w
use strict;
my $var1 = 99;
print "$var1\n";

I run perl -d silly.pl, and step to the 4th line. There I type in the debugger:

X var1

But nothing shows up. How should I use X to display the value of var1? (If I remove use strict; and don't use my, then I can get X var1 working, but that seems not a solution.)

With Many Thanks!

like image 869
Tom Z Avatar asked Jun 07 '26 01:06

Tom Z


1 Answers

The X command prints current package variables, e.g. declared as our. For lexical scope variables use x or y (needs PadWalker module installed) commands.

like image 141
Denis Ibaev Avatar answered Jun 10 '26 05:06

Denis Ibaev