--- Chat.pm-old Tue Sep 24 17:45:12 2002 +++ Chat.pm Tue Sep 24 17:32:07 2002 @@ -11,6 +11,7 @@ use strict; use vars qw(@ISA); use HTML::Entities; +use XML::Simple; use PerlMonks; use PerlMonks::NewestNodes; @@ -58,7 +59,15 @@ # Get general chat messages if ($c=$self->getpage(CHAT_URL)) { $c=~s/[\r\n\t]//g; - my @msgs=($c=~/message\s+author="([^\"]+)"[^>]+>\s*(.*?)\s*<\/message>/g); + + # problematic + # my @msgs=($c=~/message\s+author="([^\"]+)"[^>]+>\s*(.*?)\s*<\/message>/g); + + my $msgs = XMLin($c, forcearray => 1)->{message}; + + my @msgs = map { $_->{author} => $_->{content} } + sort { $a->{time} <=> $b->{time} } $msgs ? @$msgs : (); + if (@msgs) { while (@msgs) { my ($author, $msg)=(shift(@msgs),shift(@msgs));