Browse Source

* Subtitle::SRT : update build() : use $self->{eol}

master
Alex 'AdUser' Z 8 years ago
parent
commit
b4a7a44b31
  1. 13
      lib/Subtitle/SRT.pm

13
lib/Subtitle/SRT.pm

@ -121,21 +121,20 @@ sub parse {
sub build { sub build {
my ($self) = @_; my ($self) = @_;
my ($hrs, $min, $sec, $msec, $out); my (@lines, $out);
$out = '';
foreach my $e (@{ $self->{events} }) { foreach my $e (@{ $self->{events} }) {
$out .= $e->{id} . "\n"; push @lines, $e->{id};
my $start = sprintf $self->{timing_fmt}, my $start = sprintf $self->{timing_fmt},
make_timing($e->{timing}->[0]); make_timing($e->{timing}->[0]);
my $end = sprintf $self->{timing_fmt}, my $end = sprintf $self->{timing_fmt},
make_timing($e->{timing}->[1]); make_timing($e->{timing}->[1]);
$out .= sprintf "%s --> %s\n", $start, $end; push @lines, sprintf("%s --> %s", $start, $end);
$out .= "$e->{text}\n"; push @lines, $e->{text};
$out .= "\n"; push @lines, "";
} }
return $out; return join($self->{eol} => @lines);
} }
1; 1;

Loading…
Cancel
Save