Skip Menu |

This queue is for tickets about the Module-Starter-Plugin-TT2 CPAN distribution.

Report information
The Basics
Id: 46185
Status: open
Priority: 0/
Queue: Module-Starter-Plugin-TT2

People
Owner: Nobody in particular
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.125
Fixed in: (no value)



Subject: uninitialized value errors
I'm using Module::Starter v. 1.50. When using the TT2 plugin, I get the following error (multiple times): Use of uninitialized value in eval "string" at [...]/Module/Starter/Plugin/TT2.pm line 74. Line 74 is in renderer(): 72 sub renderer { 73 my ($self) = @_; 74 my $conf = (eval $self->{template_parms})||{}; 75 my $renderer = Template->new($conf); 76 } This the only reference to template_parms in the Module::Starter heirarchy that I can find. Is it orphaned code? Thanks, Diab
Yes, it appears to be. Patches welcome. -- rjbs
To my mind the parameter is in principle fine - it is meant to be passed to the Template module. However defaulting does not work because of the stray eval. I attach a patch to address this.
Subject: template_parms.patch
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); }