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
37           argument before execution. When set on a non-method subroutine,
38           perl ensures that a lock is taken on the subroutine itself before
39           execution. The semantics of the lock are exactly those of one
40           explicitly taken with the "lock" operator immediately after the
41           subroutine is entered.
42
43
44
45perl v5.10.1                      2009-07-03                        attrs(3pm)
Impressum