The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
LICENSE 44
MANIFEST 01
META.yml 1212
Makefile.PL 35
README 24
README.md 109
dist.ini 23
lib/XML/SAX/Writer/XML.pm 149
lib/XML/SAX/Writer.pm 1934
t/00-compile.t 45
10 files changed (This is a version diff) 7086
@@ -1,4 +1,4 @@
-This software is copyright (c) 2013 by Robin Berjon.
+This software is copyright (c) 2014 by Robin Berjon.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
 
 --- The GNU General Public License, Version 1, February 1989 ---
 
-This software is Copyright (c) 2013 by Robin Berjon.
+This software is Copyright (c) 2014 by Robin Berjon.
 
 This is free software, licensed under:
 
@@ -22,7 +22,7 @@ This is free software, licensed under:
                      Version 1, February 1989
 
  Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA  02110-1335  USA
+ 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
@@ -272,7 +272,7 @@ That's all there is to it!
 
 --- The Artistic License 1.0 ---
 
-This software is Copyright (c) 2013 by Robin Berjon.
+This software is Copyright (c) 2014 by Robin Berjon.
 
 This is free software, licensed under:
 
@@ -1,3 +1,4 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.025.
 Changes
 LICENSE
 MANIFEST
@@ -4,25 +4,25 @@ author:
   - 'Robin Berjon <robin@knowscape.com>'
   - 'Chris Prather <chris@prather.org>'
 build_requires:
-  File::Spec: 0
-  IO::Handle: 0
-  IPC::Open3: 0
-  Test::More: 0.40
+  File::Spec: '0'
+  IO::Handle: '0'
+  IPC::Open3: '0'
+  Test::More: '0.40'
 configure_requires:
-  ExtUtils::MakeMaker: 6.30
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.120921'
+generated_by: 'Dist::Zilla version 5.025, CPAN::Meta::Converter version 2.142690'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: XML-SAX-Writer
 requires:
-  Encode: 2.12
-  XML::Filter::BufferText: 1.00
-  XML::NamespaceSupport: 1.00
-  XML::SAX::Exception: 1.01
+  Encode: '2.12'
+  XML::Filter::BufferText: '1.00'
+  XML::NamespaceSupport: '1.00'
+  XML::SAX::Exception: '1.01'
 resources:
   homepage: https://github.com/perigrin/xml-sax-writer
   repository: https://github.com/perigrin/xml-sax-writer.git
-version: 0.54
+version: '0.56'
@@ -1,10 +1,11 @@
 
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.025.
 use strict;
 use warnings;
 
 
 
-use ExtUtils::MakeMaker 6.30;
+use ExtUtils::MakeMaker;
 
 
 
@@ -15,7 +16,7 @@ my %WriteMakefileArgs = (
     "Test::More" => "0.40"
   },
   "CONFIGURE_REQUIRES" => {
-    "ExtUtils::MakeMaker" => "6.30"
+    "ExtUtils::MakeMaker" => 0
   },
   "DISTNAME" => "XML-SAX-Writer",
   "EXE_FILES" => [],
@@ -33,7 +34,7 @@ my %WriteMakefileArgs = (
     "IPC::Open3" => 0,
     "Test::More" => "0.40"
   },
-  "VERSION" => "0.54",
+  "VERSION" => "0.56",
   "test" => {
     "TESTS" => "t/*.t"
   }
