Hello community,
here is the log from the commit of package perl-Router-Simple for
openSUSE:Factory checked in at 2013-10-06 14:56:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Router-Simple (Old)
and /work/SRC/openSUSE:Factory/.perl-Router-Simple.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Router-Simple"
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Router-Simple/perl-Router-Simple.changes
2013-06-21 13:37:13.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Router-Simple.new/perl-Router-Simple.changes
2013-10-06 14:56:09.000000000 +0200
@@ -1,0 +2,7 @@
+Fri Oct 4 09:13:25 UTC 2013 - [email protected]
+
+- updated to 0.15
+ - minil migrate. (tokuhirom)
+ - typo fix (David Steinbrunner)
+
+-------------------------------------------------------------------
Old:
----
Router-Simple-0.14.tar.gz
New:
----
Router-Simple-0.15.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Router-Simple.spec ++++++
--- /var/tmp/diff_new_pack.npf7a5/_old 2013-10-06 14:56:10.000000000 +0200
+++ /var/tmp/diff_new_pack.npf7a5/_new 2013-10-06 14:56:10.000000000 +0200
@@ -17,7 +17,7 @@
Name: perl-Router-Simple
-Version: 0.14
+Version: 0.15
Release: 0
%define cpan_name Router-Simple
Summary: Simple HTTP router
@@ -29,16 +29,13 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
+BuildRequires: perl(CPAN::Meta)
+BuildRequires: perl(CPAN::Meta::Prereqs)
BuildRequires: perl(Class::Accessor::Lite) >= 0.05
BuildRequires: perl(Module::Build) >= 0.38
BuildRequires: perl(Test::More) >= 0.98
BuildRequires: perl(parent)
-#BuildRequires: perl(Router::Simple)
-#BuildRequires: perl(Router::Simple::Declare)
-#BuildRequires: perl(Router::Simple::Route)
-#BuildRequires: perl(Router::Simple::SubMapper)
Requires: perl(Class::Accessor::Lite) >= 0.05
-Requires: perl(Test::More) >= 0.88
Requires: perl(parent)
%{perl_requires}
@@ -66,6 +63,6 @@
%files -f %{name}.files
%defattr(-,root,root,755)
-%doc Changes LICENSE README xt
+%doc Changes cpanfile LICENSE minil.toml README.md
%changelog
++++++ Router-Simple-0.14.tar.gz -> Router-Simple-0.15.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/Build.PL
new/Router-Simple-0.15/Build.PL
--- old/Router-Simple-0.14/Build.PL 2012-12-06 02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/Build.PL 2013-09-29 04:29:29.000000000 +0200
@@ -1,28 +1,70 @@
+# =========================================================================
+# THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA.
+# DO NOT EDIT DIRECTLY.
+# =========================================================================
+
+use 5.008_001;
+
use strict;
-use warnings FATAL => 'all';
+use warnings;
+use utf8;
+
use Module::Build;
+use File::Basename;
+use File::Spec;
+use CPAN::Meta;
+use CPAN::Meta::Prereqs;
-my $build = Module::Build->new(
+my %args = (
license => 'perl',
- author => 'Tokuhiro Matsuno',
- recursive_test_files => 1,
dynamic_config => 0,
- build_requires => { 'Test::More' => '0.98' },
- configure_requires => { 'Module::Build' => '0.38' },
- requires => {
- 'perl' => '5.00800',
- 'Test::More' => '0.88',
- 'List::Util' => '0',
- 'parent' => '0',
- 'Class::Accessor::Lite' => '0.05'
+
+ configure_requires => {
+ 'Module::Build' => 0.38,
},
- no_index => { 'directory' => [ 'inc', 't', 'xt' ] },
- name => 'Router-Simple',
- module_name => 'Router::Simple',
- test_files => ( -d '.git' || $ENV{RELEASE_TESTING} ) ? 't/ xt/' : 't/',
+ name => 'Router-Simple',
+ module_name => 'Router::Simple',
+ allow_pureperl => 0,
+
+ script_files => [glob('script/*'), glob('bin/*')],
+ c_source => [qw()],
+ PL_files => {},
+
+ test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt')
? 't/ xt/' : 't/',
+ recursive_test_files => 1,
+);
+if (-d 'share') {
+ $args{share_dir} = 'share';
+}
+
+my $builder = Module::Build->subclass(
+ class => 'MyBuilder',
+ code => q{
+ sub ACTION_distmeta {
+ die "Do not run distmeta. Install Minilla and `minil install`
instead.\n";
+ }
+ sub ACTION_installdeps {
+ die "Do not run installdeps. Run `cpanm --installdeps .`
instead.\n";
+ }
+ }
+)->new(%args);
+$builder->create_build_script();
- create_readme => 1,
- create_license => 1,
+my $mbmeta = CPAN::Meta->load_file('MYMETA.json');
+my $meta = CPAN::Meta->load_file('META.json');
+my $prereqs_hash = CPAN::Meta::Prereqs->new(
+ $meta->prereqs
+)->with_merged_prereqs(
+ CPAN::Meta::Prereqs->new($mbmeta->prereqs)
+)->as_string_hash;
+my $mymeta = CPAN::Meta->new(
+ {
+ %{$meta->as_struct},
+ prereqs => $prereqs_hash
+ }
);
-$build->create_build_script();
+print "Merging cpanfile prereqs to MYMETA.yml\n";
+$mymeta->save('MYMETA.yml', { version => 1.4 });
+print "Merging cpanfile prereqs to MYMETA.json\n";
+$mymeta->save('MYMETA.json', { version => 2 });
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/Changes
new/Router-Simple-0.15/Changes
--- old/Router-Simple-0.14/Changes 2012-12-06 02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/Changes 2013-09-29 04:29:29.000000000 +0200
@@ -1,5 +1,12 @@
Revision history for Perl extension Router::Simple
+0.15 2013-09-29T02:29:15Z
+
+ - minil migrate.
+ (tokuhirom)
+ - typo fix
+ (David Steinbrunner)
+
0.14
- added 'routes' acecessor for Router::Simple class.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/MANIFEST
new/Router-Simple-0.15/MANIFEST
--- old/Router-Simple-0.14/MANIFEST 2012-12-06 02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/MANIFEST 2013-09-29 04:29:29.000000000 +0200
@@ -1,15 +1,17 @@
Build.PL
Changes
+LICENSE
+META.json
+README.md
+author/benchmark.pl
+author/prof.pl
+cpanfile
lib/Router/Simple.pm
lib/Router/Simple/Cookbook.pod
lib/Router/Simple/Declare.pm
lib/Router/Simple/Route.pm
lib/Router/Simple/SubMapper.pm
-LICENSE
-MANIFEST This list of files
-META.json
-META.yml
-README
+minil.toml
t/00_compile.t
t/01_simple.t
t/02_declare.t
@@ -21,10 +23,7 @@
t/11_ext_regexp.t
t/12_paren_warnings.t
t/13_method_not_allowed.t
-xt/01_podspell.t
xt/02_perlcritic.t
-xt/03_pod.t
-xt/04_minimum_version.t
xt/04_synopsis.t
-xt/05_cpan_meta.t
-xt/06_meta_author.t
+META.yml
+MANIFEST
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/META.json
new/Router-Simple-0.15/META.json
--- old/Router-Simple-0.14/META.json 2012-12-06 02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/META.json 2013-09-29 04:29:29.000000000 +0200
@@ -1,10 +1,10 @@
{
"abstract" : "simple HTTP router",
"author" : [
- "Tokuhiro Matsuno E<lt>tokuhirom AAJKLFJEF@ GMAIL COME<gt>"
+ "Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>"
],
"dynamic_config" : 0,
- "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter
version 2.120921",
+ "generated_by" : "Minilla/v0.6.7",
"license" : [
"perl_5"
],
@@ -15,55 +15,80 @@
"name" : "Router-Simple",
"no_index" : {
"directory" : [
- "inc",
"t",
- "xt"
+ "xt",
+ "inc",
+ "share",
+ "eg",
+ "examples",
+ "author"
]
},
"prereqs" : {
- "build" : {
+ "configure" : {
"requires" : {
- "Test::More" : "0.98"
+ "CPAN::Meta" : "0",
+ "CPAN::Meta::Prereqs" : "0",
+ "Module::Build" : "0.38"
}
},
- "configure" : {
+ "develop" : {
"requires" : {
- "Module::Build" : "0.38"
+ "Test::CPAN::Meta" : "0",
+ "Test::MinimumVersion" : "0.10108",
+ "Test::Pod" : "1.41",
+ "Test::Spellunker" : "v0.2.7"
}
},
"runtime" : {
"requires" : {
"Class::Accessor::Lite" : "0.05",
"List::Util" : "0",
- "Test::More" : "0.88",
+ "Scalar::Util" : "0",
"parent" : "0",
- "perl" : "5.00800"
+ "perl" : "5.008_001"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "Test::More" : "0.98"
}
}
},
"provides" : {
"Router::Simple" : {
"file" : "lib/Router/Simple.pm",
- "version" : "0.14"
+ "version" : "0.15"
},
"Router::Simple::Declare" : {
- "file" : "lib/Router/Simple/Declare.pm",
- "version" : 0
+ "file" : "lib/Router/Simple/Declare.pm"
},
"Router::Simple::Route" : {
- "file" : "lib/Router/Simple/Route.pm",
- "version" : 0
+ "file" : "lib/Router/Simple/Route.pm"
},
"Router::Simple::SubMapper" : {
- "file" : "lib/Router/Simple/SubMapper.pm",
- "version" : 0
+ "file" : "lib/Router/Simple/SubMapper.pm"
}
},
"release_status" : "stable",
"resources" : {
- "license" : [
- "http://dev.perl.org/licenses/"
- ]
+ "bugtracker" : {
+ "web" : "https://github.com/tokuhirom/p5-router-simple/issues"
+ },
+ "homepage" : "https://github.com/tokuhirom/p5-router-simple",
+ "repository" : {
+ "url" : "git://github.com/tokuhirom/p5-router-simple.git",
+ "web" : "https://github.com/tokuhirom/p5-router-simple"
+ }
},
- "version" : "0.14"
+ "version" : "0.15",
+ "x_contributors" : [
+ "Shawn M Moore <[email protected]>",
+ "Tatsuhiko Miyagawa <[email protected]>",
+ "nipotan <[email protected]>",
+ "Naoki Tomita <[email protected]>",
+ "Philippe Bruhat (BooK) <[email protected]>",
+ "David Steinbrunner <[email protected]>",
+ "tokuhirom <[email protected]>"
+ ]
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/META.yml
new/Router-Simple-0.15/META.yml
--- old/Router-Simple-0.14/META.yml 2012-12-06 02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/META.yml 2013-09-29 04:29:29.000000000 +0200
@@ -1,13 +1,15 @@
---
abstract: 'simple HTTP router'
author:
- - 'Tokuhiro Matsuno E<lt>tokuhirom AAJKLFJEF@ GMAIL COME<gt>'
+ - 'Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>'
build_requires:
Test::More: 0.98
configure_requires:
+ CPAN::Meta: 0
+ CPAN::Meta::Prereqs: 0
Module::Build: 0.38
dynamic_config: 0
-generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version
2.120921'
+generated_by: 'Minilla/v0.6.7, CPAN::Meta::Converter version 2.132510'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -15,28 +17,39 @@
name: Router-Simple
no_index:
directory:
- - inc
- t
- xt
+ - inc
+ - share
+ - eg
+ - examples
+ - author
provides:
Router::Simple:
file: lib/Router/Simple.pm
- version: 0.14
+ version: 0.15
Router::Simple::Declare:
file: lib/Router/Simple/Declare.pm
- version: 0
Router::Simple::Route:
file: lib/Router/Simple/Route.pm
- version: 0
Router::Simple::SubMapper:
file: lib/Router/Simple/SubMapper.pm
- version: 0
requires:
Class::Accessor::Lite: 0.05
List::Util: 0
- Test::More: 0.88
+ Scalar::Util: 0
parent: 0
- perl: 5.00800
+ perl: 5.008_001
resources:
- license: http://dev.perl.org/licenses/
-version: 0.14
+ bugtracker: https://github.com/tokuhirom/p5-router-simple/issues
+ homepage: https://github.com/tokuhirom/p5-router-simple
+ repository: git://github.com/tokuhirom/p5-router-simple.git
+version: 0.15
+x_contributors:
+ - 'Shawn M Moore <[email protected]>'
+ - 'Tatsuhiko Miyagawa <[email protected]>'
+ - 'nipotan <[email protected]>'
+ - 'Naoki Tomita <[email protected]>'
+ - 'Philippe Bruhat (BooK) <[email protected]>'
+ - 'David Steinbrunner <[email protected]>'
+ - 'tokuhirom <[email protected]>'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/README
new/Router-Simple-0.15/README
--- old/Router-Simple-0.14/README 2012-12-06 02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/README 1970-01-01 01:00:00.000000000 +0100
@@ -1,198 +0,0 @@
-NAME
- Router::Simple - simple HTTP router
-
-SYNOPSIS
- use Router::Simple;
-
- my $router = Router::Simple->new();
- $router->connect('/', {controller => 'Root', action => 'show'});
- $router->connect('/blog/{year}/{month}', {controller => 'Blog', action
=> 'monthly'});
-
- my $app = sub {
- my $env = shift;
- if (my $p = $router->match($env)) {
- # $p = { controller => 'Blog', action => 'monthly', ... }
- } else {
- [404, [], ['not found']];
- }
- };
-
-DESCRIPTION
- Router::Simple is a simple router class.
-
- Its main purpose is to serve as a dispatcher for web applications.
-
- Router::Simple can match against PSGI $env directly, which means it's
- easy to use with PSGI supporting web frameworks.
-
-HOW TO WRITE A ROUTING RULE
- plain string
- $router->connect( '/foo', { controller => 'Root', action => 'foo' } );
-
- :name notation
- $router->connect( '/wiki/:page', { controller => 'WikiPage', action =>
'show' } );
- ...
- $router->match('/wiki/john');
- # => {controller => 'WikiPage', action => 'show', page => 'john' }
-
- ':name' notation matches qr{([^/]+)}.
-
- '*' notation
- $router->connect( '/download/*.*', { controller => 'Download', action
=> 'file' } );
- ...
- $router->match('/download/path/to/file.xml');
- # => {controller => 'Download', action => 'file', splat =>
['path/to/file', 'xml'] }
-
- '*' notation matches qr{(.+)}. You will get the captured argument as an
- array ref for the special key "splat".
-
- '{year}' notation
- $router->connect( '/blog/{year}', { controller => 'Blog', action =>
'yearly' } );
- ...
- $router->match('/blog/2010');
- # => {controller => 'Blog', action => 'yearly', year => 2010 }
-
- '{year}' notation matches qr{([^/]+)}, and it will be captured.
-
- '{year:[0-9]+}' notation
- $router->connect( '/blog/{year:[0-9]+}/{month:[0-9]{2}}', { controller
=> 'Blog', action => 'monthly' } );
- ...
- $router->match('/blog/2010/04');
- # => {controller => 'Blog', action => 'monthly', year => 2010, month
=> '04' }
-
- You can specify regular expressions in named captures.
-
- regexp
- $router->connect( qr{/blog/(\d+)/([0-9]{2})', { controller => 'Blog',
action => 'monthly' } );
- ...
- $router->match('/blog/2010/04');
- # => {controller => 'Blog', action => 'monthly', splat => [2010, '04']
}
-
- You can use Perl5's powerful regexp directly, and the captured values
- are stored in the special key "splat".
-
-METHODS
- my $router = Router::Simple->new();
- Creates a new instance of Router::Simple.
-
- $router->method_not_allowed() : Boolean
- This method returns last "$router->match()" call is rejected by HTTP
- method or not.
-
- $router->connect([$name, ] $pattern, \%destination[, \%options])
- Adds a new rule to $router.
-
- $router->connect( '/', { controller => 'Root', action => 'index' }
);
- $router->connect( 'show_entry', '/blog/:id',
- { controller => 'Blog', action => 'show' } );
- $router->connect( '/blog/:id', { controller => 'Blog', action =>
'show' } );
- $router->connect( '/comment', { controller => 'Comment', action =>
'new_comment' }, {method => 'POST'} );
-
- "\%destination" will be used by *match* method.
-
- You can specify some optional things to "\%options". The current
- version supports 'method', 'host', and 'on_match'.
-
- method
- 'method' is an ArrayRef[String] or String that matches
- REQUEST_METHOD in $req.
-
- host
- 'host' is a String or Regexp that matches HTTP_HOST in $req.
-
- on_match
- $r->connect(
- '/{controller}/{action}/{id}',
- {},
- {
- on_match => sub {
- my($env, $match) = @_;
- $match->{referer} = $env->{HTTP_REFERER};
- return 1;
- }
- }
- );
-
- A function that evaluates the request. Its signature must be
- "($environ, $match) => bool". It should return true if the match
- is successful or false otherwise. The first arg is $env which is
- either a PSGI environment or a request path, depending on what
- you pass to "match" method; the second is the routing variables
- that would be returned if the match succeeds.
-
- The function can modify $env (in case it's a reference) and
- $match in place to affect which variables are returned. This
- allows a wide range of transformations.
-
- $router->submapper($path, [\%dest, [\%opt]])
- $router->submapper('/entry/', {controller => 'Entry'})
-
- This method is shorthand for creating new instance of
- Router::Simple::Submapper.
-
- The arguments will be passed to
- "Router::Simple::SubMapper->new(%args)".
-
- $match = $router->match($env|$path)
- Matches a URL against one of the contained routes.
-
- The parameter is either a PSGI $env or a plain string that
- represents a path.
-
- This method returns a plain hashref that would look like:
-
- {
- controller => 'Blog',
- action => 'daily',
- year => 2010, month => '03', day => '04',
- }
-
- It returns undef if no valid match is found.
-
- my ($match, $route) = $router->routematch($env|$path);
- Match a URL against against one of the routes contained.
-
- Will return undef if no valid match is found, otherwise a result
- hashref and a Router::Simple::Route object is returned.
-
- $router->as_string()
- Dumps $router as string.
-
- Example output:
-
- home GET /
- blog_monthly GET /blog/{year}/{month}
- GET /blog/{year:\d{1,4}}/{month:\d{2}}/{day:\d\d}
- POST /comment
- GET /
-
-AUTHOR
- Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>
-
-THANKS TO
- Tatsuhiko Miyagawa
-
- Shawn M Moore
-
- routes.py <http://routes.groovie.org/>.
-
-SEE ALSO
- Router::Simple is inspired by routes.py <http://routes.groovie.org/>.
-
- Path::Dispatcher is similar, but so complex.
-
- Path::Router is heavy. It depends on Moose.
-
- HTTP::Router has many deps. It is not well documented.
-
- HTTPx::Dispatcher is my old one. It does not provide an OOish interface.
-
-THANKS TO
- DeNA
-
-LICENSE
- Copyright (C) Tokuhiro Matsuno
-
- This library is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself.
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/README.md
new/Router-Simple-0.15/README.md
--- old/Router-Simple-0.14/README.md 1970-01-01 01:00:00.000000000 +0100
+++ new/Router-Simple-0.15/README.md 2013-09-29 04:29:29.000000000 +0200
@@ -0,0 +1,218 @@
+# NAME
+
+Router::Simple - simple HTTP router
+
+# SYNOPSIS
+
+ use Router::Simple;
+
+ my $router = Router::Simple->new();
+ $router->connect('/', {controller => 'Root', action => 'show'});
+ $router->connect('/blog/{year}/{month}', {controller => 'Blog', action =>
'monthly'});
+
+ my $app = sub {
+ my $env = shift;
+ if (my $p = $router->match($env)) {
+ # $p = { controller => 'Blog', action => 'monthly', ... }
+ } else {
+ [404, [], ['not found']];
+ }
+ };
+
+# DESCRIPTION
+
+Router::Simple is a simple router class.
+
+Its main purpose is to serve as a dispatcher for web applications.
+
+Router::Simple can match against PSGI `$env` directly, which means
+it's easy to use with PSGI supporting web frameworks.
+
+# HOW TO WRITE A ROUTING RULE
+
+## plain string
+
+ $router->connect( '/foo', { controller => 'Root', action => 'foo' } );
+
+## :name notation
+
+ $router->connect( '/wiki/:page', { controller => 'WikiPage', action =>
'show' } );
+ ...
+ $router->match('/wiki/john');
+ # => {controller => 'WikiPage', action => 'show', page => 'john' }
+
+':name' notation matches `qr{([^/]+)}`.
+
+## '\*' notation
+
+ $router->connect( '/download/*.*', { controller => 'Download', action =>
'file' } );
+ ...
+ $router->match('/download/path/to/file.xml');
+ # => {controller => 'Download', action => 'file', splat =>
['path/to/file', 'xml'] }
+
+'\*' notation matches `qr{(.+)}`. You will get the captured argument as
+an array ref for the special key `splat`.
+
+## '{year}' notation
+
+ $router->connect( '/blog/{year}', { controller => 'Blog', action =>
'yearly' } );
+ ...
+ $router->match('/blog/2010');
+ # => {controller => 'Blog', action => 'yearly', year => 2010 }
+
+'{year}' notation matches `qr{([^/]+)}`, and it will be captured.
+
+## '{year:\[0-9\]+}' notation
+
+ $router->connect( '/blog/{year:[0-9]+}/{month:[0-9]{2}}', { controller =>
'Blog', action => 'monthly' } );
+ ...
+ $router->match('/blog/2010/04');
+ # => {controller => 'Blog', action => 'monthly', year => 2010, month =>
'04' }
+
+You can specify regular expressions in named captures.
+
+## regexp
+
+ $router->connect( qr{/blog/(\d+)/([0-9]{2})', { controller => 'Blog',
action => 'monthly' } );
+ ...
+ $router->match('/blog/2010/04');
+ # => {controller => 'Blog', action => 'monthly', splat => [2010, '04'] }
+
+You can use Perl5's powerful regexp directly, and the captured values
+are stored in the special key `splat`.
+
+# METHODS
+
+- my $router = Router::Simple->new();
+
+ Creates a new instance of Router::Simple.
+
+- $router->method\_not\_allowed() : Boolean
+
+ This method returns last `$router->match()` call is rejected by HTTP
method or not.
+
+- $router->connect(\[$name, \] $pattern, \\%destination\[, \\%options\])
+
+ Adds a new rule to $router.
+
+ $router->connect( '/', { controller => 'Root', action => 'index' } );
+ $router->connect( 'show_entry', '/blog/:id',
+ { controller => 'Blog', action => 'show' } );
+ $router->connect( '/blog/:id', { controller => 'Blog', action =>
'show' } );
+ $router->connect( '/comment', { controller => 'Comment', action =>
'new_comment' }, {method => 'POST'} );
+
+ `\%destination` will be used by _match_ method.
+
+ You can specify some optional things to `\%options`. The current
+ version supports 'method', 'host', and 'on\_match'.
+
+ - method
+
+ 'method' is an ArrayRef\[String\] or String that matches
__REQUEST\_METHOD__ in $req.
+
+ - host
+
+ 'host' is a String or Regexp that matches __HTTP\_HOST__ in $req.
+
+ - on\_match
+
+ $r->connect(
+ '/{controller}/{action}/{id}',
+ {},
+ {
+ on_match => sub {
+ my($env, $match) = @_;
+ $match->{referer} = $env->{HTTP_REFERER};
+ return 1;
+ }
+ }
+ );
+
+ A function that evaluates the request. Its signature must be
`($environ, $match) => bool`. It should return true if the match is
+ successful or false otherwise. The first argument is `$env` which is
+ either a PSGI environment or a request path, depending on what you
+ pass to `match` method; the second is the routing variables that
+ would be returned if the match succeeds.
+
+ The function can modify `$env` (in case it's a reference) and
+ `$match` in place to affect which variables are returned. This allows
+ a wide range of transformations.
+
+- `$router->submapper($path, [\%dest, [\%opt]])`
+
+ $router->submapper('/entry/', {controller => 'Entry'})
+
+ This method is shorthand for creating new instance of
[Router::Simple::Submapper](http://search.cpan.org/perldoc?Router::Simple::Submapper).
+
+ The arguments will be passed to `Router::Simple::SubMapper->new(%args)`.
+
+- `$match = $router->match($env|$path)`
+
+ Matches a URL against one of the contained routes.
+
+ The parameter is either a [PSGI](http://search.cpan.org/perldoc?PSGI) $env
or a plain string that
+ represents a path.
+
+ This method returns a plain hashref that would look like:
+
+ {
+ controller => 'Blog',
+ action => 'daily',
+ year => 2010, month => '03', day => '04',
+ }
+
+ It returns undef if no valid match is found.
+
+- `my ($match, $route) = $router->routematch($env|$path);`
+
+ Match a URL against one of the routes contained.
+
+ Will return undef if no valid match is found, otherwise a
+ result hashref and a
[Router::Simple::Route](http://search.cpan.org/perldoc?Router::Simple::Route)
object is returned.
+
+- `$router->as_string()`
+
+ Dumps $router as string.
+
+ Example output:
+
+ home GET /
+ blog_monthly GET /blog/{year}/{month}
+ GET /blog/{year:\d{1,4}}/{month:\d{2}}/{day:\d\d}
+ POST /comment
+ GET /
+
+# AUTHOR
+
+Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>
+
+# THANKS TO
+
+Tatsuhiko Miyagawa
+
+Shawn M Moore
+
+[routes.py](http://routes.groovie.org/).
+
+# SEE ALSO
+
+Router::Simple is inspired by [routes.py](http://routes.groovie.org/).
+
+[Path::Dispatcher](http://search.cpan.org/perldoc?Path::Dispatcher) is
similar, but so complex.
+
+[Path::Router](http://search.cpan.org/perldoc?Path::Router) is heavy. It
depends on [Moose](http://search.cpan.org/perldoc?Moose).
+
+[HTTP::Router](http://search.cpan.org/perldoc?HTTP::Router) has many
dependencies. It is not well documented.
+
+[HTTPx::Dispatcher](http://search.cpan.org/perldoc?HTTPx::Dispatcher) is my
old one. It does not provide an OO-ish interface.
+
+# THANKS TO
+
+DeNA
+
+# LICENSE
+
+Copyright (C) Tokuhiro Matsuno
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/author/benchmark.pl
new/Router-Simple-0.15/author/benchmark.pl
--- old/Router-Simple-0.14/author/benchmark.pl 1970-01-01 01:00:00.000000000
+0100
+++ new/Router-Simple-0.15/author/benchmark.pl 2013-09-29 04:29:29.000000000
+0200
@@ -0,0 +1,85 @@
+use strict;
+use warnings;
+use Benchmark qw/:all/;
+use Data::Dumper;
+use Plack::Request;
+
+my ($hr, $rs);
+{
+ package HR;
+ use HTTP::Router::Declare;
+ $hr = router {
+ # path and params
+ match '/' => to { controller => 'Root', action => 'index' };
+
+ # path, conditions, and params
+ match '/home', { method => 'GET' }
+ => to { controller => 'Home', action => 'show' };
+ match '/date/{year}', { year => qr/^\d{4}$/ }
+ => to { controller => 'Date', action => 'by_year' };
+
+ # path, params, and nesting
+ match '/account' => to { controller => 'Account' } => then {
+ match '/logout' => to { action => 'logout' };
+ match '/login' => to { action => 'login' };
+ };
+ };
+}
+{
+ package RS;
+ use Router::Simple::Declare;
+ $rs = router {
+ # path and params
+ connect '/' => { controller => 'Root', action => 'index' };
+
+ # path, conditions, and params
+ connect '/home', { controller => 'Home', action => 'show' }, { method
=> 'GET' };
+ connect '/date/{year:\d{4}}',
+ { controller => 'Date', action => 'by_year' };
+
+ # path, params, and nesting
+ submapper('/account', {controller => 'Account'})
+ ->connect('/logout', {action => 'logout'})
+ ->connect('/login', {action => 'login'});
+ };
+}
+{
+ package HD;
+ use HTTPx::Dispatcher;
+
+ # path and params
+ connect '/' => { controller => 'Root', action => 'index' };
+
+ # path, conditions, and params
+ connect '/home', { controller => 'Home', action => 'show' }, { method =>
'GET' };
+ connect '/date/{year:\d{4}}',
+ { controller => 'Date', action => 'by_year' };
+
+ # path, params, and nesting
+ connect '/account/logout' => {controller => 'Account', action => 'logout'};
+ connect '/account/login' => {controller => 'Account', action => 'login'};
+}
+
+#arn Dumper($hr->match('/account/login'));
+#arn Dumper($rs->match('/account/login'));
+
+my $req = Plack::Request->new({ PATH_INFO => '/account/login' });
+my $req2 = Plack::Request->new({ PATH_INFO => '/date/2000' });
+
+cmpthese(
+ -1, {
+ 'HTTP-Router' => sub {
+ $hr->match('/account/login');
+ $hr->match('/date/2000');
+ },
+ 'Router-Simple' => sub {
+ $rs->match('/account/login');
+ $rs->match('/date/2000');
+ },
+ 'HTTPx-Dispatcher' => sub {
+ HD->match($req);
+ HD->match($req2);
+ },
+ }
+);
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/author/prof.pl
new/Router-Simple-0.15/author/prof.pl
--- old/Router-Simple-0.14/author/prof.pl 1970-01-01 01:00:00.000000000
+0100
+++ new/Router-Simple-0.15/author/prof.pl 2013-09-29 04:29:29.000000000
+0200
@@ -0,0 +1,45 @@
+use strict;
+use warnings;
+use Router::Simple::Declare;
+
+my $path = shift @ARGV || '/account/login';
+
+my $rs = router {
+ # path and params
+ connect '/' => { controller => 'Root', action => 'index' };
+
+ # path, conditions, and params
+ connect '/home', { controller => 'Home', action => 'show' }, { method =>
'GET' };
+ connect '/date/{year:\d{4}}',
+ { controller => 'Date', action => 'by_year' };
+
+ # path, params, and nesting
+ submapper('/account', { controller => 'Account' })
+ ->connect('/login', {action => 'login'})
+ ->connect('/logout', {action => 'logout'});
+
+ # path nesting
+ submapper('/account')
+ ->connect('/signup', {controller => 'User', action => 'register'})
+ ->connect('/logout', {controller => 'Account', action => 'logout'});
+
+ # conditions nesting
+ submapper('/', {}, { method => 'GET' })
+ ->connect('/search' => {controller => 'Items', action => 'search'})
+ ->connect('/tags' => {controller => 'Tags', action => 'index'});
+
+ # params nesting
+ submapper('/', { 'controller' => 'Account' })
+ ->connect('/login', {action => 'login'})
+ ->connect('/logout', {action => 'logout'})
+ ->connect('/signup', {action => 'signup'});
+
+ # match only
+ connect '/{controller}/{action}/{id}.{format}';
+ connect '/{controller}/{action}/{id}';
+};
+
+for my $i (0..10000) {
+ $rs->match($path);
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/cpanfile
new/Router-Simple-0.15/cpanfile
--- old/Router-Simple-0.14/cpanfile 1970-01-01 01:00:00.000000000 +0100
+++ new/Router-Simple-0.15/cpanfile 2013-09-29 04:29:29.000000000 +0200
@@ -0,0 +1,10 @@
+requires 'perl', '5.008_001';
+
+requires 'Class::Accessor::Lite', '0.05';
+requires 'List::Util';
+requires 'parent';
+requires 'Scalar::Util';
+
+on test => sub {
+ requires 'Test::More', '0.98';
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/lib/Router/Simple/Declare.pm
new/Router-Simple-0.15/lib/Router/Simple/Declare.pm
--- old/Router-Simple-0.14/lib/Router/Simple/Declare.pm 2012-12-06
02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/lib/Router/Simple/Declare.pm 2013-09-29
04:29:29.000000000 +0200
@@ -28,6 +28,8 @@
1;
__END__
+=for stopwords submapper
+
=head1 NAME
Router::Simple::Declare - declarative interface for Router::Simple
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/lib/Router/Simple/Route.pm
new/Router-Simple-0.15/lib/Router/Simple/Route.pm
--- old/Router-Simple-0.14/lib/Router/Simple/Route.pm 2012-12-06
02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/lib/Router/Simple/Route.pm 2013-09-29
04:29:29.000000000 +0200
@@ -125,6 +125,8 @@
1;
__END__
+=for stopwords dest
+
=head1 NAME
Router::Simple::Route - route object
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/lib/Router/Simple/SubMapper.pm
new/Router-Simple-0.15/lib/Router/Simple/SubMapper.pm
--- old/Router-Simple-0.14/lib/Router/Simple/SubMapper.pm 2012-12-06
02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/lib/Router/Simple/SubMapper.pm 2013-09-29
04:29:29.000000000 +0200
@@ -28,6 +28,8 @@
1;
__END__
+=for stopwords submapper
+
=head1 NAME
Router::Simple::SubMapper - submapper
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/lib/Router/Simple.pm
new/Router-Simple-0.15/lib/Router/Simple.pm
--- old/Router-Simple-0.14/lib/Router/Simple.pm 2012-12-06 02:24:33.000000000
+0100
+++ new/Router-Simple-0.15/lib/Router/Simple.pm 2013-09-29 04:29:29.000000000
+0200
@@ -2,7 +2,7 @@
use strict;
use warnings;
use 5.00800;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
use Router::Simple::SubMapper;
use Router::Simple::Route;
use List::Util qw/max/;
@@ -90,6 +90,8 @@
1;
__END__
+=for stopwords DeNA
+
=encoding utf8
=head1 NAME
@@ -135,7 +137,7 @@
$router->match('/wiki/john');
# => {controller => 'WikiPage', action => 'show', page => 'john' }
-':name' notation matches qr{([^/]+)}.
+':name' notation matches C<qr{([^/]+)}>.
=head2 '*' notation
@@ -144,7 +146,7 @@
$router->match('/download/path/to/file.xml');
# => {controller => 'Download', action => 'file', splat =>
['path/to/file', 'xml'] }
-'*' notation matches qr{(.+)}. You will get the captured argument as
+'*' notation matches C<qr{(.+)}>. You will get the captured argument as
an array ref for the special key C<splat>.
=head2 '{year}' notation
@@ -154,7 +156,7 @@
$router->match('/blog/2010');
# => {controller => 'Blog', action => 'yearly', year => 2010 }
-'{year}' notation matches qr{([^/]+)}, and it will be captured.
+'{year}' notation matches C<qr{([^/]+)}>, and it will be captured.
=head2 '{year:[0-9]+}' notation
@@ -228,7 +230,7 @@
A function that evaluates the request. Its signature must be C<<
($environ, $match) => bool >>. It should return true if the match is
-successful or false otherwise. The first arg is C<$env> which is
+successful or false otherwise. The first argument is C<$env> which is
either a PSGI environment or a request path, depending on what you
pass to C<match> method; the second is the routing variables that
would be returned if the match succeeds.
@@ -239,7 +241,7 @@
=back
-=item $router->submapper($path, [\%dest, [\%opt]])
+=item C<< $router->submapper($path, [\%dest, [\%opt]]) >>
$router->submapper('/entry/', {controller => 'Entry'})
@@ -247,7 +249,7 @@
The arguments will be passed to C<< Router::Simple::SubMapper->new(%args) >>.
-=item $match = $router->match($env|$path)
+=item C<< $match = $router->match($env|$path) >>
Matches a URL against one of the contained routes.
@@ -264,14 +266,14 @@
It returns undef if no valid match is found.
-=item my ($match, $route) = $router->routematch($env|$path);
+=item C<< my ($match, $route) = $router->routematch($env|$path); >>
-Match a URL against against one of the routes contained.
+Match a URL against one of the routes contained.
Will return undef if no valid match is found, otherwise a
result hashref and a L<Router::Simple::Route> object is returned.
-=item $router->as_string()
+=item C<< $router->as_string() >>
Dumps $router as string.
@@ -305,9 +307,9 @@
L<Path::Router> is heavy. It depends on L<Moose>.
-L<HTTP::Router> has many deps. It is not well documented.
+L<HTTP::Router> has many dependencies. It is not well documented.
-L<HTTPx::Dispatcher> is my old one. It does not provide an OOish interface.
+L<HTTPx::Dispatcher> is my old one. It does not provide an OO-ish interface.
=head1 THANKS TO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/minil.toml
new/Router-Simple-0.15/minil.toml
--- old/Router-Simple-0.14/minil.toml 1970-01-01 01:00:00.000000000 +0100
+++ new/Router-Simple-0.15/minil.toml 2013-09-29 04:29:29.000000000 +0200
@@ -0,0 +1 @@
+name="Router-Simple"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/xt/01_podspell.t
new/Router-Simple-0.15/xt/01_podspell.t
--- old/Router-Simple-0.14/xt/01_podspell.t 2012-12-06 02:24:33.000000000
+0100
+++ new/Router-Simple-0.15/xt/01_podspell.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,49 +0,0 @@
-use Test::More;
-eval q{ use Test::Spelling };
-plan skip_all => "Test::Spelling is not installed." if $@;
-add_stopwords(map { split /[\s\:\-]/ } <DATA>);
-$ENV{LANG} = 'C';
-all_pod_files_spelling_ok('lib');
-__DATA__
-Tokuhiro Matsuno
-Router::Simple
-tokuhirom
-AAJKLFJEF
-GMAIL
-COM
-Tatsuhiko
-Miyagawa
-Kazuhiro
-Osawa
-lestrrat
-typester
-cho45
-charsbar
-coji
-clouder
-gunyarakun
-hio_d
-hirose31
-ikebe
-kan
-kazeburo
-daisuke
-maki
-TODO
-URI
-HTTP
-URL
-uri
-EXPORTABLE
-DeNA
-OOish
-py
-RESTful
-deps
-Blog
-submapper
-PSGI
-arg
-dest
-ish
-MVC
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/xt/02_perlcritic.t
new/Router-Simple-0.15/xt/02_perlcritic.t
--- old/Router-Simple-0.14/xt/02_perlcritic.t 2012-12-06 02:24:33.000000000
+0100
+++ new/Router-Simple-0.15/xt/02_perlcritic.t 2013-09-29 04:29:29.000000000
+0200
@@ -1,13 +1,49 @@
use strict;
+use warnings;
use Test::More;
-eval q{
- use Test::Perl::Critic 1.02 -exclude => [
- 'Subroutines::ProhibitSubroutinePrototypes',
- 'Subroutines::ProhibitExplicitReturnUndef',
- 'TestingAndDebugging::ProhibitNoStrict',
- 'ControlStructures::ProhibitMutatingListFunctions',
- 'InputOutput::ProhibitInteractiveTest',
- ]
+
+eval {
+ require Perl::Critic;
+ Perl::Critic->VERSION(1.105);
+
+ require Test::Perl::Critic;
+ Test::Perl::Critic->VERSION(1.02);
+ Test::Perl::Critic->import(
+ -profile => \(join q{}, <DATA>)
+ );
};
-plan skip_all => "Test::Perl::Critic 1.02+ is not installed." if $@;
-all_critic_ok('lib');
+note $@ if $@;
+plan skip_all => "Perl::Critic 1.105+ or Test::Perl::Critic 1.02+ is not
installed." if $@;
+
+all_critic_ok('lib', 'script', 'bin');
+
+__END__
+
+only=1
+
+# -------------------------------------------------------------------------
+# Not important.
+
+[BuiltinFunctions::ProhibitSleepViaSelect]
+[BuiltinFunctions::RequireGlobFunction]
+[ClassHierarchies::ProhibitOneArgBless]
+
+# -------------------------------------------------------------------------
+# Bug detection
+[InputOutput::ProhibitBarewordFileHandles]
+[Modules::RequireFilenameMatchesPackage]
+[Subroutines::ProhibitNestedSubs]
+[Subroutines::ProhibitReturnSort]
+[TestingAndDebugging::RequireUseStrict]
+[Variables::ProhibitConditionalDeclarations]
+[Variables::RequireLexicalLoopIterators]
+
+[TestingAndDebugging::ProhibitNoStrict]
+allow=refs
+
+# -------------------------------------------------------------------------
+# Security issue detection
+[InputOutput::RequireEncodingWithUTF8Layer]
+[Modules::ProhibitEvilModules]
+[InputOutput::ProhibitTwoArgOpen]
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/xt/03_pod.t
new/Router-Simple-0.15/xt/03_pod.t
--- old/Router-Simple-0.14/xt/03_pod.t 2012-12-06 02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/xt/03_pod.t 1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-use Test::More;
-eval "use Test::Pod 1.00";
-plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
-all_pod_files_ok();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/xt/04_minimum_version.t
new/Router-Simple-0.15/xt/04_minimum_version.t
--- old/Router-Simple-0.14/xt/04_minimum_version.t 2012-12-06
02:24:33.000000000 +0100
+++ new/Router-Simple-0.15/xt/04_minimum_version.t 1970-01-01
01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-use Test::More;
-eval "use Test::MinimumVersion 0.101080";
-plan skip_all => "Test::Minimumversion required for testing perl minimum
version" if $@;
-all_minimum_version_from_metayml_ok();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/xt/05_cpan_meta.t
new/Router-Simple-0.15/xt/05_cpan_meta.t
--- old/Router-Simple-0.14/xt/05_cpan_meta.t 2012-12-06 02:24:33.000000000
+0100
+++ new/Router-Simple-0.15/xt/05_cpan_meta.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,5 +0,0 @@
-use Test::More;
-eval "use Test::CPAN::Meta";
-plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@;
-plan skip_all => "There is no META.yml" unless -f "META.yml";
-meta_yaml_ok();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Router-Simple-0.14/xt/06_meta_author.t
new/Router-Simple-0.15/xt/06_meta_author.t
--- old/Router-Simple-0.14/xt/06_meta_author.t 2012-12-06 02:24:33.000000000
+0100
+++ new/Router-Simple-0.15/xt/06_meta_author.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,11 +0,0 @@
-use strict;
-use Test::More;
-eval "use Parse::CPAN::Meta";
-plan skip_all => "Parse::CPAN::Meta required for testing META.yml" unless eval
"use Parse::CPAN::Meta; 1;";
-plan skip_all => "There is no META.yml" unless -f "META.yml";
-
-my $meta = Parse::CPAN::Meta->load_file('META.yml');
-isnt($meta->{author}->[0], 'unknown', 'author info');
-cmp_ok($meta->{'build_requires'}->{'Test::More'}, '>=', '0.98');
-ok($meta->{'requires'}->{'perl'}, 'metayml_declares_perl_version');
-done_testing;
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]