Oddness when using PERL directive

Neil Bowers <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <[email protected]>
Hi,

I use TT2 to build my articles with CPAN module reviews. For each module I write one or more scripts which illustrate use of the module. A marked extract of the script is included into the article, followed by output, which is generated using the PERL block. Here's an example:

<pre>[% INCLUDE 'constant-generate-dualvar.pl' | extract_code %]</pre>

<p>Which produces the output:</p>

<pre>[% PERL %][% INCLUDE 'constant-generate-dualvar.pl' %][% END %]</pre>

For the module Constant::Generate I have a number of scripts, which worked fine until I hit one for the dualvar interface, used in the example above. Here's the script:

#!/usr/local/bin/perl

use warnings;
use strict;
my $value;

# START CODE
use Constant::Generate [qw(COFFEE TEA HOTCHOC)], stringy_vars => 1;
$value = TEA;
printf "value(int) = %d\n", $value;
printf "value(str) = %s\n", $value;
# END CODE

I can run this fine on the command-line:

% ./constant-generate-dualvar.pl
value(int) = 1
value(str) = TEA

But TT doesn't like it, and I end up with blank output. Am I missing something here? I've extracted the relevant code from my processor, which is attached.

If not, any suggestions for how I can work out what's happening? Turning on debug doesn't help me any, and I can't see any bugs listed in RT which would explain this behaviour.

cheers,
Neil

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.