Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Neat trick. BTW you don't need to specifically use the HTTP entities with LWPUA. Golf:

#!/usr/bin/perl -w $^W = 336 >> 3; use strict; use LWP::UserAgent; my $UA = new LWP::UserAgent; $UA->proxy('http', 'http://proxy.ahcl.com:8080/'); HEAD('http://123box.co.uk/'); HEAD('http://japhy.perlmonk.org/book/'); real_HEAD('http://123box.co.uk/'); real_HEAD('http://japhy.perlmonk.org/book/'); sub HEAD { my $req = HTTP::Request->new(GET => shift); my $res = $UA->request($req, sub { }, 1); print "HEAD\n\n", $res->as_string(), "\n"; } sub real_HEAD { my $req = HTTP::Request->new(HEAD => shift); my $res = $UA->request($req); print "real_HEAD\n\n", $res->as_string(), "\n"; } __END__ HEAD HTTP/1.1 200 OK Connection: close Date: Wed, 21 Nov 2001 12:27:24 GMT Via: HTTP/1.1 (IBM-PROXY-WTE), 1.0 NSW-PROXY Server: Apache/1.3.19 (Unix) mod_gzip/1.3.19.1a Resin/1.2.2 Content-Length: 8514 Content-Type: text/html Content-Type: text/html; Client-Date: Wed, 21 Nov 2001 12:33:16 GMT Client-Peer: 10.1.17.5:8080 Title: login HEAD HTTP/1.1 200 OK Connection: close Date: Wed, 21 Nov 2001 12:18:07 GMT Via: 1.1 NSW-PROXY Age: 940 Server: Apache/1.3.22 (Unix) mod_perl/1.26 PHP/4.0.6 Content-Length: 1766 Content-Type: text/html ETag: "57532-6e6-3bf6bcac" Last-Modified: Sat, 17 Nov 2001 19:38:20 GMT Client-Date: Wed, 21 Nov 2001 12:33:18 GMT Client-Peer: 10.1.17.5:8080 Title: Regular Expressions in Perl real_HEAD HTTP/1.1 504 (Gateway Timeout) Proxy Error: Remote host did not send a +ny data - URL "http://123box.co.uk/". Cache-Control: no-cache Connection: close Date: Wed, 21 Nov 2001 12:36:20 GMT Pragma: no-cache Via: HTTP/1.1 (IBM-PROXY-WTE), 1.0 NSW-PROXY Server: IBM-PROXY-WTE/3.0 Content-Type: text/html Expires: Wed, 21 Nov 2001 12:36:20 GMT Last-Modified: Wed, 21 Nov 2001 12:36:20 GMT Client-Date: Wed, 21 Nov 2001 12:33:18 GMT Client-Peer: 10.1.17.5:8080 real_HEAD HTTP/1.1 200 OK Connection: close Date: Wed, 21 Nov 2001 12:43:15 GMT Via: HTTP/1.1 (IBM-PROXY-WTE), 1.0 NSW-PROXY Server: Apache/1.3.22 (Unix) mod_perl/1.26 PHP/4.0.6 Content-Length: 1766 Content-Type: text/html ETag: "57532-6e6-3bf6bcac" Last-Modified: Sat, 17 Nov 2001 19:38:20 GMT Client-Date: Wed, 21 Nov 2001 12:33:19 GMT Client-Peer: 10.1.17.5:8080

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: LWP head replacement by tachyon
in thread LWP head replacement by crazyinsomniac

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 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?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found