NAME
Data::Object::Role::Syntax - Role Declaration DSL for Perl 5
VERSION
version 0.51
SYNOPSIS
package Persona;
use namespace::autoclean;
use Data::Object::Role;
use Data::Object::Role::Syntax;
use Data::Object::Library ':types';
# ATTRIBUTES
has firstname => ro;
has lastname => ro;
has address1 => rw;
has address2 => rw;
has city => rw;
has state => rw;
has zip => rw;
has telephone => rw;
has occupation => rw;
# CONSTRAINTS
req firstname => Str;
req lastname => Str;
req address1 => Str;
opt address2 => Str;
req city => Str;
req state => StrMatch[qr/^[A-Z]{2}$/];
req zip => Int;
opt telephone => StrMatch[qr/^\d{10,30}$/];
opt occupation => Str;
# DEFAULTS
def occupation => 'Unassigned';
def city => 'San Franscisco';
def state => 'CA';
1;
DESCRIPTION
Data::Object::Role::Syntax exports a collection of functions that provide a DSL (syntactic sugar) for declaring and describing Data::Object::Role roles. It is highly recommended that you also use the namespace::autoclean library to automatically cleanup the functions exported by this library and avoid method name collisions.
SEE ALSO
AUTHOR
Al Newkirk <anewkirk@ana.io>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Al Newkirk.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.