use MCE::Shared; my $obj = MCE::Shared->scalar(0); $obj->filter_store_value( \&code ); $obj->filter_fetch_value( \&code );