ENV.pm

filter: Statementstmt 100% 36 / 36 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 96.0% 48 / 50 CC 4 SCAR 5.5
CC
4
Cov
95%
__ANON__
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.7
« not/ENV.pm ↑ Summary
1 3 ▶use 5.006; # our
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Dist::Zilla::Plugin::if::ENV;
6  
7 3 our $VERSION = '0.001001';
8  
9 # ABSTRACT: Load a plugin when an ENV key is true.
10  
11 3 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12  
13 3 ▶use Moose qw( has around with );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use Dist::Zilla::Util qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 with 'Dist::Zilla::Role::PluginLoader::Configurable';
16  
17 3 has key => ( is => ro =>, required => 1 );
18  
19 2 ▶around dump_config => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
20 2 my ( $orig, $self, @args ) = @_;
21 2 my $config = $self->$orig(@args);
22 2 my $localconf = $config->{ +__PACKAGE__ } = {};
23  
24 2 $localconf->{key} = $self->key;
25  
26 2 ▶ $localconf->{ q[$] . __PACKAGE__ . '::VERSION' } = $VERSION
Branch: 1 branch
BranchTrueFalseTotal
unless __PACKAGE__ eq ref $self 0 2 2
27 unless __PACKAGE__ eq ref $self;
28  
29 2 return $config;
30 3 };
31  
32 2 ▶around load_plugins => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
33 2 my ( $orig, $self, $loader ) = @_;
34 2 my $key = $self->key;
35 2 ▶ return unless exists $ENV{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $ENV{$key} 0 2 2
36 2 ▶ return unless $ENV{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless $ENV{$key} 1 1 2
37 1 return $self->$orig($loader);
38 3 };
39  
40 3 __PACKAGE__->meta->make_immutable;
41 3 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 3 1;
44  
45 __END__
« not/ENV.pm ↑ Summary