Probably the simplest way is to save all your output into a variable, say $html, rather than printing directly, as you would typically. Then, make a simple function that displays $html and performs any filtering you like. Such a subroutine might look like:

#somewhere in the code....
my $html='';
$html='hello world';
filter_and_output($html);

#and the output subroutine....
sub filter_and_output {
my $html=shift;
#in a CGI environment, put header, start_html, etc. here.
$html=~ s/@/at/g;
print $html;
#and in CGI, put end_html, etc. here. You could also put a "footer" with email for sysadmin, etc. here.
}


Mind that this is untested!
----- Original Message ----- From: "Ing. Branislav Gerzo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 29, 2004 4:46 PM
Subject: output buffering



hi all,

is there any possibility, how to easy and fast install some script,
which changes perl script output ? For cleaner explanation:

I want do script which takes *any* (perl,cgi site) output, parse it for
mails ([EMAIL PROTECTED]) and all occurencies changes to [2g]-at-[2g]_us
for example. I look into php, and they call such a functions as
"Output Buffering Functions"

thanks


-=x=- Skontrolovane antivirovym programom NOD32


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>





-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to