Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: mod_perl and lazy zombies

by andreychek (Parson)
on Jun 07, 2001 at 18:53 UTC ( #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).

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
      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 :-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://86575]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2018-05-22 09:03 GMT
Find Nodes?
    Voting Booth?