blib/lib/Dist/Zilla/File/InMemory.pm

filter: Statementstmt 84.6% 22 / 26 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod n/a totaltotal 77.1% 27 / 35 CC 2 SCAR 4.9
CC
2
Cov
82%
__ANON__
2.0
_build_content
2.0
_build_encoded_content
2.0
CRAP 1.6
« blib/lib/Dist/Zilla/Plugin/DistINI.pm ↑ Summary blib/lib/Dist/Zilla/App/Command/clean.pm »
1 package Dist::Zilla::File::InMemory 6.040;
2 # ABSTRACT: a file that you build entirely in memory
3  
4 22 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 22 ▶use Dist::Zilla::Pragmas;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 22 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 #pod =head1 DESCRIPTION
11 #pod
12 #pod This represents a file created in memory -- it's not much more than a glorified
13 #pod string.
14 #pod
15 #pod See L<Dist::Zilla::Role::MutableFile> for details.
16 #pod
17 #pod =cut
18  
19 22 with 'Dist::Zilla::Role::MutableFile', 'Dist::Zilla::Role::StubBuild';
20  
21 125 ▶after 'BUILD' => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
22 125 my ($self,$opts) = @_;
23 125 my @sources = qw/encoded_content content/;
24 125 my @given = grep { exists $opts->{$_} } @sources;
25 125 ▶ unless ( @given == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@given == 1) 0 125 125
26 0 $self->log_fatal(__PACKAGE__ . " requires have one and only one of: @sources");
27 }
28 125 my $source = $given[0];
29 125 my $setter = "_$source";
30 125 $self->_content_source($source);
31 125 $self->$setter( $opts->{$source} );
32 22 };
33  
34 # these should never be called since we ensure one of _content or
35 # _encoded_content content is set in BUILD and set the source accordingly
36  
37 0 ▶sub _build_content { die "shouldn't reach here" }
Subroutine _build_content: not called CC=1 SCAR=6.9
38 0 ▶sub _build_encoded_content { die "shouldn't reach here" }
Subroutine _build_encoded_content: not called CC=1 SCAR=6.9
39 0 ▶sub _build_content_source { die "shouldn't reach here" }
Subroutine _build_content_source: not called CC=1 SCAR=6.9
40  
41 22 __PACKAGE__->meta->make_immutable;
42 22 1;
43  
44 __END__
« blib/lib/Dist/Zilla/Plugin/DistINI.pm ↑ Summary blib/lib/Dist/Zilla/App/Command/clean.pm »