my ($key, $value) = ($flattened->[$i], $flattened->[$i+1]);
my ($type, $op) = $key =~ m{:(.+)::(.+)};
- if ($key =~ s/:multi//) {
- my @multi;
- my $orig_key = $key;
- for my $value (parse_line('\s+', 0, $value)) {
- ($key, $value) = _apply_all($key, $value, qr/\b:(\w+)/, { %filters, %{ $params{filters} || {} } });
- ($key, $value) = _apply_all($key, $value, qr/\b::(\w+)/, { %methods, %{ $params{methods} || {} } });
- ($key, $value) = _dispatch_custom_filters($params{class}, $with_objects, $key, $value) if $params{class};
- ($key, $value) = _apply_value_filters($key, $value, $type, $op);
- push @multi, $key, $value;
- $key = $orig_key;
- }
- ($key, $value) = (and => \@multi);
- } else {
- ($key, $value) = _apply_all($key, $value, qr/\b:(\w+)/, { %filters, %{ $params{filters} || {} } });
- ($key, $value) = _apply_all($key, $value, qr/\b::(\w+)/, { %methods, %{ $params{methods} || {} } });
- ($key, $value) = _dispatch_custom_filters($params{class}, $with_objects, $key, $value) if $params{class};
- ($key, $value) = _apply_value_filters($key, $value, $type, $op);
+ my $is_multi = $key =~ s/:multi//;
+ my $orig_key = $key;
+ my @value_tokens = $is_multi ? parse_line('\s+', 0, $value) : ($value);
+
+ my @args;
+
+ for my $value_token (@value_tokens) {
+ $key = $orig_key;
+
+ ($key, $value_token) = _apply_all($key, $value_token, qr/\b:(\w+)/, { %filters, %{ $params{filters} || {} } });
+ ($key, $value_token) = _apply_all($key, $value_token, qr/\b::(\w+)/, { %methods, %{ $params{methods} || {} } });
+ ($key, $value_token) = _dispatch_custom_filters($params{class}, $with_objects, $key, $value_token) if $params{class};
+ ($key, $value_token) = _apply_value_filters($key, $value_token, $type, $op);
+
+ push @args, $key, $value_token;
}
- push @result, $key, $value if defined $key;
+ next unless defined $key;
+
+ push @result, $is_multi ? (and => [ @args ]) : @args;
}
return \@result;
}