1LWP::UserAgent(3)     User Contributed Perl Documentation    LWP::UserAgent(3)
2
3
4

NAME

6       LWP::UserAgent - Web user agent class
7

SYNOPSIS

9        require LWP::UserAgent;
10
11        my $ua = LWP::UserAgent->new;
12        $ua->timeout(10);
13        $ua->env_proxy;
14
15        my $response = $ua->get('http://search.cpan.org/');
16
17        if ($response->is_success) {
18            print $response->decoded_content;  # or whatever
19        }
20        else {
21            die $response->status_line;
22        }
23

DESCRIPTION

25       The "LWP::UserAgent" is a class implementing a web user agent.
26       "LWP::UserAgent" objects can be used to dispatch web requests.
27
28       In normal use the application creates an "LWP::UserAgent" object, and
29       then configures it with values for timeouts, proxies, name, etc. It
30       then creates an instance of "HTTP::Request" for the request that needs
31       to be performed. This request is then passed to one of the request
32       method the UserAgent, which dispatches it using the relevant protocol,
33       and returns a "HTTP::Response" object.  There are convenience methods
34       for sending the most common request types: get(), head() and post().
35       When using these methods then the creation of the request object is
36       hidden as shown in the synopsis above.
37
38       The basic approach of the library is to use HTTP style communication
39       for all protocol schemes.  This means that you will construct
40       "HTTP::Request" objects and receive "HTTP::Response" objects even for
41       non-HTTP resources like gopher and ftp.  In order to achieve even more
42       similarity to HTTP style communications, gopher menus and file
43       directories are converted to HTML documents.
44

CONSTRUCTOR METHODS

46       The following constructor methods are available:
47
48       $ua = LWP::UserAgent->new( %options )
49           This method constructs a new "LWP::UserAgent" object and returns
50           it.  Key/value pair arguments may be provided to set up the initial
51           state.  The following options correspond to attribute methods
52           described below:
53
54              KEY                     DEFAULT
55              -----------             --------------------
56              agent                   "libwww-perl/#.###"
57              from                    undef
58              conn_cache              undef
59              cookie_jar              undef
60              default_headers         HTTP::Headers->new
61              local_address           undef
62              max_size                undef
63              max_redirect            7
64              parse_head              1
65              protocols_allowed       undef
66              protocols_forbidden     undef
67              requests_redirectable   ['GET', 'HEAD']
68              timeout                 180
69
70           The following additional options are also accepted: If the
71           "env_proxy" option is passed in with a TRUE value, then proxy
72           settings are read from environment variables (see env_proxy()
73           method below).  If the "keep_alive" option is passed in, then a
74           "LWP::ConnCache" is set up (see conn_cache() method below).  The
75           "keep_alive" value is passed on as the "total_capacity" for the
76           connection cache.
77
78       $ua->clone
79           Returns a copy of the LWP::UserAgent object.
80

ATTRIBUTES

