[libpoe-filter-xml-perl] 01/08: Imported Upstream version 1.140700

gregor herrmann gregoa at debian.org
Sat May 10 12:48:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository libpoe-filter-xml-perl.

commit 78afafbf9c3945e6c7d7ac134f5c9570c7dfb5fa
Author: gregor herrmann <gregoa at debian.org>
Date:   Sat May 10 14:36:19 2014 +0200

    Imported Upstream version 1.140700
---
 Changes                       |   7 +-
 LICENSE                       |  28 ++--
 META.json                     |  41 +++---
 META.yml                      |  14 +-
 Makefile.PL                   |  58 ++++----
 README                        |   4 +-
 dist.ini                      |   3 +-
 lib/POE/Filter/XML.pm         | 324 ++++++++++++++++++------------------------
 lib/POE/Filter/XML/Handler.pm | 258 +++++++++++++++++----------------
 lib/POE/Filter/XML/NS.pm      |   8 +-
 lib/POE/Filter/XML/Node.pm    | 227 +++++++++++++++--------------
 11 files changed, 469 insertions(+), 503 deletions(-)

diff --git a/Changes b/Changes
index a969f08..84707eb 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,9 @@
-Revision history for POE-Filter-XML: 1.102960
+Revision history for POE-Filter-XML: 1.140700
+
+1.140700  2014-03-11 22:58:37 Europe/Amsterdam
+        Remove all bullshit related to MooseX::Declare
+        Fix annoying bug in toString picking up Moose attributes
+
 
 1.102960  2010-10-23 01:35:46 America/Chicago
         Fix issues with not_streaming
diff --git a/LICENSE b/LICENSE
old mode 100755
new mode 100644
index a538773..618abbd
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-This software is copyright (c) 2010 by Nicholas R. Perez <nperez at cpan.org>.
+This software is copyright (c) 2014 by Nicholas R. Perez <nperez at cpan.org>.
 
 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,21 +12,22 @@ b) the "Artistic License"
 
 --- The GNU General Public License, Version 1, February 1989 ---
 
-This software is Copyright (c) 2010 by Nicholas R. Perez <nperez at cpan.org>.
+This software is Copyright (c) 2014 by Nicholas R. Perez <nperez at cpan.org>.
 
 This is free software, licensed under:
 
   The GNU General Public License, Version 1, February 1989
 
-		    GNU GENERAL PUBLIC LICENSE
-		     Version 1, February 1989
+                    GNU GENERAL PUBLIC LICENSE
+                     Version 1, February 1989
 
  Copyright (C) 1989 Free Software Foundation, Inc.
-                59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ 51 Franklin St, Suite 500, Boston, MA  02110-1335  USA
+
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-			    Preamble
+                            Preamble
 
   The license agreements of most software companies try to keep users
 at the mercy of those companies.  By contrast, our General Public
@@ -67,7 +68,7 @@ authors' reputations.
   The precise terms and conditions for copying, distribution and
 modification follow.
 
-		    GNU GENERAL PUBLIC LICENSE
+                    GNU GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. This License Agreement applies to any program or other work which
@@ -185,7 +186,7 @@ make exceptions for this.  Our decision will be guided by the two goals
 of preserving the free status of all derivatives of our free software and
 of promoting the sharing and reuse of software generally.
 
-			    NO WARRANTY
+                            NO WARRANTY
 
   9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
@@ -207,9 +208,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGES.
 
-		     END OF TERMS AND CONDITIONS
+                     END OF TERMS AND CONDITIONS
 
-	Appendix: How to Apply These Terms to Your New Programs
+        Appendix: How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest
 possible use to humanity, the best way to achieve this is to make it
@@ -235,8 +236,9 @@ the exclusion of warranty; and each file should have at least the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software Foundation,
-    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA  02110-1301 USA
+
 
 Also add information on how to contact you by electronic and paper mail.
 
@@ -270,7 +272,7 @@ That's all there is to it!
 
 --- The Artistic License 1.0 ---
 
-This software is Copyright (c) 2010 by Nicholas R. Perez <nperez at cpan.org>.
+This software is Copyright (c) 2014 by Nicholas R. Perez <nperez at cpan.org>.
 
 This is free software, licensed under:
 
diff --git a/META.json b/META.json
index 474432b..4194ee1 100644
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "Nicholas R. Perez <nperez at cpan.org>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 4.102341, CPAN::Meta::Converter version 2.102400",
+   "generated_by" : "Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921",
    "license" : [
       "perl_5"
    ],
