Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing XML::DOM::XPath

I've written a small Perl script that uses the Bio::Seq and Bio::SeqIO packages. When I try to run the script on a linux-based server. I got a lot of errors which basically told me that BioPerl hadn't been installed.

I installed ActiveState Perl 5.26 locally and have taken care of most of the prerequisites in order to install Bio::Perl. Only XML::DOM::XPath remains a problem. After trying to install the package, I received the following error:

Test Summary Report
-------------------
t/test_non_ascii.t                  (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 10 tests but ran 0.
Files=35, Tests=183,  4 wallclock secs ( 0.12 usr  0.04 sys +  3.46 cusr  0.52 csys =  4.14 CPU)
Result: FAIL
Failed 1/35 test programs. 0/183 subtests failed.
make: *** [test_dynamic] Error 255
  MIROD/XML-DOM-XPath-0.14.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports MIROD/XML-DOM-XPath-0.14.tar.gz
Failed during this command:
 MIROD/XML-DOM-XPath-0.14.tar.gz              : make_test NO


nolock_cpan> reports MIROD/XML-DOM-XPath-0.14.tar.gz
Distribution: M/MI/MIROD/XML-DOM-XPath-0.14.tar.gz
Fetching 'http://www.cpantesters.org/show/XML-DOM-XPath.yaml'...DONE

Catching error: "CPAN::Exception::yaml_process_error=HASH(0x4ca5c28)" at /data/calvin/ActivePerl-5.26/lib/CPAN.pm line 392.
        CPAN::shell() called at -e line 1

This error seems to be connected to t/test_non_ascii.t, as an earlier output of trying to run the command install "XML::DOM::XPath" gave the following error:

t/test_non_ascii.t .................... The encoding pragma is no longer supported. Check cperl at t/test_non_ascii.t line 10.
BEGIN failed--compilation aborted at t/test_non_ascii.t line 10.
  Looks like your test exited with 2 before it could output anything.
t/test_non_ascii.t .................... Dubious, test returned 2 (wstat 512, 0x200)
Failed 10/10 subtests

Does anybody know what the exact cause of the error is and how I can fix it?

like image 959
Nottuh Avatar asked Dec 25 '17 07:12

Nottuh


3 Answers

Not sure if you ended up figuring this out, but the issue is with the encoding on line 10 of t/test_non_ascii.t, which uses encoding.pm which is no longer supported after Perl 5.25.3:

use encoding 'utf8';

The solution as can be found in the bug reports on CPAN is to change the line to

use utf8;

Results of git diff t/test_nonascii.t t/test_non_ascii.t.new:

--- t/test_non_ascii.t
+++ t/test_non_ascii.t.new
@@ -7,7 +7,7 @@ use strict;
 use Test::More tests => 10;
 use XML::DOM::XPath;

-use encoding 'utf8';
+use utf8;

 my $display_warning=0;
like image 166
august Avatar answered Nov 18 '22 07:11

august


It's been a while, but this is the lines I've used:

sudo cpanm Bio::Perl
sudo apt install clustalw
sudo cpanm Bio::Tools::Run::Alignment::Clustalw

I'm not sure how it works, let me know what you think.

like image 1
Raul Esteves Avatar answered Nov 18 '22 08:11

Raul Esteves


I was using cpanm to install the XML::DOM::XPath and encountered the same error.

To fix this issue, you should modify the "test_non_ascii.t" file (e.g. the path of mine is "/Users/USER_NAME/.cpanm/work/1565320320.17142/XML-DOM-XPath-0.14/t") - change use encoding 'utf8'; to use utf8;, and then install the module using this modified file (see below for my command). It worked well.

cpanm /Users/USER_NAME/.cpanm/work/1565320320.17142/XML-DOM-XPath-0.14
like image 1
Qiongyi Avatar answered Nov 18 '22 08:11

Qiongyi