| 1 | package Valiemon::Attributes::Not; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use parent qw(Valiemon::Attributes); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use List::MoreUtils qw(all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 12 | ▶ | sub attr_name { 'not' } | ||||||||
|
Subroutine
attr_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 11 | |||||||||||
| 12 | sub is_valid { | ||||||||||
| 13 | 12 | ▶ | my ($class, $context, $schema, $data) = @_; | ||||||||
|
Subroutine
is_valid: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 14 | $context->in_attr($class, sub { | ||||||||||
| 15 | 12 | ▶ | my $not = $schema->{not}; | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 16 | 12 | ▶ | unless (ref $not eq 'HASH') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 1 | croak sprintf '`not` must be an object at %s', $context->position | |||||||||
| 18 | } | ||||||||||
| 19 | 11 | my $sub_v = $context->sub_validator($not); | |||||||||
| 20 | 11 | my $res = $sub_v->validate($data); | |||||||||
| 21 | 11 | return !$res; | |||||||||
| 22 | 12 | }); | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 2 | 1; | |||||||||