/usr/share/perl5/Prophet/ConflictingChange.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 85 | package Prophet::ConflictingChange;
use Any::Moose;
use Prophet::Meta::Types;
use Prophet::ConflictingPropChange;
use JSON 'to_json';
use Digest::SHA 'sha1_hex';
has record_type => (
is => 'rw',
isa => 'Str',
);
has record_uuid => (
is => 'rw',
isa => 'Str',
);
has source_record_exists => (
is => 'rw',
isa => 'Bool',
);
has target_record_exists => (
is => 'rw',
isa => 'Bool',
);
has change_type => (
is => 'rw',
isa => 'Prophet::Type::ChangeType',
);
has file_op_conflict => (
is => 'rw',
isa => 'Prophet::Type::FileOpConflict',
);
has prop_conflicts => (
is => 'rw',
isa => 'ArrayRef',
default => sub { [] },
);
sub has_prop_conflicts { scalar @{ $_[0]->prop_conflicts } }
sub add_prop_conflict {
my $self = shift;
push @{ $self->prop_conflicts }, @_;
}
sub as_hash {
my $self = shift;
my $struct = {
map { $_ => $self->$_() } (
qw/record_type record_uuid source_record_exists target_record_exists change_type file_op_conflict/
)
};
for ( @{ $self->prop_conflicts } ) {
push @{ $struct->{'prop_conflicts'} }, $_->as_hash;
}
return $struct;
}
=head2 fingerprint
Returns a fingerprint of the content of this conflicting change
=cut
sub fingerprint {
my $self = shift;
my $struct = $self->as_hash;
for ( @{ $struct->{prop_conflicts} } ) {
$_->{choices} = [ sort grep { defined} ( delete $_->{source_new_value}, delete $_->{target_value} ) ];
}
return sha1_hex(to_json($struct, {utf8 => 1, canonical => 1}));
}
__PACKAGE__->meta->make_immutable;
no Any::Moose;
1;
|