27 Sep 04:03
new() or process() on a string rather than a file?
From: Corey <corey_s@...>
Subject: new() or process() on a string rather than a file?
Newsgroups: gmane.comp.lang.perl.modules.petal
Date: 2006-09-27 02:03:58 GMT
Subject: new() or process() on a string rather than a file?
Newsgroups: gmane.comp.lang.perl.modules.petal
Date: 2006-09-27 02:03:58 GMT
Subject says it all - what if I have a string that I'd like to process using Petal? How do I do so? It appears that Petal only supports processing external files? What if my template was stored in a database, then retrieved with the DBI into a variable? It seems that it would be extremely useful to be able to do something along the lines of: # or assume this came from some other datasource, like a database $input = ' <html xmlns:tal="http://purl.org/petal/1.0/"> <body tal:content="bar">Dummy Content</body> </html> '; # obviously, this does not work: $template = Petal->new( $input ); $output = $template->process ( bar => 'BAZ' ); print $output; Which would print: <html> <body>BAZ</body> </html> Did I miss what I'm looking for in the docs somewhere? Or if not, is there some specific reason why processing a string rather than a file is not made possible via Petal? Many thanks! Corey
RSS Feed