line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Params::Validate::Exception::ValidationFailedForTypeConstraint; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
63
|
use strict; |
|
14
|
|
|
|
|
18
|
|
|
14
|
|
|
|
|
554
|
|
4
|
14
|
|
|
14
|
|
58
|
use warnings; |
|
14
|
|
|
|
|
15
|
|
|
14
|
|
|
|
|
524
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.21'; |
7
|
|
|
|
|
|
|
|
8
|
14
|
|
|
14
|
|
52
|
use Moose; |
|
14
|
|
|
|
|
17
|
|
|
14
|
|
|
|
|
70
|
|
9
|
14
|
|
|
14
|
|
73698
|
use Moose::Util::TypeConstraints qw( duck_type ); |
|
14
|
|
|
|
|
24
|
|
|
14
|
|
|
|
|
92
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'Moose::Exception'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has parameter => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
isa => 'Str', |
16
|
|
|
|
|
|
|
required => 1, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has value => ( |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => 'Any', |
22
|
|
|
|
|
|
|
required => 1, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has type => ( |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
isa => duck_type( [qw( get_message name )] ), |
28
|
|
|
|
|
|
|
required => 1, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _build_message { |
32
|
68
|
|
|
68
|
|
6215
|
my $self = shift; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return |
35
|
68
|
|
|
|
|
2725
|
$self->parameter |
36
|
|
|
|
|
|
|
. ' does not pass the type constraint because: ' |
37
|
|
|
|
|
|
|
. $self->type()->get_message( $self->value() ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
14
|
|
|
14
|
|
5726
|
no Moose; |
|
14
|
|
|
|
|
21
|
|
|
14
|
|
|
|
|
66
|
|
41
|
14
|
|
|
14
|
|
2326
|
no Moose::Util::TypeConstraints; |
|
14
|
|
|
|
|
16
|
|
|
14
|
|
|
|
|
57
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# ABSTRACT: Exception thrown when a type constraint check fails |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
MooseX::Params::Validate::Exception::ValidationFailedForTypeConstraint - Exception thrown when a type constraint check fails |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 VERSION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
version 0.21 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SYNOPSIS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
use MooseX::Params::Validate qw( validated_list ); |
64
|
|
|
|
|
|
|
use Scalar::Util qw( blessed ); |
65
|
|
|
|
|
|
|
use Try::Tiny; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
try { |
68
|
|
|
|
|
|
|
my @p = validated_list( @_, foo => { isa => 'Str' } ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
catch { |
71
|
|
|
|
|
|
|
if ( |
72
|
|
|
|
|
|
|
blessed $_ |
73
|
|
|
|
|
|
|
&& $_->isa( |
74
|
|
|
|
|
|
|
'MooseX::Params::Validate::Exception::ValidationFailedForTypeConstraint' |
75
|
|
|
|
|
|
|
) |
76
|
|
|
|
|
|
|
) { |
77
|
|
|
|
|
|
|
...; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
}; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DESCRIPTION |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This class provides information about type constraint failures. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 METHODS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This class provides the following methods: |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 $e->parameter() |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This returns a string describing the parameter, something like C<The 'foo' |
92
|
|
|
|
|
|
|
parameter> or C<Parameter #1>. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 $e->value() |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This is the value that failed the type constraint check. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 $e->type() |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is the type constraint object that did not accept the value. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 STRINGIFICATION |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This object stringifies to a reasonable error message. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHORS |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=over 4 |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item * |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Stevan Little <stevan@cpan.org> |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item * |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=back |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This software is copyright (c) 2013 - 2015 by Stevan Little <stevan@cpan.org>. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
125
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |