From: Frank Lichtenheld Date: Sat, 13 Oct 2007 23:24:49 +0000 (+0200) Subject: Packages::Template: Add target parameter to page method X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=1fd5b9a7aa83ba35db2fd0543aeba1c3496b2e30;p=deb%2Fpackages.git 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. --- 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; }