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

Re^3: creating large xml files

by holli (Abbot)
on Jun 22, 2006 at 17:46 UTC ( #556962=note: print w/replies, xml ) Need Help??

in reply to Re^2: creating large xml files
in thread creating large xml files

Hey tinita! Nice to hear from you. I gonna be in Berlin for the world cup finals. I'd like to see you again. But back to the technical stuff:

You can specify an ouput file when calling process(), but that doesn't solve the memory problem, because the whole output will still be concatenated to a single string. Atm the only way to make TT to print directly is to use the "hack" mentioned above. However if you need to print to an output file you can use this:
use warnings; use strict; use Template; use Template::Directive; $Template::Directive::OUTPUT = 'print $main::OUT '; our $OUT; open $OUT, ">", "output.txt"; my $tmpl = Template->new(); my $text = "<test>[%data%]</test>"; $tmpl->process (\$text, {data=>'xxx'}); close $OUT;

holli, /regexed monk/

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://556962]
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: (10)
As of 2020-11-24 10:38 GMT
Find Nodes?
    Voting Booth?

    No recent polls found