r76034 - in /branches/upstream/libxml-libxml-simple-perl/current: ChangeLog META.yml Makefile.PL README lib/XML/LibXML/Simple.pm lib/XML/LibXML/Simple.pod

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Sat Jun 18 21:09:35 UTC 2011


Author: carnil
Date: Sat Jun 18 21:09:33 2011
New Revision: 76034

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=76034
Log:
[svn-upgrade] new version libxml-libxml-simple-perl (0.90)

Modified:
    branches/upstream/libxml-libxml-simple-perl/current/ChangeLog
    branches/upstream/libxml-libxml-simple-perl/current/META.yml
    branches/upstream/libxml-libxml-simple-perl/current/Makefile.PL
    branches/upstream/libxml-libxml-simple-perl/current/README
    branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pm
    branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pod

Modified: branches/upstream/libxml-libxml-simple-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxml-simple-perl/current/ChangeLog?rev=76034&op=diff
==============================================================================
--- branches/upstream/libxml-libxml-simple-perl/current/ChangeLog (original)
+++ branches/upstream/libxml-libxml-simple-perl/current/ChangeLog Sat Jun 18 21:09:33 2011
@@ -1,5 +1,13 @@
 
 === version history for XML::LibXML::Simple
+
+version 0.90: Wed Jun 15 10:20:48 CEST 2011
+	Fixes:
+	- initialize XML::LibXML::Parser into safe mode.
+	  rt.cpan.org#68803 [Yann Kerherve]
+
+	Improvements:
+	- new Parser and ParserOpts parameters
 
 version 0.15: Thu Apr 28 10:22:34 CEST 2011
 	Fixes:

Modified: branches/upstream/libxml-libxml-simple-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxml-simple-perl/current/META.yml?rev=76034&op=diff
==============================================================================
--- branches/upstream/libxml-libxml-simple-perl/current/META.yml (original)
+++ branches/upstream/libxml-libxml-simple-perl/current/META.yml Sat Jun 18 21:09:33 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               XML-LibXML-Simple
-version:            0.15
+version:            0.90
 abstract:           XML::LibXML based XML::Simple clone
 author:
     - Mark Overmeer

Modified: branches/upstream/libxml-libxml-simple-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxml-simple-perl/current/Makefile.PL?rev=76034&op=diff
==============================================================================
--- branches/upstream/libxml-libxml-simple-perl/current/Makefile.PL (original)
+++ branches/upstream/libxml-libxml-simple-perl/current/Makefile.PL Sat Jun 18 21:09:33 2011
@@ -4,7 +4,7 @@
 
 WriteMakefile
  ( NAME	 	=> 'XML::LibXML::Simple'
- , VERSION	=> '0.15'
+ , VERSION	=> '0.90'
  , PREREQ_PM    =>
    { XML::LibXML     => 1.64
    , Test::More      => 0.54

Modified: branches/upstream/libxml-libxml-simple-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxml-simple-perl/current/README?rev=76034&op=diff
==============================================================================
--- branches/upstream/libxml-libxml-simple-perl/current/README (original)
+++ branches/upstream/libxml-libxml-simple-perl/current/README Sat Jun 18 21:09:33 2011
@@ -1,5 +1,5 @@
-=== README for XML-LibXML-Simple version 0.15
-=   Generated on Thu Apr 28 10:22:46 2011 by OODoc 2.00
+=== README for XML-LibXML-Simple version 0.90
+=   Generated on Wed Jun 15 10:21:43 2011 by OODoc 2.00
 
 There are various ways to install this module:
 
@@ -9,16 +9,16 @@
  (2) if you use Windows, have a look at http://ppm.activestate.com/
 
  (3) if you have downloaded this module manually (as root/administrator)
-       gzip -d XML-LibXML-Simple-0.15.tar.gz
-       tar -xf XML-LibXML-Simple-0.15.tar
-       cd XML-LibXML-Simple-0.15
+       gzip -d XML-LibXML-Simple-0.90.tar.gz
+       tar -xf XML-LibXML-Simple-0.90.tar
+       cd XML-LibXML-Simple-0.90
        perl Makefile.PL
        make          # optional
        make test     # optional
        make install
 
 For usage, see the included manual-pages or
-    http://search.cpan.org/dist/XML-LibXML-Simple-0.15/
+    http://search.cpan.org/dist/XML-LibXML-Simple-0.90/
 
 Please report problems to
     http://rt.cpan.org/Dist/Display.html?Queue=XML-LibXML-Simple

Modified: branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pm?rev=76034&op=diff
==============================================================================
--- branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pm (original)
+++ branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pm Sat Jun 18 21:09:33 2011
@@ -4,7 +4,7 @@
 # Pod stripped from pm file by OODoc 2.00.
 package XML::LibXML::Simple;
 use vars '$VERSION';
-$VERSION = '0.15';
+$VERSION = '0.90';
 
 use base 'Exporter';
 use strict;
@@ -25,7 +25,7 @@
 my %known_opts = map { ($_ => 1) }
   qw(keyattr keeproot forcecontent contentkey noattr searchpath
      forcearray grouptags nsexpand normalisespace normalizespace
-     valueattr nsstrip);
+     valueattr nsstrip parser parseropts);
 
 my @DefKeyAttr     = qw(name key id);
 my $DefContentKey  = qq(content);
@@ -34,7 +34,12 @@
 sub new(@)
 {   my $class = shift;
     my $self  = bless {}, $class;
-    $self->{opts} = $self->_take_opts(@_);
+    my $opts  = $self->{opts} = $self->_take_opts(@_);
+
+    # parser object cannot be reused
+    !defined $opts->{parser}
+        or error __x"parser option for XMLin only";
+
     $self;
 }
 
@@ -64,9 +69,14 @@
 sub _get_xml($$)
 {   my ($self, $source, $opts) = @_;
 
-    $source    = $self->default_data_source($opts) unless defined $source;
-    $source    = \*STDIN if $source eq '-';
-    my $parser = XML::LibXML->new;
+    $source    = $self->default_data_source($opts)
+        unless defined $source;
+
+    $source    = \*STDIN
+        if $source eq '-';
+
+    my $parser = $opts->{parser}
+              || $self->_create_parser($opts->{parseropts});
 
     my $xml
       = UNIVERSAL::isa($source,'XML::LibXML::Document') ? $source
@@ -83,6 +93,22 @@
     $xml;
 }
 
+sub _create_parser(@)
+{   my $self = shift;
+    my @popt = @_ != 1 ? @_ : ref $_[0] eq 'HASH' ? %{$_[0]} : @{$_[0]};
+
+    XML::LibXML->new
+      ( line_numbers    => 1
+      , no_network      => 1
+      , expand_xinclude => 0
+      , expand_entities => 1
+      , load_ext_dtd    => 0
+      , ext_ent_handler =>
+           sub { alert __x"parsing external entities disabled"; '' }
+      , @popt
+      );
+}
+
 sub _take_opts(@)
 {   my $self = shift;
    
@@ -169,6 +195,8 @@
 
     !$opt{grouptags} || ref $opt{grouptags} eq 'HASH'
         or croak "Illegal value for 'GroupTags' option -expected a hashref";
+
+    $opt{parseropts} ||= {};
 
     \%opt;
 }
@@ -218,9 +246,9 @@
     $d->{$k};
 }
 
