Line # Revision Author
1 551 ahitrov <%args>
2
3 $name => undef
4 $SETS => undef
5
6 </%args>
7 <%init>
8
9 return unless ref $SETS;
10 return unless $name;
11
12 my $result = [];
13 foreach my $key (keys %$SETS) {
14 if ($key =~ /^${name}_(num|name|value)_(\d+)$/) {
15 my $field = $1;
16 my $i = $2;
17 $result->[$i-1]->{$field} = $SETS->{$key} if defined $SETS->{$key};
18 }
19 }
20 @$result = map { delete $_->{num}; $_ } sort { $a->{num} <=> $b->{num} } grep { $_->{name} } @$result;
21
22 return $result;
23
24 </%init>