r75904 - in /trunk/libhttp-oai-perl: CHANGES META.yml debian/changelog debian/compat debian/control debian/copyright lib/HTTP/OAI.pm lib/HTTP/OAI/Metadata/OAI_DC.pm t/01parse.t

fabreg-guest at users.alioth.debian.org fabreg-guest at users.alioth.debian.org
Fri Jun 17 17:19:16 UTC 2011


Author: fabreg-guest
Date: Fri Jun 17 17:19:11 2011
New Revision: 75904

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=75904
Log:
Updated package

Modified:
    trunk/libhttp-oai-perl/CHANGES
    trunk/libhttp-oai-perl/META.yml
    trunk/libhttp-oai-perl/debian/changelog
    trunk/libhttp-oai-perl/debian/compat
    trunk/libhttp-oai-perl/debian/control
    trunk/libhttp-oai-perl/debian/copyright
    trunk/libhttp-oai-perl/lib/HTTP/OAI.pm
    trunk/libhttp-oai-perl/lib/HTTP/OAI/Metadata/OAI_DC.pm
    trunk/libhttp-oai-perl/t/01parse.t

Modified: trunk/libhttp-oai-perl/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-oai-perl/CHANGES?rev=75904&op=diff
==============================================================================
--- trunk/libhttp-oai-perl/CHANGES (original)
+++ trunk/libhttp-oai-perl/CHANGES Fri Jun 17 17:19:11 2011
@@ -1,3 +1,10 @@
+3.25
+	- Added unit test for OAI_DC metadata() parsing
+	- Metadata::OAI_DC now parses dc when passed as a DOM to ->metadata
+
+3.24
+	- Fixed CPAN bugs #60760 and #60856
+
 3.23
 	- Changed license to BSD
 	- Added dependency for XML::SAX rt #43287

Modified: trunk/libhttp-oai-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-oai-perl/META.yml?rev=75904&op=diff
==============================================================================
--- trunk/libhttp-oai-perl/META.yml (original)
+++ trunk/libhttp-oai-perl/META.yml Fri Jun 17 17:19:11 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               HTTP-OAI
-version:            3.24
+version:            3.25
 abstract:           ~
 author:  []
 license:            unknown

Modified: trunk/libhttp-oai-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-oai-perl/debian/changelog?rev=75904&op=diff
==============================================================================
--- trunk/libhttp-oai-perl/debian/changelog (original)
+++ trunk/libhttp-oai-perl/debian/changelog Fri Jun 17 17:19:11 2011
@@ -1,3 +1,15 @@
+libhttp-oai-perl (3.25-1) UNRELEASED; urgency=low
+
+  * New upstream release
+  * Switch d/compat to 8.
+  * Bump to 3.9.2 Standard-Version.
+  * Removed version of Build-Depends-Indep and Depends.
+  * Add myself as Uploaders and Copyright.
+  * Switch debhelper to (>= 8).
+  
+
+ -- Fabrizio Regalli <fabreg at fabreg.it>  Fri, 17 Jun 2011 18:38:10 +0200
+
 libhttp-oai-perl (3.24-1) unstable; urgency=low
 
   [ Robin Sheat ]

Modified: trunk/libhttp-oai-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-oai-perl/debian/compat?rev=75904&op=diff
==============================================================================
--- trunk/libhttp-oai-perl/debian/compat (original)
+++ trunk/libhttp-oai-perl/debian/compat Fri Jun 17 17:19:11 2011
@@ -1,1 +1,1 @@
-7
+8

Modified: trunk/libhttp-oai-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-oai-perl/debian/control?rev=75904&op=diff
==============================================================================
--- trunk/libhttp-oai-perl/debian/control (original)
+++ trunk/libhttp-oai-perl/debian/control Fri Jun 17 17:19:11 2011
@@ -1,16 +1,18 @@
 Source: libhttp-oai-perl
 Section: perl
 Priority: optional
-Build-Depends: debhelper (>= 7.0.50)
-Build-Depends-Indep: liburi-perl,
+Build-Depends: debhelper (>= 8)
+Build-Depends-Indep: libhttp-message-perl,
+ liburi-perl,
  libwww-perl,
- libxml-libxml-perl (>= 1.60),
- libxml-sax-perl (>= 0.96),
+ libxml-libxml-perl,
+ libxml-sax-perl,
  perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Robin Sheat <robin at catalyst.net.nz>,
