Subject: | base not always set in HTTP::Response |
Try this sample program with and without HTTP::Cache::Transparent - you
get different results. webdoc->base isn't set with transparent enabled,
without it, it *is* set.
njh@philips:~/spider/cgi-bin$ cat /tmp/bar
#!/usr/bin/perl -w
use strict;
use warnings;
use diagnostics;
use LWP;
use HTTP::Cache::Transparent;
HTTP::Cache::Transparent::init( {
BasePath => '/tmp/fff',
# Verbose => 1,
NoUpdate => 60 * 60,
MaxAge => 15 * 24} ) ||
die "search/cache: $!";
my $lwp = LWP::UserAgent->new();
$lwp->timeout(20);
my $request = new HTTP::Request 'GET' => 'http://www.sldbrass.com/';
# webdoc is of type HTTP::Response
my $webdoc = $lwp->simple_request($request);
unless($webdoc->base) {
die "webdoc->base is not set\n";
}
njh@philips:~/spider/cgi-bin$ /tmp/bar
Uncaught exception from user code:
webdoc->base is not set
at /tmp/bar line 24
njh@philips:~/spider/cgi-bin$