This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 3.0: (no announcement message available)
[perl5.git] / lib / dumpvar.pl
1 package dumpvar;
2
3 sub main'dumpvar {
4     ($package) = @_;
5     local(*stab) = eval("*_$package");
6     while (($key,$val) = each(%stab)) {
7         {
8             local(*entry) = $val;
9             if (defined $entry) {
10                 print "\$$key = '$entry'\n";
11             }
12             if (defined @entry) {
13                 print "\@$key = (\n";
14                 foreach $num ($[ .. $#entry) {
15                     print "  $num\t'",$entry[$num],"'\n";
16                 }
17                 print ")\n";
18             }
19             if ($key ne "_$package" && defined %entry) {
20                 print "\%$key = (\n";
21                 foreach $key (sort keys(%entry)) {
22                     print "  $key\t'",$entry{$key},"'\n";
23                 }
24                 print ")\n";
25             }
26         }
27     }
28 }