Permalink
Browse files

Fail if we don't get a key/val pair where we expect named params.

  • Loading branch information...
1 parent a97252a commit b8d23936c353f75425b025123d6d890398ce7754 @rafl committed Feb 4, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/MooseX/Method/Signatures/Meta/Method.pm
View
6 lib/MooseX/Method/Signatures/Meta/Method.pm
@@ -406,7 +406,11 @@ sub _build_type_constraint {
}
if (%named) {
- my %rest = @{ $_ }[$i .. $#{ $_ }];
+ my @rest = @{ $_ }[$i .. $#{ $_ }];
+ confess "Expected named arguments but didn't find an even-sized list"
+ unless @rest % 2 == 0;
+ my %rest = @rest;
+
while (my ($key, $spec) = each %named) {
if (exists $rest{$key}) {
$named_args{$key} = $coerce_param->($spec, delete $rest{$key});

0 comments on commit b8d2393

Please sign in to comment.