line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
765
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Module::Starter::Plugin::ModuleStore; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.144'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Carp (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
62
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Module::Starter::Plugin::ModuleStore -- store inline templates in modules |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
version 0.144 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Module::Starter qw( |
21
|
|
|
|
|
|
|
Module::Starter::Simple |
22
|
|
|
|
|
|
|
Module::Starter::Plugin::Template |
23
|
|
|
|
|
|
|
Module::Starter::Plugin::ModuleStore |
24
|
|
|
|
|
|
|
... |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Module::Starter->create_distro( ... ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This Module::Starter plugin is intended to be loaded after |
32
|
|
|
|
|
|
|
Module::Starter::Plugin::Template. It implements the C method, |
33
|
|
|
|
|
|
|
required by the Template plugin. It works like InlineStore, but instead of |
34
|
|
|
|
|
|
|
loading a physical file, loads the DATA section of a Perl module. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 C<< templates >> |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This method reads in the template module (described above) and populates the |
43
|
|
|
|
|
|
|
object's C attribute. The module template module is found by |
44
|
|
|
|
|
|
|
checking the MODULE_TEMPLATE_MODULE environment variable and then the |
45
|
|
|
|
|
|
|
"template_module" config option. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _template_filehandle { |
50
|
0
|
|
|
0
|
|
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
0
|
|
|
|
my $template_module = |
53
|
|
|
|
|
|
|
($ENV{MODULE_TEMPLATE_MODULE} || $self->{template_module}); |
54
|
0
|
0
|
|
|
|
|
eval "require $template_module" |
55
|
|
|
|
|
|
|
or Carp::croak "couldn't load template store module $template_module: $@"; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
1
|
|
4
|
no strict 'refs'; ## no critic NoStrict |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
161
|
|
58
|
0
|
|
|
|
|
|
return \*{"$template_module\::DATA"}; |
|
0
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub templates { |
62
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
63
|
0
|
|
|
|
|
|
my %template; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $template_file = $self->_template_filehandle; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $fn = q{_}; |
68
|
0
|
|
|
|
|
|
while (<$template_file>) { |
69
|
0
|
0
|
|
|
|
|
if (/^___([-_.0-9A-Za-z]+)___$/) { |
70
|
0
|
|
|
|
|
|
$fn = $1; |
71
|
0
|
|
|
|
|
|
$template{$fn} = q{}; |
72
|
0
|
|
|
|
|
|
next; |
73
|
|
|
|
|
|
|
} |
74
|
0
|
|
|
|
|
|
$template{$fn} .= $_; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
return %template; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Ricardo SIGNES, C<< >> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 Bugs |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
87
|
|
|
|
|
|
|
C, or through the web |
88
|
|
|
|
|
|
|
interface at L. I will be notified, and then you'll |
89
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Copyright 2004 Ricardo SIGNES, All Rights Reserved. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
96
|
|
|
|
|
|
|
under the same terms as Perl itself. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |