Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Converting code to use DATA filehandle instead of external templates

by snoopy (Deacon)
on Nov 20, 2007 at 06:29 UTC ( #651863=note: print w/ replies, xml ) Need Help??


in reply to resolved: Converting code to use DATA filehandle instead of external templates

You just need to setup a DATA block and pass through filehandle => *DATA to HTML::Template

#!/usr/bin/perl use warnings; use strict; use HTML::Template; #------------ package Page; use base 'HTML::Template'; sub new { my $self = shift; my %args = @_; $self->SUPER::new(%args); } #------------ package main; my $template = Page->new(filehandle => *DATA) || die "Unable to open template"; $template->param(orb => 'world'); print $template->output; __DATA__ hello <TMPL_VAR orb>


Comment on Re: Converting code to use DATA filehandle instead of external templates
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://651863]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2014-12-26 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls