Subject: | Dump(\%::) errors when ->ARRAY is invalid on a B::SPECIAL object |
Dump(\%::)
Can't locate object method "ARRAY" via package "B::SPECIAL" at .../Data/Dump/Streamer.pm line 3157 (I think)
The attached patch checks that PADLIST and other methods actually returned something useful. The output was too big to validate. At least it doesn't die anymore. I assume this is probably something that happens to references to subs without definitions. Those won't have lexicals anyway.
--- /usr/local/lib/perl/5.8.4/Data/Dump/Streamer.pm~ 2005-04-06 16:54:34.000000000 -0500
+++ /usr/local/lib/perl/5.8.4/Data/Dump/Streamer.pm 2005-11-09 14:59:39.590658640 -0600
@@ -3154,13 +3154,20 @@
my $cv=shift;
my $svo=svref_2object($cv);
- my @pl_array = $svo->PADLIST->ARRAY;
+ my @pl_array = ( $svo->can( 'PADLIST' )
+ and $svo->PADLIST->can( 'ARRAY' )
+ ? $svo->PADLIST->ARRAY
+ : () );
- my @name_obj = $pl_array[0]->ARRAY;
+ my @name_obj = ( ref $pl_array[0]
+ and $pl_array[0]->can( 'ARRAY' )
+ ? $pl_array[0]->ARRAY
+ : () );
my %named;
for my $i ( 0..$#name_obj ) {
- if ( ref($name_obj[$i])!~/SPECIAL/) {
+ if ( ref $name_obj[$i]
+ and ref($name_obj[$i])!~/SPECIAL/) {
$named{$i} = "${ $name_obj[$i]->object_2svref }";
}
}