MooseX::Struct is a struct-like Perl interface for Moose Object creation.
SYNOPSIS
use MooseX::Struct;
struct 'MyClass::Foo' => (
bar => 'Scalar',
baz => 'Array',
);
my $obj = new MyClass::Foo;
$obj->bar(44); # sets $obj->{bar} to 44
print $obj->bar; # prints 44
### or
package MyClass::Foo;
use MooseX::Struct;
### This will default to the current package : 'MyClass::Foo'
struct (
bar => 'Scalar',
baz => 'Array',
);
### or create your struct at compile-time
use MooseX::Struct 'MyClass::Foo' => (
bar => 'Scalar',
baz => 'Array',
);
### Immutable Moose Objects
package MyClass::Foo;
use MooseX::Struct;
immutable struct (
bar => 'Scalar',
baz => 'Array',
);
Product's homepage
Requirements:
· Perl