NAME
PRANG::Coerce - Easily create subtypes and coercions for any type
SYNOPSIS
use PRANG::Coerce;
has_element 'an_array_of_strs' =>
is => 'rw',
isa => 'PRANG::Coerce::ArrayRefOfStrs',
coerce => 1,
;
# or
use PRANG::Coerce;
PRANG::Coerce::coerce_arrayref_of('Type');
has_element 'an_array_of_types' =>
is => 'rw',
isa => 'PRANG::Coerce::ArrayRefOfTypes',
coerce => 1,
;
DESCRIPTION
When defining a type which is an ArrayRef[Type]
, sometimes it's nice to be able to just pass in a Type
. By using this module, that Type
can be coerced into the 'ArrayRef[Type]' by using ArrayRefOfTypes
.
PRE-DEFINED TYPES
PRANG::Coerce already defines two array types. These are for Str
and Int
and are defined as ArrayOfStrs
and ArrayOfInts
respectively.
AUTHOR AND LICENCE
Development commissioned by NZ Registry Services, and carried out by Catalyst IT - http://www.catalyst.net.nz/
Copyright 2009, 2010, NZ Registry Services. This module is licensed under the Artistic License v2.0, which permits relicensing under other Free Software licenses.