Work continues on script at
(code)) Cisco Pass Mass - IOS (deprecated by node 123464) - next on list is moving many config parameters to external config file. Lots o' good info at PM on such doings.
AgentM and
arturo both ++ for good info in ChatBox.
Looks to me like a roll-yer-own parser can best fit the requirements, with Config::IniFiles a possible second choice. So I ask for review of my findings, and perhaps example(s) of a roll-yer-own parser to help me get started on the right foot.
cheers,
Don
striving for Perl Adept
(also tired, bleary-eyed, and quite possibly subject to incoherent rambling)
Requirements:
- Config file format can't include markup or Perl code. (must be editable by "code illiterate" support staff)
- Parser must run on Linux and WinNT4, possibly AIX and Sun also.
- Parsing can be done using CPAN modules.
Relevant PM nodes from Super Search:
Potential modules/methods to parse config file:
- Roll-yer-own
- good - platform independant if done right, flexible
- bad - more work for ybiC(?)
- Config::IniFiles
- good - runs on Win32-x86(?)
- bad - only a few months old (still bugs?)
- AppConfig
- good - been around almost exactly 2 years (more stable/secure?)
- bad - tested FAIL Win32-x86
- Data::Dumper, do
- good - part of Perl standard dist
- bad - config file is Perl code (?)
- Storable
- good - ?
- bad - config file is Perl code (?)
- FreezeThaw
- good - ?
- bad - config file is Perl code (?)
Config file would be something like this:
(param=value's read into scalars)
(others read into arrays)
[parm commands]
snmp-server community RO=notpublic
timeout=10
[noparm commands]
logging buffer errors
logging console errors
logging trap errors
[no snmp-server community]
public
private
secret
bogus
[targets]
routerA
routerB.sub1.dom
switchA.sub2.dom
switchB.sub2.dom
10.1.2.3
172.16.1.1
172.31.254.254
192.168.105.55
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.