Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2022-01-21 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (57 votes). Check out past polls.

    Notices?