Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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??


Update: Doh! got it!

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

Replies are listed 'Best First'.
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!



    -- Yeah, I'm a Delt.
Re^3: HTML::Template output to scalar or array
by GrandFather (Sage) 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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://499278]
[Corion]: Ouch. I just learned something about Chrome - the "version numbers" are not really feature numbers... Chrome 62 still gets new features even though Chrome 64 is out and Chrome 65 is the dev version
[erix]: why ouch? Something to be said for that ,surely?
LanX is a dev version
[marto]: That reminds me, I made some notes somewhere with regard W::M::C, I'll get round to a PR when I've time to flesh it out
[Corion]: erix: But that makes for fun bug hunting. "What version of Chrome are you running?" "v62". "I also run v62 and it works on my machine". :-(
[Corion]: marto: Great, looking forward to the PR!
LanX wonders, do we have a rule against systematic down voting?

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2017-12-12 20:13 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (335 votes). Check out past polls.