File Coverage

blib/lib/Dist/Zilla/MVP/Assembler/Zilla.pm
Criterion Covered Total %
statement 24 24 100.0
branch 1 2 50.0
condition n/a
subroutine 8 8 100.0
pod 2 3 66.6
total 35 37 94.5


line stmt bran cond sub pod time code
1             package Dist::Zilla::MVP::Assembler::Zilla 6.029;
2             # ABSTRACT: Dist::Zilla::MVP::Assembler for the Dist::Zilla object
3              
4 50     50   1480 use Moose;
  50         158  
  50         427  
5             extends 'Dist::Zilla::MVP::Assembler';
6              
7 50     50   351742 use Dist::Zilla::Pragmas;
  50         156  
  50         529  
8              
9 50     50   482 use namespace::autoclean;
  50         189  
  50         558  
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 Dist::Zilla object.
15             #pod
16             #pod It has a C<zilla_class> attribute, which is used to determine what class of
17             #pod Dist::Zilla object to create. (This isn't very useful now, but will be in the
18             #pod future when minting and building use different subclasses of Dist::Zilla.)
19             #pod
20             #pod Upon construction, the assembler will create a L<Dist::Zilla::MVP::RootSection>
21             #pod as the initial section.
22             #pod
23             #pod =cut
24              
25 50     50   5348 use MooseX::Types::Perl qw(PackageName);
  50         199  
  50         808  
26 50     50   149463 use Dist::Zilla::MVP::RootSection;
  50         210  
  50         14206  
27              
28             sub BUILD {
29 188     188 0 726 my ($self) = @_;
30              
31 188         7415 my $root = Dist::Zilla::MVP::RootSection->new;
32 188         5847 $self->sequence->add_section($root);
33             }
34              
35             has zilla_class => (
36             is => 'ro',
37             isa => PackageName,
38             required => 1
39             );
40              
41             #pod =method zilla
42             #pod
43             #pod This method is a shortcut for retrieving the C<zilla> from the root section.
44             #pod If called before that section has been finalized, it will result in an
45             #pod exception.
46             #pod
47             #pod =cut
48              
49             sub zilla {
50 761     761 1 112276 my ($self) = @_;
51 761         20317 $self->sequence->section_named('_')->zilla;
52             }
53              
54             #pod =method register_stash
55             #pod
56             #pod $assembler->register_stash($name => $stash_object);
57             #pod
58             #pod This adds a stash to the assembler's zilla's stash registry -- unless the name
59             #pod is already taken, in which case an exception is raised.
60             #pod
61             #pod =cut
62              
63             sub register_stash {
64 4     4 1 630 my ($self, $name, $object) = @_;
65             $self->log_fatal("tried to register $name stash entry twice")
66 4 50       23 if $self->zilla->_local_stashes->{ $name };
67              
68 4         18 $self->zilla->_local_stashes->{ $name } = $object;
69 4         18 return;
70             }
71              
72             __PACKAGE__->meta->make_immutable;
73             1;
74              
75             __END__
76              
77             =pod
78              
79             =encoding UTF-8
80              
81             =head1 NAME
82              
83             Dist::Zilla::MVP::Assembler::Zilla - Dist::Zilla::MVP::Assembler for the Dist::Zilla object
84              
85             =head1 VERSION
86              
87             version 6.029
88              
89             =head1 OVERVIEW
90              
91             This is a subclass of L<Dist::Zilla::MVP::Assembler> used when assembling the
92             Dist::Zilla object.
93              
94             It has a C<zilla_class> attribute, which is used to determine what class of
95             Dist::Zilla object to create. (This isn't very useful now, but will be in the
96             future when minting and building use different subclasses of Dist::Zilla.)
97              
98             Upon construction, the assembler will create a L<Dist::Zilla::MVP::RootSection>
99             as the initial section.
100              
101             =head1 PERL VERSION
102              
103             This module should work on any version of perl still receiving updates from
104             the Perl 5 Porters. This means it should work on any version of perl released
105             in the last two to three years. (That is, if the most recently released
106             version is v5.40, then this module should work on both v5.40 and v5.38.)
107              
108             Although it may work on older versions of perl, no guarantee is made that the
109             minimum required version will not be increased. The version may be increased
110             for any reason, and there is no promise that patches will be accepted to lower
111             the minimum required perl.
112              
113             =head1 METHODS
114              
115             =head2 zilla
116              
117             This method is a shortcut for retrieving the C<zilla> from the root section.
118             If called before that section has been finalized, it will result in an
119             exception.
120              
121             =head2 register_stash
122              
123             $assembler->register_stash($name => $stash_object);
124              
125             This adds a stash to the assembler's zilla's stash registry -- unless the name
126             is already taken, in which case an exception is raised.
127              
128             =head1 AUTHOR
129              
130             Ricardo SIGNES 😏 <cpan@semiotic.systems>
131              
132             =head1 COPYRIGHT AND LICENSE
133              
134             This software is copyright (c) 2022 by Ricardo SIGNES.
135              
136             This is free software; you can redistribute it and/or modify it under
137             the same terms as the Perl 5 programming language system itself.
138              
139             =cut