This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Quick integration of mainline changes to date
[perl5.git] / ext / B / B / Stash.pm
CommitLineData
a6f4eb0a
VB
1# Stash.pm -- show what stashes are loaded
2# vishalb@hotmail.com
3package B::Stash;
4
5BEGIN { %Seen = %INC }
6
146174a9 7STOP {
a6f4eb0a
VB
8 my @arr=scan($main::{"main::"});
9 @arr=map{s/\:\:$//;$_;} @arr;
10 print "-umain,-u", join (",-u",@arr) ,"\n";
11}
12sub scan{
13 my $start=shift;
56eca212
GS
14 my $prefix=shift;
15 $prefix = '' unless defined $prefix;
a6f4eb0a
VB
16 my @return;
17 foreach my $key ( keys %{$start}){
56eca212 18# print $prefix,$key,"\n";
a6f4eb0a
VB
19 if ($key =~ /::$/){
20 unless ($start eq ${$start}{$key} or $key eq "B::" ){
56eca212
GS
21 push @return, $key unless omit($prefix.$key);
22 foreach my $subscan ( scan(${$start}{$key},$prefix.$key)){
a6f4eb0a
VB
23 push @return, "$key".$subscan;
24 }
25 }
26 }
27 }
28 return @return;
29}
56eca212
GS
30sub omit{
31 my $module = shift;
32 my %omit=("DynaLoader::" => 1 , "CORE::" => 1 ,
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
GS
40 return 0;
41}
421;