home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / ext / attrs / attrs.pm next >
Text File  |  2000-02-22  |  1KB  |  59 lines

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