GX::Meta::Attribute - Attribute metaclass
None.
This module provides the GX::Meta::Attribute class.
new
Returns a new attribute metaobject.
$attribute = GX::Meta::Attribute->new( %attributes );
accessor ( string | HASH reference )
accessor
HASH
An accessor definition.
accessors ( ARRAY reference )
accessors
ARRAY
A reference to an array of accessor definitions (see above).
class ( GX::Meta::Class object ) [ required ]
class
The associated class metaobject.
constraint ( string | CODE reference )
constraint
CODE
A constraint.
constraints ( ARRAY reference )
constraints
A reference to an array with constraints (see above).
default ( scalar )
default
A default value for the attribute slot.
initialize ( bool )
initialize
A boolean value indicating whether or not to initialize the attribute on object construction. Defaults to false, which means that the attribute is initialized only on demand, i.e. when it is actually accessed through a generated accessor method.
initializer ( string | CODE reference )
initializer
An initializer.
isa ( string )
isa
The attribute type (for example "Scalar", "Array" or "Hash"; see ATTRIBUTE TYPES below) or attribute class (for example "GX::Meta::Attribute::Scalar"). Defaults to "Scalar".
name ( string ) [ required ]
name
The name of the attribute.
preprocessor ( string | CODE reference )
preprocessor
A preprocessor.
private ( bool )
private
A boolean value indicating whether the attribute is private or not. Defaults to false.
processor ( string | CODE reference )
processor
A processor.
protected ( bool )
protected
A boolean value indicating whether the attribute is protected or not. Defaults to false.
public ( bool )
public
A boolean value indicating whether the attribute is public or not. Defaults to true.
required ( bool )
required
A boolean value indicating whether the attribute is required or not. Defaults to false.
slot ( string )
slot
The name of the attribute slot. Defaults to the name of the attribute.
static ( bool )
static
A boolean value indicating whether the attribute is a static (class) attribute or not. Defaults to false.
sticky ( bool )
sticky
A boolean value indicating whether the attribute is sticky or not. Defaults to false.
type ( string )
type
The attribute type, for example "Scalar", "Array" or "Hash" (see ATTRIBUTE TYPES below).
$attribute ( GX::Meta::Attribute object )
$attribute
GX::Meta::Exception
Returns the associated accessor metaobjects.
@accessors = $attribute->accessors;
@accessors ( GX::Meta::Accessor objects )
@accessors
add_accessor
Creates a new accessor metaobject for the attribute and adds it.
$accessor = $attribute->add_accessor( %arguments );
%arguments ( named list )
%arguments
Arguments to pass to the GX::Meta::Accessor constructor.
$accessor ( GX::Meta::Accessor object )
$accessor
add_preprocessor
Adds a preprocessor.
$attribute->add_preprocessor( $preprocessor );
$preprocessor ( string | CODE reference )
$preprocessor
A code reference or method name.
add_processor
Adds a processor.
$attribute->add_processor( $processor );
$processor ( string | CODE reference )
$processor
add_type_constraint
Adds a type constraint.
$attribute->add_type_constraint( $constraint );
$constraint ( string | CODE reference )
$constraint
add_value_constraint
Adds a value constraint.
$attribute->add_value_constraint( $constraint );
Returns the associated class metaobject.
$class = $attribute->class;
$class ( GX::Meta::Class object )
$class
default_value
Returns the default attribute value.
$default_value = $attribute->default_value;
$default_value ( scalar )
$default_value
has_default_value
Returns true if the attribute has a default value, otherwise false.
$result = $attribute->has_default_value;
$result ( bool )
$result
has_initializer
Returns true if the attribute has an initializer, otherwise false.
$result = $attribute->has_initializer;
Returns the initializer, or undef if the attribute does not have one.
undef
$initializer = $attribute->initializer;
$initializer ( string | CODE reference | undef )
$initializer
install
Installs the attribute.
$attribute->install;
install_accessors
Installs the accessors.
$attribute->install_accessors;
is_private
Returns true if the attribute is private, otherwise false.
$result = $attribute->is_private;
is_protected
Returns true if the attribute is protected, otherwise false.
$result = $attribute->is_protected;
is_public
Returns true if the attribute is public, otherwise false.
$result = $attribute->is_public;
is_required
Returns true if the attribute is required, otherwise false.
$result = $attribute->is_required;
is_static
Returns true if the attribute is static, otherwise false.
$result = $attribute->is_static;
is_sticky
Returns true if the attribute is sticky, otherwise false.
$result = $attribute->is_sticky;
Returns the name of the attribute.
$name = $attribute->name;
$name ( string )
$name
preprocessors
Returns the preprocessors.
@preprocessors = $attribute->preprocessors;
@preprocessors ( strings | CODE references )
@preprocessors
processors
Returns the processors.
@processors = $attribute->processors;
@processors ( strings | CODE references )
@processors
quoted_slot_key
Returns the quoted slot key.
$quoted_slot_key = $attribute->quoted_slot_key;
$quoted_slot_key ( string )
$quoted_slot_key
slot_key
Returns the slot key.
$slot_key = $attribute->slot_key;
$slot_key ( string )
$slot_key
Returns a string identifying the attribute type.
$type = $attribute->type;
$type ( string )
$type
type_constraints
Returns the type constraints.
@constraints = $attribute->type_constraints;
@constraints ( strings | CODE references )
@constraints
value_constraints
Returns the value constraints.
@constraints = $attribute->value_constraints;
Array
See GX::Meta::Attribute::Array.
Bool
See GX::Meta::Attribute::Bool.
Hash
See GX::Meta::Attribute::Hash.
Hash::Ordered
See GX::Meta::Attribute::Hash::Ordered.
Object
See GX::Meta::Attribute::Object.
Scalar
See GX::Meta::Attribute::Scalar.
String
See GX::Meta::Attribute::String.
GX::Meta
Jörg A. Uzarek <uzarek@runlevelnull.de>
Copyright (c) 2009-2011 Jörg A. Uzarek.
This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.
To install GX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GX
CPAN shell
perl -MCPAN -e shell install GX
For more information on module installation, please visit the detailed CPAN module installation guide.