Re: Problems with perl script on 6.1/5.8.8

2007-02-07 Thread Jonathan McKeown
On Tuesday 06 February 2007 22:24, Don O'Neil wrote:
 I've got a perl script that just refuses to run on my new 6.1 box with Perl
 5.8.8... Whenever I run it from the command line I get this:

 Can't modify single ref constructor in lock at ./caldisp.pl line 84, near
 *LOCKF)
 Execution of ./caldisp.pl aborted due to compilation errors.

 The lines in question are:

 if (open (LOCKF, $LOCKF))
 {
 lock (\*LOCKF);
 }

No real comment on the error, but shouldn't you be using flock() rather than 
lock()? flock is for locking files, lock is for locking shared variables in 
threads (unless of course you have a lock() subroutine defined somewhere, in 
which case it overrides the CORE::lock).

See perldoc perlopentut for details (it's hard to say more without more 
context).

Jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Problems with perl script on 6.1/5.8.8

2007-02-06 Thread Don O'Neil
I've got a perl script that just refuses to run on my new 6.1 box with Perl
5.8.8... Whenever I run it from the command line I get this:

Can't modify single ref constructor in lock at ./caldisp.pl line 84, near
*LOCKF)
Execution of ./caldisp.pl aborted due to compilation errors.

The lines in question are:

if (open (LOCKF, $LOCKF))
{
lock (\*LOCKF);
}

Now the script work fine on my older 4.10 box with perl 5.6.1.

Anyone have any ideas on how to fix this?

Thanks!!!

P.S. Thanks for the 'doh!' from everyone on the 'rm' with scp... I didn't
even think of just using ssh!

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problems with perl script on 6.1/5.8.8

2007-02-06 Thread Josh Carroll

Can't modify single ref constructor in lock at ./caldisp.pl line 84, near
*LOCKF)
Execution of ./caldisp.pl aborted due to compilation errors.


I'm not sure what has changed in Perl 5.8, but this should work instead:

if(open my $fh,  $LOCKF) {
  lock($fh);
}

Josh
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]