pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/textproc/p5-XML-LibXML-Iterator Fix a bug in XML::LibX...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4b020741e670
branches:  trunk
changeset: 531796:4b020741e670
user:      seb <seb%pkgsrc.org@localhost>
date:      Mon Aug 06 15:28:03 2007 +0000

description:
Fix a bug in XML::LibXML::NodeList::Iterator::last().
Patches sent upstream.

Bump PKGREVISION to 1.

diffstat:

 textproc/p5-XML-LibXML-Iterator/Makefile         |   3 +-
 textproc/p5-XML-LibXML-Iterator/distinfo         |   4 +-
 textproc/p5-XML-LibXML-Iterator/patches/patch-aa |  13 ++++
 textproc/p5-XML-LibXML-Iterator/patches/patch-ab |  63 ++++++++++++++++++++++++
 4 files changed, 81 insertions(+), 2 deletions(-)

diffs (109 lines):

diff -r 2c1382fe51f3 -r 4b020741e670 textproc/p5-XML-LibXML-Iterator/Makefile
--- a/textproc/p5-XML-LibXML-Iterator/Makefile  Mon Aug 06 15:27:06 2007 +0000
+++ b/textproc/p5-XML-LibXML-Iterator/Makefile  Mon Aug 06 15:28:03 2007 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.9 2007/07/19 21:55:50 seb Exp $
+# $NetBSD: Makefile,v 1.10 2007/08/06 15:28:03 seb Exp $
 #
 
 DISTNAME=      XML-LibXML-Iterator-1.02
+PKGREVISION=   1
 PKGNAME=       p5-${DISTNAME}
 SVR4_PKGNAME=  p5xlx
 CATEGORIES=    textproc perl5
diff -r 2c1382fe51f3 -r 4b020741e670 textproc/p5-XML-LibXML-Iterator/distinfo
--- a/textproc/p5-XML-LibXML-Iterator/distinfo  Mon Aug 06 15:27:06 2007 +0000
+++ b/textproc/p5-XML-LibXML-Iterator/distinfo  Mon Aug 06 15:28:03 2007 +0000
@@ -1,5 +1,7 @@
-$NetBSD: distinfo,v 1.3 2007/07/19 21:55:51 seb Exp $
+$NetBSD: distinfo,v 1.4 2007/08/06 15:28:03 seb Exp $
 
 SHA1 (XML-LibXML-Iterator-1.02.tar.gz) = cb41b80d22b0c5ee5de61abeb5a866b349b96966
 RMD160 (XML-LibXML-Iterator-1.02.tar.gz) = a1f003fd89a20693f3b989b77ec0ad77dc75cd7e
 Size (XML-LibXML-Iterator-1.02.tar.gz) = 7712 bytes
+SHA1 (patch-aa) = 114cec249ab35eed749037e7ad33811fcb077a42
+SHA1 (patch-ab) = b8330c8a1b30e99311bebf19c15f5f3bf29a4672
diff -r 2c1382fe51f3 -r 4b020741e670 textproc/p5-XML-LibXML-Iterator/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/p5-XML-LibXML-Iterator/patches/patch-aa  Mon Aug 06 15:28:03 2007 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-aa,v 1.1 2007/08/06 15:28:03 seb Exp $
+
+--- lib/XML/LibXML/NodeList/Iterator.pm.orig   2007-06-23 13:42:16.000000000 +0000
++++ lib/XML/LibXML/NodeList/Iterator.pm
+@@ -61,7 +61,7 @@ sub first    { $_[0][1]=0;
+ sub last     {
+     my $i = scalar(@{$_[0][0]})-1;
+     while($i >= 0){
+-        if ( $_[0]->accept_node($_[0][0][$i] == FILTER_ACCEPT) ) {
++        if ( $_[0]->accept_node($_[0][0][$i]) == FILTER_ACCEPT ) {
+             $_[0][1] = $i;
+             last;
+         }
diff -r 2c1382fe51f3 -r 4b020741e670 textproc/p5-XML-LibXML-Iterator/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/p5-XML-LibXML-Iterator/patches/patch-ab  Mon Aug 06 15:28:03 2007 +0000
@@ -0,0 +1,63 @@
+$NetBSD: patch-ab,v 1.1 2007/08/06 15:28:04 seb Exp $
+
+--- t/03list.t.orig    2007-06-23 13:33:50.000000000 +0000
++++ t/03list.t
+@@ -1,7 +1,7 @@
+ use Test;
+ 
+ 
+-BEGIN { plan tests => 7; }
++BEGIN { plan tests => 8; }
+ 
+ use XML::LibXML;
+ use XML::LibXML::NodeList::Iterator;
+@@ -257,3 +257,49 @@ sub t05_run_iterate {
+     return 1;
+ }
+ ok(t05_run_iterate());
++
++package MyFilter;
++use base qw(XML::NodeFilter);
++use XML::NodeFilter qw(:results);
++use UNIVERSAL;
++
++sub accept_node {
++    my $self = shift;
++    my $node = shift;
++    if (!UNIVERSAL::isa($node, 'XML::LibXML::Element')) {
++        die "invalid node in MyFilter::accept_node()";
++    }
++    return FILTER_DECLINED;
++}
++
++package main;
++
++sub t08_last_with_filter {
++    my $doc = XML::LibXML->new->parse_string( $xmlstr );
++    
++    unless ( defined $doc ) {
++        print "# XML string was not parsed properly\n";
++        return 0;
++    }
++
++    my $nodelist = $doc->findnodes( '//*' );
++    my $iterator = XML::LibXML::NodeList::Iterator->new( $nodelist ); 
++    $iterator->add_filter( MyFilter->new() );
++
++    $iterator->last();
++
++    unless ( defined $iterator->current() ) {
++        print "# there is no last node\n";
++        return 0;
++    }
++    
++    unless ( $iterator->current()->nodeName() eq "D" ) {
++        print "# expected nodeName 'D' received '"
++            . $iterator->current()->nodeName()
++            . "'\n";
++        return 0;
++    }
++
++    return 1;
++}
++ok(t08_last_with_filter());



Home | Main Index | Thread Index | Old Index