Async-ContextSwitcher
view release on metacpan or search on metacpan
lib/Async/ContextSwitcher.pm view on Meta::CPAN
that stores and restores context to make sure correct context travels
with your code.
async_call( callback => cb_w_context { context->{good} = shift } );
Make sure that all callbacks in your code are created with this function
or you can loose track of your context.
=cut
sub cb_w_context(&) {
my $cb = $_[0];
my $ctx = $CTX;
return sub {
$CTX = $ctx;
goto &$cb;
};
}
=head1 AUTHOR
( run in 1.714 second using v1.01-cache-2.11-cpan-49f99fa48dc )