line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
8
|
|
|
8
|
|
188
|
use 5.010001; |
|
8
|
|
|
|
|
32
|
|
2
|
8
|
|
|
8
|
|
57
|
use strict; |
|
8
|
|
|
|
|
24
|
|
|
8
|
|
|
|
|
249
|
|
3
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
392
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Type::Params::Signature 1.016008 (); |
7
|
8
|
|
|
8
|
|
4024
|
use Types::Standard qw( Slurpy ); |
|
8
|
|
|
|
|
378621
|
|
|
8
|
|
|
|
|
270
|
|
8
|
8
|
|
|
8
|
|
77
|
use Scalar::Util (); |
|
8
|
|
|
|
|
27
|
|
|
8
|
|
|
|
|
53
|
|
9
|
8
|
|
|
8
|
|
11974
|
|
|
8
|
|
|
|
|
24
|
|
|
8
|
|
|
|
|
3643
|
|
10
|
|
|
|
|
|
|
our @ISA = 'Type::Params::Signature'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $self = shift; |
13
|
|
|
|
|
|
|
|
14
|
10
|
|
|
10
|
0
|
3550
|
Scalar::Util::weaken( $self->{mite_signature} ); |
15
|
|
|
|
|
|
|
|
16
|
10
|
|
|
|
|
61
|
# This is not a Mite class, so manually call |
17
|
|
|
|
|
|
|
# parent BUILD: |
18
|
|
|
|
|
|
|
$self->SUPER::BUILD( @_ ); |
19
|
|
|
|
|
|
|
} |
20
|
10
|
|
|
|
|
59
|
|
21
|
|
|
|
|
|
|
my ( $self, %args ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $croaker = $self->{mite_signature}->class->_function_for_croak; |
24
|
19
|
|
|
19
|
|
3304
|
|
25
|
|
|
|
|
|
|
return sprintf '%s( "Failure in signature for %s: " . %s )', $croaker, $self->subname, $args{message}; |
26
|
19
|
|
|
|
|
79
|
} |
27
|
|
|
|
|
|
|
|
28
|
19
|
|
|
|
|
54
|
my ( $self, %args ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $type = $args{constraint}; |
31
|
|
|
|
|
|
|
if ( $type->parent and $type->parent->{uniq} == Slurpy->{uniq} ) { |
32
|
28
|
|
|
28
|
|
9236
|
$type = $type->type_parameter || $type; |
33
|
|
|
|
|
|
|
} |
34
|
28
|
|
|
|
|
63
|
|
35
|
28
|
50
|
33
|
|
|
119
|
my $croaker = $self->{mite_signature}->class->_function_for_croak; |
36
|
0
|
|
0
|
|
|
0
|
|
37
|
|
|
|
|
|
|
return sprintf '%s( "Type check failed in signature for %s: %%s should be %%s", %s, %s )', |
38
|
|
|
|
|
|
|
$croaker, $self->subname, B::perlstring( $args{display_var} || $args{varname} ), B::perlstring( $type->display_name ); |
39
|
28
|
|
|
|
|
881
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my ( $self, %args ) = @_; |
42
|
28
|
|
33
|
|
|
82
|
|
43
|
|
|
|
|
|
|
my $msg; |
44
|
|
|
|
|
|
|
my $min = $args{minimum}; |
45
|
|
|
|
|
|
|
my $max = $args{minimum}; |
46
|
10
|
|
|
10
|
|
5049
|
|
47
|
|
|
|
|
|
|
if ( defined $min and defined $max and $min==$max ) { |
48
|
10
|
|
|
|
|
26
|
$msg = sprintf 'expected exactly %d parameters', $min; |
49
|
10
|
|
|
|
|
26
|
} |
50
|
10
|
|
|
|
|
20
|
elsif ( defined $max ) { |
51
|
|
|
|
|
|
|
$msg = sprintf 'expected between %d and %d parameters', $min || 0, $max; |
52
|
10
|
100
|
66
|
|
|
96
|
} |
|
|
50
|
66
|
|
|
|
|
|
|
50
|
|
|
|
|
|
53
|
4
|
|
|
|
|
21
|
elsif ( defined $min ) { |
54
|
|
|
|
|
|
|
$msg = sprintf 'expected at least %d parameters', $min; |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
0
|
|
|
0
|
else { |
57
|
|
|
|
|
|
|
$msg = 'that does not seem right'; |
58
|
|
|
|
|
|
|
} |
59
|
0
|
|
|
|
|
0
|
|
60
|
|
|
|
|
|
|
my $croaker = $self->{mite_signature}->class->_function_for_croak; |
61
|
|
|
|
|
|
|
|
62
|
6
|
|
|
|
|
11
|
if ( $args{got} ) { |
63
|
|
|
|
|
|
|
return sprintf '%s( "Wrong number of parameters in signature for %%s: got %%d, %%s", %s, %s, %s )', |
64
|
|
|
|
|
|
|
$croaker, B::perlstring( $self->subname ), $args{got}, B::perlstring( $msg ); |
65
|
10
|
|
|
|
|
90
|
} |
66
|
|
|
|
|
|
|
else { |
67
|
10
|
50
|
|
|
|
59
|
return sprintf '%s( "Wrong number of parameters in signature for %%s: got ???, %%s", %s, %s )', |
68
|
|
|
|
|
|
|
$croaker, B::perlstring( $self->subname ), B::perlstring( $msg ); |
69
|
10
|
|
|
|
|
51
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |