Subject: | Modification of a read-only value |
Date: | Sun, 4 May 2014 09:06:14 +1000 |
To: | bug-Mail-Box [...] rt.cpan.org |
From: | Jiminaus <jiminaus [...] gmail.com> |
After upgrading a system to perl v5.18.2, I started to receive the following error:
Modification of a read-only value attempted at /perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Mail/Box/Locker/POSIX.pm line 29
I had to apply the following patch to resolve the error.
--- /tmp/POSIX.pm 2014-05-04 09:03:51.000000000 +1000
+++ /perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Mail/Box/Locker/POSIX.pm 2014-05-04 08:57:32.000000000 +1000
@@ -26,13 +26,15 @@
sub _try_lock($)
{ my ($self, $file) = @_;
- $? = fcntl($file, F_SETLK, pack('s @256', F_WRLCK)) || ($!+0);
+ my $p = pack('s @256', F_WRLCK);
+ $? = fcntl($file, F_SETLK, $p) || ($!+0);
$?==0;
}
sub _unlock($)
{ my ($self, $file) = @_;
- fcntl($file, F_SETLK, pack('s @256', F_UNLCK));
+ my $p = pack('s @256', F_UNLCK);
+ fcntl($file, F_SETLK, $p);
delete $self->{MBL_has_lock};
$self;
}