Skip to content

Commit

Permalink
->wrap can now be called on instance too
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Oct 9, 2009
1 parent 9a81edc commit 4a1e2a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Plack/Middleware.pm
Expand Up @@ -14,8 +14,13 @@ sub import {
}

sub wrap {
my($class, $app, @args) = @_;
$class->new({ app => $app, @args })->to_app;
my($self, $app, @args) = @_;
if (ref $self) {
$self->{app} = $app;
} else {
$self = $self->new({ app => $app, @args });
}
return $self->to_app;
}

sub to_app {
Expand Down

0 comments on commit 4a1e2a1

Please sign in to comment.