RDWest writes ..

>    i just joined the list. i've been fooling with perl scripts for a
>few months now. just installing and editing html output mainly... now
>i'm studying a coupkle books to write my own (i hope)
>
>question: i've seen a couple post in some forums about creating a temp
>file for a lock on win32(i know win32 doesn't support FLOCK)
>
>these post had a couple of contradictions about them...
>
>does anyone know a stable way to lock a file on win32?

the term "Win32" that you use isn't specific enough .. flock is buggy on
Win9x .. but works perfectly on WinNT

  use Fcntl ':flock';
  open FILE, 'file' or die "Bad open: $!";
  flock FILE, LOCK_EX;

if you're on Win9x and need to lock a file then you don't really have an
option other than to get a real operating system (sorry ;)

as for creating a temporary file .. usually there's no locking involved -
because you'll usually use a different filename for each temporary file that
you create

your best bet is to check out the perl FAQ which was installed on your
system when you installed Perl

you can get to by typing the following at a command prompt

  perldoc -q temporary

there are a few different solutions for different situations

there are also a number of FAQ items on file locking - if that's actually
what you need

  perldoc -f lock

-- 
  jason king

  A Canadian law states that citizens may not publicly remove bandages.
  - http://dumblaws.com/

Reply via email to