/[webpac]/trunk2/lib/WebPAC.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk2/lib/WebPAC.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 398 by dpavlin, Sat Jul 24 13:48:08 2004 UTC revision 411 by dpavlin, Sun Sep 5 22:22:37 2004 UTC
# Line 775  sub output { Line 775  sub output {
775          return $out;          return $out;
776  }  }
777    
778    =head2 output_file
779    
780    Create output from in-memory data structure using Template Toolkit template
781    to a file.
782    
783     $webpac->output_file(
784            file => 'out.txt',
785            template => 'text.tt',
786            data => @ds
787     );
788    
789    =cut
790    
791    sub output_file {
792            my $self = shift;
793    
794            my $args = {@_};
795    
796            my $log = $self->_get_logger();
797    
798            $log->logconfess("need file name") if (! $args->{'file'});
799    
800            $log->debug("creating file ",$args->{'file'});
801    
802            open(my $fh, ">", $args->{'file'}) || $log->logdie("can't open output file '$self->{'file'}': $!");
803            print $fh $self->output(
804                    template => $args->{'template'},
805                    data => $args->{'data'},
806            ) || $log->logdie("print: $!");
807            close($fh) || $log->logdie("close: $!");
808    }
809    
810  =head2 apply_format  =head2 apply_format
811    
812  Apply format specified in tag with C<format_name="name"> and  Apply format specified in tag with C<format_name="name"> and

Legend:
Removed from v.398  
changed lines
  Added in v.411

  ViewVC Help
Powered by ViewVC 1.1.26