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

kanashiro-guest pushed a commit to branch master
in repository libxml-compile-cache-perl.

commit 439948fc93f379a19c1544e29c2275e25633db81
Author: Lucas Kanashiro <kanashiro.dua...@gmail.com>
Date:   Fri Jul 24 00:57:24 2015 -0300

    Imported Upstream version 1.03
---
 ChangeLog                 | 10 +++++++
 META.json                 |  6 ++---
 META.yml                  |  6 ++---
 Makefile.PL               |  6 ++---
 README                    | 12 ++++-----
 lib/XML/Compile/Cache.pm  | 66 +++++++++++++++++++++++++++++++++++------------
 lib/XML/Compile/Cache.pod | 45 ++++++++++++++++++++++++++++++--
 7 files changed, 118 insertions(+), 33 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ecbddbe..e19fe2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
 
 ==== version history of XML::Compile::Cache
 
+version 1.03: Mon Dec 22 08:41:12 CET 2014
+
+       Fixes:
+       - compileAll code-refs stored incorrectly.
+
+       Improvements:
+       - new method ::WSDL11::addNicePrefix()
+       - support new 'extends' hook.
+       - reader()/writer() add is_type option
+
 version 1.02: Wed May 28 09:28:08 CEST 2014
        Changes:
        - any_element default changed from 'SKIP_ALL' into 'ATTEMPT'
diff --git a/META.json b/META.json
index 2cea18e..3d33269 100644
--- a/META.json
+++ b/META.json
@@ -34,12 +34,12 @@
          "requires" : {
             "Log::Report" : "0.19",
             "Test::More" : "0.54",
-            "XML::Compile" : "1.41",
+            "XML::Compile" : "1.48",
             "XML::Compile::Tester" : "0.02",
-            "XML::LibXML::Simple" : "0.13"
+            "XML::LibXML::Simple" : "0.95"
          }
       }
    },
    "release_status" : "stable",
-   "version" : "1.02"
+   "version" : "1.03"
 }
diff --git a/META.yml b/META.yml
index 6258b4b..ee17ef9 100644
--- a/META.yml
+++ b/META.yml
@@ -20,7 +20,7 @@ no_index:
 requires:
   Log::Report: 0.19
   Test::More: 0.54
-  XML::Compile: 1.41
+  XML::Compile: 1.48
   XML::Compile::Tester: 0.02