@@ -16,31 +16,34 @@
    "prereqs" : {
       "configure" : {
          "requires" : {
-            "ExtUtils::MakeMaker" : "6.31"
+            "ExtUtils::MakeMaker" : "6.30"
+         }
+      },
+      "develop" : {
+         "requires" : {
+            "Test::Pod" : "1.41"
          }
       },
       "runtime" : {
          "requires" : {
-            "Carp" : 0,
-            "Exporter" : 0,
-            "Moose::Object" : 0,
-            "Moose::Util::TypeConstraints" : 0,
-            "MooseX::Declare" : 0,
-            "MooseX::InsideOut" : 0,
-            "MooseX::NonMoose" : 0,
-            "MooseX::NonMoose::InsideOut" : 0,
-            "MooseX::Types::Moose" : 0,
-            "POE::Filter" : 0,
-            "Try::Tiny" : 0,
-            "XML::LibXML" : 0,
-            "XML::LibXML::Element" : 0,
-            "XML::SAX::Base" : 0,
-            "constant" : 0
+            "Carp" : "0",
+            "Exporter" : "0",
+            "Moose" : "0",
+            "Moose::Object" : "0",
+            "MooseX::InsideOut" : "0",
+            "MooseX::NonMoose" : "0",
+            "POE::Filter" : "0",
+            "XML::LibXML" : "0",
+            "XML::LibXML::Element" : "0",
+            "XML::SAX::Base" : "0",
+            "constant" : "0",
+            "strict" : "0",
+            "warnings" : "0"
          }
       },
       "test" : {
          "requires" : {
-            "Test::More" : 0
+            "Test::More" : "0"
          }
       }
    },
@@ -51,6 +54,6 @@
          "url" : "git://nickandperla.net/pfx.git"
       }
    },
-   "version" : "1.102960"
+   "version" : "1.140700"
 }
 
diff --git a/META.yml b/META.yml
index 65f90ea..98b5eb1 100644
--- a/META.yml
+++ b/META.yml
@@ -5,9 +5,9 @@ author:
 build_requires:
   Test::More: 0
 configure_requires:
-  ExtUtils::MakeMaker: 6.31
+  ExtUtils::MakeMaker: 6.30
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.102341, CPAN::Meta::Converter version 2.102400'
+generated_by: 'Dist::Zilla version 4.300030, CPAN::Meta::Converter version 2.120921'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -16,19 +16,17 @@ name: POE-Filter-XML
 requires:
   Carp: 0
   Exporter: 0
+  Moose: 0
   Moose::Object: 0
-  Moose::Util::TypeConstraints: 0
-  MooseX::Declare: 0
   MooseX::InsideOut: 0
   MooseX::NonMoose: 0
-  MooseX::NonMoose::InsideOut: 0
-  MooseX::Types::Moose: 0
   POE::Filter: 0
-  Try::Tiny: 0
   XML::LibXML: 0
   XML::LibXML::Element: 0
   XML::SAX::Base: 0
   constant: 0
+  strict: 0
+  warnings: 0
 resources:
   repository: git://nickandperla.net/pfx.git
-version: 1.102960
+version: 1.140700
diff --git a/Makefile.PL b/Makefile.PL
index ceb3e47..fb83e1d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,43 +4,41 @@ use warnings;
 
 
 
