in reply to HTML::Template in a module's __DATA__ section

I think <DATA> always reads from the __DATA__/__END__ in the startup file. (You could test this yourself by copying the template into the .pl file.) You could do the following instead of using <DATA>:

my @html = <<'__EOD__' =~ m#(.*?$/)#g; <html> <head> </head> <body> <TMPL_VAR NAME=VALUE> </body> </html> __EOD__

Replies are listed 'Best First'.
Re^2: HTML::Template in a module's __DATA__ section
by Anonymous Monk on Sep 12, 2004 at 01:34 UTC
    Actually, the __DATA__ section seems to be read in just fine, hence the syntax error on the template tag. I have tried to test this by printing and examining the contents before sending to the HTML::Template constructor, and it looks perfectly normal. I have solved the immediate issue by just creating a method that returns the template as a scalar, but I am still very curious as to why this did not work as I had expected.

    (I also tried using <Foo::DATA> to ensure that the correct package was being read.)

    Thanks for the reply, and any other suggestions are welcome.