blib/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm

filter: Statementstmt 94.4% 17 / 18 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 88.4% 23 / 26 CC 2 SCAR 4.1
CC
2
Cov
90%
register_stash
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.5
« blib/lib/Dist/Zilla/MVP/RootSection.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Manifest.pm »
1 package Dist::Zilla::MVP::Assembler::GlobalConfig 6.040;
2 # ABSTRACT: Dist::Zilla::MVP::Assembler for global configuration
3  
4 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 extends 'Dist::Zilla::MVP::Assembler';
6  
7 2 ▶use Dist::Zilla::Pragmas;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 #pod =head1 OVERVIEW
12 #pod
13 #pod This is a subclass of L<Dist::Zilla::MVP::Assembler> used when assembling the
14 #pod global configuration. It has a C<stash_registry> attribute, a hashref, into
15 #pod which stashes will be registered.
16 #pod
17 #pod They get registered via the C<register_stash> method, below, generally called
18 #pod by the C<register_component> method on L<Dist::Zilla::Role::Stash>-performing
19 #pod class.
20 #pod
21 #pod =cut
22  
23 has stash_registry => (
24 is => 'ro',
25 isa => 'HashRef[Object]',
26 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 2 );
28  
29 #pod =method register_stash
30 #pod
31 #pod $assembler->register_stash($name => $stash_object);
32 #pod
33 #pod This adds a stash to the assembler's stash registry -- unless the name is
34 #pod already taken, in which case an exception is raised.
35 #pod
36 #pod =cut
37  
38 2 ▶sub register_stash {
Subroutine register_stash: called CC=2 SCAR=7.0
Pod documented
39 2 my ($self, $name, $object) = @_;
40  
41 # $self->log_fatal("tried to register $name stash entry twice")
42 confess("tried to register $name stash entry twice")
43 2 ▶ if $self->stash_registry->{ $name };
Branch: 1 branch
BranchTrueFalseTotal
if $self->stash_registry->{$name} 0 2 2
44  
45 2 $self->stash_registry->{ $name } = $object;
46 2 return;
47 }
48  
49 2 __PACKAGE__->meta->make_immutable;
50 2 1;
51  
52 __END__
« blib/lib/Dist/Zilla/MVP/RootSection.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Manifest.pm »