-  XML::LibXML::Simple: 0.13
-version: 1.02
+  XML::LibXML::Simple: 0.95
+version: 1.03
diff --git a/Makefile.PL b/Makefile.PL
index ea8c00f..1c613de 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,11 +4,11 @@ use 5.008;
 
 WriteMakefile
  ( NAME                => 'XML::Compile::Cache'
- , VERSION     => '1.02'
+ , VERSION     => '1.03'
  , PREREQ_PM    =>
-   { XML::Compile              => '1.41'
+   { XML::Compile              => 1.48
    , XML::Compile::Tester      => 0.02
-   , XML::LibXML::Simple       => 0.13
+   , XML::LibXML::Simple       => 0.95
    , Log::Report               => 0.19
 
    , Test::More                => 0.54
diff --git a/README b/README
index bc5e134..ea730f8 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-=== README for XML-Compile-Cache version 1.02
-=   Generated on Wed May 28 09:28:15 2014 by OODoc 2.01
+=== README for XML-Compile-Cache version 1.03
+=   Generated on Mon Dec 22 08:41:24 2014 by OODoc 2.01
 
 There are various ways to install this module:
 
@@ -9,16 +9,16 @@ There are various ways to install this module:
  (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-Compile-Cache-1.02.tar.gz
-       tar -xf XML-Compile-Cache-1.02.tar
-       cd XML-Compile-Cache-1.02
+       gzip -d XML-Compile-Cache-1.03.tar.gz
+       tar -xf XML-Compile-Cache-1.03.tar
+       cd XML-Compile-Cache-1.03
        perl Makefile.PL
        make          # optional
        make test     # optional
        make install
 
 For usage, see the included manual-pages or
-    http://search.cpan.org/dist/XML-Compile-Cache-1.02/
+    http://search.cpan.org/dist/XML-Compile-Cache-1.03/
 
 Please report problems to
     http://rt.cpan.org/Dist/Display.html?Queue=XML-Compile-Cache
diff --git a/lib/XML/Compile/Cache.pm b/lib/XML/Compile/Cache.pm
index f6124be..b460497 100644
--- a/lib/XML/Compile/Cache.pm
+++ b/lib/XML/Compile/Cache.pm
@@ -7,7 +7,7 @@ use strict;
 
 package XML::Compile::Cache;
 use vars '$VERSION';
-$VERSION = '1.02';
+$VERSION = '1.03';
 
 use base 'XML::Compile::Schema';
 
@@ -30,14 +30,12 @@ sub init($)
     $self->{XCC_wopts}  = delete $args->{opts_writers} || [];
     $self->{XCC_undecl} = delete $args->{allow_undeclared} || 0;
 
-    $self->{XCC_rcode}  = {};  # compiled code refs
-    $self->{XCC_wcode}  = {};
     $self->{XCC_dropts} = {};  # declared opts
     $self->{XCC_dwopts} = {};
     $self->{XCC_uropts} = {};  # undeclared opts
     $self->{XCC_uwopts} = {};
 
-    $self->{XCC_readers} = {};
+    $self->{XCC_readers} = {}; # compiled code refs;
     $self->{XCC_writers} = {};
 
     $self->typemap($args->{typemap});
@@ -128,7 +126,7 @@ sub addPrefixes(@)
 
         if(my $def = $a->{$prefix})
         {   if($def->{uri} ne $ns)
-            {   error __x"prefix {prefix} already refers to {uri}, cannot use 
it for {ns}"
+            {   error __x"prefix `{prefix}' already refers to {uri}, cannot 
use it for {ns}"
                   , prefix => $prefix, uri => $def->{uri}, ns => $ns;
             }
         }
@@ -162,6 +160,26 @@ sub prefixFor($)
 }
 
 
+sub addNicePrefix($$)
+{   my ($self, $base, $ns) = @_;
+    if(my $def = $self->prefix($base))
+    {   return $base if $def->{uri} eq $ns;
+    }
+    else
+    {   $self->addPrefixes($base => $ns);
+        return $base;
+    }
+
+    $base .= '01' if $base !~ m/[0-9]$/;
+    while(my $def = $self->prefix($base))
+    {   return $base if $def->{uri} eq $ns;
+        $base++;
+    }
+    $self->addPrefixes($base => $ns);
+    $base;
+}
+
+
 sub learnPrefixes($)
 {   my ($self, $node) = @_;
     my $namespaces = $self->prefixes;
@@ -220,7 +238,7 @@ sub compileAll(;$$)
             {   my ($myns, $local) = unpack_type $type;
                 next if $usens eq $myns;
             }
-            $self->{XCC_rcode}{$type} ||= $self->compile(READER=>$type);
+            $self->reader($type);
         }
     }
 
@@ -230,7 +248,7 @@ sub compileAll(;$$)
             {   my ($myns, $local) = unpack_type $type;
                 next if $usens eq $myns;
             }
-            $self->{XCC_wcode}{$type} ||= $self->compile(WRITER => $type);
+            $self->writer($type);
         }
     }
 }
