Local/Plugin/Inject.pm

filter: Statementstmt 100% 35 / 35 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 100% 1 / 1 totaltotal 100% 48 / 48 CC 3 SCAR 4.1
CC
3
Cov
100%
inject
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Local/Distribution.pm ↑ Summary Local/App.pm »
1 package CPAN::Local::Plugin::Inject;
2 {
3 2 $CPAN::Local::Plugin::Inject::VERSION = '0.010';
4 }
5  
6 # ABSTRACT: Inject a distribution into the repo
7  
8 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use CPAN::Inject;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Path::Class qw(file);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Try::Tiny qw(try catch);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 extends 'CPAN::Local::Plugin';
15 2 with 'CPAN::Local::Role::Inject';
16 2 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 sub inject
19 2 ▶{
Subroutine inject: called CC=3 SCAR=11.0
Pod documented
20 2 my ( $self, @distros ) = @_;
21  
22 2 my @injected;
23  
24 2 foreach my $distro (@distros)
25 {
26 3 my $injector = CPAN::Inject->new(
27 sources => $self->root,
28 author => $distro->authorid,
29 );
30  
31 3 ▶ next unless try { $injector->add( file => $distro->filename ) }
Subroutine __ANON__: called CC=1 SCAR=0.0
32 3 ▶ catch { $self->log($_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
unless &try(sub { $injector->add("file", $distro->filename); } , &catch(sub { $self->log($_); } )) 1 2 3
33  
34 2 push @injected, $self->create_distribution(
35 filename => file( $self->root, $distro->path )->stringify,
36 authorid => $distro->authorid,
37 path => $distro->path,
38 );
39 }
40  
41 2 return @injected;
42 }
43  
44 2 __PACKAGE__->meta->make_immutable;
45  
46  
47 __END__
« Local/Distribution.pm ↑ Summary Local/App.pm »