Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #283 from jonswar/master

document Plack::Middleware auto-prefix, use prefixless examples
  • Loading branch information...
commit 6a0233f4a52b5e94a327ffe7e3a57102043e10ef 2 parents dd8a32a + e1c406b
@miyagawa miyagawa authored
Showing with 10 additions and 8 deletions.
  1. +10 −8 lib/Plack/Builder.pm
View
18 lib/Plack/Builder.pm
@@ -126,9 +126,10 @@ Plack::Builder - OO and DSL to enable Plack Middlewares
my $app = sub { ... };
builder {
- enable "Plack::Middleware::Foo";
- enable "Plack::Middleware::Bar", opt => "val";
- enable "Plack::Middleware::Baz";
+ enable "Deflater";
+ enable "Session", store => "File";
+ enable "Debug", panels => [ qw(DBITrace Memory Timer) ];
+ enable "+My::Plack::Middleware";
$app;
};
@@ -136,7 +137,7 @@ Plack::Builder - OO and DSL to enable Plack Middlewares
builder {
mount "/foo" => builder {
- enable "Plack::Middleware::Foo";
+ enable "Foo";
$app;
};
@@ -160,11 +161,12 @@ base class to use this DSL, inspired by Rack::Builder.
Whenever you call C<enable> on any middleware, the middleware app is
pushed to the stack inside the builder, and then reversed when it
-actually creates a wrapped application handler, so:
+actually creates a wrapped application handler. "Plack::Middleware::"
+is added as a prefix by default. So:
builder {
- enable "Plack::Middleware::Foo";
- enable "Plack::Middleware::Bar", opt => "val";
+ enable "Foo";
+ enable "Bar", opt => "val";
$app;
};
@@ -215,7 +217,7 @@ Plack::Builder has a native support for L<Plack::App::URLMap> with C<mount> meth
my $app = builder {
mount "/foo" => $app1;
mount "/bar" => builder {
- enable "Plack::Middleware::Foo";
+ enable "Foo";
$app2;
};
};

0 comments on commit 6a0233f

Please sign in to comment.
Something went wrong with that request. Please try again.