@@ -248,6 +266,7 @@ sub _same_params($$)
 
 sub reader($@)
 {   my ($self, $name) = (shift, shift);
+    my %args    = @_;
     my $type    = $self->findName($name);
     my $readers = $self->{XCC_readers};
 
@@ -262,7 +281,9 @@ sub reader($@)
     {   if(my $ur = $self->{XCC_uropts}{$type})
         {   # do not use cached version when options differ
             _same_params $ur, \@_
-                or return $self->compile(READER => $type, @_);
+                or return $args{is_type}
+                  ? $self->compileType(READER => $type, @_)
+                  : $self->compile(READER => $type, @_);
         }
         else
         {   $self->{XCC_uropts}{$type} = \@_;
@@ -272,13 +293,16 @@ sub reader($@)
          { error __x"type {name} is only declared as writer", name => $name }
     else { error __x"type {name} is not declared", name => $name }
 
-    $readers->{$type} ||= $self->compile(READER => $type, @_);
+    $readers->{$type} ||= $args{is_type}
+       ? $self->compileType(READER => $type, @_)
+       : $self->compile(READER => $type, @_);
 }
 
 
-sub writer($)
+sub writer($%)
 {   my ($self, $name) = (shift, shift);
-    my $type = $self->findName($name);
+    my %args    = @_;
+    my $type    = $self->findName($name);
     my $writers = $self->{XCC_writers};
 
     if(exists $self->{XCC_dwopts}{$type})
@@ -292,7 +316,9 @@ sub writer($)
     {   if(my $ur = $self->{XCC_uwopts}{$type})
         {   # do not use cached version when options differ
             _same_params $ur, \@_
-                or return $self->compile(WRITER => $type, @_)
+                or return $args{is_type}
+                  ? $self->compileType(WRITER => $type, @_)
+                  : $self->compile(WRITER => $type, @_);
         }
         else
         {   $self->{XCC_uwopts}{$type} = \@_;
@@ -305,7 +331,10 @@ sub writer($)
     {   error __x"type {name} is not declared", name => $name;
     }
 
-    $writers->{$type} ||= $self->compile(WRITER => $type, @_);
+    $writers->{$type} ||= $args{is_type}
+       ? $self->compileType(WRITER => $type, @_)
+       : $self->compile(WRITER => $type, @_);
+
 }
 
 sub template($$@)
@@ -408,11 +437,16 @@ sub _cleanup_hooks($)
 {   my ($self, $hooks) = @_;
     $hooks or return;
 
+    # translate prefixed type names into full names
     foreach my $hook (ref $hooks eq 'ARRAY' ? @$hooks : $hooks)
-    {   my $types = $hook->{type} or next;
-        $hook->{type} =
-           [ map {ref $_ eq 'Regexp' ? $_ : $self->findName($_)}
+    {   if(my $types = $hook->{type})
+        {   $hook->{type} =
+              [ map {ref $_ eq 'Regexp' ? $_ : $self->findName($_)}
                        ref $types eq 'ARRAY' ? @$types : $types ];
+        }
+        elsif(my $ext = $hook->{extends})
+        {   $hook->{extends} = $self->findName($ext);
+        }
     }
     $hooks;
 }
diff --git a/lib/XML/Compile/Cache.pod b/lib/XML/Compile/Cache.pod
index 44383fd..b5ef4f5 100644
--- a/lib/XML/Compile/Cache.pod
+++ b/lib/XML/Compile/Cache.pod
@@ -224,6 +224,19 @@ but the code gets much cleaner.
 
 =over 4
 
+=item $obj-E<gt>B<addNicePrefix>(BASE, NAMESPACE)
+
+[1.03] Register NAMESPACE -if not yet defined- with prefix name BASE.  When
+that prefix name is already in use for some other namespace, BASE followed
+by a number are attempted (starting with 01).  The prefix is returned.
+
+When the BASE already ends on a number, that number will get counted.
+
+example: 
+
+  my $prefix = $schema->addNicePrefix('call', $myns);
+  # $prefix now can be call, call01, call02 etc
+
 =item $obj-E<gt>B<addPrefixes>( [PAIRS|ARRAY|HASH] )
 
 The X::C logic does auto-detect prefix/namespaces combinations from
@@ -312,6 +325,10 @@ By default, the processors are only compiled when used.  
This method is
 especially useful in a B<daemon process>, where preparations can take as
 much time as they want to... and running should be as fast as possible.
 
+=item $obj-E<gt>B<compileType>( <'READER'|'WRITER'>, $type, %options )
+
+Inherited, see L<XML::Compile::Schema/"Compilers">
+
 =item $obj-E<gt>B<dataToXML>($node|REF-XML|XML-STRING|$filename|$fh|$known)
 
 =item 
XML::Compile::Cache-E<gt>B<dataToXML>($node|REF-XML|XML-STRING|$filename|$fh|$known)
@@ -334,6 +351,18 @@ The reader will be compiled the first time that it is 
used, and that
 same CODE reference will be returned each next request for the same
 $type.  Call L<compileAll()|XML::Compile::Cache/"Compilers"> to have all 
readers compiled by force.
 
+ -Option --Default
+  is_type  <false>
+
+=over 2
+
+=item is_type => BOOLEAN
+
+[1.03] use L<compileType()|XML::Compile::Schema/"Compilers"> with the given 
element, to replace L<compile()|XML::Compile::Schema/"Compilers">
+You probably want an additional C<element> parameter.
+
+=back
+
 example: 
 
   my $schema = XML::Compile::Cache->new(\@xsd,
@@ -357,6 +386,18 @@ The writer will be compiled the first time that it is 
used, and that
 same CODE reference will be returned each next request for the same
 type.
 
+ -Option --Default
+  is_type  <false>
+
+=over 2
+
+=item is_type => BOOLEAN
+
+[1.03] use L<compileType()|XML::Compile::Schema/"Compilers"> with the given 
element, to replace L<compile()|XML::Compile::Schema/"Compilers">
+You probably want an additional C<element> parameter.
+
+=back
+
 example: 
 
   my $xml = $cache->writer('gml:members')->($doc, $data);
@@ -501,8 +542,8 @@ 
L<XML::Compile::Util::pack_type()|XML::Compile::Util/"Packing">.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile-Cache distribution version 1.02,
-built on May 28, 2014. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile-Cache distribution version 1.03,
+built on December 22, 2014. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libxml-compile-cache-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to