Subject: | Type::Params::multisig fails to validate when presented with a slurpy Dict |
The documentation for multisig indicates that it supports slurpy params, but it doesn't seem to work for me.
The attached script fails where multisig is presented with a slurpy Dict:
% perl multisig.pl
Parameter validation failed at multisig.pl line 36.
Parameter validation failed at multisig.pl line 50.
Subject: | multisig.pl |
use strict;
use warnings;
use Data::Dumper;
use Type::Params qw[ multisig validate ];
use Types::Standard -all;
my $a = Dict [ a => Num ];
my $b = Dict [ b => Num ];
# works
eval {
validate( [ { a => 3 } ], $a );
validate( [ a => 3 ], slurpy $a );
} || warn $@;
# works
eval {
my $check = multisig( [ $a ], [ $b ] );
$check->( { a => 3 } );
$check->( { b => 3 } );
1;
} || warn $@;
eval {
my $check = multisig( [ slurpy $a ], [ slurpy $b ] );
# Parameter validation failed...
$check->( { a => 3 } );
$check->( { b => 3 } );
1;
} || warn $@;
eval {
my $check = multisig( [ $a ], [ slurpy $b ] );
# works
$check->( { a => 3 } );
# Parameter validation failed...
$check->( { b => 3 } );
1;
} || warn $@;