r55072 - in /branches/upstream/libxml-writer-perl/current: Changes LICENSE META.yml Makefile.PL README Writer.pm t/01_main.t

nhandler-guest at users.alioth.debian.org nhandler-guest at users.alioth.debian.org
Mon Mar 29 21:07:30 UTC 2010


Author: nhandler-guest
Date: Mon Mar 29 21:07:06 2010
New Revision: 55072

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=55072
Log:
[svn-upgrade] Integrating new upstream version, libxml-writer-perl (0.610)

Modified:
    branches/upstream/libxml-writer-perl/current/Changes
    branches/upstream/libxml-writer-perl/current/LICENSE
    branches/upstream/libxml-writer-perl/current/META.yml
    branches/upstream/libxml-writer-perl/current/Makefile.PL
    branches/upstream/libxml-writer-perl/current/README
    branches/upstream/libxml-writer-perl/current/Writer.pm
    branches/upstream/libxml-writer-perl/current/t/01_main.t

Modified: branches/upstream/libxml-writer-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-writer-perl/current/Changes?rev=55072&op=diff
==============================================================================
--- branches/upstream/libxml-writer-perl/current/Changes (original)
+++ branches/upstream/libxml-writer-perl/current/Changes Mon Mar 29 21:07:06 2010
@@ -1,4 +1,8 @@
 Revision history for Perl extension XML::Writer.
+
+0.610 Mon Mar 29 02:29:32 BST 2010    <joe at kafsemo.org>
+        - Add a CHECK_PRINT constructor parameter to check the output print
+           success (#50465). It will croak when printing to output fails.
 
 0.607 Mon Mar 22 14:46:26 GMT 2010    <joe at kafsemo.org>
         - Address license confusion by reverting to the original

Modified: branches/upstream/libxml-writer-perl/current/LICENSE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-writer-perl/current/LICENSE?rev=55072&op=diff
==============================================================================
--- branches/upstream/libxml-writer-perl/current/LICENSE (original)
+++ branches/upstream/libxml-writer-perl/current/LICENSE Mon Mar 29 21:07:06 2010
@@ -1,6 +1,7 @@
 Writer.pm - write an XML document.
 
 Copyright (c) 1999 by Megginson Technologies.
-Copyright (c) 2004, 2005 by Joseph Walton <joe at kafsemo.org>.
+Copyright (c) 2003 Ed Avis <ed at membled.com>
+Copyright (c) 2004-2010 Joseph Walton <joe at kafsemo.org>
 
 No warranty.  Commercial and non-commercial use freely permitted.

Modified: branches/upstream/libxml-writer-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-writer-perl/current/META.yml?rev=55072&op=diff
==============================================================================
--- branches/upstream/libxml-writer-perl/current/META.yml (original)
+++ branches/upstream/libxml-writer-perl/current/META.yml Mon Mar 29 21:07:06 2010
@@ -1,9 +1,9 @@
 --- #YAML:1.0
 meta-spec:
-  version: 1.3
-  url: http://module-build.sourceforge.net/META-spec-v1.3.html
+  version: 1.4
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
 name:         XML-Writer
-version:      0.607
+version:      0.610
 abstract:     Easily generate well-formed, namespace-aware XML.
 author:
   - David Megginson <david at megginson.com>

Modified: branches/upstream/libxml-writer-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-writer-perl/current/Makefile.PL?rev=55072&op=diff
==============================================================================
--- branches/upstream/libxml-writer-perl/current/Makefile.PL (original)
+++ branches/upstream/libxml-writer-perl/current/Makefile.PL Mon Mar 29 21:07:06 2010
@@ -7,7 +7,7 @@
 # the contents of the Makefile that is written.
 WriteMakefile(
     'NAME'    => 'XML::Writer',
-    'VERSION' => '0.607',
+    'VERSION' => '0.610',
 
     # A manually-created META.yml has all the other metadata;
     #  we don't want it overwritten

Modified: branches/upstream/libxml-writer-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-writer-perl/current/README?rev=55072&op=diff
==============================================================================
--- branches/upstream/libxml-writer-perl/current/README (original)
+++ branches/upstream/libxml-writer-perl/current/README Mon Mar 29 21:07:06 2010
@@ -18,9 +18,8 @@
 
 See the Changes file for detailed changes between versions.
 
-Copyright (c) 1999 by David Megginson,
-copyright 2003 Ed Avis, <ed at membled.com> and others.
-Some fixes, and a rewritten test suite,
-copyright 2004, 2005 Joseph Walton <joe at kafsemo.org>
+Copyright (c) 1999 by Megginson Technologies.
+Copyright (c) 2003 Ed Avis <ed at membled.com>
+Copyright (c) 2004-2010 Joseph Walton <joe at kafsemo.org>
 
 Current development is hosted at <http://xml-writer-perl.berlios.de/>.

Modified: branches/upstream/libxml-writer-perl/current/Writer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-writer-perl/current/Writer.pm?rev=55072&op=diff
==============================================================================
--- branches/upstream/libxml-writer-perl/current/Writer.pm (original)
+++ branches/upstream/libxml-writer-perl/current/Writer.pm Mon Mar 29 21:07:06 2010
@@ -1,10 +1,9 @@
 ########################################################################
 # Writer.pm - write an XML document.
 # Copyright (c) 1999 by Megginson Technologies.
-# Copyright (c) 2004, 2005 by Joseph Walton <joe at kafsemo.org>.
+# Copyright (c) 2003 Ed Avis <ed at membled.com>
+# Copyright (c) 2004-2010 Joseph Walton <joe at kafsemo.org>
 # No warranty.  Commercial and non-commercial use freely permitted.
-#
-# $Id$
 ########################################################################
 
 package XML::Writer;
@@ -15,7 +14,7 @@
 use vars qw($VERSION);
 use Carp;
 use IO::Handle;
-$VERSION = "0.607";
+$VERSION = "0.610";
 
 
 
@@ -454,7 +453,11 @@
 
                                 # Set and get the output destination.
   $self->{'GETOUTPUT'} = sub {
-    return $output;
+    if (ref($output) ne 'XML::Writer::_PrintChecker') {
+      return $output;
+    } else {
+      return $output->{HANDLE};
+    }
   };
 
   $self->{'SETOUTPUT'} = sub {
@@ -475,6 +478,10 @@
           die 'The only supported encodings are utf-8 and us-ascii';
         }
       }
+    }
+
+    if ($params{CHECK_PRINT}) {
+      $output = XML::Writer::_PrintChecker->new($output);
     }
   };
 
