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 2     2   56696 use warnings;
  2         11  
  2         53  
4 2     2   9 use strict;
  2         3  
  2         46  
5 2     2   8 use Carp qw( croak );
  2         3  
  2         85  
6 2     2   939 use Module::Runtime qw( require_module );
  2         3045  
  2         10  
7              
8             =head1 NAME
9              
10             Module::Starter - a simple starter kit for any module
11              
12             =head1 VERSION
13              
14             Version 1.75
15              
16             =cut
17              
18             our $VERSION = '1.75';
19              
20             =head1 SYNOPSIS
21              
22             Nothing in here is meant for public consumption. Use F
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 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 => $author, # author's full name (taken from C if not provided)
59             email => $email, # author's email address (taken from C 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 and other methods. This is done by the class's C
83             routine, which accepts a list of plugins to be loaded, in order.
84              
85             For more information, refer to L.
86              
87             =cut
88              
89             sub import {
90 2     2   16 my $class = shift;
91 2 50       8 my @plugins = ((@_ ? @_ : 'Module::Starter::Simple'), $class);
92 2         4 my $parent;
93              
94 2         9 while (my $child = shift @plugins) {
95 4         11 require_module $child;
96              
97             ## no critic
98 2     2   187 no strict 'refs'; #Violates ProhibitNoStrict
  2         3  
  2         87  
99 4 100       66 push @{"${child}::ISA"}, $parent if $parent;
  2         19  
100 2     2   9 use strict 'refs';
  2         3  
  2         143  
101             ## use critic
102              
103 4 50 66     36 if ( @plugins && $child->can('load_plugins') ) {
104 0         0 $parent->load_plugins(@plugins);
105 0         0 last;
106             }
107 4         27 $parent = $child;
108             }
109              
110 2         35 return;
111             }
112              
113             =head1 AUTHORS
114              
115             Sawyer X, C<< >>
116              
117             Andy Lester, C<< >>
118              
119             Ricardo Signes, C<< >>
120              
121             C.J. Adams-Collier, C<< >>
122              
123             =head1 SUPPORT
124              
125             You can find documentation for this module with the perldoc command.
126              
127             perldoc Module::Starter
128              
129             You can also look for information at:
130              
131             =over 4
132              
133             =item * Source code at GitHub
134              
135             L
136              
137             =item * AnnoCPAN: Annotated CPAN documentation
138              
139             L
140              
141             =item * CPAN Ratings
142              
143             L
144              
145             =item * GitHub issue tracker
146              
147             L
148              
149             =item * Metacpan
150              
151             L
152              
153             =back
154              
155             =head1 BUGS
156              
157             Please report any bugs or feature requests to the bugtracker for this project
158             on GitHub at: L. I will be
159             notified, and then you'll automatically be notified of progress on your bug
160             as I make changes.
161              
162             =head1 COPYRIGHT
163              
164             Copyright 2005-2009 Andy Lester, Ricardo Signes and C.J. Adams-Collier,
165             All Rights Reserved.
166              
167             Copyright 2010 Sawyer X, All Rights Reserved.
168              
169             This program is free software; you can redistribute it and/or modify it
170             under the same terms as Perl itself.
171              
172             =head1 SEE ALSO
173              
174             =over 4
175              
176             =item L
177              
178             Minimal authoring tool to create and manage distributions using
179             L as an installer.
180              
181             =item L
182              
183             Easy to use and powerful authoring tool using L to create and
184             manage distributions.
185              
186             =item L
187              
188             Authoring tool similar to L but without using L.
189              
190             =item L
191              
192             Very complex, fully pluggable and customizable distribution builder.
193              
194             =back
195              
196             =cut
197              
198             1;
199              
200             # vi:et:sw=4 ts=4