
brandonh
New User
Jun 5, 2008, 1:00 PM
Post #1 of 3
(414 views)
|
|
can't lock an object from a base class in a derived class
|
Can't Post
|
|
Hi, I'm trying to split a large chunk of code that uses shared variables and I can't get past the error "lock can only be used on shared values". Here's the reduced version of that code, in two files: ***mybase.pm: package mybase; use threads; use threads::shared; my $mode : shared; 1; ***derived.pm: #!/usr/bin/perl package derived; use strict; use Exporter; use threads; use threads::shared; use mybase; use vars qw(@ISA); @ISA = ('mybase'); sub foo { lock($mybase::mode); $mybase::mode = 1; } foo(); 1; *** [root@nf-power2 perltest]# ./derived.pm lock can only be used on shared values at ./derived.pm line 12. Any ideas on why a variable declared as shared is not appearing as a one? Thanks, b
|