Re: flock - exclusive file locking

2008-03-18 Thread Chas. Owens
On Mon, Mar 17, 2008 at 4:47 PM, Dermot <[EMAIL PROTECTED]> wrote: snip > print $fh $status."\n"; > print STDERR "$0: $! $?\n"; snip $? holds the status returned by the last external call (call to system() function, pipes, qx// operator, call to wait() or waitpid(),

Re: flock - exclusive file locking

2008-03-17 Thread John W. Krahn
Dermot wrote: Hi, Hello, I have a cgi script that writes to a disk file. It would be safest if I can get an exclusive lock on the file. I had a look at the opentut and believe I have followed that the example there. Here's what I have sysopen my $fh, $file_path, O_WRONLY || die "can't open $

Re: flock - exclusive file locking

2008-03-17 Thread Gunnar Hjalmarsson
Dermot wrote: I have a cgi script that writes to a disk file. It would be safest if I can get an exclusive lock on the file. I had a look at the opentut and believe I have followed that the example there. Here's what I have sysopen my $fh, $file_path, O_WRONLY || die "can't open $

Re: flock - exclusive file locking

2008-03-17 Thread Dr.Ruud
Dermot schreef: >sysopen my $fh, $file_path, O_WRONLY >|| die "can't open $file_path: $!\n"; Change or-operator (or use parenthesis). -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

flock - exclusive file locking

2008-03-17 Thread Dermot
Hi, I have a cgi script that writes to a disk file. It would be safest if I can get an exclusive lock on the file. I had a look at the opentut and believe I have followed that the example there. Here's what I have sysopen my $fh, $file_path, O_WRONLY || die "can't open $file_path:

Re: File locking issue

2006-08-31 Thread Tom Phoenix
On 8/31/06, Nath, Alok (STSD) <[EMAIL PROTECTED]> wrote: What I am seeing is when I enable the file locking commands the file is completely wiped out.Just zero bytes. #use lock to write into the file sysopen( FH, $registerFile,

Re: File locking issue

2006-08-31 Thread John W. Krahn
Nath, Alok (STSD) wrote: > Hi, Hello, > I am trying to save data in an xml file. > What I am seeing is when I enable the file locking commands > the file is completely wiped out.Just zero bytes. > > But it works correctly when I remove the file locking commands. > &g

File locking issue

2006-08-31 Thread Nath, Alok (STSD)
Hi, I am trying to save data in an xml file. What I am seeing is when I enable the file locking commands the file is completely wiped out.Just zero bytes. But it works correctly when I remove the file locking commands. Please help ?? What I am

File locking with XML processing

2006-08-11 Thread Nath, Alok (STSD)
questions here ? - Can I use file locking (flock command) mechanism while writing/reading from the XML or there is some mechanism to avoid Reader/Writer problem ? - Can it be used with XML processing or is it used only when you open the file.In my case

Re: file locking before move?

2002-11-17 Thread Ramprasad A Padmanabhan
All locking modules use advisory locking hence it is not possible to ensure that the file is not being touched unless you build the intelligence into all possible scripts Rory O'Connor wrote: I am using File::Copy to move a file from one directory to another. However, I do not want to move the

Re: file locking before move?

2002-11-16 Thread smoot
> "Rory O'Connor" <[EMAIL PROTECTED]> said: > I am using File::Copy to move a file from one directory to another. However, I do >not want to move the file if it is being written to (by another program). > > Do i need to lock the file before moving it or does File::Copy by nature wait until >

file locking before move?

2002-11-16 Thread Rory O'Connor
I am using File::Copy to move a file from one directory to another. However, I do not want to move the file if it is being written to (by another program). Do i need to lock the file before moving it or does File::Copy by nature wait until a file is not being written to before moving? I lo

RE: Some advice needed on file locking with modperl'ed code

2001-11-15 Thread Andy McDowell
m: Bob Showalter <[EMAIL PROTECTED]> > To: 'Andy McDowell' <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > Subject: RE: Some advice needed on file locking with modperl'ed code > > > -Original Message- > > From: Andy McDowell [mailto:[EMAIL PROTECTED]

RE: Some advice needed on file locking with modperl'ed code

2001-11-15 Thread Bob Showalter
> -Original Message- > From: Andy McDowell [mailto:[EMAIL PROTECTED]] > Sent: Thursday, November 15, 2001 6:37 AM > To: [EMAIL PROTECTED] > Subject: Some advice needed on file locking with modperl'ed code > > > Hi All, > > I am writing a modperl we

Some advice needed on file locking with modperl'ed code

2001-11-15 Thread Andy McDowell
Hi All, I am writing a modperl webapp (the new web interface for the RipeNCC whois database server) and I have need to store some data to a file. Nothing heavy, just a few one liners like user query strings, screen used, server process time and a few others to do some analysis work on potential b

RE: Please ! Expert help needed - File locking

2001-11-01 Thread Bob Showalter
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Thursday, November 01, 2001 1:53 PM > To: [EMAIL PROTECTED] > Subject: Please ! Expert help needed - File locking > > > Hi, > > I'm trying to use file locking to work w

Please ! Expert help needed - File locking

2001-11-01 Thread documents
Hi, I'm trying to use file locking to work with the same file from different scripts. Each script may open the file in different mode. For example: Script1 opens for APPEND and Script2 opens the file for writing, thus truncating the file and then writing the data. I have rea

Re: File locking

2001-08-24 Thread Tim Keefer
this should lock the file: open(FH, ">>somefile.log") or print "can't append to file: $!"; flock(FH, 2) or die "can't flock file: $!"; # ~ output to file close FH; At 07:00 AM 8/24/2001, Joe Bellifont wrote: >Hi, >I have an html form that when submitted writes to a log file. >How can

File locking

2001-08-24 Thread Joe Bellifont
Hi, I have an html form that when submitted writes to a log file. How can I get a lock on this log file? -because currently if multiple users submit simultaneously, then it leaves the log file in a mess. TIA. -J _ Get your FREE d

Re: File locking question.

2001-07-29 Thread Michael Fowler
On Sat, Jul 28, 2001 at 04:15:33PM -0500, [EMAIL PROTECTED] wrote: > #!/usr/local/bin/perl > > #use strict; > use warnings; > > my $file = 'data'; > my $TIMEOUT = 10; > sub LOCK_SH { 1 }; > sub LOCK_EX { 2 }; > sub LOCK_UN { 8 }; Do not manually define these constants. It will work, but it's b

File locking question.

2001-07-28 Thread h1kv27q1mkye6001
I am trying to use L Stein's file locking subroutine from 'Official Guide to Programming with CGI.pm' for a light duty cgi program I am writing. I'd like to use 'use strict', but I can't get perl to agree with the return at the end of the subroutine. (See retu