Imported upstream version 0.10 upstream/0.10
authorIan Beckwith <ianb@erislabs.net>
Sat, 1 Mar 2008 00:36:31 +0000 (00:36 +0000)
committerIan Beckwith <ianb@erislabs.net>
Sat, 1 Mar 2008 00:36:31 +0000 (00:36 +0000)
22 files changed:
Changes
MANIFEST
META.yml
Makefile.PL
README [deleted file]
inc/Module/Install.pm
inc/Module/Install/AutoInstall.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Include.pm
inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
lib/URI/Template.pm
t/10-basic.t
t/11-ordered.t
t/12-suite.t
t/20-deparse.t
t/98-pod.t
t/99-podcoverage.t

diff --git a/Changes b/Changes
index c14ab35..6ba0a19 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Perl extension URI::Template
 
+0.10  Wed Jan 16 2007
+    - fix test suite for JSON 2.x
+
 0.09  Tue Aug 28 2007
     - minor doc update
 
index 31ee7b1..926e9c6 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -14,7 +14,6 @@ lib/URI/Template.pm
 Makefile.PL
 MANIFEST                       This list of files
 META.yml
-README
 t/01-use.t
 t/10-basic.t
 t/11-ordered.t
index 4a4c9cd..9cd5464 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,8 +1,11 @@
 --- 
 abstract: Object for handling URI templates
-author: Brian Cassidy <bricas@cpan.org>
+author: 
+  - Brian Cassidy <bricas@cpan.org>
+build_requires: 
+  Test::More: 0
 distribution_type: module
-generated_by: Module::Install version 0.67
+generated_by: Module::Install version 0.68
 license: perl
 meta-spec: 
   url: http://module-build.sourceforge.net/META-spec-v1.3.html
@@ -13,6 +16,5 @@ no_index:
     - inc
     - t
 requires: 
-  Test::More: 0
   URI: 0
-version: 0.09
+version: 0.10
index 9d387c8..a7295fc 100644 (file)
@@ -1,10 +1,11 @@
-use inc::Module::Install 0.65;
+use inc::Module::Install 0.68;
 
 name 'URI-Template';
 all_from 'lib/URI/Template.pm';
 
 requires 'URI';
-requires 'Test::More';
+
+test_requires 'Test::More';
 
 auto_install;
 WriteAll;
diff --git a/README b/README
deleted file mode 100644 (file)
index fd4982a..0000000
--- a/README
+++ /dev/null
@@ -1,62 +0,0 @@
-NAME
-    URI::Template - Object for handling URI templates
-
-SYNOPSIS
-        use URI::Template;
-        my $template = URI::Template->new( 'http://example.com/{x}' );
-        my $uri      = $template->process( x => 'y' );
-        # uri is a URI object with value 'http://example.com/y'
-
-        my %result = $template->deparse( $uri );
-        # %result is ( x => 'y' )
-
-DESCRIPTION
-    This is an initial attempt to provide a wrapper around URI templates as
-    described at
-    http://www.ietf.org/internet-drafts/draft-gregorio-uritemplate-01.txt
-
-INSTALLATION
-        perl Makefile.PL
-        make
-        make test
-        make install
-
-METHODS
-  new( $template )
-    Creates a new URI::Template instance with the template passed in as the
-    first parameter.
-
-  as_string( )
-    Returns the original template string. Also used when the object is
-    stringified.
-
-  variables( )
-    Returns an array of unique variable names found in the template. NB:
-    they are returned in random order.
-
-  all_variables( )
-    Returns an array of variable names found as they appear in template --
-    in order, duplicates included.
-
-  process( %vars|\@values )
-    Given a list of key-value pairs or an array ref of values (for
-    positional substitution), it will URI escape the values and substitute
-    them in to the template. Returns a URI object.
-
-  process_to_string( %vars|\@values )
-    Processes input like the "process" method, but doesn't inflate the
-    result to a URI object.
-
-  deparse( $uri )
-    Does some rudimentary deparsing of a uri based on the current template.
-    Returns a hash with the extracted values.
-
-AUTHOR
-    Brian Cassidy <bricas@cpan.org>
-
-COPYRIGHT AND LICENSE
-    Copyright 2007 by Brian Cassidy
-
-    This library is free software; you can redistribute it and/or modify it
-    under the same terms as Perl itself.
-
index 9d13686..89a8653 100644 (file)
@@ -28,7 +28,7 @@ BEGIN {
     # This is not enforced yet, but will be some time in the next few
     # releases once we can make sure it won't clash with custom
     # Module::Install extensions.
-    $VERSION = '0.67';
+    $VERSION = '0.68';
 }
 
 # Whether or not inc::Module::Install is actually loaded, the
