I've just patched these modules too (and in the process removed an ugly warning). It seems a bit smaller change than the patch above, so I'll just post it here.
diff output:
--- Chat.pm Sat Oct 28 00:47:21 2000
+++ /home/joost/opt/pmchat/PerlMonks/Chat.pm Tue Jul 30 14:51:00 20
+02
@@ -58,7 +58,7 @@
# Get general chat messages
if ($c=$self->getpage(CHAT_URL)) {
$c=~s/[\r\n\t]//g;
- my @msgs=($c=~/message\s+author="([^\"]+)"[^>]+>\s*(.*?)\s*<\/mes
+sage>/g);
+ my @msgs=($c=~/<message[^>]+author="([^\"]+)"[^>]+>\s*(.*?)\s*<\/
+message>/g);
if (@msgs) {
while (@msgs) {
my ($author, $msg)=(shift(@msgs),shift(@msgs));
@@ -161,7 +161,7 @@
# Add the new lines to the cache
unshift @$cache, @newcache;
# Trim the cache to the last 50 lines.
- splice(@$cache, CACHE_LIMIT);
+ splice(@$cache, CACHE_LIMIT) if @$cache > CACHE_LIMIT;
# Return the lines that were just added to the cache
return reverse @newcache;
}
--- Users.pm Mon Sep 4 22:44:10 2000
+++ /home/joost/opt/pmchat/PerlMonks/Users.pm Tue Jul 30 13:32:42 20
+02
@@ -63,7 +63,12 @@
my $self=shift;
if ( (time() - $self->{cache_users_ts}) > USERS_REFRESH) {
if (my $c=$self->getpage(USERS_URL)) {
- my %users=($c=~/user\s+username="([^\"]+)"\s+user_id="(\d+)"/g)
+;
+ my %users;
+ for ($c=~/<user[^>]+>/g) {
+ my ($name) = /username="([^\"]+)"/;
+ my ($id) = /user_id="(\d+)"/;
+ $users{$name}=$id;
+ }
$self->{cache_users}=\%users;
$self->{cache_users_ts}=time();
}
Btw, as mentioned above these modules could really need some cleaning up. Any takers?
--
Joost downtime n. The period during which a system
is error-free and immune from user input.