01 Nov 2011 17:45:13 UTC
- Distribution: LWPx-TimedHTTP
- Module version: 1.8
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (4)
- Testers (532 / 867 / 0)
- KwaliteeBus factor: 0
- 12.39% Coverage
- License: perl_5
- Download (9.07KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- Simon Wistow
- SEE ALSO
LWPx::TimedHTTP - time the different stages of an HTTP request
# do the work for you use LWP::UserAgent; use LWPx::TimedHTTP qw(:autoinstall); # now just continue as normal my $ua = LWP::UserAgent->new; my $response = $ua->get("http://thegestalt.org"); # ... with optional retrieving of metrics (in seconds) printf "%f\n", $response->header('Client-Request-Connect-Time'); # or if you don't like magic going on in the background use LWP::UserAgent; use LWP::Protocol; use LWPx::TimedHTTP; LWP::Protocol::implementor('http', 'LWPx::TimedHTTP'); # or for https .... LWP::Protocol::implementor('https', 'LWPx::TimedHTTP::https'); my $ua = LWP::UserAgent->new; my $response = $ua->get("http://thegestalt.org"); printf "%f\n", $response->header('Client-Request-Connect-Time');
This module performs an HTTP request exactly the same as LWP does normally except for the fact that it times each stage of the request and then inserts the results as header.
It's useful for debugging where abouts in a connection slow downs are occuring.
All times returned are in seconds
The time it took to do a DNS lookup on the host.
NOTE: The value of this timing is NOT thread safe since it has to smuggle the data back via a global variable.
The time it took to connect to the remote server
The time it took to transmit the request
Time it took to respond to the request
Time it took to get the data back
Simon Wistow <firstname.lastname@example.org>
Based entirely on work by David Carter - this module is a little light frobbing and some packaging of code he posted to the libwww-perl mailing list in response to one of my questions.
His code was, in turn, based on LWP::Protocol::http by Gisle Aas which is distributed as part of the libwww package.
(c)opyright 2002, Simon Wistow
Distributed under the same terms as Perl itself.
This software is under no warranty and will probably ruin your life, kill your friends, burn your house and bring about the apocalypse
Module Install Instructions
To install LWPx::TimedHTTP, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install LWPx::TimedHTTP
For more information on module installation, please visit the detailed CPAN module installation guide.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|