summaryrefslogtreecommitdiff
path: root/lib/dumpvar.pl
blob: b8cff8952c60bef4b465ac6d6a0af97cadef6bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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";
	    }
	}
    }
}

1;