my $counter = 0;
my $app = sub {
my $senv = shift;
$counter++;
return [ 200, [ 'Content-Type' => 'text/html' ], [ "counter: $counter" ] ];
};
Each worker gets it's own copy of $counter. The value of $counter depends on the worker serving the request.
Would it be somehow possible to share a variable between workers?
Kind regards,
Arjan.
--
Hi Nuba, Thanks, I know redis, it's really cool. But I'm not looking for anything database-like, I want to make a server that has a large hash of bit::vectors and serves information about that collection. Hence I need access to an instantiated variable with instantiated objects. The counter was just a simple example to demonstrate the problem with implementing this with starman. So I should either find out how to share it between workers, or I should find some single process solution perhaps. Kind regards, Arjan.
--