Jie Gao said (talking about avoiding memory problems with
libareq::parms()):
> What I do is kill the child process after uploading is finished:
>
> $r->child_terminate();
>
> Not an elegant way, but it works for the time being.
Good idea. I've implemented something which uses this approach if the
file upload size is 'too big'. Here's the code I use--I hope someone else
finds it useful:
use constant MAX_SIZE_KILLPROC => 2000000;
my $TotalSize = 0;
foreach my $ThisAtt ($R->upload()) {
# Check that filehandle for uploaded file is valid
if ($ThisAtt->fh) {
SaveAtt ($MsgId, $ThisAtt)
### Replace next line with your own error handler
|| return $Self->SignalError(ERR_UPLOAD_FAILED);
$TotalSize += $ThisAtt->size();
} # If valid fh
# Work around bug in libareq->parms, that uses up too much memory
$R->post_connection(sub {$R->child_terminate()})
if $TotalSize > MAX_SIZE_KILLPROC;
}
--
Jeremy Howard
[EMAIL PROTECTED]
--
Jeremy Howard
[EMAIL PROTECTED]