From 59407413ad69a5943d95ca460208f58ad1864376 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Sat, 11 Jun 2016 16:05:02 +0000 Subject: [PATCH] * Subtitle::Base : cleanup --- lib/Subtitle/BASE.pm | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) 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"; }