Moose::Cookbook::Snack::HashRef is a Perl module for using the HashRef type constraint.
SYNOPSIS
package Fruit;
use Moose;
has 'species' => ( is => 'rw', required => 1 );
package ProduceStore;
use Moose;
use Moose::Util::TypeConstraints;
has 'fruit_aisle' => ( is => 'rw', isa => 'HashRef[Fruit]' );
package main;
use Moose;
# we need something to put in the fruit aisle
my $orange = Fruit->new( species => 'C. sinensis' );
my $apple = Fruit->new( species => 'M. domestica' );
my %fruit = ( orange => $orange, apple => $apple );
my $store = ProduceStore->new( fruit_aisle => %fruit );
Product's homepage
Requirements:
· Perl