Common/Numeric.pm

filter: Statementstmt 67.8% 38 / 56 Branchbran 45.0% 9 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 45.4% 15 / 33 Podpod n/a totaltotal 56.8% 62 / 109 CC 2 SCAR 5.8
CC
2
Cov
62%
__ANON__
6.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.8
« Common/String.pm ↑ Summary Common.pm »
1 package MooseX::Types::Common::Numeric;
2 # ABSTRACT: Commonly used numeric types
3  
4 1 our $VERSION = '0.001015';
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use MooseX::Types -declare => [
Subroutine BEGIN: called CC=1 SCAR=0.0
10 qw(PositiveNum PositiveOrZeroNum
11 PositiveInt PositiveOrZeroInt
12 NegativeNum NegativeOrZeroNum
13 NegativeInt NegativeOrZeroInt
14 SingleDigit)
15 1 ];
16  
17 1 ▶use Moose ();
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use MooseX::Types::Moose qw/Num Int/;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use if MooseX::Types->VERSION >= 0.42, 'namespace::autoclean';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 subtype PositiveNum,
22 as Num,
23 0 ▶ where { $_ > 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 ▶ message { "Must be a positive number" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 ( $Moose::VERSION >= 2.0200
26 1 ▶ ? inline_as {
Subroutine __ANON__: called CC=1 SCAR=0.0
27 1 $_[0]->parent()->_inline_check( $_[1] ) . ' && '
28 . qq{ ($_[1] > 0) };
29 }
30 : ()
31 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$Moose::VERSION >= 2.02 ? : 1 0 1
32  
33 subtype PositiveOrZeroNum,
34 as Num,
35 0 ▶ where { $_ >= 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
36 0 ▶ message { "Must be a number greater than or equal to zero" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
37 ( $Moose::VERSION >= 2.0200
38 1 ▶ ? inline_as {
Subroutine __ANON__: called CC=1 SCAR=0.0
39 1 $_[0]->parent()->_inline_check( $_[1] ) . ' && '
40 . qq{ ($_[1] >= 0) };
41 }
42 : ()
43 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$Moose::VERSION >= 2.02 ? : 1 0 1
44  
45 subtype PositiveInt,
46 as Int,
47 0 ▶ where { $_ > 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
48 0 ▶ message { "Must be a positive integer" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
49 ( $Moose::VERSION >= 2.0200
50 1 ▶ ? inline_as {
Subroutine __ANON__: called CC=1 SCAR=0.0
51 1 $_[0]->parent()->_inline_check( $_[1] ) . ' && '
52 . qq{ ($_[1] > 0) };
53 }
54 : ()
55 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$Moose::VERSION >= 2.02 ? : 1 0 1
56  
57 subtype PositiveOrZeroInt,
58 as Int,
59 0 ▶ where { $_ >= 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ message { "Must be an integer greater than or equal to zero" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 ( $Moose::VERSION >= 2.0200
62 1 ▶ ? inline_as {
Subroutine __ANON__: called CC=1 SCAR=0.0
63 1 $_[0]->parent()->_inline_check( $_[1] ) . ' && '
64 . qq{ ($_[1] >= 0) };
65 }
66 : ()
67 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$Moose::VERSION >= 2.02 ? : 1 0 1
68  
69 subtype NegativeNum,
70 as Num,
71 0 ▶ where { $_ < 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
72 0 ▶ message { "Must be a negative number" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
73 ( $Moose::VERSION >= 2.0200
74 1 ▶ ? inline_as {
Subroutine __ANON__: called CC=1 SCAR=0.0
75 1 $_[0]->parent()->_inline_check( $_[1] ) . ' && '
76 . qq{ ($_[1] < 0) };
77 }
78 : ()
79 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$Moose::VERSION >= 2.02 ? : 1 0 1
80  
81 subtype NegativeOrZeroNum,
82 as Num,
83 0 ▶ where { $_ <= 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
84 0 ▶ message { "Must be a number less than or equal to zero" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
85 ( $Moose::VERSION >= 2.0200
86 1 ▶ ? inline_as {
Subroutine __ANON__: called CC=1 SCAR=0.0
87 1 $_[0]->parent()->_inline_check( $_[1] ) . ' && '
88 . qq{ ($_[1] <= 0) };
89 }
90 : ()
91 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$Moose::VERSION >= 2.02 ? : 1 0 1
92  
93 subtype NegativeInt,
94 as Int,
95 0 ▶ where { $_ < 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
96 0 ▶ message { "Must be a negative integer" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
97 ( $Moose::VERSION >= 2.0200
98 1 ▶ ? inline_as {
Subroutine __ANON__: called CC=1 SCAR=0.0
99 1 $_[0]->parent()->_inline_check( $_[1] ) . ' && '
100 . qq{ ($_[1] < 0) };
101 }
102 : ()
103 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$Moose::VERSION >= 2.02 ? : 1 0 1
104  
105 subtype NegativeOrZeroInt,
106 as Int,
107 0 ▶ where { $_ <= 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
108 0 ▶ message { "Must be an integer less than or equal to zero" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
109 ( $Moose::VERSION >= 2.0200
110 1 ▶ ? inline_as {
Subroutine __ANON__: called CC=1 SCAR=0.0
111 1 $_[0]->parent()->_inline_check( $_[1] ) . ' && '
112 . qq{ ($_[1] <= 0) };
113 }
114 : ()
115 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$Moose::VERSION >= 2.02 ? : 1 0 1
116  
117 subtype SingleDigit,
118 as Int,
119 0 ▶ where { $_ >= -9 and $_ <= 9 },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_ >= -9 and $_ <= 9 0 0 0
120 0 ▶ message { "Must be a single digit" },
Subroutine __ANON__: not called CC=1 SCAR=6.9
121 ( $Moose::VERSION >= 2.0200
122 1 ▶ ? inline_as {
Subroutine __ANON__: called CC=1 SCAR=0.0
123 1 $_[0]->parent()->_inline_check( $_[1] ) . ' && '
124 . qq{ ($_[1] >= -9 and $_[1] <= 9) };
125 }
126 : ()
127 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$Moose::VERSION >= 2.02 ? : 1 0 1
128  
129 1 1;
130  
131 __END__
« Common/String.pm ↑ Summary Common.pm »