Thomas Wittek > Konstrukt-0.5-beta13 > Konstrukt::Attributes

Download:
konstrukt/Konstrukt-0.5-beta13.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View Bugs
Report a bug
Source  

NAME ^

Konstrukt::Attributes - Sub attribute handling

SYNOPSIS ^

        #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');

DESCRIPTION ^

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:

        use base 'Konstrukt::Attributes';

METHODS ^

new

Constructor of this class

init

Initialization.

has

Returns true if the given sub has a specified attribute.

Parameters:

INTERNALS ^

MODIFY_CODE_ATTRIBUTES

This sub does the real work. It captures the definition of attributes during compile time and saves them for later use.

AUTHOR ^

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.

SEE ALSO ^

Konstrukt