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 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"; }

Loading…
Cancel
Save