Attribute-Handlers-Clean
view release on metacpan or search on metacpan
lib/Attribute/Handlers/Clean.pm view on Meta::CPAN
definitions for your attributes to work there too. You can do this same
thing in your calling subclasses if you need the callers of those subclasses
to also have your custom attributes available there. This is only necessary
when you define your own C<import> method. Otherwise, it should happen
automatically.
Variables and subroutines subsequently defined in your package, or in packages
derived from that package may be given attributes with the same names as
the attribute handler subroutines, which will then be called in one of
the compilation phases (i.e. in a C<BEGIN>, C<CHECK>, C<INIT>, or C<END>
block). (C<UNITCHECK> blocks don't correspond to a global compilation
phase, so they can't be specified here.)
To create a handler, define it as a subroutine with the same name as
the desired attribute, and declare the subroutine itself with the
attribute C<:ATTR>. For example:
package LoudDecl;
use Attribute::Handlers::Clean;
sub Loud :ATTR {
( run in 2.672 seconds using v1.01-cache-2.11-cpan-702932259ff )