Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: HTML::Template output to scalar or array

by jonnyfolk (Vicar)
on Oct 11, 2005 at 21:02 UTC ( #499278=note: print w/ replies, xml ) Need Help??


in reply to Re: HTML::Template output to scalar or array
in thread HTML::Template output to scalar or array

I tried this:

my $template = HTML::Template->new(filename => $prepage, die_on_bad_par +ams => 0); $template->param(Option_3 => $Option_3); $template->param(Option_4 => $Option_4); $template->param(Option_5 => $Option_5); $template->output(); print "$template"; exit;
But it results in a blank screen. what have I misunderstood??

Thanks

Update: Doh! got it!

my $html = $template->output(); print "$html"; exit;
Thanks all for your help...


Comment on Re^2: HTML::Template output to scalar or array
Select or Download Code
Re^3: HTML::Template output to scalar or array
by GrandFather (Cardinal) on Oct 11, 2005 at 21:19 UTC

    $template is an object. Unless it has an explicit stringification overload printing it is unlikely to do what you might hope for. Try my $str = $template->output (); print $str; instead.


    Perl is Huffman encoded by design.
Re^3: HTML::Template output to scalar or array
by dorko (Parson) on Oct 11, 2005 at 21:21 UTC
    Or just:

    print $template->output();

    if you're not doing anything with $html other than printing it. But yup, you've got it!

    Cheers,

    Brent

    -- Yeah, I'm a Delt.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2014-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls