Re: [htmltmpl] hash of hashes
Brought to you by:
samtregar
From: Raful Mr M. H <RA...@us...> - 2008-01-09 13:20:12
|
Thanks! That should help alot. Since I also want the mac address I can = do something like... =20 @keys =3D keys %{$arpCache{$mac_address}}; foreach $key @keys { push @outer_loop, { mac_address =3D> $_ }; } in the template <TMPL_LOOP outer_loop> <TMPL_VAR mac_address> <TMPL_LOOP arp_cache_mac_address> <TMPL_VAR ip_address> </TMPL_LOOP arp_cache_mac_address> </TMPL_LOOP outer_loop> =20 Thanks again! =20 Mitchell Raful MCSE CCNP=20 MCB Quantico=20 Personal and Family Readiness (MRI)=20 3044 Catlin Avenue=20 Quantico, VA 22134=20 Com: 703-784-5991=20 DSN: 278-5991=20 Cell: 804-363-0731=20 -----Original Message----- From: Mathew Robertson [mailto:mat...@ne...] Sent: Tuesday, January 08, 2008 6:02 PM To: Raful Mr Mitchell H Cc: htm...@li... Subject: Re: [htmltmpl] hash of hashes Without further information on what you are trying to do and why you are = making the hash like so - I'm not sure what you are asking. ie: what are = you trying to loop through, a list of IP addresses? the arp cache? assuming the IP address: my $ht =3D HTML::Template->new("some.tmpl"); my @loop; foreach (@{$arpCache{$mac_address}}) { push @loop, { ip_address =3D> $_ }; } $ht->param(arp_cache_mac_address =3D> \@loop); in the "some.tmpl": <TMPL_LOOP arp_cache_mac_address> ... <TMPL_VAR ip_address> ... </TMPL_LOOP> Alternatively if you are willing to change the push(...), you could = write it as: push( @{$arpCache{$mac_address}}, { ip_address =3D> $ip_addr } ); ... $ht->param(arp_cache_mac_address =3D> $arpCache{$mac_address} ); Hope this helps, Mathew Raful Mr Mitchell H wrote:=20 My code puts together a hash like so... =20 push( @{$arpCache{$mac_address}}, $ip_addr ); =20 How on earth could I get that output via a TMPL_LOOP with TMPL_VAR? Or = is there a different way? =20 Thanks, =20 Mitch Mitchell Raful MCSE CCNP=20 MCB Quantico=20 Personal and Family Readiness (MRI)=20 3044 Catlin Avenue=20 Quantico, VA 22134=20 Com: 703-784-5991=20 DSN: 278-5991=20 Cell: 804-363-0731=20 =20 _____ =20 -------------------------------------------------------------------------= Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketpl= ace _____ =20 _______________________________________________ Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users =20 |