diff options
author | Peter Palfrader <peter@palfrader.org> | 2002-08-10 01:36:47 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2002-08-10 01:36:47 +0000 |
commit | 0b94c34343aee2dfb449166f4884f16a71e3c7fe (patch) | |
tree | 7248e7742d43b40b8bc79bb135a7ea576e51ac46 /Echolot/Stats.pm | |
parent | eccb64b18dbc0c65e8b0a218b478d5bae73893a9 (diff) |
Produce echolot.html, an index file for echolot resultsecholot-2.0beta25
Diffstat (limited to 'Echolot/Stats.pm')
-rw-r--r-- | Echolot/Stats.pm | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/Echolot/Stats.pm b/Echolot/Stats.pm index 0311bf9..5d64f35 100644 --- a/Echolot/Stats.pm +++ b/Echolot/Stats.pm @@ -1,7 +1,7 @@ package Echolot::Stats; # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: Stats.pm,v 1.26 2002/08/10 00:56:24 weasel Exp $ +# $Id: Stats.pm,v 1.27 2002/08/10 01:36:47 weasel Exp $ # =pod @@ -273,28 +273,35 @@ sub read_file($;$) { sub write_file($$;$) { my ($filebasename, $html_template, $output) = @_; - my $filename = $filebasename.'.txt'; - open(F, '>'.$filename) or - cluck("Cannot open $filename: $!\n"), - return 0; - print F $output; - close (F); + my $filename; + if (defined $output) { + $filename = $filebasename.'.txt'; + open(F, '>'.$filename) or + cluck("Cannot open $filename: $!\n"), + return 0; + print F $output; + close (F); + }; return 1 unless defined $html_template; - $output =~ s/&/&/g; - $output =~ s/"/"/g; - $output =~ s/</</g; - $output =~ s/>/>/g; my $template = HTML::Template->new( filename => $html_template, strict => 0, + die_on_bad_params => 0, global_vars => 1 ); - $template->param ( list => $output ); + if (defined $output) { + $output =~ s/&/&/g; + $output =~ s/"/"/g; + $output =~ s/</</g; + $output =~ s/>/>/g; + $template->param ( list => $output ); + }; $template->param ( CURRENT_TIMESTAMP => scalar gmtime() ); $template->param ( SITE_NAME => Echolot::Config::get()->{'sitename'} ); $template->param ( seperate_rlist => Echolot::Config::get()->{'seperate_rlists'} ); $template->param ( combined_list => Echolot::Config::get()->{'combined_list'} ); + $template->param ( thesaurus => Echolot::Config::get()->{'thesaurus'} ); $template->param ( version => Echolot::Globals::get()->{'version'} ); $filename = $filebasename.'.html'; @@ -557,6 +564,9 @@ sub build_lists() { build_clist( $clist, $broken1, $broken2, $sameop, Echolot::Config::get()->{'private_resultdir'}.'/'.'clist', Echolot::Config::get()->{'templates'}->{'clist'}); build_clist( $pubclist, $broken1, $broken2, $sameop, Echolot::Config::get()->{'resultdir'}.'/'.'clist', Echolot::Config::get()->{'templates'}->{'clist'}); }; + + + write_file(Echolot::Config::get()->{'resultdir'}.'/'.'echolot', Echolot::Config::get()->{'templates'}->{'indexfile'}); }; |