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