line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
597620
|
use strict; |
|
6
|
|
|
|
|
37
|
|
|
6
|
|
|
|
|
628
|
|
2
|
6
|
|
|
6
|
|
44
|
use warnings; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
713
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package ExtUtils::ModuleMaker::TT; |
5
|
|
|
|
|
|
|
# ABSTRACT: Makes skeleton modules with Template Toolkit templates (UNMAINTAINED) |
6
|
|
|
|
|
|
|
our $VERSION = '0.94'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
6783
|
use Path::Class 0.15; |
|
6
|
|
|
|
|
253212
|
|
|
6
|
|
|
|
|
542
|
|
9
|
6
|
|
|
6
|
|
9595
|
use Template 2.14; |
|
6
|
|
|
|
|
243301
|
|
|
6
|
|
|
|
|
12167
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# predeclare |
12
|
|
|
|
|
|
|
our %templates; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _get_dir_and_file { |
15
|
2
|
|
|
2
|
|
4
|
my $module = shift; |
16
|
2
|
|
|
|
|
9
|
my @layers = split( /::/, $module->{NAME} ); |
17
|
2
|
|
|
|
|
7
|
my $file = pop(@layers) . '.pm'; |
18
|
2
|
|
|
|
|
5
|
my $dir = join( '/', 'lib', @layers ); |
19
|
2
|
|
|
|
|
7
|
return ($dir, $file); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub build_single_pm { |
23
|
2
|
|
|
2
|
1
|
2595
|
my ($self, $module) = @_; |
24
|
2
|
|
|
|
|
4
|
my $module_object; |
25
|
|
|
|
|
|
|
|
26
|
2
|
50
|
|
|
|
7
|
if ( ref($module) ) { |
27
|
2
|
50
|
|
|
|
7
|
if ( $module == $self) { |
28
|
0
|
|
|
|
|
0
|
$module_object = $module; |
29
|
|
|
|
|
|
|
} else { |
30
|
2
|
|
|
|
|
3
|
$module_object = { %{$self}, %{$module} }; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
34
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} else { |
33
|
0
|
|
|
|
|
0
|
$module_object = { %{$self}, NAME => $module }; |
|
0
|
|
|
|
|
0
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# To support calling this function on a standalone basis, look upwards |
37
|
|
|
|
|
|
|
# for a base directory |
38
|
|
|
|
|
|
|
# (abs->rel) is a workaround to drop the volume on MSWin32 |
39
|
2
|
|
|
|
|
14
|
my $orig_wd = my $cwd = dir()->absolute; |
40
|
2
|
|
|
|
|
459
|
my $root_dir = dir(q{})->absolute; |
41
|
2
|
100
|
|
|
|
121
|
unless ($self->{Base_Dir}) { |
42
|
1
|
|
|
|
|
6
|
while (! $cwd->subsumes($root_dir)) { |
43
|
4
|
|
|
|
|
1077
|
chdir $cwd; |
44
|
4
|
100
|
66
|
|
|
184
|
if ( -e 'MANIFEST' and -d 'lib' ) { |
45
|
1
|
|
|
|
|
3
|
$self->{Base_Dir} = $cwd; |
46
|
1
|
|
|
|
|
2
|
last; |
47
|
|
|
|
|
|
|
} |
48
|
3
|
|
|
|
|
10
|
$cwd = $cwd->parent; |
49
|
|
|
|
|
|
|
} |
50
|
1
|
|
|
|
|
3
|
chdir $orig_wd; |
51
|
1
|
50
|
|
|
|
34
|
$self->death_message(["Can't locate base directory"]) |
52
|
|
|
|
|
|
|
unless $self->{Base_Dir}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
2
|
|
|
|
|
12
|
my ( $dir, $file ) = _get_dir_and_file( $module_object ); |
56
|
2
|
|
|
|
|
12
|
$self->create_directory( dir($self->{Base_Dir}, $dir )); |
57
|
|
|
|
|
|
|
|
58
|
2
|
|
|
|
|
307
|
$module_object->{new_method} = $self->build_single_method('new'); |
59
|
|
|
|
|
|
|
# hack to remove subroutine bit -- a real new sub is in module.pm template |
60
|
2
|
|
|
|
|
88
|
$module_object->{new_method} =~ s/sub new {.*}\n//s; |
61
|
|
|
|
|
|
|
# hack to add class name to call new in example |
62
|
2
|
|
|
|
|
16
|
$module_object->{new_method} =~ s/\$rv = /\$rv = $module_object->{NAME}->/s; |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
12
|
$self->print_file( |
65
|
|
|
|
|
|
|
file( $dir, $file ), |
66
|
|
|
|
|
|
|
$self->text_pm_file( $module_object ) |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
2
|
|
|
|
|
753
|
(my $clean_name = $module_object->{NAME} ) =~ s/::/_/g; |
70
|
2
|
|
|
|
|
11
|
my $testfile = file( "t", $clean_name . ".t" ); |
71
|
2
|
|
|
|
|
204
|
$self->print_file( |
72
|
|
|
|
|
|
|
$testfile, |
73
|
|
|
|
|
|
|
$self->text_test( $clean_name, $module_object ) |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
2
|
|
|
|
|
676
|
chdir $orig_wd; |
77
|
2
|
|
|
|
|
109
|
return 1; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub build_single_method { |
81
|
2
|
|
|
2
|
1
|
34
|
my ($self,$method_name) = @_; |
82
|
2
|
|
|
|
|
5
|
my $results; |
83
|
|
|
|
|
|
|
|
84
|
2
|
50
|
|
|
|
18
|
my $tt = ( $self->{'TEMPLATE_DIR'} ? |
|
|
50
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Template->new({'INCLUDE_PATH' => $self->{'TEMPLATE_DIR'} }) : |
86
|
|
|
|
|
|
|
Template->new() ) |
87
|
|
|
|
|
|
|
or $self->death_message([ "Template error: $Template::ERROR" ]); |
88
|
2
|
|
|
|
|
1007
|
my $template_text = $templates{'method'}; |
89
|
2
|
|
|
|
|
52
|
$tt->process( $self->{'TEMPLATE_DIR'} ? 'method' : \$template_text, |
90
|
2
|
50
|
|
|
|
8
|
{ %{ $self }, method_name => $method_name }, \$results ) |
|
|
50
|
|
|
|
|
|
91
|
|
|
|
|
|
|
or $self->death_message([ "Could not write method '$method_name': " |
92
|
|
|
|
|
|
|
. $tt->error() ]); |
93
|
2
|
|
|
|
|
10222
|
return $results; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
98
|
|
|
|
|
|
|
# subclassing ExtUtils::ModuleMaker::StandardText |
99
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub text_README { |
103
|
3
|
|
|
3
|
0
|
4789
|
my $self = shift; |
104
|
3
|
|
|
|
|
23
|
return $self->process_template( 'README', $self ); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub text_Todo { |
108
|
3
|
|
|
3
|
0
|
1545
|
my $self = shift; |
109
|
3
|
|
|
|
|
16
|
return $self->process_template( 'Todo', $self ); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub text_Changes { |
113
|
3
|
|
|
3
|
0
|
645
|
my $self = shift; |
114
|
3
|
|
|
|
|
13
|
return $self->process_template( 'Changes', $self ); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub text_test { |
118
|
5
|
|
|
5
|
0
|
1192
|
my ( $self, $test_filename, $module_data ) = @_; |
119
|
5
|
|
|
|
|
20
|
return $self->process_template( 'test.t', $module_data ); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub text_test_multi { |
123
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $testfilename, $pmfilesref ) = @_; |
124
|
0
|
|
|
|
|
0
|
my @pmfiles = @{$pmfilesref}; |
|
0
|
|
|
|
|
0
|
|
125
|
0
|
|
|
|
|
0
|
return $self->process_template( 'test.t', $self ); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub text_Makefile { |
129
|
1
|
|
|
1
|
0
|
210
|
my $self = shift; |
130
|
1
|
|
|
|
|
4
|
return $self->process_template( 'Makefile.PL', $self ); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub text_Buildfile { |
135
|
2
|
|
|
2
|
0
|
452
|
my $self = shift; |
136
|
2
|
|
|
|
|
8
|
return $self->process_template( 'Build.PL', $self ); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub text_proxy_makefile { |
140
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
141
|
0
|
|
|
|
|
0
|
return $self->process_template( 'Proxy_Makefile.PL', $self ); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub text_MANIFEST_SKIP { |
145
|
3
|
|
|
3
|
0
|
721
|
my $self = shift; |
146
|
3
|
|
|
|
|
18
|
return $self->process_template( 'MANIFEST.SKIP', $self ); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub text_pod_coverage_test { |
150
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
151
|
0
|
|
|
|
|
0
|
return $self->process_template( 'pod_coverage.t', $self ); |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub text_pod_test { |
155
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
156
|
0
|
|
|
|
|
0
|
return $self->process_template( 'pod.t', $self ); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub text_pm_file { |
160
|
5
|
|
|
5
|
0
|
1968
|
my $self = shift; |
161
|
5
|
|
|
|
|
11
|
my $module_data = shift; |
162
|
|
|
|
|
|
|
|
163
|
5
|
|
|
|
|
22
|
return $self->process_template( 'module.pm', $module_data ); |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
167
|
|
|
|
|
|
|
# Template handling |
168
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub create_template_directory { |
171
|
1
|
|
|
1
|
1
|
9963
|
my ($class, $dir) = @_; |
172
|
1
|
|
|
|
|
17
|
dir($dir)->mkpath; |
173
|
1
|
|
|
|
|
546
|
for my $template ( keys %templates ) { |
174
|
12
|
|
|
|
|
112
|
my $target = dir($dir, $template); |
175
|
12
|
50
|
|
|
|
2647
|
open (FILE, ">", $target) or croak ("Could not write '$target', $!"); |
176
|
12
|
|
|
|
|
1321
|
print FILE ( $templates{$template} ); |
177
|
12
|
|
|
|
|
531
|
close FILE; |
178
|
|
|
|
|
|
|
} |
179
|
1
|
|
|
|
|
23
|
return 1; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub process_template { |
183
|
25
|
|
|
25
|
1
|
58
|
my ($self, $template, $data) = @_; |
184
|
25
|
50
|
|
|
|
223
|
my $tt = ( $self->{'TEMPLATE_DIR'} ? |
|
|
50
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Template->new({'INCLUDE_PATH' => $self->{'TEMPLATE_DIR'} }) : |
186
|
|
|
|
|
|
|
Template->new() ) |
187
|
|
|
|
|
|
|
or $self->death_message([ "Template error: $Template::ERROR" ]); |
188
|
25
|
|
|
|
|
92641
|
my $template_text = $templates{$template}; |
189
|
25
|
|
|
|
|
43
|
my $output_text; |
190
|
25
|
50
|
|
|
|
144
|
$tt->process( $self->{'TEMPLATE_DIR'} ? $template : \$template_text, |
|
|
50
|
|
|
|
|
|
191
|
|
|
|
|
|
|
$data, \$output_text ) |
192
|
|
|
|
|
|
|
or $self->death_message([ |
193
|
|
|
|
|
|
|
"Could not generate $template contents: " . $tt->error() |
194
|
|
|
|
|
|
|
]); |
195
|
25
|
|
|
|
|
221691
|
return $output_text; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
#-------------------------------------------------------------------------# |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
$templates{'README'} = <<'EOF'; |
201
|
|
|
|
|
|
|
If this is still here it means the programmer was too lazy to create the readme file. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
You can create it now by using the command shown below from this directory: |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
pod2text [% NAME %] > README |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
At the very least you should be able to use this set of instructions |
208
|
|
|
|
|
|
|
to install the module... |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
[%- IF BUILD_SYSTEM == 'ExtUtils::MakeMaker' -%] |
211
|
|
|
|
|
|
|
perl Makefile.PL |
212
|
|
|
|
|
|
|
make |
213
|
|
|
|
|
|
|
make test |
214
|
|
|
|
|
|
|
make install |
215
|
|
|
|
|
|
|
[%- ELSE -%] |
216
|
|
|
|
|
|
|
perl Build.PL |
217
|
|
|
|
|
|
|
perl Build |
218
|
|
|
|
|
|
|
perl Build test |
219
|
|
|
|
|
|
|
perl Build install |
220
|
|
|
|
|
|
|
[%- END -%] |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
If you are on a windows box you should use 'nmake' rather than 'make'. |
223
|
|
|
|
|
|
|
EOF |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
#-------------------------------------------------------------------------# |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
$templates{'Changes'} = <<'EOF'; |
228
|
|
|
|
|
|
|
Revision history for Perl module [% NAME %] |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
[% VERSION %] [% timestamp %] |
231
|
|
|
|
|
|
|
- original skeleton created with ExtUtils::ModuleMaker::TT |
232
|
|
|
|
|
|
|
EOF |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
$templates{'Todo'} = <<'EOF'; |
235
|
|
|
|
|
|
|
TODO list for Perl module [% NAME %] |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
- Nothing yet |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
EOF |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
#-------------------------------------------------------------------------# |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
$templates{'Build.PL'} = <<'EOF'; |
244
|
|
|
|
|
|
|
use Module::Build; |
245
|
|
|
|
|
|
|
# See perldoc Module::Build for details of how this works |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Module::Build->new( |
248
|
|
|
|
|
|
|
module_name => '[% NAME %]', |
249
|
|
|
|
|
|
|
dist_author => '[% AUTHOR %] <[% EMAIL %]>', |
250
|
|
|
|
|
|
|
[%- IF LICENSE.match('perl|gpl|artistic') %] |
251
|
|
|
|
|
|
|
license => '[% LICENSE %]', |
252
|
|
|
|
|
|
|
[%- END %] |
253
|
|
|
|
|
|
|
create_readme => 1, |
254
|
|
|
|
|
|
|
create_makefile_pl => 'traditional', |
255
|
|
|
|
|
|
|
requires => { |
256
|
|
|
|
|
|
|
# module requirements here |
257
|
|
|
|
|
|
|
}, |
258
|
|
|
|
|
|
|
build_requires => { |
259
|
|
|
|
|
|
|
Test::Simple => 0.44, |
260
|
|
|
|
|
|
|
}, |
261
|
|
|
|
|
|
|
)->create_build_script; |
262
|
|
|
|
|
|
|
EOF |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
#-------------------------------------------------------------------------# |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
$templates{'Makefile.PL'} = <<'EOF'; |
267
|
|
|
|
|
|
|
use ExtUtils::MakeMaker; |
268
|
|
|
|
|
|
|
# See lib/ExtUtils/MakeMaker.pm for details of how to influence |
269
|
|
|
|
|
|
|
# the contents of the Makefile that is written. |
270
|
|
|
|
|
|
|
WriteMakefile( |
271
|
|
|
|
|
|
|
NAME => '[% NAME %]', |
272
|
|
|
|
|
|
|
VERSION_FROM => '[% FILE %]', # finds $VERSION |
273
|
|
|
|
|
|
|
AUTHOR => '[% AUTHOR %] ([% EMAIL %])', |
274
|
|
|
|
|
|
|
ABSTRACT => '[% ABSTRACT %]', |
275
|
|
|
|
|
|
|
PREREQ_PM => { |
276
|
|
|
|
|
|
|
'Test::Simple' => 0.44, |
277
|
|
|
|
|
|
|
}, |
278
|
|
|
|
|
|
|
); |
279
|
|
|
|
|
|
|
EOF |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
#-------------------------------------------------------------------------# |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
$templates{'Proxy_Makefile.PL'} = <<'EOF'; |
284
|
|
|
|
|
|
|
unless (eval "use Module::Build::Compat 0.02; 1" ) { |
285
|
|
|
|
|
|
|
print "This module requires Module::Build to install itself.\n"; |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
require ExtUtils::MakeMaker; |
288
|
|
|
|
|
|
|
my $yn = ExtUtils::MakeMaker::prompt |
289
|
|
|
|
|
|
|
(' Install Module::Build from CPAN?', 'y'); |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
if ($yn =~ /^y/i) { |
292
|
|
|
|
|
|
|
require Cwd; |
293
|
|
|
|
|
|
|
require File::Spec; |
294
|
|
|
|
|
|
|
require CPAN; |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
# Save this 'cause CPAN will chdir all over the place. |
297
|
|
|
|
|
|
|
my $cwd = Cwd::cwd(); |
298
|
|
|
|
|
|
|
my $makefile = File::Spec->rel2abs($0); |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
CPAN::Shell->install('Module::Build::Compat'); |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
chdir $cwd or die "Cannot chdir() back to $cwd: $!"; |
303
|
|
|
|
|
|
|
exec $^X, $makefile, @ARGV; # Redo now that we have Module::Build |
304
|
|
|
|
|
|
|
} else { |
305
|
|
|
|
|
|
|
warn " *** Cannot install without Module::Build. Exiting ...\n"; |
306
|
|
|
|
|
|
|
exit 1; |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
Module::Build::Compat->run_build_pl(args => \@ARGV); |
310
|
|
|
|
|
|
|
Module::Build::Compat->write_makefile(); |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
EOF |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
#-------------------------------------------------------------------------# |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
$templates{'MANIFEST.SKIP'} = <<'EOF'; |
317
|
|
|
|
|
|
|
# Version control files and dirs. |
318
|
|
|
|
|
|
|
\bRCS\b |
319
|
|
|
|
|
|
|
\bCVS\b |
320
|
|
|
|
|
|
|
,v$ |
321
|
|
|
|
|
|
|
.svn/ |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
# ExtUtils::MakeMaker generated files and dirs. |
324
|
|
|
|
|
|
|
^MANIFEST\.(?!SKIP) |
325
|
|
|
|
|
|
|
^Makefile$ |
326
|
|
|
|
|
|
|
^blib/ |
327
|
|
|
|
|
|
|
^blibdirs$ |
328
|
|
|
|
|
|
|
^PM_to_blib$ |
329
|
|
|
|
|
|
|
^MakeMaker-\d |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
# Module::Build |
332
|
|
|
|
|
|
|
^Build$ |
333
|
|
|
|
|
|
|
^_build |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
# Temp, old, vi and emacs files. |
336
|
|
|
|
|
|
|
~$ |
337
|
|
|
|
|
|
|
\.old$ |
338
|
|
|
|
|
|
|
^#.*#$ |
339
|
|
|
|
|
|
|
^\.# |
340
|
|
|
|
|
|
|
\.swp$ |
341
|
|
|
|
|
|
|
\.bak$ |
342
|
|
|
|
|
|
|
EOF |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
#-------------------------------------------------------------------------# |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
$templates{'test.t'} = <<'EOF'; |
347
|
|
|
|
|
|
|
# [% NAME %] - check module loading and create testing directory |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
use Test::More tests => [% IF NEED_NEW_METHOD %] 2 [% ELSE %] 1 [% END %]; |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
BEGIN { use_ok( '[% NAME %]' ); } |
352
|
|
|
|
|
|
|
[% IF NEED_NEW_METHOD %] |
353
|
|
|
|
|
|
|
my $object = [% NAME %]->new (); |
354
|
|
|
|
|
|
|
isa_ok ($object, '[% NAME %]'); |
355
|
|
|
|
|
|
|
[%- END %] |
356
|
|
|
|
|
|
|
EOF |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
#-------------------------------------------------------------------------# |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
$templates{'module.pm'} = <<'EOF'; |
361
|
|
|
|
|
|
|
package [% NAME %]; |
362
|
|
|
|
|
|
|
use strict; |
363
|
|
|
|
|
|
|
use warnings; |
364
|
|
|
|
|
|
|
use Carp; |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
BEGIN { |
367
|
|
|
|
|
|
|
use Exporter (); |
368
|
|
|
|
|
|
|
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
369
|
|
|
|
|
|
|
$VERSION = "0.92"; |
370
|
|
|
|
|
|
|
@ISA = qw (Exporter); |
371
|
|
|
|
|
|
|
@EXPORT = qw (); |
372
|
|
|
|
|
|
|
@EXPORT_OK = qw (); |
373
|
|
|
|
|
|
|
%EXPORT_TAGS = (); |
374
|
|
|
|
|
|
|
} |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
[%- IF NEED_POD %] |
377
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
378
|
|
|
|
|
|
|
# main pod documentation |
379
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
# Below is the stub of documentation for your module. You better edit it! |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
!=head1 NAME |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
[% NAME %] - Put abstract here |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
!=head1 SYNOPSIS |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
use [% NAME %]; |
390
|
|
|
|
|
|
|
blah blah blah |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
!=head1 DESCRIPTION |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
Description... |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
!=head1 USAGE |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
Usage... |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
!=cut |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
[% END %] |
403
|
|
|
|
|
|
|
[%- IF NEED_NEW_METHOD -%] |
404
|
|
|
|
|
|
|
[% new_method -%] |
405
|
|
|
|
|
|
|
sub new { |
406
|
|
|
|
|
|
|
my ($class, $parameters) = @_; |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
croak "new() can't be invoked on an object" |
409
|
|
|
|
|
|
|
if ref($class); |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
my $self = bless ({ }, $class); |
412
|
|
|
|
|
|
|
return $self; |
413
|
|
|
|
|
|
|
} |
414
|
|
|
|
|
|
|
[% END %] |
415
|
|
|
|
|
|
|
1; #this line is important and will help the module return a true value |
416
|
|
|
|
|
|
|
__END__ |