Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

push-style templating and large files

by metaperl (Curate)
on Aug 03, 2009 at 12:00 UTC ( [id://785419]=perlmeditation: print w/replies, xml ) Need Help??

In his paper "Enforcing Strict Model-View Separation in Template Engines" , Terence Parr defines and push and pull style templating as follows:
DEFINITION 8. A template uses the push strategy if all data used by the template is computed prior to template evaluation and is available as a set of attributes ai.
An example of a push-style templating system is HTML::Template - there is no way to use a streaming iterator within a template. You have to stream all of the data and make it available as a parameter to the template.
DEFINITION 9. A template uses the pull strategy if any data used by the template is computed on demand by invoking model functions.
Template is an example of a pull-style templating system. You can freely invoke methods on objects or use iterated streams directly in the template.

my question/meditation

I have heard of people needing to stream large amounts of HTML data, around 1 gigabyte to respond to a single web request.

In that case, what would you do to avoid a timeout while streaming that data into a single memory location? Also, I can imagine a potential memory fault from being forced to pre-fetch an entire stream of data to satisfy push-style templating requirements.

Replies are listed 'Best First'.
Re: push-style templating and large files
by Anonymous Monk on Aug 03, 2009 at 12:21 UTC
Re: push-style templating and large files
by metaperl (Curate) on Aug 03, 2009 at 13:19 UTC
    There's also a good thread on Stackoverflow about this. i like the javascript progress meter response.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://785419]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-18 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found