diff options
Diffstat (limited to 'lib/dumpvar.pl')
-rw-r--r-- | lib/dumpvar.pl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl new file mode 100644 index 0000000000..8a49ec09e7 --- /dev/null +++ b/lib/dumpvar.pl @@ -0,0 +1,28 @@ +package dumpvar; + +sub main'dumpvar { + ($package) = @_; + local(*stab) = eval("*_$package"); + while (($key,$val) = each(%stab)) { + { + local(*entry) = $val; + if (defined $entry) { + print "\$$key = '$entry'\n"; + } + if (defined @entry) { + print "\@$key = (\n"; + foreach $num ($[ .. $#entry) { + print " $num\t'",$entry[$num],"'\n"; + } + print ")\n"; + } + if ($key ne "_$package" && defined %entry) { + print "\%$key = (\n"; + foreach $key (sort keys(%entry)) { + print " $key\t'",$entry{$key},"'\n"; + } + print ")\n"; + } + } + } +} |