Mouse::Meta::Attribute.3pm

Langue: en

Version: 2009-03-08 (fedora - 05/07/09)

Section: 3 (Bibliothèques de fonctions)

Sommaire

NAME

Mouse::Meta::Attribute - attribute metaclass

METHODS


new %args -> Mouse::Meta::Attribute


new %args -> Mouse::Meta::Attribute

Instantiates a new Mouse::Meta::Attribute. Does nothing else.

create OwnerClass, AttributeName, %args -> Mouse::Meta::Attribute


create OwnerClass, AttributeName, %args -> Mouse::Meta::Attribute

Creates a new attribute in OwnerClass. Accessors and helper methods are installed. Some error checking is done.

name -> AttributeName


associated_class -> OwnerClass


is_required -> Bool


default -> Item


has_default -> Bool


is_lazy -> Bool


predicate -> MethodName | Undef


has_predicate -> Bool


clearer -> MethodName | Undef


has_clearer -> Bool


handles -> { LocalName => RemoteName }


has_handles -> Bool


is_weak_ref -> Bool


init_arg -> Str


type_constraint -> Str


has_type_constraint -> Bool


trigger => CODE | Undef


has_trigger -> Bool


builder => MethodName | Undef


has_builder -> Bool


is_lazy_build => Bool


should_auto_deref -> Bool

Informational methods.

generate_accessor -> CODE

Creates a new code reference for the attribute's accessor.

generate_predicate -> CODE

Creates a new code reference for the attribute's predicate.

generate_clearer -> CODE

Creates a new code reference for the attribute's clearer.

generate_handles -> { MethodName => CODE }

Creates a new code reference for each of the attribute's handles methods.

find_type_constraint -> CODE

Returns a code reference which can be used to check that a given value passes this attribute's type constraint;

verify_against_type_constraint Item -> 1 | ERROR

Checks that the given value passes this attribute's type constraint. Returns 1 on success, otherwise "confess"es.

canonicalize_args Name, %args -> %args


canonicalize_args Name, %args -> %args

Canonicalizes some arguments to create. In particular, "lazy_build" is canonicalized into "lazy", "builder", etc.

validate_args Name, \%args -> 1 | ERROR

Checks that the arguments to create the attribute (ie those specified by "has") are valid.

clone_parent OwnerClass, AttributeName, %args -> Mouse::Meta::Attribute


clone_parent OwnerClass, AttributeName, %args -> Mouse::Meta::Attribute

Creates a new attribute in OwnerClass, inheriting options from parent classes. Accessors and helper methods are installed. Some error checking is done.

get_parent_args OwnerClass, AttributeName -> Hash

Returns the options that the parent class of "OwnerClass" used for attribute "AttributeName".