NAME
MooX::Role::CachedURL - a role providing a locally cached copy of a remote file
SYNOPSIS
package MyClass;
use Moo;
with 'MooX::Role::CachedURL';
has '+url' => (default => sub { 'http://www.cpan.org/robots.txt' });
sub my_method {
my $self = shift;
# $self->path has the path to the local copy of the file
}
DESCRIPTION
This role represents a remote file that you want to cache locally, and then process. This is common functionality that I'm pulling out of my PAUSE::Users, PAUSE::Permissions and PAUSE::Packages modules.
PAUSE::Users provides a simple interface to the 00whois.xml
file that is generated by PAUSE. It caches the file locally, then provides a mechanism for iterating over all users in the file.
If you look right now, you'll notice that none of those modules use this role yet; I'll be gradually refactoring them once this role is on CPAN.
REPOSITORY
https://github.com/neilbowers/MooX-Role-CachedURL
AUTHOR
Neil Bowers <neilb@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Neil Bowers <neilb@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.