From b4a7a44b3146a637d3c1a34eb2c9aa6b3154d7f0 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Thu, 7 Jul 2016 16:48:01 +1000 Subject: [PATCH] * Subtitle::SRT : update build() : use $self->{eol} --- lib/Subtitle/SRT.pm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/Subtitle/SRT.pm b/lib/Subtitle/SRT.pm index bd36027..c5ddff8 100644 --- a/lib/Subtitle/SRT.pm +++ b/lib/Subtitle/SRT.pm @@ -121,21 +121,20 @@ sub parse { sub build { my ($self) = @_; - my ($hrs, $min, $sec, $msec, $out); + my (@lines, $out); - $out = ''; foreach my $e (@{ $self->{events} }) { - $out .= $e->{id} . "\n"; + push @lines, $e->{id}; my $start = sprintf $self->{timing_fmt}, make_timing($e->{timing}->[0]); my $end = sprintf $self->{timing_fmt}, make_timing($e->{timing}->[1]); - $out .= sprintf "%s --> %s\n", $start, $end; - $out .= "$e->{text}\n"; - $out .= "\n"; + push @lines, sprintf("%s --> %s", $start, $end); + push @lines, $e->{text}; + push @lines, ""; } - return $out; + return join($self->{eol} => @lines); } 1;