Skip Menu |

This queue is for tickets about the WWW-Class CPAN distribution.

Report information
The Basics
Id: 73070
Status: new
Priority: 0/
Queue: WWW-Class

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Using LWP::Simple is inefficient.
The uri() method performs a head() request then a body() request, meaning that two HTTP requests are performed, thus two TCP connections need to be opened and torn down in sequence. This wastes network resources and time. If you used LWP::UserAgent instead of LWP::Simple you could just do one request: $response = LWP::UserAgent->new->get($uri); Then you can check whether the response was a success (i.e. HTTP 200) with: $response->is_success and you can get the response body like this: $response->decoded_content You may also be interested in checking: $response->headers->content_is_html