tokuhirom/p5-router-simple — pull request #11 by mla (2014-11-21 23:35:00+00:00)
Title: support nested submappers

Please consider integrating this change or something similar to it. The idea is to allow nested submapper calls like this:

```perl
#!/usr/bin/env perl

use strict;
use Router::Simple;

my $router = Router::Simple->new();
$router->submapper('/a', { controller => 'Root' })
->connect('', { action => 'a' })
->submapper('/b')
->connect('', { action => 'b' })
->submapper('/c')
->connect('', { action => 'c' })
;

foreach my $path ('/a', '/a/b', '/a/b/c') {
my $match = $router->match($path) or die "Failed to match path '$path'";
print "$path: $match->{controller}::$match->{action}\n";
}
```

All I did was add a submapper() method to the SubMapper class, so it can be called recursively. Currently it's forwarding the call to Router::Simple::submapper() so as not to duplicate the parameter handling. Not sure if you'll like that, since the instance variable to that method is now either a Router instance OR a SubMapper instance. But it does seem to work.

I'll be happy to write some tests for it if you're willing to merge.

Thanks!