Subject: | t/72destruction.t fails with Perl < 5.10 |
Fails like this:
t/72destruction.....................Can't call method "attributes" on an
undefined value at
/builddir/build/BUILD/XML-LibXML-1.91/blib/lib/XML/LibXML/AttributeHash.pm
line 43.
# Looks like your test died before it could output anything.
dubious
Test returned status 9 (wstat 2304, 0x900)
Scalar found where operator expected at (eval 152) line 1, near "'int'
$__val"
(Missing operator before $__val?)
DIED. FAILED test 1
Failed 1/1 tests, 0.00% okay
Attached patch fixes this for me but I expect you can probably come up
with a neater solution ;-)
Subject: | XML-LibXML-1.91-72destruction.patch |
t/72destruction.....................Can't call method "attributes" on an undefined value at /builddir/build/BUILD/XML-LibXML-1.91/blib/lib/XML/LibXML/AttributeHash.pm line 43.
# Looks like your test died before it could output anything.
dubious
Test returned status 9 (wstat 2304, 0x900)
Scalar found where operator expected at (eval 152) line 1, near "'int' $__val"
(Missing operator before $__val?)
DIED. FAILED test 1
Failed 1/1 tests, 0.00% okay
--- XML-LibXML/lib/XML/LibXML/AttributeHash.pm
+++ XML-LibXML/lib/XML/LibXML/AttributeHash.pm
@@ -40,11 +40,14 @@
sub all_keys
{
my ($self, @keys) = @_;
- foreach ($self->element->attributes)
+ if (defined ($self->element) and defined ($self->element->attributes))
{
- if (! $_->isa('XML::LibXML::Namespace'))
+ foreach ($self->element->attributes)
{
- push @keys, $self->to_clark($_->namespaceURI, $_->localname);
+ if (! $_->isa('XML::LibXML::Namespace'))
+ {
+ push @keys, $self->to_clark($_->namespaceURI, $_->localname);
+ }
}
}
return sort @keys;