Try to look at
Config::Tiny. Config file can look like this:
debug = 1
[routers]
router1 = 192.168.1.2
router2 = 192.168.1.3
router3 = 192.168.1.4
router4 = 192.168.1.5
router5 = 192.168.1.6
[groups]
group1 = [router1,router5]
group2 = [router1, router2, router3]
group3 = [router2, router3, router4]
You can get access to the those variables in your script:
use Config::Tiny;
my $conf = Config::Tiny->read('your_config');
my $debug = $conf->{_}->{debug};
my $routers = $conf->{routers}; # Hash ref with routers information
my $groups = $conf->{groups}; # Hash ref with group information
my $router1 = $routers->{router1}; # Router's IP
my $group1 = $groups->{group1}; # Array ref with routers list which be
+long to group 1.
. . .
Hope I helped :)
--------------------------------
SV* sv_bless(SV* sv, HV* stash);
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.