Dist.pm

filter: Statementstmt 100% 33 / 33 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 100% 44 / 44 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« OPM.pm ↑ Summary RENEEB.pm »
1 package Types::Dist;
2  
3 # ABSTRACT: Types related to distributions (e.g. distributions on CPAN)
4  
5 10 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 use Type::Library
11 10 ▶ -base,
Subroutine BEGIN: called CC=1 SCAR=0.0
12 10 -declare => qw( DistName DistVersion DistFQ CPANfile );
13  
14 10 ▶use Type::Utils -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 10 ▶use Types::Standard -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 10 ▶use Module::CPANfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 10 my $distname_re = qr{
20 (?:[A-Za-z][A-Za-z0-9]*)
21 (?: - [A-Za-z0-9]+ )*
22 }xms;
23  
24 10 my $distversion_re = qr{
25 v?
26 (?:
27 [0-9]+
28 (?: \. [0-9]+ )*
29 )
30 }xms;
31  
32 10 my $distfq_re = qr{$distname_re-$distversion_re};
33  
34  
35 declare DistName =>
36 as Str,
37 62 ▶ where { $_ =~ m{\A$distname_re\z} };
Subroutine __ANON__: called CC=1 SCAR=0.0
38  
39 declare DistVersion =>
40 as Str,
41 34 ▶ where { $_ =~ m{\A$distversion_re\z} };
Subroutine __ANON__: called CC=1 SCAR=0.0
42  
43 declare DistFQ =>
44 as Str,
45 38 ▶ where { $_ =~ m{\A$distfq_re\z} };
Subroutine __ANON__: called CC=1 SCAR=0.0
46  
47 10 class_type CPANfile, { class => 'Module::CPANfile' };
48  
49 coerce CPANfile,
50 2 ▶ from Str, via { Module::CPANfile->load( $_ ) }
Subroutine __ANON__: called CC=1 SCAR=0.0
51 10 ;
52  
53 10 1;
54  
55 __END__
« OPM.pm ↑ Summary RENEEB.pm »