Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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.

In reply to Re: PerlMonks modules 2.0 by Joost
in thread PerlMonks modules 2.0 by ZZamboni

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (5)
    As of 2014-09-22 01:17 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (176 votes), past polls