Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: mod_perl and lazy zombies

by andreychek (Parson)
on Jun 07, 2001 at 18:53 UTC ( [id://86575]=note: print w/replies, xml ) Need Help??


in reply to mod_perl and lazy zombies

I ran across this in the mod_perl guide:

When you write a script running under mod_cgi, you can get away with sloppy programming, like opening a file and letting the interpreter close it for you when the script had finished its run...
...
For mod_perl, before the end of the script you must close() any files you opened!
...
If you forget to close(), you might get file descriptor leakage and (if you flock()ed on this file descriptor) also unlock problems.

Later on in that same section, they actually go as far as recommending
you use IO::File to do work with files under mod_perl in case the
interpreter stops before getting to run the close statement (ie, the user
presses the stop button in their browser).
-Eric

Replies are listed 'Best First'.
Re: Re: mod_perl and lazy zombies
by Odud (Pilgrim) on Jun 07, 2001 at 19:16 UTC
    I must have missed that somewhere in the 666 pages! do you have the section number? Also do you think "sloppy" eq "lazy"?
    Update I didn't look at your reference properly - I see it's in section 9.33 File handlers and locks leakages - I still might take exception to "sloppy" though
    Pete
      Heh.. well, don't feel bad, I can't say I found it on
      my first try either :-)

      As far as it being sloppy programming -- perhaps that is
      a bit strong of a word, but the guy who has to maintain your
      code when you are gone would most likely enjoy knowing when
      you are done using a particular file :-) Or even if you
      go to work on it later on, having that close statement
      would clearly state that you are finished with the filehandle,
      and might make your life a bit easier.

      But, as a Perl programmer, it's you're absolute right to
      code it that way if thats how you want to and you feel it
      makes you're life easier :-)
      -Eric

Log In?
Username:
Password:

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

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

    No recent polls found