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