Subject: | [Patch] Config file does not allow spaces in values |
When using config file, spaces can not be used as values.
However when parsing command line, spaces are allowed wrapping them with "" or ''
This patch makes spaces possible and comments with #
You can escape with # with \# to avoid it to be taken as comment.
Subject: | Net-Server-2.008-readconfspaces-2.patch |
diff -ur a/lib/Net/Server.pm b/lib/Net/Server.pm
--- a/lib/Net/Server.pm 2014-05-12 17:34:07.000000000 +0200
+++ b/lib/Net/Server.pm 2017-03-23 00:21:23.850986263 +0100
@@ -1026,7 +1026,9 @@
warn "Couldn't open conf \"$file\" [$!]\n";
};
while (defined(my $line = <$fh>)) {
- push @args, $1, $2 if $line =~ m/^\s* ((?:--)?\w+) (?:\s*[=:]\s*|\s+) (\S+)/x;
+ $line = $1 if $line =~ /(.*?)(?<!\\)#/;
+ $line =~ s/\\#/#/g;
+ push @args, $1, $2 if $line =~ m/^\s*((?:--)?\w+)(?:\s*[=:]\s*|\s+)(.+)/;
}
close $fh;
return \@args;