Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re^2: simple CGI::upload_hook() guide or example? by thoughts
in thread simple CGI::upload_hook() guide or example? by thoughts

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-25 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found