Tk-Browser
view release on metacpan or search on metacpan
$kl -> insert( 'end', $s -> {name}." => $contents" );
}
} elsif ( defined *v{IO} ) {
$contents = '<'.$key.'>' if $key;
if( $list ) {
$kl -> insert( 'end', $s -> {name}." => $contents" );
}
} elsif ( defined ${*v{SCALAR}} ) {
# If it's uninitialized don't list it.
$contents = "\'${*v{SCALAR}}\'";
if( $list ) {
$kl -> insert( 'end', $s -> {name}." => $contents" );
}
}
}
return @{$m -> Symbols};
}
sub modImport {
my ($pkg) = @_;
eval "package $pkg";
eval "use $pkg";
eval "require $pkg";
}
sub menus {
my ($b, $w) = @_;
my $items;
$b -> {menubar} = $w -> Menu ( -type => 'menubar' );
$b -> {filemenu} = $b -> {menubar} -> Menu;
$b -> {editmenu} = $b -> {menubar} -> Menu;
$b -> {modulemenu} = $b -> {menubar} -> Menu;
$b -> {viewmenu} = $b -> {menubar} -> Menu;
$b -> {symbolmenu} = $b -> {menubar} -> Menu;
$b -> {helpmenu} = $b -> {menubar} -> Menu;
$b -> menubar -> add ('cascade', -label => 'File',
-menu => $b -> {filemenu} );
$b -> menubar ->add ('cascade', -label => 'Edit',
-menu => $b -> {editmenu} );
$b -> menubar -> add ('cascade', -label => 'View',
-menu => $b -> {viewmenu} );
$b -> menubar ->add ('cascade', -label => 'Library',
-menu => $b -> {modulemenu} );
$b -> menubar -> add ('cascade', -label => 'Package',
-menu => $b -> {symbolmenu} );
$b -> menubar -> add ('separator');
$b -> menubar -> add ('cascade', -label => 'Help',
-menu => $b -> {helpmenu} );
$b -> menubar -> pack( -anchor => 'w', -fill => 'x' );
$b -> filemenu -> add( 'command', -label => 'Open Selected Module',
-command => sub{ openSelectedModule( $b ) } );
$b -> filemenu -> add( 'command', -label => 'Save Info...',
-command => sub{ saveInfo( $b ) } );
$b -> filemenu -> add ('separator');
$b -> filemenu -> add( 'command', -label => 'Exit',
-command => sub{ $b->window->WmDeleteWindow});
$b -> editmenu -> add( 'command', -label => 'Copy',
-command => sub{$b->editor->clipboardCopy});
$b -> editmenu -> add( 'command', -label => 'Cut',
-command => sub{$b->editor->clipboardCut});
$b -> editmenu -> add( 'command', -label => 'Paste',
-command => sub{$b->editor->clipboardPaste});
$b -> modulemenu -> add ( 'command', -label => 'Read Again',
-state => 'normal',
-command => sub{mod_reload($b)});
$b -> modulemenu -> add ( 'command', -label => 'List Imported',
-state => 'normal',
-command => sub{listimports($b)});
$b -> viewmenu -> add( 'radiobutton', -label => 'Source',
-variable => \$b -> {modview},
-value => 'source');
$b -> viewmenu -> add( 'radiobutton', -label => 'POD Documentation',
-variable => \$b -> {modview},
-value => 'doc');
$b -> viewmenu -> add( 'radiobutton', -label => 'Module Info',
-variable => \$b -> {modview},
-value => 'info');
$b -> viewmenu -> invoke( 1 );
$b -> viewmenu -> add ('separator');
# $b -> viewmenu -> add( 'command', -label => '*main:: Stash',
# -state => 'normal',
# -command => sub{viewmain($b)} );
$b -> viewmenu -> add( 'command', -label => 'Package Stashes',
-state => 'normal',
-command => sub{packagestashes($b)} );
$b -> symbolmenu -> add( 'radiobutton', -label => '*main:: Stash',
-variable => \$b -> {symbolrefs},
-value => 'mainstash');
$b -> symbolmenu -> add( 'radiobutton', -label => 'Symbol Table Imports',
-variable => \$b -> {symbolrefs},
-value => 'packagestash');
$b -> symbolmenu -> add( 'radiobutton', -label => 'Lexical',
-variable => \$b -> {symbolrefs},
-value => 'lexical');
$b -> symbolmenu -> add( 'radiobutton', -label => 'Cross References',
-variable => \$b -> {symbolrefs},
-value => 'xrefs');
$b -> symbolmenu -> invoke( 1 );
$b -> helpmenu -> add ( 'command', -label => 'About...',
-state => 'normal',
-command => sub{about($b)});
$b -> helpmenu -> add ( 'command', -label => 'Help...',
-state => 'normal',
-accelerator => "F1",
-command => sub{$b -> self_help(__FILE__)});
$b -> window -> SUPER::bind('<F1>',
sub{$b -> self_help( __FILE__)});
$b->modulepopupmenu($b->filelist->Menu(-type=>'normal',-tearoff => ''));
$b->textpopupmenu($b->editor->Menu(-type=>'normal',-tearoff => ''));
$b->symbolpopupmenu($b->symbollist->Menu(-type=>'normal',-tearoff => '' ));
$b -> filelist -> bind( '<ButtonPress-3>',[\&postpopupmenu,
$b -> modulepopupmenu,Ev('X'), Ev('Y') ] );
$b -> symbollist -> bind( '<ButtonPress-3>',[\&postpopupmenu,
$b -> symbolpopupmenu,Ev('X'), Ev('Y') ] );
$b -> window -> bind('Tk::Text', '<3>','' );
$b -> editor -> bind( '<ButtonPress-3>',[\&postpopupmenu,
$b -> textpopupmenu,Ev('X'), Ev('Y') ] );
$b -> modulepopupmenu -> add( 'command', -label => 'Find...',
-command => [\&findModule, $b ]);
"View," menu.
If the default Perl configuration includes '.' in the @INC path array,
the browser also displays modules in the current directory and its
subdirectories.
The section L<MENU FUNCTIONS> describes the menu bar functions.
If the entire library is scanned, the listing starts with the default
class, UNIVERSAL. Selecting the main:: Symbol Table display from the
View menu displays all of the symbols in the default stash, including
those of the the Browser itself. In this stash also are the path
names of library modules that are imported at run time.
The Modules ==> List Imports menu option opens a window that lists all
symbol table imports.
The open() method's B<package> option browses the first package which
has a matching name, after locating it in the Perl library's @INC
directories. The B<pathname> argument specifies the path name of a
single Perl module to browse. For example:
. . .
my $b = new Tk::Browser;
if( -e $ARGV[0] ) { # Package file name.
$b -> open(pathname => $ARGV[0]);
} elsif( $ARGV[0] ) { # Module name
$b -> open(package => $ARGV[0]);
} else { # No argument: scan everything.
$b -> open;
}
. . .
MainLoop;
=head1 MENU FUNCTIONS
=head2 File Menu
=head3 Open Selected Module
Open a new browser for the module selected in the module list window.
=head3 Save Info...
Open a FileBrowser and prompt for a file name. Save the information
in each of the browser windows to the text file.
=head3 Exit
Exit the browser and close the window.
=head2 Edit Menu
=head3 Cut
Move selected text from the editor pane to the X clipboard.
=head3 Copy
Copy selected text from the editor pane to the X clipboard.
=head3 Paste
Insert text from the X clipboard at the text editor pane's insertion
point.
=head2 View Menu
=head3 Source
View module source code of selected module.
=head3 POD Documentation
Format and view the selected module's POD documentation, if any.
=head3 Module Info
List the selected module's package name, module filename, version, and
superclasses.
=head3 Package Stashes
Filter current symbol list to show only secondary stashes and their
symbols.
=head2 Library Menu
=head3 Read Again
Re-scan the Perl library directories and files.
=head3 View Imported
List files in the main:: stash that were imported by Perl.
=head2 Packages Menu
=head3 main:: Stash
View the symbols in the main:: symbol table hash.
=head3 Symbol Table Imports
View symbols that are in the module's symbol table hash.
=head3 Lexical
View symbols parsed from the module's source code.
=head3 Cross References
For non-local stash symbols, check for cross references in other
modules that have been loaded by the interpreter. Warning: Cross
referencing can take a considerable amount of time.
=head2 Help Menu
=head3 About
Display the version number and authorship of the Browser library.
=head3 Help
( run in 1.071 second using v1.01-cache-2.11-cpan-84e82930d8c )