I want to manipulate various href links in the server response. I read in
the server response as follows:
sub handler
{
my $f = shift;
unless ($f->ctx){
while ($f->read(my $Buffer, BUFF_LEN)) {
if ($Buffer =~ m/Logout/){
$Buffer =~ s/href="(.*?\?.*?)"/href="$1\&NewParameter=$Value"/g;
$f->print($Buffer);
}
return Apache2::Const::OK;
}
}
}
The BUFF_LEN constant is set to 1024. I want to run the regex against the
entire server response. I tried adding a $CompleteBuffer .= $Buffer inside
the while loop and moving the $f->print($Buffer) statement out of that loop,
but still ended up with multiple copies of the same text within $Buffer.
What is the correct what to access the entire server response in a single
variable? Any pointers to examples of this are greatly appreciated.
Thanks,
Chris