How to print like debuggers `x $HASH`

I

Ian Pellew

Hi All;

What is the call to print a HASH like the debugs print of a hash:-

EG:-
$t_xmlin = eval{XMLin($xml, forcearray=>0, NormaliseSpace=>2)};

DB<2> x $t_xmlin
0 HASH(0x22a84a8)
'define' => HASH(0x22a840c)
'gen_dir' => 'c:/Program Files/Apache Group/Apache2/cgi-bin/Pages/Generated/'
'src_dir' => 'c:/Program Files/Apache Group/Apache2/cgi-bin/Pages/'
Etc.

This a lot easier than the Dumper output.

Regards
Ian
 
J

John Bokma

Ian said:
Hi All;

What is the call to print a HASH like the debugs print of a hash:-

EG:-
$t_xmlin = eval{XMLin($xml, forcearray=>0, NormaliseSpace=>2)};

DB<2> x $t_xmlin
0 HASH(0x22a84a8)
'define' => HASH(0x22a840c)
'gen_dir' => 'c:/Program Files/Apache
Group/Apache2/cgi-bin/Pages/Generated/' 'src_dir' => 'c:/Program
Files/Apache Group/Apache2/cgi-bin/Pages/'
Etc.

This a lot easier than the Dumper output.

In what respect? Also, you can change the display behaviour of Dumper.
See $Data::Dumper::Indent, I use often a value of 1.
 
P

Peter Scott

Hi All;

What is the call to print a HASH like the debugs print of a hash:-

EG:-
$t_xmlin = eval{XMLin($xml, forcearray=>0, NormaliseSpace=>2)};

DB<2> x $t_xmlin
0 HASH(0x22a84a8)
'define' => HASH(0x22a840c)
'gen_dir' => 'c:/Program Files/Apache Group/Apache2/cgi-bin/Pages/Generated/'
'src_dir' => 'c:/Program Files/Apache Group/Apache2/cgi-bin/Pages/'
Etc.

This a lot easier than the Dumper output.

I don't think you'll find many people agreeing with that, but if
you feel you must go down this path:

% perl -e 'require "dumpvar.pl"; dumpValue([{answer => 42}], -1)'
0 HASH(0x476a4)
'answer' => 42

Ugh.
 
I

Ilya Zakharevich

[A complimentary Cc of this posting was sent to
Ian Pellew
Hi All;

What is the call to print a HASH like the debugs print of a hash:-

EG:-
$t_xmlin = eval{XMLin($xml, forcearray=>0, NormaliseSpace=>2)};

DB<2> x $t_xmlin
0 HASH(0x22a84a8)
'define' => HASH(0x22a840c)
'gen_dir' => 'c:/Program Files/Apache Group/Apache2/cgi-bin/Pages/Generated/'
'src_dir' => 'c:/Program Files/Apache Group/Apache2/cgi-bin/Pages/'
Etc.

This a lot easier than the Dumper output.

Sure, it was designed for readability only...

use Dumpvalue;

Hope this helps,
Ilya

P.S. It may be that the debugger itself still uses the obsolete dumpvar.pl...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,901
Members
47,439
Latest member
elif2sghost

Latest Threads

Top