Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

No, I don't really know why and it's honestly a lot of code to wade through. The main reason that you don't know is because you never check to see if things succeed or fail. Here's what I mean, in your hook sub, you have this code.

open (SES, ">$_sloc/$sessid.session"); print SES "$bytes_read:$length:$percent"; close (SES);

From my point of view, that's an error, what happens if you can't open the file? You just blindly write to it anyhow and the whole script ought to fail right there. As I said before, ALWAYS CHECK THE RETURN FROM OPEN. The simple fix is

open (SES, ">$_sloc/$sessid.session") or die $!; print SES "$bytes_read:$length:$percent"; close (SES);

Then try it and see if anything shows up in the server logs. After that, start the debugging process... use warn statements to ensure your variables contain what they ought to. Stick a warn @_; as the first line of the hook subroutine to be sure it's getting called and check that the parameters are sane. Then comment out the warn lines when it's working right.


In reply to Re^12: file upload and IO::Handle by rowdog
in thread file upload and IO::Handle by Anonymous Monk

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: (8)
As of 2024-03-29 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found