File: template_parms.patch

package info (click to toggle)
libmodule-starter-plugin-tt2-perl 0.125-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 200 kB
  • ctags: 11
  • sloc: perl: 151; makefile: 5
file content (36 lines) | stat: -rw-r--r-- 1,386 bytes parent folder | download
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
Author: Nicholas Bamber <nicholas@periapt.co.uk>
Last-Update: 2010-11-01
Bug: http://rt.cpan.org/Ticket/Display.html?id=46185
Subject: Module author asked for patches for broken code
 djerius@cpan.org reported that if the template_parms parameter was not
 set in create_distro an error would be reported, but that the parameter was 
 not used elsewhere in the code. He went on to speculate that it might be
 orphan code. The module author thinks this might be corrected and requested
 patches.

 Code inspection reveals that the parameter does have meaning - it is passed 
 to the Template module where it may do all sorts of stuff. However this usage
 is broken because of a stray 'eval'. This patch documents the usage and removes
 the eval.
--- a/lib/Module/Starter/Plugin/TT2.pm
+++ b/lib/Module/Starter/Plugin/TT2.pm
@@ -64,6 +64,10 @@
 MODULE_TEMPLATE_MODULE environment variable, or using a different template
 store altogether (q.v., SimpleStore or other plugins).
 
+If you need to send parameters to the L<Template> constructor, put them
+in the C<template_parms> parameter to the C<create_distro> method. It must
+be a hash reference.
+
 =head1 METHODS
 
 =head2 C<< renderer >>
@@ -75,7 +79,7 @@
 
 sub renderer {
   my ($self) = @_;
-  my $conf = (eval $self->{template_parms})||{};
+  my $conf = $self->{template_parms} || {};
   my $renderer = Template->new($conf);
 }