I'm not sure I understand the question. Maybe this code example is what you're looking for?
use strict;
use List::Extract 'extract';
sub MODIFY_CODE_ATTRIBUTES {
my $class = shift;
my ($cref, @attrs) = @_;
my ($bent) = extract { /^Bent\b/ } @attrs;
if (defined $bent) {
print "Recognized attribute: $bent\n";
}
return @attrs; # Unrecognized.
}
sub foo :Bent;
sub bar :Bent(named) { 1 }
my $code = sub :Bent(anonymous) { 1 }
__END__
Recognized attribute: Bent
Recognized attribute: Bent(named)
Recognized attribute: Bent(anonymous)
This is documented in
attributes under "Package-specific Attribute Handling".
What to do once a subroutine attribute is recognized is a completely different story. :-)
lodin