You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
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"; }
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub events {
|
|
|
|
my ($self) = @_;
|
|
|
|
|
|
|
|
return wantarray ? @{ $self->{events} } : $self->{events};
|
|
|
|
}
|
|
|
|
|
|
|
|
sub parse { return "Unimplemented by subclass"; }
|
|
|
|
sub build { return "Unimplemented by subclass"; }
|
|
|
|
|
|
|
|
1;
|