The first and simplest use of LWP's two basic classes is LWP::UserAgent, which
manages HTTP connections and performs requests for you. The
new( ) constructor makes a user agent
$browser = LWP::UserAgent->new(
options and their default values
are summarized in Table
3-1. The options are attributes whose values can be fetched or
altered by the method calls described in the next section.
Table 3-1. Constructor options and default values for LWP::UserAgent
If you have a user agent object and want a copy of it (for
example, you want to run the same requests over two connections, one persistent with KeepAlive and
one without) use the
$copy = $browser->clone( );
This object represents a browser and has attributes you can get and set by calling methods on the object. Attributes modify future connections (e.g., proxying, timeouts, and whether the HTTP connection can be persistent) or the requests sent over the connection (e.g., authentication and cookies, or HTTP headers).
timeout( ) attribute
represents how long LWP will wait for a server to respond to a
$oldval = $browser->timeout([
That is, if you want to set the value, you'd do it like so:
And if you wanted to read the value, you'd do ...