I was working at a different site yesterday, so this is the earliest I could respond.
I didn't know about LWP::Debug, so thanks for adding to my enlightenment. If I have somehow conveyed the impression that I am generally knowledgeable about LWP, it was unintentional. My knowledge is pretty basic, and I'm trying to keep my projects pretty basic, too, for now.
Anyway, I've turned on the debug option, and changed the script to dump $a. The site is an intranet site, so you won't be able to run the code. I had the "whatever.com" in there as a too-oblique indicator of that.
Code is now:
#!perl
# Automated navigation through web pages
use strict;
use warnings;
use WWW::Mechanize;
use LWP::Debug '+';
use Data::Dumper;
my $a = WWW::Mechanize->new(
autocheck => 1,
agent => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'
);
my $testpage = 'http://myprodportalv2.unocal.com:7778/portal/page?_pag
+eid=33,30917,33_30962&_dad=puno2o&_schema=PORTAL_PUNO2O';
$a->get($testpage);
$a->success() or do {
open PAGE, '>failpage.html';
print PAGE Dumper($a);
close PAGE;
die 'Get failed: "'.$a->res->status_line."\" for\n".$testpage."\n
+or ".$a->base()."\n";
};
Output is now:
C:\Documents and Settings\johnsro\My Documents\Perl>perl myfinint2.pl
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking myprodportalv2.unocal.com f
+or cookies
HTTP::Cookies::add_cookie_header: Checking .unocal.com for cookies
HTTP::Cookies::add_cookie_header: Checking unocal.com for cookies
HTTP::Cookies::add_cookie_header: Checking .com for cookies
LWP::UserAgent::send_request: GET http://myprodportalv2.unocal.com:777
+8/portal/page?_pageid=33,30917,33_30962&_dad=puno2o&_schema=PORTAL_PU
+NO2O
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::UserAgent::request: Simple response: Not Implemented
Get failed: "501 Not Implemented" for
http://myprodportalv2.unocal.com:7778/portal/page?_pageid=33,30917,33_
+30962&_dad=puno2o&_schema=PORTAL_PUNO2O
or http://myprodportalv2.unocal.com:7778/portal/page?_pageid=33,30917
+,33_30962&_dad=puno2o&_schema=PORTAL_PUNO2O
and the dumped file is
$VAR1 = bless( {
'req' => bless( {
'_content' => '',
'_uri' => bless( do{\(my $o = 'http
+://myprodportalv2.unocal.com:7778/portal/page?_pageid=33,30917,33_309
+62&_dad=puno2o&_schema=PORTAL_PUNO2O')}, 'URI::http' ),
'_headers' => bless( {
'user-agent'
+ => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'
}, 'HTTP::Head
+ers' ),
'_method' => 'GET'
}, 'HTTP::Request' ),
'status' => '501',
'content' => '',
'ct' => 'text/plain',
'res' => bless( {
'_protocol' => 'HTTP/1.1',
'_content' => '',
'_rc' => 501,
'_headers' => bless( {
'connection'
+ => 'Close',
'client-resp
+onse-num' => 1,
'cache-contr
+ol' => 'private',
'date' => 'W
+ed, 19 Nov 2003 14:45:01 GMT',
'client-peer
+' => '141.146.165.174:7778',
'content-len
+gth' => '0',
'client-date
+' => 'Wed, 19 Nov 2003 14:45:02 GMT',
'content-typ
+e' => 'text/plain',
'server' =>
+'Oracle9iAS/9.0.2.2.0 Oracle HTTP Server Oracle9iAS-Web-Cache/9.0.2.2
+.0 (N)'
}, 'HTTP::Head
+ers' ),
'_msg' => 'Not Implemented',
'_request' => $VAR1->{'req'}
}, 'HTTP::Response' ),
'page_stack' => [],
'redirected_uri' => $VAR1->{'req'}{'_uri'},
'requests_redirectable' => [
'GET',
'HEAD',
'POST'
],
'from' => undef,
'timeout' => 180,
'parse_head' => 1,
'base' => bless( do{\(my $o = 'http://myprodportalv2.
+unocal.com:7778/portal/page?_pageid=33,30917,33_30962&_dad=puno2o&_sc
+hema=PORTAL_PUNO2O')}, 'URI::http' ),
'quiet' => 0,
'protocols_forbidden' => undef,
'no_proxy' => [],
'protocols_allowed' => undef,
'use_eval' => 1,
'agent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Window
+s NT 5.1)',
'cookie_jar' => bless( {
'COOKIES' => {}
}, 'HTTP::Cookies' ),
'proxy' => {},
'max_size' => undef
}, 'WWW::Mechanize' );
|