It still works for me? Assuming that the relevant part of the program (going by the comments) is these 3 statements:
my %shared_data = ( 'dtLastRcvMsg' => time, 'dummy2' => 33, 'dummy' => 5 ); my ( $p1, $p2 ); # 1° test : OK $p1 = \%shared_data; $self->mylog( "P1: ($p1) " . Dumper( $p1 )); # 2° test : OK $p2 = $p1; $self->mylog( "P2: ($p2)" . Dumper( $p2 )); # 3° test : NOT-OK $self->{'shared_data'} = $p1; $p2 = $self->{'shared_data'}; $self->mylog( "P2: ($p2)" . Dumper( $p2 ));
This is the output I get from them:
c:\test\691728>..\junk.pl ..Non posso aprire il file /var/log/www/test1.dat (No such file or dir +ectory) print() on closed filehandle F at c:\test\junk.pl line 105. [2008.6.17 13:39:5] pid=2032 P1: (HASH(0x1e74f40)) $VAR1 = { 'dummy2' => 33, 'dummy' => 5, 'dtLastRcvMsg' => 1213706345 }; ..Non posso aprire il file /var/log/www/test1.dat (No such file or dir +ectory) print() on closed filehandle F at c:\test\junk.pl line 105. [2008.6.17 13:39:5] pid=2032 P2: (HASH(0x1e74f40))$VAR1 = { 'dummy2' => 33, 'dummy' => 5, 'dtLastRcvMsg' => 1213706345 }; ..Non posso aprire il file /var/log/www/test1.dat (No such file or dir +ectory) print() on closed filehandle F at c:\test\junk.pl line 105. [2008.6.17 13:39:5] pid=2032 P2: (HASH(0x1e74f40))$VAR1 = { 'dummy2' => 33, 'dummy' => 5, 'dtLastRcvMsg' => 1213706345 };
I had to disable a few things because I didn't have the relevant modules, but nothing that would affect those 3 outputs. For reference, here's the exact code I ran to get the above output:
I still suspect that you are simplifying the code for demonstration purposes and failing to demonstrate the problem.
Your not by any chance trying to share references between processes are you? Because that doesn't work!
In reply to Re^3: FATAL ERROR: Can't use string ("HASH(0x875fffc)") as a HASH ref while "strict refs" in use at
by BrowserUk
in thread FATAL ERROR: Can't use string ("HASH(0x875fffc)") as a HASH ref while "strict refs" in use at
by earlati2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |