diff --git a/lib/Subtitle/BASE.pm b/lib/Subtitle/BASE.pm index 00924b5..bdfc912 100644 --- a/lib/Subtitle/BASE.pm +++ b/lib/Subtitle/BASE.pm @@ -2,29 +2,26 @@ package Subtitle::BASE; use strict; use warnings; -use feature qw(switch); use utf8; sub log { my ($self, $level, $msg) = @_; - given ($level) { - when ("error") { push @{ $self->{log} }, "E: $msg"; } - when ("warn") { push @{ $self->{log} }, "W: $msg"; } - when ("info") { push @{ $self->{log} }, "I: $msg"; } - when ("debug") { push @{ $self->{log} }, "D: $msg" if $self->{debug}; } - default { warn "Unknown loglevel $level of $msg\n"; } + if ($level eq 'error') { + push @{ $self->{log} }, "E: $msg"; + } elsif ($level eq 'warn') { + push @{ $self->{log} }, "W: $msg"; + } elsif ($level eq 'info') { + push @{ $self->{log} }, "I: $msg"; + } elsif ($level eq 'debug') { + push @{ $self->{log} }, "D: $msg" if $self->{debug}; + } else { + warn "Unknown loglevel $level of $msg\n"; } return 1; } -sub events { - my ($self) = @_; - - return wantarray ? @{ $self->{events} } : $self->{events}; -} - sub parse { return "Unimplemented by subclass"; } sub build { return "Unimplemented by subclass"; }