@@ -42,6 +43,7 @@ my %WriteMakefileArgs = (
 
 my %FallbackPrereqs = (
   "Encode" => "2.12",
+  "ExtUtils::MakeMaker" => 0,
   "File::Spec" => 0,
   "IO::Handle" => 0,
   "IPC::Open3" => 0,
@@ -1,13 +1,15 @@
 
 
 This archive contains the distribution XML-SAX-Writer,
-version 0.54:
+version 0.56:
 
   SAX2 XML Writer
 
-This software is copyright (c) 2013 by Robin Berjon.
+This software is copyright (c) 2014 by Robin Berjon.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 
+This README file was generated by Dist::Zilla::Plugin::Readme v5.025.
+
@@ -27,17 +27,16 @@ who reported bugs and suggested fixes.
 Usage
 -----
 
-  use XML::SAX::Writer;
-  use XML::SAX::SomeDriver;
-
-  my $w = XML::SAX::Writer->new;
-  my $d = XML::SAX::SomeDriver->new(Handler => $w);
-
-  $d->parse('some options...');
-
-See http://perl-xml.sourceforge.net/perl-sax/ for more details about
+>   use XML::SAX::Writer;
+>   use XML::SAX::SomeDriver;
+> 
+>   my $w = XML::SAX::Writer->new;
+>   my $d = XML::SAX::SomeDriver->new(Handler => $w);
+> 
+>   $d->parse('some options...');
+
+See [http://perl-xml.sourceforge.net/perl-sax/]() for more details about
 Perl SAX 2.
- 
 
 License
 -------
@@ -3,14 +3,13 @@ author  = Robin Berjon <robin@knowscape.com>
 author  = Chris Prather <chris@prather.org>
 license = Perl_5
 copyright_holder = Robin Berjon
-copyright_year   = 2013
+copyright_year   = 2014
 
 [@Basic]
 [PkgVersion]
 [Prereqs::FromCPANfile]
 
 [PruneFiles]
-filenames = Makefile.PL
 match = ^nytprof.*
 match = ^local
 match = ^perl5
@@ -21,5 +20,7 @@ match = ^cpan.*
 [PodWeaver]
 
 [@Git]
+exclude_filename = Makefile.PL
+
 [Git::NextVersion]
 [GithubMeta]
@@ -1,20 +1,15 @@
-###
-# XML::SAX::Writer - SAX2 XML Writer
-# Robin Berjon <robin@knowscape.com>
-###
-
 package XML::SAX::Writer::XML;
-{
-  $XML::SAX::Writer::XML::VERSION = '0.54';
-}
+$XML::SAX::Writer::XML::VERSION = '0.56';
 use strict;
 use XML::NamespaceSupport   qw();
 @XML::SAX::Writer::XML::ISA = qw(XML::SAX::Writer);
 
+# ABSTRACT: XML::SAX::Writer's SAX Handler
+
+###
+# Robin Berjon <robin@knowscape.com>
+###
 
-#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,#
-#`,`, The SAX Handler `,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,#
-#```````````````````````````````````````````````````````````````````#
 
 #-------------------------------------------------------------------#
 # start_document
@@ -547,11 +542,11 @@ __END__
 
 =head1 NAME
 
-XML::SAX::Writer::XML
+XML::SAX::Writer::XML - XML::SAX::Writer's SAX Handler
 
 =head1 VERSION
 
-version 0.54
+version 0.56
 
 =head1 SYNOPSIS
 
@@ -595,7 +590,7 @@ Chris Prather <chris@prather.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2013 by Robin Berjon.
+This software is copyright (c) 2014 by Robin Berjon.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -1,7 +1,7 @@
 package XML::SAX::Writer;
+$XML::SAX::Writer::VERSION = '0.56';
 use strict;
-use vars qw($VERSION %DEFAULT_ESCAPE %COMMENT_ESCAPE);
-$VERSION = '0.53';
+use vars qw(%DEFAULT_ESCAPE %COMMENT_ESCAPE);
 
 # ABSTRACT: SAX2 XML Writer
 
@@ -36,12 +36,12 @@ sub new {
     $opt->{Writer}          ||= 'XML::SAX::Writer::XML';
     $opt->{Escape}          ||= \%DEFAULT_ESCAPE;
     $opt->{CommentEscape}   ||= \%COMMENT_ESCAPE;
-    $opt->{EncodeFrom}      ||= 'utf-8';
-    $opt->{EncodeTo}        ||= 'utf-8';
+    $opt->{EncodeFrom}        = exists $opt->{EncodeFrom} ? $opt->{EncodeFrom} : 'utf-8';
+    $opt->{EncodeTo}          = exists $opt->{EncodeTo}   ? $opt->{EncodeTo}   : 'utf-8';
     $opt->{Format}          ||= {}; # needs options w/ defaults, we'll see later
     $opt->{Output}          ||= *{STDOUT}{IO};
     $opt->{QuoteCharacter}  ||= q['];
-    
+
     eval "use $opt->{Writer};";
 
     my $obj = bless $opt, $opt->{Writer};
@@ -171,10 +171,10 @@ sub safeConvert {
     my $str = shift;
 
     my $out = $self->{Encoder}->convert($str);
-    
-    if (!defined $out and defined $str) {
-	warn "Conversion error returned by Encoder [$self->{Encoder}], string: '$str'";
-	$out = '_LOST_DATA_';
+
+    if (!defined $out && defined $str) {
+        warn "Conversion error returned by Encoder [$self->{Encoder}], string: '$str'";
+        $out = '_LOST_DATA_';
     }
     return $out;
 }
@@ -189,7 +189,7 @@ sub safeConvert {
 # new methods are added to the interface
 
 package XML::SAX::Writer::ConsumerInterface;
-
+$XML::SAX::Writer::ConsumerInterface::VERSION = '0.56';
 sub new {
     my $class = shift;
     my $ref = shift;
@@ -207,6 +207,7 @@ sub finalize {}
 #```````````````````````````````````````````````````````````````````#
 
 package XML::SAX::Writer::StringConsumer;
+$XML::SAX::Writer::StringConsumer::VERSION = '0.56';
 @XML::SAX::Writer::StringConsumer::ISA = qw(XML::SAX::Writer::ConsumerInterface);
 
 #-------------------------------------------------------------------#
@@ -236,6 +237,7 @@ sub finalize { ${$_[0]} }
 #```````````````````````````````````````````````````````````````````#
 
 package XML::SAX::Writer::CodeConsumer;
+$XML::SAX::Writer::CodeConsumer::VERSION = '0.56';
 @XML::SAX::Writer::CodeConsumer::ISA = qw(XML::SAX::Writer::ConsumerInterface );
 
 #-------------------------------------------------------------------#
@@ -266,6 +268,7 @@ sub finalize { ${$_[0]}->('end_document', '') }
 #```````````````````````````````````````````````````````````````````#
 
 package XML::SAX::Writer::ArrayConsumer;
+$XML::SAX::Writer::ArrayConsumer::VERSION = '0.56';
 @XML::SAX::Writer::ArrayConsumer::ISA = qw(XML::SAX::Writer::ConsumerInterface);
 
 #-------------------------------------------------------------------#
@@ -296,6 +299,7 @@ sub finalize { return ${$_[0]} }
 #```````````````````````````````````````````````````````````````````#
 
 package XML::SAX::Writer::HandleConsumer;
+$XML::SAX::Writer::HandleConsumer::VERSION = '0.56';
 @XML::SAX::Writer::HandleConsumer::ISA = qw(XML::SAX::Writer::ConsumerInterface);
 
 #-------------------------------------------------------------------#
@@ -321,6 +325,7 @@ sub finalize { return 0 }
 #```````````````````````````````````````````````````````````````````#
 
 package XML::SAX::Writer::FileConsumer;
+$XML::SAX::Writer::FileConsumer::VERSION = '0.56';
 @XML::SAX::Writer::FileConsumer::ISA = qw(XML::SAX::Writer::HandleConsumer);
 
 #-------------------------------------------------------------------#
@@ -358,6 +363,7 @@ sub finalize {
 #```````````````````````````````````````````````````````````````````#
 
 package XML::SAX::Writer::NullConverter;
+$XML::SAX::Writer::NullConverter::VERSION = '0.56';
 sub new     { return bless [], __PACKAGE__ }
 sub convert { $_[1] }
 
@@ -367,21 +373,26 @@ sub convert { $_[1] }
 #```````````````````````````````````````````````````````````````````#
 
 package XML::SAX::Writer::Encode;
+$XML::SAX::Writer::Encode::VERSION = '0.56';
 sub new {
-    my $class = shift;
+    my ($class, $from, $to) = @_;
     my $self = {
-        from_enc => shift,
-        to_enc => shift,
+        from_enc => $from,
+        to_enc   => $to,
     };
     return bless $self, $class;
 }
 sub convert {
-    my $self = shift;
-    my $data = shift;
+    my ($self, $data) = @_;
     eval {
-        Encode::from_to( $data, $self->{from_enc}, $self->{to_enc}, Encode::FB_CROAK );
+        $data = Encode::decode($self->{from_enc}, $data) if $self->{from_enc};
+        $data = Encode::encode($self->{to_enc}, $data, Encode::FB_CROAK) if $self->{to_enc};
     };
-    return $@ ? undef : $data;
+    if ($@) {
+        warn $@;
+        return;
+    }
+    return $data;
 };
 
 
@@ -397,7 +408,7 @@ XML::SAX::Writer - SAX2 XML Writer
 
 =head1 VERSION
 
-version 0.54
+version 0.56
 
 =head1 SYNOPSIS
 
@@ -479,11 +490,15 @@ can be copied from %XML::SAX::Writer::COMMENT_ESCAPE.
 The character set encoding in which incoming data will be provided.
 This defaults to UTF-8, which works for US-ASCII as well.
 
+Set this to C<undef> if you do not wish to decode your data.
+
 =item * EncodeTo
 
 The character set encoding in which output should be encoded. Again,
 this defaults to UTF-8.
 
+Set this to C<undef> if you do not with to encode your data.
+
 =item * QuoteCharacter
 
 Set the character used to quote attributes. This defaults to single quotes (') 
@@ -700,7 +715,7 @@ Chris Prather <chris@prather.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2013 by Robin Berjon.
+This software is copyright (c) 2014 by Robin Berjon.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -2,11 +2,11 @@ use 5.006;
 use strict;
 use warnings;
 
-# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.039
-
-use Test::More  tests => 2 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
+# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051
 
+use Test::More;
 
+plan tests => 2 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
 
 my @module_files = (
     'XML/SAX/Writer.pm',
@@ -46,6 +46,7 @@ for my $lib (@module_files)
 
 
 
-is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING};
+is(scalar(@warnings), 0, 'no warnings found')
+    or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};