From c02c21564c1261f05214196621d2841f3f4e639d Mon Sep 17 00:00:00 2001 From: octo Date: Tue, 12 Apr 2005 08:59:27 +0000 Subject: [PATCH] More bugfixes.. --- lib/Onis/Plugins/Bignumbers.pm | 5 +++++ lib/Onis/Plugins/Core.pm | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/Onis/Plugins/Bignumbers.pm b/lib/Onis/Plugins/Bignumbers.pm index 00f298c..7e37935 100644 --- a/lib/Onis/Plugins/Bignumbers.pm +++ b/lib/Onis/Plugins/Bignumbers.pm @@ -105,11 +105,16 @@ sub calculate $CalcData->{$main}{'uppercase'} += $uppercase; $CalcData->{$main}{'smiley_happy'} += $smiley_happy; $CalcData->{$main}{'smiley_sad'} += $smiley_sad; + + require Data::Dumper; + print STDOUT Data::Dumper->Dump ([$CalcData->{$main}], ["CalcData->{$main}"]); } } sub output { + calculate (); + my $first_nick; my $first_name; my $second_nick; diff --git a/lib/Onis/Plugins/Core.pm b/lib/Onis/Plugins/Core.pm index 1b05bab..fc8e3db 100644 --- a/lib/Onis/Plugins/Core.pm +++ b/lib/Onis/Plugins/Core.pm @@ -380,8 +380,13 @@ sub calculate } if (defined ($QuoteCache->{$nick})) { - my @new = sort (sub { $b->[0] <=> $a->[0] }, @{$QuoteCache->{$nick}}, @{$QuoteData->{$main}}); + my @new = (); + push (@new, @{$QuoteData->{$main}}) if (@{$QuoteData->{$main}}); + push (@new, @{$QuoteCache->{$nick}}) if (@{$QuoteCache->{$nick}}); + + @new = sort { $b->[0] <=> $a->[0] } (@new); splice (@new, $QuoteCacheSize) if (scalar (@new) > $QuoteCacheSize); + $QuoteData->{$main} = \@new; } } @@ -585,6 +590,10 @@ EOF { my $num = scalar (@{$QuoteData->{$nick}}); my $rand = int (rand ($num)); + + require Data::Dumper; + print STDOUT Data::Dumper->Dump ([$rand, $QuoteData->{$nick}], ['rand', "QuoteData->{$nick}"]); + $quote = html_escape ($QuoteData->{$nick}[$rand][1]); } -- 2.11.0