perlperl-modulexml-libxml

XML::LibXML::Pattern failed to install


I'm using XML::LibXML to read a large xml file. Below is a snippet of the code:

use XML::LibXML::Pattern;
next unless $reader->matchesPattern($doc_pattern);

As you can see, I need to install the XML::LibXML::Pattern module. Here is the log info during the installation process of XML::LibXML::Pattern.

It seems to have only installed the XML::LibXML, not the XML::LibXML::Pattern? Did I miss something?

Oh, I needed the XML::LibXML::Reader module too, and its installation process went smooth.

`/Users/test/perl5/perlbrew/bin/perlbrew exec -q --with perl-5.31.3 

/Users/test/perl5/perlbrew/perls/perl-5.31.3/bin/cpan XML::LibXML::Pattern
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/Users/test/.cpan/Metadata'
  Database was generated on Tue, 27 Aug 2019 22:41:03 GMT
Running install for module 'XML::LibXML::Pattern'
Checksum for /Users/test/.cpan/sources/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0201.tar.gz ok
'YAML' not installed, will not store persistent state
Configuring S/SH/SHLOMIF/XML-LibXML-2.0201.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for XML::LibXML
Writing MYMETA.yml and MYMETA.json
  SHLOMIF/XML-LibXML-2.0201.tar.gz
  /Users/test/perl5/perlbrew/perls/perl-5.31.3/bin/perl5.31.3 Makefile.PL -- OK
Running make for S/SH/SHLOMIF/XML-LibXML-2.0201.tar.gz
cp lib/XML/LibXML/InputCallback.pod blib/lib/XML/LibXML/InputCallback.pod
cp lib/XML/LibXML/NodeList.pm blib/lib/XML/LibXML/NodeList.pm
cp lib/XML/LibXML/PI.pod blib/lib/XML/LibXML/PI.pod
cp lib/XML/LibXML/SAX/Generator.pm blib/lib/XML/LibXML/SAX/Generator.pm
cp LibXML.pod blib/lib/XML/LibXML.pod
cp lib/XML/LibXML/Element.pod blib/lib/XML/LibXML/Element.pod
cp lib/XML/LibXML/Reader.pm blib/lib/XML/LibXML/Reader.pm
cp lib/XML/LibXML/Schema.pod blib/lib/XML/LibXML/Schema.pod
cp lib/XML/LibXML/DOM.pod blib/lib/XML/LibXML/DOM.pod
cp lib/XML/LibXML/Attr.pod blib/lib/XML/LibXML/Attr.pod
cp lib/XML/LibXML/Namespace.pod blib/lib/XML/LibXML/Namespace.pod
cp lib/XML/LibXML/RegExp.pod blib/lib/XML/LibXML/RegExp.pod
cp lib/XML/LibXML/Number.pm blib/lib/XML/LibXML/Number.pm
cp lib/XML/LibXML/Dtd.pod blib/lib/XML/LibXML/Dtd.pod
cp lib/XML/LibXML/Error.pod blib/lib/XML/LibXML/Error.pod
cp lib/XML/LibXML/Devel.pm blib/lib/XML/LibXML/Devel.pm
cp lib/XML/LibXML/Literal.pm blib/lib/XML/LibXML/Literal.pm
cp lib/XML/LibXML/RelaxNG.pod blib/lib/XML/LibXML/RelaxNG.pod
cp lib/XML/LibXML/SAX/Parser.pm blib/lib/XML/LibXML/SAX/Parser.pm
cp lib/XML/LibXML/Reader.pod blib/lib/XML/LibXML/Reader.pod
cp lib/XML/LibXML/Error.pm blib/lib/XML/LibXML/Error.pm
cp lib/XML/LibXML/XPathContext.pm blib/lib/XML/LibXML/XPathContext.pm
cp lib/XML/LibXML/XPathExpression.pod blib/lib/XML/LibXML/XPathExpression.pod
cp lib/XML/LibXML/Common.pod blib/lib/XML/LibXML/Common.pod
cp lib/XML/LibXML/Text.pod blib/lib/XML/LibXML/Text.pod
cp lib/XML/LibXML/Parser.pod blib/lib/XML/LibXML/Parser.pod
cp lib/XML/LibXML/XPathContext.pod blib/lib/XML/LibXML/XPathContext.pod
cp lib/XML/LibXML/AttributeHash.pm blib/lib/XML/LibXML/AttributeHash.pm
cp lib/XML/LibXML/DocumentFragment.pod blib/lib/XML/LibXML/DocumentFragment.pod
cp lib/XML/LibXML/Node.pod blib/lib/XML/LibXML/Node.pod
cp lib/XML/LibXML/SAX/Builder.pm blib/lib/XML/LibXML/SAX/Builder.pm
cp lib/XML/LibXML/Comment.pod blib/lib/XML/LibXML/Comment.pod
cp lib/XML/LibXML/SAX/Builder.pod blib/lib/XML/LibXML/SAX/Builder.pod
cp lib/XML/LibXML/SAX.pod blib/lib/XML/LibXML/SAX.pod
cp lib/XML/LibXML/CDATASection.pod blib/lib/XML/LibXML/CDATASection.pod
cp lib/XML/LibXML/ErrNo.pm blib/lib/XML/LibXML/ErrNo.pm
cp lib/XML/LibXML/SAX.pm blib/lib/XML/LibXML/SAX.pm
cp lib/XML/LibXML/Document.pod blib/lib/XML/LibXML/Document.pod
cp lib/XML/LibXML/Pattern.pod blib/lib/XML/LibXML/Pattern.pod
cp lib/XML/LibXML/Common.pm blib/lib/XML/LibXML/Common.pm
cp lib/XML/LibXML/ErrNo.pod blib/lib/XML/LibXML/ErrNo.pod
cp LibXML.pm blib/lib/XML/LibXML.pm
cp lib/XML/LibXML/Boolean.pm blib/lib/XML/LibXML/Boolean.pm
Running Mkbootstrap for LibXML ()
chmod 644 "LibXML.bs"
"/Users/test/perl5/perlbrew/perls/perl-5.31.3/bin/perl5.31.3" -MExtUtils::Command::MM -e 'cp_nonempty' -- LibXML.bs blib/arch/auto/XML/LibXML/LibXML.bs 644
cc -c   -I/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2  -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -O3   -DVERSION=\"2.0201\" -DXS_VERSION=\"2.0201\"  "-I/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/darwin-2level/CORE"  -DHAVE_UTF8 Av_CharPtrPtr.c
"/Users/test/perl5/perlbrew/perls/perl-5.31.3/bin/perl5.31.3" "/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/ExtUtils/xsubpp"  -typemap '/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/ExtUtils/typemap' -typemap '/Users/test/.cpan/build/XML-LibXML-2.0201-9/typemap'  Devel.xs > Devel.xsc
mv Devel.xsc Devel.c
cc -c   -I/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2  -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -O3   -DVERSION=\"2.0201\" -DXS_VERSION=\"2.0201\"  "-I/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/darwin-2level/CORE"  -DHAVE_UTF8 Devel.c
"/Users/test/perl5/perlbrew/perls/perl-5.31.3/bin/perl5.31.3" "/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/ExtUtils/xsubpp"  -typemap '/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/ExtUtils/typemap' -typemap '/Users/test/.cpan/build/XML-LibXML-2.0201-9/typemap'  LibXML.xs > LibXML.xsc
mv LibXML.xsc LibXML.c
cc -c   -I/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2  -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -O3   -DVERSION=\"2.0201\" -DXS_VERSION=\"2.0201\"  "-I/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/darwin-2level/CORE"  -DHAVE_UTF8 LibXML.c
cc -c   -I/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2  -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -O3   -DVERSION=\"2.0201\" -DXS_VERSION=\"2.0201\"  "-I/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/darwin-2level/CORE"  -DHAVE_UTF8 dom.c
cc -c   -I/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2  -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -O3   -DVERSION=\"2.0201\" -DXS_VERSION=\"2.0201\"  "-I/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/darwin-2level/CORE"  -DHAVE_UTF8 perl-libxml-mm.c
cc -c   -I/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2  -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -O3   -DVERSION=\"2.0201\" -DXS_VERSION=\"2.0201\"  "-I/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/darwin-2level/CORE"  -DHAVE_UTF8 perl-libxml-sax.c
cc -c   -I/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2  -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -O3   -DVERSION=\"2.0201\" -DXS_VERSION=\"2.0201\"  "-I/Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/darwin-2level/CORE"  -DHAVE_UTF8 xpath.c
rm -f blib/arch/auto/XML/LibXML/LibXML.bundle
LD_RUN_PATH="/usr/local/Cellar/libxml2/2.9.9_2/lib" cc  -mmacosx-version-min=10.15 -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector-strong  Av_CharPtrPtr.o Devel.o LibXML.o dom.o perl-libxml-mm.o perl-libxml-sax.o xpath.o  -o blib/arch/auto/XML/LibXML/LibXML.bundle  \
       -L/usr/local/Cellar/libxml2/2.9.9_2/lib -lxml2   \

chmod 755 blib/arch/auto/XML/LibXML/LibXML.bundle
Manifying 34 pod documents
  SHLOMIF/XML-LibXML-2.0201.tar.gz
  /usr/bin/make -- OK
The current configuration of allow_installing_outdated_dists is 'ask/yes', but for this option we would need 'CPAN::DistnameInfo' installed. Please install 'CPAN::DistnameInfo' as soon as possible. As long as we are not equipped with 'CPAN::DistnameInfo' this option does not take effect
Running make test for SHLOMIF/XML-LibXML-2.0201.tar.gz
"/Users/test/perl5/perlbrew/perls/perl-5.31.3/bin/perl5.31.3" -MExtUtils::Command::MM -e 'cp_nonempty' -- LibXML.bs blib/arch/auto/XML/LibXML/LibXML.bs 644
PERL_DL_NONLAZY=1 "/Users/test/perl5/perlbrew/perls/perl-5.31.3/bin/perl5.31.3" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-report-prereqs.t .............................. # 
# Versions for all modules listed in MYMETA.json (including optional ones):
# 
# === Configure Requires ===
# 
#     Module              Want     Have
#     ------------------- ---- --------
#     Alien::Libxml2       any     0.09
#     Config               any 5.031003
#     ExtUtils::MakeMaker  any     7.36
# 
# === Build Requires ===
# 
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 7.36
# 
# === Test Requires ===
# 
#     Module       Want     Have
#     ------------ ---- --------
#     Config        any 5.031003
#     Errno         any     1.30
#     IO::File      any     1.41
#     IO::Handle    any     1.41
#     POSIX         any     1.89
#     Scalar::Util  any     1.50
#     Test::More    any 1.302166
#     locale        any     1.09
#     utf8          any     1.22
# 
# === Runtime Requires ===
# 
#     Module                    Want  Have
#     ------------------------- ---- -----
#     Carp                       any  1.50
#     DynaLoader                 any  1.45
#     Encode                     any  3.01
#     Exporter                  5.57  5.74
#     IO::Handle                 any  1.41
#     Scalar::Util               any  1.50
#     Tie::Hash                  any  1.05
#     XML::NamespaceSupport     1.07  1.12
#     XML::SAX                  0.11  1.02
#     XML::SAX::Base             any  1.09
#     XML::SAX::DocumentLocator  any undef
#     XML::SAX::Exception        any  1.09
#     base                       any  2.27
#     constant                   any  1.33
#     overload                   any  1.31
#     parent                     any 0.237
#     strict                     any  1.11
#     vars                       any  1.05
#     warnings                   any  1.45
# 
t/00-report-prereqs.t .............................. ok
t/01basic.t ........................................ 1/3 # 
# 
# Compiled against libxml2 version: 20909
# Running libxml2 version:          20909
# 
t/01basic.t ........................................ ok
t/02parse.t ........................................ ok
t/03doc.t .......................................... ok
t/04node.t ......................................... ok
t/05text.t ......................................... ok
t/06elements.t ..................................... ok
t/07dtd.t .......................................... ok
t/08findnodes.t .................................... ok
t/09xpath.t ........................................ ok
t/10ns.t ........................................... ok
t/11memory.t ....................................... skipped: These tests are for authors only!
t/12html.t ......................................... ok
t/13dtd.t .......................................... ok
t/14sax.t .......................................... ok
t/15nodelist.t ..................................... ok
t/16docnodes.t ..................................... ok
t/17callbacks.t .................................... ok
t/18docfree.t ...................................... ok
t/19die_on_invalid_utf8_rt_58848.t ................. ok
t/19encoding.t ..................................... ok
t/20extras.t ....................................... ok
t/21catalog.t ...................................... ok
t/23rawfunctions.t ................................. ok
t/24c14n.t ......................................... ok
t/25relaxng.t ...................................... ok
t/26schema.t ....................................... ok
t/27new_callbacks_simple.t ......................... ok
t/28new_callbacks_multiple.t ....................... ok
t/29id.t ........................................... ok
t/30keep_blanks.t .................................. ok
t/30xpathcontext.t ................................. ok
t/31xpc_functions.t ................................ ok
t/32xpc_variables.t ................................ ok
t/35huge_mode.t .................................... ok
t/40reader.t ....................................... ok
t/40reader_mem_error.t ............................. ok
t/41xinclude.t ..................................... ok
t/42common.t ....................................... ok
t/43options.t ...................................... ok
t/44extent.t ....................................... ok
t/45regex.t ........................................ ok
t/46err_column.t ................................... ok
t/47load_xml_callbacks.t ........................... ok
t/48_memleak_rt_83744.t ............................ skipped: Test::LeakTrace is required for memory leak tests.
t/48_reader_undef_warning_on_empty_str_rt106830.t .. ok
t/48_removeChild_crashes_rt_80395.t ................ ok
t/48_replaceNode_DTD_nodes_rT_80521.t .............. ok
t/48_RH5_double_free_rt83779.t ..................... skipped: Test::LeakTrace is required.
t/48_rt123379_setNamespace.t ....................... ok
t/48_rt55000.t ..................................... ok
t/48_rt93429_recover_2_in_html_parsing.t ........... ok
t/48_SAX_Builder_rt_91433.t ........................ ok
t/48importing_nodes_IDs_rt_69520.t ................. ok
t/49_load_html.t ................................... ok
t/49callbacks_returning_undef.t .................... ok
t/49global_extent.t ................................ ok
t/50devel.t ........................................ ok
t/51_parse_html_string_rt87089.t ................... ok
t/60error_prev_chain.t ............................. ok
t/60struct_error.t ................................. ok
t/61error.t ........................................ ok
t/62overload.t ..................................... ok
t/71overloads.t .................................... ok
t/72destruction.t .................................. ok
t/80registryleak.t ................................. ok
t/90shared_clone_failed_rt_91800.t ................. skipped: no ithreads in this Perl
t/90stack.t ........................................ ok
t/90threads.t ...................................... skipped: no ithreads in this Perl
t/91unique_key.t ................................... ok
t/cpan-changes.t ................................... skipped: These tests are for authors only!
t/pod-files-presence.t ............................. ok
t/pod.t ............................................ skipped: These tests are for authors only!
t/release-kwalitee.t ............................... skipped: These tests are for authors only!
t/style-trailing-space.t ........................... skipped: These tests are for authors only!
All tests successful.
Files=75, Tests=2529, 14 wallclock secs ( 0.51 usr  0.22 sys +  9.62 cusr  2.02 csys = 12.37 CPU)
Result: PASS
  SHLOMIF/XML-LibXML-2.0201.tar.gz
  /usr/bin/make test -- OK
Running make install for SHLOMIF/XML-LibXML-2.0201.tar.gz
"/Users/test/perl5/perlbrew/perls/perl-5.31.3/bin/perl5.31.3" -MExtUtils::Command::MM -e 'cp_nonempty' -- LibXML.bs blib/arch/auto/XML/LibXML/LibXML.bs 644
Manifying 34 pod documents
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Appending installation info to /Users/test/perl5/perlbrew/perls/perl-5.31.3/lib/5.31.3/darwin-2level/perllocal.pod
  SHLOMIF/XML-LibXML-2.0201.tar.gz
  /usr/bin/make install  -- OK

Process finished with exit code 0

`


Solution

  • XML::LibXML::Pattern is a package populated by the XML::LibXML module (XML/LibXML.pm) of the XML-LibXML distribution, so the correct distribution was indeed installed.

    There's no XML/LibXML/Pattern.pm, so use XML::LibXML::Pattern; will fail. As the documentation shows, you need to use use XML::LibXML;.