Starter.pm

filter: Statementstmt 93.7% 30 / 32 Branchbran 75.0% 6 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 86.5% 45 / 52 SCAR 18.0
CC
6
Cov
88%
import
6.2
BEGIN
1.0
BEGIN
1.0
CRAP 6.1
« Starter/BuilderSet.pm ↑ Summary Starter/Plugin/Template.pm »
1 package Module::Starter;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Module::Runtime qw( require_module );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Module::Starter - a simple starter kit for any module
11  
12 =head1 VERSION
13  
14 version 1.77
15  
16 =cut
17  
18 1 our $VERSION = '1.77';
19  
20 =head1 SYNOPSIS
21  
22 Nothing in here is meant for public consumption. Use L<module-starter>
23 from the command line.
24  
25 module-starter --module=Foo::Bar,Foo::Bat \
26 --author="Andy Lester" --email=andy@petdance.com
27  
28 =head1 DESCRIPTION
29  
30 This is the core module for Module::Starter. If you're not looking to extend
31 or alter the behavior of this module, you probably want to look at
32 L<module-starter> instead.
33  
34 Module::Starter is used to create a skeletal CPAN distribution, including basic
35 builder scripts, tests, documentation, and module code. This is done through
36 just one method, C<create_distro>.
37  
38 =head1 METHODS
39  
40 =head2 Module::Starter->create_distro(%args)
41  
42 C<create_distro> is the only method you should need to use from outside this
43 module; all the other methods are called internally by this one.
44  
45 This method creates orchestrates all the work; it creates distribution and
46 populates it with the all the requires files.
47  
48 It takes a hash of params, as follows:
49  
50 distro => $distroname, # distribution name (defaults to first module)
51 modules => [ module names ], # modules to create in distro
52 dir => $dirname, # directory in which to build distro
53 builder => 'Module::Build', # defaults to ExtUtils::MakeMaker
54 # or specify more than one builder in an
55 # arrayref
56  
57 license => $license, # type of license; defaults to 'artistic2'
58 author => $author, # author's full name (taken from C<getpwuid> if not provided)
59 email => $email, # author's email address (taken from C<EMAIL> if not provided)
60 ignores_type => $type, # ignores file type ('generic', 'cvs', 'git', 'hg', 'manifest' )
61 fatalize => $fatalize, # generate code that makes warnings fatal
62  
63 verbose => $verbose, # bool: print progress messages; defaults to 0
64 force => $force # bool: overwrite existing files; defaults to 0
65  
66 The ignores_type is a new feature that allows one to create SCM-specific ignore files.
67 These are the mappings:
68  
69 ignores_type => 'generic' # default, creates 'ignore.txt'
70 ignores_type => 'cvs' # creates .cvsignore
71 ignores_type => 'git' # creates .gitignore
72 ignores_type => 'hg' # creates .hgignore
73 ignores_type => 'manifest' # creates MANIFEST.SKIP
74  
75 It is also possible to provide an array ref with multiple types wanted:
76  
77 ignores_type => [ 'git', 'manifest' ]
78  
79 =head1 PLUGINS
80  
81 Module::Starter itself doesn't actually do anything. It must load plugins that
82 implement C<create_distro> and other methods. This is done by the class's C<import>
83 routine, which accepts a list of plugins to be loaded, in order.
84  
85 For more information, refer to L<Module::Starter::Plugin>.
86  
87 =cut
88  
89 sub import {
90 1 ▶ my $class = shift;
Subroutine import: called CC=6 SCAR=18.2
91 1 ▶ my @plugins = ((@_ ? @_ : 'Module::Starter::Simple'), $class);
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 1 1
92 1 my $parent;
93  
94 1 ▶ while (my $child = shift @plugins) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $child = shift @plugins) 2 1 3
95 2 require_module $child;
96  
97 ## no critic
98 1 ▶ no strict 'refs'; #Violates ProhibitNoStrict
Subroutine BEGIN: called CC=1 SCAR=0.0
99 2 ▶ push @{"${child}::ISA"}, $parent if $parent;
Branch: 1 branch
BranchTrueFalseTotal
if $parent 1 1 2
100 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
101 ## use critic
102  
103 2 ▶ if ( @plugins && $child->can('load_plugins') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@plugins and $child->can("load_plugins")) 0 2 2
Condition66%2/3
@plugins and $child->can("load_plugins")
!ll&&!rl&&r
110
MC/DC0%0/2
@plugins and $child->can("load_plugins")
@plugins $child->can("load_plugins")
Truth table66%2/3
A and B
A= @pluginsB= $child->can("load_plugins")
ABresult
0X0
100
111
104 0 $parent->load_plugins(@plugins);
105 0 last;
106 }
107 2 $parent = $child;
108 }
109  
110 1 return;
111 }
112  
113 =head1 AUTHORS
114  
115 Dan Book, C<< <dbook at cpan.org> >>
116  
117 Sawyer X, C<< <xsawyerx at cpan.org> >>
118  
119 Andy Lester, C<< <petdance at cpan.org> >>
120  
121 Ricardo Signes, C<< <rjbs at cpan.org> >>
122  
123 C.J. Adams-Collier, C<< <cjac at colliertech.org> >>
124  
125 =head1 SUPPORT
126  
127 You can find documentation for this module with the perldoc command.
128  
129 perldoc Module::Starter
130  
131 You can also look for information at:
132  
133 =over 4
134  
135 =item * Source code at GitHub
136  
137 L<https://github.com/xsawyerx/module-starter>
138  
139 =item * CPAN Ratings
140  
141 L<http://cpanratings.perl.org/dist/Module-Starter>
142  
143 =item * GitHub issue tracker
144  
145 L<https://github.com/xsawyerx/module-starter/issues>
146  
147 =item * Search CPAN
148  
149 L<https://metacpan.org/release/Module-Starter>
150  
151 =back
152  
153 =head1 BUGS
154  
155 Please report any bugs or feature requests to the bugtracker for this project
156 on GitHub at: L<https://github.com/xsawyerx/module-starter/issues>. I will be
157 notified, and then you'll automatically be notified of progress on your bug
158 as I make changes.
159  
160 =head1 COPYRIGHT
161  
162 Copyright 2005-2009 Andy Lester, Ricardo Signes and C.J. Adams-Collier,
163 All Rights Reserved.
164  
165 Copyright 2010 Sawyer X, All Rights Reserved.
166  
167 This program is free software; you can redistribute it and/or modify it
168 under the same terms as Perl itself.
169  
170 =head1 SEE ALSO
171  
172 =over 4
173  
174 =item L<mbtiny>
175  
176 Minimal authoring tool to create and manage distributions using
177 L<Module::Build::Tiny> as an installer.
178  
179 =item L<Dist::Milla>
180  
181 Easy to use and powerful authoring tool using L<Dist::Zilla> to create and
182 manage distributions.
183  
184 =item L<Minilla>
185  
186 Authoring tool similar to L<Dist::Milla> but without using L<Dist::Zilla>.
187  
188 =item L<Dist::Zilla>
189  
190 Very complex, fully pluggable and customizable distribution builder.
191  
192 =back
193  
194 =cut
195  
196 1 1;
197  
198 # vi:et:sw=4 ts=4
« Starter/BuilderSet.pm ↑ Summary Starter/Plugin/Template.pm »