perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnon Weinberg <ar...@back2front.ca>
Subject Include() vs. TrapInclude()
Date Mon, 30 Apr 2012 16:29:37 GMT

Just thought I'd post this for anyone else that might run into a similar 
situation...

The documentation seems to suggest that Include() and TrapInclude() are 
interchangeable, apart from the buffering that happens.  That is:
<%
   $Response->Include('test.inc');
%>
should be equivalent to:
<%=
   ${$Response->TrapInclude('test.inc')}
%>
with respect to output.

However, TrapInclude() creates a local output buffer, whereas Include() 
does not, so certain methods behave differently if they run inside an 
Include() file vs. a TrapInclude() file.  For example, 
$Response->Clear(), $Response->End(), and $Response->Flush() produce 
different results.  Their behaviour is a natural consequence of local 
output buffering, so just something to be aware of.

Also, when Buffering is turned on, the behaviour of $Response->End() is 
not as expected given a local output buffer, as it ends the program, but 
does not flush the caller's buffer, so this may be a minor bug.


-- 
-------------------------------------------------------------------------------
Arnon Weinberg
www.back2front.ca



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Mime
View raw message