line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
632
|
use 5.006; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
113
|
|
2
|
3
|
|
|
3
|
|
12
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
82
|
|
3
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
180
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Gentoo::Util::MetaCPAN::Requirement; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.001000'; # TRIAL |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: A Single dependency requirement specialized for Gentoo |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
475
|
use Moo qw( has ); |
|
3
|
|
|
|
|
13439
|
|
|
3
|
|
|
|
|
16
|
|
14
|
3
|
|
|
3
|
|
2369
|
use Gentoo::PerlMod::Version qw( gentooize_version ); |
|
3
|
|
|
|
|
3725
|
|
|
3
|
|
|
|
|
18
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'module' => ( is => ro =>, required => 1, ); |
17
|
|
|
|
|
|
|
has 'range' => ( is => ro =>, required => 1, ); |
18
|
|
|
|
|
|
|
has 'version' => ( is => ro =>, lazy => 1, builder => '_build_version' ); |
19
|
|
|
|
|
|
|
has 'gentoo_version' => ( is => ro =>, lazy => 1, builder => '_build_gentoo_version' ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub BUILD { |
22
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
23
|
0
|
|
|
|
|
|
$self->gentoo_version; |
24
|
0
|
|
|
|
|
|
return; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _has_min_version { |
28
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
29
|
|
|
|
|
|
|
## no critic (Subroutines::ProtectPrivateSubs) |
30
|
0
|
|
|
|
|
|
return !( $self->range->_accepts(0) ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _build_version { |
34
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
35
|
0
|
|
|
|
|
|
return $self->range->as_string; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _build_gentoo_version { |
39
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
40
|
0
|
|
|
|
|
|
my $ver; |
41
|
|
|
|
|
|
|
## no critic (ErrorHandling::RequireCheckingReturnValueOfEval) |
42
|
0
|
|
|
|
|
|
eval { $ver = gentooize_version( $self->version, { lax => 1 } ); }; |
|
0
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return $ver; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _pretty_version { |
47
|
0
|
|
|
0
|
|
|
my ($version) = @_; |
48
|
0
|
|
0
|
|
|
|
return eval { gentooize_version( $version, { lax => 1 } ) } || q<?>; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _pretty { |
52
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
53
|
0
|
|
|
|
|
|
my $module = $self->module; |
54
|
0
|
|
|
|
|
|
my $range = $self->range; |
55
|
0
|
0
|
|
|
|
|
if ( $range->isa('CPAN::Meta::Requirements::_Range::Exact') ) { |
56
|
0
|
|
|
|
|
|
return sprintf '= %s @ %s', $module, _pretty_version( $range->{version} ); |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
|
my @out; |
59
|
0
|
0
|
|
|
|
|
if ( exists $range->{minimum} ) { |
60
|
0
|
0
|
|
|
|
|
if ( $range->{minimum} != 0 ) { |
61
|
0
|
|
|
|
|
|
push @out, sprintf '>= %s @ %s', $module, _pretty_version( $range->{minimum} ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else { |
64
|
0
|
|
|
|
|
|
push @out, sprintf '%s', $module; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
0
|
0
|
|
|
|
|
if ( exists $range->{maximum} ) { |
68
|
0
|
|
|
|
|
|
push @out, sprintf '<= %s @ %s', $module, _pretty_version( $range->{maximum} ); |
69
|
|
|
|
|
|
|
} |
70
|
0
|
0
|
|
|
|
|
if ( exists $range->{exclusions} ) { |
71
|
0
|
|
|
|
|
|
for my $exclusion ( @{ $range->{exclusions} } ) { |
|
0
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
push @out, sprintf '! %s @ %s', $module, _pretty_version( $exclusion, { lax => 1 } ); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
|
|
|
|
return join q[ ], @out; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
3
|
|
|
3
|
|
1215
|
no Moo; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
12
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=pod |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=encoding UTF-8 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 NAME |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Gentoo::Util::MetaCPAN::Requirement - A Single dependency requirement specialized for Gentoo |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 VERSION |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
version 0.001000 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 METHODS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 BUILD |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 module |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 range |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
113
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |