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
requires:
URI: 0
perl: 5.6.0
-version: 0.11
+version: 0.12
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.
use strict;
use warnings;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use URI;
use URI::Escape ();
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/;
}
=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.
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More tests => 11;
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' );
+}