Commit | Line | Data |
a6f4eb0a |
1 | # Stash.pm -- show what stashes are loaded |
2 | # vishalb@hotmail.com |
3 | package B::Stash; |
4 | |
5 | BEGIN { %Seen = %INC } |
6 | |
7d30b5c4 |
7 | CHECK { |
a6f4eb0a |
8 | my @arr=scan($main::{"main::"}); |
ccc418af |
9 | @arr=map{s/\:\:$//;$_ eq "<none>"?():$_;} @arr; |
a6f4eb0a |
10 | print "-umain,-u", join (",-u",@arr) ,"\n"; |
11 | } |
12 | sub scan{ |
13 | my $start=shift; |
56eca212 |
14 | my $prefix=shift; |
15 | $prefix = '' unless defined $prefix; |
a6f4eb0a |
16 | my @return; |
17 | foreach my $key ( keys %{$start}){ |
56eca212 |
18 | # print $prefix,$key,"\n"; |
a6f4eb0a |
19 | if ($key =~ /::$/){ |
20 | unless ($start eq ${$start}{$key} or $key eq "B::" ){ |
56eca212 |
21 | push @return, $key unless omit($prefix.$key); |
22 | foreach my $subscan ( scan(${$start}{$key},$prefix.$key)){ |
a6f4eb0a |
23 | push @return, "$key".$subscan; |
24 | } |
25 | } |
26 | } |
27 | } |
28 | return @return; |
29 | } |
56eca212 |
30 | sub omit{ |
31 | my $module = shift; |
595f3c5f |
32 | my %omit=("DynaLoader::" => 1 , "XSLoader::" => 1, "CORE::" => 1 , |
56eca212 |
33 | "CORE::GLOBAL::" => 1, "UNIVERSAL::" => 1 ); |
34 | return 1 if $omit{$module}; |
35 | if ($module eq "IO::" or $module eq "IO::Handle::"){ |
36 | $module =~ s/::/\//g; |
37 | return 1 unless $INC{$module}; |
38 | } |
a6f4eb0a |
39 | |
56eca212 |
40 | return 0; |
41 | } |
42 | 1; |