Hi, I am trying to use the template toolkit to built configuration files for a network management system.
Currently the data-structure looks like this:
$VAR1 = {
'novell.com' => {
'minotaur.novell.com' => {
'preference' => 5,
'geo' => {
'country' => 'US',
'area_code' => '801',
'org' => 'NOVELL',
'lat' => '40.218899',
'err' => undef,
'postal' => '84606',
'region' => 'UT',
'city' => 'Provo',
'lon' => '-111.635399',
'dma_code' => '770',
'isp' => 'NOVELL'
},
'ip' => '130.57.21.1',
'type' => 'Mailserver'
},
'NS1.WESTNET.NET' => {
'ping' => 'Yes',
'geo' => {
'country' => 'US',
'area_code' => '303',
'org' =>
'University of Colorado',
'lat' =>
'40.087799',
'err' => undef,
'postal'
=> '80309',
'region' => 'CO',
'city'
=> 'Boulder',
'lon' =>
'-105.373596',
'dma_code' => '751',
'isp' =>
'University of Colorado'
},
'ip' => '128.138.213.13',
'type' => 'Nameserver'
},
'prv2-mx.provo.novell.com' => {
'preference' => 5,
'geo' => {
'country' => 'US',
'area_code' => '801',
'org' => 'NOVELL',
'lat' => '40.218899',
'err' => undef,
'postal' => '84606',
'region' => 'UT',
'city' => 'Provo',
'lon' => '-111.635399',
'dma_code' => '770',
'isp' => 'NOVELL'
},
'ip' =>
'130.57.1.12',
'type' =>
'Mailserver'
},
'ns.novell.com' => {
'geo' => {
'country' => 'US',
'area_code' => '801',
'org' => 'NOVELL',
'lat' =>
'40.218899',
'err' => undef,
'postal' => '84606',
'region' => 'UT',
'city' => 'Provo',
'lon' =>
'-111.635399',
'dma_code' => '770',
'isp' => 'NOVELL'
},
'ip' => '137.65.1.1',
'type' => 'Nameserver'
},
'NS.UTAH.EDU' => {
'geo' => {
'country' => 'US',
'area_code' => '801',
'org' =>
'University of Utah',
'lat' => '40.711102',
'err' => undef,
'postal' => '',
'region' => 'UT',
'city' =>
'Salt Lake City',
'lon' =>
'-111.890297',
'dma_code' => '770',
'isp' =>
'University of Utah'
},
'ip' => '128.110.124.120',
'type' => 'Nameserver'
},
'prv-mx.provo.novell.com' => {
'preference' => 5,
'geo' => {
'country' => 'US',
'area_code' => '801',
'org' => 'NOVELL',
'lat' => '40.218899',
'err' => undef,
'postal' => '84606',
'region' => 'UT',
'city' => 'Provo',
'lon' => '-111.635399',
'dma_code' => '770',
'isp' => 'NOVELL'
},
'ip' =>
'130.57.1.10',
'type' =>
'Mailserver'
},
'www.novell.com' => {
'geo' => {
'country' => 'US',
'area_code' => '801',
'org' => 'NOVELL',
'lat' =>
'40.218899',
'err' => undef,
'postal'
=> '84606',
'region' => 'UT',
'city' => 'Provo',
'lon' =>
'-111.635399',
'dma_code' => '770',
'isp' => 'NOVELL'
},
'ip' => '130.57.4.27',
'type' => 'Submitted'
},
'prv1-mx.provo.novell.com' => {
'preference' => 5,
'geo' => {
'country' => 'US',
'area_code' => '801',
'org' => 'NOVELL',
'lat' => '40.218899',
'err' => undef,
'postal' => '84606',
'region' => 'UT',
'city' => 'Provo',
'lon' => '-111.635399',
'dma_code' => '770',
'isp' => 'NOVELL'
},
'ip' =>
'130.57.1.11',
'type' =>
'Mailserver'
}
}
};
I would like to create several config-files out of this information
(hostlist, all "pingable" hosts, dependencies, ...), but I didnt work
out how to access such a data-structure, because the "keys" change all
the time. In perl it works fine with a foreach loop, but with the
template toolkit I dont know how do to that.
Do I have to change the datastructure or does anybody have a good idea
how to do this?
THANKS,
Markus
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates
