/usr/share/perl5/Prophet/ContentAddressedStore.pm is in libprophet-perl 0.750-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 | package Prophet::ContentAddressedStore;
use Any::Moose;
use JSON;
use Digest::SHA qw(sha1_hex);
has fs_root => (
is => 'rw',
);
has root => (
isa => 'Str',
is => 'rw',
);
sub write {
my ($self, $content) = @_;
$content = $$content
if ref($content) eq 'SCALAR';
$content = to_json( $content,
{ canonical => 1, pretty => 0, utf8 => 1 } )
if ref($content);
my $fingerprint = sha1_hex($content);
Prophet::Util->write_file( file => $self->filename($fingerprint, 1),
content => $content );
return $fingerprint;
}
sub filename {
my ($self, $key, $full) = @_;
Prophet::Util->catfile( $full ? $self->fs_root : (),
$self->root =>
Prophet::Util::hashed_dir_name($key) );
}
__PACKAGE__->meta->make_immutable();
no Any::Moose;
1;
|