I have a
.pl
script in which starts by:
I can't seem to run that via
perl myScript.pl
, having this error:
如果对于一个绝大部分内容是静态的网站,只有极少数的地方需要动态显示,碰巧你又了解一点perl知识,那么nginx + perl的结合就能很好解决问题。. How to fix Apache – “httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName”.
1- I tried to locate the
XPath.pm
file and export that as:
and
2- Installed
perl -MCPAN -e 'install XML::Parser'
3- Used -I to explicitly define the path as:
4- changing the line 3 to
use XML::Twig::XPath;
led to:
But none of them solved the issue and I keep receiving the same error at line.3.
P.S: Running on
CentOS 6.2
with the kernel 2.6.32-358
and perl --version=v5.10.1 (*) built for x86_64-linux-thread-multi
Any helps would be appreciated,
Amir
AmirAmir
1 Answer
-
Your title says XML::XPath can't be found, but your question indicates you tried to install XML::Parser. Did you try to install XML::XPath?
-
From
man perlrun
: 'If PERL5LIB is not defined, PERLLIB'. You seem to have tried setting PERLIB5 (notice the spelling difference: the var is PERL5LIB (or PERLLIB), not PERLIB5). -
From
man perlrun
: 'PERL5LIB -- A list of directories in which to look for Perl library files before looking in the standard library and the current directory.' You seem to have tried setting it to the full path to a .pm file, rather than a directory. -
The file you assigned would be XML::Twig::XPath, not XML::XPath; those are two different Perl modules.
Edit: After looking at your revised question:
-
I'm not sure if your script requires XML::Twig::XPath or XML::XPath, or if either one can provide the API you need. However, XML::Twig::XPath seems to depend on XML::XPath so you will need XML::XPath no matter what, and it looks like XML::XPath is not installed on your system. I think that's probably the main problem. Please try to install XML::XPath using CPAN.
-
The value of the PERL5LIB variable (or the argument to the -I option) should be the directory that sits at the base of the package-qualified module file. For example, if XML::XPath is located at ~/perl_custom_modules/XML/XPath.pm, then you need to set PERL5LIB (or the -I argument) to ~/perl_custom_modules. The XML directory is part of the package qualification of the module, so does not need to be included in the include path.
bgoldstbgoldst