Thread map in map (4 answers)
Opened by roooot at 2010-02-09 17:18

roooot
 2010-02-09 17:18
#132433 #132433
User since
2008-03-03
276 Artikel
BenutzerIn
[default_avatar]
Hi,

ich erstelle für CPAN:HTML::Template ein Array für ein TMPL_LOOP.

Dazu erstelle ich ein Array mittels map. In diesem map Block soll nun nochmals ein Array mit map erstellt werden. Folgenden Code habe ich dazu probiert
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    my @news_w_details = +map {
        
        my %links   = %{$_->{'links'}};
        {
            NEWS_TITLE  => $_->{'title'},
            NEWS_TEXT   => $_->{'text'},
            
            NEWS_LINKS  => +map {
                
                NEWS_LINKS_LINK => $links{$_},
                NEWS_LINKS_TEXT => $_
                
            } keys %links
        }
        
    } @$gdn;  

Allerdings funktioniert das so leider nicht :( Er gibt mir einen Syntax Error bei "} keys" aus.

Daten:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$gdn = [
         {
           'link' => 'mapadelic-woho',
           'u_name' => 'chris',
           'uid' => 1,
           'created_time' => '2010-02-09 17:08:08',
           'text' => "Google ist \x{fc}berall, ab jetzt auch hier in der Galerie. Wers nicht mag, dem steht es frei, Google mithilfe einer Einstellung im Usercenter wieder von der Seite zu verbannen,",
           'id' => '001',
           'title' => 'mapadelic, woho',
           'links' => {
                        'Google Maps' => 'http://www.google.de/maps',
                        'Google Maps API' => 'http://code.google.com/intl/de-DE/apis/maps/'
                      }
         }
       ];


Danke für Hilfe
Viele Grüße :)

View full thread map in map