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   56647 use warnings;
  3         12  
  3         89  
5 3     3   12 use strict;
  3         5  
  3         55  
6 3     3   11 use Carp qw( croak );
  3         4  
  3         371  
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.8';
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   17 my $class = shift;
76 3 50       11 my @plugins = ((@_ ? @_ : 'Dist::Man::Simple'), $class);
77 3         17 my $parent;
78              
79 3         10 while (my $child = shift @plugins) {
80 6         263 eval "require $child";
81              
82 6 50       32 croak "couldn't load plugin $child: $@" if $@;
83              
84             ## no critic
85 3     3   25 no strict 'refs'; #Violates ProhibitNoStrict
  3         16  
  3         139  
86 6 100       14 push @{"${child}::ISA"}, $parent if $parent;
  3         29  
87 3     3   15 use strict 'refs';
  3         5  
  3         278  
88             ## use critic
89              
90 6 50 66     55 if ( @plugins && $child->can('load_plugins') ) {
91 0         0 $parent->load_plugins(@plugins);
92 0         0 last;
93             }
94 6         23 $parent = $child;
95             }
96              
97 3         37 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 * CPAN Ratings
126              
127             L
128              
129             =item * RT: CPAN's request tracker
130              
131             L
132              
133             =item * Search CPAN
134              
135             L
136              
137             =back
138              
139             =head1 BUGS
140              
141             Please report any bugs or feature requests to
142             C, or through the web interface at
143             L. I will be notified, and then you'll automatically be
144             notified of progress on your bug as I make changes.
145              
146             =head1 LICENSE
147              
148             Copyright 2005-2009 Andy Lester, Ricardo Signes and C.J. Adams-Collier,
149             All Rights Reserved.
150              
151             This program is free software; you can redistribute it and/or modify it
152             under the same terms as Perl itself.
153              
154             =head1 ADDITIONAL MODIFICATION TERMS
155              
156             Modified by Shlomi Fish, 2009 - all rights disclaimed - may be used under
157             any of the present or future terms of Module-Starter.
158              
159             =cut
160              
161             1;