| 1 | Description: Use a config file instead of hardcoded paths to determine @perllib |
| 2 | Forwarded: no |
| 3 | Author: Florian Ragwitz <[email protected]> |
| 4 | Reviewed-by: gregor herrmann <[email protected]> |
| 5 | Last-Update: 2012-12-11 |
| 6 | |
| 7 | --- a/perlindex.PL |
| 8 | +++ b/perlindex.PL |
| 9 | @@ -82,6 +82,7 @@ |
| 10 | $index_dir = $Config{'man1direxp'}; |
| 11 | $index_dir =~ s:/[^/]*$::; |
| 12 | $index_dir = $ENV{'INDEXDIR'} if $ENV{'INDEXDIR'}; |
| 13 | +$conffile = $ENV{'CONFFILE'} || '/etc/perlindex/config'; |
| 14 | |
| 15 | print OUT <<"EOC"; |
| 16 | \$nroff = \'$Config{'nroff'}\' || \'nroff\'; |
| 17 | @@ -89,6 +90,7 @@ |
| 18 | \$man3direxp = \'$Config{'man3direxp'}\'; |
| 19 | \$IDIR = \'$index_dir\'; |
| 20 | \$prefix = \'$Config{'prefix'}\'; |
| 21 | +\$conffile = \'$conffile\'; |
| 22 | EOC |
| 23 | ; |
| 24 | |
| 25 | @@ -139,8 +141,13 @@ |
| 26 | 'verbose', |
| 27 | 'dict:i', |
| 28 | 'idir=s', |
| 29 | + 'conf=s', |
| 30 | ) || die "Usage: $0 [-index] [words ...]\n"; |
| 31 | |
| 32 | +if (defined $opt_conf) { |
| 33 | + $conffile = $opt_conf; |
| 34 | +} |
| 35 | + |
| 36 | if (defined $opt_idir) { |
| 37 | $IDIR = $opt_idir; # avoid to many changes below. |
| 38 | } |
| 39 | @@ -182,10 +189,15 @@ |
| 40 | |
| 41 | require File::Find; |
| 42 | |
| 43 | + open (CONFIG, "<$conffile") || die "Can't open config file $conffile: $!"; |
| 44 | + my @config_perllib = <CONFIG>; |
| 45 | + chomp @config_perllib; |
| 46 | + |
| 47 | unless (@ARGV) { # breaks compatibility :-( |
| 48 | my %seen; |
| 49 | my @perllib = grep(length && -d && !$seen{$_}++, |
| 50 | @Config{qw(installprivlib installarchlib installsitelib installvendorlib installscript installsitearch)}); |
| 51 | + push @perllib, @config_perllib; |
| 52 | |
| 53 | for $dir (@perllib) { |
| 54 | print "Scanning $dir ... \n"; |
| 55 | @@ -630,6 +642,14 @@ |
| 56 | Generates additional information which query words have been not found |
| 57 | in the database and which words of the query are stopwords. |
| 58 | |
| 59 | +=item B<-conf> |
| 60 | + |
| 61 | +!NO!SUBS! |
| 62 | + |
| 63 | +print OUT "Use another config than the default config ($conffile).\n"; |
| 64 | + |
| 65 | +print OUT <<'!NO!SUBS!'; |
| 66 | + |
| 67 | =back |
| 68 | |
| 69 | =head1 EXAMPLE |