You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Ben Kim <bk...@coe.tamu.edu> on 2005/04/01 22:27:11 UTC

saving snapshot of the page

I asked a similar question before (teeing the output), but had a
different needs and would like to ask again.

I'd like to save the complete page by making a very long string. That is,
the complete (embperl processed) page will be stored into one field in the
database.

I'd like to do it at the same time when I send the page to the browser.
This is needed only on a few pages.

If there's a way to change the output handle inside the page, I'd like to
do something like
===============
[- 
  ... Process all ...
  buffer the output in a string variable named $page. 
-] 
<!-- save to database --> 
[-
  insert into table values (id, '$page')
-]
<!-- send to browser -->
[+$page+]
================

I know I can do it the cgi way or equivalent (like $str .=
qq[<table>...];) but the resulting code looked very tangled and I feel
there should be a simpler way.

I checked Execute method (since it has the "output" option) but from the
documentation, I can't figure out how to get the output buffer's contents
before it's output to the output file.
 
  Execute({
    inputfile => "degree_plan_printable.epl",
    outputfile => "degree_plan_printable4.epl"
  });

What I need is something similar to php's ob_start, ob_get_contents, and
ob_end_flush.

I'd appreciate any idea.



PS. I could possibly use embpexec.pl but it's giving me this error. Also,
it's not my preferred way.
========================================================== ==============

$ embpexec.pl degree_plan_printable.epl 

ld.so.1: <SNIP>perl: fatal: relocation error: file /usr/<SNIP>/Embperl.so:
symbol ap_strchr: referenced symbol not found. Killed



Regards,

Ben Kim
Database Developer/Systems Administrator
434E Harrington Tower / College of Education 
Texas A&M University


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