| 1 | package Validator::LIVR::Rules::Collection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Validator::LIVR::Rules::Types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | our $VERSION = '2.22'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # LIVR 2.5: rules for hashes and lists. The builders of values, keys and split are livr_values, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # livr_keys and livr_split, as Perl has functions with these names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # The fields next to a value of "values" or a key of "keys": none. They have no containing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # object, so equal_to_field and the references of required_if and when see a missing value there | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | my $NO_FIELDS = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 54 | ▶ | sub livr_values { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
livr_values: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 54 | my ( $rules, $rule_builders ) = _rules_argument( 'values', @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 47 | my $value_rule = Validator::LIVR->_new_with_rules( { field => $rules }, $rule_builders )->_field_rule('field'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 40 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 40 | my ( $object, undef, $output_ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 40 | ▶ | return if !defined($object) || $object eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $object or $object eq ""
MC/DC100%2/2
not defined $object or $object eq ""
not defined $object
$object eq ""
Truth table100%3/3
not(A) or B
A= not defined $objectB= $object eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 30 | ▶ | return 'FORMAT_ERROR' if ref($object) ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 25 | my ( %result, %errors ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 25 | foreach my $key ( keys %$object ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 48 | my $value = $object->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 48 | my $output = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 48 | ▶ | if ( my $err_code = $value_rule->( $value, $NO_FIELDS, \$output ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 15 | $errors{$key} = $err_code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 33 | $result{$key} = $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 25 | ▶ | return \%errors if %errors; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 15 | $$output_ref = \%result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 15 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 46 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 32 | ▶ | sub livr_keys { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
livr_keys: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 32 | my ( $rules, $rule_builders ) = _rules_argument( 'keys', @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # Keys are checked as they are, without auto trim | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 26 | my $key_rule = Validator::LIVR->_new_with_rules( { field => $rules }, $rule_builders, 0 )->_field_rule('field'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 25 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 25 | my $object = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 25 | ▶ | return if !defined($object) || $object eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $object or $object eq ""
MC/DC100%2/2
not defined $object or $object eq ""
not defined $object
$object eq ""
Truth table100%3/3
not(A) or B
A= not defined $objectB= $object eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 20 | ▶ | return 'FORMAT_ERROR' if ref($object) ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # The rules only check: their output is ignored and the hash stays unchanged | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 16 | my %errors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 16 | foreach my $key ( keys %$object ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 27 | my $output = $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 27 | ▶ | $errors{$key} = 'WRONG_KEY' if $key_rule->( $key, $NO_FIELDS, \$output ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 16 | ▶ | return \%errors if %errors; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 25 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # The arguments of values and keys are the same as in list_of: values('string'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # values('required', 'string') or values(['required', 'string']) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 86 | ▶ | sub _rules_argument { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_rules_argument: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 86 | my ( $rule_name, @args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 86 | my $rule_builders = pop @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 86 | ▶ | my $rules = @args == 1 && ref( $args[0] ) eq 'ARRAY' ? $args[0] : \@args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args == 1 and ref $args[0] eq "ARRAY"
MC/DC100%2/2
@args == 1 and ref $args[0] eq "ARRAY"
@args == 1
ref $args[0] eq "ARRAY"
Truth table100%3/3
A and B
A= @args == 1B= ref $args[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 86 | ▶ | die "Rule [$rule_name] needs rules\n" if !@$rules; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # { values => undef }: null in place of rules, not in a list of rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 80 | ▶ | Validator::LIVR::Rules::Types::check_rule_set( $rule_name, @args == 1 && !defined( $args[0] ) ? undef : $rules ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args == 1 and not defined $args[0]
MC/DC100%2/2
@args == 1 and not defined $args[0]
@args == 1
not defined $args[0]
Truth table100%3/3
A and not(B)
A= @args == 1B= not defined $args[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 73 | return ( $rules, $rule_builders ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # list_length($length), list_length($min, $max), list_length({ min => $min, max => $max }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 59 | ▶ | sub list_length { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_length: called CC=19 SCAR=29.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 59 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 59 | pop @args; # rule_builders | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 59 | my ( $min, $max ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | # Arguments after the options object, or after "max", are ignored | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 59 | ▶ | if ( @args && ref( $args[0] ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
@args and ref $args[0] eq "HASH"
MC/DC100%2/2
@args and ref $args[0] eq "HASH"
@args
ref $args[0] eq "HASH"
Truth table100%3/3
A and B
A= @argsB= ref $args[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 15 | my $options = $args[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 15 | foreach my $name ( sort keys %$options ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 18 | ▶ | die qq{Rule [list_length] got an unknown option "$name"\n} if $name ne 'min' && $name ne 'max'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$name ne "min" and $name ne "max"
MC/DC100%2/2
$name ne "min" and $name ne "max"
$name ne "min"
$name ne "max"
Truth table100%3/3
A and B
A= $name ne "min"B= $name ne "max"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 14 | ▶ | die qq{Rule [list_length] takes "min", "max" or both\n} if !%$options; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 13 | ▶ | ( $min, $max ) = ( $options->{min} // 0, $options->{max} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$options->{"min"} // 0
MC/DC100%1/1
$options->{"min"} // 0
$options->{"min"}
Truth table100%2/2
A
A= $options->{"min"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 13 | ▶ | if ( ( exists $options->{min} && !_is_length( $options->{min} ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
exists $options->{"min"} and not _is_length($options->{"min"}) or exists $options->{"max"} and not _is_length($options->{"max"})
exists $options->{"min"} and not _is_length($options->{"min"})
exists $options->{"max"} and not _is_length($options->{"max"})
MC/DC75%3/4
exists $options->{"min"} and not _is_length($options->{"min"}) or exists $options->{"max"} and not _is_length($options->{"max"})
exists $options->{"min"}
not _is_length($options->{"min"})
exists $options->{"max"}
not _is_length($options->{"max"})
Truth table71%5/7
A and not(B) or C and not(D)
A= exists $options->{"min"}B= not _is_length($options->{"min"})C= exists $options->{"max"}D= not _is_length($options->{"max"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | || ( exists $options->{max} && !_is_length( $options->{max} ) ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | die qq{Rule [list_length] takes non-negative integers as "min" and "max"\n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ▶ | } elsif ( @args == 1 && _is_length( $args[0] ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@args == 1 and _is_length($args[0])
MC/DC100%2/2
@args == 1 and _is_length($args[0])
@args == 1
_is_length($args[0])
Truth table100%3/3
A and B
A= @args == 1B= _is_length($args[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 19 | $min = $max = $args[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | ▶ | } elsif ( @args >= 2 && _is_length( $args[0] ) && _is_length( $args[1] ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
@args >= 2 and _is_length($args[0]) and _is_length($args[1])
@args >= 2 and _is_length($args[0])
MC/DC66%2/3
@args >= 2 and _is_length($args[0]) and _is_length($args[1])
@args >= 2
_is_length($args[0])
_is_length($args[1])
Truth table75%3/4
A and B and C
A= @args >= 2B= _is_length($args[0])C= _is_length($args[1])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 19 | ( $min, $max ) = @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 6 | die qq{Rule [list_length] takes a length, a minimum and a maximum, or an object with "min" and "max"\n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 49 | ▶ | die qq{Rule [list_length] got "min" greater than "max"\n} if defined($max) && $min > $max; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $max and $min > $max
MC/DC100%2/2
defined $max and $min > $max
defined $max
$min > $max
Truth table100%3/3
A and B
A= defined $maxB= $min > $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 50 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 50 | my $list = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | # An empty list is a value: { min => 1 } rejects it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 50 | ▶ | return if !defined($list) || $list eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $list or $list eq ""
MC/DC100%2/2
not defined $list or $list eq ""
not defined $list
$list eq ""
Truth table100%3/3
not(A) or B
A= not defined $listB= $list eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 45 | ▶ | return 'FORMAT_ERROR' if ref($list) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 39 | ▶ | return 'TOO_FEW_ITEMS' if @$list < $min; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 30 | ▶ | return 'TOO_MANY_ITEMS' if defined($max) && @$list > $max; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $max and @$list > $max
MC/DC100%2/2
defined $max and @$list > $max
defined $max
@$list > $max
Truth table100%3/3
A and B
A= defined $maxB= @$list > $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 22 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 47 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 79 | ▶ | sub _is_length { Validator::LIVR::Rules::Types::is_length(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_length: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # unique(): primitive items, unique(@keys): hashes with unique values of the keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 62 | ▶ | sub unique { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unique: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 62 | my @keys = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 62 | pop @keys; # rule_builders | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 62 | ▶ | die "Rule [unique] takes key names as strings\n" if grep { !defined($_) || ref($_) } @keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
!defined($_) || ref $_
MC/DC50%1/2
!defined($_) || ref $_
!defined($_)
ref $_
Truth table66%2/3
not(A) || B
A= !defined($_)B= ref $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # Items are compared by their string forms, so 1 and "1" are duplicates. A wrong item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # is FORMAT_ERROR, wherever it is in the list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 60 | ▶ | if ( !@keys ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 31 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 31 | my $list = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 31 | ▶ | return if !defined($list) || $list eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $list or $list eq ""
MC/DC100%2/2
not defined $list or $list eq ""
not defined $list
$list eq ""
Truth table100%3/3
not(A) or B
A= not defined $listB= $list eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 26 | ▶ | return 'FORMAT_ERROR' if ref($list) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 23 | my ( %is_seen, $has_duplicates ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 23 | foreach my $item (@$list) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 59 | ▶ | next if !defined($item) || $item eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $item or $item eq ""
MC/DC100%2/2
not defined $item or $item eq ""
not defined $item
$item eq ""
Truth table100%3/3
not(A) or B
A= not defined $itemB= $item eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 54 | my $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 54 | ▶ | if ( ref($item) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 6 | ▶ | return 'FORMAT_ERROR' if ref($item) !~ /Boolean/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 2 | ▶ | $string = $item ? 'true' : 'false'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 48 | $string = Validator::LIVR::Rules::Types::string_form($item); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 50 | ▶ | $has_duplicates = 1 if $is_seen{$string}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 19 | ▶ | return 'NOT_UNIQUE_ITEMS' if $has_duplicates; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 31 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 29 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=17 SCAR=28.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 29 | my $list = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 29 | ▶ | return if !defined($list) || $list eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $list or $list eq ""
MC/DC0%0/2
not defined $list or $list eq ""
not defined $list
$list eq ""
Truth table33%1/3
not(A) or B
A= not defined $listB= $list eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 29 | ▶ | return 'FORMAT_ERROR' if ref($list) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 27 | my ( %is_seen, $has_duplicates ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 27 | ITEM: foreach my $item (@$list) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 62 | ▶ | next if !defined($item) || $item eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $item or $item eq ""
MC/DC100%2/2
not defined $item or $item eq ""
not defined $item
$item eq ""
Truth table100%3/3
not(A) or B
A= not defined $itemB= $item eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 58 | ▶ | return 'FORMAT_ERROR' if ref($item) ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # An item with an empty key value is not compared, a key value of a wrong type is an error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | # The string forms with their lengths, so ["a,b"] and ["a", "b"] differ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 55 | my ( $id, $has_empty_value ) = (''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 55 | foreach my $key (@keys) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 83 | my $value = $item->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 83 | ▶ | if ( !defined($value) || $value eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $value or $value eq ""
MC/DC100%2/2
not defined $value or $value eq ""
not defined $value
$value eq ""
Truth table100%3/3
not(A) or B
A= not defined $valueB= $value eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 11 | $has_empty_value = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 11 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 72 | my $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 72 | ▶ | if ( ref($value) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 10 | ▶ | return 'FORMAT_ERROR' if ref($value) !~ /Boolean/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | ▶ | $string = $value ? 'true' : 'false'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 62 | $string = Validator::LIVR::Rules::Types::string_form($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 64 | $id .= length($string) . ':' . $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 47 | ▶ | next ITEM if $has_empty_value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 37 | ▶ | $has_duplicates = 1 if $is_seen{$id}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 16 | ▶ | return 'NOT_UNIQUE_ITEMS' if $has_duplicates; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 13 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 29 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 48 | ▶ | sub livr_split { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
livr_split: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 48 | my ($separator) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # Arguments after the separator are ignored. The last one is the rule builders | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 48 | ▶ | if ( @_ < 2 || !defined($separator) || ref($separator) || $separator eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
@_ < 2 or not defined $separator or ref $separator or $separator eq ""
@_ < 2 or not defined $separator or ref $separator
@_ < 2 or not defined $separator
MC/DC100%4/4
@_ < 2 or not defined $separator or ref $separator or $separator eq ""
@_ < 2
not defined $separator
ref $separator
$separator eq ""
Truth table100%5/5
A or not(B) or C or D
A= @_ < 2B= not defined $separatorC= ref $separatorD= $separator eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 5 | die "Rule [split] takes a non-empty separator string\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | # A number is its string form | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 43 | $separator = Validator::LIVR::Rules::Types::string_form($separator); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 43 | my $separator_re = qr/\Q$separator\E/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # A modifier: lists, empty values and hashes stay as they are, the next rule reports them. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # Numbers and booleans are split in their string form, like strings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 44 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 44 | my ( $value, undef, $output_ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 44 | ▶ | return if !defined($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 40 | my $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 40 | ▶ | if ( ref($value) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 10 | ▶ | return if ref($value) !~ /Boolean/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 2 | ▶ | $string = $value ? 'true' : 'false'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 30 | ▶ | return if $value eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 28 | $string = Validator::LIVR::Rules::Types::string_form($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | # At every separator, empty parts are kept: "a,,b" is [ "a", "", "b" ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 30 | ▶ | $$output_ref = index( $string, $separator ) < 0 ? [$string] : [ split $separator_re, $string, -1 ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 30 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | Validator::LIVR::Rules::Collection - LIVR 2.5 rules of Validator::LIVR for hashes and lists: values, keys, list_length, unique and split | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | This module has the code of these rules, which are documented in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | L<Validator::LIVR/LIVR 2.5 rules>. Validator::LIVR loads it when a validator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | uses one of the rules. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | Each sub is the builder of the rule with the same name. The builders of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | C<values>, C<keys> and C<split> are C<livr_values>, C<livr_keys> and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | C<livr_split>, as Perl has functions with these names. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||