The new HTTP::Size module seems to do exactly what you want.
In reply to Re: size of page by adrianh in thread size of page by darshan_atha