Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I need to get the LWP::UserAgent get request to go out on a specific interface. For this I need to set the local_addr of the socket. I have 4 interfaces and need to test them. By making the get request going out on a specific ip address/interface I can determine if the interface is working correctly. Thanks, Robert
  • Comment on need to set local_addr for LWP::UserAgent

Replies are listed 'Best First'.
Re: need to set local_addr for LWP::UserAgent
by Fletch (Bishop) on Jul 28, 2006 at 18:29 UTC
Re: need to set local_addr for LWP::UserAgent
by ikegami (Patriarch) on Jul 28, 2006 at 19:39 UTC
    You can put any IO::Socket::INET options you wish in @LWP::Protocol::http::EXTRA_SOCK_OPTS.
    local @LWP::Protocol::http::EXTRA_SOCK_OPTS = ( @LWP::Protocol::http::EXTRA_SOCK_OPTS, LocalAddr => '127.0.0.1', ); ... do request ...