/usr/share/perl5/Code/TidyAll/Cache.pm is in libcode-tidyall-perl 0.20-1.
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 | package Code::TidyAll::Cache;
$Code::TidyAll::Cache::VERSION = '0.20';
use Digest::SHA qw(sha1_hex);
use Code::TidyAll::Util qw(dirname mkpath read_file write_file);
use Moo;
has 'cache_dir' => ( is => 'ro', required => 1 );
sub path_to_key {
my ( $self, $key ) = @_;
my $sig = sha1_hex($key);
return join( "/", $self->cache_dir, substr( $sig, 0, 1 ), "$sig.dat" );
}
sub get {
my ( $self, $key ) = @_;
my $file = $self->path_to_key($key);
if ( defined $file && -f $file ) {
return read_file($file);
}
else {
return undef;
}
}
sub set {
my ( $self, $key, $value ) = @_;
my $file = $self->path_to_key($key);
mkpath( dirname($file), 0, 0775 );
write_file( $file, $value );
}
sub remove {
my ( $self, $key, $value ) = @_;
my $file = $self->path_to_key($key);
unlink($file);
}
1;
|