1attrs(3pm)             Perl Programmers Reference Guide             attrs(3pm)
2
3
4

NAME

6       attrs - set/get attributes of a subroutine (deprecated)
7

SYNOPSIS

9           sub foo {
10               use attrs qw(locked method);
11               ...
12           }
13
14           @a = attrs::get(\&foo);
15

DESCRIPTION

17       NOTE: Use of this pragma is deprecated.  Use the syntax
18
19           sub foo : locked method { }
20
21       to declare attributes instead.  See also attributes.
22
23       This pragma lets you set and get attributes for subroutines.  Setting
24       attributes takes place at compile time; trying to set invalid attribute
25       names causes a compile-time error. Calling "attrs::get" on a subroutine
26       reference or name returns its list of attribute names. Notice that
27       "attrs::get" is not exported.  Valid attributes are as follows.
28
29       method
30           Indicates that the invoking subroutine is a method.
31
32       locked
33           Setting this attribute is only meaningful when the subroutine or
34           method is to be called by multiple threads. When set on a method
35           subroutine (i.e. one marked with the method attribute above), perl
36           ensures that any invocation of it implicitly locks its first argu‐
37           ment before execution. When set on a non-method subroutine, perl
38           ensures that a lock is taken on the subroutine itself before execu‐
39           tion. The semantics of the lock are exactly those of one explicitly
40           taken with the "lock" operator immediately after the subroutine is
41           entered.
42
43
44
45perl v5.8.8                       2001-09-21                        attrs(3pm)
Impressum