There are two cases where my code won't seg fault:
- When I use Smart::Comments in at least one place
- run through the debugger.
I've tracked it down to this call:
$action->{breakdown}
= join( ' '
, each_pair {
my ( $name, $length ) = @_;
return "x$length" if $name eq 'FILLER';
push @$field_list_ref, $name;
return "A$length";
} @$field_def_ref
);
where each_pair
is defined in another module as:
sub each_pair (&@) {
my $block = shift;
return unless @_;
my $caller = caller();
my $aref = qualify( 'a', $caller );
my $bref = qualify( 'b', $caller );
my @results;
my $pairs = 0;
for ( my $index = 0; $index < $#_; $index += 2 ) {
$pairs++;
my @pair = @_[$index..($index+1)];
no strict 'refs';
local ( $$aref, $$bref ) = @pair;
push @results, $block->( @pair );
}
return wantarray || $pairs != 1 ? @results : shift @results;
}
- Now I know that I can just replace each_pair with List::MoreUtils::natatime (although I hear that has some bugs), they have just recently allowed this module into our environment, and I'm still interested in why this call is causing a seg fault--or what other perl programmers due to debug seg faults.
I've lost a bit of time on this.
EDIT
I have other modules using this function, some expect to be able to use $a
and $b
, also it's working elsewhere in the same module, for another list. I can change this invocation of it, I can change it for this file, but changing it for every place that uses it successfully, is probably more changes than I would be allowed to make at this late hour.