in reply to Advice sought for parsing config file
and the configuration file 'bar.conf':use strict; use Config::General; my $conf = new Config::General('bar.conf'); my %config = $conf->getall; use Data::Dumper; print Dumper \%config;
Which produces the following output:<define> destination = /u90/gvc_archive/new runonce = port100 </define> <macro arbor_ama> regex = /F.*?-P.*?\.(\d+)\.ama/ dfield = $1 </macro> <macro dex> regex = /^P.*?_DSC_.*?\.(\d+)\.ama$/ dfield = $1 </macro> <rule 10> port = port11,port41, port61,port77,port85 regex = dfield = NULL macro = rtcd_everything </rule> <rule 60> port = 87 regex = /F.*?\-P.*?_FCC_(\d+)_.*?\.cdr/ dfield = $1 macro = usl1 macro = usl2 </rule>
$VAR1 = {
'define' => {
'runonce' => 'port100',
'destination' => '/u90/gvc_archive/new'
},
'macro' => {
'dex' => {
'dfield' => '$1',
'regex' => '/^P.*?_DSC_.*?\\.(\\d+)\\.ama$/'
},
'arbor_ama' => {
'dfield' => '$1',
'regex' => '/F.*?-P.*?\\.(\\d+)\\.ama/'
}
},
'rule' => {
'10' => {
'dfield' => 'NULL',
'macro' => 'rtcd_everything',
'port' => 'port11,port41, port61,port77,port85',
'regex' => ''
},
'60' => {
'dfield' => '$1',
'macro' => [
'usl1',
'usl2'
],
'port' => '87',
'regex' => '/F.*?\\-P.*?_FCC_(\\d+)_.*?\\.cdr/'
}
}
};
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|