index c244cb5..3a490fb 100644 (file)
@@ -6,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.67';
+       $VERSION = '0.68';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
index 81fbcb6..49dfde6 100644 (file)
@@ -1,7 +1,7 @@
 #line 1
 package Module::Install::Base;
 
-$VERSION = '0.67';
+$VERSION = '0.68';
 
 # Suspend handler for "redefined" warnings
 BEGIN {
index 5d1eab8..ec66fdb 100644 (file)
@@ -11,7 +11,7 @@ use ExtUtils::MakeMaker ();
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.67';
+       $VERSION = '0.68';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
index e884477..e0dd6db 100644 (file)
@@ -6,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.67';
+       $VERSION = '0.68';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
index 574acc8..001d0c6 100644 (file)
@@ -6,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.67';
+       $VERSION = '0.68';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
index fbc5cb2..17bd8a7 100644 (file)
@@ -7,7 +7,7 @@ use ExtUtils::MakeMaker ();
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.67';
+       $VERSION = '0.68';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
index b886046..f77d68a 100644 (file)
@@ -6,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.67';
+       $VERSION = '0.68';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
index 612dc30..4f808c7 100644 (file)
@@ -6,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.67';
+       $VERSION = '0.68';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
index e1db381..078797c 100644 (file)
@@ -6,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.67';
+       $VERSION = '0.68';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
index f31f973..79bffdf 100644 (file)
@@ -3,7 +3,7 @@ package URI::Template;
 use strict;
 use warnings;
 
-our $VERSION = '0.09';
+our $VERSION = '0.10';
 
 use URI;
 use URI::Escape ();
@@ -114,7 +114,7 @@ inflate the result to a URI object.
 sub process_to_string {
     my $self = shift;
 
-    if( ref $_[ 0 ] ) {
+    if ( ref $_[ 0 ] ) {
         return $self->_process_by_position( @_ );
     }
     else {
@@ -130,7 +130,8 @@ sub _process_by_key {
 
     # fix undef vals
     for my $var ( @vars ) {
-        $params{ $var } = defined $params{ $var }
+        $params{ $var }
+            = defined $params{ $var }
             ? URI::Escape::uri_escape( $params{ $var }, $unsafe )
             : '';
     }
@@ -167,11 +168,11 @@ sub deparse {
     my $self = shift;
     my $uri  = shift;
 
-    if( !$self->{ deparse_re } ) {
-       my $templ = $self->as_string;
-       $self->{ vars_list } = [ $templ =~ /{(.+?)}/g ];
-       $templ =~ s/{.+?}/(.+?)/g;
-       $self->{ deparse_re } = qr/$templ/;
+    if ( !$self->{ deparse_re } ) {
+        my $templ = $self->as_string;
+        $self->{ vars_list } = [ $templ =~ /{(.+?)}/g ];
+        $templ =~ s/{.+?}/(.+?)/g;
+        $self->{ deparse_re } = qr/$templ/;
     }
 
     my @matches = $uri =~ $self->{ deparse_re };
index 4240367..28e8522 100644 (file)
@@ -7,15 +7,19 @@ use_ok( 'URI::Template' );
 
 # fatal - no template provided
 {
-   eval { URI::Template->new; };
-   ok( $@ );
+    eval { URI::Template->new; };
+    ok( $@ );
 }
 
 {
     my $text     = 'http://foo.com/{bar}/{baz}?q=%7B';
     my $template = URI::Template->new( $text );
     isa_ok( $template, 'URI::Template' );
-    is_deeply( [ sort $template->variables ], [ qw( bar baz ) ], 'variables()' );
+    is_deeply(
+        [ sort $template->variables ],
+        [ qw( bar baz ) ],
+        'variables()'
+    );
     is( "$template", $text, 'as_string()' );
 
     {
@@ -43,7 +47,7 @@ use_ok( 'URI::Template' );
         is( $result, 'http://foo.com/%7Bx%7D/', 'values are uri escaped' );
     }
     {
-        my $result = $template->process( );
+        my $result = $template->process();
         is( $result, 'http://foo.com//', 'no value sent' );
     }
     {
index a160818..c96a184 100644 (file)
@@ -9,7 +9,11 @@ use_ok( 'URI::Template' );
     my $text     = 'http://foo.com/{arg2}/{arg1}';
     my $template = URI::Template->new( $text );
     isa_ok( $template, 'URI::Template' );
-    is_deeply( [ $template->all_variables ], [ qw( arg2 arg1 ) ], 'all_variables()' );
+    is_deeply(
+        [ $template->all_variables ],
+        [ qw( arg2 arg1 ) ],
+        'all_variables()'
+    );
 
     {
         my $result = $template->process( [ qw( x y ) ] );
@@ -31,7 +35,7 @@ use_ok( 'URI::Template' );
 
     # test with no values
     {
-        my $result = $template->process_to_string( [ ] );
+        my $result = $template->process_to_string( [] );
         is( $result, 'http://foo.com//', 'process w/ no values' );
     }
 }
index 83f0e99..c95931e 100644 (file)
@@ -14,18 +14,19 @@ my @files = glob( 't/data/*.json' );
 
 for my $file ( @files ) {
     open( my $json, $file );
-    my $suite = JSON::jsonToObj( do { local $/; <$json> } );
+    my $data = do { local $/; <$json> };
     close( $json );
 
+    eval { JSON->VERSION( 2 ) };
+    my $suite = $@ ? JSON::jsonToObj( $data ) : JSON::from_json( $data );
     my %variables = %{ $suite->{ variables } };
 
     my $count = 0;
     for my $test ( @{ $suite->{ tests } } ) {
         my $template = URI::Template->new( $test->{ template } );
-        my $result = $template->process( %variables );
+        my $result   = $template->process( %variables );
         $count++;
         is( $result, $test->{ expected }, "${file}#${count}" );
     }
 }
 
-
index d6bd543..acb753e 100644 (file)
@@ -6,17 +6,23 @@ use Test::More tests => 8;
 use_ok( 'URI::Template' );
 
 {
-    my $template = URI::Template->new( 'http://{domain}.com/{dir}/{file}.html' );
+    my $template
+        = URI::Template->new( 'http://{domain}.com/{dir}/{file}.html' );
     isa_ok( $template, 'URI::Template' );
     my %result = $template->deparse( 'http://example.com/test/1.html' );
-    is_deeply( \%result, { domain => 'example', dir => 'test', file => '1' }, 'deparse()' );
+    is_deeply( \%result, { domain => 'example', dir => 'test', file => '1' },
+        'deparse()' );
 }
 
 {
     my $template = URI::Template->new( 'http://test.com/{x}/{y}/{x}/{y}' );
     isa_ok( $template, 'URI::Template' );
     my %result = $template->deparse( 'http://test.com/1/2/1/2' );
-    is_deeply( \%result, { x => 1, y => 2 }, 'deparse() with multiple values' );
+    is_deeply(
+        \%result,
+        { x => 1, y => 2 },
+        'deparse() with multiple values'
+    );
 }
 
 {
index 251640d..4586f7e 100644 (file)
@@ -4,6 +4,6 @@ use Test::More;
 
 eval "use Test::Pod 1.14";
 plan skip_all => 'Test::Pod 1.14 required' if $@;
-plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{ TEST_POD };
 
 all_pod_files_ok();
index ae59d4c..b4b4740 100644 (file)
@@ -4,6 +4,6 @@ use Test::More;
 
 eval "use Test::Pod::Coverage 1.04";
 plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
-plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{ TEST_POD };
 
 all_pod_coverage_ok();