Error installing XML::DOM::XPath

Error installing XML::DOM::XPath

xml dom xpath perl
install bioperl
install perl module locally
cpanm command not found

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?


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;

Error installing XML::DOM::XPath - xml - html, 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​  To install XML::DOM::XPath, simply copy and paste either of the commands in to your terminal. cpanm. cpanm XML::DOM::XPath. CPAN shell. perl -MCPAN -e shell install


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.

XML::DOM::XPath, XML::DOM::XPath allows you to use XML::XPath methods to query a DOM. This is often much easier than relying only on getElementsByTagName. It lets you  To install XML::DOM::XPath, simply copy and paste either of the commands in to your terminal. cpanm. cpanm XML::DOM::XPath. CPAN shell. perl -MCPAN -e shell install


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

XML-DOM-XPath-0.14, upgraded dependency to XML::XPathEngine 1.10; added the findnodes_as_strings method, that returns a list of strings, one for each matching node; fixed RT  XML Path Language (XPath) queries can be used to query the XML documents with DOM methods such as selectNodes or selectSingleNode.The default query that is used is XSLPattern for backward compatibility.


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

Problem installing XML::DOM, XML::Parser comes with ActiveState Perl. Having said that, XML::DOM is probably not a good choice of DOM module. XML::XPath would be better  How to install XML-DOM-XPath. Download and install ActivePerl; Open Command Prompt; Type ppm install XML-DOM-XPath Perl 5.8 Perl 5.10 Perl 5.12 Perl 5.14 Perl 5.16


mac os X mojave Perl 5 XML::DOM::XPath test_non_ascii fail , You need to change use encoding 'utf8'; to use utf8;. I was using cpanm to install the XML::DOM::XPath and encountered the same error as  XML Path Language (XPath) queries can be used to query the XML documents with DOM methods such as selectNodes or selectSingleNode. The default query that is used is XSLPattern for backward compatibility. To use XPath, change the SelectionLanguage internal property of DOMDocument to XPath. XPath adds lot of functionality; for example, it allows


Ubuntu CPAN 2 dependencies missing (GD,XML::DOM::XPath , I'm trying to install Bio::Seq on CPAN in Ubuntu, but it's not working. Failed 1/212 test programs. 2/14838 subtests failed. make:  In this case, someone has written a module called XML::XPath (in Perl, the path is delineated by '::') and you just need to install it. The easiest way to install it is via cpan, it's a tool that comes installed with most Perl installations. Just run: cpan (you'll be dropped into a different command prompt) install XML::XPath


Bug #29423 for XML-DOM-XPath: make test, I can't seem to replicate that bug, as I only have en locales installed (ironic <​bug-XML-DOM-XPath@rt.cpan.org> ha scritto: Show quoted text. Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.