The use of $stop here is inconsistent, using $end.
After reading this I accidentally created code like this:
my ($start, $end, $strand) =
Bio::Range->union( @ranges );
my $newrange =
Bio::Range->new( -name => $chr,
-start => $start,
-stop => $stop,
);
Clearly wrong, but easy to do. I've changed $stop to $end in the documentation for consistency with the $end range parameter.
The error I was seeing was going un-caught, but I haven't fixed that issue with this commit:
Use of uninitialized value in sort at /homes/dbolser/perl5/lib/perl5/Bio/RangeI.pm line 411.