Skip to content

Commit

Permalink
misc - dumper script tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
fglock committed Nov 9, 2014
1 parent 74adb31 commit 164076c
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions misc/typeglob/dumper.pl
Expand Up @@ -4,14 +4,24 @@
no strict 'refs';

my %out;
my %done;
my @todo = 'main::';

while (@todo) {
my $namespace = shift(@todo);
next if $done{$namespace};
foreach my $entry ( keys %{$namespace} ) {
if ( length($entry) > 2 && substr( $entry, -2, 2 ) eq '::' ) {
push @todo, $entry;
}
local *g = $Exporter::{$entry};
if ( defined *g{SCALAR} ) { $out{$namespace}{$entry}{SCALAR} = *g{SCALAR} }
if ( defined *g{ARRAY} ) { $out{$namespace}{$entry}{ARRAY} = *g{ARRAY} }
if ( defined *g{HASH} ) { $out{$namespace}{$entry}{HASH} = *g{HASH} }
if ( defined *g{CODE} ) { $out{$namespace}{$entry}{CODE} = *g{CODE} }
}
$done{$namespace} = 1;

foreach my $entry ( keys %Exporter:: ) {
# foreach my $entry ( keys %main:: ) {
local *g = $Exporter::{$entry};
if ( defined *g{SCALAR} ) { $out{$entry}{SCALAR} = *g{SCALAR} }
if ( defined *g{ARRAY} ) { $out{$entry}{ARRAY} = *g{ARRAY} }
if ( defined *g{HASH} ) { $out{$entry}{HASH} = *g{HASH} }
if ( defined *g{CODE} ) { $out{$entry}{CODE} = *g{CODE} }
}
print Dump( \%out ), "\n";
}
Expand Down

0 comments on commit 164076c

Please sign in to comment.