Help for this page

Select Code to Download


  1. or download this
    use Fctl qw(:flock);
    
    ...
    # rename("file2","file1"); doesn't work
    # File::Copy's move($fh2,$fh1); doens't work
    flock($fh,LOCK_UN);
    
  2. or download this
    #!/usr/bin/perl
    
    ...
     #flock($fh1,LOCK_UN);#probably not needed as close does it
                                     #(might cause issues with buffering?)
     close($fh1);
    
  3. or download this
    #!/usr/bin/perl
    use IO::File;
    ...
      close($fh_lock);
      unlink("file~")
        or print "couldn't remove lock - someone else must have it";