projects
/
liburi-template-perl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c5e0642
)
Imported Upstream version 0.18
upstream/0.18
author
Ian Beckwith
<ianb@erislabs.net>
Thu, 23 Jan 2014 22:59:49 +0000
(22:59 +0000)
committer
Ian Beckwith
<ianb@erislabs.net>
Thu, 23 Jan 2014 22:59:49 +0000
(22:59 +0000)
Changes
patch
|
blob
|
history
META.yml
patch
|
blob
|
history
README
patch
|
blob
|
history
lib/URI/Template.pm
patch
|
blob
|
history
t/cases/extended-tests.json
patch
|
blob
|
history
t/cases/negative-tests.json
patch
|
blob
|
history
t/cases/spec-examples-by-section.json
patch
|
blob
|
history
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
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
0.17 2013-03-11
- Special case return from empty hash and array values in query strings
diff --git
a/META.yml
b/META.yml
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
resources:
license: http://dev.perl.org/licenses/
repository: http://github.com/bricas/uri-template
-version: 0.1
7
+version: 0.1
8
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
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
INSTALLATION
perl Makefile.PL
diff --git
a/lib/URI/Template.pm
b/lib/URI/Template.pm
index
390f6a6
..
54a73ac
100644
(file)
--- a/
lib/URI/Template.pm
+++ b/
lib/URI/Template.pm
@@
-3,7
+3,7
@@
package URI::Template;
use strict;
use warnings;
use strict;
use warnings;
-our $VERSION = '0.1
7
';
+our $VERSION = '0.1
8
';
use URI;
use URI::Escape ();
use URI;
use URI::Escape ();
@@
-123,10
+123,7
@@
sub _tostring_query {
$join = '&' if $exp->{ op } =~ /[?&]/;
if ( ref $value eq 'ARRAY' ) {
$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 );
if ( $var->{ explode } ) {
return join( $join,
map { $var->{ name } . '=' . _quote( $_, $safe ) } @$value );
@@
-137,10
+134,7
@@
sub _tostring_query {
}
}
elsif ( ref $value eq 'HASH' ) {
}
}
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,
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:
=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
=head1 INSTALLATION
diff --git
a/t/cases/extended-tests.json
b/t/cases/extended-tests.json
index
959840e
..
fd69744
100644
(file)
--- a/
t/cases/extended-tests.json
+++ b/
t/cases/extended-tests.json
@@
-92,9
+92,9
@@
"testcases":[
[ "{/empty_list}", [ "" ] ],
[ "{/empty_list*}", [ "" ] ],
"testcases":[
[ "{/empty_list}", [ "" ] ],
[ "{/empty_list*}", [ "" ] ],
- [ "{?empty_list}", [ "
?empty_list=
"] ],
+ [ "{?empty_list}", [ ""] ],
[ "{?empty_list*}", [ "" ] ],
[ "{?empty_list*}", [ "" ] ],
- [ "{?empty_assoc}", [ "
?empty_assoc=
" ] ],
+ [ "{?empty_assoc}", [ "" ] ],
[ "{?empty_assoc*}", [ "" ] ]
]
},
[ "{?empty_assoc*}", [ "" ] ]
]
},
diff --git
a/t/cases/negative-tests.json
b/t/cases/negative-tests.json
index
dca9c9e
..
552a6bf
100644
(file)
--- a/
t/cases/negative-tests.json
+++ b/
t/cases/negative-tests.json
@@
-5,6
+5,9
@@
"id" : "thing",
"var" : "value",
"hello" : "Hello World!",
"id" : "thing",
"var" : "value",
"hello" : "Hello World!",
+ "with space" : "fail",
+ " leading_space" : "Hi!",
+ "trailing_space " : "Bye!",
"empty" : "",
"path" : "/foo/bar",
"x" : "1024",
"empty" : "",
"path" : "/foo/bar",
"x" : "1024",
@@
-26,6
+29,9
@@
[ "{hello:2*}", false ] ,
[ "{??hello}", false ] ,
[ "{!hello}", false ] ,
[ "{hello:2*}", false ] ,
[ "{??hello}", false ] ,
[ "{!hello}", false ] ,
+ [ "{with space}", false],
+ [ "{ leading_space}", false],
+ [ "{trailing_space }", false],
[ "{=path}", false ] ,
[ "{$var}", false ],
[ "{|var*}", false ],
[ "{=path}", false ] ,
[ "{$var}", false ],
[ "{|var*}", false ],
@@
-41,6
+47,8
@@
[ "{;keys:1*}", false ],
[ "?{-join|&|var,list}" , false ],
[ "/people/{~thing}", 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 ]
[ "/sparql{?query){&default-graph-uri*}", false ],
[ "/resolution{?x, y}" , false ]
diff --git
a/t/cases/spec-examples-by-section.json
b/t/cases/spec-examples-by-section.json
index
dbb00ff
..
5aef182
100644
(file)
--- a/
t/cases/spec-examples-by-section.json
+++ b/
t/cases/spec-examples-by-section.json
@@
-109,6
+109,8
@@
},
"testcases" : [
["{+var}", "value"],
},
"testcases" : [
["{+var}", "value"],
+ ["{/var,empty}", "/value/"],
+ ["{/var,undef}", "/value"],
["{+hello}", "Hello%20World!"],
["{+half}", "50%25"],
["{base}index", "http%3A%2F%2Fexample.com%2Fhome%2Findex"],
["{+hello}", "Hello%20World!"],
["{+half}", "50%25"],
["{base}index", "http%3A%2F%2Fexample.com%2Fhome%2Findex"],