Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: simple CGI::upload_hook() guide or example?

by thoughts (Initiate)
on Oct 12, 2005 at 21:03 UTC ( [id://499683]=note: print w/replies, xml ) Need Help??


in reply to Re: simple CGI::upload_hook() guide or example?
in thread simple CGI::upload_hook() guide or example?

My gut instinct tells me that your test DID work, but your logfile was just buffering the output.

This does appear to be the case. Even though I tried both of these in my hook:

select(STDERR); $|=1; print STDERR "$byte_size\n";
select((select(STDERR), $| = 1)[0]); print STDERR "$byte_size\n";

...STDERR refused to be unbuffered. Switching to a custom (plain old) logfile allowed it to work.

To guarantee that it doesn't happen with this example, I am doing something very inefficient by opening and closing the log file on every call to the hook.

But since the purpose of this is for some secondary process to be reading the log at the same time as it's being written, you'd at least have to release the filelock after every hook call, right?

And if you use the OO interface like I do, you must pass the hook in at creation time.

Good to know; I can't imagine how one is supposed to determine that (how did you?), given that the docs certainly don't say anything about it.

Thanks for your help.

Replies are listed 'Best First'.
Re^3: simple CGI::upload_hook() guide or example?
by cees (Curate) on Oct 12, 2005 at 21:11 UTC
    ...STDERR refused to be unbuffered

    Well, you might be unbuffering your perl code, but Apache could still be buffering the output before it writes it to the error log...

    I can't imagine how one is supposed to determine that (how did you?), given that the docs certainly don't say anything about it.

    If I can't get something to work according to the docs, then I assume the docs are lying and check the source. Mind you the source of CGI.pm is not for the faint of heart ;). I meant to send in a doc patch to clarify this stuff, but never got around to it. If you can find the time, I am sure Lincoln would appreciate it.

    The upload hook seems to be one of those cool things that no one really uses. I guess that is why there is such a lack of info on the subject...

      The upload hook seems to be one of those cool things that no one really uses. I guess that is why there is such a lack of info on the subject...
      Yeah, it seems unusually unknown/unused. With all the hype surrounding AJAX and Ruby on Rails, I've come across this implementation a couple times, and it seems like a fancy newfangled thing... but I see it's been possible for quite some time in Perl.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://499683]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-12-12 17:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (65 votes). Check out past polls.