perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew O'Brien" <andr...@oriel.com.au>
Subject RE: saving snapshot of the page
Date Mon, 04 Apr 2005 00:54:55 GMT

With HTML::Embperl:

[-
  $content = '';
  @err = ();
  # note: this will produce output based on the current escmode setting
  # You would want to check errors etc etc
  Execute({inputfile => 'blah',
           output => \$content,
           errors => \@err
          });

  # save to DB
-]

[-
  local $escmode=0;
  print OUT $content;
-]

-- 
Andrew O'Brien

> -----Original Message-----
> From: Ben Kim [mailto:bkim@coe.tamu.edu] 
> Sent: Saturday, 2 April 2005 6:27 AM
> To: embperl@perl.apache.org
> Subject: 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

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


Mime
View raw message