Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Autoflush $|?

by Anonymous Monk
on Feb 15, 2006 at 17:57 UTC ( [id://530457]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a fairly simple CGI application that has worked for years on a IIS5 server that recently got ported to a IIS6 server and started to behave badly.
The script
  1. creates a XSL file
  2. creates a XML file
  3. redirects the user to the newly created XML file
  4. the XML gets displayed using the XSL in the users browser
Half of the time the script runs normally, half of the time the script only creates part of the XSL.(using all of the same inputs)
This XSL is created in a subroutine, that sub returns and then the XML is created correctly. The sub that creates the XSL is really just print statements with some extrapolated values in it.
The only real clue I have is when I set $|++. Now it seems the XSL gets created but the XML cuts out part way. Go figure. Its very consistant in its behavior when it fails, but its not consistent if it fails.
I'm at a loss as to how to debug this, any suggestions?

Replies are listed 'Best First'.
Re: Autoflush $|?
by trammell (Priest) on Feb 15, 2006 at 18:54 UTC
    Are you closing your filehandles? $| only applies to the currently selected filehandle, not to all filehandles.

    One indicator of this problem is a "suspicious filesize" -- is the created file a multiple of e.g. 8k?

Re: Autoflush $|?
by ikegami (Patriarch) on Feb 15, 2006 at 19:02 UTC
    File handles are flushed when they are closed, and they are closed when the program ends. This happens even when die or exit are called. It looks like your program is crashing in a manner serious enough to prevent this, since you have more data in the file when you turn off buffering. At least that's how I interpret this. Good luck!
Re: Autoflush $|?
by Anonymous Monk on Feb 15, 2006 at 20:17 UTC
    You guys are good. I wasn't closing the file handles. Thanks again.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-25 07:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found