I tried it myself this morning.

Only code:

use XML::LibXML;

Result:
Can't locate XML/LibXML/Common.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at :/Perl/site/lib/XML/LibXML.pm line 12. BEGIN failed--compilation aborted at C:/Perl/site/lib/XML/LibXML.pm line 12. Compilation failed in require at test_LibXML.pl line 3. BEGIN failed--compilation aborted at test_LibXML.pl line 3.

This is the line in LibXML.pm that causes the error:
use XML::LibXML::Common qw(:encoding :libxml);
Which is not surprising of course. I looked in C:\Perl\site\lib\XML\LibXML and the Common.pm is (of course) missing. Apparently the ppm package for Win32 from ActiveState is flawed.

Next I installed the ppm for Common separately. This took care of the problem.... but then the next problem popped up:-(

Update

Code used (taken from the pod)

use strict; use warnings; use XML::LibXML; my $parser = XML::LibXML->new; open my $fh, "dHarry.xml"; binmode $fh; # drop all PerlIO layers possibly created by a use open + pragma my $doc = $parser->parse_fh($fh); open my $out, "out.xml"; binmode $fh; # as above $doc->toFh($fh); # or print $fh $doc->toString();

Error message: Can't locate object method "toFh" via package "XML::LibXML::Document". Which makes a lot of sense since the sub is not in LibXML.pm where it should be. This wrong as it was added in v1.53 and my version is 1.66.

The ppm package from ActiveState is buggy. As an alternative you can try build it from the CPAN distribution or find another Win32 ppm package for it.

Update 2

Submitted the bug to ActiveState.

Update 3

I tried the trouchelle ppm package. First you have to install Common separately because it's not present on trouchelle. The code above gives the following error message:

Can't load 'C:/Perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XM +L::LibXML: load_file:The specified procedure could not be found at C: +/Perl/lib/DynaLoader.pm line 230. at C:/Perl/site/lib/XML/LibXML.pm line 116 BEGIN failed--compilation aborted at C:/Perl/site/lib/XML/LibXML.pm li +ne 116. Compilation failed in require at C:/workspace/XML/test_LibXML.pl line +4. BEGIN failed--compilation aborted at C:/workspace/XML/test_LibXML.pl l +ine 4.
So now we're back at Problems installing XML::LibXML for Perl5.10 on Win32 platform with the remark that it's the same s*** for Per5.8.8.


In reply to Re: use XML::LibXML; is causing compile error by dHarry
in thread use XML::LibXML; is causing compile error by willjones

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.