r69819 - in /trunk/libmarc-xml-perl: ./ debian/ debian/source/ lib/MARC/File/ t/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sun Feb 27 02:45:28 UTC 2011


Author: jawnsy-guest
Date: Sun Feb 27 02:45:20 2011
New Revision: 69819

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=69819
Log:
* New upstream release
* Bump debhelper compat level to 8
* Standards-Version 3.9.1 (no changes)
* Use new 3.0 (quilt) source format
* Refresh copyright information

Added:
    trunk/libmarc-xml-perl/debian/source/
    trunk/libmarc-xml-perl/debian/source/format
    trunk/libmarc-xml-perl/t/batch-ns.t
      - copied unchanged from r69816, branches/upstream/libmarc-xml-perl/current/t/batch-ns.t
    trunk/libmarc-xml-perl/t/batch-ns.xml
      - copied unchanged from r69816, branches/upstream/libmarc-xml-perl/current/t/batch-ns.xml
    trunk/libmarc-xml-perl/t/error-handling.t
      - copied unchanged from r69816, branches/upstream/libmarc-xml-perl/current/t/error-handling.t
    trunk/libmarc-xml-perl/t/invalid.xml
      - copied unchanged from r69816, branches/upstream/libmarc-xml-perl/current/t/invalid.xml
Modified:
    trunk/libmarc-xml-perl/Changes
    trunk/libmarc-xml-perl/MANIFEST
    trunk/libmarc-xml-perl/META.yml
    trunk/libmarc-xml-perl/debian/changelog
    trunk/libmarc-xml-perl/debian/compat
    trunk/libmarc-xml-perl/debian/control
    trunk/libmarc-xml-perl/debian/copyright
    trunk/libmarc-xml-perl/lib/MARC/File/SAX.pm
    trunk/libmarc-xml-perl/lib/MARC/File/XML.pm

Modified: trunk/libmarc-xml-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/Changes?rev=69819&op=diff
==============================================================================
--- trunk/libmarc-xml-perl/Changes (original)
+++ trunk/libmarc-xml-perl/Changes Sun Feb 27 02:45:20 2011
@@ -1,5 +1,16 @@
 Revision history for Perl extension MARC-XML
 
