File Coverage

blib/lib/Dist/Man.pm
Criterion Covered Total %
statement 26 28 92.8
branch 5 8 62.5
condition 2 3 66.6
subroutine 6 6 100.0
pod n/a
total 39 45 86.6


line stmt bran cond sub pod time code
1             package Dist::Man;
2             # vi:et:sw=4 ts=4
3              
4 3     3   51616 use warnings;
  3         7  
  3         115  
5 3     3   19 use strict;
  3         6  
  3         119  
6 3     3   29 use Carp qw( croak );
  3         6  
  3         3855  
7              
8             =head1 NAME
9              
10             Dist::Man - a simple starter kit for any module
11              
12             =head1 VERSION
13              
14             version 0.0.6
15              
16             =cut
17              
18             our $VERSION = '0.0.7';
19              
20             =head1 SYNOPSIS
21              
22             Nothing in here is meant for public consumption. Use F
23             from the command line.
24              
25             pl-dist-man create --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 Dist::Man. 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             Dist::Man 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 Dist::Man->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 'perl'
58             author => $author, # author's full name (required)
59             email => $email, # author's email address (required)
60              
61             verbose => $verbose, # bool: print progress messages; defaults to 0
62             force => $force # bool: overwrite existing files; defaults to 0
63              
64             =head1 PLUGINS
65              
66             Dist::Man itself doesn't actually do anything. It must load plugins that
67             implement C and other methods. This is done by the class's C
68             routine, which accepts a list of plugins to be loaded, in order.
69              
70             For more information, refer to L.
71              
72             =cut
73              
74             sub import {
75 3     3   34 my $class = shift;
76 3 50       15 my @plugins = ((@_ ? @_ : 'Dist::Man::Simple'), $class);
77 3         5 my $parent;
78              
79 3         13 while (my $child = shift @plugins) {
80 6         605 eval "require $child";
81              
82 6 50       35 croak "couldn't load plugin $child: $@" if $@;
83              
84             ## no critic
85 3     3   20 no strict 'refs'; #Violates ProhibitNoStrict
  3         4  
  3         149  
86 6 100       21 push @{"${child}::ISA"}, $parent if $parent;
  3         47  
87 3     3   20 use strict 'refs';
  3         5  
  3         362  
88             ## use critic
89              
90 6 50 66     84 if ( @plugins && $child->can('load_plugins') ) {
91 0         0 $parent->load_plugins(@plugins);
92 0         0 last;
93             }
94 6         31 $parent = $child;
95             }
96              
97 3         43 return;
98             }
99              
100             =head1 AUTHORS
101              
102             Shlomi Fish, L (while disclaiming any implicit
103             or explicit claims on the code).
104              
105             Andy Lester, C<< >>
106              
107             Ricardo Signes, C<< >>
108              
109             C.J. Adams-Collier, C<< >>
110              
111             =head1 SUPPORT
112              
113             You can find documentation for this module with the perldoc command.
114              
115             perldoc Dist::Man
116              
117             You can also look for information at:
118              
119             =over 4
120              
121             =item * Source code at Berlios.de
122              
123             B
124              
125             =item * AnnoCPAN: Annotated CPAN documentation
126              
127             L
128              
129             =item * CPAN Ratings
130              
131             L
132              
133             =item * RT: CPAN's request tracker
134              
135             L
136              
137             =item * Search CPAN
138              
139             L
140              
141             =back
142              
143             =head1 BUGS
144              
145             Please report any bugs or feature requests to
146             C, or through the web interface at
147             L. I will be notified, and then you'll automatically be
148             notified of progress on your bug as I make changes.
149              
150             =head1 LICENSE
151              
152             Copyright 2005-2009 Andy Lester, Ricardo Signes and C.J. Adams-Collier,
153             All Rights Reserved.
154              
155             This program is free software; you can redistribute it and/or modify it
156             under the same terms as Perl itself.
157              
158             =head1 ADDITIONAL MODIFICATION TERMS
159              
160             Modified by Shlomi Fish, 2009 - all rights disclaimed - may be used under
161             any of the present or future terms of Module-Starter.
162              
163             =cut
164              
165             1;