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