plack/Plack — pull request #367 by miyagawa (2013-01-31 18:53:53+00:00)
Title: New preferred Builder API 

Plack::Builder has had its OO API, but the way `->mount` and `->to_app` works is kind of weird and requires you to pass around the `$app` to make it work.

This patch fixes it by preserving the urlmap state inside (as it is designed), and allows you to more naturally write:

```perl
use Plack::Builder;

my $builder = Plack::Builder->new;
$builder->add_middleware('Foo');
$builder->mount('/foo' => $foo);
$builder->to_app;
```

in case you don't need mount feature there's a `->wrap` method which is basically the equivalent of putting `$app` in the last line of `builder {}` block DSL.

This preserves the existing (unfortunately documented) API, and passes the test for it as well. We can add a deprecation warning if we plan to eliminate that compatibility but that's not much of a big deal at this moment.