App/SmokeBrew/Types.pm

filter: Statementstmt 100% 42 / 42 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 14 / 14 Podpod n/a totaltotal 100% 58 / 58 CC 2 SCAR 1.3
CC
2
Cov
100%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« App/SmokeBrew/Plugin/Null.pm ↑ Summary App/SmokeBrew/Plugin.pm »
1 package App::SmokeBrew::Types;
2 12 $App::SmokeBrew::Types::VERSION = '1.06';
3 #ABSTRACT: Moose types for smokebrew
4  
5 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 use MooseX::Types
9 12 ▶ -declare => [qw(ArrayRefUri PerlVersion ArrayRefStr)];
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 12 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 12 ▶use MooseX::Types::Moose qw[Str ArrayRef];
Subroutine BEGIN: called CC=1 SCAR=0.0
14 12 ▶use MooseX::Types::URI qw[to_Uri Uri];
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 12 ▶use Module::CoreList;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 12 ▶use Perl::Version;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 # Thanks to Florian Ragwitz for this magic
20  
21 12 subtype 'ArrayRefUri', as ArrayRef[Uri];
22  
23 1 ▶coerce 'ArrayRefUri', from Str, via { [to_Uri($_)] };
Subroutine __ANON__: called CC=1 SCAR=0.0
24 8 ▶coerce 'ArrayRefUri', from ArrayRef, via { [map { to_Uri($_) } @$_] };
Subroutine __ANON__: called CC=1 SCAR=0.0
25  
26 # This is my own magic
27  
28 subtype( 'PerlVersion', as 'Perl::Version',
29 9 ▶ where { ( my $ver = Perl::Version->new($_)->numify ) =~ s/_//g;
Subroutine __ANON__: called CC=2 SCAR=6.9
30 $ver >= 5.006 and
31 9 ▶ scalar grep { $ver eq sprintf('%.6f',$_) } keys %Module::CoreList::released },
Branch: 1 branch
BranchTrueFalseTotal
$ver >= "5.006" and scalar grep({$ver eq sprintf("%.6f", $_);} keys %Module::CoreList::released) 7 2 9
32 4 ▶ message { "The version ($_) given is not a valid Perl version and is too old (< 5.006)" },
Subroutine __ANON__: called CC=1 SCAR=0.0
33 12 );
34  
35 9 ▶coerce( 'PerlVersion', from 'Str', via { Perl::Version->new($_) } );
Subroutine __ANON__: called CC=1 SCAR=0.0
36  
37 12 subtype( 'ArrayRefStr', as ArrayRef[Str] );
38 1 ▶coerce( 'ArrayRefStr', from 'Str', via { [ $_ ] } );
Subroutine __ANON__: called CC=1 SCAR=0.0
39  
40 12 qq[Smokin'];
41  
42 __END__
« App/SmokeBrew/Plugin/Null.pm ↑ Summary App/SmokeBrew/Plugin.pm »