Name

new

Synopsis

$ua->new(%options)

Constructs a new LWP::UserAgent object and returns a reference to it. Key/value arguments may be provided to set up the initial state of the user agent. new accepts several options that correspond to the following attribute methods:

Key

Default

agent

"libwww-perl/#.##"

from

undef

timeout

180

use_eval

1

parse_head

1

max_size

undef

cookie_jar

undef

conn_cache

undef

protocols_allowed

undef

protocols_forbidden

undef

requests_redirectable

["GET", "HEAD"]

The options are:

env_proxy

If set to true, proxy settings are read from environment variables.

keep_alive

A number that will be passed on as the total_capacity for the connection. A LWP::ConnCache is set up (see the conn_cache method), and the HTTP/1.1 protocol module is enabled.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.