Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: PerlMonks modules 2.0

by Joost (Canon)
on Jul 31, 2002 at 12:09 UTC ( #186474=note: print w/replies, xml ) Need Help??

in reply to PerlMonks modules 2.0

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:

--- Sat Oct 28 00:47:21 2000 +++ /home/joost/opt/pmchat/PerlMonks/ 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; } --- Mon Sep 4 22:44:10 2000 +++ /home/joost/opt/pmchat/PerlMonks/ 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.

Replies are listed 'Best First'.
Re: Re: PerlMonks modules 2.0
by Jouke (Curate) on Sep 11, 2002 at 14:47 UTC
    I would like to take over the maintenance of these modules. ZZamboni created a sourceforge project for them, where I donwloaded them and discovered that these don't work either.

    I /msg'd him to ask if he'd mind if I'd take over and put it on CPAN. But I haven't heard from him since. I use the modules for a client I'm writing myself. If I don't hear from him, I'll take the sources, apply the patches and put it on CPAN. Unless someone else objects with good reasons of course :)

    Jouke Visser, Perl 'Adept'
    Using Perl to help the disabled: pVoice and pStory

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://186474]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2017-01-17 01:15 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (151 votes). Check out past polls.