File Coverage

blib/lib/App/SmokeBrew/PerlVersion.pm
Criterion Covered Total %
statement 28 35 80.0
branch 2 8 25.0
condition n/a
subroutine 9 11 81.8
pod 4 4 100.0
total 43 58 74.1


line stmt bran cond sub pod time code
1             $App::SmokeBrew::PerlVersion::VERSION = '1.02';
2             #ABSTRACT: Moose role for perl versions
3              
4             use strict;
5 4     4   2640 use warnings;
  4         13  
  4         115  
6 4     4   22  
  4         6  
  4         100  
7             use Moose::Role;
8 4     4   859 use Perl::Version;
  4         8464  
  4         28  
9 4     4   19308 use Module::CoreList;
  4         2573  
  4         97  
10 4     4   2896 use App::SmokeBrew::Types qw[PerlVersion];
  4         90389  
  4         35  
11 4     4   1657  
  4         10  
  4         24  
12             has 'version' => (
13             is => 'ro',
14             isa => 'PerlVersion',
15             required => 1,
16             coerce => 1,
17             );
18              
19             my $self = shift;
20             ( my $numify = $self->version->numify ) =~ s/_//g;
21 3     3 1 6 my $pv = 'perl'.( $numify < 5.006 ? $self->version->numify : $self->version->normal );
22 3         88 $pv =~ s/perlv/perl-/g;
23 3 50       156 return $pv;
24 3         75 }
25 3         11  
26             my $self = shift;
27             return 0 unless $self->version->numify >= 5.006;
28             return $self->version->version % 2;
29 0     0 1 0 }
30 0 0       0  
31 0         0 my $self = shift;
32             return 0 unless $self->version->numify >= 5.021004;
33             return 1;
34             }
35 1     1 1 2  
36 1 50       30 my $self = shift;
37 0           return 0 unless $self->version->numify >= 5.019004;
38             return 1;
39             }
40              
41 0     0 1   no Moose::Role;
42 0 0          
43 0           qq[Smokin'];
44              
45              
46 4     4   4160 =pod
  4         9  
  4         26  
47              
48             =encoding UTF-8
49              
50             =head1 NAME
51              
52             App::SmokeBrew::PerlVersion - Moose role for perl versions
53              
54             =head1 VERSION
55              
56             version 1.02
57              
58             =head1 SYNOPSIS
59              
60             use Moose;
61              
62             with 'App::SmokeBrew::PerlVersion';
63              
64             =head1 DESCRIPTION
65              
66             App::SmokeBrew::PerlVersion is a L<Moose::Role> consumed by various parts of L<smokebrew> that provides
67             a required attribute and some methods.
68              
69             =head1 ATTRIBUTES
70              
71             =over
72              
73             =item C<version>
74              
75             A required attribute.
76              
77             A L<Perl::Version> object.
78              
79             Coerced from C<Str> via C<new> in L<Perl::Version>
80              
81             Constrained to existing in L<Module::CoreList> C<released> and being >= C<5.006>
82              
83             =back
84              
85             =head1 METHODS
86              
87             These are methods provided by the role.
88              
89             =over
90              
91             =item C<perl_version>
92              
93             Returns the normalised perl version prefixed with C<perl->.
94              
95             =item C<is_dev_release>
96              
97             Returns true if the perl version is a C<development> perl release, false otherwise.
98              
99             =item C<can_quadmath>
100              
101             Returns true if the perl version is capable of being built with C<quadmath>.
102              
103             =item C<can_jobs>
104              
105             Returns true if the perl version is safely capable of being built with C<make -j>.
106              
107             =back
108              
109             =head1 SEE ALSO
110              
111             L<smokebrew>
112              
113             L<Moose::Role>
114              
115             L<App::SmokeBrew::Types>
116              
117             L<Perl::Version>
118              
119             =head1 AUTHOR
120              
121             Chris Williams <chris@bingosnet.co.uk>
122              
123             =head1 COPYRIGHT AND LICENSE
124              
125             This software is copyright (c) 2022 by Chris Williams.
126              
127             This is free software; you can redistribute it and/or modify it under
128             the same terms as the Perl 5 programming language system itself.
129              
130             =cut