Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1 KiB

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