package A;
use subs qw(write); # only needed if you want to call write {...} within package A itself
use Exporter 'import';
@EXPORT_OK = qw(write);
sub write (&) { printf "write(): $_[0] -> %s\n", $_[0]->() }
####
package B;
use A 'write';
write { 42 };
####
write(): CODE(0x65eb80) -> 42