2013-07-24 41 views
-1

我试图在共享Linux环境上安装CPAN模块,但没有root权限,尤其是PDL::Graphics::Gnuplot模块。默认的gnuplot版本是Version 3.7 patchlevel 3,但版本Version 4.6 patchlevel 3也被安装(/opt/gnuplot-4.6.3/bin/gnuplot)。当试图安装Perl模块,在我的本地目录,它失败的测试:如何覆盖由Perl发起的shell中的系统命令?

unless(`gnuplot -V`) 

我试图用别名来替代默认的gnuplot命令.bashrc

alias gnuplot='/opt/gnuplot-4.6.3/bin/gnuplot' 

在常规shell我得到:

$gnuplot -V 
gnuplot 4.6 patchlevel 3 

但使用Perl:

$ perl -e 'system("gnuplot -V")' 
     Cannot open load file '-V' 
     line 0: (No such file or directory) 

我该如何让Perl看到新版本的gnuplot?

在解决方案中,我想要更改模块中的Makefile和以下文件中的系统命令。

回答

2

Shell别名只能在交互式shell中工作。你有其他的选择:

  1. 更改路径,以便新的gnuplot的bin先旧的。

  2. bin中创建一个符号链接到新的gnuplot,并确保它首先在PATH中。

+0

非常好,两个选项都有效。 – hakanc