NAME
Constructor::SugarLibrary - build a library of generic constructor syntax sugar
VERSION
version 0.152091
SYNOPSIS
Declare syntax sugar in a library that will export it.
package My::SugarLib;
use Constructor::SugarLibrary;
sweeten "My::Moo::Object";
sweeten "My::Moose::Thing";
This is how you'd normally construct and check objects:
package My::NormalCode;
use My::Moo::Object;
use My::Moose::Thing;
my $obj = My::Moo::Object->new( plus => "some", more => "data" );
die if !$obj->isa( "My::Moo::Object" );
my $obj2 = My::Moose::Thing->new( with => "other", meta => "data" );
die if !$obj->isa( "My::Moose::Thing" );
Using the sugar library the same can be done much more concisely:
package My::SugaredCode;
use My::SugarLib;
my $obj = object plus => "some", more => "data";
die if $obj->isa( Object );
my $obj2 = thing with => "other", meta => "data";
die if $obj->isa( Thing );
AUTHOR
Christian Walde <walde.christian@gmail.com>
COPYRIGHT AND LICENSE
Christian Walde has dedicated the work to the Commons by waiving all of his or her rights to the work worldwide under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law.
Works under CC0 do not require attribution. When citing the work, you should not imply endorsement by the author.