@@ -1142,6 +1149,27 @@
   return 1;
 }
 
+
+package XML::Writer::_PrintChecker;
+
+use Carp;
+
+sub new
+{
+  my $class = shift;
+  return bless({HANDLE => shift}, $class);
+}
+
+sub print
+{
+  my $self = shift;
+  if ($self->{HANDLE}->print(shift)) {
+    return 1;
+  } else {
+    croak "Failed to write output: $!";
+  }
+}
+
 1;
 __END__
 
@@ -1294,6 +1322,12 @@
 If present, it will be used for the underlying character encoding and as the
 default in the XML declaration.
 
+=item CHECK_PRINT
+
+A true or false value; if this parameter is present and its value is
+true, all prints to the underlying output will be checked for success. Failures
+will cause a croak rather than being ignored.
+
 =back
 
 =item end()
@@ -1620,9 +1654,7 @@
 
 Copyright 2004, 2005 Joseph Walton E<lt>joe at kafsemo.orgE<gt>
 
-This module is free software; you can redistribute it and/or
-modify it under the terms of the MIT License. See the F<LICENSE> file
-included with this distribution.
+No warranty.  Commercial and non-commercial use freely permitted.
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libxml-writer-perl/current/t/01_main.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-writer-perl/current/t/01_main.t?rev=55072&op=diff
==============================================================================
--- branches/upstream/libxml-writer-perl/current/t/01_main.t (original)
+++ branches/upstream/libxml-writer-perl/current/t/01_main.t Mon Mar 29 21:07:06 2010
@@ -2,10 +2,9 @@
 ########################################################################
 # test.pl - test script for XML::Writer module.
 # Copyright (c) 1999 by Megginson Technologies.
-# Copyright (c) 2004 - 2006 by Joseph Walton <joe at kafsemo.org>.
+# Copyright (c) 2003 Ed Avis <ed at membled.com>
+# Copyright (c) 2004-2010 Joseph Walton <joe at kafsemo.org>
 # No warranty.  Commercial and non-commercial use freely permitted.
-#
-# $Id$
 ########################################################################
 
 # Before 'make install' is performed this script should be runnable with
@@ -13,7 +12,9 @@
 
 use strict;
 
-use Test::More(tests => 221);
+use Errno;
+
+use Test::More(tests => 223);
 
 
 # Catch warnings
@@ -76,7 +77,7 @@
 	binmode($outputFile, ':raw') if $] >= 5.006;
 
 	# Overwrite OUTPUT so it goes to the scratch file
-	$args{'OUTPUT'} = $outputFile;
+	$args{'OUTPUT'} = $outputFile unless(defined($args{'OUTPUT'}));
 
 	# Set NAMESPACES, unless it's present
 	$args{'NAMESPACES'} = 1 unless(defined($args{'NAMESPACES'}));
@@ -1842,9 +1843,58 @@
 	});
 };
 
+# Get the string for our test error
+$! = Errno::ENOSPC;
+my $enospcMessage = $!;
+
+# A failing underlying write is caught when the CHECK_PRINT flag is set
+TEST: {
+	my $failingWriter = XML::Writer::Test::FailingWriter->new();
+
+	initEnv(OUTPUT => $failingWriter, CHECK_PRINT => 1);
+	expectError("Failed to write output: $enospcMessage", eval {
+		$w->xmlDecl();
+	});
+};
+
+# Changing the underlying target to a failing one makes the next write fail
+TEST: {
+	my $failingWriter = XML::Writer::Test::FailingWriter->new();
+
+	initEnv(CHECK_PRINT => 1);
+	$w->xmlDecl();
+	$w->setOutput($failingWriter);
+	expectError("Failed to write output: $enospcMessage", eval {
+		$w->startTag('x');
+	});
+};
+
+# A failing underlying write is ignored when the CHECK_PRINT flag is not set
+TEST: {
+	my $failingWriter = XML::Writer::Test::FailingWriter->new();
+
+	initEnv(OUTPUT => $failingWriter);
+	$w->xmlDecl();
+};
+
 # Free test resources
 $outputFile->close() or die "Unable to close temporary file: $!";
 
 1;
 
+
+package XML::Writer::Test::FailingWriter;
+
+sub new
+{
+  my $class = shift;
+  return bless({}, $class);
+}
+
+sub print
+{
+  $! = Errno::ENOSPC;
+  return 0;
+}
+
 __END__




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