
arnon at back2front
Apr 30, 2012, 9:29 AM
Post #1 of 1
(514 views)
Permalink
|
|
Include() vs. TrapInclude()
|
|
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 [at] perl For additional commands, e-mail: asp-help [at] perl
|