albus123 has asked for the wisdom of the Perl Monks concerning the following question:
I have recently started working on Perl LWP. I have been able to get a very simple program to work:
The program works fine and now I am trying to understand the flow. Using debugs, I could figure out that _new_socket() in http.pm creates the socket, connect() in IO::Socket is used to connect to the remote server and drop() routine in ConnCache.pm is used for clearing connections. However, I do not understand where the socket is getting closed. I expected close() or shutdown() in Socket.pm to get invoked from drop(), but neither are (but the FIN is being sent by the client). Am I missing something here? Can some one help me understand where the close() routine (or any equivalent) is getting called. Thanks & Regards,my $conn = LWP::UserAgent->new(keep_alive => 1,) or die(Failed to create UserAgent"); $conn->timeout("3"); my $cache = $conn->conn_cache(); my $url = "http://192.168.1.2/test.html" #My local machine my $request = HTTP::Request->new('GET', $url); my $response = $conn->request($request); print STDERR "$response\n"; $cache->drop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Query regarding LWP
by Discipulus (Canon) on Jun 23, 2015 at 09:31 UTC | |
by albus123 (Novice) on Jun 23, 2015 at 21:43 UTC |