in reply to HEAD / HTTP/1.0
Not sure that it's strictly within the relm of traditional JAPH's. But then again, part of the principle of a good JAPH is to think outside of the box. Certanly some of mine have broken a few of the rules-of-thumb (4-line size limitation often being the first rule to go). The biggest complaint would be using a module, which implies importing a bunch of code. But then again, it *is* a standard module, so why not.
I wanted to see if I could get your JAPH to fit into four lines. It may be possible with more of a rewrite, but I tried to maintain similar strucure and flow. Here's the outcome (longer than 4 still, but I've managed to cut it down to 7 lines from 14, and maybe just a little smoother... maybe not).
I really liked your idea, which is why I tinkered with it further. At first run, I thought you'd hung my system when it sat there for 20 seconds waiting for the host. ;)use IO::Socket;$_='www.perlmonks.org';$et='IO::Socket::INET'-> new('Proto','tcp','PeerAddr',$_,'PeerPort','80','Timeout',10); die unless $et;$et->autoflush(1);print $et "HEAD / HTTP/1.0\nHost: $_\n\n";while(<$et>){$l=$_ if /Perl Monks - The Monastery Gates/}@a=('Just',' ','cke'); for(qw/26,1 25,1 24,1 19,3 8,1 6,4 20,1/){($b,$c)=split/,/; push@a,substr($l,$b,$c)}print@a[0,1,3..7,1,8,1,9,3,2,7],$/
Thanks for the fun.
Dave
"If I had my life to do over again, I'd be a plumber." -- Albert Einstein
|
|---|