YAPC::2004::Israel << Previous | Index | Next >> Copyright © 2004 Gaal Yahas

The code


     my @layouts = map { $_, $pub->{$_}->{'name'} }
         sort { $pub->{$a}->{'name'} cmp $pub->{$b}->{'name'} }
         grep { /^\d+$/ && $pub->{$_}->{'type'} eq "layout" &&
             LJ::S2::can_use_layer($u, $pub->{$_}->{'uniq'}) }
         keys %$pub;
  • Go over all layout IDs (keys %$pub)

  • grep for keys that are numerical and refer to layout objects which the user $u is allowed to use

  • sort by layout name

  • construct a hash from layout IDs to names

    • ignore the fact that it's @layout vs %layout, it's not related