Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: How do I tell if a handle is open for writing?

by DrWhy (Chaplain)
on Nov 07, 2005 at 17:44 UTC ( #506464=note: print w/ replies, xml ) Need Help??


in reply to Re: How do I tell if a handle is open for writing?
in thread How do I tell if a handle is open for writing?

Excellent! I had thought about just trying to write something to the file but didn't want to modify the file. It didn't occur to me to write *nothing* to the file :)

I was worried that even this solution might have unintended side effects, e.g., changing the modified time on the file or (less likely in my mind) writing a null character to the file. I tried it on my WinXP system and it doesn't appear to modify the file in any way -- modified date remains unchanged.

Thanks!

--DrWhy

"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."


Comment on Re^2: How do I tell if a handle is open for writing?
Replies are listed 'Best First'.
Re^3: How do I tell if a handle is open for writing?
by Anonymous Monk on Mar 01, 2006 at 17:02 UTC
    It should write an EOF at the position (on Win that is, or was it FAT-filesystem only?) and everything after it would be lost. Of course perl could intervene and take it to mean a check for writability, and then use other means to check and get you the result. But I would first seek to EOF.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (19)
As of 2015-07-29 14:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls