File Coverage

blib/lib/Module/Starter.pm
Criterion Covered Total %
statement 28 30 93.3
branch 4 6 66.6
condition 2 3 66.6
subroutine 7 7 100.0
pod n/a
total 41 46 89.1


line stmt bran cond sub pod time code
1             package Module::Starter;
2              
3 1     1   159875 use warnings;
  1         2  
  1         76  
4 1     1   15 use strict;
  1         3  
  1         39  
5 1     1   6 use Carp qw( croak );
  1         2  
  1         172  
6 1     1   2632 use Module::Runtime qw( require_module );
  1         3853  
  1         8  
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             our $VERSION = '1.82';
19              
20             =head1 SYNOPSIS
21              
22             Nothing in here is meant for public consumption. Use L
23             from the command line.
24              
25             module-starter --module=Foo::Bar,Foo::Bat \
26             --author="Andy Lester "
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 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.
37              
38             =head1 METHODS
39              
40             =head2 Module::Starter->create_distro(%args)
41              
42             C 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
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 and other methods. This is done by the class's C
86             routine, which accepts a list of plugins to be loaded, in order.
87              
88             For more information, refer to L.
89              
90             =cut
91              
92             sub import {
93 1     1   11 my $class = shift;
94 1 50       10 my @plugins = ((@_ ? @_ : 'Module::Starter::Simple'), $class);
95 1         4 my $parent;
96              
97 1         6 while (my $child = shift @plugins) {
98 2         10 require_module $child;
99              
100             ## no critic
101 1     1   164 no strict 'refs'; #Violates ProhibitNoStrict
  1         5  
  1         79  
102 2 100       53 push @{"${child}::ISA"}, $parent if $parent;
  1         14  
103 1     1   6 use strict 'refs';
  1         3  
  1         141  
104             ## use critic
105              
106 2 50 66     38 if ( @plugins && $child->can('load_plugins') ) {
107 0         0 $parent->load_plugins(@plugins);
108 0         0 last;
109             }
110 2         11 $parent = $child;
111             }
112              
113 1         44 return;
114             }
115              
116             =head1 AUTHORS
117              
118             Dan Book, C<< >>
119              
120             Sawyer X, C<< >>
121              
122             Andy Lester, C<< >>
123              
124             Ricardo Signes, C<< >>
125              
126             C.J. Adams-Collier, C<< >>
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
141              
142             =item * GitHub issue tracker
143              
144             L
145              
146             =item * Search CPAN
147              
148             L
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. 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
174              
175             Minimal authoring tool to create and manage distributions using
176             L as an installer.
177              
178             =item L
179              
180             Easy to use and powerful authoring tool using L to create and
181             manage distributions.
182              
183             =item L
184              
185             Authoring tool similar to L but without using L.
186              
187             =item L
188              
189             Very complex, fully pluggable and customizable distribution builder.
190              
191             =back
192              
193             =cut
194              
195             1;
196              
197             # vi:et:sw=4 ts=4