Getting error "Can't locate HTML/TreeBuilder/XPath.pm in #INC " - perl

Gettin below error while running my perl file
Can't locate HTML/TreeBuilder/XPath.pm in #INC (#INC contains: C:/Perl/lib C:/Pe
rl/site/lib .) at display.pl line 4.
BEGIN failed--compilation aborted at display.pl line 4.
HTML::TreeBuilder::XPath module(0.14) is installed. From command line when i run command
perl -e HTML::TreeBuilder::XPath it doesn't give any error.
when i run from command line perldoc -l HTML::TreeBuilder::XPath gives below error:
No documentation found for "HTML::TreeBuilder::XPath".
My perl version is 5.8.7

First cross check does this module is really installed ? I think it is not installed, install it from cpan.

Related

Perl CPAN Can't locate CPAN/Author.pm... when trying to install nipe

I'm trying to install "nipe" on my Windows Machine but i get this error code all the time. I have installed Strawberry Perl.
This is the error code:
Can't locate CPAN/Author.pm in #INC (you may need to install the CPAN::Author module) (#INC contains: /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/share/perl5/core_perl/CPAN.pm line 19.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/CPAN.pm line 19.
Compilation failed in require at /usr/share/perl5/core_perl/App/Cpan.pm line 290.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/App/Cpan.pm line 290.
Compilation failed in require at /c/Strawberry/perl/bin/cpan line 7.
BEGIN failed--compilation aborted at /c/Strawberry/perl/bin/cpan line 7.
While you may have Strawberry Perl installed, that's not the perl you are using. C:\Strawberry\perl\bin\cpan uses the first perl in your PATH, which isn't your installation of Strawberry Perl. It appears that you are using some unix emulation (Cygwin? MSYS?) and using the perl from that emulation.
To use your Strawberry Perl build of perl, you could adjust your PATH so that SP comes before whatever perl you ended up using, or you could use
C:\Strawberry\perl\bin\perl C:\Strawberry\perl\bin\cpan Try::Tiny Config::Simple JSON
or
C:\Strawberry\perl\bin\perl -MCPAN -e"install #ARGV" Try::Tiny Config::Simple JSON
in lieu of
cpan Try::Tiny Config::Simple JSON
Similarly, if you don't adjust your path, you'll need to use
C:\Strawberry\perl\bin\perl nipe.pl ...
in lieu of
perl nipe.pl ...
If your are using windows and a bash then try to it with cmd or powershell after you applied the changes from #ikegami. Took me some time to figure out, that it had no effect to change the paths for this terminal, as it still took the paths from /usr//perl5/
I tried to do all of the other answers, but it didn't work. Instead it appeared that it doesn't work because I tried to run it from unix shell script (sh in powershell or git bash). After moving it from .sh to .ps1 and running non-unix way it works perfectly.

taxid2wgs.pl: undefined symbol: Perl_xs_handshake

I trying to run a Perl script (taxid2wgs.pl) used in searching a taxonomic subset of WGS.
taxid2wgs.pl (available at ftp://ftp.ncbi.nlm.nih.gov/blast/WGS_TOOLS).
$ ./taxid2wgs.pl -title "Bacteria WGS" -alias_file bacteria-wgs 2
Here, 2 is the taxid for Bacteria. taxid2wgs.pl will produce the alias file "bacteria-wgs.nvl".
However I got an error message below.
Can't locate LWP/UserAgent.pm in #INC (you may need to install the LWP::UserAgent module) (#INC contains: /usr/local/lib/perl5/site_perl/5.24.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.24.0 /usr/local/lib/perl5/5.24.0/x86_64-linux-thread-multi /usr/local/lib/perl5/5.24.0 .) at ./taxid2wgs.pl line 4.
BEGIN failed--compilation aborted at ./taxid2wgs.pl line 4.
What I do next is install the LWP perl module (libwww-perl-6.05).
~# perl Makefile.PL
Checking if your kit is complete...
perl: symbol lookup error: /root/perl5/lib/perl5/x86_64-linux-thread-multi/auto/List/Util/Util.so: undefined symbol: Perl_xs_handshake
Before posting, I've tried to another solution.
~# perl -MCPAN -e 'install Bundle::LWP'
perl: symbol lookup error: /root/perl5/lib/perl5/x86_64-linux-thread-multi/auto/List/Util/Util.so: undefined symbol: Perl_xs_handshake
To overcome the problem, I used YUM to install the required module named perl-libwww-perl.
~# yum install perl-libwww-perl
But it still doesn't work for my operation.
Sorry, I'm very new to this. Appreciate the help!
I had the same issue. And like others have said, this is because the program uses a different perl. I got the error when I used perl 5.24.0, but the program worked with perl-5.18.2.

Can't locate XML/LibXML.pm in #INC

I am trying to run script which uses XML/LibXML package.
But, XML/LibXML package is already installed. I ran following command:
perl -MXML::LibXML -e 1. it did not give any output, that means this package is installed.
when i ran my script. Following error occured.
Can't locate XML/LibXML.pm in #INC (#INC contains:
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8
.). BEGIN failed--compilation aborted.
One more point to note is there is no directory "5.8.8" under /usr/lib64/perl5/site_perl/
Please suggest to overcome this issue.
There are three possibilities:
You have two installs of perl and you script is using the "wrong" one.
Either install XML::LibXML using the perl used by the script, or replace the script's shebang (#!) line with the output of the following:
perl -MXML::LibXML -le'print "#!".$^X'
Differences in the environment.
If XML::LibXML was installed in a nonstandard directory, it could be that PERL5LIB was used to communicate this to perl when you executed your test, but not when you run the script.
A permission issue.
This isn't very likely.
If the script is run as the same user as your test, it's not a permission issue.
If it is a permission issue, make sure the library directory is accessible to the user executing the script.

now function for displaying Date and Time not working through ActivePerl

I want to display the present date and time in perl using now() function. I am running this script using Active Perl software but I am getting error.
#! /usr/bin/perl
use Date::Parse;
$date = str2time(now());
print "$date\n";
I am getting error as:
C:\Users\admin\Desktop>perl test.pl
Can't locate Date/Parse.pm in #INC (#INC contains: C:/Perl/site/lib C:/Perl/lib
.) at test.pl line 3.
BEGIN failed--compilation aborted at test.pl line 3.
Please help.
You do not have module Date::Parse installed by default in ActivePerl.
You can fix this with:
ppm install Date::Parse
This works for me for ActivePerl 5.16 default install.

Perl - Error : Cant locate file in #INC

As I am Novice to Perl, I would be happy if you are able to solve my problem.
I created a Module named "Messages.pm" and it resides in the path "E:\Venkadachalam\Perl_samples\Modules\Messages.pm"
Also I included this module in another Perl file named "Main.pl" as show below
use Modules::Messages;
and invoked the subroutine defined in the Messaged.pm in the Main.pl
In the Command Window, I tried executing the above perl program as
perl -I E:\Venkadachalam\Perl_samples\Modules\Messages.pm Main.pl
Here it gives an error message as shown below:
"Can't locate Modules/Messages.pm in #INC (#INC contains: E:/Venkadachalam/Perl_s
ample/Modules C:/Perl/site/lib C:/Perl/lib .) at Main.pl line 1
BEGIN failed--compilation aborted at Main.pl line 1"
Any help is highly appreciated.
You are saying use Modules::Messages; and pointing the lib to E:/Venkadachalam/Perl_sample/Modules. So it is expecting lib to be E:/Venkadachalam/Perl_sample/Modules/Modules/Messages.pm.
Change it to E:/Venkadachalam/Perl_sample
Doc