CSS-Inliner
view release on metacpan or search on metacpan
lib/CSS/Inliner.pm view on Meta::CPAN
$ua->agent($self->_agent()); # masquerade as Mozilla/4.0 unless otherwise specified in the constructor
$ua->protocols_allowed( ['http','https'] );
# set URI internal flag such that leading dot edge-case urls work
local $URI::ABS_REMOTE_LEADING_DOTS = 1;
# Create a request
my $uri = URI->new($$params{url});
my $req = HTTP::Request->new('GET', $uri, [ 'Accept' => 'text/html, */*' ]);
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
# if not successful
if (!$res->is_success()) {
croak 'There was an error in fetching the document for ' . $uri . ' : ' . $res->message;
}
# Is it a HTML document
( run in 0.440 second using v1.01-cache-2.11-cpan-de7293f3b23 )