in reply to Sub attributes
I'm not sure I understand the question. Maybe this code example is what you're looking for?
This is documented in attributes under "Package-specific Attribute Handling".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)
What to do once a subroutine attribute is recognized is a completely different story. :-)
lodin
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Sub attributes
by John M. Dlugosz (Monsignor) on Jun 10, 2009 at 16:14 UTC | |
by lodin (Hermit) on Jun 10, 2009 at 20:33 UTC |
In Section
Seekers of Perl Wisdom