r61902 - in /trunk/libxml-sax-writer-perl: debian/changelog debian/copyright debian/patches/half_code_pod_errors.patch debian/patches/series lib/XML/SAX/Writer.pm lib/XML/SAX/Writer/XML.pm

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Sun Aug 22 18:36:30 UTC 2010


Author: periapt-guest
Date: Sun Aug 22 18:35:54 2010
New Revision: 61902

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=61902
Log:
Applied a pod patch from Frank Wiegand.   

Added:
    trunk/libxml-sax-writer-perl/debian/patches/half_code_pod_errors.patch
Modified:
    trunk/libxml-sax-writer-perl/debian/changelog
    trunk/libxml-sax-writer-perl/debian/copyright
    trunk/libxml-sax-writer-perl/debian/patches/series
    trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer.pm
    trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer/XML.pm

Modified: trunk/libxml-sax-writer-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-sax-writer-perl/debian/changelog?rev=61902&op=diff
==============================================================================
--- trunk/libxml-sax-writer-perl/debian/changelog (original)
+++ trunk/libxml-sax-writer-perl/debian/changelog Sun Aug 22 18:35:54 2010
@@ -21,6 +21,7 @@
   * Removed consumer_newline.patch as it is no longer required.
   * Reviewed remaining patches refreshing, editing, folding and
     adding headers as required.
+  * Applied a pod patch from Frank Wiegand.   
 
  -- Nicholas Bamber <nicholas at periapt.co.uk>  Mon, 16 Aug 2010 00:39:15 +0100
 

Modified: trunk/libxml-sax-writer-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-sax-writer-perl/debian/copyright?rev=61902&op=diff
==============================================================================
--- trunk/libxml-sax-writer-perl/debian/copyright (original)
+++ trunk/libxml-sax-writer-perl/debian/copyright Sun Aug 22 18:35:54 2010
@@ -23,6 +23,10 @@
  2010, Nicholas Bamber <nicholas at periapt.co.uk>
 License: Artistic or GPL-1+
 
+File: debian/patches/half_code_pod_errors.patch
+Copyright: 2010, Frank Wiegand <fwie 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.

Added: trunk/libxml-sax-writer-perl/debian/patches/half_code_pod_errors.patch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-sax-writer-perl/debian/patches/half_code_pod_errors.patch?rev=61902&op=file
==============================================================================
--- trunk/libxml-sax-writer-perl/debian/patches/half_code_pod_errors.patch (added)
+++ trunk/libxml-sax-writer-perl/debian/patches/half_code_pod_errors.patch Sun Aug 22 18:35:54 2010
@@ -1,0 +1,28 @@
+Author: Frank Wiegand <fwie at cpan.org>
+Origin: http://rt.cpan.org/Ticket/Attachment/692202/356379/diff
+Bug: http://rt.cpan.org/Ticket/Display.html?id=51618
+Subject: POD nits [ C<...> construct missing left side ]
+Last-Update: 2010-08-22
+--- a/lib/XML/SAX/Writer.pm
++++ b/lib/XML/SAX/Writer.pm
+@@ -635,17 +635,17 @@
+ 
+ This is used to set the proper converter for character encodings. The
+ default implementation should suffice but you can override it. It must
+-set C<$self->{Encoder}> to an Encoder object. Subclasses *should* call
++set C<< $self->{Encoder} >> to an Encoder object. Subclasses *should* call
+ it.
+ 
+ =item setConsumer
+ 
+ Same as above, except that it is for the Consumer object, and that it
+-must set C<$self->{Consumer}>.
++must set C<< $self->{Consumer} >>.
+ 
+ =item setEscaperRegex
+ 
+-Will initialise the escaping regex C<$self->{EscaperRegex}> based on
++Will initialise the escaping regex C<< $self->{EscaperRegex} >> based on
+ what is needed.
+ 
+ =item escape STRING

Modified: trunk/libxml-sax-writer-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-sax-writer-perl/debian/patches/series?rev=61902&op=diff
==============================================================================
--- trunk/libxml-sax-writer-perl/debian/patches/series (original)
+++ trunk/libxml-sax-writer-perl/debian/patches/series Sun Aug 22 18:35:54 2010
@@ -1,3 +1,4 @@
 quote_xml_version.patch
 combined_pod_fixes.patch
 file_consumer_encoding.patch
+half_code_pod_errors.patch

