3 use B qw(svref_2object comppadlist class);
8 # perl -MO=Showlex,foo bar.pl
9 # to see the names of lexical variables used by &foo
11 # perl -MO=Showlex bar.pl
12 # to see the names of file scope lexicals used by bar.pl
20 print "$name has $count entries\n";
21 for ($i = 0; $i < $count; $i++) {
28 my ($objname, $namesav, $valsav) = @_;
29 showarray("Pad of lexical names for $objname", $namesav);
30 showarray("Pad of lexical values for $objname", $valsav);
34 my ($objname, $obj) = @_;
35 $objname =~ s/^&main::/&/;
36 showlex($objname, svref_2object($obj)->PADLIST->ARRAY);
40 showlex("comppadlist", comppadlist->ARRAY);
48 foreach $objname (@options) {
49 $objname = "main::$objname" unless $objname =~ /::/;
50 eval "showlex_obj('&$objname', \\&$objname)";
54 return \&showlex_main;
64 B::Showlex - Show lexical variables used in functions or files
68 perl -MO=Showlex[,SUBROUTINE] foo.pl
72 When a subroutine name is provided in OPTIONS, prints the lexical
73 variables used in that subroutine. Otherwise, prints the file-scope
78 Malcolm Beattie, C<mbeattie@sable.ox.ac.uk>