accessing the entire stream

Chris Datfung <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.