"Issac Goldstand" <[EMAIL PROTECTED]> writes:

> The documentation on how to use this feature is a bit sketchy... 

Yes, I agree. Doc patches are always welcome.  

Comments below are from memory since I last tested this feature 
about 6 months ago.

> Can anyone explain: 1) What the variables passed to the callback
> function are (looks like the Apache::Upload object is the first, but
> what's been filled in there when the hook gets called? 

The current upload object goes there when the hook is called.

> The second looks like the current bunch of data that's been
> recieved[?], 

Right, it's the buffer from apache's ap_get_client_block,
which is usually around 2-4 KB.  The hook runs before the
buffer gets written to the underlying tempfile, but as soon 
as your hook has completed, Apache::Request will write it 
automatically.

> the third is the length, but is that the length recieved so far or the
> length recieved between the last time it was called and this time?

The length of the buffer; the same as length($buffer).

> And lastly, what can be placed in HOOK_DATA - scalar only?)

Yes, but the scalar can also be a ref to an array or hash.

> 2) Is there any way of knowing how often the hook will get called? 

Not really- it's called when apache calls ap_get_client_block.

> 3) Is there a specific phase of the Request that Apache::Request 
> must be called and initialized with the callback before?  

The hooks get run as the data is uploaded to the server,
which IOW is when the data is first being parsed.  This
can happen at any phase you choose, but it only happens
once per request.

> 4) Are there any specific issues for using this with
> Apache::Request->instance ?

Other than (3), I don't think so- but as I said before
this is not a well-tested feature (yet :)

HTH
-- 
Joe Schaefer

Reply via email to