Revision a45d8cbe
Von Sven Schöling vor mehr als 11 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
138 | 138 |
foreach my $idx (0 .. scalar @{ $curr->{$key} } - 1) { |
139 | 139 |
my $first_array_entry = 1; |
140 | 140 |
|
141 |
foreach my $hash_key (sort keys %{ $curr->{$key}->[$idx] }) { |
|
142 |
push @result, $self->_flatten_variables_rec($curr->{$key}->[$idx], $prefix . $key . ($first_array_entry ? '[+].' : '[].'), $hash_key); |
|
143 |
$first_array_entry = 0; |
|
141 |
my $element = $curr->{$key}[$idx]; |
|
142 |
|
|
143 |
if ('HASH' eq ref $element) { |
|
144 |
foreach my $hash_key (sort keys %{ $element }) { |
|
145 |
push @result, $self->_flatten_variables_rec($element, $prefix . $key . ($first_array_entry ? '[+].' : '[].'), $hash_key); |
|
146 |
$first_array_entry = 0; |
|
147 |
} |
|
148 |
} else { |
|
149 |
@result = ({ 'key' => $prefix . $key . ($first_array_entry ? '[+]' : '[]'), 'value' => $element }); |
|
144 | 150 |
} |
145 | 151 |
} |
146 | 152 |
} |
Auch abrufbar als: Unified diff
flatten_variables auch die var[] syntax beigebracht