Again, not much of an obfuscation (i never was very clever at obscuring stuff), this one is more of 'catalyst' - i hope that someone more clever will find inspiration from this. Only tested with Perl 5.8.1 on Linux. There also is no garuantee that the order will be "correct". I would have tried to obfuscate this more ... but i have real work to do (happy client == food on table). ;)
use threads; use IO::Socket; @thread = map threads->create ('fetch',$_),9655,6352,297065, 138903; $_->join for @thread; print $/; sub fetch { $sock = IO::Socket::INET->new(qw(PeerAddr perlmonks.org PeerPort 80)); print $sock "GET /?node_id=". "$_[0]&displaytype=xml HTTP". "/1.0\n\n"; print do{local $/; <$sock>} =~ /title="(\w+\s)/;}

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: Just Another Thread Hacker
by liz (Monsignor) on Oct 08, 2003 at 13:45 UTC
    I've taken the liberty to change the code making sure it always returns "Just Another Perl hacker":
    use threads;use IO::Socket;@thread=map threads ->create(fetch,$_),9655,6352,297065,138903; print$_->join for@thread;print $/;sub fetch{ $sock=IO::Socket::INET->new(qw(PeerAddr perlmonks.org PeerPort 80));print$sock "GET /?node_id=$_[0]&displaytype=xml HTTP/1.0 \n";local$/;(<$sock>=~/title="(\w+\s)/)}

    Liz

      While we're at it... golfed down from liz's 301 keystrokes to 278. Could have gone smaller but a few strokes were added here and there for asthetic purposes, to keep rows nice and tidy.

      use threads;;;use IO::Socket;;;@t=map threads->create(sub{$o= IO::Socket::INET->new(qw(PeerAddr perlmonks.org PeerPort 80)) ;print $o "GET /?node_id=$_[0]&displaytype=xml HTTP/1.0\n\n"; local$/;(<$o>=~/title="(\w+\s)/)},$_),9655,6352,297065,138903 ;print$_->join for@t;print$/
      I lost five strokes in the beautification. ;) The biggest gain was in making the sub an anonymous inline sub rather than a named one.

      Great japh. I always like these ones that grab things off the net.


      Dave


      "If I had my life to do over again, I'd be a plumber." -- Albert Einstein
        Well, if we're golfing...
        use threads;use IO'Socket;print$_->join for map threads-> create(sub{$o=IO'Socket'INET->new('perlmonks.org:80');print$o "GET /?node_id=$_[0]\n\n";local$/;<$o>=~/e>(\w+\s)/},$_),9655 ,6352,297065,138903;print$/
        A wee bit slower (it grabs the full HTML) and not as prettily formatted, but comes in at 207.

        Toodle-pip,
        Ben