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
resources:
license: http://dev.perl.org/licenses/
repository: http://github.com/bricas/uri-template
-version: 0.17
+version: 0.18
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
use strict;
use warnings;
-our $VERSION = '0.17';
+our $VERSION = '0.18';
use URI;
use URI::Escape ();
$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 );
}
}
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,
=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
"testcases":[
[ "{/empty_list}", [ "" ] ],
[ "{/empty_list*}", [ "" ] ],
- [ "{?empty_list}", [ "?empty_list="] ],
+ [ "{?empty_list}", [ ""] ],
[ "{?empty_list*}", [ "" ] ],
- [ "{?empty_assoc}", [ "?empty_assoc=" ] ],
+ [ "{?empty_assoc}", [ "" ] ],
[ "{?empty_assoc*}", [ "" ] ]
]
},
"id" : "thing",
"var" : "value",
"hello" : "Hello World!",
+ "with space" : "fail",
+ " leading_space" : "Hi!",
+ "trailing_space " : "Bye!",
"empty" : "",
"path" : "/foo/bar",
"x" : "1024",
[ "{hello:2*}", false ] ,
[ "{??hello}", false ] ,
[ "{!hello}", false ] ,
+ [ "{with space}", false],
+ [ "{ leading_space}", false],
+ [ "{trailing_space }", false],
[ "{=path}", false ] ,
[ "{$var}", false ],
[ "{|var*}", false ],
[ "{;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 ]
},
"testcases" : [
["{+var}", "value"],
+ ["{/var,empty}", "/value/"],
+ ["{/var,undef}", "/value"],
["{+hello}", "Hello%20World!"],
["{+half}", "50%25"],
["{base}index", "http%3A%2F%2Fexample.com%2Fhome%2Findex"],