in reply to HTML::Template in a module's __DATA__ section
I can't seem to provoke the error message even when using your code. It works in both versions, well, after I put the "Foo->run();" statement into the second version. Otherwise your second version outputs nothing.
This is the code I was playing with:
which outputs#!/usr/bin/perl use strict; use warnings; Foo->run(); package Foo; use HTML::Template; sub run { my @html = <DATA>; my $template = HTML::Template->new( arrayref => \@html, strict => 1, + die_on_bad_params => 1 ); $template->param( VALUE => 'pick me - pick me!' ); print $template->output; } 1; __DATA__ <html> <head> </head> <body> <TMPL_VAR NAME=VALUE> </body> </html>
You might also want to upgrade to version 2.7. It is a couple years newer than the version 2.6 that you are running (but forgot to mention)<html> <head> </head> <body> pick me - pick me! </body> </html>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HTML::Template in a module's __DATA__ section
by Anonymous Monk on Sep 12, 2004 at 01:46 UTC |