check arguments for ->new

[email protected] (Jozef Kutej)
Newsgroups perl.moose
Message-ID <[email protected]>
Hi,

is there a way how to check and throw an exception if an argument passed to
constructor of Moose based class has no equivalent accessor?

Example:

--- cut ---

package MyClass;
use Moose;
has 'colour' => ('is' => 'rw', 'isa' => 'Str');
1;

package main;
MyClass->new('color' => '#123456');   # should throw exception

--- cut ---

Thank you,
Jozef
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.