From: Moritz Bunkus Date: Thu, 16 Jan 2014 08:55:14 +0000 (+0100) Subject: Refactoring: SL::Template: Parameterübergabe als Hash, nicht positionsabhängig X-Git-Tag: release-3.2.0beta~467^2~41 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7e0814bb34ae9e6c424aa10e37ccb9ca4541fc49;p=kivitendo-erp.git Refactoring: SL::Template: Parameterübergabe als Hash, nicht positionsabhängig --- diff --git a/SL/Template.pm b/SL/Template.pm index df6dbec7c..903ea90d8 100644 --- a/SL/Template.pm +++ b/SL/Template.pm @@ -25,7 +25,13 @@ sub create { my %params = @_; my $package = "SL::Template::" . $params{type}; - $package->new($params{file_name}, $params{form}, $params{myconfig} || \%::myconfig, $params{userspath} || $::lx_office_conf{paths}->{userspath}); + $package->new( + %params, + source => $params{file_name}, + form => $params{form}, + myconfig => $params{myconfig} || \%::myconfig, + userspath => $params{userspath} || $::lx_office_conf{paths}->{userspath}, + ); } sub available_templates { diff --git a/SL/Template/Simple.pm b/SL/Template/Simple.pm index be5ba8b5d..8696796bc 100644 --- a/SL/Template/Simple.pm +++ b/SL/Template/Simple.pm @@ -30,12 +30,9 @@ sub new { } sub _init { - my $self = shift; + my ($self, %params) = @_; - $self->{source} = shift; - $self->{form} = shift; - $self->{myconfig} = shift; - $self->{userspath} = shift; + $self->{$_} = $params{$_} for keys %params; $self->{error} = undef; $self->{quot_re} = '"';