diff --git a/lib/Subtitle/SSA/Event.pm b/lib/Subtitle/SSA/Event.pm index ca158a6..75b8807 100644 --- a/lib/Subtitle/SSA/Event.pm +++ b/lib/Subtitle/SSA/Event.pm @@ -32,7 +32,7 @@ sub new { _type => 'ass', _fields => \%FIELDS, _format => \@FIELDS_ASS, - _prefix => 'Dialogue', + _prefix => qr/(Dialogue|Comment|Picture|Sound|Movie|Command)/, }; if (my $t = $opts{type}) { diff --git a/lib/Subtitle/SSA/Record.pm b/lib/Subtitle/SSA/Record.pm index da2a4db..f358be8 100644 --- a/lib/Subtitle/SSA/Record.pm +++ b/lib/Subtitle/SSA/Record.pm @@ -64,6 +64,8 @@ sub parse { my $PREFIX = $self->{_prefix}; return $self->error("not looks like $PREFIX line") unless $line and $line =~ m{^$PREFIX:}i; + $self->{_prefix} = $1 + if ref($self->{_prefix}) eq 'Regexp'; return $self->error("passed custom fields order not ARRAY ref") unless $format and ref($format) eq 'ARRAY';