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 CC 6 SCAR 12.8
CC
6
Cov
88%
import
6.2
BEGIN
1.0
BEGIN
1.0
CRAP 3.6
« Starter/Simple.pm ↑ Summary Starter/BuilderSet.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.82
15  
16 =cut
17  
18 1 our $VERSION = '1.82';
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 <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 => [ authors ], # author(s) name and email address
59 # (if not provided, name and email are taken from getpwuid and
60 # EMAIL respectively)
61 # format: Author Name <author-email@domain.tld>
62 github => $username, # author's GitHub user name (for creating links to issue tracker)
63 ignores_type => $type, # ignores file type ('generic', 'cvs', 'git', 'hg', 'manifest')
64 fatalize => $fatalize, # generate code that makes warnings fatal
65  
66 verbose => $verbose, # bool: print progress messages; defaults to 0
67 force => $force # bool: overwrite existing files; defaults to 0
68  
69 The ignores_type is a new feature that allows one to create SCM-specific ignore files.
70 These are the mappings:
71  
72 ignores_type => 'generic' # default, creates 'ignore.txt'
73 ignores_type => 'cvs' # creates .cvsignore
74 ignores_type => 'git' # creates .gitignore
75 ignores_type => 'hg' # creates .hgignore
76 ignores_type => 'manifest' # creates MANIFEST.SKIP
77  
78 It is also possible to provide an array ref with multiple types wanted:
79  
80 ignores_type => [ 'git', 'manifest' ]
81  
82 =head1 PLUGINS
83  
84 Module::Starter itself doesn't actually do anything. It must load plugins that
85 implement C<create_distro> and other methods. This is done by the class's C<import>
86 routine, which accepts a list of plugins to be loaded, in order.
87  
88 For more information, refer to L<Module::Starter::Plugin>.
89  
90 =cut
91  
92 1 ▶sub import {
Subroutine import: called CC=6 SCAR=18.2
93 1 my $class = shift;
94 1 ▶ my @plugins = ((@_ ? @_ : 'Module::Starter::Simple'), $class);
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 1 1
95 1 my $parent;
96  
97 1 ▶ while (my $child = shift @plugins) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $child = shift @plugins) 2 1 3
98 2 require_module $child;
99  
100 ## no critic
101 1 ▶ no strict 'refs'; #Violates ProhibitNoStrict
Subroutine BEGIN: called CC=1 SCAR=0.0
102 2 ▶ push @{"${child}::ISA"}, $parent if $parent;
Branch: 1 branch
BranchTrueFalseTotal
if $parent 1 1 2
103 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
104 ## use critic
105  
106 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
107 0 $parent->load_plugins(@plugins);
108 0 last;
109 }
110 2 $parent = $child;
111 }
112  
113 1 return;
114 }
115  
116 =head1 AUTHORS
117  
118 Dan Book, C<< <dbook at cpan.org> >>
119  
120 Sawyer X, C<< <xsawyerx at cpan.org> >>
121  
122 Andy Lester, C<< <petdance at cpan.org> >>
123  
124 Ricardo Signes, C<< <rjbs at cpan.org> >>
125  
126 C.J. Adams-Collier, C<< <cjac at colliertech.org> >>
127  
128 =head1 SUPPORT
129  
130 You can find documentation for this module with the perldoc command.
131  
132 perldoc Module::Starter
133  
134 You can also look for information at:
135  
136 =over 4
137  
138 =item * Source code at GitHub
139  
140 L<https://github.com/xsawyerx/module-starter>
141  
142 =item * GitHub issue tracker
143  
144 L<https://github.com/xsawyerx/module-starter/issues>
145  
146 =item * Search CPAN
147  
148 L<https://metacpan.org/release/Module-Starter>
149  
150 =back
151  
152 =head1 BUGS
153  
154 Please report any bugs or feature requests to the bugtracker for this project
155 on GitHub at: L<https://github.com/xsawyerx/module-starter/issues>. I will be
156 notified, and then you'll automatically be notified of progress on your bug
157 as I make changes.
158  
159 =head1 COPYRIGHT
160  
161 Copyright 2005-2009 Andy Lester, Ricardo Signes and C.J. Adams-Collier,
162 All Rights Reserved.
163  
164 Copyright 2010 Sawyer X, All Rights Reserved.
165  
166 This program is free software; you can redistribute it and/or modify it
167 under the same terms as Perl itself.
168  
169 =head1 SEE ALSO
170  
171 =over 4
172  
173 =item L<mbtiny>
174  
175 Minimal authoring tool to create and manage distributions using
176 L<Module::Build::Tiny> as an installer.
177  
178 =item L<Dist::Milla>
179  
180 Easy to use and powerful authoring tool using L<Dist::Zilla> to create and
181 manage distributions.
182  
183 =item L<Minilla>
184  
185 Authoring tool similar to L<Dist::Milla> but without using L<Dist::Zilla>.
186  
187 =item L<Dist::Zilla>
188  
189 Very complex, fully pluggable and customizable distribution builder.
190  
191 =back
192  
193 =cut
194  
195 1 1;
196  
197 # vi:et:sw=4 ts=4
« Starter/Simple.pm ↑ Summary Starter/BuilderSet.pm »