Class and Methods

Learn about classes and their methods in Moose.

Classes

A Moose object is a concrete instance of a class, a template describing data and behavior specific to the object. A class generally belongs to a package, which provides its name:

Press + to interact
package Cat {
use Moose;
}

This Cat class appears to do nothing, but that’s all Moose needs to make a class. We can create objects (or instances) of the Cat class with this syntax:

Press + to interact
package Cat {
use Moose;
}
my $brad = Cat->new;
my $jack = Cat->new;

In the same way that this arrow operator dereferences a ...