Sub::Attribute - Reliable subroutine attribute handlers
This document describes Sub::Attribute version 0.05.
package Attribute::Foo; use Sub::Attribute; sub Foo :ATTR_SUB{ my($class, $sym_ref, $code_ref, $attr_name, $attr_data) = @_; # ... } # and later package main; use parent qw(Attribute::Foo); sub something :Foo(xyzzy){ # ... } # apply: __PACKAGE__->Foo(\*something, \&something, 'Foo', 'xyzzy')
Sub::Attribute is a role to define attribute handlers for specific subroutine attributes.
Sub::Attribute
The feature of this module is similar to that of Attribute::Handlers, but has less functionality and more reliability. That is, while Attribute::Handlers provides many options for ATTR(CODE), Sub::Attribute provides no options for ATTR_SUB. However, the attribute handlers defined by Sub::Attribute are always called with informative arguments. Attribute::Handlers's ATTR(CODE) is not called in run-time eval(), so ATTR(CODE) is not reliable.
Attribute::Handlers
ATTR(CODE)
ATTR_SUB
eval()
Defines a method as an subroutine attribute handler.
If true, reports how attributes are applied, using warn() function.
warn()
Perl 5.8.1 or later, and a C compiler.
No bugs have been reported.
Please report any bugs or feature requests to the author.
attributes.
"Subroutine Attributes" in perlsub.
Attribute::Handlers.
Goro Fuji (gfx) <gfuji(at)cpan.org>.
Copyright (c) 2009-20010, Goro Fuji (gfx). Some rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Sub::Attribute, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sub::Attribute
CPAN shell
perl -MCPAN -e shell install Sub::Attribute
For more information on module installation, please visit the detailed CPAN module installation guide.