Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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/ ./PerlMonks/ --- ./PerlMonks/ Fri Oct 27 15:47:21 2000 +++ ./PerlMonks/ 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/ ./PerlMonks/ --- ./PerlMonks/ Mon Sep 4 13:44:10 2000 +++ ./PerlMonks/ 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

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

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

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (11)
    As of 2019-11-15 13:29 GMT
    Find Nodes?
      Voting Booth?
      Strict and warnings: which comes first?

      Results (83 votes). Check out past polls.