From 7e0814bb34ae9e6c424aa10e37ccb9ca4541fc49 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 16 Jan 2014 09:55:14 +0100 Subject: [PATCH] =?utf8?q?Refactoring:=20SL::Template:=20Parameter=C3=BCbe?= =?utf8?q?rgabe=20als=20Hash,=20nicht=20positionsabh=C3=A4ngig?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Template.pm | 8 +++++++- SL/Template/Simple.pm | 7 ++----- 2 files changed, 9 insertions(+), 6 deletions(-) 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} = '"'; -- 2.20.1