6

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?

Sudha Velan
  • 633
  • 8
  • 24
Nottuh
  • 61
  • 1
  • 4

5 Answers5

5

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;
august
  • 725
  • 5
  • 15
1

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.

1

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
Qiongyi
  • 11
  • 1
  • I had the same issue, I updated my test_nonascii.t file, and then I tried to install it using - cpanm "/path/XML-DOM-XPath-0.14/" but I was not able to install it. Any other suggestion? – Alex Oct 01 '19 at 14:57
  • editing in the source file as suggested by answers below didn't work but editing in the build file and building from there did. any ideas why? – Brian Wiley Jul 23 '20 at 03:53
1

Although most of the answers above are right, they do not address the problem properly.

Assuming that you are in a Linux system you need to go to the source file which is compressed. You can usually find this at /home/username/.cpan/sources/authors/id/M/MI/MIROD/XML-DOM-XPath-0.14.tar.gz. You must uncompress the file

tar -xvzf XML-DOM-XPath-0.14.tar.gz
nano XML-DOM-XPath-0.14/t/test_non_ascii.t

Modify the file by substituting use encoding 'utf8'; with use utf8;

Save the file with Ctrl+X + S + Enter

Now you must compress the file again using

tar -czvf XML-DOM-XPath-0.14.tar.gz XML-DOM-XPath-0.14/

Retrieve md5 and sha256sum as follows:

sha256sum XML-DOM-XPath-0.14.tar.gz
md5sum XML-DOM-XPath-0.14.tar.gz

Replace those checksums in the CHECKSUMS file by searching in the json file the filename XML-DOM-XPath-0.14.tar.gz

Now run the installation normally, it should work!

You are welcome

andresito
  • 111
  • 3
1

Andresito's explanation worked for me. Here are the steps again, but using CPAN::Checksums.

  1. cd .cpan/sources/authors/id/M/MI/MIROD
  2. tar zxvf XML-DOM-XPath-0.14.tar.gz
  3. edit and save XML-DOM-XPath-0.14/t/test_non_ascii.t
  4. tar zcvf XML-DOM-XPath-0.14.tar.gz XML-DOM-XPath-0.14
  5. perl -we 'use CPAN::Checksums qw(updatedir); printf "%s\n", updatedir(".")'
  6. cpan cpan XML::DOM::XPath

Danny
  • 41
  • 3