Subject: | Module will not install in Strawberry Perl +patch |
Hi
When installing XML::Atom in Strawberry Perl v5.12.3 on Windows 7, the
installation fails at test 31 with a invalid URI message.
I've rated this as critical as this bug stops XML::Atom from installing
on Windows, and therefore stops upstream modules in CAPN from
installing on Windows as well (Such as Net::Google::Calendar).
The problem appears to be that in test 31, which uses the test code 31-
external-entities-libxml.t, the file URI is obtained by the module
FileBin. But the file URI that is provided by FindBin includes the
Windows Drive letter syntax and a reversed directory seperatorIn my
case this results in C:/ being included in the path that the FindBin
modules returns. Which then chokes with
t/31-external-entities-libxml.t .. :3: parser error : Invalid URI:
file://C:/st
awberry/cpan/build/XML-Atom-0.39-hGqzUB/t/samples/entry-ns.xml
EM "file://C:/strawberry/cpan/build/XML-Atom-0.39-
hGqzUB/t/samples/entry-ns.xml
^
:20: parser error : Entity 'ref' failed to parse
<content type="text/html" xml:lang="en-us">&ref;
^
# Looks like your test exited with 255 before it could output anything.
t/31-external-entities-libxml.t .. Dubious, test returned 255 (wstat
65280, 0xf
00)
Failed 4/4 subtests
Adding in the substitution regex below , after the my declaration of
$filepath, strips out the c:/ and test 31 passes and the module
installs.
$filepath =~ s/\w\:\///;
Cheers
Andrew Dent
adent@comptroub.com
Computer Troubleshooters Croydon
Subject: | 31-external-entities-libxml.t |
use strict;
use Test::More;
use XML::Atom::Entry;
use FindBin;
my $filepath = "$FindBin::Bin/samples/entry-ns.xml";
$filepath =~ s/\w\:\///;
BEGIN {
unless (eval { require XML::LibXML }) {
plan skip_all => 'LibXML required for this test';
}
}
plan tests => 4;
my $xml = <<"EOX";
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE entry [
<!ENTITY ref SYSTEM "file://$filepath">
]>
<entry xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Guest Author</title>
<link rel="alternate" type="text/html" href="http://ben.stupidfool.org/typepad/2003/07/guest_author.html" />
<link rel="service.edit" title="Edit" type="application/x.atom+xml" href="http://www.example.com/atom/entry_id=75207" />
<id>tag:typepad.com:post:75207</id>
<issued>2003-07-21T02:47:34-07:00</issued>
<modified>2003-08-22T18:36:57-07:00</modified>
<created>2003-07-21T02:47:34-07:00</created>
<summary>No, Ben isn't updating. It's me testing out guest author functionality....</summary>
<author>
<name>Mena</name>
<url>http://mena.typepad.com/</url>
</author>
<dc:subject>Food</dc:subject>
<dc:subject>Cats</dc:subject>
<content type="text/html" xml:lang="en-us">&ref;
<div xmlns="http://www.w3.org/1999/xhtml"><p>No, Ben isn't updating. It's me testing out guest author functionality.</p></div>
</content>
</entry>
EOX
## default sane parser
{
my $entry = XML::Atom::Entry->new(Stream => \$xml);
is $entry->title, "Guest Author", "got title";
my $content = $entry->content->body;
unlike $content, qr/This is what you get when you do unit testing/,
"ignored entity";
}
## custom parser
{
my $libxml = XML::LibXML->new;
my $entry = XML::Atom::Entry->new(Stream => \$xml, Parser => $libxml);
is $entry->title, "Guest Author", "got title";
my $content = $entry->content->body;
like $content, qr/This is what you get when you do unit testing/,
"resolved entity";
}