Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

It seems that these modules have stopped working, possibly due to the Perlmonks Server Move. I've patched it up hurridly, and it seems to work. Probably the Correct Solution is to change everything over to using the XML modules, but not only do I not have the time (or knowledge), but this isn't my code, so I'll stick to minimal patching. (Hope you don't mind this much, ZZamboni.)

Update: tye has much better code on tye's scratchpad.

diff -ru ./PerlMonks/Chat.pm.orig ./PerlMonks/Chat.pm --- ./PerlMonks/Chat.pm.orig Fri Oct 27 15:47:21 2000 +++ ./PerlMonks/Chat.pm Sat Feb 2 23:37:50 2002 @@ -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[^>]*\s+author="([^\"]+)"[^>]+>\s*(.*?)\s*< +\/message>/g); if (@msgs) { while (@msgs) { my ($author, $msg)=(shift(@msgs),shift(@msgs)); @@ -91,7 +91,8 @@ if ($self->{cookie_jar}) { if ($c=$self->getpage(PRIVATE_URL)) { $c=~s/[\r\n\t]//g; - my @msgs=($c=~/message\s+message_id="(\d+)"\s+author="([^\"]+)" +[^>]+>\s*(.*?)\s*<\/message>/g); + my @msgs=($c=~/message[^<]+message_id="(\d+)"[^>]+author="([^\" +]+)"[^>]+>\s*(.*?)\s*<\/message>/g) || + private_swap_order($c=~/message[^<]+author="([^\"]+)"[^>]+ +message_id="(\d+)"[^>]+>\s*(.*?)\s*<\/message>/g); while (@msgs) { my ($mid, $author, $msg)=(shift(@msgs),shift(@msgs),shift(@msg +s)); # Remove html tags @@ -276,6 +278,18 @@ my $substmode=shift; $self->getnewlines(undef,$substmode); return @{$self->{cache_msg}}; +} + + +sub private_swap_order { + my @out; + while (@_) { + my $one = shift; + my $two = shift; + my $three = shift; + push @out, ($two, $one, $three); + } + return @out; } 1; diff -ru ./PerlMonks/Users.pm.orig ./PerlMonks/Users.pm --- ./PerlMonks/Users.pm.orig Mon Sep 4 13:44:10 2000 +++ ./PerlMonks/Users.pm Sat Feb 2 23:39:42 2002 @@ -63,7 +63,8 @@ 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=($c=~/user\s+username="([^\"]+)"\s+user_id="(\d+)"/g) + || + reverse($c=~/user\s+user_id="(\d+)"\s+username="([^\"]+)"/g +); $self->{cache_users}=\%users; $self->{cache_users_ts}=time(); }

In reply to Re: PerlMonks modules 2.0 by wmono
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 studying the Monastery: (5)
As of 2022-01-24 17:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?