GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  HTML::HTML5::PARSER::UA (3)

.ds Aq ’

NAME

HTML::HTML5::Parser::UA - simple web user agent class

CONTENTS

SYNOPSIS



 use aliased HTML::HTML5::Parser::UA;

 my $response = UA->get($url);
 die unless $response->{success};

 print $response->{decoded_content};



DESCRIPTION

This is a simple wrapper around HTTP::Tiny and LWP::UserAgent to smooth out the API differences between them. It only supports bog standard get($url) requests.

If LWP::UserAgent is already in memory, this module will use that.

If LWP::UserAgent is not in memory, then this module will use HTTP::Tiny (or direct filesystem access for file:// URLs).

If LWP::UserAgent is not in memory, and you attempt to request a URL that HTTP::Tiny cannot handle (e.g. an ftp:// URL), then this module will load LWP::UserAgent and die if it cannot be loaded (e.g. is not installed).

HTML::HTML5::Parser::UA is used by the parse_file method of HTML::HTML5::Parser.

    Class Method

get($url, $ua) Gets the URL and returns a hashref similar to HTTP::Tiny’s hashrefs, but with an additional decoded_content key, which contains the response body, decoded into a Perl character string (not a byte string).

If $ua is given (it’s optional), then this user agent will be used to perform the actual request. Must be undef or an LWP::UserAgent object (or a subclass) or an HTTP::Tiny object (or a subclass).

    Package Variable

$HTML::HTML5::Parser::NO_LWP If true, avoids using LWP::UserAgent.

MOTIVATION

LWP::UserAgent is a good piece of software but it has a dependency on HTML::Parser. HTML::Parser is only used to provide one fairly esoteric feature, which this package doesn’t make use of. (It’s the parse_head option.)

Because of that, I don’t especially want HTML::HTML5::Parser to have a dependency on LWP::UserAgent. Hence this module.

SEE ALSO

HTML::HTML5::Parser.

AUTHOR

Toby Inkster, <tobyink@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Toby Inkster

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED AS IS AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 HTML::HTML5::PARSER::UA (3) 2013-07-08

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.