Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Writing to a file atomically without renaming

by waswas-fng (Curate)
on Jun 30, 2005 at 19:33 UTC ( [id://471441]=note: print w/replies, xml ) Need Help??


in reply to Writing to a file atomically without renaming

If this is on unix you can change the group of the file and its parent dir to a group that is common between both user1 and user2. If you also chmod 770 and g+s (group sicky bit) the parent dir, you should be in a situation where any file created is set to the group of the parent dir. This allows you to read and write to the file as power from both user1 and user2.


-Waswas
  • Comment on Re: Writing to a file atomically without renaming

Replies are listed 'Best First'.
Re^2: Writing to a file atomically without renaming
by nomis80 (Sexton) on Jun 30, 2005 at 19:46 UTC
    Very nice pragmatic solution! However I'm not in a situation where I can presume that I can chmod the parent dir at will.
      Modify IO::AtomicFile's source --
      Change: ### Open the file! Returns filehandle on success, for use as a constr +uctor: $self->SUPER::open($temp, $mode) ? $self : undef; To: ### Open the file! Returns filehandle on success, for use as a constr +uctor: $self->SUPER::open($temp, $mode) ? $self : undef; chown $uid, $gid, $temp;
      Where uid,and gid are static for this app or dynamically built somehow or passed to your version of IO::AtomicFile... chown $uid, $gid, "tempfile


      -Waswas

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2024-04-25 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found