diff options
Diffstat (limited to 'ext/B/B/Stash.pm')
-rw-r--r-- | ext/B/B/Stash.pm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/B/B/Stash.pm b/ext/B/B/Stash.pm new file mode 100644 index 0000000000..42c8bc0fd3 --- /dev/null +++ b/ext/B/B/Stash.pm @@ -0,0 +1,29 @@ +# Stash.pm -- show what stashes are loaded +# vishalb@hotmail.com +package B::Stash; + +BEGIN { %Seen = %INC } + +END { + my @arr=scan($main::{"main::"}); + @arr=map{s/\:\:$//;$_;} @arr; + print "-umain,-u", join (",-u",@arr) ,"\n"; +} +sub scan{ + my $start=shift; + my @return; + foreach my $key ( keys %{$start}){ + if ($key =~ /::$/){ + unless ($start eq ${$start}{$key} or $key eq "B::" ){ + push @return, $key ; + foreach my $subscan ( scan(${$start}{$key})){ + push @return, "$key".$subscan; + } + } + } + } + return @return; +} +1; + + |