/usr/share/perl5/Validation/Class/Fields.pm is in libvalidation-class-perl 7.900054-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 | # Container Class for Validation::Class::Field Objects
# Validation::Class::Fields is a container class for L<Validation::Class::Field>
# objects and is derived from the L<Validation::Class::Mapping> class.
package Validation::Class::Fields;
use strict;
use warnings;
use Validation::Class::Util '!has';
use Hash::Flatten ();
use Carp;
our $VERSION = '7.900054'; # VERSION
use base 'Validation::Class::Mapping';
use Validation::Class::Mapping;
use Validation::Class::Field;
sub add {
my $self = shift;
my $arguments = $self->build_args(@_);
my @suspects = sort keys %{$arguments};
confess
"Illegal field names detected, possible attempt to define validation " .
"rules for a parameter containing an array of nested structures on " .
"the following fields: " . join ", ", @suspects
if grep /(:.*:|:\d+.)/, @suspects
;
while (my ($key, $value) = each %{$arguments}) {
# never overwrite
unless (defined $self->{$key}) {
if (isa_hashref($value)) {
$value->{name} = $key;
}
$self->{$key} = $value; # accept an object as a value
$self->{$key} = Validation::Class::Field->new($value) unless
"Validation::Class::Field" eq ref $self->{$key}; # unless obj
}
}
return $self;
}
sub AUTOLOAD {
(my $routine = $Validation::Class::Fields::AUTOLOAD) =~ s/.*:://;
my ($self) = @_;
if ($routine) {
if ($self->has($routine)) {
return $self->get($routine);
}
}
croak sprintf q(Can't locate object method "%s" via package "%s"),
$routine, ((ref $_[0] || $_[0]) || 'main')
;
}
sub DESTROY {}
1;
|