Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.3 KiB

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