Removed /usr/local from CDPATH
[clearscm.git] / maps / lib / MAPSFile.pm
1 #!/usr/bin/perl
2 ################################################################################
3 #
4 # File:         $RCSfile: MAPSFile.pm,v $
5 # Revision:     $Revision: 1.1 $
6 # Description:  File manipulation routines for MAPS.
7 # Author:       Andrew@DeFaria.com
8 # Created:      Fri Nov 29 14:17:21  2002
9 # Modified:     $Date: 2013/06/12 14:05:47 $
10 # Language:     perl
11 #
12 # (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
13 #
14 ################################################################################
15 package MAPSFile;
16
17 use strict;
18 use vars qw (@ISA @EXPORT);
19
20 use Fcntl ':flock'; # import LOCK_* constants
21
22 use Exporter;
23 @ISA = qw (Exporter);
24
25 @EXPORT = qw (
26   Lock
27   Unlock
28 );
29
30 sub Lock($) {
31   my ($file) = @_;
32
33   flock($file, LOCK_EX);
34
35   # and, in case someone appended while we were waiting...
36   seek ($file, 0, 2);
37 } # lock
38
39 sub Unlock($) {
40   my ($file) = @_;
41
42   flock($file,LOCK_UN);
43 } # unlock
44
45 1;