Read/Write INI-Style configuration files
Compiles fine on VMS, but the following patch allows VMS-Style bang (!) comments.
*** iniconf.pm;1
--- iniconf.pm;7
**************
*** 60,65
Parameter=Value
Both the hash mark (#) and the semicolon (;) are comment characters.
Lines that begin with either of these characters will be ignored. Any
amount of whitespace may preceed the comment character.
--- 60,66 -----
Parameter=Value
Both the hash mark (#) and the semicolon (;) are comment characters.
+ The exclamation point (!) is a comment character if running under VMS.
Lines that begin with either of these characters will be ignored. Any
amount of whitespace may preceed the comment character.
**************
*** 295,301
my($lineno, $sect);
my($group, $groupmem);
my($parm, $val);
! my @cmts;
@errors = ( );
# Initialize (and clear out) storage hashes
--- 296,302 -----
my($lineno, $sect);
my($group, $groupmem);
my($parm, $val);
! my ($comments, @cmts);
@errors = ( );
# Initialize (and clear out) storage hashes
**************
*** 320,325
chop;
$lineno++;
if (/^\s*$/) { # ignore blank lines
next;
}
--- 321,328 -----
chop;
$lineno++;
+ $comments = $^O eq 'VMS' ? '^\s*[\#\;\!]' : '^\s*[\#\;]';
+
if (/^\s*$/) { # ignore blank lines
next;
}
**************
*** 323,329
if (/^\s*$/) { # ignore blank lines
next;
}
! elsif (/^\s*[\#\;]/) { # collect comments
push(@cmts, $_);
next;
}
--- 326,332 -----
if (/^\s*$/) { # ignore blank lines
next;
}
! elsif (/$comments/o) { # collect comments
push(@cmts, $_);
next;
}
Last Update 12-September-1997
Questions or Comments?
Write the WebMaster