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

Re: print_r or var_dump?

by Rudif (Hermit)
on Oct 10, 2001 at 03:22 UTC ( [id://117893]=note: print w/replies, xml ) Need Help??


in reply to print_r or var_dump?

If you would like to have a graphical browser for perl structures, it's easy:

- install package Tk

- install package Tk::ObjScanner

- run the demo below

#!perl -w # This demo of Tk-ObjScanner # is a stripped-down version of the test file Tk-ObjScanner\t\basic.t # The module Tk::ObjScanner by Dominique Dumont is available on CPAN a +nd on PPM use strict ; package Toto ; # creates a moderately complicated perl structure sub new { my $type = shift ; my $tkstuff = shift ; my $scalar = 'dummy scalar ref value'; open (FILE,"$0") || die "can't open myself !\n"; my $glob = \*FILE ; # ??? my $self = { 'key1' => 'value1', 'array' => [qw/a b sdf/, {'v1' => '1', 'v2' => 2},'dfg'], 'key2' => { 'sub key1' => 'sv1', 'sub key2' => 'sv2' }, 'some_code' => sub {print "some_code\n";}, 'piped|key' => {a => 1 , b => 2}, 'scalar_ref_ref' => \\$scalar, 'filehandle' => $glob, 'empty string' => '', 'non_empty string' => ' ', 'long' => 'very long line'.'.' x 80 , 'is undef' => undef, 'some text' => "some \n dummy\n Text\n", 'tk widget' => $tkstuff } ; bless $self,$type; } package main; use Tk ; use Tk::ObjScanner ; my $mw = MainWindow-> new ; my $dummytolookat = new Toto ($mw); $mw -> ObjScanner ( 'caller' => $dummytolookat, #destroyable => 0, title => 'test scanner' ) -> pack(expand => 1, fill => 'both') ; MainLoop ; # Tk's
Both packages are available from CPAN or from PPM (Active State)

Rudif

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-20 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found