line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Starter::AddModule; |
2
|
1
|
|
|
1
|
|
759
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
18
|
use 5.010; |
|
1
|
|
|
|
|
53
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
7
|
1
|
|
|
1
|
|
5
|
no warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
612
|
use subs qw(); |
|
1
|
|
|
|
|
24
|
|
|
1
|
|
|
|
|
29
|
|
10
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
540
|
use parent qw(Module::Starter::Smart); |
|
1
|
|
|
|
|
307
|
|
|
1
|
|
|
|
|
6
|
|
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
0
|
BEGIN { |
15
|
|
|
|
|
|
|
package # hide package from PAUSE |
16
|
|
|
|
|
|
|
Module::Starter::Smart; |
17
|
1
|
|
|
1
|
|
16438
|
use parent qw(Module::Starter::Simple); |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
102
|
use Cwd; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
345
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$VERSION = '1.007'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=encoding utf8 |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Module::Starter::AddModule - Add a new module to a distribution |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SYNOPSIS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# in the module-starter config |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
plugins: Module::Starter::AddModule |
35
|
|
|
|
|
|
|
make: /whatever/make/you/like/dmake |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# from the command line |
38
|
|
|
|
|
|
|
# the --dist option specifies the dist directory |
39
|
|
|
|
|
|
|
% module-starter --module=Add::This::Module --dist=. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
C and C (which relies |
44
|
|
|
|
|
|
|
on C<::Simple>) try to construct the MANIFEST file themselves. This is |
45
|
|
|
|
|
|
|
the wrong approach since it doesn't not take into account build file |
46
|
|
|
|
|
|
|
subclasses or F. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Once you have the build file, let it do it's job by running its C |
49
|
|
|
|
|
|
|
target. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Furthermore, C doesn't explicitly inherit from |
52
|
|
|
|
|
|
|
C, but this module inserts the inheritance |
53
|
|
|
|
|
|
|
relationship for you automatically. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=over 4 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item create_MANIFEST |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Overrides the C in C to use |
60
|
|
|
|
|
|
|
the C target of the build system instead of trying to create |
61
|
|
|
|
|
|
|
the C file directly. It automatically figures out the build |
62
|
|
|
|
|
|
|
system you use. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This assumes that your C program is called C. If it's |
65
|
|
|
|
|
|
|
something else, such as C, set the C configuration. This |
66
|
|
|
|
|
|
|
only matters if you are using F. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub create_MANIFEST { |
71
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
require Distribution::Guess::BuildSystem; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $dist_dir = $self->basedir; |
76
|
0
|
0
|
|
|
|
|
die "The base directory" unless -d $dist_dir; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$self->progress( "Regenerating MANIFEST" ); |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
0
|
|
|
|
my $make = $self->{make} // 'make'; #/ |
81
|
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
eval { |
83
|
0
|
|
|
|
|
|
my $dir = cwd(); |
84
|
0
|
0
|
|
|
|
|
chdir $dist_dir or die "Could not change to $dist_dir: $!\n"; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $guesser = Distribution::Guess::BuildSystem->new( |
87
|
|
|
|
|
|
|
dist_dir => '.' |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# it doesn't matter who makes the MANIFEST |
91
|
0
|
0
|
0
|
|
|
|
if( $guesser->uses_module_build ) { |
|
|
0
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$self->verbose( "Detected Module::Build" ); |
93
|
0
|
|
|
|
|
|
system( $^X, 'Build.PL' ); |
94
|
0
|
|
|
|
|
|
system( $^X, 'Build', 'manifest' ); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
elsif( $guesser->uses_makemaker or $guesser->uses_module_install ) { |
97
|
0
|
|
|
|
|
|
$self->verbose( "Detected ExtUtils::Makemaker or Module::Install" ); |
98
|
0
|
|
|
|
|
|
system( $^X, 'Makefile.PL' ); |
99
|
0
|
|
|
|
|
|
system( $make, 'manifest' ); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
chdir $dir or die "Could not change back to $dir: $!\n"; |
103
|
|
|
|
|
|
|
} or die $@; |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
return 1; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item basedir |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Return the top-level directory for the distribution. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
0
|
1
|
|
sub basedir { $_[0]->{basedir} || '' } |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=back |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SEE ALSO |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SOURCE AVAILABILITY |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This source is in Github: |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
https://github.com/briandfoy/module-starter-addmodule/ |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 AUTHOR |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
brian d foy, C<< >> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Copyright © 2010-2021, brian d foy . All rights reserved. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
You may redistribute this under the terms of the Artistic License 2.0. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |