deprecate C<use attrs>
[p5sagit/p5-mst-13.2.git] / ext / attrs / attrs.pm
CommitLineData
77a005ab 1package attrs;
2require DynaLoader;
3use vars '@ISA';
4@ISA = 'DynaLoader';
5
6use vars qw($VERSION);
7$VERSION = "1.0";
8
9=head1 NAME
10
a98df962 11attrs - set/get attributes of a subroutine (deprecated)
77a005ab 12
13=head1 SYNOPSIS
14
15 sub foo {
16 use attrs qw(locked method);
17 ...
18 }
19
20 @a = attrs::get(\&foo);
21
22=head1 DESCRIPTION
23
a98df962 24NOTE: Use of this pragma is deprecated. Use the syntax
25
26 sub foo : locked, method { }
27
28to declare attributes instead. See also L<attributes>.
29
30This pragma lets you set and get attributes for subroutines.
77a005ab 31Setting attributes takes place at compile time; trying to set
32invalid attribute names causes a compile-time error. Calling
a98df962 33C<attrs::get> on a subroutine reference or name returns its list
34of attribute names. Notice that C<attrs::get> is not exported.
77a005ab 35Valid attributes are as follows.
36
37=over
38
39=item method
40
41Indicates that the invoking subroutine is a method.
42
43=item locked
44
45Setting this attribute is only meaningful when the subroutine or
46method is to be called by multiple threads. When set on a method
47subroutine (i.e. one marked with the B<method> attribute above),
48perl ensures that any invocation of it implicitly locks its first
49argument before execution. When set on a non-method subroutine,
50perl ensures that a lock is taken on the subroutine itself before
51execution. The semantics of the lock are exactly those of one
52explicitly taken with the C<lock> operator immediately after the
53subroutine is entered.
54
55=back
56
57=cut
58
59bootstrap attrs $VERSION;
60
611;