projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Regex FTW!
[kivitendo-erp.git]
/
SL
/
Inifile.pm
diff --git
a/SL/Inifile.pm
b/SL/Inifile.pm
index
f7fe27b
..
6895d60
100644
(file)
--- a/
SL/Inifile.pm
+++ b/
SL/Inifile.pm
@@
-37,10
+37,12
@@
package Inifile;
use IO::File;
use IO::File;
+use strict;
+
sub new {
sub new {
- $main::lxdebug->enter_sub();
+ $main::lxdebug->enter_sub(
2
);
- my ($type, $file) = @_;
+ my ($type, $file
, %options
) = @_;
my $id = "";
my $skip;
my $id = "";
my $skip;
@@
-52,16
+54,18
@@
sub new {
open FH, "$file" or Form->error("$file : $!");
while (<FH>) {
open FH, "$file" or Form->error("$file : $!");
while (<FH>) {
- next if m/^(#|;|\s)/;
-
chomp;
chomp;
- # strip comments
- s/(#|;).*//g;
+ if (!$options{verbatim}) {
+ # strip comments
+ s/\#.*//;
- # remove any trailing whitespace
- s/^\s*//;
- s/\s*$//;
+ # remove any trailing whitespace
+ s/^\s*//;
+ s/\s*$//;
+ } else {
+ next if (m/^\s*\#/);
+ }
next unless $_;
next unless $_;
@@
-86,7
+90,7
@@
sub new {
}
close FH;
}
close FH;
- $main::lxdebug->leave_sub();
+ $main::lxdebug->leave_sub(
2
);
return bless $self, $type;
}
return bless $self, $type;
}