]> git.deb.at Git - deb/packages.git/commitdiff
Packages::Template: Add target parameter to page method
authorFrank Lichtenheld <frank@lichtenheld.de>
Sat, 13 Oct 2007 23:24:49 +0000 (01:24 +0200)
committerFrank Lichtenheld <frank@lichtenheld.de>
Sat, 13 Oct 2007 23:24:49 +0000 (01:24 +0200)
This makes it easier to use this in create_index_pages since
we can save all the filehandle handling.

lib/Packages/Template.pm

index 554f2ce0e4c8551248ad625a9d0224190c1fff01..0fe24813ee9bad83afbf1999a4213f3c7ab9f451 100644 (file)
@@ -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;
 }