Konstrukt::Attributes - Sub attribute handling
#define a method with an attribute sub some_sub :some_attr { #... } #check if a sub has a specified attribute $Konstrukt::Attributes->has(\&some_sub => 'some_attr');
This module collects the attribute definitions for the methods of the (loaded) plugins and allows to check if a given method has a specified attribute.
With this information you may for example decide to execute a method or not.
Attributes are primarily used in Konstrukt::SimplePlugin.
To enable the attribute collection your module must import the MODIFY_CODE_ATTRIBUTES of this package. This can be done this way:
MODIFY_CODE_ATTRIBUTES
use base 'Konstrukt::Attributes';
Constructor of this class
Initialization.
Returns true if the given sub has a specified attribute.
Parameters:
$coderef - Coderef to the sub/method
$attribute - The name of the attribute
This sub does the real work. It captures the definition of attributes during compile time and saves them for later use.
Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.
This document is free software. It is distributed under the same terms as Perl itself.
Konstrukt
To install Konstrukt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Konstrukt
CPAN shell
perl -MCPAN -e shell install Konstrukt
For more information on module installation, please visit the detailed CPAN module installation guide.