diff --git a/lib/Type/Params.pm b/lib/Type/Params.pm index 3ba4fba07..09746ed72 100644 --- a/lib/Type/Params.pm +++ b/lib/Type/Params.pm @@ -279,7 +279,7 @@ sub multisig { { my ( $extra_env, @extra_lines ) = ( {}, 'my $on_die = undef;' ); if ( $options{'on_die'} ) { - my ( $extra_env, @extra_lines ) = ( { '$on_die' => \$options{'on_die'} }, '1;' ); + ( $extra_env, @extra_lines ) = ( { '$on_die' => \$options{'on_die'} }, '1;' ); } if ( @extra_lines ) { $code[0] .= join '', @extra_lines; diff --git a/t/20-modules/Type-Params/multisig.t b/t/20-modules/Type-Params/multisig.t index 0b3e33e57..5e68626e0 100644 --- a/t/20-modules/Type-Params/multisig.t +++ b/t/20-modules/Type-Params/multisig.t @@ -143,4 +143,20 @@ is exception { $check->( b => 3 ); }, undef; +{ + my $error; + my $other = multisig( + { on_die => sub { $error = shift->message; () } }, + [ Int, ArrayRef[$Rounded] ], + [ ArrayRef[$Rounded], Int ], + [ HashRef[Num] ], + ); + $other->(); + is( + $error, + 'Parameter validation failed', + 'on_die works', + ); +} + done_testing;