Thursday, 22 July 2010

Difficult to track bug

Here was a difficult bug to spot (using 5.8.8 and 5.10.1, not tried on 5.12):



my $output_path = $self->output_path();
my $bam_filename = $self->bam_filename_root();

if ( some condition ) {

$output_path .= q{lane} . $self->position_decode_string() . q{/}.
$bam_filename .= $self->position_decode_string();

}


This was caused by a bit of lack of due care and attention after a bit of copy and paste refactoring.

Unfortunately, the code is perfectly legit, and parses as though the .= after $bam_filename is just a ., without also doing the concat to $bam_filename.

Bit of a pain in the backside to find this one.

No comments: