Posted on 2007-07-25 13:43:29-07 by vadimlv
update some data without reloading Apache
Hi all
I try to update some data without reloading Apache (thread-based Apache model). I have Data.pm with some shared variables:
#########
package Data;
use threads;
use threads::shared;
share($test);
$test = 'str1';
share($test1);
$test1 = 'str2';

1;
#########
When I try to change some shared variable - all ok. All threads update variable value.
But when I try to create new shared variable - it's work only for one thread. The others threads don't see this new variable.
Is there any way to add shared variable without reloading Apache ?
Could anybody help me?
#########
package Update;
....
use Data;
use threads;
use threads::shared;
sub handler
{
...
# it's ok!
$Data::test1 = 'new_value';
# it's work only for one thread
share($Data::test2);
$Data::test2 = 'new_value';
...
}
#########
Direct Responses: 5811 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.