82       The settings of the configuration attributes modify the behaviour of
83       the "LWP::UserAgent" when it dispatches requests.  Most of these can
84       also be initialized by options passed to the constructor method.
85
86       The following attribute methods are provided.  The attribute value is
87       left unchanged if no argument is given.  The return value from each
88       method is the old attribute value.
89
90       $ua->agent
91       $ua->agent( $product_id )
92           Get/set the product token that is used to identify the user agent
93           on the network.  The agent value is sent as the "User-Agent" header
94           in the requests.  The default is the string returned by the
95           _agent() method (see below).
96
97           If the $product_id ends with space then the _agent() string is
98           appended to it.
99
100           The user agent string should be one or more simple product
101           identifiers with an optional version number separated by the "/"
102           character.  Examples are:
103
104             $ua->agent('Checkbot/0.4 ' . $ua->_agent);
105             $ua->agent('Checkbot/0.4 ');    # same as above
106             $ua->agent('Mozilla/5.0');
107             $ua->agent("");                 # don't identify
108
109       $ua->_agent
110           Returns the default agent identifier.  This is a string of the form
111           "libwww-perl/#.###", where "#.###" is substituted with the version
112           number of this library.
113
114       $ua->from
115       $ua->from( $email_address )
116           Get/set the e-mail address for the human user who controls the
117           requesting user agent.  The address should be machine-usable, as
118           defined in RFC 822.  The "from" value is send as the "From" header
119           in the requests.  Example:
120
121             $ua->from('gaas@cpan.org');
122
123           The default is to not send a "From" header.  See the
124           default_headers() method for the more general interface that allow
125           any header to be defaulted.
126
127       $ua->cookie_jar
128       $ua->cookie_jar( $cookie_jar_obj )
129           Get/set the cookie jar object to use.  The only requirement is that
130           the cookie jar object must implement the extract_cookies($request)
131           and add_cookie_header($response) methods.  These methods will then
132           be invoked by the user agent as requests are sent and responses are
133           received.  Normally this will be a "HTTP::Cookies" object or some
134           subclass.
135
136           The default is to have no cookie_jar, i.e. never automatically add
137           "Cookie" headers to the requests.
138
139           Shortcut: If a reference to a plain hash is passed in as the
140           $cookie_jar_object, then it is replaced with an instance of
141           "HTTP::Cookies" that is initialized based on the hash.  This form
142           also automatically loads the "HTTP::Cookies" module.  It means
143           that:
144
145             $ua->cookie_jar({ file => "$ENV{HOME}/.cookies.txt" });
146
147           is really just a shortcut for:
148
149             require HTTP::Cookies;
150             $ua->cookie_jar(HTTP::Cookies->new(file => "$ENV{HOME}/.cookies.txt"));
151
152       $ua->default_headers
153       $ua->default_headers( $headers_obj )
154           Get/set the headers object that will provide default header values
155           for any requests sent.  By default this will be an empty
156           "HTTP::Headers" object.
157
158       $ua->default_header( $field )
159       $ua->default_header( $field => $value )
160           This is just a short-cut for $ua->default_headers->header( $field
161           => $value ). Example:
162
163             $ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodable());
164             $ua->default_header('Accept-Language' => "no, en");
165
166       $ua->conn_cache
167       $ua->conn_cache( $cache_obj )
168           Get/set the "LWP::ConnCache" object to use.  See LWP::ConnCache for
169           details.
170
171       $ua->credentials( $netloc, $realm )
172       $ua->credentials( $netloc, $realm, $uname, $pass )
173           Get/set the user name and password to be used for a realm.
174
175           The $netloc is a string of the form "<host>:<port>".  The username
176           and password will only be passed to this server.  Example:
177
178             $ua->credentials("www.example.com:80", "Some Realm", "foo", "secret");
179
180       $ua->local_address
181       $ua->local_address( $address )
182           Get/set the local interface to bind to for network connections.
183           The interface can be specified as a hostname or an IP address.
184           This value is passed as the "LocalAddr" argument to
185           IO::Socket::INET.
186
187       $ua->max_size
188       $ua->max_size( $bytes )
189           Get/set the size limit for response content.  The default is
190           "undef", which means that there is no limit.  If the returned
191           response content is only partial, because the size limit was
192           exceeded, then a "Client-Aborted" header will be added to the
193           response.  The content might end up longer than "max_size" as we
194           abort once appending a chunk of data makes the length exceed the
195           limit.  The "Content-Length" header, if present, will indicate the
196           length of the full content and will normally not be the same as
197           "length($res->content)".
198
199       $ua->max_redirect
200       $ua->max_redirect( $n )
201           This reads or sets the object's limit of how many times it will
202           obey redirection responses in a given request cycle.
203
204           By default, the value is 7. This means that if you call request()
205           method and the response is a redirect elsewhere which is in turn a
206           redirect, and so on seven times, then LWP gives up after that
207           seventh request.
208
209       $ua->parse_head
210       $ua->parse_head( $boolean )
211           Get/set a value indicating whether we should initialize response
212           headers from the <head> section of HTML documents. The default is
213           TRUE.  Do not turn this off, unless you know what you are doing.
214
215       $ua->protocols_allowed
216       $ua->protocols_allowed( \@protocols )
217           This reads (or sets) this user agent's list of protocols that the
218           request methods will exclusively allow.  The protocol names are
219           case insensitive.
220
221           For example: "$ua->protocols_allowed( [ 'http', 'https'] );" means
222           that this user agent will allow only those protocols, and attempts
223           to use this user agent to access URLs with any other schemes (like
224           "ftp://...") will result in a 500 error.
225
226           To delete the list, call: "$ua->protocols_allowed(undef)"
227
228           By default, an object has neither a "protocols_allowed" list, nor a
229           "protocols_forbidden" list.
230
231           Note that having a "protocols_allowed" list causes any
232           "protocols_forbidden" list to be ignored.
233
234       $ua->protocols_forbidden
235       $ua->protocols_forbidden( \@protocols )
236           This reads (or sets) this user agent's list of protocols that the
237           request method will not allow. The protocol names are case
238           insensitive.
239
240           For example: "$ua->protocols_forbidden( [ 'file', 'mailto'] );"
241           means that this user agent will not allow those protocols, and
242           attempts to use this user agent to access URLs with those schemes
243           will result in a 500 error.
244
245           To delete the list, call: "$ua->protocols_forbidden(undef)"
246
247       $ua->requests_redirectable
248       $ua->requests_redirectable( \@requests )
249           This reads or sets the object's list of request names that
250           "$ua->redirect_ok(...)" will allow redirection for.  By default,
251           this is "['GET', 'HEAD']", as per RFC 2616.  To change to include
252           'POST', consider:
253
254              push @{ $ua->requests_redirectable }, 'POST';
255
256       $ua->show_progress
257       $ua->show_progress( $boolean )
258           Get/set a value indicating whether a progress bar should be
259           displayed on on the terminal as requests are processed. The default
260           is FALSE.
261
262       $ua->timeout
263       $ua->timeout( $secs )
264           Get/set the timeout value in seconds. The default timeout() value
265           is 180 seconds, i.e. 3 minutes.
266
267           The requests is aborted if no activity on the connection to the
268           server is observed for "timeout" seconds.  This means that the time
269           it takes for the complete transaction and the request() method to
270           actually return might be longer.
271
272       $ua->ssl_opts
273       $ua->ssl_opts( $key )
274       $ua->ssl_opts( $key => $value )
275           Get/set the options for SSL connections.  Without argument return
276           the list of options keys currently set.  With a single argument
277           return the current value for the given option.  With 2 arguments
278           set the option value and return the old.  Setting an option to the
279           value "undef" removes this option.
280
281           The options that LWP relates to are:
282
283           "verify_hostname" => $bool
284               When TRUE LWP will for secure protocol schemes ensure it
285               connects to servers that have a valid certificate matching the
286               expected hostname.  If FALSE no checks are made and you can't
287               be sure that you communicate with the expected peer.  The no
288               checks behaviour was the default for libwww-perl-5.837 and
289               earlier releases.
290
291               This option is initialized from the
292               PERL_LWP_SSL_VERIFY_HOSTNAME environment variable.  If this
293               envirionment variable isn't set; then "verify_hostname"
294               defaults to 1.
295
296           "SSL_ca_file" => $path
297               The path to a file containing Certificate Authority
298               certificates.  A default setting for this option is provided by
299               checking the environment variables "PERL_LWP_SSL_CA_FILE" and
300               "HTTPS_CA_FILE" in order. Last resort value is built-in value
301               /etc/pki/tls/certs/ca-bundle.crt.
302
303           "SSL_ca_path" => $path
304               The path to a directory containing files containing Certificate
305               Authority certificates.  A default setting for this option is
306               provided by checking the environment variables
307               "PERL_LWP_SSL_CA_PATH" and "HTTPS_CA_DIR" in order.
308
309           Other options can be set and are processed directly by the SSL
310           Socket implementation in use.  See IO::Socket::SSL or Net::SSL for
311           details.
312
313           SSL Socket implementation can be selected by environment variable
314           "PERL_NET_HTTPS_SSL_SOCKET_CLASS". IO::Socket::SSL is preferred by
315           default.
316
317   Proxy attributes
318       The following methods set up when requests should be passed via a proxy
319       server.
320
321       $ua->proxy(\@schemes, $proxy_url)
322       $ua->proxy($scheme, $proxy_url)
323           Set/retrieve proxy URL for a scheme:
324
325            $ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
326            $ua->proxy('gopher', 'http://proxy.sn.no:8001/');
327
328           The first form specifies that the URL is to be used for proxying of
329           access methods listed in the list in the first method argument,
330           i.e. 'http' and 'ftp'.
331
332           The second form shows a shorthand form for specifying proxy URL for
333           a single access scheme.
334
335       $ua->no_proxy( $domain, ... )
336           Do not proxy requests to the given domains.  Calling no_proxy
337           without any domains clears the list of domains. Eg:
338
339            $ua->no_proxy('localhost', 'example.com');
340
341       $ua->env_proxy
342           Load proxy settings from *_proxy environment variables.  You might
343           specify proxies like this (sh-syntax):
344
345             gopher_proxy=http://proxy.my.place/
346             wais_proxy=http://proxy.my.place/
347             no_proxy="localhost,example.com"
348             export gopher_proxy wais_proxy no_proxy
349
350           csh or tcsh users should use the "setenv" command to define these
351           environment variables.
352
353           On systems with case insensitive environment variables there exists
354           a name clash between the CGI environment variables and the
355           "HTTP_PROXY" environment variable normally picked up by
356           env_proxy().  Because of this "HTTP_PROXY" is not honored for CGI
357           scripts.  The "CGI_HTTP_PROXY" environment variable can be used
358           instead.
359
360   Handlers
361       Handlers are code that injected at various phases during the processing
362       of requests.  The following methods are provided to manage the active
363       handlers:
364
365       $ua->add_handler( $phase => \&cb, %matchspec )
366           Add handler to be invoked in the given processing phase.  For how
367           to specify %matchspec see "Matching" in HTTP::Config.
368
369           The possible values $phase and the corresponding callback
370           signatures are:
371
372           request_preprepare => sub { my($request, $ua, $h) = @_; ... }
373               The handler is called before the "request_prepare" and other
374               standard initialization of of the request.  This can be used to
375               set up headers and attributes that the "request_prepare"
376               handler depends on.  Proxy initialization should take place
377               here; but in general don't register handlers for this phase.
378
379           request_prepare => sub { my($request, $ua, $h) = @_; ... }
380               The handler is called before the request is sent and can modify
381               the request any way it see fit.  This can for instance be used
382               to add certain headers to specific requests.
383
384               The method can assign a new request object to $_[0] to replace
385               the request that is sent fully.
386
387               The return value from the callback is ignored.  If an
388               exceptions is raised it will abort the request and make the
389               request method return a "400 Bad request" response.
390
391           request_send => sub { my($request, $ua, $h) = @_; ... }
392               This handler get a chance of handling requests before it's sent
393               to the protocol handlers.  It should return an HTTP::Response
394               object if it wishes to terminate the processing; otherwise it
395               should return nothing.
396
397               The "response_header" and "response_data" handlers will not be
398               invoked for this response, but the "response_done" will be.
399
400           response_header => sub { my($response, $ua, $h) = @_; ... }
401               This handler is called right after the response headers have
402               been received, but before any content data.  The handler might
403               set up handlers for data and might croak to abort the request.
404
405               The handler might set the $response->{default_add_content}
406               value to control if any received data should be added to the
407               response object directly.  This will initially be false if the
408               $ua->request() method was called with a $content_file or
409               $content_cb argument; otherwise true.
410
411           response_data => sub { my($response, $ua, $h, $data) = @_; ... }
412               This handlers is called for each chunk of data received for the
413               response.  The handler might croak to abort the request.
414
415               This handler need to return a TRUE value to be called again for
416               subsequent chunks for the same request.
417
418           response_done => sub { my($response, $ua, $h) = @_; ... }
419               The handler is called after the response has been fully
420               received, but before any redirect handling is attempted.  The
421               handler can be used to extract information or modify the
422               response.
423
424           response_redirect => sub { my($response, $ua, $h) = @_; ... }
425               The handler is called in $ua->request after "response_done".
426               If the handler return an HTTP::Request object we'll start over
427               with processing this request instead.
428
429       $ua->remove_handler( undef, %matchspec )
430       $ua->remove_handler( $phase, %matchspec )
431           Remove handlers that match the given %matchspec.  If $phase is not
432           provided remove handlers from all phases.
433
434           Be careful as calling this function with %matchspec that is not not
435           specific enough can remove handlers not owned by you.  It's
436           probably better to use the set_my_handler() method instead.
437
438           The removed handlers are returned.
439
440       $ua->set_my_handler( $phase, $cb, %matchspec )
441           Set handlers private to the executing subroutine.  Works by
442           defaulting an "owner" field to the %matchspec that holds the name
443           of the called subroutine.  You might pass an explicit "owner" to
444           override this.
445
446           If $cb is passed as "undef", remove the handler.
447
448       $ua->get_my_handler( $phase, %matchspec )
449       $ua->get_my_handler( $phase, %matchspec, $init )
450           Will retrieve the matching handler as hash ref.
451
452           If $init is passed passed as a TRUE value, create and add the
453           handler if it's not found.  If $init is a subroutine reference,
454           then it's called with the created handler hash as argument.  This
455           sub might populate the hash with extra fields; especially the
456           callback.  If $init is a hash reference, merge the hashes.
457
458       $ua->handlers( $phase, $request )
459       $ua->handlers( $phase, $response )
460           Returns the handlers that apply to the given request or response at
461           the given processing phase.
462

