I am trying to use a hash hash to keep a constant field and timestamp when this field was changed.
It should be shared, though, since I have 2 threads that are needed to access it, although only one sets the values.
here is my current code with a few comments:
my $status = {}; share($status); sub get_status { my($raid) = @_; return $status->{$raid}->{status} if exists $status->{$raid}; return 1; } sub set_status { my($raid,$newstatus) = @_; my %t; $t{status} = $newstatus; $t{timestamp} = Time::HiRes::time; $status->{$raid} = \%t;
I constantly get Invalid value for shared scalar at ./hashtest line 19.
Can anyone help: D?
source share