X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=videosite%2FBase.pm;h=51b091c5ed9b55ff28219c97de48bf0d062214b8;hb=9cfabbf047871e6671aca65e9313cb4f2ce23124;hp=939e203108bd81ed04f071b35eb1ee0d09dc8304;hpb=7d7ff7b6405f55adf3e083808da57b6bc6a31312;p=videosite.git diff --git a/videosite/Base.pm b/videosite/Base.pm index 939e203..51b091c 100644 --- a/videosite/Base.pm +++ b/videosite/Base.pm @@ -5,6 +5,7 @@ package Base; use strict; use Irssi; +use Data::Dumper; sub new { my $class = shift; @@ -19,9 +20,11 @@ sub new { sub error { my $self = shift; - my @data = @_; + my $t; - Irssi::print(sprintf(shift(@_), @_)); + $t = sprintf(shift(@_), @_); + $t =~ s/%/%%/g; + Irssi::print($t); } sub debug { @@ -52,7 +55,7 @@ sub _prepare_parameters { my $self = shift; my $p; - $self->{'_CONFIG'} = {'option' => {}}; + $self->{'_CONFIG'} = {'option' => {'enabled' => {'content' => '1'}}}; foreach $p (keys(%{$self->{'_PARAMS'}})) { $self->{'_CONFIG'}->{'option'}->{$p}->{'content'} = $self->{'_PARAMS'}->{$p}->[0]; @@ -62,8 +65,12 @@ sub _prepare_parameters { sub _getval { my $self = shift; my $key = shift; + my $val; + + $val = $self->{'_CONFIG'}->{'option'}->{$key}->{'content'}; + $self->debug('Returning %s=%s', $key, $val); - return $self->{'_CONFIG'}->{'option'}->{$key}->{'content'} + return $val; } sub setval { @@ -88,7 +95,7 @@ sub getconfstr { $p = $self->{'_CONFIG'}->{'option'}->{$k}->{'content'}; $p =~ s/%/%%/g; $s .= sprintf(" %s: %s", $k, $p); - if ($self->{'_CONFIG'}->{'option'}->{$k}->{'content'} == $self->{'_PARAMS'}->{$k}->[0]) { + if ($self->{'_CONFIG'}->{'option'}->{$k}->{'content'} eq $self->{'_PARAMS'}->{$k}->[0]) { $s .= " (default)\n"; } else { $s .= "\n";