Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Test for writable filehandles on win32

by dragonchild (Archbishop)
on Jun 09, 2008 at 18:36 UTC ( [id://691066]=note: print w/replies, xml ) Need Help??


in reply to Re: Test for writable filehandles on win32
in thread Test for writable filehandles on win32

Is it really that simple?? That looks like it would be completely platform-independent ...

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re^2: Test for writable filehandles on win32

Replies are listed 'Best First'.
Re^3: Test for writable filehandles on win32
by bart (Canon) on Jun 09, 2008 at 19:32 UTC
    It probably will work... but it'll change the file modification time, if it succeeds. This probably isn't what is wanted, but it may not matter if you're planning on writing to the filehandle anyway.

      Yes it will change the modification time but I don't think that really matters, given the logical reason for checking if you can write to a file (in the context of a DBM module) would seem to be that you do *actually* want to write to the file. I have not checked to see how it is being used though.

      You could always stat the fh before the print (to get the atime and mtime) and then use utime to restore them afterwards although this is not reliably portable.

      Yes, is_W() is only called whenever an actual write is coming, so that's ok. :-)

      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-18 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found