How do you use Moose with a short example?

Moose is a postmodern object system for Perl that makes object-oriented programming easier and more powerful. It provides features like type constraints, roles, and method modifiers, enhancing the capabilities of Perl's object-oriented programming.

package Person; use Moose; has 'name' => ( is => 'rw', isa => 'Str', ); has 'age' => ( is => 'rw', isa => 'Int', ); sub hello { my $self = shift; return "Hello, my name is " . $self->name . " and I am " . $self->age . " years old."; } 1; # End of the module

Moose Perl Object-oriented programming Type constraints Roles