Server IP : 104.21.38.3 / Your IP : 162.158.170.252 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/x86_64-linux-gnu/perl5/5.34/File/FcntlLock/ |
Upload File : |
# -*- cperl -*- # # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # # Copyright (C) 2002-2014 Jens Thoms Toerring <[email protected]> # Base class for the three modules for file locking using fcntl(2) package File::FcntlLock::Core; use 5.006; use strict; use warnings; use POSIX; use Carp; use base qw( File::FcntlLock::Errors Exporter ); our $VERSION = '0.22'; # Items to export into callers namespace by default. our @EXPORT = qw( F_GETLK F_SETLK F_SETLKW F_RDLCK F_WRLCK F_UNLCK SEEK_SET SEEK_CUR SEEK_END ); ########################################################### # # Make our exports exportable by child classes sub import { File::FcntlLock::Core->export_to_level( 1, @_ ); } ########################################################### # Method for creating the object sub new { my $inv = shift; my $pkg = ref( $inv ) || $inv; my $self = { l_type => F_RDLCK, l_whence => SEEK_SET, l_start => 0, l_len => 0, l_pid => 0, errno => undef, error_message => undef }; if ( @_ % 2 ) { carp "Missing value in key-value initializer list " . "in call of new method"; return; } while ( @_ ) { my $key = shift; no strict 'refs'; unless ( defined &$key ) { carp "Flock structure has no '$key' member " . "in call of new method"; return; } &$key( $self, shift ); use strict 'refs'; } bless $self, $pkg; } ########################################################### # Method for setting or querying the 'l_type' property sub l_type { my $self = shift; if ( @_ ) { my $l_type = shift; unless ( $l_type == F_RDLCK or $l_type == F_WRLCK or $l_type == F_UNLCK ) { carp "Invalid argument in call of l_type method"; return; } $self->{ l_type } = $l_type; } return $self->{ l_type }; } ########################################################### # Method for setting or querying the 'l_whence' property sub l_whence { my $self = shift; if ( @_ ) { my $l_whence = shift; unless ( $l_whence == SEEK_SET or $l_whence == SEEK_CUR or $l_whence == SEEK_END ) { carp "Invalid argument in call of l_whence method"; return; } $self->{ l_whence } = $l_whence; } return $self->{ l_whence }; } ########################################################### # Method to set or query of the 'l_start' property sub l_start { my $self = shift; $self->{ l_start } = shift if @_; return $self->{ l_start }; } ########################################################### # Method to set or query the 'l_len' property sub l_len { my $self = shift; $self->{ l_len } = shift if @_; return $self->{ l_len }; } ########################################################### # Method to query the 'l_pid' property sub l_pid { return shift->{ l_pid }; } 1; # Local variables: # tab-width: 4 # indent-tabs-mode: nil # End: