2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml">
5 <title>attrs - set/get attributes of a subroutine
</title>
6 <meta http-equiv=
"content-type" content=
"text/html; charset=utf-8" />
7 <link rev=
"made" href=
"mailto:" />
10 <body style=
"background-color: white">
11 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
12 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
13 <big><strong><span class=
"block"> attrs - set/get attributes of a subroutine
</span></strong></big>
17 <p><a name=
"__index__"></a></p>
22 <li><a href=
"#name">NAME
</a></li>
23 <li><a href=
"#synopsis">SYNOPSIS
</a></li>
24 <li><a href=
"#description">DESCRIPTION
</a></li>
31 <h1><a name=
"name">NAME
</a></h1>
32 <p>attrs - set/get attributes of a subroutine (deprecated)
</p>
36 <h1><a name=
"synopsis">SYNOPSIS
</a></h1>
39 use attrs qw(locked method);
43 @a = attrs::get(\
&foo);
</pre>
47 <h1><a name=
"description">DESCRIPTION
</a></h1>
48 <p>NOTE: Use of this pragma is deprecated. Use the syntax
</p>
50 sub foo : locked method { }
</pre>
51 <p>to declare attributes instead. See also
<a href=
"file://C|\msysgit\mingw\html/lib/attributes.html">the attributes manpage
</a>.
</p>
52 <p>This pragma lets you set and get attributes for subroutines.
53 Setting attributes takes place at compile time; trying to set
54 invalid attribute names causes a compile-time error. Calling
55 <code>attrs::get
</code> on a subroutine reference or name returns its list
56 of attribute names. Notice that
<code>attrs::get
</code> is not exported.
57 Valid attributes are as follows.
</p>
59 <dt><strong><a name=
"item_method">method
</a></strong>
62 <p>Indicates that the invoking subroutine is a method.
</p>
65 <dt><strong><a name=
"item_locked">locked
</a></strong>
68 <p>Setting this attribute is only meaningful when the subroutine or
69 method is to be called by multiple threads. When set on a method
70 subroutine (i.e. one marked with the
<strong>method
</strong> attribute above),
71 perl ensures that any invocation of it implicitly locks its first
72 argument before execution. When set on a non-method subroutine,
73 perl ensures that a lock is taken on the subroutine itself before
74 execution. The semantics of the lock are exactly those of one
75 explicitly taken with the
<code>lock
</code> operator immediately after the
76 subroutine is entered.
</p>
80 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
81 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
82 <big><strong><span class=
"block"> attrs - set/get attributes of a subroutine
</span></strong></big>