Doit::Lwp - commands for dealing with WWW access
use Doit; my $doit = Doit->init; $doit->add_component('lwp'); $doit->lwp_mirror('http://example.com', 'mirrored-file');
Doit::Lwp is a Doit component providing commands for dealing with WWW access. It has to be added to a script using Doit's add_component:
$doit->add_component('lwp');
The following commands are added to the Doit runner object:
$doit->lwp_mirror($url, $filename); $doit->lwp_mirror($url, $filename, refresh => always|never, ua => $ua);
Make sure that the resource at $url is fetched and stored on the local system as $filename. LWP::UserAgent's mirror is used to fetch the resource, so if the remote resource did not change and the remote server deals correctly with If-Modified-Since requests, then nothing happens.
If-Modified-Since
The refresh option may be set to never --- in this case the resource will fetched only once, and never refreshed.
refresh
never
By default, LWP::UserAgent is used for doing the mirror. It is possible to use HTTP::Tiny by passing an object of this class to the ua option.
ua
Please note that LWP::UserAgent's mirror is not atomic.
The command returns 1 if the resource was downloaded, otherwise 0.
Slaven Rezic <srezic@cpan.org>
Copyright (c) 2017 Slaven Rezic. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Doit, LWP::UserAgent, HTTP::Tiny.
To install Doit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Doit
CPAN shell
perl -MCPAN -e shell install Doit
For more information on module installation, please visit the detailed CPAN module installation guide.