42c8bc0fd3172402d4fd936b9fb16f5e8ee87e5b
[p5sagit/p5-mst-13.2.git] / ext / B / B / Stash.pm
1 # Stash.pm -- show what stashes are loaded
2 # vishalb@hotmail.com 
3 package B::Stash;
4
5 BEGIN { %Seen = %INC }
6
7 END {
8         my @arr=scan($main::{"main::"});
9         @arr=map{s/\:\:$//;$_;}  @arr;
10         print "-umain,-u", join (",-u",@arr) ,"\n";
11 }
12 sub scan{
13         my $start=shift;
14         my @return;
15         foreach my $key ( keys %{$start}){
16                 if ($key =~ /::$/){
17                         unless ($start  eq ${$start}{$key} or $key eq "B::" ){
18                                 push @return, $key ;
19                                 foreach my $subscan ( scan(${$start}{$key})){
20                                         push @return, "$key".$subscan;  
21                                 }
22                         }
23                 }
24         }
25         return @return;
26 }
27 1;
28
29