Modified: trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer.pm?rev=61902&op=diff
==============================================================================
--- trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer.pm (original)
+++ trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer.pm Sun Aug 22 18:35:54 2010
@@ -330,7 +330,10 @@
 # new
 #-------------------------------------------------------------------#
 sub new {
-    my ( $proto, $file ) = ( shift, shift );
+    my ( $proto, $file, $opt ) = @_;
+    my $enc_to = (defined $opt and ref $opt eq 'HASH'
+                  and defined $opt->{EncodeTo}) ? $opt->{EncodeTo}
+                                                : 'utf-8';
 
     XML::SAX::Writer::Exception->throw(
         Message => "No filename provided to " . ref( $proto || $proto )
@@ -338,9 +341,10 @@
 
     local *XFH;
 
-    open XFH, ">$file" or XML::SAX::Writer::Exception->throw(
+    open XFH, ">:encoding($enc_to)", $file
+      or XML::SAX::Writer::Exception->throw(
         Message => "Error opening file $file: $!"
-    );
+      );
 
     return $proto->SUPER::new( *{XFH}{IO}, @_ );
 }
@@ -437,16 +441,16 @@
 
 =item * new(%hash)
 
-This is the constructor for this object.  It takes a number of
+This is the constructor for this object. It takes a number of
 parameters, all of which are optional.
 
-=item -- Output
-
-This parameter can be one of several things.  If it is a simple
+=item * -- Output
+
+This parameter can be one of several things. If it is a simple
 scalar, it is interpreted as a filename which will be opened for
-writing.  If it is a scalar reference, output will be appended to this
-scalar.  If it is an array reference, output will be pushed onto this
-array as it is generated.  If it is a filehandle, then output will be
+writing. If it is a scalar reference, output will be appended to this
+scalar. If it is an array reference, output will be pushed onto this
+array as it is generated. If it is a filehandle, then output will be
 sent to this filehandle.
 
 Finally, it is possible to pass an object for this parameter, in which
@@ -456,11 +460,11 @@
 
 If this parameter is not provided, then output is sent to STDOUT.
 
-=item -- Escape
+=item * -- Escape
 
 This should be a hash reference where the keys are characters
 sequences that should be escaped and the values are the escaped form
-of the sequence.  By default, this module will escape the ampersand
+of the sequence. By default, this module will escape the ampersand
 (&), less than (<), greater than (>), double quote ("), and apostrophe
 ('). Note that some browsers don't support the &apos; escape used for
 apostrophes so that you should be careful when outputting XHTML.
@@ -468,24 +472,24 @@
 If you only want to add entries to the Escape hash, you can first
 copy the contents of %XML::SAX::Writer::DEFAULT_ESCAPE.
 
-=item -- CommentEscape
+=item * -- CommentEscape
 
 Comment content often needs to be escaped differently from other
 content. This option works exactly as the previous one except that
 by default it only escapes the double dash (--) and that the contents
 can be copied from %XML::SAX::Writer::COMMENT_ESCAPE.
 
-=item -- EncodeFrom
+=item * -- EncodeFrom
 
 The character set encoding in which incoming data will be provided.
 This defaults to UTF-8, which works for US-ASCII as well.
 
-=item -- EncodeTo
-
-The character set encoding in which output should be encoded.  Again,
+=item * -- EncodeTo
+
+The character set encoding in which output should be encoded. Again,
 this defaults to UTF-8.
 
-=item -- QuoteCharacter
+=item * -- QuoteCharacter
 
 Set the character used to quote attributes. This defaults to single quotes (') 
 for backwards compatiblity.
@@ -588,10 +592,9 @@
 =head1 THE ENCODER INTERFACE
 
 Encoders can be plugged in to allow one to use one's favourite encoder
-object. Presently there are two encoders: Iconv and NullEncoder, and
-one based on C<Encode> ought to be out soon. They need to implement
-two methods, and may inherit from XML::SAX::Writer::NullConverter if
-they wish to
+object. Presently there are two encoders: Encode and NullEncoder. They
+need to implement two methods, and may inherit from
+XML::SAX::Writer::NullConverter if they wish to
 
 =over 4
 
@@ -604,6 +607,11 @@
 Converts that string and returns it.
 
 =back
+
+Note that the return value of the convert method is B<not> checked. Output may
+be truncated if a character couldn't be converted correctly. To avoid problems
+the encoder should take care encoding errors itself, for example by raising an
+exception.
 
 =head1 CUSTOM OUTPUT
 
@@ -627,17 +635,17 @@
 
 This is used to set the proper converter for character encodings. The
 default implementation should suffice but you can override it. It must
-set C<$self->{Encoder}> to an Encoder object. Subclasses *should* call
+set C<< $self->{Encoder} >> to an Encoder object. Subclasses *should* call
 it.
 
 =item setConsumer
 
 Same as above, except that it is for the Consumer object, and that it
-must set C<$self->{Consumer}>.
+must set C<< $self->{Consumer} >>.
 
 =item setEscaperRegex
 
-Will initialise the escaping regex C<$self->{EscaperRegex}> based on
+Will initialise the escaping regex C<< $self->{EscaperRegex} >> based on
 what is needed.
 
 =item escape STRING

Modified: trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer/XML.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer/XML.pm?rev=61902&op=diff
==============================================================================
--- trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer/XML.pm (original)
+++ trunk/libxml-sax-writer-perl/lib/XML/SAX/Writer/XML.pm Sun Aug 22 18:35:54 2010
@@ -481,14 +481,14 @@
     # also, there's order in the pseudo-attr
     my $xd = '';
     if ($data->{Version}) {
-        $xd .= "<?xml version='$data->{Version}'";
+        $xd .= "<?xml version=\"$data->{Version}\"";
         if ($data->{Encoding}) {
-            $xd .= " encoding='$data->{Encoding}'";
+            $xd .= " encoding=\"$data->{Encoding}\"";
         }
         if ($data->{Standalone}) {
-            $xd .= " standalone='$data->{Standalone}'";
-        }
-        $xd .= '?>';
+            $xd .= " standalone=\"$data->{Standalone}\"";
+        }
+        $xd .= "?>\n";
     }
 
     #$xd = $self->{Encoder}->convert($xd); # this may blow up




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