On Fri, Oct 19, 2001 at 01:22:25PM -0700, Wim Kerkhoff wrote:
> Have you talked with Peter Theony about your changes at all? He seems
> to be totally in favour of massive and ruthless refactoring... that's
> what XP and Wiki webs are all about.
Yes.
He wasn't at all interested.
In fact he took great offence at my suggesting that the code was ugly,
amateurish, and written by someone who obviously doesn't know Perl. ;)
I sent some patches, but they were ignored.
So, we still have this amazing code. Pay careful attention to it: the more
you read the more insane you realise it is....
sub getTopList
{
my( $doUser, $theMaxNum, @theList ) = @_;
my %hash = ();
my $tmp;
foreach( @theList ) {
$tmp = $_;
if( $doUser ) {
$tmp =~ s/^\|[^\|]*\|\s([^\.]*\.\S*).*/$1/go;
} else {
$tmp =~ s/^\|[^\|]*\|[^\|]*\|[^\|]*\|\s([^\.]*\.\S*).*/$1/go;
}
if( $hash{ $tmp } ) {
$hash{ $tmp } = $hash{ $tmp } + 1;
} else {
%hash = ( %hash, $tmp, 1 );
}
}
my @list = ();
while( ( $key, $value ) = each( %hash ) ) {
$tmp = " $value";
$tmp =~ s/\s*(.{5})$/$1/go;
$list[@list] = "$tmp $key";
}
@list = reverse( sort( @list ) );
my @returnList = ();
my $idx = 0;
for( $x = 0; $x < @list; $x++ )
{
if( $x >= $theMaxNum ) {
return @returnList;
}
$tmp = $list[$x];
$tmp =~ s/^\s*(.*)/ $1/go;
$returnList[$x] = $tmp;
}
return @returnList;
}
Tony
--
--------------------------------------------------------------------------
Tony Bowden | [EMAIL PROTECTED] | http://www.tmtm.com/
all history is too small for even me; for me and you,exceedingly too small
--------------------------------------------------------------------------