Moose data types

Tags:

A quick reference to the built-in data types you can use in Moose. Use these when declaring a class, as with 'isa':

Data Type

Possible Values

Any

*Note: [`a] is an optional extension which means any Type *

Item

Bool

undef, 0, empty string, or 1

Maybe[`a]

undef or [`a]. e.g.: Maybe[Str]

Undef

must be undef

Defined

must not be undef

Value

Str

string

Num

looks like a number

Int

integer

ClassName

string that is name of a class

RoleName

…of a role

Ref

ScalarRef[`a]

e.g., ScalarRef[Value]

ArrayRef[`a]

HashRef[`a]

CodeRef

RegexpRef

GlobRef

FileHandle

IO::Handle or Perl filehandle

Object

any blessed reference

any Class

e.g., MyClass or SQL::Abstract assuming your program uses them

Full details, examples, and advanced capabilites are explained at https://metacpan.org/pod/Moose::Manual::Types