Line # Revision Author
1 3 ahitrov@rambler.ru <%args>
2 $object
3 $name => undef
4 $SETS => undef
5 </%args>
6 <%init>
7
8 return undef unless ref $SETS;
9 return undef unless $name;
10
11 my @props = $object->structure();
12 my ($prop) = grep { $_->{attr} eq $name } @props;
13 return undef unless ref $prop;
14
15 my @values = exists $prop->{values} && ref $prop->{values} eq 'ARRAY' ? @{ $prop->{values} } :
16 exists $prop->{cases} && ref $prop->{cases} eq 'ARRAY' ? @{ $prop->{cases} } : ();
17
18 return undef unless @values;
19
20 my @ids;
21 foreach my $val ( @values ) {
22 if ( ref $val eq 'ARRAY' && scalar @$val == 2 ) {
23 if ( exists $SETS->{$name."_".$val->[0]} && $SETS->{$name."_".$val->[0]} ) {
24 push @ids, $val->[0];
25 }
26 } else {
27 if ( exists $SETS->{$name."_".$val} && $SETS->{$name."_".$val} ) {
28 push @ids, $val;
29 }
30 }
31 }
32
33 return \@ids;
34
35 </%init>