/usr/share/perl5/Module/Starter/Plugin/Template.pm is in libmodule-starter-perl 1.730+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | package Module::Starter::Plugin::Template;
use warnings;
use strict;
use Carp qw( confess );
=head1 NAME
Module::Starter::Plugin::Template - module starter with templates
=head1 VERSION
Version 1.73
=cut
our $VERSION = '1.73';
=head1 SYNOPSIS
use Module::Starter qw(
Module::Starter::Simple
Module::Starter::Plugin::Template
);
Module::Starter->create_distro(%args);
=head1 DESCRIPTION
This plugin is designed to be added to a Module::Starter::Simple-compatible
Module::Starter class. It adds stub methods for template retrieval and
rendering, and it replaces all of Simple's _guts methods with methods that will
retrieve and render the appropriate templates.
=head1 CLASS METHODS
=head2 C<< new(%args) >>
This plugin calls the C<new> supermethod and then initializes the template
store and renderer. (See C<templates> and C<renderer> below.)
=cut
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->{templates} = { $self->templates };
$self->{renderer} = $self->renderer;
return bless $self => $class;
}
=head1 OBJECT METHODS
=head2 C<< templates() >>
This method is used to initialize the template store on the Module::Starter
object. It returns a hash of templates; each key is a filename and each value
is the body of the template. The filename F<Module.pm> is used for the module
template.
=cut
sub templates {
confess 'attempted to use abstract base templates method';
}
=head2 C<< renderer() >>
This method is used to initialize the template renderer. Its result is stored
in the object's C<renderer> entry. The implementation will determine its use.
=cut
sub renderer {
confess 'attempted to use abstract base renderer method';
}
=head2 C<< render($template, \%options) >>
The C<render> method will render the template passed to it, using the
data in the Module::Starter object and in the hash of passed parameters.
=cut
sub render {
my $self = shift;
my $template = shift;
my $options = shift;
confess 'attempted to use abstract base render method';
}
=head2 _guts methods
All of the C<FILE_guts> methods from Module::Starter::Simple are subclassed to
look something like this:
sub file_guts {
my $self = shift;
my %options;
@options{qw(first second third)} = @_;
my $template = $self->{templates}{filename};
$self->render($template, \%options);
}
These methods will need to be rewritten when (as is likely)
Module::Starter::Simple's _guts methods are refactored into a registry.
=over 4
=item module_guts
=cut
sub module_guts {
my $self = shift;
my %options;
@options{qw(module rtname)} = @_;
my $template = $self->{templates}{'Module.pm'};
$self->render($template, \%options);
}
=item Makefile_PL_guts
=cut
sub Makefile_PL_guts {
my $self = shift;
my %options;
@options{qw(main_module main_pm_file)} = @_;
my $template = $self->{templates}{'Makefile.PL'};
$self->render($template, \%options);
}
=item MI_Makefile_PL_guts
=cut
sub MI_Makefile_PL_guts {
my $self = shift;
my %options;
@options{qw(main_module main_pm_file)} = @_;
my $template = $self->{templates}{'MI_Makefile.PL'};
$self->render($template, \%options);
}
=item Build_PL_guts
=cut
sub Build_PL_guts {
my $self = shift;
my %options;
@options{qw(main_module main_pm_file)} = @_;
my $template = $self->{templates}{'Build.PL'};
$self->render($template, \%options);
}
=item Changes_guts
=cut
sub Changes_guts {
my $self = shift;
my $template = $self->{templates}{'Changes'};
$self->render($template);
}
=item README_guts
=cut
sub README_guts {
my $self = shift;
my %options;
@options{qw(build_instructions)} = @_;
my $template = $self->{templates}{'README'};
$self->render($template, \%options);
}
=item t_guts
=cut
sub t_guts {
my $self = shift;
my %options;
$options{modules} = [ @_ ];
my %t_files;
foreach (grep { /\.t$/ } keys %{$self->{templates}}) {
my $template = $self->{templates}{$_};
$t_files{$_} = $self->render($template, \%options);
}
return %t_files;
}
=item MANIFEST_guts
=cut
sub MANIFEST_guts {
my $self = shift;
my %options;
$options{files} = [ sort @_ ];
my $template = $self->{templates}{MANIFEST};
$self->render($template, \%options);
}
=item ignores_guts
=cut
sub ignores_guts {
my $self = shift;
my $template = $self->{templates}{ignores};
$self->render($template);
}
=back
=head1 AUTHOR
Ricardo SIGNES, C<< <rjbs at cpan.org> >>
=head1 Bugs
Please report any bugs or feature requests to the bugtracker for this project
on GitHub at: L<https://github.com/xsawyerx/module-starter/issues>. I will be
notified, and then you'll automatically be notified of progress on your bug
as I make changes.
=head1 COPYRIGHT
Copyright 2005-2007 Ricardo SIGNES, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
# vi:et:sw=4 ts=4
1;
|