NAME

MooseX::Has::Sugar::Saccharin - Experimental sweetness

VERSION

version 0.0404

SYNOPSIS

This is a highly experimental sugaring module. No Guarantees of stability.

has name   => rw Str, default { 1 };
has suffix => required rw Str;
has 'suffix', required rw Str;

Your choice.

FUNCTIONS

bare $Type

bare Str

equivalent to this

is => 'bare', isa => Str

ro $Type

ro Str

equivalent to this

is => 'ro', isa => Str,

rw $Type

rw Str

equivalent to this

is => 'rw', isa => Str

required @rest

this

required rw Str

is equivalent to this

required => 1, is => 'rw', isa => Str,

this

rw Str, required

is equivalent to this

is => 'rw', isa => Str , required => 1

lazy @rest

like ( lazy = 1 , @rest )>

lazy_build @rest

like ( lazy_build = 1, @rest )>

weak_ref @rest

like ( weak_ref = 1, @rest )>

coerce @rest

like ( coerce = 1, @rest )>

auto_deref @rest

like ( auto_deref = 1, @rest )>

builder $buildername

ie:

required rw Str, builder '_build_foo'

is like

builder => '_build_foo'

predicate $predicatename

see builder

clearer $clearername

see builder

init_arg $argname

see builder

default { $code }

Examples:

default { 1 }
default { { } }
default { [ ] }
default { $_->otherfield }

$_ is localised as the same value as $_[0] for convenience ( usually $self )

trigger { $code }

Works exactly like default.

ACKNOWLEDGEMENTS

AUTHOR

Kent Fredric <kentnl at cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2009 by Kent Fredric.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.