IamtheGorf has asked for the wisdom of the Perl Monks concerning the following question:
bob { ed { larry { rule5 { option { disable-server-response-inspection no; } tag [ some_tag ]; from [ prod-L3 ]; to [ corp-L3 ]; source [ any ]; destination [ any ]; source-user [ any ]; category [ any ]; application [ any ]; service [ any ]; hip-profiles [ any ]; log-start no; log-end yes; negate-source no; negate-destination no; action allow; log-setting orion_log; } rule6 { option { disable-server-response-inspection no; } tag [ some_tag ]; from [ prod-L3 ]; to [ corp-L3 ]; source [ any ]; destination [ any ]; source-user [ any ]; category [ any ]; application [ any ]; service [ any ]; hip-profiles [ any ]; log-start no; log-end yes; negate-source no; negate-destination no; action allow; log-setting orion_log; } } } }
I can't figure out how to get that test to display correctly. I wrapped it in pre but the links are text that was wrapped in brackets. ANyway...
It's a lot of nesting. I have 1000's of these rules to parse plus other subsections to parse through. I started with Config::Scoped hoping that it would be able to help me but it seems to struggle with nested blocks:
GetOptions ( "pancfg=s" => \$pan_cfg, "outfile=s" => \$outfile ) or die("Error in command line arguments. Arguments:\n\t--pancfg + = Pan config file to read.\n\t--outfile = Output file for parsed dat +a."); #Open the config file and attempt to parse it. $cs = Config::Scoped->new( file => $pan_cfg, warnings => $warnings, ); $cfg_hash = $cs->parse;
That code block errors with:
Invalid decl item: Was expecting parameter or macro or comment or warning but found "mgt-config { " instead at
that "mgt-config { " is one of the subsections that occurs in the config file. I'm sorta struggling to find a decent way to do this. Can anyone offer any advice or better solutions?
|
|---|