Created
September 4, 2009 06:36
-
-
Save gaurav/180768 to your computer and use it in GitHub Desktop.
A first step to getting Perldoc-Server to work on local folders.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- perldoc-server.original 2009-09-04 14:23:55.000000000 +0800 | |
+++ perldoc-server 2009-09-04 14:35:57.000000000 +0800 | |
@@ -31,6 +31,7 @@ | |
GetOptions(\%options, | |
'perl=s', | |
'port=i', | |
+ 'search|l=s@', | |
'public', | |
'help|h|?' => sub{pod2usage(1)}, | |
); | |
@@ -52,8 +53,8 @@ | |
root $ENV{PERLDOC_SERVER_HOME} | |
EOT | |
-if ($options{perl}) { | |
- print $config_fh perl_config($options{perl}); | |
+if ($options{perl} || $options{search}) { | |
+ print $config_fh perl_config($options{perl}, @{$options{search}}); | |
} | |
close $config_fh; | |
@@ -109,10 +110,18 @@ | |
sub perl_config { | |
my $perl = shift; | |
+ my @search = @_; | |
+ | |
+ $perl = $^X unless defined $perl; | |
+ | |
my $version_cmd = 'printf("%vd",$^V)'; | |
my $perl_version = `$perl -e '$version_cmd'`; | |
my $inc_cmd = 'print "$_\n" foreach @INC'; | |
my $perl_inc = `$perl -e '$inc_cmd'`; | |
+ | |
+ if(@search) { | |
+ $perl_inc = join("\n", @search); | |
+ } | |
$perl_inc =~ s/^/search_path /mg; | |
#warn "Using perl INC $perl_inc"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment