Tk-ObjScanner-2.018/0000755000175000017500000000000014515247403012573 5ustar domidomiTk-ObjScanner-2.018/README.org0000644000175000017500000000570014515247403014243 0ustar domidomi* Tk::ObjScanner :PROPERTIES: :CUSTOM_ID: tkobjscanner :END: ** What is Tk::ObjScanner Tk::ObjScanner is a Perl/Tk module that provides a GUI to scan any perl data including the attributes of an object. This module also provides =data-viewer=, a standalone script that opens a =Tk::ObjScanner= widget on a JSON or YAML file. For instance, this command =data-viewer /usr/share/nodejs/tar/package.json= creates the following widget: [[file:data-viewer.png]] ** In more details The scanner is a composite widget made of a HList. This widget acts as a scanner to the object (or hash ref) passed with the 'caller' parameter. The scanner will retrieve all keys of the hash/object and insert them in the HList. When the user double clicks on a key, the corresponding value will be added in the HList. If the user use the middle button to open a tied item, the internals of the tied object will be displayed. If the value is a scalar, the scalar will be displayed in a popup text window. If the value is a code ref, the deparsed code will be displayed in a popup text window. This widget can be used as a regular widget in a Tk application or can be used as an autonomous popup widget that will display the content of a data structure. The latter is like a call to a graphical =Data::Dumper=. The scanner recognizes: - tied hashes arrays or scalars - weak reference (See weaken function of =Scalar::Util= for details) This module was tested with perl5.8.2 and Tk 804.025 (beta). But should work with older versions of perl (> 5.6.1) or Tk. On the other hand, =data-viewer= requires Perl 5.16. See the embedded documentation in the module for more details. *Note* that test program (in the 't' directory) can be run interactively this way : #+begin_example perl t/xxx.t 1 #+end_example *** Installation :PROPERTIES: :CUSTOM_ID: installation :END: #+begin_example gunzip -c .tar.gz | tar xvf - cd perl Makefile.PL make test make install #+end_example From github, this module is built with *Dist::Zilla*. You must make sure that the following modules are installed: #+begin_example Dist::Zilla::Plugin::MetaResources Dist::Zilla::Plugin::Prepender Dist::Zilla::Plugin::Prereqs Dist::Zilla::PluginBundle::Filter #+end_example On debian or ubuntu, do: #+begin_example sudo aptitude install \ libdist-zilla-plugin-prepender-perl \ libdist-zilla-plugins-cjm-perl \ libdist-zilla-perl #+end_example Then run: #+begin_example dzil build #+end_example or #+begin_example dzil test dzil build #+end_example -------------- Comments and suggestions are always welcome. ** Contributors :PROPERTIES: :CUSTOM_ID: contributors :END: Many thanks to *Achim Bohnet* for all the tests, patches (and reports) he made. Many improvements were made thanks to his efforts. Thanks to *Rudi Farkas* for the 'watch' patch. Thanks to *heytitle* for the documentation fixes Thanks to *E. Choroba* for the retro compatibility patch Tk-ObjScanner-2.018/META.json0000644000175000017500000000373214515247403014221 0ustar domidomi{ "abstract" : "a GUI to scan any perl data structure or object", "author" : [ "Dominique Dumont" ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.030, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Tk-ObjScanner", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "B::Deparse" : "0", "Carp" : "0", "Data::Dumper" : "0", "Getopt::Long" : "0", "JSON" : "0", "Path::Tiny" : "0", "Scalar::Util" : "1.01", "Tk" : "0", "Tk::Adjuster" : "0", "Tk::Derived" : "0", "Tk::Frame" : "0", "Tk::HList" : "0", "Tk::Menubutton" : "0", "Tk::ROText" : "0", "YAML::PP" : "0", "perl" : "5.016" } }, "test" : { "requires" : { "Benchmark" : "0", "FileHandle" : "0", "Math::BigInt" : "0", "Test::More" : "0", "Tie::Hash" : "0", "Tie::Scalar" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "ddumont at cpan.org", "web" : "https://github.com/dod38fr/perl-tk-objscanner/issues" }, "homepage" : "https://github.com/dod38fr/perl-tk-objscanner", "repository" : { "type" : "git", "url" : "https://github.com/dod38fr/perl-tk-objscanner.git", "web" : "https://github.com/dod38fr/perl-tk-objscanner" } }, "version" : "2.018", "x_generated_by_perl" : "v5.36.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.37", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } Tk-ObjScanner-2.018/Changes0000644000175000017500000001146514515247403014075 0ustar domidomi2.018 2023-10-22 * add data-viewer script * ObjScanner: add -destroy_label option * remove support of obsolete pseudo-hashes 2.017 2017-05-11 * Fix failures in pre-5.10 Perls (tx E. Choroba) * Tk::ObjScanner doc: Correct example code. (tx heytitle) * README: Use proper Markdown syntax.(tx heytitle) * change bug tracker from RT to github 2.016 2014-07-30 * Added forgotten $VERSION string 2.015 2014-07-29 * Fixed Abstract 2.014 2014-07-28 * Fixed META informations 2.013 2014-07-28 * Refreshed the module: * no longer mess with UNIVERSAL::isa * use Test::More * skip test when x server is not available 2.012 2007-10-09 * ObjScanner.pm: Added require 5.006 * Makefile.PL: Added require 5.006 to avoid automatic test failures from tester.cpan.org 2.011 2007-09-20 * ObjScanner.pm (Populate): pseudo hashes are disabled for perl >= 5.009 2.010 2004-07-30 * ObjScanner.pm: Showing tied info can be disabled by option or menu (exclusive or) Removed unnecessary 'ROOT:' word from top level label 2.009 2004-07-28 * ObjScanner.pm v2.8: Applied patch from MAREKR at cpan.org (See https://rt.cpan.org/Ticket/Display.html?id=5197) to better handle pseudo hashes (even though pseudo hashes are still obsolete) 2.008 2004-07-27 * ObjScanner.pm : Applied Slaven Rezic's patch which fixes image associated to array elements. (See https://rt.cpan.org/Ticket/Display.html?id=6831) * t/basic.t (new): works with Tk804.025 2.006 2003-11-19 * ObjScanner.pm: all configuration options can be called with a hyphen (i.e '-title' instead of 'title') (scan_object): call pack with hyphenated option (otherwise it breaks on Solaris with Tk800.025) 2.005 2003-11-14 * ObjScanner.pm: replaced obsolete WeakRef module by Scalar::Util Note that pseudo-hashes are deprecated. 2.004 2003-03-21 * ObjScanner.pm (analyse_element): - recognize weak references 2.003 2003-02-28 * ObjScanner.pm (scan_object): - added autonomous scan popup widget 2.001 2003-01-31 * ObjScanner.pm: External changes: - added view_pseudo parameter - can view intern of tied scalar, hash or array by using middle-button - text window is removed from scanner and is now displayed in popup window. - can deparse code ref and display the deparsed code in popup window Internal changes: - changed internal data model. This will break classes derived from ObjScanner - internal methods are re-organized for easier sub-classing 1.022 2001-01-17 * ObjScanner.pm (isPseudoHash): small bug fix * Makefile.PL: added Tk in PREREQ_PM 1.021 2001-01-12 * Makefile.PL: fixed Makefile.PL * ObjScanner.pm: - added pseudo hash viewer 1.019 2000-06-07 * ObjScanner.pm: 1: Use Adjuster so that the user can adjust the relative heights of the HList window and the dump window. 2: Provide 5 options for setting colors and images 3: Impose the same scrollbar style ('osoe') to HList and ROText. 4: Set -wideselection 0 for HList. 5: add 'open folder' image and display it when item has displayed children 1.018 2000-04-17 * ObjScanner.pm: - fixed a bug related to root display - added a patch provided by Rudi Farkas to display a watch cursor when displaying a sub-object 1.017 1999-07-06 * ObjScanner.pm (element): bug fix on string display * Thanks to Rudi Farkas for contributing test cases with Math::BigInt and Filehandle 1.016 1999-05-31 * ObjScanner.pm: - Better support of complex (perl wise) objects - added 'destroyable' parameters - updated 'CAVEATS' doc 1.014 1999-04-29 * ObjScanner.pm (element): Support REF and SCALAR, and does not choke on GLOB ,CODE. 1.013 1999-04-21 * ObjScanner.pm : Complete re-write. It now uses HList instead of data dumper. 1.11 1999-01-20 * ObjScanner.pm: removed dependance on Tk::Multi, better doc, don't wrap lines in Text widget. 0.5 1998-08-18 * ObjScanner.pm: simplified and adapted for new Multi::Text 0.4 1998-06-25 * cleanup remaining traces in test.pl 0.3 1998-03-17 * Accepts '-stuff' parameters (instead of 'stuff') 0.2 1998-02-12 * Patch made by Achim Bohnet (Thanks) o removed AutoLoadeer because don't use AutoLoader for 3 little function defs. Every 'use AutoLoader' does search auto/mod/ule/autoload.ix in at INC. I think that this is much more expensive than having perl compile the 3 subs (Tom C. mentioned that perl can compile ~10000 lines/sec). o use Data::Dumper only when needed: startup gain with replace of 'use Data::Dumper' and use 'require Data::Dumper in sub listScan. o 2 little POD fixes o Makefile.PL: Tk::Multi does not exist. Changed to check for Tk::Multi::Text 0.1 1998-02-06 * 0.1 Beta version. Better AutoLoader usage. Fix minor problem to smooth inheriting Tk::ObjScanner 0 1997-12-01 - bug fix - better README - original version; created by h2xs 1.18 Tk-ObjScanner-2.018/bin/0000755000175000017500000000000014515247403013343 5ustar domidomiTk-ObjScanner-2.018/bin/data-viewer0000755000175000017500000000442314515247403015504 0ustar domidomi#!/usr/bin/env perl # # This file is part of Tk-ObjScanner # # This software is copyright (c) 1997-2004,2007,2014,2017,2023 by Dominique Dumont. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use 5.016; use strict; use warnings; use Tk; use Tk::ObjScanner; use YAML::PP; use JSON; use Path::Tiny; use warnings qw(FATAL utf8); # fatalize encoding glitches use open qw(:std :utf8); # undeclared streams in UTF-8 use Getopt::Long; my $opt = {}; GetOptions($opt, 'yaml!', 'json!') or die("Error in command line arguments\n"); my $file = shift @ARGV // ''; my $format = $opt->{yaml} ? 'yaml' : $opt->{json} ? 'json' : $file =~ /\.ya?ml$/i ? 'yaml' : $file =~ /\.json/i ? 'json' : die "Unknown format for ", $file ? "file $file" : "standard input. Please use -yaml or -json option"; my $string = $file ? path($file)->slurp_utf8($file) : join('', <> ); my $ypp = YAML::PP->new; my $data = $format eq 'yaml' ? $ypp->load_string( $string ) : decode_json ($string) ; my $mw = MainWindow->new; # $mw->geometry('+10+10'); my $s = $mw->ObjScanner( '-caller' => $data, -destroyable => 1, -destroy_label => "quit", -show_tied => 0, -title => 'data viewer' ); $s->pack( -expand => 1, -fill => 'both' ); $s->OnDestroy( sub { $mw->destroy; } ); MainLoop; # Tk's __END__ =pod =encoding UTF-8 =head1 NAME data_viewer - Open a data viewer widget for you JSON or YAML data =head1 SYNOPSIS # view json file data_viewer file.json # viewn yaml file data_viewer file.yml # pipe json data data_viewer -json < file.json # pipe yaml data data_viewer -yaml < file.yml =head1 DESCRIPTION This command opens a L widget for the data stored in YAML or JSON file. This command can be applied on a file passed as argument or data can be piped to C. Yaml file suffix can be C or C. =head1 OPTIONS =head2 -json Parse the data as JSON. =head2 -yaml Parse the data as YAML. =head1 BUGS =over =item * YAML anchor and aliases are ignored. Data is seen as duplicated in the widget. =item * JSON object are showed as C, which is Perl terminology. =back =head1 SEE ALSO L =cut =cut Tk-ObjScanner-2.018/lib/0000755000175000017500000000000014515247403013341 5ustar domidomiTk-ObjScanner-2.018/lib/Tk/0000755000175000017500000000000014515247403013717 5ustar domidomiTk-ObjScanner-2.018/lib/Tk/ObjScanner.pm0000644000175000017500000005330714515247403016311 0ustar domidomi# # This file is part of Tk-ObjScanner # # This software is copyright (c) 1997-2004,2007,2014,2017,2023 by Dominique Dumont. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # package Tk::ObjScanner; $Tk::ObjScanner::VERSION = '2.018'; require 5.006; use strict; use warnings; use Scalar::Util 1.01 qw(weaken isweak reftype); # Version 1.1805 - patches proposed by Rudi Farkas rudif@lecroy.com # 1: Use Adjuster so that the user can adjust the relative heights of the # HList window and the dump window. # 2: Provide 5 options for setting colors and images # 3: Impose the same scrollbar style ('osoe') to HList and ROText. # 4: Set -wideselection 0 for HList. # The patches consist of code changes in sub Populate(). # Version 1.1803 - patch proposed by Rudi Farkas rudif@lecroy.com # Purpose #1: fix the problem with call $scanner->configure(); # dies with error # unknown option "oldcursor" at C:/Perl/site/lib/Tk/Derived.pm line 223. # The patch consists of # - a modified ConfigSpecs line # oldcursor => [$hlist, undef, undef, undef], # Purpose #2: add 'open folder' image and display it when item has displayed children # The patch consists of # - a line in sub Populate # $cw->{openImg} = $cw->Photo(-file => Tk->findINC('open_folder.xbm')); # - method _redisplayImage() # - 2 calls to _redisplayImage inside displaySubItem() # Patch proposed by Rudi Farkas rudif@lecroy.com # Purpose: while executing displaySubItem() which may take a long time # if getting data from disk, another package or another machine, # the default arrow cursor is replaced by a 'watch' cursor. # The patch consists of # - ConfigSpecs item : oldcursor => undef # - method _swapCursor() # - 3 calls to _swapCursor inside displaySubItem(), at entry and at 2 exits # Implementation note: # # The scanner deals with a tree representation of the user data. The # scanner used to keep a copy of the data in its data tree that is # embedded in the HList widget. Unfortunately this scheme fails when # dealing with tied scalar: the copy stored within the HList is a copy # of the value of the scalar. The tied object itself is lost. # So to be able to use ObjScanner with tied scalar, one big change was # necessary: The HList data must not hold a copy of the data, but just # reference to the data. Hence it will hold a scalar ref, a ref to a # hash ref or a ref to an array ref. Hence the item attribute of the # itemcget data part of Hlist is changed to item_ref. # Furthermore to avoid memory leak if the user modifies its data # structure, the ref kept must be weakened (See Scalar::Util man page) use Carp; use warnings; use Tk::Derived; use Tk::Frame; use Data::Dumper; use base qw(Tk::Derived Tk::Frame); Tk::Widget->Construct('ObjScanner'); sub scan_object { require Tk; import Tk; my $object = shift; my $animate = shift || 0; # used by tests my $mw = MainWindow->new; $mw->geometry('+10+10'); my $s = $mw->ObjScanner( '-caller' => $object, -destroyable => 1, -title => 'object scan' ); $s->pack( -expand => 1, -fill => 'both' ); $s->OnDestroy( sub { $mw->destroy; } ); if ($animate) { $s->_scan('root'); } else { &MainLoop; # Tk's } } # used by test sub _scan { my $cw = shift; my $topName = shift; $cw->yview($topName); $cw->after(200); # sleep 200ms foreach my $c ( $cw->infoChildren($topName) ) { $cw->displaySubItem($c); $cw->_scan($c); } $cw->idletasks; } sub _isa { #return UNIVERSAL::isa(@_); return (reftype($_[0]) || '') eq $_[1] ; } sub Populate { my ( $cw, $args ) = @_; require Tk::Menubutton; require Tk::HList; require Tk::ROText; require Tk::Adjuster; $cw->{show_menu} = defined $args->{'show_menu'} ? delete $args->{'show_menu'} : defined $args->{'-show_menu'} ? delete $args->{'-show_menu'} : 0; my $display_show_tied_button = defined $args->{'-show_tied'} || defined $args->{show_tied} ? 0 : 1; $cw->{show_tied} = defined $args->{'-show_tied'} ? delete $args->{'-show_tied'} : defined $args->{show_tied} ? delete $args->{show_tied} : 1; my $scanned_data = delete $args->{'caller'} || delete $args->{'-caller'}; $cw->{chief} = \$scanned_data; my $destroyable = defined $args->{'-destroyable'} ? delete $args->{'-destroyable'} : defined $args->{'destroyable'} ? delete $args->{'destroyable'} : 1; my $destroy_label = delete $args->{'-destroy_label'} // delete $args->{destroy_label} // "destroy"; croak "Missing caller argument in ObjScanner\n" unless defined $cw->{chief}; my $title = delete $args->{title} || delete $args->{-title} || ref( $cw->{chief} ) . ' scanner'; my $background = delete $args->{'background'} || delete $args->{'-background'}; my $selectbackground = delete $args->{'selectbackground'} || delete $args->{'-selectbackground'}; $cw->{itemImg} = delete $args->{'itemImage'} || delete $args->{'-itemImage'} || $cw->Photo( -file => Tk->findINC('textfile.xpm') ); $cw->{foldImg} = delete $args->{'foldImage'} || delete $args->{'-foldImage'} || $cw->Photo( -file => Tk->findINC('folder.xpm') ); $cw->{openImg} = delete $args->{'openImage'} || delete $args->{'-openImage'} || $cw->Photo( -file => Tk->findINC('openfolder.xpm') ); my $menuframe; my $menu; if ( $destroyable or $cw->{show_menu} ) { $menuframe = $cw->Frame( -relief => 'raised', -borderwidth => 1 )-> pack( -pady => 2, -fill => 'x' ); $menu = $cw->{menu} = $menuframe->Menubutton( -text => $title . ' menu' ) ->pack( -fill => 'x', -side => 'left' ); $menu->command( -label => 'reload', -command => sub { $cw->updateListBox; } ); } my %hlist_args; map { $hlist_args{$_} = delete $args->{$_} if defined $args->{$_}; } qw/-columns -header/; my $hlist = $cw->Scrolled( qw\HList -selectmode single -indent 35 -separator | -itemtype imagetext -wideselection 0 \, %hlist_args )->pack(qw/-fill both -expand 1 /); # See Mastering Perl/Tk page 364 for details $hlist->bind( '' => sub { my $y = $Tk::event->y; my $name = $Tk::widget->nearest($y); $cw->displaySubItem( $name, 0 ); } ); $hlist->bind( '' => sub { my $y = $Tk::event->y; my $name = $Tk::widget->nearest($y); $cw->displaySubItem( $name, 1 ); } ) if $cw->{show_tied}; $cw->Advertise( hlist => $hlist ); #my $adj1 = $cw->Adjuster()->packAfter($hlist); my $popup = $cw->{popup} = $cw->Toplevel; $popup->withdraw; $cw->{dumpLabel} = $popup->Label( -text => 'not yet ...' ); $cw->{dumpLabel}->pack( -fill => 'x' ); $cw->{dumpWindow} = $popup->Scrolled( 'ROText', -height => 10 ); $cw->{dumpWindow}->pack( -fill => 'both', -expand => 1 ); $popup->Button( -text => 'OK', -command => sub { $popup->withdraw(); } )->pack; # add a destroy command to the menu $menu->command( -label => $destroy_label, -command => sub { $cw->destroy; } ) if defined $cw->{menu} && $destroyable; $cw->ConfigSpecs( -scrollbars => [ 'DESCENDANTS', undef, undef, 'osoe' ], -background => [ 'DESCENDANTS', 'background', 'Background', $background ], -selectbackground => [ $hlist, 'selectBackground', 'SelectBackground', $selectbackground ], -width => [ $hlist, undef, undef, 80 ], -height => [ $hlist, undef, undef, 25 ], -oldcursor => [ $hlist, undef, undef, undef ], DEFAULT => [$hlist] ); $cw->Delegates( DEFAULT => $hlist ); $cw->SUPER::Populate($args); if ( defined $menuframe ) { $menuframe->Checkbutton( -text => 'show tied info', -variable => \$cw->{show_tied}, -onvalue => 1, -offvalue => 0, -command => sub { $cw->updateListBox; } )->pack( -side => 'right' ) if $display_show_tied_button; } $cw->updateListBox; return $cw; } sub updateListBox { my $cw = shift; my $h = $cw->Subwidget('hlist'); my $root = 'root'; #print "root adding $root \n"; if ( $h->infoExists($root) ) { #print "deleting root children\n"; $h->deleteOffsprings($root); # set new text of root $h->entryconfigure( $root, -text => $cw->element( $cw->{chief} ) ); } else { $h->add( $root, -data => { tied_display => 0, item_ref => $cw->{chief} } ); $h->itemCreate( $root, 0, -image => $cw->{foldImg}, -text => $cw->element( $cw->{chief} ) ); } $cw->displaySubItem( $root, 0 ); } sub displaySubItem { my $cw = shift; my $name = shift; my $do_tie = shift || 0; $do_tie = 0 unless $cw->{show_tied}; my $h = $cw->Subwidget('hlist'); $h->selectionClear(); $h->selectionSet($name); ### my $hash = $h->info( 'data', $name ); my $tied_display = $hash->{tied_display}; my $ref = $hash->{item_ref}; #print "pressed ",$Tk::event->b,',', # $Tk::event->x,' ',$y," for $Tk::widget\n"; # test for tied_display objects my $tied_object; if ( _isa( $$ref, 'ARRAY' ) ) { $tied_object = tied @$$ref; } elsif ( _isa( $$ref, 'HASH' ) ) { $tied_object = tied %$$ref; } elsif ( _isa( $$ref, 'REF' ) ) { $tied_object = tied $$$ref; } else { $tied_object = tied $$ref; } my $is_tied = $do_tie && defined $tied_object ? 1 : 0; my $delete = $is_tied ^ $tied_display; #print "Button clicked for $name (do_tie $do_tie, item $$ref, ", # "tied object $tied_object)\n"; if ($delete) { $hash->{tied_display} = $is_tied; $h->deleteOffsprings($name); } $cw->toggle_display($name); # return if the children are already represented in the hlist return if scalar( $h->infoChildren($name) ); my $ref_to_display = $is_tied ? \$tied_object : $ref; $cw->_swapCursor('watch'); $cw->displayObject( $name, $ref_to_display ); $cw->_swapCursor(); $cw->_redisplayImage($name); } sub toggle_display { my $cw = shift; my $name = shift; my $h = $cw->Subwidget('hlist'); foreach my $child ( $h->infoChildren($name) ) { if ( $h->info( 'hidden', $child ) ) { $h->show( 'entry', $child ); } else { $h->hide( 'entry', $child ); } } $cw->_redisplayImage($name); } sub displayObject { my $cw = shift; my $name = shift; my $ref = shift; my $h = $cw->Subwidget('hlist'); if ( _isa( $$ref, 'ARRAY' )) { foreach my $i ( 0 .. $#$$ref ) { #print "adding array item $i: $_,",ref($_),"\n"; my $img = ref $$ref->[$i] ? $cw->{foldImg} : $cw->{itemImg}; my $npath = $h->addchild( $name, -data => { tied_display => 0, index => $i, item_ref => \$$ref->[$i] } ); $h->itemCreate( $npath, 0, -image => $img, -text => $cw->describe_element( $ref, $i ) ); } } elsif ( _isa( $$ref, 'REF' ) or _isa( $$ref, 'SCALAR' ) ) { my $npath = $h->addchild( $name, -data => { tied_display => 0, item_ref => $$ref } ); $h->itemCreate( $npath, 0, -image => _isa( $$ref, 'REF' ) ? $cw->{foldImg} : $cw->{itemImg}, -text => $cw->describe_element($ref) ); } elsif ( _isa( $$ref, 'CODE' ) ) { require B::Deparse; my $deparse = B::Deparse->new( "-p", "-sC" ); my $body = $deparse->coderef2text($$ref); $cw->popup_text( "B::Deparse code dump", $body ); } elsif ( _isa( $$ref, 'GLOB' ) ) { if ( _isa( $$ref, 'UNIVERSAL' ) ) { my ($what) = ( $$ref =~ /\b([A-Z]+)\b/ ); $cw->popup_text( 'Error', "Sorry, can't display a $what based $$ref object" ); } else { $cw->popup_text( 'Error', "Sorry, can't display " . $$ref . " reference" ); } } elsif ( _isa( $$ref, 'HASH' )) { # hash or object foreach my $k ( sort keys %$$ref ) { #print "adding hash key $name|$k ", ref($$ref->{$k}),"\n"; my $img = ref( $$ref->{$k} ) ? $cw->{foldImg} : $cw->{itemImg}; my $npath = $h->addchild( $name, -data => { tied_display => 0, index => $k, item_ref => \$$ref->{$k} } ); $h->itemCreate( $npath, 0, -text => $cw->describe_element( $ref, $k ), -image => $img ); } } elsif ( defined $$ref ) { #print "adding scalar $name , $$ref is a scalar\n"; $cw->popup_text( 'scalar dump', $$ref ) if $$ref =~ /\n/; } } sub describe_element { my ( $cw, $ref, $index ) = @_; if ( _isa( $$ref, 'ARRAY' )) { return "[$index]-> " . $cw->element( \$$ref->[$index] ); } elsif ( _isa( $$ref, 'REF' ) or _isa( $$ref, 'SCALAR' ) ) { return $cw->element($$ref); } elsif ( _isa( $$ref, 'HASH' )) { return ( "{$index}-> " . $cw->element( \$$ref->{$index} ) ); } else { die "describe_element: unexpected type $$ref, index $index"; } } sub popup_text { my ( $cw, $title, $text ) = @_; $cw->{popup}->title($title); $cw->{dumpLabel}->configure( -text => $title ); $cw->{dumpWindow}->delete( '1.0', 'end' ); $cw->{dumpWindow}->insert( 'end', $text ); $cw->{popup}->deiconify; $cw->{popup}->raise; } sub analyse_element { my $cw = shift; my $ref = shift; my %info = ( description => '' ); confess "ref error" unless ref($ref); $info{element_ref} = $ref; my $str_ref = ref($$ref); $info{tied} = $str_ref eq 'HASH' ? tied %$$ref : $str_ref eq 'ARRAY' ? tied @$$ref : $str_ref eq 'SCALAR' ? tied $$$ref : $str_ref eq 'REF' ? tied $$$ref : $str_ref ? undef : tied $$ref; if ( not defined $$ref ) { $info{description} = 'undefined'; } elsif ( $str_ref and _isa( $$ref, 'UNIVERSAL' ) ) { $info{class} = $str_ref; $info{base} = _isa( $$ref, 'SCALAR' ) ? 'SCALAR' : ( $$ref =~ /=([A-Z]+)\(/ ) ? $1 : "some magic with $$ref"; # desperate measure $info{description} = "$str_ref OBJECT based on $info{base}"; } elsif ($str_ref) { # a ref but not an object $info{description} = $str_ref; } elsif ( $$ref =~ /\n/ ) { # multi-line string $info{description} = 'double click here to display value'; } else { # plain scalar $info{value} = $$ref; } if ( defined $$ref ) { $info{nb} = _isa( $$ref, 'ARRAY' ) ? scalar(@$$ref) : _isa( $$ref, 'HASH' ) ? scalar keys(%$$ref) : undef; } if ( $str_ref and isweak($$ref) ) { $info{description} .= ' (weak ref)'; } return \%info; } sub element { my $cw = shift; my $ref = shift; my $info = $cw->analyse_element($ref); my $what = $info->{description} || "'$info->{value}'"; my $nb = $info->{nb}; my $tied = $info->{tied}; $what .= " ($nb)" if defined $nb; $what .= " (tied with " . ref($tied) . ")" if defined $tied and $cw->{show_tied}; return $what; } sub _swapCursor { my ( $cw, $cursor ) = @_; my $parent = $cw->parent; if ( defined($cursor) ) { $cw->{oldcursor} = $parent->cget('-cursor'); # save $parent->configure( -cursor => $cursor ); # replace } else { $parent->configure( -cursor => $cw->{oldcursor} ); # restore } $parent->update; # does not seem to be absolutely necessary } sub _redisplayImage { my ( $cw, $name ) = @_; my $h = $cw->Subwidget('hlist'); my @children = $h->infoChildren($name); return if @children == 0; my $image = $h->info( 'hidden', $children[0] ) ? $cw->{foldImg} : $cw->{openImg}; $h->entryconfigure( $name, '-image' => $image ); } 1; __END__ =head1 NAME Tk::ObjScanner - a GUI to scan any perl data structure or object =head1 SYNOPSIS # regular use use Tk::ObjScanner; my $mw = MainWindow->new; my $scanner1 = $mw->ObjScanner( -caller => $object, -title=>"windows" )->pack; my $scanner2 = $mw->ObjScanner( -caller => $object, -title => 'demo setting the scanner options', -background => 'white', -selectbackground => 'beige', -foldImage => $mw->Photo(-file => Tk->findINC('folder.xpm')), -openImage => $mw->Photo(-file => Tk->findINC('openfolder.xpm')), -itemImage => $mw->Photo(-file => Tk->findINC('textfile.xpm')), )->pack( -expand => 1, -fill => 'both' ) ; # non-intrusive scan style # user code to produce data Tk::ObjScanner::scan_object($mydata) ; # resume user code =head1 DESCRIPTION The scanner provides a GUI to scan the attributes of an object. It can also be used to scan the elements of a hash or an array. This widget can be used as a regular widget in a Tk application or can be used as an autonomous popup widget that will display the content of a data structure. The latter is like a call to a graphical L. The scanner can be used in an autonomous way with the C function. The scanner is a composite widget made of a menubar and L. This widget acts as a scanner to the object (or hash ref) passed with the 'caller' parameter. The scanner will retrieve all keys of the hash/object and insert them in the HList. When the user double clicks on a key, the corresponding value will be added in the HList. If the value is a multi-line scalar, the scalar will be displayed in a popup text window. Code ref will be deparsed and shown also in the pop-up window. Tied scalar, hash or array internal can also be scanned by clicking on the I button to open them. Weak references are recognized (See L for details) =head1 Autonomous widget =head2 scan_object( data ) This function is not exported and must be called this way: Tk::ObjScanner::scan_object($data); This function will load Tk and pop up a scanner widget. When the user destroy the widget (with C destroy> menu), the user code is resumed. =head1 Constructor parameters =over 4 =item C The ref of the object or hash or array to scan (mandatory). (you can also use 'C<-caller>') =item C<-title> The title of the menu created by the scanner (optional) =item C<-background> The background color for subwidgets (optional) =item C<-selectbackground> The select background color for HList (optional) =item C<-itemImage> The image for a scalar item (optional, default 'file.xbm') =item C<-foldImage> The image for a composite item (array or hash) when closed (optional, default 'folder.xbm') =item C<-openImage> The image for a composite item (array or hash) when open (optional, default 'openfolder.xbm') =item C<-show_menu> ObjScanner can feature a menu with 'reload' button, 'show tied info'. (optional default 0). =item C<-destroyable> If set, a menu entry will allow the user to destroy the scanner widget. (optional, default 1) . You may want to set this parameter to 0 if the destroy can be managed by a higher level object. This parameter is ignored if show_menu is unset. =item C<-destroy_label> Label to be used for C menu entry. =item C<-show_tied> If set, will indicate if a variable is a tied variable. You can see the internal data of the tied variable by double clicking on the middle button. (default 1) =back =head1 WIDGET-SPECIFIC METHODS =head2 updateListBox Update the keys of the listbox. This method may be handy if the scanned object wants to update the listbox of the scanner when the scanned object gets new attributes. =head1 CAVEATS The name of the widget is misleading as any data (not only object) may be scanned. This widget is in fact a DataScanner. ObjScanner may fail if an object involves a lot of internal perl magic. In this case, I'd be glad to hear about and I'll try to fix the problem. ObjScanner does not detect recursive data structures. It will just keep on displaying the tree until the user gets tired of clicking on the HList items. The icon used for tied scalar changes from scalar icon to folder icon when opening the object hidden behind the tied scalar (using the middle button). I sure could use a better icon for tied items. (hint hint) =head1 THANKS To Rudi Farkas for all the improvements provided to ObjScanner. To Slaven Rezic for: =over =item * The idea to use B::Deparse to view code ref. =back =head1 CONTRIBUTORS Many thanks to Achim Bohnet for all the tests, patches (and reports) he made. Many improvements were made thanks to his efforts. Thanks to Rudi Farkas for the 'watch' patch. Thanks to heytitle for the documentation fixes =head1 AUTHOR Dominique Dumont, ddumont@cpan.org =head1 SEE ALSO L, L, L, L, L =cut Tk-ObjScanner-2.018/t/0000755000175000017500000000000014515247403013036 5ustar domidomiTk-ObjScanner-2.018/t/basic.t0000644000175000017500000000711314515247403014306 0ustar domidomiuse warnings FATAL => qw(all); # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' use Test::More ; use Tk ; use ExtUtils::testlib ; BEGIN { use_ok ('Tk::ObjScanner') ; }; use strict ; my $trace = shift || 0 ; package myHash; use Tie::Hash ; use vars qw/@ISA/; @ISA=qw/Tie::StdHash/ ; sub TIEHASH { my $class = shift; my %args = @_ ; return bless { %args, dummy => 'foo' } , $class ; } sub STORE { my ($self, $idx, $value) = @_ ; $self->{$idx}=$value; return $value; } package MyScalar; use Tie::Scalar ; use vars qw/@ISA/; @ISA=qw/Tie::StdHash/ ; sub TIESCALAR { my $class = shift; my %args = @_ ; return bless { %args, dummy => 'foo default value' } , $class ; } sub STORE { my ($self, $value) = @_ ; $self->{data} = $value; return $value; } sub FETCH { my ($self) = @_ ; # print "\t\t",'@.....@.....@..... MeScalar read',"\n"; return $self->{data} || $self->{dummy} ; } package Toto ; use Scalar::Util qw(weaken) ; sub new { my $type = shift ; my %h ; tie (%h, 'myHash', 'dummy key' => 'dummy value') or die ; $h{data1}='value1'; # add recursive data only if interactive test my $tkstuff = $trace ? shift : "may be another time ..." ; my $scalar = 'dummy scalar ref value'; open (FILE,"t/basic.t") || die "can't open myself !\n"; my %a_hash = (for => 'weak ref') ; 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", 'tied hash' => \%h , 'not weak' => \%a_hash, 'weak' => \%a_hash , 'tk widget' => $tkstuff }; tie ($self->{tied_scalar}, 'MyScalar', 'dummy key' => 'dummy value') or die ; weaken($self->{weak}) ; $self->{tied_scalar} = 'some scalar huh?'; bless $self,$type; } package main; SKIP: { my $toto ; my $mw = eval { MainWindow-> new ; }; # cannot create Tk window if (not $mw) { skip "Cannot create Tk window", 1 ; done_testing ; exit; } $mw->geometry('600x400+10+10'); my $w_menu = $mw->Frame(-relief => 'raised', -borderwidth => 2); $w_menu->pack(-fill => 'x'); my $f = $w_menu->Menubutton(-text => 'File', -underline => 0) -> pack(-side => 'left' ); $f->command(-label => 'Quit', -command => sub{$mw->destroy;} ); my $dummy = Toto->new ($mw); ok($dummy, "created dummy object"); my $s = $mw -> ObjScanner ('-caller' => $dummy, -columns => 4, -header => 1 ); ok($s, "Created obj scanner"); $s->headerCreate(1,-text =>'coucou') ; $s -> pack(-expand => 1, -fill => 'both') ; $mw->idletasks; sub scan { my $topName = shift ; $s->yview($topName) ; ok(1, "view $topName"); $mw->after(200); # sleep 300ms foreach my $c ($s->infoChildren($topName)) { $s->displaySubItem($c); scan($c); } $mw->idletasks; } if ($trace) { MainLoop ; # Tk's } else { scan('root'); } } done_testing; Tk-ObjScanner-2.018/t/scanner.t0000644000175000017500000000072614515247403014661 0ustar domidomi# -*- cperl -*- use warnings FATAL => qw(all); use strict; use ExtUtils::testlib; use Test::More ; use Tk ; BEGIN { use_ok ('Tk::ObjScanner') ; }; my $trace = shift || 0 ; my $data = { foo => 'bar', bar => 'baz' } ; my $animate = $trace ? 0 : 1 ; SKIP: { my $mw = eval { MainWindow-> new ; }; # cannot create Tk window skip "Cannot create Tk window", 1 unless $mw; Tk::ObjScanner::scan_object($data,$animate, $mw) ; ok(1) ; } done_testing; Tk-ObjScanner-2.018/t/options.t0000644000175000017500000001010714515247403014715 0ustar domidomi### ### test of Tk:ObjScanner options ### by Rudi Farkas rudif@lecroy.com 27 May 1999 ### use strict; use warnings FATAL => qw(all); use Test::More ; use Tk ; use ExtUtils::testlib ; BEGIN { use_ok ('Tk::ObjScanner') ; }; my $trace = shift || 0 ; package myHash; use Tie::Hash ; use vars qw/@ISA/; sub TIEHASH { my $type = shift; my $self={ 'tied_attr1' => 'hidden data1', 'tied_attr2' => 'hidden data2' } ; bless $self,$type; my %args = @_ ; return $self ; } sub STORE { my ($self,$index,$value) = @_ ; return $self->{data}{$index} = $value ; } sub FETCH { my ($self,$index) = @_ ; return $self->{data}{$index} ; } sub DELETE { my $self = shift; my $idx = shift ; delete $self->{data}{$idx}; } sub CLEAR { my $self = shift; $self->{data} = {} ; } sub EXISTS { my $self = shift; my $idx = shift ; return exists $self->{data}{$idx}; } sub FIRSTKEY { my $self = shift; my $a = keys %{$self->{data}}; # reset each() iterator each %{$self->{data}} } sub NEXTKEY { my $self = shift; return each %{ $self->{data} } ; } package Toto ; my %h ; tie %h, 'myHash', 'dummy key' => 'dummy value' or die ; $h{'user_data1'} = 'non hidden data' ; use FileHandle; use Benchmark; use Math::BigInt; sub new { my $type = shift ; # add recursive data only if interactive test my $tkstuff = $trace ? shift : "may be another time ..." ; my $scl = 'my scalar var'; my $self = { 'scalar: key1' => 'value1', 'ref array:' => [qw/a b sdf/, {'v1' => '1', 'v2' => 2},'dfg'], 'ref hash: key2' => { 'sub key1' => 'sv1', 'sub key2' => 'sv2' }, 'ref hash: piped|key' => {a => 1 , b => 2}, 'scalar: long' => 'very long line'.'.' x 80 , 'scalar: is undef' => undef, 'scalar: some text' => "some \n dummy\n Text\n", 'ref blessed hash: tk widget' => $tkstuff, 'ref const' => \12345, 'ref scalar' => \$scl, 'ref ref tk widget' => \$tkstuff, # ref to ref (assumes $tkstuff is a ref) 'ref code' => sub { my $x = shift; sin($x) + cos(2*$x) }, 'ref blessed glob' => new FileHandle, 'ref blessed array' => new Benchmark, 'ref blessed scalar' => new Math::BigInt('123 456 789 123 456 789'), 'tied hash' => \%h , } ; bless $self,$type; } package main; SKIP: { my $toto ; my $mw = eval { MainWindow-> new ; }; # cannot create Tk window if (not $mw) { skip "Cannot create Tk window", 1 ; } $mw->geometry('600x400+10+10'); my $w_menu = $mw->Frame(-relief => 'raised', -borderwidth => 2); $w_menu->pack(-fill => 'x'); my $f = $w_menu->Menubutton(-text => 'File', -underline => 0) -> pack(-side => 'left' ); $f->command(-label => 'Quit', -command => sub{$mw->destroy;} ); my $dummy = new Toto ($mw); ok($dummy, "created dummy object"); print "Creating obj scanner\n" if $trace ; my $s = $mw -> ObjScanner ( caller => $dummy, title => 'test scanner options', background => 'white', selectbackground => 'beige', show_menu => 1, foldImage => $mw->Photo(-file => Tk->findINC('folder.xpm')), openImage => $mw->Photo(-file => Tk->findINC('openfolder.xpm')), itemImage => $mw->Photo(-file => Tk->findINC('textfile.xpm')) ); $s -> pack(-expand => 1, -fill => 'both') ; ok($s, "Created obj scanner"); $mw->idletasks; sub scan { my $topName = shift ; ok(1, "view $topName"); $s->yview($topName) ; $mw->after(200); # sleep 300ms foreach my $c ($s->infoChildren($topName)) { $s->displaySubItem($c,1); scan($c); } $mw->idletasks; } if ($trace) { MainLoop ; # Tk's } else { scan('root'); } } done_testing; Tk-ObjScanner-2.018/t/rudi.t0000644000175000017500000000546014515247403014173 0ustar domidomi use strict; use warnings FATAL => qw(all); ### ### variant of test.pl for Tk:ObjScanner, with additional test cases ### by R Farkas rudif@lecroy.com 27 Jun 1999 ### use Test::More ; use Tk ; use ExtUtils::testlib ; BEGIN { use_ok ('Tk::ObjScanner') ; }; my $trace = shift || 0 ; package toto ; use FileHandle; use Benchmark; use Math::BigInt; sub new { my $type = shift; # add recursive data only if interactive test my $tkstuff = $trace ? shift : "may be another time ..." ; my $scl = 'my scalar var'; my $self = { 'scalar: key1' => 'value1', 'ref array:' => [qw/a b sdf/, {'v1' => '1', 'v2' => 2},'dfg'], 'ref hash: key2' => { 'sub key1' => 'sv1', 'sub key2' => 'sv2' }, 'ref hash: piped|key' => {a => 1 , b => 2}, 'scalar: long' => 'very long line'.'.' x 80 , 'scalar: is undef' => undef, 'scalar: some text' => "some \n dummy\n Text\n", 'ref blessed hash: tk widget' => $tkstuff, 'ref const' => \12345, 'ref scalar' => \$scl, 'ref ref tk widget' => \$tkstuff, # ref to ref (assumes $tkstuff is a ref) 'ref code' => sub { my $x = shift; sin($x) + cos(2*$x) }, 'ref blessed glob' => new FileHandle, 'ref blessed array' => new Benchmark, 'ref blessed scalar' => new Math::BigInt '123 456 789 123 456 789', } ; bless $self,$type; } package main; SKIP: { my $toto ; my $mw = eval { MainWindow-> new ; }; # cannot create Tk window if (not $mw) { skip "Cannot create Tk window", 1 ; done_testing ; exit; } $mw->geometry('600x400+10+10'); my $w_menu = $mw->Frame(-relief => 'raised', -borderwidth => 2); $w_menu->pack(-fill => 'x'); my $f = $w_menu->Menubutton(-text => 'File', -underline => 0) -> pack(-side => 'left' ); $f->command(-label => 'Quit', -command => sub{$mw->destroy;} ); my $dummy = new toto ($mw); ok($dummy, "created dummy object"); my $s = $mw -> ObjScanner ( 'caller' => $dummy, title => 'test scanner' ); $s -> pack(-expand => 1, -fill => 'both') ; ok($s, "Created obj scanner"); $mw->idletasks; sub scan { my $topName = shift ; ok(1, "view $topName"); $s->yview($topName) ; $mw->after(200); # sleep 300ms foreach my $c ($s->infoChildren($topName)) { $s->displaySubItem($c); scan($c); } $mw->idletasks; } if ($trace) { MainLoop ; # Tk's } else { scan('root'); } } done_testing; Tk-ObjScanner-2.018/dist.ini0000644000175000017500000000175414515247403014246 0ustar domidominame = Tk-ObjScanner author = Dominique Dumont license = Perl_5 copyright_holder = Dominique Dumont copyright_year = 1997-2004,2007,2014,2017,2023 [MetaResources] homepage = https://github.com/dod38fr/perl-tk-objscanner bugtracker.mailto = ddumont at cpan.org bugtracker.web = https://github.com/dod38fr/perl-tk-objscanner/issues repository.url = https://github.com/dod38fr/perl-tk-objscanner.git repository.web = https://github.com/dod38fr/perl-tk-objscanner repository.type = git [Prereqs] perl = 5.016 [GatherDir] exclude_filename = data-viewer.png exclude_match = ~$ [@Filter] -bundle = @Basic -remove = Readme -remove = GatherDir [AutoPrereqs] skip = ^[a-z\d]+$ skip = ExtUtils::testlib skip = Exporter [Prepender] copyright=1 [NextRelease] format = %v%T %{yyyy-MM-dd}d [PkgVersion] ; use 'V=2.234 dzil release' to override version number [Git::NextVersion] [Git::Check] allow_dirty = dist.ini allow_dirty = Changes [Git::Commit] [Git::Tag] [Git::Push] [MetaJSON] Tk-ObjScanner-2.018/MANIFEST0000644000175000017500000000035514515247403013727 0ustar domidomi# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.030. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README.org bin/data-viewer dist.ini lib/Tk/ObjScanner.pm t/basic.t t/options.t t/rudi.t t/scanner.t Tk-ObjScanner-2.018/LICENSE0000644000175000017500000004655614515247403013620 0ustar domidomiThis software is copyright (c) 1997-2004,2007,2014,2017,2023 by Dominique Dumont. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 1997-2004,2007,2014,2017,2023 by Dominique Dumont. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 1997-2004,2007,2014,2017,2023 by Dominique Dumont. This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Tk-ObjScanner-2.018/META.yml0000644000175000017500000000216014515247403014043 0ustar domidomi--- abstract: 'a GUI to scan any perl data structure or object' author: - 'Dominique Dumont' build_requires: Benchmark: '0' FileHandle: '0' Math::BigInt: '0' Test::More: '0' Tie::Hash: '0' Tie::Scalar: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.030, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Tk-ObjScanner requires: B::Deparse: '0' Carp: '0' Data::Dumper: '0' Getopt::Long: '0' JSON: '0' Path::Tiny: '0' Scalar::Util: '1.01' Tk: '0' Tk::Adjuster: '0' Tk::Derived: '0' Tk::Frame: '0' Tk::HList: '0' Tk::Menubutton: '0' Tk::ROText: '0' YAML::PP: '0' perl: '5.016' resources: bugtracker: https://github.com/dod38fr/perl-tk-objscanner/issues homepage: https://github.com/dod38fr/perl-tk-objscanner repository: https://github.com/dod38fr/perl-tk-objscanner.git version: '2.018' x_generated_by_perl: v5.36.0 x_serialization_backend: 'YAML::Tiny version 1.74' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' Tk-ObjScanner-2.018/Makefile.PL0000644000175000017500000000417614515247403014555 0ustar domidomi# # This file is part of Tk-ObjScanner # # This software is copyright (c) 1997-2004,2007,2014,2017,2023 by Dominique Dumont. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.030. use strict; use warnings; use 5.016; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "a GUI to scan any perl data structure or object", "AUTHOR" => "Dominique Dumont", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Tk-ObjScanner", "EXE_FILES" => [ "bin/data-viewer" ], "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.016", "NAME" => "Tk::ObjScanner", "PREREQ_PM" => { "B::Deparse" => 0, "Carp" => 0, "Data::Dumper" => 0, "Getopt::Long" => 0, "JSON" => 0, "Path::Tiny" => 0, "Scalar::Util" => "1.01", "Tk" => 0, "Tk::Adjuster" => 0, "Tk::Derived" => 0, "Tk::Frame" => 0, "Tk::HList" => 0, "Tk::Menubutton" => 0, "Tk::ROText" => 0, "YAML::PP" => 0 }, "TEST_REQUIRES" => { "Benchmark" => 0, "FileHandle" => 0, "Math::BigInt" => 0, "Test::More" => 0, "Tie::Hash" => 0, "Tie::Scalar" => 0 }, "VERSION" => "2.018", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "B::Deparse" => 0, "Benchmark" => 0, "Carp" => 0, "Data::Dumper" => 0, "FileHandle" => 0, "Getopt::Long" => 0, "JSON" => 0, "Math::BigInt" => 0, "Path::Tiny" => 0, "Scalar::Util" => "1.01", "Test::More" => 0, "Tie::Hash" => 0, "Tie::Scalar" => 0, "Tk" => 0, "Tk::Adjuster" => 0, "Tk::Derived" => 0, "Tk::Frame" => 0, "Tk::HList" => 0, "Tk::Menubutton" => 0, "Tk::ROText" => 0, "YAML::PP" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs);