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   71678 use warnings;
  1         12  
  1         33  
4 1     1   6 use strict;
  1         2  
  1         37  
5 1     1   6 use Carp qw( croak );
  1         2  
  1         56  
6 1     1   572 use Module::Runtime qw( require_module );
  1         1871  
  1         6  
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             our $VERSION = '1.77';
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" --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 1     1   9 my $class = shift;
91 1 50       5 my @plugins = ((@_ ? @_ : 'Module::Starter::Simple'), $class);
92 1         3 my $parent;
93              
94 1         4 while (my $child = shift @plugins) {
95 2         7 require_module $child;
96              
97             ## no critic
98 1     1   117 no strict 'refs'; #Violates ProhibitNoStrict
  1         3  
  1         51  
99 2 100       38 push @{"${child}::ISA"}, $parent if $parent;
  1         11  
100 1     1   6 use strict 'refs';
  1         2  
  1         88  
101             ## use critic
102              
103 2 50 66     23 if ( @plugins && $child->can('load_plugins') ) {
104 0         0 $parent->load_plugins(@plugins);
105 0         0 last;
106             }
107 2         8 $parent = $child;
108             }
109              
110 1         26 return;
111             }
112              
113             =head1 AUTHORS
114              
115             Dan Book, C<< >>
116              
117             Sawyer X, C<< >>
118              
119             Andy Lester, C<< >>
120              
121             Ricardo Signes, C<< >>
122              
123             C.J. Adams-Collier, C<< >>
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
138              
139             =item * CPAN Ratings
140              
141             L
142              
143             =item * GitHub issue tracker
144              
145             L
146              
147             =item * Search CPAN
148              
149             L
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. 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
175              
176             Minimal authoring tool to create and manage distributions using
177             L as an installer.
178              
179             =item L
180              
181             Easy to use and powerful authoring tool using L to create and
182             manage distributions.
183              
184             =item L
185              
186             Authoring tool similar to L but without using L.
187              
188             =item L
189              
190             Very complex, fully pluggable and customizable distribution builder.
191              
192             =back
193              
194             =cut
195              
196             1;
197              
198             # vi:et:sw=4 ts=4