1Sub::Attribute(3)     User Contributed Perl Documentation    Sub::Attribute(3)
2
3
4

NAME

6       Sub::Attribute - Reliable subroutine attribute handlers
7

VERSION

9       This document describes Sub::Attribute version 0.05.
10

SYNOPSIS

12               package Attribute::Foo;
13               use Sub::Attribute;
14
15               sub Foo :ATTR_SUB{
16                       my($class, $sym_ref, $code_ref, $attr_name, $attr_data) = @_;
17
18                       # ...
19               }
20
21               # and later
22               package main;
23               use parent qw(Attribute::Foo);
24
25               sub something :Foo(xyzzy){
26                       # ...
27               }
28               # apply: __PACKAGE__->Foo(\*something, \&something, 'Foo', 'xyzzy')
29

DESCRIPTION

31       "Sub::Attribute" is a role to define attribute handlers for specific
32       subroutine attributes.
33
34       The feature of this module is similar to that of "Attribute::Handlers",
35       but has less functionality and more reliability.  That is, while
36       "Attribute::Handlers" provides many options for "ATTR(CODE)",
37       "Sub::Attribute" provides no options for "ATTR_SUB".  However, the
38       attribute handlers defined by "Sub::Attribute" are always called with
39       informative arguments. "Attribute::Handlers"'s "ATTR(CODE)" is not
40       called in run-time "eval()", so "ATTR(CODE)" is not reliable.
41

INTERFACE

43   The ATTR_SUB meta attribute
44       Defines a method as an subroutine attribute handler.
45

CONFIGURATION AND ENVIRONMENT

47   $ENV{SUB_ATTRIBUTE_DEBUG}
48       If true, reports how attributes are applied, using "warn()" function.
49

DEPENDENCIES

51       Perl 5.8.1 or later, and a C compiler.
52

BUGS

54       No bugs have been reported.
55
56       Please report any bugs or feature requests to the author.
57

SEE ALSO

59       attributes.
60
61       "Subroutine Attributes" in perlsub.
62
63       Attribute::Handlers.
64

AUTHOR

66       Goro Fuji (gfx) <gfuji(at)cpan.org>.
67
69       Copyright (c) 2009-20010, Goro Fuji (gfx). Some rights reserved.
70
71       This library is free software; you can redistribute it and/or modify it
72       under the same terms as Perl itself.
73
74
75
76perl v5.32.1                      2021-01-27                 Sub::Attribute(3)
Impressum