> Variations on the following code snippet have run successfully before, 
> but now the compiler halts with the complaint
> " Bareword "LOCK_EX" not allowed while "strict subs" in use at 
> student_info_viewer.cgi line 47"
> Can someone help me see what I am overlooking?
>

You haven't shown us your 'use' statements, I suspect you didn't import
the LOCK_ constants,

perldoc -f flock

Adding:

use Fcntl ':flock'; # import LOCK_* constants

Should help. If it doesn't post the new errors,

http://danconia.org
 
> # Declare the 'working' datahash, then tie it to file
> my %datahash;
> my $db = tie %datahash, 'DB_File', $file_to_view, O_RDWR | O_CREAT, 0644
>       or die "Can't initialize database: $!\n";
> my $fd = $db->fd(); # get a file descriptor
> open DATAFILE, "+<&=$fd" or die "Can't safely open file: $!\n";
> flock ( DATAFILE, LOCK_EX )
>       or die "Unable to acquire exclusive lock: $!. Aborting";
> undef $db; # Avoid untie problems
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to