Revision 7e0814bb
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Template.pm | ||
---|---|---|
25 | 25 |
my %params = @_; |
26 | 26 |
my $package = "SL::Template::" . $params{type}; |
27 | 27 |
|
28 |
$package->new($params{file_name}, $params{form}, $params{myconfig} || \%::myconfig, $params{userspath} || $::lx_office_conf{paths}->{userspath}); |
|
28 |
$package->new( |
|
29 |
%params, |
|
30 |
source => $params{file_name}, |
|
31 |
form => $params{form}, |
|
32 |
myconfig => $params{myconfig} || \%::myconfig, |
|
33 |
userspath => $params{userspath} || $::lx_office_conf{paths}->{userspath}, |
|
34 |
); |
|
29 | 35 |
} |
30 | 36 |
|
31 | 37 |
sub available_templates { |
SL/Template/Simple.pm | ||
---|---|---|
30 | 30 |
} |
31 | 31 |
|
32 | 32 |
sub _init { |
33 |
my $self = shift;
|
|
33 |
my ($self, %params) = @_;
|
|
34 | 34 |
|
35 |
$self->{source} = shift; |
|
36 |
$self->{form} = shift; |
|
37 |
$self->{myconfig} = shift; |
|
38 |
$self->{userspath} = shift; |
|
35 |
$self->{$_} = $params{$_} for keys %params; |
|
39 | 36 |
|
40 | 37 |
$self->{error} = undef; |
41 | 38 |
$self->{quot_re} = '"'; |
Auch abrufbar als: Unified diff
Refactoring: SL::Template: Parameterübergabe als Hash, nicht positionsabhängig