/usr/share/perl5/Code/TidyAll/Cache.pm is in libcode-tidyall-perl 0.55~dfsg-2.
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 | package Code::TidyAll::Cache;
use strict;
use warnings;
use Digest::SHA qw(sha1_hex);
use Path::Tiny qw(path);
use Moo;
our $VERSION = '0.55';
has 'cache_dir' => ( is => 'ro', required => 1 );
sub path_to_key {
my ( $self, $key ) = @_;
my $sig = sha1_hex($key);
return $self->cache_dir->child( substr( $sig, 0, 1 ), "$sig.dat" );
}
sub get {
my ( $self, $key ) = @_;
my $file = $self->path_to_key($key);
if ( $file->exists ) {
return $file->slurp;
}
else {
return undef;
}
}
sub set {
my ( $self, $key, $value ) = @_;
my $file = $self->path_to_key($key);
$file->parent->mkpath( { mode => 0755 } );
$file->spew($value);
return;
}
sub remove {
my ( $self, $key, $value ) = @_;
$self->path_to_key($key)->remove;
return;
}
1;
|