Hi Ken, I've tried this, and it works. How does it compare with what you're doing?
File test.pl ------------ #!/usr/bin/perl use warnings; use strict; use lib '.'; use Bar; Bar::foo(); File Bar.pm ----------- package Bar; use strict; use HTML::Template; sub foo { my $tmpl = HTML::Template->new (filehandle => *DATA); $tmpl->param(bar => 'works'); print $tmpl->output; } 1; __DATA__ foo <TMPL_VAR bar> baz ----- Carl >>> ken <[EMAIL PROTECTED]> 04/10/2004 11:43:16 >>> Carl Franks wrote: > > >>> <[EMAIL PROTECTED]> 02/10/2004 23:41:36 >>> > > > >Anyone ideas on what is going on? Any suggestions welcome. > > > >Thanks in advance, > >-Ken > > Hi Ken, > > Try this instead (below), noticed that I pass the DATA fileglob (*DATA) > directly to HTML::Template->new > > Carl > > #!/usr/bin/perl > use strict; > use warnings; > Foo->run(); > package Foo; > use HTML::Template; > sub run{ > my $template = HTML::Template->new(filehandle => *DATA, > die_on_bad_params=>1, strict=>1); > $template->param(VALUE=>'xx'); > print $template->output; > } > > 1; > __DATA__ > <html> > <head> > </head> > <body> > <TMPL_VAR NAME=VALUE> > </body> > </html> > [EMAIL PROTECTED] DBWebForm]$ ./Foo.pm > <html> > <head> > </head> > <body> > xx > </body> > </html> > This gives me the same result. I have tried using the __DATA__ as a filehandle directly, copying to a arrayref, and copying to a scallarref, but all yield the same results. I do notice that running the file directly (e.g. ./Foo.pm) works, while using the module (e.g. perl -MFoo) gives a syntax error. The odd thing is, I can find no difference in the contents of the template file between invocations. I am completely stumped. Thanks for the suggestion, though. -Ken ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users