bug in LWP::Simple::head()
Tom Christiansen (tchrist@mox.perl.com)
Sun, 12 May 1996 09:25:19 -0600
If you call head($url) in a scalar context on a file: URL
if (head("file:/index.html")) {...}
this fails, because head() only has a list return, and the last
element of that list is the Server, which is empty, so you get a false string
there. This seems suboptimal.
--tom
sub head ($)
{
my($url) = @_;
my $request = new HTTP::Request 'HEAD', $url;
my $response = $ua->request($request);
if ($response->is_success) {
return ($response->header('Content-Type'),
$response->header('Content-Length'),
str2time($response->header('Last-Modified')),
str2time($response->header('Expires')),
$response->header('Server'),
##### >>>>>>>>>>>>>>>>>>>>>>>>> this guy is empty
);
} else {
return undef;
}
}