1 |
296 |
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 $schedule = []; |
13 |
|
|
foreach my $key (keys %$SETS) { |
14 |
|
|
if ($key =~ /^${name}_(name|alias|image|amage|url|delete)_(\d+)$/) { |
15 |
|
|
my $field = $1; |
16 |
|
|
my $i = $2; |
17 |
|
|
$schedule->[$i-1]->{$field} = $SETS->{$key} if $SETS->{$key}; |
18 |
|
|
} |
19 |
|
|
} |
20 |
|
|
@$schedule = grep { !$_->{delete} } @$schedule; |
21 |
|
|
local $Data::Dumper::Indent = 0; |
22 |
|
|
return Data::Dumper::Dumper($schedule); |
23 |
|
|
|
24 |
|
|
</%init> |