From cc92db539dd5b70bfc38f0c3091f03a7e5ca200f Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Sun, 27 Jul 2003 02:53:20 +0000 Subject: [PATCH] Replaced faulty sort and compare method for checking lists with List::Compare CPAN module --- src/www-spong-ack.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/www-spong-ack.pl b/src/www-spong-ack.pl index 528224f..027eb4e 100755 --- a/src/www-spong-ack.pl +++ b/src/www-spong-ack.pl @@ -11,7 +11,7 @@ # History # (1) Created, pulled out of www-spong program (Ed 07-28-97) # -# $Id: www-spong-ack.pl,v 1.10 2003/01/29 23:01:51 sljohnson Exp $ +# $Id: www-spong-ack.pl,v 1.11 2003/07/27 02:53:20 sljohnson Exp $ use lib "@@LIBDIR@@"; @@ -22,6 +22,8 @@ use POSIX; use Time::Local; use Spong::Host; +use List::Compare; + # Load our configuration variables, including the user specified configuration # information (spong.conf, spong.hosts, and spong.groups files). @@ -380,9 +382,9 @@ sub load_config_files { eval $evalme || die "Invalid spong.hosts file: $@"; # Fallback, if we didn't read things correctly... + my $lc = List::Compare->new( \@HOSTS_LIST, \@{[keys %HOSTS]} ); + if( ! $lc->is_LequivalentR ) { @HOSTS_LIST = sort keys %HOSTS; } - if( sort ( @HOSTS_LIST ) != sort ( keys %HOSTS ) ) { - @HOSTS_LIST = sort keys %HOSTS; } # Do the same thing for the groups file. @@ -397,8 +399,8 @@ sub load_config_files { close( GROUPS ); eval $evalme || die "Invalid spong.groups file: $@"; - if( sort ( @GROUPS_LIST ) != sort ( keys %GROUPS ) ) { - @GROUPS_LIST = sort keys %GROUPS; } + $lc = List::Compare->new( \@GROUPS_LIST, \@{[keys %GROUPS]} ); + if( ! $lc->is_LequivalentR ) { @GROUPS_LIST = sort keys %GROUPS; } } -- 2.30.2