/usr/share/perl5/Perlanet/Trait/Cache.pm is in libperlanet-perl 0.56-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | package Perlanet::Trait::Cache;
use strict;
use warnings;
use Moose::Role;
use namespace::autoclean;
=head1 NAME
Perlanet::Trait::Cache - cache feeds with CHI
=head1 SYNOPSIS
my $perlanet = Perlanet->new_with_traits(
traits => [ 'Perlanet::Trait::Cache' ]
);
$perlanet->run;
=head1 DESCRIPTION
Everytime a page is fetched it is cached first through CHI. This allows you
to cache pages to a local disk for example, if the feed has not changed.
=head1 ATTRIBUTES
=head2 cache
The L<Chi> cache object
=cut
has 'cache'=> (
is => 'rw'
);
around 'fetch_page' => sub {
my $orig = shift;
my ($self, $url) = @_;
return URI::Fetch->fetch(
$url,
UserAgent => $self->ua,
Cache => $self->cache || undef,
ForceResponse => 1,
);
};
=head1 AUTHOR
Dave Cross, <dave@mag-sol.com>
=head1 COPYRIGHT AND LICENSE
Copyright (c) 2010 by Magnum Solutions Ltd.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.
=cut
1;
|