11 attrs - set/get attributes of a subroutine (deprecated)
16 use attrs qw(locked method);
20 @a = attrs::get(\&foo);
24 NOTE: Use of this pragma is deprecated. Use the syntax
26 sub foo : locked, method { }
28 to declare attributes instead. See also L<attributes>.
30 This pragma lets you set and get attributes for subroutines.
31 Setting attributes takes place at compile time; trying to set
32 invalid attribute names causes a compile-time error. Calling
33 C<attrs::get> on a subroutine reference or name returns its list
34 of attribute names. Notice that C<attrs::get> is not exported.
35 Valid attributes are as follows.
41 Indicates that the invoking subroutine is a method.
45 Setting this attribute is only meaningful when the subroutine or
46 method is to be called by multiple threads. When set on a method
47 subroutine (i.e. one marked with the B<method> attribute above),
48 perl ensures that any invocation of it implicitly locks its first
49 argument before execution. When set on a non-method subroutine,
50 perl ensures that a lock is taken on the subroutine itself before
51 execution. The semantics of the lock are exactly those of one
52 explicitly taken with the C<lock> operator immediately after the
53 subroutine is entered.
59 bootstrap attrs $VERSION;