fetch_attrs#

Return the built-in attributes currently set on a referent.

Σύνοψη#

my @attrs = attributes::_fetch_attrs(\&foo);

Τι επιστρέφεται#

A list of attribute names drawn only from the built-in set. For a CODE referent that list can contain lvalue and method. For any other referent the list is empty. User-defined attributes are not consulted here; use get for that.

Παραδείγματα#

sub s :lvalue :method { $x }
my @a = attributes::_fetch_attrs(\&s);    # ('lvalue', 'method')
my $h = {};
my @a = attributes::_fetch_attrs($h);     # ()

Οριακές περιπτώσεις#

  • Called with the wrong number of args or a non-reference: croaks with Usage: attributes::_fetch_attrs($reference).

  • Order is fixed: lvalue before method when both are set.

Διαφορές από το upstream#

Fully compatible with upstream.

Δείτε επίσης#

  • get - public wrapper that also calls FETCH_${type}_ATTRIBUTES.

  • _modify_attrs - write-side counterpart.