From 34eb364e3a9a9a7a47e82130a202aa147c49819f Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 6 Jun 2003 09:32:37 +0000 Subject: Move read file from Stats to Tools --- Echolot/Stats.pm | 22 ++++------------------ Echolot/Tools.pm | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Echolot/Stats.pm b/Echolot/Stats.pm index 48e9ae8..905f210 100644 --- a/Echolot/Stats.pm +++ b/Echolot/Stats.pm @@ -1,7 +1,7 @@ package Echolot::Stats; # (c) 2002 Peter Palfrader -# $Id: Stats.pm,v 1.55 2003/02/28 18:12:21 weasel Exp $ +# $Id: Stats.pm,v 1.56 2003/06/06 09:32:37 weasel Exp $ # =pod @@ -255,20 +255,6 @@ sub calculate($$) { }; }; -sub read_file($;$) { - my ($name, $fail_ok) = @_; - - unless (open (F, $name)) { - Echolot::Log::warn("Could not open '$name': $!.") unless ($fail_ok); - return undef; - }; - local $/ = undef; - my $result = ; - close (F); - - return $result; -}; - sub write_file($$$$) { my ($filebasename, $html_template, $expires, $output) = @_; @@ -624,9 +610,9 @@ sub build_lists() { my %stats; my %addresses; - my $hardbroken1 = read_file( Echolot::Config::get()->{'broken1'}, 1); - my $hardbroken2 = read_file( Echolot::Config::get()->{'broken2'}, 1); - my $sameop = read_file( Echolot::Config::get()->{'sameop'}, 1); + my $hardbroken1 = Echolot::Tools::read_file( Echolot::Config::get()->{'broken1'}, 1); + my $hardbroken2 = Echolot::Tools::read_file( Echolot::Config::get()->{'broken2'}, 1); + my $sameop = Echolot::Tools::read_file( Echolot::Config::get()->{'sameop'}, 1); my $pubbroken1; my $pubbroken2; my $privbroken1; diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm index 4426b86..fd86a4c 100644 --- a/Echolot/Tools.pm +++ b/Echolot/Tools.pm @@ -1,7 +1,7 @@ package Echolot::Tools; # (c) 2002 Peter Palfrader -# $Id: Tools.pm,v 1.21 2003/02/28 17:10:57 weasel Exp $ +# $Id: Tools.pm,v 1.22 2003/06/06 09:32:37 weasel Exp $ # =pod @@ -349,6 +349,21 @@ sub make_garbage() { return $random; }; +sub read_file($;$) { + my ($name, $fail_ok) = @_; + + unless (open (F, $name)) { + Echolot::Log::warn("Could not open '$name': $!.") unless ($fail_ok); + return undef; + }; + local $/ = undef; + my $result = ; + close (F); + + return $result; +}; + + 1; # vim: set ts=4 shiftwidth=4: -- cgit v1.2.3