To pick up declared but not defined subs, use
exists &$_ instead. Also, avoid all-uppercase names.
*
Example:
package Foo;
use strict;
use warnings;
our @EXPORT = do {
no strict 'refs';
grep exists &$_ && /[a-z]/, keys %{ __PACKAGE__ . '::'};
};
sub bar;
sub AUTOLOAD {
our $AUTOLOAD;
print "AUTOLOADing $AUTOLOAD\n";
}
1;
*perlsub says:
Subroutines whose names are in all upper case are reserved to the Perl
core, as are modules whose names are in all lower case. A subroutine in
all capitals is a loosely-held convention meaning it will be called
indirectly by the run-time system itself, usually due to a triggered event.
Subroutines that do special, pre-defined things include AUTOLOAD, CLONE,
DESTROY plus all functions mentioned in perltie and PerlIO::via.
Update: changed [_a-z] to [a-z], based on the new CLONE_SKIP method; but perhaps that ought to be CLONESKIP...