+0.93 Fri Feb 11 17:13:02 EST 2011
+       - When slurping MARCXML records (e.g., via MARC::Batch), can
+         now handle XML files that use a prefix
+         to refer to the http://www.loc.gov/MARC21/slim namespace.
+       - If trying to parse a MARCXML record that has omitted
+         the <record> wrapper element, throw an exception
+         with a more meaningful error message.
+       - adjusted copyright statement further to meet Debian requirements
+         (RT#48333)
+       - set license in Makefile.PL
+ 
 0.92 Thu Jul 30 22:37:07 EDT 2009
       - small documentation changes to close RT tickets #48334 and #48333
         filed by Jonathan from Debian world.

Modified: trunk/libmarc-xml-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/MANIFEST?rev=69819&op=diff
==============================================================================
--- trunk/libmarc-xml-perl/MANIFEST (original)
+++ trunk/libmarc-xml-perl/MANIFEST Sun Feb 27 02:45:20 2011
@@ -8,11 +8,15 @@
 MANIFEST
 META.yml
 README
+t/batch-ns.t
+t/batch-ns.xml
 t/batch.t
 t/batch.xml
 t/encode.t
+t/error-handling.t
 t/escape.mrc
 t/escape.t
+t/invalid.xml
 t/namespace.t
 t/namespace.xml
 t/record.dat

Modified: trunk/libmarc-xml-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/META.yml?rev=69819&op=diff
==============================================================================
--- trunk/libmarc-xml-perl/META.yml (original)
+++ trunk/libmarc-xml-perl/META.yml Sun Feb 27 02:45:20 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               MARC-XML
-version:            0.92
+version:            0.93
 abstract:           ~
 author:
     - Ed Summers <ehs at pobox.com>
@@ -18,7 +18,7 @@
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.52
+generated_by:       ExtUtils::MakeMaker version 6.55_02
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: trunk/libmarc-xml-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/debian/changelog?rev=69819&op=diff
==============================================================================
--- trunk/libmarc-xml-perl/debian/changelog (original)
+++ trunk/libmarc-xml-perl/debian/changelog Sun Feb 27 02:45:20 2011
@@ -1,8 +1,16 @@
-libmarc-xml-perl (0.92-2) UNRELEASED; urgency=low
+libmarc-xml-perl (0.93-1) UNRELEASED; urgency=low
 
+  [ Jonathan Yu ]
+  * New upstream release
+  * Bump debhelper compat level to 8
+  * Standards-Version 3.9.1 (no changes)
+  * Use new 3.0 (quilt) source format
+  * Refresh copyright information
+
+  [ Ryan Niebur ]
   * Update jawnsy's email address
 
- -- Ryan Niebur <ryanryan52 at gmail.com>  Tue, 01 Sep 2009 21:19:09 -0700
+ -- Jonathan Yu <jawnsy at cpan.org>  Sat, 26 Feb 2011 22:08:17 -0500
 
 libmarc-xml-perl (0.92-1) unstable; urgency=low
 

Modified: trunk/libmarc-xml-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/debian/compat?rev=69819&op=diff
==============================================================================
--- trunk/libmarc-xml-perl/debian/compat (original)
+++ trunk/libmarc-xml-perl/debian/compat Sun Feb 27 02:45:20 2011
@@ -1,1 +1,1 @@
-7
+8

Modified: trunk/libmarc-xml-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/debian/control?rev=69819&op=diff
==============================================================================
--- trunk/libmarc-xml-perl/debian/control (original)
+++ trunk/libmarc-xml-perl/debian/control Sun Feb 27 02:45:20 2011
@@ -1,21 +1,25 @@
 Source: libmarc-xml-perl
 Section: perl
 Priority: optional
-Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: perl (>= 5.8.8-7), libmarc-charset-perl (>= 0.98),
- libxml-sax-perl (>= 0.12), libmarc-record-perl (>= 2)
+Build-Depends: debhelper (>= 8)
+Build-Depends-Indep: perl,
+ libmarc-charset-perl (>= 0.98),
+ libxml-sax-perl (>= 0.12),
+ libmarc-record-perl (>= 2)
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Vincent Danjean <vdanjean at debian.org>,
  Damyan Ivanov <dmn at debian.org>, Jonathan Yu <jawnsy at cpan.org>
-Standards-Version: 3.8.2
+Standards-Version: 3.9.1
 Homepage: http://search.cpan.org/dist/MARC-XML/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libmarc-xml-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libmarc-xml-perl/
 
 Package: libmarc-xml-perl
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, libmarc-charset-perl (>= 0.98),
- libxml-sax-perl (>= 0.12), libmarc-record-perl (>= 2)
+Depends: ${perl:Depends}, ${misc:Depends},
+ libmarc-charset-perl (>= 0.98),
+ libxml-sax-perl (>= 0.12),
+ libmarc-record-perl (>= 2)
 Description: Perl library to access MARC data encoded as XML
  MARC::XML is an extension to the Marc::Record distribution for working with
  MARC21 data that is encoded as XML. The XML encoding used is the MARC21slim

Modified: trunk/libmarc-xml-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/debian/copyright?rev=69819&op=diff
==============================================================================
--- trunk/libmarc-xml-perl/debian/copyright (original)
+++ trunk/libmarc-xml-perl/debian/copyright Sun Feb 27 02:45:20 2011
@@ -1,31 +1,31 @@
-Format-Specification:
-    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
-Upstream-Maintainer: Ed Summers <ehs at pobox.net>
-Upstream-Source: http://search.cpan.org/dist/MARC-XML/
-Upstream-Name: MARC-XML
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
+Maintainer: Ed Summers <ehs at pobox.com>
+Source: http://search.cpan.org/dist/MARC-XML/
+Name: MARC-XML
 
 Files: *
-Copyright: 2003-2009 Ed Summers <ehs at pobox.net> and contributors
-License-Alias: Perl
-License: Artistic | GPL-1+
+Copyright: 2003-2009, Ed Summers <ehs at pobox.com>
+License: Artistic or GPL-1+
 
 Files: debian/*
-Copyright: 2009, Jonathan Yu <jawnsy at cpan.org>
- 2007, Damyan Ivanov <dmn at debian.org>
+Copyright: 2007, Damyan Ivanov <dmn at debian.org>
+ 2007, Vincent Danjean <vdanjean at debian.org>
  2007, gregor herrmann <gregoa at debian.org>
- 2007, Vincent Danjean <vdanjean at debian.org>
-License: Artistic | GPL-1+
+ 2009-2011, Jonathan Yu <jawnsy at cpan.org>
+License: Artistic or GPL-1+
 
 License: Artistic
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the Artistic License, which comes with Perl.
-    On Debian GNU/Linux systems, the complete text of the Artistic License
-    can be found in `/usr/share/common-licenses/Artistic'
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+ .
+ On Debian systems, the complete text of the Artistic License can be
+ found in `/usr/share/common-licenses/Artistic'.
 
 License: GPL-1+
-    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
-    the Free Software Foundation; either version 1, or (at your option)
-    any later version.
-    On Debian GNU/Linux systems, the complete text of the GNU General
-    Public License can be found in `/usr/share/common-licenses/GPL'
+ 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
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+ .
+ On Debian systems, the complete text of version 1 of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL-1'.

Added: trunk/libmarc-xml-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/debian/source/format?rev=69819&op=file
==============================================================================
--- trunk/libmarc-xml-perl/debian/source/format (added)
+++ trunk/libmarc-xml-perl/debian/source/format Sun Feb 27 02:45:20 2011
@@ -1,0 +1,1 @@
+3.0 (quilt)

Modified: trunk/libmarc-xml-perl/lib/MARC/File/SAX.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/lib/MARC/File/SAX.pm?rev=69819&op=diff
==============================================================================
--- trunk/libmarc-xml-perl/lib/MARC/File/SAX.pm (original)
+++ trunk/libmarc-xml-perl/lib/MARC/File/SAX.pm Sun Feb 27 02:45:20 2011
@@ -12,6 +12,7 @@
 use Data::Dumper;
 use MARC::Record;
 use MARC::Charset qw(utf8_to_marc8);
+use Carp qw(croak);
 
 =head2 new()
 
@@ -50,16 +51,36 @@
     my $name = $element->{ LocalName };
     if ( $name eq 'record' ) {
         $self->{ record } = MARC::Record->new();
-    } elsif ( $name eq 'leader' ) { 
-        $self->{ tag } = 'LDR';
-    } elsif ( $name eq 'controlfield' ) {
-        $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value };
-    } elsif ( $name eq 'datafield' ) { 
-        $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value };
-        $self->{ i1 } = $element->{ Attributes }{ '{}ind1' }{ Value };
-        $self->{ i2 } = $element->{ Attributes }{ '{}ind2' }{ Value };
-    } elsif ( $name eq 'subfield' ) { 
-        $self->{ subcode } = $element->{ Attributes }{ '{}code' }{ Value };
+    } elsif ( $name eq 'collection' ) {
+        # ignore collection wrappers
+    } elsif ( defined $self->{ record } ) {
+        if ( $name eq 'leader' ) { 
+            $self->{ tag } = 'LDR';
+        } elsif ( $name eq 'controlfield' ) {
+            $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value };
+        } elsif ( $name eq 'datafield' ) { 
+            $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value };
+            $self->{ i1 } = $element->{ Attributes }{ '{}ind1' }{ Value };
+            $self->{ i2 } = $element->{ Attributes }{ '{}ind2' }{ Value };
+        } elsif ( $name eq 'subfield' ) { 
+            $self->{ subcode } = $element->{ Attributes }{ '{}code' }{ Value };
+        }
+    } else {
+        # we've reached a new element but haven't started populating
+        # a MARC::Record yet.  This either means that we've encountered
+        # some non-MARC21slim stuff or the caller's given us an invalid
+        # doc that doesn't include a <record> element.
+        # In the first case, we'll just ignore the element; in the second
+        # case, we'll thow an exception with a better description.
+        #
+        # TODO: to be more consistent with how MARC::File::USMARC handles
+        #        parse errors, rather than throwing an exception we could
+        #        instantiate an empty MARC::Record and set its warnings
+        #        array.
+        #
+        if ( $name eq 'leader' || $name eq 'controlfield' || $name eq 'datafield' || $name eq 'subfield' ) {
+            croak("found MARCXML element $name, but the <record> wrapper is missing");
+        }
     }
 }
 

Modified: trunk/libmarc-xml-perl/lib/MARC/File/XML.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmarc-xml-perl/lib/MARC/File/XML.pm?rev=69819&op=diff
==============================================================================
--- trunk/libmarc-xml-perl/lib/MARC/File/XML.pm (original)
+++ trunk/libmarc-xml-perl/lib/MARC/File/XML.pm Sun Feb 27 02:45:20 2011
@@ -14,7 +14,7 @@
 use Carp qw( croak );
 use Encode ();
 
-$VERSION = '0.92';
+$VERSION = '0.93';
 
 my $factory = XML::SAX::ParserFactory->new();
 $factory->require_feature(Namespaces);
@@ -395,15 +395,22 @@
     return if eof($fh);
 
     ## get a chunk of xml for a record
-    local $/ = '</record>';
+    local $/ = 'record>';
     my $xml = <$fh>;
 
+    ## do we have enough?
+    $xml .= <$fh> if $xml !~ m!</([^:]+:){0,1}record>$!;
     ## trim stuff before the start record element 
-    $xml =~ s/.*<record.*?>/<record>/s;
+    $xml =~ s/.*?<(([^:]+:){0,1})record.*?>/<$1record>/s;
 
     ## return undef if there isn't a good chunk of xml
-    return if ( $xml !~ m|<record>.*</record>|s );
-    
+    return if ( $xml !~ m|<(([^:]+:){0,1})record>.*</\1record>|s );
+
+    ## if we have a namespace prefix, restore the declaration
+    if ($xml =~ /<([^:]+:)record>/) {
+        $xml =~ s!<([^:]+):record>!<$1:record xmlns:$1="http://www.loc.gov/MARC21/slim">!;
+    }
+
     ## return the chunk of xml
     return( $xml );
 }
@@ -512,8 +519,6 @@
 
 =item * Support for callback filters in decode().
 
-=item * Command line utilities marc2xml, etc.
-
 =back
 
 =head1 SEE ALSO




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