-use ExtUtils::MakeMaker 6.31;
+use ExtUtils::MakeMaker 6.30;
 
 
 
 my %WriteMakefileArgs = (
-  'ABSTRACT' => 'XML parsing for the POE framework',
-  'AUTHOR' => 'Nicholas R. Perez <nperez at cpan.org>',
-  'BUILD_REQUIRES' => {
-    'Test::More' => '0'
+  "ABSTRACT" => "XML parsing for the POE framework",
+  "AUTHOR" => "Nicholas R. Perez <nperez\@cpan.org>",
+  "BUILD_REQUIRES" => {
+    "Test::More" => 0
   },
-  'CONFIGURE_REQUIRES' => {
-    'ExtUtils::MakeMaker' => '6.31'
+  "CONFIGURE_REQUIRES" => {
+    "ExtUtils::MakeMaker" => "6.30"
   },
-  'DISTNAME' => 'POE-Filter-XML',
-  'EXE_FILES' => [],
-  'LICENSE' => 'perl',
-  'NAME' => 'POE::Filter::XML',
-  'PREREQ_PM' => {
-    'Carp' => '0',
-    'Exporter' => '0',
-    'Moose::Object' => '0',
-    'Moose::Util::TypeConstraints' => '0',
-    'MooseX::Declare' => '0',
-    'MooseX::InsideOut' => '0',
-    'MooseX::NonMoose' => '0',
-    'MooseX::NonMoose::InsideOut' => '0',
-    'MooseX::Types::Moose' => '0',
-    'POE::Filter' => '0',
-    'Try::Tiny' => '0',
-    'XML::LibXML' => '0',
-    'XML::LibXML::Element' => '0',
-    'XML::SAX::Base' => '0',
-    'constant' => '0'
+  "DISTNAME" => "POE-Filter-XML",
+  "EXE_FILES" => [],
+  "LICENSE" => "perl",
+  "NAME" => "POE::Filter::XML",
+  "PREREQ_PM" => {
+    "Carp" => 0,
+    "Exporter" => 0,
+    "Moose" => 0,
+    "Moose::Object" => 0,
+    "MooseX::InsideOut" => 0,
+    "MooseX::NonMoose" => 0,
+    "POE::Filter" => 0,
+    "XML::LibXML" => 0,
+    "XML::LibXML::Element" => 0,
+    "XML::SAX::Base" => 0,
+    "constant" => 0,
+    "strict" => 0,
+    "warnings" => 0
   },
-  'VERSION' => '1.102960',
-  'test' => {
-    'TESTS' => 't/*.t'
+  "VERSION" => "1.140700",
+  "test" => {
+    "TESTS" => "t/*.t"
   }
 );
 
diff --git a/README b/README
index c20ed52..6ab8760 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
 
 
 This archive contains the distribution POE-Filter-XML,
-version 1.102960:
+version 1.140700:
 
   XML parsing for the POE framework
 
-This software is copyright (c) 2010 by Nicholas R. Perez <nperez at cpan.org>.
+This software is copyright (c) 2014 by Nicholas R. Perez <nperez at cpan.org>.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
diff --git a/dist.ini b/dist.ini
index fb51f55..dc44a55 100644
--- a/dist.ini
+++ b/dist.ini
@@ -2,7 +2,7 @@ name    = POE-Filter-XML
 author  = Nicholas R. Perez <nperez at cpan.org>
 license = Perl_5
 copyright_holder = Nicholas R. Perez <nperez at cpan.org>
-copyright_year   = 2010
+copyright_year   = 2014
 
 [@Basic]
 [AutoVersion]
@@ -11,6 +11,7 @@ copyright_year   = 2010
 [AutoPrereqs]
 [Prereqs]
 MooseX::InsideOut = 0
+MooseX::NonMoose = 0
 [NextRelease]
 [PodSyntaxTests]
 [MetaJSON]
diff --git a/lib/POE/Filter/XML.pm b/lib/POE/Filter/XML.pm
old mode 100755
new mode 100644
index 1942d6f..dbbfa89
--- a/lib/POE/Filter/XML.pm
+++ b/lib/POE/Filter/XML.pm
@@ -1,222 +1,189 @@
 package POE::Filter::XML;
-BEGIN {
-  $POE::Filter::XML::VERSION = '1.102960';
+{
+  $POE::Filter::XML::VERSION = '1.140700';
 }
 
 #ABSTRACT: XML parsing for the POE framework
 
-use MooseX::Declare;
+use Moose;
+use MooseX::NonMoose;
 
 
-class POE::Filter::XML {
-    use MooseX::NonMoose;
-    extends 'Moose::Object','POE::Filter';
+extends 'Moose::Object','POE::Filter';
 
-    use Carp;
-    use Try::Tiny;
-    use XML::LibXML;
-    use POE::Filter::XML::Handler;
-    use Moose::Util::TypeConstraints;
-    use MooseX::Types::Moose(':all');
+use Carp;
+use XML::LibXML;
+use POE::Filter::XML::Handler;
 
 
-    has buffer =>
-    (
-        is => 'ro',
-        traits => [ 'Array' ],
-        isa => ArrayRef,
-        lazy => 1,
-        clearer => '_clear_buffer',
-        default => sub { [] },
-        handles =>
-        {
-            has_buffer => 'count',
-            all_buffer => 'elements',
-            push_buffer => 'push',
-            shift_buffer => 'shift',
-            join_buffer => 'join',
-        }
-    );
-
+has buffer =>
+(
+    is => 'ro',
+    traits => [ 'Array' ],
+    isa => 'ArrayRef',
+    lazy => 1,
+    clearer => '_clear_buffer',
+    default => sub { [] },
+    handles =>
+    {
+        has_buffer => 'count',
+        all_buffer => 'elements',
+        push_buffer => 'push',
+        shift_buffer => 'shift',
+        join_buffer => 'join',
+    }
+);
+
+
+has callback =>
+(
+    is => 'ro',
+    isa => 'CodeRef',
+    lazy => 1,
+    default => sub { sub { Carp::confess('Parsing error happened: '. join("\n", @_)) } },
+);
+
+
+has handler =>
+(
+    is => 'ro',
+    isa => 'POE::Filter::XML::Handler',
+    lazy => 1,
+    builder => '_build_handler',
+);
+
+
+has parser =>
+(
+    is => 'ro',
+    isa => 'XML::LibXML',
+    lazy => 1,
+    builder => '_build_parser',
+    clearer => '_clear_parser'
+);
+
+
+has not_streaming =>
+(
+    is => 'ro',
+    isa => 'Bool',
+    default => 0,
+);
+
+sub _build_handler {
+    my ($self) = @_;
+    POE::Filter::XML::Handler->new(not_streaming => $self->not_streaming)
+}
 
-    has callback =>
-    (
-        is => 'ro',
-        isa => CodeRef,
-        lazy => 1,
-        default => sub { Carp::confess('Parsing error happened: '. shift) },
-    );
+sub _build_parser {
+    my ($self) = @_;
+    XML::LibXML->new(Handler => $self->handler)
+}
 
 
-    has handler =>
-    (
-        is => 'ro',
-        isa => class_type('POE::Filter::XML::Handler'),
-        lazy => 1,
-        builder => '_build_handler',
-        handles =>
+sub BUILD {
+    my ($self) = @_;
+    if($self->has_buffer)
+    {
+        eval
         {
-            '_reset_handler' => 'reset',
-            'finished_nodes' => 'has_finished_nodes',
-            'get_node' => 'get_finished_node',
+            $self->parser->parse_chunk($self->join_buffer("\n"));
+            1;
         }
-    );
-
-
-    has parser =>
-    (
-        is => 'ro',
-        isa => class_type('XML::LibXML'),
-        lazy => 1,
-        builder => '_build_parser',
-        clearer => '_clear_parser'
-    );
-
-
-    has not_streaming =>
-    (
-        is => 'ro',
-        isa => Bool,
-        default => 0,
-    );
-
-    method _build_handler {
-        POE::Filter::XML::Handler->new(not_streaming => $self->not_streaming)
-    }
+        or do
+        {
+            my $err = $@ || 'Zombie Error';
+            $self->callback->($err);
+        };
 
-    method _build_parser {
-        XML::LibXML->new(Handler => $self->handler)
+        $self->_clear_buffer();
     }
+}
 
 
-    method BUILDARGS(ClassName $class: @args) returns (HashRef) {
+sub reset {
 
-        my $config = {};
-        my @keys;
-        while($#args != -1)
-        {
-            my $key = shift(@args);
-            if($key =~ m/[A-Z]+/)
-            {
-                push(@keys, $key);
-                $key = lc($key);
-            }
+    my ($self) = @_;
+    $self->handler->reset();
+    $self->_clear_parser();
+    $self->_clear_buffer();
+}
 
-            my $val = shift(@args);
-            $config->{$key} = $val;
-        }
-
-        if(@keys)
-        {
-            Carp::cluck
-            (
-                q|ALL CAPS usage of parameters (| . join(' ', @keys) . q|)|.
-                q| to the constructor |.
-                q|is DEPRECATED. Please correct this usage soon. Next |.
-                q|version will NOT support these arguments|
-            );
-        }
-        return $config;
-    }
 
+sub get_one_start {
 
-    method BUILD {
+    my ($self, $raw) = @_;
 
-        if($self->has_buffer)
+    if (defined $raw)
+    {
+        foreach my $raw_data (@$raw)
         {
-            try
-            {
-                $self->parser->parse_chunk($self->join_buffer("\n"));
-
-            }
-            catch
-            {
-                $self->callback->($_);
-            }
-            finally
-            {
-                $self->_clear_buffer();
-            }
+            $self->push_buffer(split(/(?=\x0a?\x0d|\x0d\x0a?)/s, $raw_data));
         }
     }
+}
 
 
-    method reset {
-
-        $self->_reset_handler();
-        $self->_clear_parser();
-        $self->_clear_buffer();
-    }
+sub get_one {
 
+    my ($self) = @_;
 
-    method get_one_start(ArrayRef $raw?) {
+    if($self->handler->has_finished_nodes())
+    {
+        return [$self->handler->get_finished_node()];
 
-        if (defined $raw)
+    }
+    else
+    {
+        while($self->has_buffer())
         {
-            foreach my $raw_data (@$raw)
+            my $line = $self->shift_buffer();
+
+            eval
             {
-                $self->push_buffer(split(/(?=\x0a?\x0d|\x0d\x0a?)/s, $raw_data));
+                $self->parser->parse_chunk($line);
+                1;
             }
-        }
-    }
-
-
-    method get_one returns (ArrayRef) {
-
-        if($self->finished_nodes())
-        {
-            return [$self->get_node()];
+            or do
+            {
+                my $err = $@ || 'Zombie error';
+                $self->callback->($err);
+            };
 
-        }
-        else
-        {
-            while($self->has_buffer())
+            if($self->handler->has_finished_nodes())
             {
-                my $line = $self->shift_buffer();
+                my $node = $self->handler->get_finished_node();
 
-                try
+                if($node->stream_end() or $self->not_streaming)
                 {
-                    $self->parser->parse_chunk($line);
+                    $self->parser->parse_chunk('', 1);
+                    $self->reset();
                 }
-                catch
-                {
-                    $self->callback->($_);
-                };
-
-                if($self->finished_nodes())
-                {
-                    my $node = $self->get_node();
 
-                    if($node->stream_end() or $self->not_streaming)
-                    {
-                        $self->parser->parse_chunk('', 1);
-                        $self->reset();
-                    }
-
-                    return [$node];
-                }
+                return [$node];
             }
-            return [];
         }
+        return [];
     }
+}
 
 
-    method put(ArrayRef $nodes) returns (ArrayRef) {
-
-        my $output = [];
+sub put {
+    my ($self, $nodes) = @_;
+    my $output = [];
 
-        foreach my $node (@$nodes)
+    foreach my $node (@$nodes)
+    {
+        if($node->stream_start())
         {
-            if($node->stream_start())
-            {
-                $self->reset();
-            }
-            push(@$output, $node->toString());
+            $self->reset();
         }
-
-        return $output;
+        push(@$output, $node->toString());
     }
+
+    return $output;
 }
+
 1;
 
 
@@ -228,7 +195,7 @@ POE::Filter::XML - XML parsing for the POE framework
 
 =head1 VERSION
 
-version 1.102960
+version 1.140700
 
 =head1 SYNOPSIS
 
@@ -247,16 +214,6 @@ strategy for POE::Wheels that will be dealing with XML streams.
 
 The parser is XML::LibXML
 
-=head1 CLASS_METHODS
-
-=head2 BUILDARGS
-
-    (ClassName $class: @args) returns (HashRef)
-
-BUILDARGS is provided to continue parsing the old style ALL CAPS arguments. If
-any ALL CAPS argument is detected, it will warn very loudly about deprecated
-usage.
-
 =head1 PUBLIC_ATTRIBUTES
 
 =head2 not_streaming
@@ -355,20 +312,13 @@ documented here in case the Filter is used outside of the POE context.
 A BUILD method is provided to parse the initial buffer (if any was included
 when constructing the filter).
 
-=head1 NOTES
-
-This latest version got a major overhaul. Everything is Moose-ified using
-MooseX::Declare to provide more rigorous constraint checking, real accessors,
-and greatly simplified internals. It should be backwards compatible (even the
-constructor arguments). If not, please file a bug report with a test case.
-
 =head1 AUTHOR
 
 Nicholas R. Perez <nperez at cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2010 by Nicholas R. Perez <nperez at cpan.org>.
+This software is copyright (c) 2014 by Nicholas R. Perez <nperez at cpan.org>.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
diff --git a/lib/POE/Filter/XML/Handler.pm b/lib/POE/Filter/XML/Handler.pm
old mode 100755
new mode 100644
index f79a8c4..427e280
--- a/lib/POE/Filter/XML/Handler.pm
+++ b/lib/POE/Filter/XML/Handler.pm
@@ -1,181 +1,179 @@
 package POE::Filter::XML::Handler;
-BEGIN {
-  $POE::Filter::XML::Handler::VERSION = '1.102960';
+{
+  $POE::Filter::XML::Handler::VERSION = '1.140700';
 }
 
 #ABSTRACT: Default SAX Handler for POE::Filter::XML
 
-use MooseX::Declare;
-
-class POE::Filter::XML::Handler {
-    use MooseX::NonMoose;
-    extends 'XML::SAX::Base';
-
-    use Moose::Util::TypeConstraints;
-    use MooseX::Types::Moose(':all');
-    use POE::Filter::XML::Node;
-
-
-    has current_node =>
-    (
-        is => 'rw',
-        isa => class_type('POE::Filter::XML::Node'),
-        predicate => '_has_current_node',
-        clearer => '_clear_current_node'
-    );
-
-    has finished_nodes =>
-    (
-        is => 'ro',
-        traits => ['Array'],
-        isa => ArrayRef,
-        default => sub { [] },
-        clearer => '_clear_finished_nodes',
-        handles =>
-        {
-            all_finished_nodes => 'elements',
-            has_finished_nodes => 'count',
-            add_finished_node => 'push',
-            get_finished_node => 'shift',
-        }
-    );
+use Moose;
+use MooseX::NonMoose;
 
+extends 'XML::SAX::Base';
 
-    has depth_stack =>
-    (
-        is => 'ro',
-        traits => ['Array'],
-        isa => ArrayRef,
-        default => sub { [] },
-        clearer => '_clear_depth_stack',
-        handles =>
-        {
-            push_depth_stack => 'push',
-            pop_depth_stack => 'pop',
-            depth => 'count',
-        }
-    );
+use POE::Filter::XML::Node;
 
 
-    has not_streaming => ( is => 'ro', isa => Bool, default => 0 );
+has current_node =>
+(
+    is => 'rw',
+    isa => 'POE::Filter::XML::Node',
+    predicate => '_has_current_node',
+    clearer => '_clear_current_node'
+);
 
 
-    method reset {
+has finished_nodes =>
+(
+    is => 'ro',
+    traits => ['Array'],
+    isa => 'ArrayRef',
+    default => sub { [] },
+    handles =>
+    {
+        all_finished_nodes => 'elements',
+        has_finished_nodes => 'count',
+        add_finished_node => 'push',
+        get_finished_node => 'shift',
+        _clear_finished_nodes => 'clear',
+    }
+);
+
 
-        $self->_clear_current_node();
-        $self->_clear_finished_nodes();
-        $self->_clear_depth_stack();
+has depth_stack =>
+(
+    is => 'ro',
+    traits => ['Array'],
+    isa => 'ArrayRef',
+    default => sub { [] },
+    clearer => '_clear_depth_stack',
+    handles =>
+    {
+        push_depth_stack => 'push',
+        pop_depth_stack => 'pop',
+        depth => 'count',
     }
+);
 
 
+has not_streaming => ( is => 'ro', isa => 'Bool', default => 0 );
 
-    override start_element(HashRef $data) {
 
-        my $node = POE::Filter::XML::Node->new($data->{'Name'});
+sub reset {
+    my ($self) = @_;
+    $self->_clear_current_node();
+    $self->_clear_finished_nodes();
+    $self->_clear_depth_stack();
+}
 
-        foreach my $attrib (values %{$data->{'Attributes'}})
-        {
-            $node->setAttribute
-            (
-                $attrib->{'Name'},
-                $attrib->{'Value'}
-            );
-        }
 
+sub start_element {
+    my ($self, $data) = @_;
+    my $node = POE::Filter::XML::Node->new($data->{'Name'});
 
-        if($self->depth() == 0)
-        {
-            #start of a document
-            $self->push_depth_stack($node);
+    foreach my $attrib (values %{$data->{'Attributes'}})
+    {
+        $node->setAttribute
+        (
+            $attrib->{'Name'},
+            $attrib->{'Value'}
+        );
+    }
 
-            if($self->not_streaming)
-            {
-                $self->current_node($node);
-            }
-            else
-            {
-                $node->_set_stream_start(1);
-                $self->add_finished_node($node);
-            }
+    if($self->depth() == 0)
+    {
+        #start of a document
+        $self->push_depth_stack($node);
 
+        if($self->not_streaming)
+        {
+            $self->current_node($node);
         }
         else
         {
-            # Top level fragment
-            $self->push_depth_stack($self->current_node);
+            $node->_set_stream_start(1);
+            $self->add_finished_node($node);
+        }
+    }
+    else
+    {
+        # Top level fragment
+        $self->push_depth_stack($self->current_node);
 
-            if($self->depth() == 2)
-            {
-                if($self->not_streaming)
-                {
-                    $self->current_node->appendChild($node);
-                }
-                $self->current_node($node);
-            }
-            else
+        if($self->depth() == 2)
+        {
+            if($self->not_streaming)
             {
-                # Some node within a fragment
                 $self->current_node->appendChild($node);
-                $self->current_node($node);
             }
+            $self->current_node($node);
+        }
+        else
+        {
+            # Some node within a fragment
+            $self->current_node->appendChild($node);
+            $self->current_node($node);
         }
-
-        super();
     }
 
+    $self->SUPER::start_element($data);
+}
 
-    method end_element(HashRef $data) {
 
-        if($self->depth() == 1)
-        {
-            if($self->not_streaming)
-            {
-                $self->add_finished_node($self->pop_depth_stack());
-            }
-            else
-            {
-                my $end = POE::Filter::XML::Node->new($data->{'Name'});
-                $end->_set_stream_end(1);
-                $self->add_finished_node($end);
-            }
+sub end_element {
+    
+    my ($self, $data) = @_;
 
-        }
-        elsif($self->depth() == 2)
+    if($self->depth() == 1)
+    {
+        if($self->not_streaming)
         {
-            if($self->not_streaming)
-            {
-                $self->current_node($self->pop_depth_stack());
-            }
-            else
-            {
-                $self->add_finished_node($self->current_node);
-                $self->_clear_current_node();
-                $self->pop_depth_stack();
-            }
-
+            $self->add_finished_node($self->pop_depth_stack());
         }
         else
         {
+            my $end = POE::Filter::XML::Node->new($data->{'Name'});
+            $end->_set_stream_end(1);
+            $self->add_finished_node($end);
+        }
+    }
+    elsif($self->depth() == 2)
+    {
+        if($self->not_streaming)
+        {
             $self->current_node($self->pop_depth_stack());
         }
-
-        super();
+        else
+        {
+            $self->add_finished_node($self->current_node);
+            $self->_clear_current_node();
+            $self->pop_depth_stack();
+        }
+    }
+    else
+    {
+        $self->current_node($self->pop_depth_stack());
     }
 
+    $self->SUPER::end_element($data);
+}
 
-    override characters(HashRef $data) {
 
-        if($self->depth() == 1)
-        {
-            return;
-        }
+sub characters {
 
-        $self->current_node->appendText($data->{'Data'});
+    my ($self, $data) = @_;
 
-        super();
+    if($self->depth() == 1)
+    {
+        return;
     }
+
+    $self->current_node->appendText($data->{'Data'});
+
+    $self->SUPER::characters($data);
 }
 
+1;
+
 
 
 =pod
@@ -186,7 +184,7 @@ POE::Filter::XML::Handler - Default SAX Handler for POE::Filter::XML
 
 =head1 VERSION
 
-version 1.102960
+version 1.140700
 
 =head1 DESCRIPTION
 
@@ -289,7 +287,7 @@ Nicholas R. Perez <nperez at cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2010 by Nicholas R. Perez <nperez at cpan.org>.
+This software is copyright (c) 2014 by Nicholas R. Perez <nperez at cpan.org>.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
diff --git a/lib/POE/Filter/XML/NS.pm b/lib/POE/Filter/XML/NS.pm
old mode 100755
new mode 100644
index b6b44d5..74b9d73
--- a/lib/POE/Filter/XML/NS.pm
+++ b/lib/POE/Filter/XML/NS.pm
@@ -1,6 +1,6 @@
 package POE::Filter::XML::NS;
-BEGIN {
-  $POE::Filter::XML::NS::VERSION = '1.102960';
+{
+  $POE::Filter::XML::NS::VERSION = '1.140700';
 }
 
 #ABSTRACT: Provides constants that return appropriate namespace strings
@@ -79,7 +79,7 @@ POE::Filter::XML::NS - Provides constants that return appropriate namespace stri
 
 =head1 VERSION
 
-version 1.102960
+version 1.140700
 
 =head1 SYNOPSIS
 
@@ -118,7 +118,7 @@ Nicholas R. Perez <nperez at cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2010 by Nicholas R. Perez <nperez at cpan.org>.
+This software is copyright (c) 2014 by Nicholas R. Perez <nperez at cpan.org>.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
diff --git a/lib/POE/Filter/XML/Node.pm b/lib/POE/Filter/XML/Node.pm
old mode 100755
new mode 100644
index 297f472..fb6f4ff
--- a/lib/POE/Filter/XML/Node.pm
+++ b/lib/POE/Filter/XML/Node.pm
@@ -1,159 +1,170 @@
 package POE::Filter::XML::Node;
-BEGIN {
-  $POE::Filter::XML::Node::VERSION = '1.102960';
+{
+  $POE::Filter::XML::Node::VERSION = '1.140700';
 }
 
 #ABSTRACT: A XML::LibXML::Element subclass that adds streaming semantics
 
-use MooseX::Declare;
+use Moose;
+use MooseX::NonMoose;
+use MooseX::InsideOut;
 
 
-class POE::Filter::XML::Node {
-    use MooseX::NonMoose::InsideOut;
-    extends 'XML::LibXML::Element';
+extends 'XML::LibXML::Element';
 
-    use XML::LibXML(':libxml');
-    use MooseX::Types::Moose(':all');
+use XML::LibXML(':libxml');
 
 
-    has stream_start => (is => 'ro', writer => '_set_stream_start', isa => Bool, default => 0);
-    has stream_end => (is => 'ro', writer => '_set_stream_end', isa => Bool, default => 0);
+has stream_start => (is => 'ro', writer => '_set_stream_start', isa => 'Bool', default => 0);
+has stream_end => (is => 'ro', writer => '_set_stream_end', isa => 'Bool', default => 0);
 
 
-    method BUILDARGS(ClassName $class: $name) {
+sub BUILDARGS {
+    my ($self, $name) = @_;
+    #only a name should be passed
+    return { name => $name };
+}
 
-        #only a name should be passed
-        return { name => $name };
-    }
 
+sub cloneNode {
+    
+    my ($self, $deep) = @_;
+    my $clone = $self->SUPER::cloneNode($deep);
+    
+    bless($clone, $self->meta->name());
+    
+    $clone->_set_stream_start($self->stream_start());
+    $clone->_set_stream_end($self->stream_end());
+    
+    return $clone;
+}
 
-    override cloneNode(Bool $deep) {
-        
-        my $clone = super();
-        
-        bless($clone, $self->meta->name());
-        
-        $clone->_set_stream_start($self->stream_start());
-        $clone->_set_stream_end($self->stream_end());
-        
-        return $clone;
-    }
+sub getChildrenByTagName {
+    my ($self, $name) = @_;
+    my $CLASS = $self->meta->name();
+    return (map { bless($_, $CLASS) } @{ $self->SUPER::getChildrenByTagName($name) });
+}
 
-    override getChildrenByTagName(Str $name) {
+sub getChildrenByTagNameNS {
+    my ($self, $nsURI, $localname) = @_;
+    my $CLASS = $self->meta->name();
+    return (map { bless($_, $CLASS) } @{ $self->SUPER::getChildrenByTagNameNS($nsURI, $localname) });
+}
 
-        return (map { bless($_, $self->meta->name()) } @{ super() });
-    }
+sub getChildrenByLocalName {
+    my ($self, $localname) = @_;
+    my $CLASS = $self->meta->name();
+    return (map { bless($_, $CLASS) } @{ $self->SUPER::getChildrenByLocalName($localname) });
+}
 
-    override getChildrenByTagNameNS(Str $nsURI, $localname) {
+sub getElementsByTagName {
+    my ($self, $name) = @_;
+    my $CLASS = $self->meta->name();
+    return (map { bless($_, $CLASS) } @{ $self->SUPER::getElementsByTagName($name) });
+}
 
-        return (map { bless($_, $self->meta->name()) } @{ super() });
-    }
+sub getElementsByTagNameNS {
+    my ($self, $nsURI, $localname) = @_;
+    my $CLASS = $self->meta->name();
+    return (map { bless($_, $CLASS) } @{ $self->SUPER::getElementsByTagNameNS($nsURI, $localname) });
+}
 
-    override getChildrenByLocalName(Str $localname) {
-        
-        return (map { bless($_, $self->meta->name()) } @{ super() });
-    }
+sub getElementsByLocalName {
+    my ($self, $localname) = @_;
+    my $CLASS = $self->meta->name();
+    return (map { bless($_, $CLASS) } @{ $self->SUPER::getElementsByLocalName($localname) });
+}
     
-    override getElementsByTagName(Str $name) {
 
-        return (map { bless($_, $self->meta->name()) } @{ super() });
+sub toString {
+    my ($self, $formatted, $docencoding) = @_;
+    
+    $formatted = defined($formatted) ? $formatted : 0;
+    $docencoding = defined($docencoding) ? $docencoding : 0;
+    
+    if($self->stream_start())
+    {
+        my $string = '<';
+        $string .= $self->nodeName();
+        foreach my $attr ($self->attributes())
+        {
+            $string .= sprintf(' %s="%s"', $attr->nodeName(), $attr->value());
+        }
+        $string .= '>';
+        return $string;
     }
-
-    override getElementsByTagNameNS(Str $nsURI, $localname) {
-
-        return (map { bless($_, $self->meta->name()) } @{ super() });
+    elsif ($self->stream_end())
+    {
+        return sprintf('</%s>', $self->nodeName()); 
     }
-
-    override getElementsByLocalName(Str $localname) {
-        
-        return (map { bless($_, $self->meta->name()) } @{ super() });
+    else
+    {
+        return $self->SUPER::toString($formatted, $docencoding);
     }
-    
+}
 
-    override toString(Bool $formatted?) returns (Str) {
 
-        if($self->stream_start())
+sub setAttributes {
+    my ($self, $array) = @_;
+    for(my $i = 0; $i < scalar(@$array); $i++)
+    {
+        if($array->[$i] eq 'xmlns')
         {
-            my $string = '<';
-            $string .= $self->nodeName();
-            foreach my $attr ($self->attributes())
-            {
-                $string .= sprintf(' %s="%s"', $attr->nodeName(), $attr->value());
-            }
-            $string .= '>';
-            return $string;
-        }
-        elsif ($self->stream_end())
-        {
-            return sprintf('</%s>', $self->nodeName()); 
+            $self->setNamespace($array->[++$i], '', 0);
         }
         else
         {
-            return super();
-        }
-    }
-
-
-    method setAttributes(ArrayRef $array) {
-
-        for(my $i = 0; $i < scalar(@$array); $i++)
-        {
-            if($array->[$i] eq 'xmlns')
-            {
-                $self->setNamespace($array->[++$i], '', 0);
-            }
-            else
-            {
-                $self->setAttribute($array->[$i], $array->[++$i]);
-            }
+            $self->setAttribute($array->[$i], $array->[++$i]);
         }
     }
+}
 
 
-    method getAttributes() returns (HashRef) {
-
-        my $attributes = {};
+sub getAttributes {
+    my ($self) = @_;
+    my $attributes = {};
 
-        foreach my $attrib ($self->attributes())
+    foreach my $attrib ($self->attributes())
+    {
+        if($attrib->nodeType == XML_ATTRIBUTE_NODE)
         {
-            if($attrib->nodeType == XML_ATTRIBUTE_NODE)
-            {
-                $attributes->{$attrib->nodeName()} = $attrib->value();
-            }
+            $attributes->{$attrib->nodeName()} = $attrib->value();
         }
-
-        return $attributes;
     }
 
+    return $attributes;
+}
 
-    method getSingleChildByTagName(Str $name) returns (Maybe[POE::Filter::XML::Node]) {
-
-        my $node = ($self->getChildrenByTagName($name))[0];
-        return undef if not defined($node);
-        return $node;
-    }
 
+sub getSingleChildByTagName {
+    my ($self, $name) = @_;
+    my $node = ($self->getChildrenByTagName($name))[0];
+    return undef if not defined($node);
+    return $node;
+}
 
-    method getChildrenHash() returns (HashRef) {
 
-        my $children = {};
+sub getChildrenHash {
+    my ($self) = @_;
+    my $children = {};
 
-        foreach my $child ($self->getChildrenByTagName("*"))
+    foreach my $child ($self->getChildrenByTagName("*"))
+    {
+        my $name = $child->nodeName();
+        
+        if(!exists($children->{$name}))
         {
-            my $name = $child->nodeName();
-            
-            if(!exists($children->{$name}))
-            {
-                $children->{$name} = [];
-            }
-            
-            push(@{$children->{$name}}, $child);
+            $children->{$name} = [];
         }
-
-        return $children;
+        
+        push(@{$children->{$name}}, $child);
     }
+
+    return $children;
 }
 
+1;
+
 
 
 =pod
@@ -164,7 +175,7 @@ POE::Filter::XML::Node - A XML::LibXML::Element subclass that adds streaming sem
 
 =head1 VERSION
 
-version 1.102960
+version 1.140700
 
 =head1 SYNOPSIS
 
@@ -280,7 +291,7 @@ Nicholas R. Perez <nperez at cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2010 by Nicholas R. Perez <nperez at cpan.org>.
+This software is copyright (c) 2014 by Nicholas R. Perez <nperez at cpan.org>.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libpoe-filter-xml-perl.git



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