It's not perfect ... but it should get you started. ;)use strict; use LWP::Simple; use HTML::TokeParser; my $url = shift || 'http://www.google.com'; my $html = get($url); my $size = length($html); print "html has size $size\n"; my $parser = HTML::TokeParser->new(\$html); while (my $tag = $parser->get_tag('img')) { my $img = $tag->[1]->{src}; next unless $img; $img = "$url/$img" unless $img =~ /^http/; my $img_size = (head($img))[1]; print "$img has size $img_size\n"; $size += $img_size; } print "Total size: $size\n";
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to (jeffa) Re: size of page
by jeffa
in thread size of page
by darshan_atha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |