Comment Comment by mfontani Since about 2008-01 or so, using Moose, we've been able to do something like: { package Point; use Moose; has 'x' => (is => 'ro', isa => 'Int', required => 1); has 'y' => (is => 'ro', isa => 'Int', required => 1); sub as_string { my $self = shift; return sprintf '(%d,%d)', $self->x, $self->y; } } my $origin = Point->new(0, 0); say $origin->as_string; parent mfontani 3 years ago