in reply to Re: How to get Pod::Coverage to stop calling my export naked (closure)
in thread How to get Pod::Coverage to stop calling my export naked

Note that if the module that is importing DEBUG uses namespace::autoclean or similar (as is common in the Moose world these days), then the DEBUG function will not be callable as an object or class method. (Though it should still be called OK as a function.)

A workaround for that is to use Sub::Name

use Sub::Name qw/subname/; sub import { # ... my $exp = $pkg."::DEBUG"; { no strict 'refs'; *{$exp} = subname $exp => sub() { $debug }; } # ... }