use HTTP::Size;
$url = "file://localhost/c:";
my $size = HTTP::Size::get_size( $url );
print $size;
if( defined $size )
{
print "$url size was $size";
}
elsif( HTTP::Size::ERROR == $HTTP::Size::INVALID_URL )
{
print "$url is not a valid absolute URL";
}
elsif( HTTP::Size::ERROR == $HTTP::Size::COULD_NOT_FETCH )
{
print "Could not fetch $url\nHTTP status is $HTTP::Size::HTTP_STATUS";
}
elsif( HTTP::Size::ERROR == $HTTP::Size::BAD_CONTENT_LENGTH )
{
print "Could not determine content length of $url";
}
Now, is this script supposed to get the total size of the localhost ?
I'm pretty sure your goal is not to discover how many characters it takes to display your c:\ directory as if it were a webpage. ;)
As a matter of fact, try entering that URL into your browser. You'll just get an error message. All you're getting, then, is the number of bytes in the error message.
Dave
perlmonks.org content © perlmonks.org and Anonymous Monk, borisz, brian_d_foy, chiburashka, davido, NodeReaper
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03