use Attribute::Property; package Dog; sub new : New; sub intelligence : Property { /^\d+\z/ } package main; my $dog = Dog->new(intelligence => 15); $dog->intelligence++; my $dog = Dog->new(inteligence => 15); # error $dog->inteligence++; # error