Imported upstream version 0.12 upstream/0.12
authorIan Beckwith <ianb@erislabs.net>
Sat, 1 Mar 2008 00:36:32 +0000 (00:36 +0000)
committerIan Beckwith <ianb@erislabs.net>
Sat, 1 Mar 2008 00:36:32 +0000 (00:36 +0000)
Changes
META.yml
README
lib/URI/Template.pm
t/20-deparse.t

diff --git a/Changes b/Changes
index d6a2826..3dc01f2 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Perl extension URI::Template
 
+0.12  Sun Feb 10 2008
+    - Attempt to fix deparse() when the template ends in a variable
+
 0.11  Fri Feb 08 2008
     - require perl 5.6 minimum
 
index 72d5576..dcc55c4 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -18,4 +18,4 @@ no_index:
 requires: 
   URI: 0
   perl: 5.6.0
-version: 0.11
+version: 0.12
diff --git a/README b/README
index fd4982a..c632c13 100644 (file)
--- a/README
+++ b/README
@@ -55,7 +55,7 @@ AUTHOR
     Brian Cassidy <bricas@cpan.org>
 
 COPYRIGHT AND LICENSE
-    Copyright 2007 by Brian Cassidy
+    Copyright 2008 by Brian Cassidy
 
     This library is free software; you can redistribute it and/or modify it
     under the same terms as Perl itself.
index 8b67663..c7f45a2 100644 (file)
@@ -3,7 +3,7 @@ package URI::Template;
 use strict;
 use warnings;
 
-our $VERSION = '0.11';
+our $VERSION = '0.12';
 
 use URI;
 use URI::Escape ();
@@ -172,6 +172,8 @@ sub deparse {
         my $templ = $self->as_string;
         $self->{ vars_list } = [ $templ =~ /{(.+?)}/g ];
         $templ =~ s/{.+?}/(.+?)/g;
+        # If the template ends w/ a match, then make it greedy.
+        $templ =~ s/\Q(.+?)\E$/(.+)/;
         $self->{ deparse_re } = qr/$templ/;
     }
 
@@ -188,7 +190,7 @@ Brian Cassidy E<lt>bricas@cpan.orgE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2007 by Brian Cassidy
+Copyright 2008 by Brian Cassidy
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 
index acb753e..4fac4b3 100644 (file)
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 8;
+use Test::More tests => 11;
 
 use_ok( 'URI::Template' );
 
@@ -34,3 +34,13 @@ use_ok( 'URI::Template' );
     my %result = $template->deparse( $uri );
     is_deeply( \%result, \%input, 'process => deparse' );
 }
+
+{
+    my $template = URI::Template->new( 'http://ex.com/{test}' );
+    isa_ok( $template, 'URI::Template' );
+    my %input = ( test => 'test' );
+    my $uri = $template->process( test => 'test' );
+    is( $uri, 'http://ex.com/test' );
+    my %result = $template->deparse( $uri );
+    is_deeply( \%result, \%input, 'process => deparse w/ multiple chars' );
+}