state $validate = compile(slurpy Dict[ prefix => DBPrefix ]); #per the docs for named args my ($param) = $validate->( @_ ); # in foo.pl $obj->method( 'bar' ); # output : # Reference {"prefix" => "bar"} did not pass type constraint "Dict[prefix=>DBPrefix]" (in $SLURPY) at ./foo.pl line 11