- Chris Butler <chrisb at debian.org>
-Standards-Version: 3.9.1
+ Chris Butler <chrisb at debian.org>,
+ Fabrizio Regalli <fabreg at fabreg.it>
+Standards-Version: 3.9.2
 Homepage: http://search.cpan.org/dist/HTTP-OAI/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libhttp-oai-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libhttp-oai-perl/
@@ -18,10 +20,11 @@
 Package: libhttp-oai-perl
 Architecture: all
 Depends: ${misc:Depends}, ${perl:Depends},
+ libhttp-message-perl,
  liburi-perl,
  libwww-perl,
- libxml-libxml-perl (>= 1.60),
- libxml-sax-perl (>= 0.96)
+ libxml-libxml-perl,
+ libxml-sax-perl
 Description: API for the OAI-PMH
  HTTP::OAI is a Perl library implementing an API to use the Open Archives 
  Initiative Protocol for Metadata Harvesting (OAI-PMH). See

Modified: trunk/libhttp-oai-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-oai-perl/debian/copyright?rev=75904&op=diff
==============================================================================
--- trunk/libhttp-oai-perl/debian/copyright (original)
+++ trunk/libhttp-oai-perl/debian/copyright Fri Jun 17 17:19:11 2011
@@ -35,6 +35,7 @@
 Files: debian/*
 Copyright: 2010, Lars Wirzenius <lars at catalyst.net.nz>
  2011, Chris Butler <chrisb at debian.org>
+ 2011, Fabrizio Regalli <fabreg at fabreg.it>
 License: GPL3+
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by

Modified: trunk/libhttp-oai-perl/lib/HTTP/OAI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-oai-perl/lib/HTTP/OAI.pm?rev=75904&op=diff
==============================================================================
--- trunk/libhttp-oai-perl/lib/HTTP/OAI.pm (original)
+++ trunk/libhttp-oai-perl/lib/HTTP/OAI.pm Fri Jun 17 17:19:11 2011
@@ -2,7 +2,7 @@
 
 use strict;
 
-our $VERSION = '3.24';
+our $VERSION = '3.25';
 
 # perlcore
 use Carp;

Modified: trunk/libhttp-oai-perl/lib/HTTP/OAI/Metadata/OAI_DC.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-oai-perl/lib/HTTP/OAI/Metadata/OAI_DC.pm?rev=75904&op=diff
==============================================================================
--- trunk/libhttp-oai-perl/lib/HTTP/OAI/Metadata/OAI_DC.pm (original)
+++ trunk/libhttp-oai-perl/lib/HTTP/OAI/Metadata/OAI_DC.pm Fri Jun 17 17:19:11 2011
@@ -1,39 +1,72 @@
 package HTTP::OAI::Metadata::OAI_DC;
 
-use strict;
-use warnings;
-
+use XML::LibXML;
 use HTTP::OAI::Metadata;
-
-use vars qw(@ISA @DC_TERMS);
-
 @ISA = qw(HTTP::OAI::Metadata);
 
-use XML::LibXML;
+use strict;
 
- at DC_TERMS = qw( contributor coverage creator date description format identifier language publisher relation rights source subject title type );
+our $OAI_DC_SCHEMA = 'http://www.openarchives.org/OAI/2.0/oai_dc/';
+our $DC_SCHEMA = 'http://purl.org/dc/elements/1.1/';
+our @DC_TERMS = qw( contributor coverage creator date description format identifier language publisher relation rights source subject title type );
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new(@_);
-	my %args = @_;
-	if( exists $args{dc} && ref($args{dc}) eq 'HASH' ) {
+	my( $class, %self ) = @_;
+
+	my $self = $class->SUPER::new( %self );
+
+	if( exists $self{dc} && ref($self{dc}) eq 'HASH' )
+	{
 		my ($dom,$dc) =_oai_dc_dom();
-		for(keys %{$args{dc}}) {
-			$self->{dc}->{lc($_)} = $args{dc}->{$_};
-			foreach my $value (@{$args{dc}->{$_}}) {
-				$dc->appendChild($dom->createElement("dc:".lc($_)))->appendChild($dom->createTextNode($value));
+		foreach my $term (@DC_TERMS)
+		{
+			foreach my $value (@{$self{dc}->{$term}||[]})
+			{
+				$dc->appendChild($dom->createElementNS($DC_SCHEMA, $term))->appendText( $value );
 			}
 		}
 		$self->dom($dom);
 	}
-	for(@DC_TERMS) {
-		$self->{dc}->{$_} ||= [];
-	}
+
 	$self;
 }
 
-sub dc { shift->{dc} }
+sub dc
+{
+	my( $self ) = @_;
+
+	my $dom = $self->dom;
+	my $metadata = $dom->documentElement;
+
+	return $self->{dc} if defined $self->{dc};
+
+	my %dc = map { $_ => [] } @DC_TERMS;
+
+	$self->_dc( $metadata, \%dc );
+
+	return \%dc;
+}
+
+sub _dc
+{
+	my( $self, $node, $dc ) = @_;
+
+	my $ns = $node->getNamespaceURI;
+	$ns =~ s/\/?$/\//;
+
+	if( $ns eq $DC_SCHEMA )
+	{
+		push @{$dc->{lc($node->localName)}}, $node->textContent;
+	}
+	elsif( $node->hasChildNodes )
+	{
+		for($node->childNodes)
+		{
+			next if $_->nodeType != XML_ELEMENT_NODE;
+			$self->_dc( $_, $dc );
+		}
+	}
+}
 
 sub _oai_dc_dom {
 	my $dom = XML::LibXML->createDocument();
@@ -46,34 +79,25 @@
 }
 
 sub metadata { 
-	my $self = shift;
-	return $self->dom() unless @_;
-	my $md = shift or return $self->dom(undef);
-#	unless(my @nodes = $md->findnodes("*/*[local-name()='oai_dc' and namespace:uri()='http://purl.org/dc/elements/1.1/']")) {
-	my $oai_dc;
-	foreach my $nameSpace (qw(
-		http://www.openarchives.org/OAI/2.0/oai_dc/
-		http://purl.org/dc/elements/1.1/
-	)) {
-		foreach my $tagName (qw(dc oai_dc)) {
-			($oai_dc) = $md->getElementsByTagNameNS($nameSpace,$tagName);
-			last if $oai_dc;
+	my( $self, $md ) = @_;
+
+	return $self->dom if @_ == 1;
+
+	delete $self->{dc};
+	$self->dom( $md );
+
+	return if !defined $md;
+
+	my $dc = $self->dc;
+
+	my ($dom,$metadata) = _oai_dc_dom();
+
+	foreach my $term (@DC_TERMS)
+	{
+		foreach my $value (@{$dc->{$term}})
+		{
+			$metadata->appendChild( $dom->createElementNS( $DC_SCHEMA, $term ) )->appendText( $value );
 		}
-		last if $oai_dc;
-	}
-	unless( defined($oai_dc) ) {
-		die "Unable to locate OAI Dublin Core in:\n".$md->toString;
-		return $self->dom(undef);
-	}
-	$md = $oai_dc;
-
-	my ($dom,$dc) = _oai_dc_dom();
-
-	for ($md->getChildNodes) {
-		next unless $_->nodeType == XML_ELEMENT_NODE;
-		next unless $_->hasChildNodes;
-		next unless ($_->getFirstChild->nodeType == XML_TEXT_NODE || $_->getFirstChild->nodeType == XML_CDATA_SECTION_NODE);
-		$dc->appendChild($dom->createElement("dc:".$_->localName))->appendChild($dom->createTextNode($_->getFirstChild->toString));
 	}
 
 	$self->dom($dom)

Modified: trunk/libhttp-oai-perl/t/01parse.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-oai-perl/t/01parse.t?rev=75904&op=diff
==============================================================================
--- trunk/libhttp-oai-perl/t/01parse.t (original)
+++ trunk/libhttp-oai-perl/t/01parse.t Fri Jun 17 17:19:11 2011
@@ -1,4 +1,4 @@
-use Test::More tests => 4;
+use Test::More tests => 5;
 
 use IO::File;
 use HTTP::OAI;
@@ -19,6 +19,11 @@
 ok($rec);
 ok($rec->metadata->dc->{creator}->[0] eq 'Aspinwall, Paul S.');
 
+my $dom = $rec->metadata->dom;
+my $md = HTTP::OAI::Metadata::OAI_DC->new;
+$md->metadata( $dom );
+ok($md->dc->{creator}->[0] eq 'Aspinwall, Paul S.');
+
 $r = HTTP::OAI::Identify->new();
 $fh = IO::File->new('examples/identify.xml','r')
 	or BAIL_OUT( "Failed to open examples/identify.xml: $!" );




More information about the Pkg-perl-cvs-commits mailing list