Subject: | aix and flock |
Hello,
'make test' for Mail-Box-2.012 on an AIX 4.33 machine with perl-5.6.1
fails for tests 70flock.t and 70multi.t The error message generated is
'Can't call method "name" on an undefined value at Mail/Box/Locker/Flock.pm line 107'
This error message seems to be created due to the use of the variable
'$self->{MBL_folder}->name', which is not defined at this stage in file Mail/Box/Locker/Flock.pm. Changing the variable to '$self->filename' makes the tests pass with the message:
'ERROR: Will never get a lock at t/lockfiletest: A file descriptor does not refer to an open file'.
The reason for this is that in Mail/Box/Locker/Flock.pm the access-mode to filehandle is set to 'r', which does not work for flock()under AIX. Using
'r+' (as already used for Solaris) will solve the problem, see attached patch.
Andreas Piper
*** Flock.pm Sat Mar 9 16:54:36 2002
--- Flock.pm.new Mon Apr 29 12:48:20 2002
***************
*** 85,91 ****
my $filename = $self->filename;
# 'r+' is require under Solaris, other OSes are satified with 'r'.
! my $access = $^O eq 'solaris' ? 'r+' : 'r';
my $file = FileHandle->new($filename, $access);
unless($file)
--- 85,91 ----
my $filename = $self->filename;
# 'r+' is require under Solaris, other OSes are satified with 'r'.
! my $access = ($^O eq 'aix')||($^O eq 'solaris') ? 'r+' : 'r';
my $file = FileHandle->new($filename, $access);
unless($file)
***************
*** 105,111 ****
if($! != EAGAIN)
{ $self->log(ERROR =>
! "Will never get a lock at ".$self->{MBL_folder}->name.": $!");
return 0;
}
--- 105,111 ----
if($! != EAGAIN)
{ $self->log(ERROR =>
! "Will never get a lock at ".$self->filename.": $!");
return 0;
}
***************
*** 123,129 ****
my $filename = $self->filename;
# 'r+' is require under Solaris, other OSes are satified with 'r'.
! my $access = $^O eq 'solaris' ? 'r+' : 'r';
my $file = FileHandle->new($filename, "r+");
unless($file)
--- 123,129 ----
my $filename = $self->filename;
# 'r+' is require under Solaris, other OSes are satified with 'r'.
! my $access = ($^O eq 'aix')||($^O eq 'solaris') ? 'r+' : 'r';
my $file = FileHandle->new($filename, "r+");
unless($file)