From 1fd5b9a7aa83ba35db2fd0543aeba1c3496b2e30 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Sun, 14 Oct 2007 01:24:49 +0200 Subject: [PATCH] Packages::Template: Add target parameter to page method This makes it easier to use this in create_index_pages since we can save all the filehandle handling. --- lib/Packages/Template.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/Packages/Template.pm b/lib/Packages/Template.pm index 554f2ce..0fe2481 100644 --- a/lib/Packages/Template.pm +++ b/lib/Packages/Template.pm @@ -53,7 +53,7 @@ sub error { } sub page { - my ($self, $action, $page_content) = @_; + my ($self, $action, $page_content, $target) = @_; #use Data::Dumper; #die Dumper($self, $action, $page_content); @@ -63,9 +63,13 @@ sub page { @{$page_content->{used_langs}} ); my $txt; - $self->process("$self->{format}/$action.tmpl", $page_content, \$txt) - or die sprintf( "template error: %s", $self->error ); # too late for reporting on-line - + if ($target) { + $self->process("$self->{format}/$action.tmpl", $page_content, $target) + or die sprintf( "template error: %s", $self->error ); # too late for reporting on-line + } else { + $self->process("$self->{format}/$action.tmpl", $page_content, \$txt) + or die sprintf( "template error: %s", $self->error ); + } return $txt; } -- 2.39.2