9 use MooseX::Params::Validate qw( validated_hash );
13 my %params = validated_hash(
15 x => { isa => 'Int' },
16 y => { isa => 'Int' },
22 my %params = validated_hash(
24 x => { isa => 'Int' },
25 y => { isa => 'Int' },
26 MX_PARAMS_VALIDATE_ALLOW_EXTRA => 1,
33 bar( x => 42, y => 1 ),
35 'bar returns expected values with no extra params'
39 bar( x => 42, y => 1, z => 'whatever' ),
40 { x => 42, y => 1, z => 'whatever' },
41 'bar returns expected values with extra params'
45 exception { foo( x => 42, y => 1, z => 'whatever' ) },
46 qr/The following parameter .+ listed in the validation options: z/,
47 'foo rejects extra params'