/usr/share/perl5/Plucene/Utils.pm is in libplucene-perl 1.25-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | package Plucene::Utils;
=head1 NAME
Plucene::Utils - Utility class for Plucene
=head1 SYNOPSIS
use Plucene::Utils;
do_locked($sub, $lock);
=head1 DESCRIPTION
Utilities to help with Plucene.
=head1 METHODS
=cut
use strict;
use warnings;
use Carp;
use Fcntl qw(O_EXCL O_CREAT O_WRONLY);
use base 'Exporter';
our @EXPORT = qw( do_locked );
=head2 do_locked
do_locked($sub, $lock);
=cut
sub do_locked (&$) {
my ($sub, $lock) = @_;
local *FH;
for (1 .. 5) {
sysopen FH, $lock, O_EXCL | O_CREAT | O_WRONLY
and goto got_lock;
sleep 1;
warn "I had to sleep to get a lock on $lock";
}
carp "Couldn't get lock $lock: $!";
got_lock:
$sub->();
close *FH;
unlink $lock;
}
1;
|