The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MooseX::Attribute::LazyInflator::Meta::Role::Attribute - Lazy inflate attributes

VERSION

version 2.2.2

SYNOPSIS

package Test;

use Moose;
use MooseX::Attribute::LazyInflator;
# Load default deflators and inflators
use MooseX::Attribute::Deflator::Moose;

has hash => ( is => 'rw', 
             isa => 'HashRef',
             traits => ['LazyInflator'] );

package main;

my $obj = Test->new( hash => '{"foo":"bar"}' );
# Attribute 'hash' is being inflated to a HashRef on access
$obj->hash;

ROLES

This role consumes MooseX::Attribute::Deflator::Meta::Role::Attribute.

METHODS

is_inflated( $intance )

Returns a true value if the value of the attribute passes the type contraint or has been inflated.

before get_value

The attribute's value is being inflated and set if it has a value and hasn't been inflated yet.

override verify_against_type_constraint

Will return true if the attribute hasn't been inflated yet.

FUNCTIONS

accessor_metaclass

The accessor metaclass is set to MooseX::Attribute::LazyInflator::Meta::Role::Method::Accessor.

AUTHOR

Moritz Onken

COPYRIGHT AND LICENSE

This software is Copyright (c) 2012 by Moritz Onken.

This is free software, licensed under:

The (three-clause) BSD License