On Tuesday, 26 November 2019 19:13:21 CET Richard W.M. Jones wrote:
+my $path;
+
+=item B<--path DIR[:DIR...]>
+
+Set the path used for searching for included files (see L</POD FORMAT>
+above). The current directory is always searched first so you don’t
+need to add that explicitly.
I believe we can improve the handling of this option, for example
allowing multiple occurrences.
@@ -642,11 +682,29 @@ if ($text) {
#print "$progname: wrote $text\n";
}
+sub find_file
+{
+ my $input = shift;
+ my $path = shift;
+ local $_;
+
+ my @path = (".");
+ if ($path) {
+ push (@path, split (/:/, $path))
+ }
This splits the include path every time, while the list of paths does
not change. Most probably we can do the following:
my @paths = ('.');
[...]
GetOptions(
"path=s" => sub {
push @paths, split(/:/, $_[1]);
},
[...]
This way:
- @paths is already there as array
- @paths already includes '.' as first element
- --path can still be a colon-separated list of paths
- --path can be specified multiple times
BTW is the colon-separated value for --path needed? Reading the other
two patches of this series, I see the values are only a single
directory every time. In this case, the proposal above can be
simplified as:
my @paths = ('.');
[...]
GetOptions(
"path=s" => \@paths,
[...]
--
Pino Toscano