Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

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

Well, actually, I was looking for an answer like Perl should guarantee proper closing of the file if the file if the local handle goes out of scope, or otherwise Perl does not guarantee that this happens. Maybe I didn't made myself clear in this respect, but the problem wasn't what to do to avoid this problem (in my case, I simply put a close in the end of the block), but whether this problem (in a correct Perl installation) is supposed to appear at all; for, in case this is something which is supposed to work, but at my colleagues system it occasionally does not work, this means that we have a fundamental problem lurking somewhere on his platform which is well worth investigating. Otherwise, in case it is really undefined behaviour in Perl, but just happens to work *usually*, there is no need to research further.

From my understanding of Perl, I could not decide this question. The link I mentioned in an earlier post seems to suggest that this is well defined behaviour in Perl, but of course this article could also be wrong, or I could have misinterpreted it. So I was hoping that someone would know what exactly happens in Perl if a local filehandle goes out of scope. Given the length of this discussion, this seems to be a dark corner in Perl.

Actually, it maybe has implications to other areas as well. For instance, if I have a local scalar, holding a blessed reference, and this scalar goes out of scope (and there are no accesses to this reference any more); does Perl guarantee then that the DESTROY function of this object will be executed immediately, or could it be that it is called at some later time?

-- 
Ronald Fischer <ynnor@mm.st>

In reply to Re^2: Implicit closing of files by rovf
in thread Implicit closing of files by rovf

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: (3)
As of 2024-04-25 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found