You can use HTTP::Size under the same terms as Perl itself.