Imported Upstream version 0.18 upstream/0.18
authorIan Beckwith <ianb@erislabs.net>
Thu, 23 Jan 2014 22:59:49 +0000 (22:59 +0000)
committerIan Beckwith <ianb@erislabs.net>
Thu, 23 Jan 2014 22:59:49 +0000 (22:59 +0000)
Changes
META.yml
README
lib/URI/Template.pm
t/cases/extended-tests.json
t/cases/negative-tests.json
t/cases/spec-examples-by-section.json

diff --git a/Changes b/Changes
index a9677c3..edd4a6f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Perl extension URI::Template
 
+0.18 2013-12-05
+ - Fix empty hash/array special casing to not return anything
+
 0.17 2013-03-11
  - Special case return from empty hash and array values in query strings
 
index fc3f038..4ce2ac9 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -27,4 +27,4 @@ requires:
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://github.com/bricas/uri-template
-version: 0.17
+version: 0.18
diff --git a/README b/README
index 0010981..b8e6224 100644 (file)
--- a/README
+++ b/README
@@ -9,7 +9,7 @@ SYNOPSIS
 
 DESCRIPTION
     This module provides a wrapper around URI templates as described in RFC
-    6570: http://tools.ietf.org/html/rfc6570
+    6570: <http://tools.ietf.org/html/rfc6570>.
 
 INSTALLATION
         perl Makefile.PL
index 390f6a6..54a73ac 100644 (file)
@@ -3,7 +3,7 @@ package URI::Template;
 use strict;
 use warnings;
 
-our $VERSION = '0.17';
+our $VERSION = '0.18';
 
 use URI;
 use URI::Escape        ();
@@ -123,10 +123,7 @@ sub _tostring_query {
     $join = '&' if $exp->{ op } =~ /[?&]/;
 
     if ( ref $value eq 'ARRAY' ) {
-        if( !@$value ) {
-            return if $var->{ explode };
-            return $var->{ name } . '=';
-        }
+        return if !@$value;
         if ( $var->{ explode } ) {
             return join( $join,
                 map { $var->{ name } . '=' . _quote( $_, $safe ) } @$value );
@@ -137,10 +134,7 @@ sub _tostring_query {
         }
     }
     elsif ( ref $value eq 'HASH' ) {
-        if( !keys %$value ) {
-            return if $var->{ explode };
-            return $var->{ name } . '=';
-        }
+        return if !keys %$value;
         if ( $var->{ explode } ) {
             return join(
                 $join,
@@ -341,7 +335,7 @@ URI::Template - Object for handling URI templates (RFC 6570)
 =head1 DESCRIPTION
 
 This module provides a wrapper around URI templates as described in RFC 6570: 
-http://tools.ietf.org/html/rfc6570
+L<< http://tools.ietf.org/html/rfc6570 >>.
 
 =head1 INSTALLATION
 
index 959840e..fd69744 100644 (file)
@@ -92,9 +92,9 @@
         "testcases":[
             [ "{/empty_list}", [ "" ] ],
             [ "{/empty_list*}", [ "" ] ],
-            [ "{?empty_list}", [ "?empty_list="] ],
+            [ "{?empty_list}", [ ""] ],
             [ "{?empty_list*}", [ "" ] ],
-            [ "{?empty_assoc}", [ "?empty_assoc=" ] ],
+            [ "{?empty_assoc}", [ "" ] ],
             [ "{?empty_assoc*}", [ "" ] ]
         ]
     },
index dca9c9e..552a6bf 100644 (file)
@@ -5,6 +5,9 @@
             "id"                : "thing",
             "var"               : "value",
             "hello"             : "Hello World!",
+            "with space"        : "fail",
+            " leading_space"    : "Hi!",
+            "trailing_space "   : "Bye!",
             "empty"             : "",
             "path"              : "/foo/bar",
             "x"                 : "1024",
@@ -26,6 +29,9 @@
             [ "{hello:2*}",  false  ] ,
             [ "{??hello}",  false  ] ,
             [ "{!hello}",  false  ] ,
+            [ "{with space}", false],
+            [ "{ leading_space}", false],
+            [ "{trailing_space }", false],
             [ "{=path}",  false  ] ,
             [ "{$var}", false ],
             [ "{|var*}", false ],
@@ -41,6 +47,8 @@
             [ "{;keys:1*}",  false  ],
             [ "?{-join|&|var,list}" , false ],
             [ "/people/{~thing}", false],
+            [ "/{default-graph-uri}", false ],
+            [ "/sparql{?query,default-graph-uri}", false ],
             [ "/sparql{?query){&default-graph-uri*}", false ],
             [ "/resolution{?x, y}" , false ]
 
index dbb00ff..5aef182 100644 (file)
      },
      "testcases" : [
         ["{+var}", "value"],
+        ["{/var,empty}", "/value/"],
+        ["{/var,undef}", "/value"],
         ["{+hello}", "Hello%20World!"],
         ["{+half}", "50%25"],
         ["{base}index", "http%3A%2F%2Fexample.com%2Fhome%2Findex"],