http://www.perlmonks.org?node_id=958765


in reply to Module to Check Constructors?

Yes, see e.g. Params::Validate
update
An example:
#!/usr/bin/perl use strict; use warnings; use v5.10; package Player; use Params::Validate qw(:all); sub new { my $class = shift; my %attr = validate(@_, {name => 1, race => 1}); return bless \%attr => $class; } package main; my $player = Player->new(race => 'Elf', name => 'Legolas'); # dies: missing attribute my $player2 = Player->new(race => 'Dwarf'); # dies: unknown attribute my $player3 = Player->new(race => 'Hobbit', name => 'Bilbo Baggins', s +ize => 'small'); say 'done';