-# Takes the parse tree that XML::Parser produced from the supplied XML and
-# recurses through it 'collapsing' unnecessary levels of indirection (nested
-# arrays etc) to produce a data structure that is easier to work with.
+# Takes the parse tree that XML::LibXML::Parser produced from the supplied
+# XML and recurse through it 'collapsing' unnecessary levels of indirection
+# (nested arrays etc) to produce a data structure that is easier to work with.
 
 sub _expand_name($)
 {   my $node = shift;

Modified: branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pod?rev=76034&op=diff
==============================================================================
--- branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pod (original)
+++ branches/upstream/libxml-libxml-simple-perl/current/lib/XML/LibXML/Simple.pod Sat Jun 18 21:09:33 2011
@@ -67,24 +67,23 @@
 
 =over 4
 
-=item .
-
-Only L<XMLin()|XML::LibXML::Simple/"Translators"> is supported: if you want to write XML the use a schema
-(for instance with XML::Compile).  Do not attempt to create XML by
-hand!  If you still think you need it, then have a look at XMLout() as
-implemented by XML::Simple or any of a zillion template systems.
-
-=item .
+=item only L<XMLin()|XML::LibXML::Simple/"Translators"> is supported
+
+If you want to write XML then use a schema (for instance with
+XML::Compile). Do not attempt to create XML by hand!  If you still
+think you need it, then have a look at XMLout() as implemented by
+XML::Simple or any of a zillion template systems.
+
+=item no "variables" option
 
 IMO, you should use a templating system if you want variables filled-in
 in the input: it is not a task for this module.
 
-=item .
-
-Also, empty elements are not removed: being empty has a meaning which
-should not be ignored.
-
-=item .
+=item empty elements are not removed
+
+Being empty has a meaning which should not be ignored.
+
+=item ForceArray options
 
 There are a few small differences in the result of the C<forcearray> option,
 because XML::Simple seems to behave inconsequently.
@@ -465,6 +464,23 @@
 
 Note: you can spell this option with a 'z' if that is more natural for you.
 
+=item Parser => OBJECT
+
+You may pass your own XML::LibXML object, in stead of having one
+created for you. This is useful when you need specific configuration
+on that object (See XML::LibXML::Parser) or have implemented your
+own extension to that object.
+
+The internally created parser object is configured in safe mode.
+Read the XML::LibXML::Parser manual about security issues with
+certain parameter settings.  The default is unsafe!
+
+=item ParserOpts => HASH|ARRAY
+
+Pass parameters to the creation of a new internal parser object. You
+can overrule the options which will create a safe parser. It may be more
+readible to use the C<Parser> parameter.
+
 =item SearchPath => [ list ] I<# handy>
 
 If you pass C<XMLin()> a filename, but the filename include no directory
@@ -479,7 +495,7 @@
 will contain only the directory in which the script itself is located.
 Otherwise the default SearchPath will be empty.  
 
-=item ValueAttr => [ names ] I<# in - handy>
+=item ValueAttr => [ names ] I<# handy>
 
 Use this option to deal elements which always have a single attribute and no
 content.  Eg:




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