Browse Source

* Subtitle::Base : cleanup

master
Alex 'AdUser' Z 9 years ago
parent
commit
59407413ad
  1. 23
      lib/Subtitle/BASE.pm

23
lib/Subtitle/BASE.pm

@ -2,29 +2,26 @@ package Subtitle::BASE;
use strict; use strict;
use warnings; use warnings;
use feature qw(switch);
use utf8; use utf8;
sub log { sub log {
my ($self, $level, $msg) = @_; my ($self, $level, $msg) = @_;
given ($level) { if ($level eq 'error') {
when ("error") { push @{ $self->{log} }, "E: $msg"; } push @{ $self->{log} }, "E: $msg";
when ("warn") { push @{ $self->{log} }, "W: $msg"; } } elsif ($level eq 'warn') {
when ("info") { push @{ $self->{log} }, "I: $msg"; } push @{ $self->{log} }, "W: $msg";
when ("debug") { push @{ $self->{log} }, "D: $msg" if $self->{debug}; } } elsif ($level eq 'info') {
default { warn "Unknown loglevel $level of $msg\n"; } 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; return 1;
} }
sub events {
my ($self) = @_;
return wantarray ? @{ $self->{events} } : $self->{events};
}
sub parse { return "Unimplemented by subclass"; } sub parse { return "Unimplemented by subclass"; }
sub build { return "Unimplemented by subclass"; } sub build { return "Unimplemented by subclass"; }

Loading…
Cancel
Save