/usr/share/perl5/Prophet/DatabaseSetting.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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | package Prophet::DatabaseSetting;
use Any::Moose;
extends 'Prophet::Record';
use Params::Validate;
use JSON;
has default => (
is => 'ro',
);
has label => (
isa => 'Str|Undef',
is => 'rw',
);
has '+type' => ( default => '__prophet_db_settings' );
sub BUILD {
my $self = shift;
$self->initialize
unless ($self->handle->record_exists(uuid => $self->uuid, type => $self->type) );
}
sub initialize {
my $self = shift;
$self->set($self->default);
}
sub set {
my $self = shift;
my $entry;
if (exists $_[1] || !ref($_[0])) {
$entry = [@_];
} else {
$entry = shift @_;
}
my $content = to_json($entry, {
canonical => 1,
pretty => 0,
utf8 => 1,
allow_nonref => 0,
});
my %props = (
content => $content,
label => $self->label,
);
if ($self->handle->record_exists( uuid => $self->uuid, type => $self->type)) {
$self->set_props(props => \%props);
}
else {
$self->_create_record(
uuid => $self->uuid,
props => \%props,
);
}
}
sub get_raw {
my $self = shift;
my $content = $self->prop('content');
return $content;
}
sub get {
my $self = shift;
$self->initialize() unless $self->load(uuid => $self->uuid);
my $content = $self->get_raw;
my $entry = from_json($content, { utf8 => 1 });
return $entry;
}
__PACKAGE__->meta->make_immutable;
no Any::Moose;
1;
|