VersionRange.pm

filter: Statementstmt 99.3% 160 / 161 Branchbran 84.8% 56 / 66 Conditioncond 85.1% 23 / 27 MC/DCmcdc 62.5% 10 / 16 Subroutinesub 100% 38 / 38 Podpod 100% 13 / 13 totaltotal 93.4% 300 / 321 CC 47 SCAR 21.9
CC
47
Cov
94%
contains
23.4
constraint_contains
9.2
new
6.0
CRAP 8.9
« PackageURL/Util.pm ↑ Summary VersionRange/Constraint.pm »
1 package URI::VersionRange;
2  
3 15 ▶use feature ':5.10';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 15 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use List::Util qw(first);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 15 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 15 ▶use URI::VersionRange::Constraint;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 15 ▶use URI::VersionRange::Util qw(native_range_to_vers);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 15 ▶use URI::VersionRange::Version;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 15 ▶use constant DEBUG => $ENV{VERS_DEBUG};
Subroutine BEGIN: called CC=1 SCAR=0.0
17 15 ▶use constant TRUE => !!1;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 15 ▶use constant FALSE => !!0;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 15 ▶use overload '""' => 'to_string', fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 15 ▶BEGIN { *VERS:: = *URI::VersionRange:: }
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 15 our $VERSION = '2.26';
25 15 our @EXPORT = qw(encode_vers decode_vers is_vers);
26  
27 15 my $VERS_SCHEME_REGEXP = qr{[a-z][a-z0-9\.\-]*};
28 15 my $VERS_REGEXP = qr{^vers:$VERS_SCHEME_REGEXP/.+};
29  
30 2615 ▶sub is_vers { ($_[0] =~ /$VERS_REGEXP/) ? 1 : undef }
Subroutine is_vers: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0] =~ /$VERS_REGEXP/ ? : 2610 5 2615
31  
32 4372 ▶sub new {
Subroutine new: called CC=6 SCAR=18.0
Pod documented
33  
34 4372 my ($class, %params) = @_;
35  
36 4372 ▶ my $scheme = delete $params{scheme} or Carp::croak "Invalid Version Range: 'scheme' is required";
Branch: 1 branch
BranchTrueFalseTotal
my $scheme = delete $params{"scheme"} or Carp::croak("Invalid Version Range: 'scheme' is required") 4372 0 4372
37 4372 ▶ my $constraints = delete $params{constraints} or Carp::croak "Invalid Version Range: 'constraints' is required";
Branch: 1 branch
BranchTrueFalseTotal
my $constraints = delete $params{"constraints"} or Carp::croak("Invalid Version Range: 'constraints' is required") 4372 0 4372
38  
39 4372 my @constraints = ();
40  
41 4372 foreach my $constraint (@{$constraints}) {
42  
43 8295 ▶ if (ref($constraint) ne 'URI::VersionRange::Constraint') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $constraint ne "URI::VersionRange::Constraint") 3551 4744 8295
44 3551 $constraint = URI::VersionRange::Constraint->from_string($constraint);
45 }
46  
47 8295 push @constraints, $constraint;
48  
49 }
50  
51 4372 $scheme = lc $scheme;
52  
53 4372 ▶ Carp::croak "Invalid Version Range: invalid scheme '$scheme'" unless $scheme =~ /\A$VERS_SCHEME_REGEXP\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $scheme =~ /\A$VERS_SCHEME_REGEXP\z/ 1 4371 4372
54  
55 4371 my $scheme_class = URI::VersionRange::Version->load($scheme);
56  
57 4371 my $self = {scheme => $scheme, constraints => \@constraints, scheme_class => $scheme_class};
58  
59 4371 return bless $self, $class;
60  
61 }
62  
63 5150 ▶sub scheme { shift->{scheme} }
Subroutine scheme: called CC=1 SCAR=0.0
Pod documented
64 6987 ▶sub constraints { shift->{constraints} }
Subroutine constraints: called CC=1 SCAR=0.0
Pod documented
65  
66 1 ▶sub encode_vers { __PACKAGE__->new(@_)->to_string }
Subroutine encode_vers: called CC=1 SCAR=0.0
Pod documented
67 33 ▶sub decode_vers { __PACKAGE__->from_string(shift) }
Subroutine decode_vers: called CC=1 SCAR=0.0
Pod documented
68  
69 740 ▶sub from_native {
Subroutine from_native: called CC=5 SCAR=16.1
Pod documented
70  
71 740 my ($class, %params) = @_;
72  
73 740 ▶ my $scheme = delete $params{scheme} or Carp::croak "Invalid Version Range: 'scheme' is required";
Branch: 1 branch
BranchTrueFalseTotal
my $scheme = delete $params{"scheme"} or Carp::croak("Invalid Version Range: 'scheme' is required") 740 0 740
74 740 ▶ my $range = delete $params{range} or Carp::croak "Invalid Version Range: 'range' is required";
Branch: 1 branch
BranchTrueFalseTotal
my $range = delete $params{"range"} or Carp::croak("Invalid Version Range: 'range' is required") 739 1 740
75  
76 739 $scheme = lc $scheme;
77  
78 739 ▶ Carp::croak "Invalid Version Range: invalid scheme '$scheme'" unless $scheme =~ /\A$VERS_SCHEME_REGEXP\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $scheme =~ /\A$VERS_SCHEME_REGEXP\z/ 1 738 739
79  
80 738 my $version_class = URI::VersionRange::Version->load($scheme);
81  
82 738 ▶ my $vers
Branch: 1 branch
BranchTrueFalseTotal
$version_class->can('from_native') ? : 1 737 738
83 = $version_class->can('from_native')
84 ? $version_class->from_native($range, $scheme)
85 : native_range_to_vers($scheme, $range);
86  
87 737 return $class->from_string($vers);
88  
89 }
90  
91 2609 ▶sub from_string {
Subroutine from_string: called CC=5 SCAR=16.1
Pod documented
92  
93 2609 my ($class, $string) = @_;
94  
95 2609 utf8::encode($string);
96  
97 2609 ▶ unless (is_vers($string)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (is_vers($string)) 2 2607 2609
98 2 Carp::croak 'Malformed Version Range string';
99 }
100  
101 2607 ▶ if ($string =~ /^vers\:(none|all)\// && $string !~ /^vers\:(none|all)\/\*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ m[^vers\:(none|all)/] and not $string =~ m[^vers\:(none|all)/\*$]) 2 2605 2607
Condition100%3/3
$string =~ m[^vers\:(none|all)/] and not $string =~ m[^vers\:(none|all)/\*$]
!ll&&!rl&&r
259962
MC/DC100%2/2
$string =~ m[^vers\:(none|all)/] and not $string =~ m[^vers\:(none|all)/\*$]
$string =~ m[^vers\:(none|all)/] not $string =~ m[^vers\:(none|all)/\*$]
Truth table100%3/3
A and not(B)
A= $string =~ m[^vers\:(none|all)/]B= not $string =~ m[^vers\:(none|all)/\*$]
ABresult
0X0
100
111
102 2 Carp::croak 'Malformed Version Range string';
103 }
104  
105 2605 my %params = ();
106  
107 # - Remove all spaces and tabs.
108 # - Start from left, and split once on colon ":".
109 # - The left hand side is the URI-scheme that must be lowercase.
110 # Tools must validate that the URI-scheme value is vers.
111 # - The right hand side is the specifier.
112  
113 2605 $string =~ s/(\n|\t)+//g;
114  
115 2605 my @s1 = split(':', $string, 2);
116  
117 # - Split the specifier from left once on a slash "/".
118 # - The left hand side is the <versioning-scheme> that must be lowercase. Tools
119 # should validate that the <versioning-scheme> is a known scheme.
120 # - The right hand side is a list of one or more constraints. Tools must validate
121 # that this constraints string is not empty ignoring spaces.
122  
123 2605 my @s2 = split('/', $s1[1]);
124 2605 $params{scheme} = lc $s2[0];
125  
126 # - If the constraints string is equal to "", the ``<version-constraint>``
127 # is "". Parsing is done and no further processing is needed for this vers.
128 # A tool should report an error if there are extra characters beyond "*".
129 # - Strip leading and trailing pipes "|" from the constraints string.
130 # - Split the constraints on pipe "|". The result is a list of <version-constraint>.
131 # Consecutive pipes must be treated as one and leading and trailing pipes ignored.
132  
133 2605 $s2[1] =~ s/(^\|)|(\|$)//g;
134  
135 2605 my @s3 = split(/\|/, $s2[1]);
136 2605 $params{constraints} = [];
137  
138 # - For each <version-constraint>:
139 # - Determine if the <version-constraint> starts with one of the two comparators:
140 # - If it starts with ">=", then the comparator is ">=".
141 # - If it starts with "<=", then the comparator is "<=".
142 # - If it starts with "!=", then the comparator is "!=".
143 # - If it starts with "<", then the comparator is "<".
144 # - If it starts with ">", then the comparator is ">".
145 # - Remove the comparator from <version-constraint> string start. The remaining string is the version.
146 # - Otherwise the version is the full <version-constraint> string (which implies an equality comparator of "=")
147 # - Tools should validate and report an error if the version is empty.
148 # - If the version contains a percent "%" character, apply URL quoting rules to unquote this string.
149 # - Append the parsed (comparator, version) to the constraints list.
150  
151 2605 foreach (@s3) {
152 4749 push @{$params{constraints}}, URI::VersionRange::Constraint->from_string($_);
153 }
154  
155 2592 if (DEBUG) {
156 say STDERR "-- S1: @s1";
157 say STDERR "-- S2: @s2";
158 say STDERR "-- S3: @s3";
159 }
160  
161 2592 return $class->new(%params);
162  
163 }
164  
165 5113 ▶sub to_string {
Subroutine to_string: called CC=1 SCAR=0.0
Pod documented
166 5113 my $self = shift;
167  
168 5113 my $class = $self->{scheme_class};
169 5113 my @constraints = sort { $class->new($a->version) <=> $class->new($b->version) } @{$self->constraints};
170  
171 5113 return join '', 'vers:', $self->scheme, '/', join('|', @constraints);
172 }
173  
174 32 ▶sub constraint_contains {
Subroutine constraint_contains: called CC=9 SCAR=22.2
Pod documented
175  
176 32 my ($self, $constraint, $version) = @_;
177  
178 # "vers:none/*" is a range containing no versions (vers-spec)
179 32 ▶ return FALSE if $self->scheme eq 'none';
Branch: 1 branch
BranchTrueFalseTotal
if $self->scheme eq "none" 3 29 32
180  
181 # "vers:scheme/*" is range containing all versions (vers-spec)
182 29 ▶ return TRUE if $constraint->comparator eq '*';
Branch: 1 branch
BranchTrueFalseTotal
if $constraint->comparator eq "*" 19 10 29
183  
184 10 my $version_class = $self->{scheme_class};
185  
186 10 my $v1 = $version_class->new($version);
187 10 my $v2 = $version_class->new($constraint->version);
188  
189 10 ▶ return ($v1 == $v2) if ($constraint->comparator eq '=');
Branch: 1 branch
BranchTrueFalseTotal
if $constraint->comparator eq "=" 0 10 10
190 10 ▶ return ($v1 != $v2) if ($constraint->comparator eq '!=');
Branch: 1 branch
BranchTrueFalseTotal
if $constraint->comparator eq "!=" 0 10 10
191 10 ▶ return ($v1 <= $v2) if ($constraint->comparator eq '<=');
Branch: 1 branch
BranchTrueFalseTotal
if $constraint->comparator eq "<=" 1 9 10
192 9 ▶ return ($v1 >= $v2) if ($constraint->comparator eq '>=');
Branch: 1 branch
BranchTrueFalseTotal
if $constraint->comparator eq ">=" 1 8 9
193 8 ▶ return ($v1 < $v2) if ($constraint->comparator eq '<');
Branch: 1 branch
BranchTrueFalseTotal
if $constraint->comparator eq "<" 7 1 8
194 1 ▶ return ($v1 > $v2) if ($constraint->comparator eq '>');
Branch: 1 branch
BranchTrueFalseTotal
if $constraint->comparator eq ">" 1 0 1
195  
196 0 return FALSE;
197  
198 }
199  
200 48 ▶sub contains {
Subroutine contains: called CC=23 SCAR=31.5
Pod documented
201  
202 48 my ($self, $version) = @_;
203  
204 48 my @first = ();
205 48 my @second = ();
206  
207 48 my $version_class = $self->{scheme_class};
208 48 my $tested = $version_class->new($version);
209  
210 48 ▶ if (scalar @{$self->constraints} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @{$self->constraints;} == 1) 30 18 48
211 30 return $self->constraint_contains($self->constraints->[0], $version);
212 }
213  
214 18 foreach my $constraint (@{$self->constraints}) {
215  
216 # If the "tested version" is equal to the any of the constraint version
217 # where the constraint comparator is for equality (any of "=", "<=", or ">=")
218 # then the "tested version" is in the range. Check is finished.
219  
220 return TRUE
221 45 ▶ if ((first { $constraint->comparator eq $_ } ('=', '<=', '>='))
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if &first(sub { $constraint->comparator eq $_; } , "=", "<=", ">=") and $tested == $version_class->new($constraint->version) 3 42 45
Condition100%3/3
&first(sub { $constraint->comparator eq $_; } , "=", "<=", ">=") and $tested == $version_class->new($constraint->version)
!ll&&!rl&&r
17253
MC/DC100%2/2
&first(sub { $constraint->comparator eq $_; } , "=", "<=", ">=") and $tested == $version_class->new($constraint->version)
&first(sub { $constraint->comparator eq $_; } , "=", "<=", ">=") $tested == $version_class->new($constraint->version)
Truth table100%3/3
A and B
A= &first(sub { $constraint->comparator eq $_; } , "=", "<=", ">=")B= $tested == $version_class->new($constraint->version)
ABresult
0X0
100
111
222 && ($tested == $version_class->new($constraint->version)));
223  
224 # If the "tested version" is equal to the any of the constraint version
225 # where the constraint comparator is "=!" then the "tested version" is NOT
226 # in the range. Check is finished.
227  
228 42 ▶ return FALSE if ($constraint->comparator eq '!=' && ($tested == $version_class->new($constraint->version)));
Branch: 1 branch
BranchTrueFalseTotal
if $constraint->comparator eq "!=" and $tested == $version_class->new($constraint->version) 2 40 42
Condition100%3/3
$constraint->comparator eq "!=" and $tested == $version_class->new($constraint->version)
!ll&&!rl&&r
3552
MC/DC100%2/2
$constraint->comparator eq "!=" and $tested == $version_class->new($constraint->version)
$constraint->comparator eq "!=" $tested == $version_class->new($constraint->version)
Truth table100%3/3
A and B
A= $constraint->comparator eq "!="B= $tested == $version_class->new($constraint->version)
ABresult
0X0
100
111
229  
230 # Split the constraint list in two sub lists:
231 # a first list where the comparator is "=" or "!="
232 # a second list where the comparator is neither "=" nor "!="
233  
234 40 ▶ push @first, $constraint if ((first { $constraint->comparator eq $_ } ('=', '!=')));
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if &first(sub { $constraint->comparator eq $_; } , "=", "!=") 12 28 40
235 40 ▶ push @second, $constraint if (!(first { $constraint->comparator eq $_ } ('=', '!=')));
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
unless &first(sub { $constraint->comparator eq $_; } , "=", "!=") 28 12 40
236  
237 }
238  
239 13 ▶ return FALSE unless @second;
Branch: 1 branch
BranchTrueFalseTotal
unless @second 0 13 13
240  
241 13 ▶ if (scalar @second == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @second == 1) 2 11 13
242 2 return $self->constraint_contains($second[0], $version);
243 }
244  
245 # Iterate over the current and next contiguous constraints pairs (aka. pairwise)
246 # in the second list.
247  
248 # For each current and next constraint:
249  
250 11 my $is_first_iteration = TRUE;
251  
252 11 my $current_constraint = undef;
253 11 my $next_constraint = undef;
254  
255 11 foreach (_pairwise(@second)) {
256  
257 11 ($current_constraint, $next_constraint) = @{$_};
258  
259 11 DEBUG and say STDERR sprintf '-- Current constraint --> %s', $current_constraint;
260 11 DEBUG and say STDERR sprintf '-- Next constraint --> %s', $next_constraint;
261  
262 # If this is the first iteration and current comparator is "<" or <=" and
263 # the "tested version" is less than the current version then the "tested
264 # version" is IN the range. Check is finished.
265  
266 11 ▶ if ($is_first_iteration) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_first_iteration) 11 0 11
267  
268 return TRUE
269 11 ▶ if ((first { $current_constraint->comparator eq $_ } ('<=', '<'))
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
if &first(sub { $current_constraint->comparator eq $_; } , "<=", "<") and $tested < $version_class->new($current_constraint->version) 0 11 11
Condition66%2/3
&first(sub { $current_constraint->comparator eq $_; } , "<=", "<") and $tested < $version_class->new($current_constraint->version)
!ll&&!rl&&r
1010
MC/DC0%0/2
&first(sub { $current_constraint->comparator eq $_; } , "<=", "<") and $tested < $version_class->new($current_constraint->version)
&first(sub { $current_constraint->comparator eq $_; } , "<=", "<") $tested < $version_class->new($current_constraint->version)
Truth table66%2/3
A and B
A= &first(sub { $current_constraint->comparator eq $_; } , "<=", "<")B= $tested < $version_class->new($current_constraint->version)
ABresult
0X0
100
111
270 && ($tested < $version_class->new($current_constraint->version)));
271  
272 11 $is_first_iteration = FALSE;
273  
274 }
275  
276 # If current comparator is ">" or >=" and next comparator is "<" or <="
277 # and the "tested version" is greater than the current version and the
278 # "tested version" is less than the next version then the "tested version"
279 # is IN the range. Check is finished.
280  
281 11 ▶ if ( (first { $current_constraint->comparator eq $_ } ('>', '>='))
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
if (&first(sub { $current_constraint->comparator eq $_; } , '>', '>=') and &first(sub { $next_constraint->comparator eq $_; } , '<', '<=') and $tested > $version_class->new($current_constraint->version) and $tested < $version_class->new($next_constraint->version)) { } 5 6 11
elsif (&first(sub { $current_constraint->comparator eq $_; } , '<', '<=') and &first(sub { $next_constraint->comparator eq $_; } , '>', '>=')) { } 1 10 11
Condition88%8/9
&first(sub { $current_constraint->comparator eq $_; } , ">", ">=") and &first(sub { $next_constraint->comparator eq $_; } , "<", "<=") and $tested > $version_class->new($current_constraint->version) and $tested < $version_class->new($next_constraint->version)
!ll&&!rl&&r
425
&first(sub { $current_constraint->comparator eq $_; } , ">", ">=") and &first(sub { $next_constraint->comparator eq $_; } , "<", "<=") and $tested > $version_class->new($current_constraint->version)
!ll&&!rl&&r
137
&first(sub { $current_constraint->comparator eq $_; } , ">", ">=") and &first(sub { $next_constraint->comparator eq $_; } , "<", "<=")
!ll&&!rl&&r
1010
MC/DC75%3/4
&first(sub { $current_constraint->comparator eq $_; } , ">", ">=") and &first(sub { $next_constraint->comparator eq $_; } , "<", "<=") and $tested > $version_class->new($current_constraint->version) and $tested < $version_class->new($next_constraint->version)
&first(sub { $current_constraint->comparator eq $_; } , ">", ">=") &first(sub { $next_constraint->comparator eq $_; } , "<", "<=") $tested > $version_class->new($current_constraint->version) $tested < $version_class->new($next_constraint->version)
Truth table80%4/5
A and B and C and D
A= &first(sub { $current_constraint->comparator eq $_; } , ">", ">=")B= &first(sub { $next_constraint->comparator eq $_; } , "<", "<=")C= $tested > $version_class->new($current_constraint->version)D= $tested < $version_class->new($next_constraint->version)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
282 17 ▶ && (first { $next_constraint->comparator eq $_ } ('<', '<='))
Subroutine __ANON__: called CC=1 SCAR=0.0
283 && ($tested > $version_class->new($current_constraint->version))
284 && ($tested < $version_class->new($next_constraint->version)))
285 {
286 5 return TRUE;
287 }
288  
289 # If current comparator is "<" or <=" and next comparator is ">" or >="
290 # then these versions are out the range. Continue to the next iteration.
291  
292 12 ▶ elsif ((first { $current_constraint->comparator eq $_ } ('<', '<='))
Subroutine __ANON__: called CC=1 SCAR=0.2
Condition66%2/3
&first(sub { $current_constraint->comparator eq $_; } , "<", "<=") and &first(sub { $next_constraint->comparator eq $_; } , ">", ">=")
!ll&&!rl&&r
501
MC/DC50%1/2
&first(sub { $current_constraint->comparator eq $_; } , "<", "<=") and &first(sub { $next_constraint->comparator eq $_; } , ">", ">=")
&first(sub { $current_constraint->comparator eq $_; } , "<", "<=") &first(sub { $next_constraint->comparator eq $_; } , ">", ">=")
Truth table66%2/3
A and B
A= &first(sub { $current_constraint->comparator eq $_; } , "<", "<=")B= &first(sub { $next_constraint->comparator eq $_; } , ">", ">=")
ABresult
0X0
100
111
293 2 ▶ && (first { $next_constraint->comparator eq $_ } ('>', '>=')))
Subroutine __ANON__: called CC=1 SCAR=0.0
294 {
295 1 next;
296 }
297  
298 }
299  
300 # If this is the last iteration and next comparator is ">" or >=" and the
301 # "tested version" is greater than the next version then the "tested version"
302 # is IN the range. Check is finished.
303  
304 return TRUE
305 6 ▶ if ((first { $next_constraint->comparator eq $_ } ('>', '>='))
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
if &first(sub { $next_constraint->comparator eq $_; } , ">", ">=") and $tested > $version_class->new($next_constraint->version) 0 6 6
Condition66%2/3
&first(sub { $next_constraint->comparator eq $_; } , ">", ">=") and $tested > $version_class->new($next_constraint->version)
!ll&&!rl&&r
510
MC/DC0%0/2
&first(sub { $next_constraint->comparator eq $_; } , ">", ">=") and $tested > $version_class->new($next_constraint->version)
&first(sub { $next_constraint->comparator eq $_; } , ">", ">=") $tested > $version_class->new($next_constraint->version)
Truth table66%2/3
A and B
A= &first(sub { $next_constraint->comparator eq $_; } , ">", ">=")B= $tested > $version_class->new($next_constraint->version)
ABresult
0X0
100
111
306 && ($tested > $version_class->new($next_constraint->version)));
307  
308 6 return FALSE;
309  
310 }
311  
312 1 ▶sub to_hash {
Subroutine to_hash: called CC=1 SCAR=0.0
Pod documented
313 1 return {scheme => $_[0]->scheme, constraints => $_[0]->constraints};
314 }
315  
316 1 ▶sub TO_JSON { shift->to_hash }
Subroutine TO_JSON: called CC=1 SCAR=0.0
Pod documented
317  
318 11 ▶sub _pairwise {
Subroutine _pairwise: called CC=3 SCAR=11.0
319  
320 11 my @out = ();
321  
322 11 ▶ for (my $i = 0; $i < scalar @_; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @_) 22 11 33
323 22 ▶ push @out, [$_[$i], $_[$i + 1]] if $_[$i + 1];
Branch: 1 branch
BranchTrueFalseTotal
if $_[$i + 1] 11 11 22
324 }
325  
326 11 return @out;
327  
328 }
329  
330 15 1;
331  
332 __END__
« PackageURL/Util.pm ↑ Summary VersionRange/Constraint.pm »