REQUEST METHODS

464       The methods described in this section are used to dispatch requests via
465       the user agent.  The following request methods are provided:
466
467       $ua->get( $url )
468       $ua->get( $url , $field_name => $value, ... )
469           This method will dispatch a "GET" request on the given $url.
470           Further arguments can be given to initialize the headers of the
471           request. These are given as separate name/value pairs.  The return
472           value is a response object.  See HTTP::Response for a description
473           of the interface it provides.
474
475           There will still be a response object returned when LWP can't
476           connect to the server specified in the URL or when other failures
477           in protocol handlers occur.  These internal responses use the
478           standard HTTP status codes, so the responses can't be
479           differentiated by testing the response status code alone.  Error
480           responses that LWP generates internally will have the "Client-
481           Warning" header set to the value "Internal response".  If you need
482           to differentiate these internal responses from responses that a
483           remote server actually generates, you need to test this header
484           value.
485
486           Fields names that start with ":" are special.  These will not
487           initialize headers of the request but will determine how the
488           response content is treated.  The following special field names are
489           recognized:
490
491               :content_file   => $filename
492               :content_cb     => \&callback
493               :read_size_hint => $bytes
494
495           If a $filename is provided with the ":content_file" option, then
496           the response content will be saved here instead of in the response
497           object.  If a callback is provided with the ":content_cb" option
498           then this function will be called for each chunk of the response
499           content as it is received from the server.  If neither of these
500           options are given, then the response content will accumulate in the
501           response object itself.  This might not be suitable for very large
502           response bodies.  Only one of ":content_file" or ":content_cb" can
503           be specified.  The content of unsuccessful responses will always
504           accumulate in the response object itself, regardless of the
505           ":content_file" or ":content_cb" options passed in.
506
507           The ":read_size_hint" option is passed to the protocol module which
508           will try to read data from the server in chunks of this size.  A
509           smaller value for the ":read_size_hint" will result in a higher
510           number of callback invocations.
511
512           The callback function is called with 3 arguments: a chunk of data,
513           a reference to the response object, and a reference to the protocol
514           object.  The callback can abort the request by invoking die().  The
515           exception message will show up as the "X-Died" header field in the
516           response returned by the get() function.
517
518       $ua->head( $url )
519       $ua->head( $url , $field_name => $value, ... )
520           This method will dispatch a "HEAD" request on the given $url.
521           Otherwise it works like the get() method described above.
522
523       $ua->post( $url, \%form )
524       $ua->post( $url, \@form )
525       $ua->post( $url, \%form, $field_name => $value, ... )
526       $ua->post( $url, $field_name => $value,... Content => \%form )
527       $ua->post( $url, $field_name => $value,... Content => \@form )
528       $ua->post( $url, $field_name => $value,... Content => $content )
529           This method will dispatch a "POST" request on the given $url, with
530           %form or @form providing the key/value pairs for the fill-in form
531           content. Additional headers and content options are the same as for
532           the get() method.
533
534           This method will use the POST() function from
535           "HTTP::Request::Common" to build the request.  See
536           HTTP::Request::Common for a details on how to pass form content and
537           other advanced features.
538
539       $ua->mirror( $url, $filename )
540           This method will get the document identified by $url and store it
541           in file called $filename.  If the file already exists, then the
542           request will contain an "If-Modified-Since" header matching the
543           modification time of the file.  If the document on the server has
544           not changed since this time, then nothing happens.  If the document
545           has been updated, it will be downloaded again.  The modification
546           time of the file will be forced to match that of the server.
547
548           The return value is the the response object.
549
550       $ua->request( $request )
551       $ua->request( $request, $content_file )
552       $ua->request( $request, $content_cb )
553       $ua->request( $request, $content_cb, $read_size_hint )
554           This method will dispatch the given $request object.  Normally this
555           will be an instance of the "HTTP::Request" class, but any object
556           with a similar interface will do.  The return value is a response
557           object.  See HTTP::Request and HTTP::Response for a description of
558           the interface provided by these classes.
559
560           The request() method will process redirects and authentication
561           responses transparently.  This means that it may actually send
562           several simple requests via the simple_request() method described
563           below.
564
565           The request methods described above; get(), head(), post() and
566           mirror(), will all dispatch the request they build via this method.
567           They are convenience methods that simply hides the creation of the
568           request object for you.
569
570           The $content_file, $content_cb and $read_size_hint all correspond
571           to options described with the get() method above.
572
573           You are allowed to use a CODE reference as "content" in the request
574           object passed in.  The "content" function should return the content
575           when called.  The content can be returned in chunks.  The content
576           function will be invoked repeatedly until it return an empty string
577           to signal that there is no more content.
578
579       $ua->simple_request( $request )
580       $ua->simple_request( $request, $content_file )
581       $ua->simple_request( $request, $content_cb )
582       $ua->simple_request( $request, $content_cb, $read_size_hint )
583           This method dispatches a single request and returns the response
584           received.  Arguments are the same as for request() described above.
585
586           The difference from request() is that simple_request() will not try
587           to handle redirects or authentication responses.  The request()
588           method will in fact invoke this method for each simple request it
589           sends.
590
591       $ua->is_protocol_supported( $scheme )
592           You can use this method to test whether this user agent object
593           supports the specified "scheme".  (The "scheme" might be a string
594           (like 'http' or 'ftp') or it might be an URI object reference.)
595
596           Whether a scheme is supported, is determined by the user agent's
597           "protocols_allowed" or "protocols_forbidden" lists (if any), and by
598           the capabilities of LWP.  I.e., this will return TRUE only if LWP
599           supports this protocol and it's permitted for this particular
600           object.
601
602   Callback methods
603       The following methods will be invoked as requests are processed. These
604       methods are documented here because subclasses of "LWP::UserAgent"
605       might want to override their behaviour.
606
607       $ua->prepare_request( $request )
608           This method is invoked by simple_request().  Its task is to modify
609           the given $request object by setting up various headers based on
610           the attributes of the user agent. The return value should normally
611           be the $request object passed in.  If a different request object is
612           returned it will be the one actually processed.
613
614           The headers affected by the base implementation are; "User-Agent",
615           "From", "Range" and "Cookie".
616
617       $ua->redirect_ok( $prospective_request, $response )
618           This method is called by request() before it tries to follow a
619           redirection to the request in $response.  This should return a TRUE
620           value if this redirection is permissible.  The $prospective_request
621           will be the request to be sent if this method returns TRUE.
622
623           The base implementation will return FALSE unless the method is in
624           the object's "requests_redirectable" list, FALSE if the proposed
625           redirection is to a "file://..."  URL, and TRUE otherwise.
626
627       $ua->get_basic_credentials( $realm, $uri, $isproxy )
628           This is called by request() to retrieve credentials for documents
629           protected by Basic or Digest Authentication.  The arguments passed
630           in is the $realm provided by the server, the $uri requested and a
631           boolean flag to indicate if this is authentication against a proxy
632           server.
633
634           The method should return a username and password.  It should return
635           an empty list to abort the authentication resolution attempt.
636           Subclasses can override this method to prompt the user for the
637           information. An example of this can be found in "lwp-request"
638           program distributed with this library.
639
640           The base implementation simply checks a set of pre-stored member
641           variables, set up with the credentials() method.
642
643       $ua->progress( $status, $request_or_response )
644           This is called frequently as the response is received regardless of
645           how the content is processed.  The method is called with $status
646           "begin" at the start of processing the request and with $state
647           "end" before the request method returns.  In between these $status
648           will be the fraction of the response currently received or the
649           string "tick" if the fraction can't be calculated.
650
651           When $status is "begin" the second argument is the request object,
652           otherwise it is the response object.
653

SEE ALSO

655       See LWP for a complete overview of libwww-perl5.  See lwpcook and the
656       scripts lwp-request and lwp-download for examples of usage.
657
658       See HTTP::Request and HTTP::Response for a description of the message
659       objects dispatched and received.  See HTTP::Request::Common and
660       HTML::Form for other ways to build request objects.
661
662       See WWW::Mechanize and WWW::Search for examples of more specialized
663       user agents based on "LWP::UserAgent".
664
666       Copyright 1995-2009 Gisle Aas.
667
668       This library is free software; you can redistribute it and/or modify it
669       under the same terms as Perl itself.
670
671
672
673perl v5.12.4                      2011-10-13                 LWP::UserAgent(3)
Impressum