line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
18650
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Module::Starter::Plugin::DirStore; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.144'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Carp (); |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
12
|
|
9
|
1
|
|
|
1
|
|
5
|
use File::Basename; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
328
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Module::Starter::Plugin::DirStore -- module template files in a directory |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
version 0.144 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Module::Starter qw( |
22
|
|
|
|
|
|
|
Module::Starter::Simple |
23
|
|
|
|
|
|
|
Module::Starter::Plugin::Template |
24
|
|
|
|
|
|
|
Module::Starter::Plugin::DirStore |
25
|
|
|
|
|
|
|
... |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Module::Starter->create_distro( ... ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This Module::Starter plugin is intended to be loaded after |
33
|
|
|
|
|
|
|
Module::Starter::Plugin::Template. It implements the C method, |
34
|
|
|
|
|
|
|
required by the Template plugin. The C plugin stores all the |
35
|
|
|
|
|
|
|
required templates as files in a directory. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 C<< templates >> |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This method reads in the template files and populates the object's C |
44
|
|
|
|
|
|
|
attribute. The module template directory is found by checking the |
45
|
|
|
|
|
|
|
MODULE_TEMPLATE_DIR environment variable and then the config option |
46
|
|
|
|
|
|
|
"template_dir". |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub templates { |
51
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
52
|
0
|
|
|
|
|
|
my %template; |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
0
|
|
|
|
my $template_dir = ($ENV{MODULE_TEMPLATE_DIR} || $self->{template_dir}) |
55
|
|
|
|
|
|
|
or Carp::croak "template dir not defined"; |
56
|
0
|
0
|
|
|
|
|
Carp::croak "template dir does not exist: $template_dir" |
57
|
|
|
|
|
|
|
unless -d $template_dir; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
foreach (glob "$template_dir/*") { |
60
|
0
|
|
|
|
|
|
my $basename = basename $_; |
61
|
0
|
0
|
0
|
|
|
|
next if (not -f $_) or ($basename =~ /^\./); |
62
|
0
|
0
|
|
|
|
|
open my $template_file, '<', $_ |
63
|
|
|
|
|
|
|
or Carp::croak "couldn't open template: $_"; |
64
|
0
|
|
|
|
|
|
$template{$basename} = do { |
65
|
0
|
|
|
|
|
|
local $/ = undef; |
66
|
0
|
|
|
|
|
|
<$template_file>; |
67
|
|
|
|
|
|
|
}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
return %template; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Ricardo SIGNES, C<< >> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 Bugs |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
80
|
|
|
|
|
|
|
C, or through the web |
81
|
|
|
|
|
|
|
interface at L. I will be notified, and then you'll |
82
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Copyright 2004 Ricardo SIGNES, All Rights Reserved. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
89
|
|
|
|
|
|
|
under the same terms as Perl itself. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |