Commit | Line | Data |
3fea05b9 |
1 | package Perl6::Junction::None; |
2 | use strict; |
3 | our $VERSION = '1.40000'; |
4 | |
5 | use base 'Perl6::Junction::Base'; |
6 | |
7 | sub num_eq { |
8 | return regex_eq(@_) if ref( $_[1] ) eq 'Regexp'; |
9 | |
10 | my ( $self, $test ) = @_; |
11 | |
12 | for (@$self) { |
13 | return if $_ == $test; |
14 | } |
15 | |
16 | return 1; |
17 | } |
18 | |
19 | sub num_ne { |
20 | return regex_ne(@_) if ref( $_[1] ) eq 'Regexp'; |
21 | |
22 | my ( $self, $test ) = @_; |
23 | |
24 | for (@$self) { |
25 | return if $_ != $test; |
26 | } |
27 | |
28 | return 1; |
29 | } |
30 | |
31 | sub num_ge { |
32 | my ( $self, $test, $switch ) = @_; |
33 | |
34 | return num_le( $self, $test ) if $switch; |
35 | |
36 | for (@$self) { |
37 | return if $_ >= $test; |
38 | } |
39 | |
40 | return 1; |
41 | } |
42 | |
43 | sub num_gt { |
44 | my ( $self, $test, $switch ) = @_; |
45 | |
46 | return num_lt( $self, $test ) if $switch; |
47 | |
48 | for (@$self) { |
49 | return if $_ > $test; |
50 | } |
51 | |
52 | return 1; |
53 | } |
54 | |
55 | sub num_le { |
56 | my ( $self, $test, $switch ) = @_; |
57 | |
58 | return num_ge( $self, $test ) if $switch; |
59 | |
60 | for (@$self) { |
61 | return if $_ <= $test; |
62 | } |
63 | |
64 | return 1; |
65 | } |
66 | |
67 | sub num_lt { |
68 | my ( $self, $test, $switch ) = @_; |
69 | |
70 | return num_gt( $self, $test ) if $switch; |
71 | |
72 | for (@$self) { |
73 | return if $_ < $test; |
74 | } |
75 | |
76 | return 1; |
77 | } |
78 | |
79 | sub str_eq { |
80 | my ( $self, $test ) = @_; |
81 | |
82 | for (@$self) { |
83 | return if $_ eq $test; |
84 | } |
85 | |
86 | return 1; |
87 | } |
88 | |
89 | sub str_ne { |
90 | my ( $self, $test ) = @_; |
91 | |
92 | for (@$self) { |
93 | return if $_ ne $test; |
94 | } |
95 | |
96 | return 1; |
97 | } |
98 | |
99 | sub str_ge { |
100 | my ( $self, $test, $switch ) = @_; |
101 | |
102 | return str_le( $self, $test ) if $switch; |
103 | |
104 | for (@$self) { |
105 | return if $_ ge $test; |
106 | } |
107 | |
108 | return 1; |
109 | } |
110 | |
111 | sub str_gt { |
112 | my ( $self, $test, $switch ) = @_; |
113 | |
114 | return str_lt( $self, $test ) if $switch; |
115 | |
116 | for (@$self) { |
117 | return if $_ gt $test; |
118 | } |
119 | |
120 | return 1; |
121 | } |
122 | |
123 | sub str_le { |
124 | my ( $self, $test, $switch ) = @_; |
125 | |
126 | return str_ge( $self, $test ) if $switch; |
127 | |
128 | for (@$self) { |
129 | return if $_ le $test; |
130 | } |
131 | |
132 | return 1; |
133 | } |
134 | |
135 | sub str_lt { |
136 | my ( $self, $test, $switch ) = @_; |
137 | |
138 | return str_gt( $self, $test ) if $switch; |
139 | |
140 | for (@$self) { |
141 | return if $_ lt $test; |
142 | } |
143 | |
144 | return 1; |
145 | } |
146 | |
147 | sub regex_eq { |
148 | my ( $self, $test, $switch ) = @_; |
149 | |
150 | for (@$self) { |
151 | return if $_ =~ $test; |
152 | } |
153 | |
154 | return 1; |
155 | } |
156 | |
157 | sub regex_ne { |
158 | my ( $self, $test, $switch ) = @_; |
159 | |
160 | for (@$self) { |
161 | return if $_ !~ $test; |
162 | } |
163 | |
164 | return 1; |
165 | } |
166 | |
167 | sub bool { |
168 | my ($self) = @_; |
169 | |
170 | for (@$self) { |
171 | return if $_; |
172 | } |
173 | |
174 | return 1; |
175 | } |
176 | |
177 | 1; |
178 | |