Browse Source

* Subtitle::SSA::Record : fixes

master
Alex 'AdUser' Z 9 years ago
parent
commit
2ebdf65cdf
  1. 6
      lib/Subtitle/SSA/Record.pm

6
lib/Subtitle/SSA/Record.pm

@ -63,12 +63,12 @@ sub parse {
my $PREFIX = $self->{_prefix}; my $PREFIX = $self->{_prefix};
return $self->error("not looks like $PREFIX line") return $self->error("not looks like $PREFIX line")
unless $line and $line =~ m{^$PREFIX:}oi; unless $line and $line =~ m{^$PREFIX:}i;
return $self->error("passed custom fields order not ARRAY ref") return $self->error("passed custom fields order not ARRAY ref")
unless $format and ref($format) eq 'ARRAY'; unless $format and ref($format) eq 'ARRAY';
chomp $line; chomp $line;
$line =~ s{^$PREFIX:\s*}{}oi; $line =~ s{^$PREFIX:\s*}{}i;
my $fieldcnt = scalar @{ $format }; my $fieldcnt = scalar @{ $format };
my @values = split /,\s*/o, $line, $fieldcnt; my @values = split /,\s*/o, $line, $fieldcnt;
# check that values count match fields count # check that values count match fields count
@ -125,7 +125,7 @@ sub get_format_line {
my ($self) = @_; my ($self) = @_;
my @keys = @{ $self->{_format} }; my @keys = @{ $self->{_format} };
my @names = map { $FIELDS{$_}->{name} } @keys; my @names = map { $self->{_fields}->{$_}->{name} } @keys;
my $line = 'Format: ' . join(', ' => @names); my $line = 'Format: ' . join(', ' => @names);

Loading…
Cancel
Save