# connect to remote site my $socket = $self->_new_socket($host, $port, $timeout); $self->_check_sock($request, $socket); sub _check_sock { #my($self, $req, $sock) = @_; } #### *LWP::Protocol::http::Socket::connect = *LWP::Protocol::http10::Socket::connect = *LWP::Protocol::https::Socket::connect = *LWP::Protocol::https10::Socket::connect = sub { my $self = shift; my $sock = $self->SUPER::connect(@_); ## get port here return $sock; };