use LWP::Debug qw(+); use Time::HiRes qw(gettimeofday tv_interval); my $ts; use LWP::Protocol::http; use Hook::LexWrap; wrap 'LWP::Protocol::http::SocketMethods::sysread', pre => sub { $ts = [gettimeofday] }, post => sub { printf ">>%.5f\n" , tv_interval($ts) }; #### use LWP::Debug qw(+); use Aspect; my $pcut = call qr/LWP::Protocol::http::SocketMethods::sysread/; before { $ts = [gettimeofday] } $pcut; after { printf ">>%.5f\n" , tv_interval($ts) } $pcut; #### LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () >>0.00536 LWP::Protocol::collect: read 796 bytes >>0.00007 LWP::Protocol::collect: read 3356 bytes >>0.00071 LWP::Protocol::collect: read 1460 bytes >>0.00103 LWP::Protocol::collect: read 1460 bytes >>0.00005 LWP::Protocol::collect: read 997 bytes LWP::UserAgent::request: Simple response: OK