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)