Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: html2doc server connection dies early

by CountZero (Bishop)
on Oct 23, 2005 at 15:08 UTC ( [id://502313]=note: print w/replies, xml ) Need Help??


in reply to html2doc server connection dies early

I don't have a similar set-up as yours so I cannot test your code and therefore I can only give some general pointers.

  • Add use strict; and use warnings; and change your code so it runs without complaints under these pragma's.
  • use indirect filehandles in the three-argument form of open: open(my $IFILE, ">", $file"); rather than open(IFILE, ">$file"). These filehandles close by themselves when they fall out of scope. Of course there is nothing wrong with explicitly closing a filehandle once you are done with it.
  • You declare lexical variables (which is Good), but then undef them only to redeclare them a few lines later. Probably you want to make sure that you start with fresh variables, but OTOH you initialize these lexical variables when you declare them! You could dispense with the undef and the second declaration and just keep the initialisations.
  • Test all open and close functions for errors. As a general rule, test everything which depends on an event outside your own script (this includes all OLE-calls!).
  • Check the file-length immediately before you start sending it to the client. If it is still zero-length, there was something wrong with the writing of the temporary word-file. Perhaps it was not yet flushed to the disk. Wait a moment and check again. If the file remains at zero length, the OLE-call to write the Word-file did not work.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Replies are listed 'Best First'.
Re^2: html2doc server connection dies early
by IdleResonance (Acolyte) on Oct 23, 2005 at 23:18 UTC
    • will do
    • will do
    • With the undefs, I just didn't want a possibility of a carryover buffer of HTML sent back to the client on a zero-length file, but I should just re-initialize them.
    • will do
    • I haven't had any zero-length files on the server though. As far as the file-length is concerned, you can see in the server output that between 23-24K are read from the document and supposedly sent back to the client.

Log In?
Username:
Password:

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

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

    No recent polls found