HTTP::Size and local host
chiburashka
created: 2004-06-16 06:39:09
My code is :

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 ?

Re: HTTP::Size and local host
created: 2004-06-16 06:50:05
HTTP::Size::get_size( $url ); returns the size of the page without taking the images into account. HTTP::Size::get_sizes( $url ); adds the size of the images too. perldoc HTTP::Size.
Boris
Re: HTTP::Size and local host
created: 2004-06-16 06:51:33
No, that will tell you the number of bytes returned when you ask for a list of the contents of the root directory of your C: drive. It's basically a count of the number of bytes it takes to textually represent your c:\ directory.

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

Re^2: HTTP::Size and local host
created: 2004-06-16 07:52:48
it works fine with the browser :-/
Re^3: HTTP::Size and local host
created: 2004-07-07 18:16:10
so ask browser
Re: HTTP::Size and local host
created: 2004-06-16 12:51:25
HTTP::Size just gets the size of the stuff that the web browser will have to download to display the URL that you requested. That's it. It does not recurse any further than the links on the specified URL.

--
brian d foy <bdfoy@cpan.org>
Author of HTTP::Size :)
Re: HTTP::Size and local host
created: 2004-07-07 18:16:25
This node was taken out by the NodeReaper on Wed Jul 7 18:47:17 2004 (EST)
Reason: Elian Empty

For more information on this node visit: this

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