diff options
Diffstat (limited to 'lib/App/Beam/Config/Locus.pm')
-rw-r--r-- | lib/App/Beam/Config/Locus.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/App/Beam/Config/Locus.pm b/lib/App/Beam/Config/Locus.pm index 050e5bb..7d1087c 100644 --- a/lib/App/Beam/Config/Locus.pm +++ b/lib/App/Beam/Config/Locus.pm @@ -69,7 +69,9 @@ sub add { Returns a string representation of the locus. The argument is optional. If given, its string representation will be concatenated to the formatted -locus with a ": " in between. This is useful for formatting error messages. +locus with a ": " in between. If multiple arguments are supplied, their +string representations will be concatenated, separated by horizontal +space characters. This is useful for formatting error messages. If the locus contains multiple file locations, the method tries to compact them by representing contiguous line ranges as B<I<X>-I<Y>> and outputting @@ -93,6 +95,7 @@ will produce the following: sub format { my $self = shift; unless (exists($self->{string})) { + $self->{string} = ''; foreach my $file (sort { $self->{table}{$a}{order} <=> $self->{table}{$b}{order} } @@ -124,7 +127,13 @@ sub format { $self->{string} .= join(',', @ranges); } } - return "$self->{string}: $_[0]" if @_; + if (@_) { + if ($self->{string} ne '') { + return "$self->{string}: " . join(' ', @_); + } else { + return join(' ', @_); + } + } return $self->{string}; } |