Larry,
Thank you. I wonder which Mod_perl cook book you are referring to and where can we get them? I am very interested in details of recipe 3.8. This is our first time to port our perl scripts to Apache (we are using Apache:PerRun mode), and we are still learning.
Thanks and Regards,
Hui Liu
-----Original Message-----
From: Larry Leszczynski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 04, 2003 3:16 PM
To: Liu, Hui (GXS)
Cc: mod_perl list
Subject: RE: Trouble with sysread in modperl
Hi Hui Liu -
> > Not sure about that error, but by any chance are you trying to read
> > POSTed data from the request? If so, all you need to do is:
> >
> > my $content;
> > $r->read($content, $r->header_in('Content-length'));
> >
> > (mod_perl cookbook recipe 3.6)
>
> Thanks for the suggestion. Does this mean if we have a 20MB file,
> this "read" will load the entire file into the memory?
Yes, at least up to the size limit defined by POST_MAX. But if you're
trying to read uploaded files, don't do it like that. Instead do it like
recipe 3.8 which shows how to get a filehandle to the uploaded file, e.g.
something like:
use Apache::Request;
sub handler {
my $r = Apache::Request->new(shift,
POST_MAX => 20 * 1024 * 1024,
DISABLE_UPLOADS => 0);
foreach my $upload ($r->upload) {
my $fh = $upload->fh;
...
}
}
Larry Leszczynski
[EMAIL PROTECTED]