aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-23 14:11:26 +1200
committerDavid Phillips <david@sighup.nz>2018-09-23 14:11:26 +1200
commitb7c5b2f71798c45e88d31c63e0be5f60cffb1b9d (patch)
tree97319bde9b781645c030419fbae3f663829b3c92
parent8a590377ea2066e247b03fde5f2a205c02049956 (diff)
downloadidalius-b7c5b2f71798c45e88d31c63e0be5f60cffb1b9d.tar.xz
ListParser: die on duplicate keys in hash
-rw-r--r--ListParser.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/ListParser.pm b/ListParser.pm
index 9e3e511..b7c3f26 100644
--- a/ListParser.pm
+++ b/ListParser.pm
@@ -83,9 +83,9 @@ sub parse_list {
my $item = substr($input, $item_i, $i - $item_i);
$item =~ s/^\s+|\s+$//g;
if ($is_hash) {
- # FIXME should we die on duplicate keys or no?
my ($error, $key, $value) = parse_mapping($item);
die $error if $error;
+ die "Error: duplicate key \"$key\"" if grep {$_ eq $key} (keys %h_res);
$h_res{$key} = $value;
} else {
push @a_res, $item;