}
sub run_if_script {
- # ->as_psgi_app is true for require() but also works for plackup
+ # ->to_psgi_app is true for require() but also works for plackup
return $_[0]->to_psgi_app if caller(1);
my $self = ref($_[0]) ? $_[0] : $_[0]->new;
$self->run(@_);
sub _run_cgi {
my $self = shift;
require Plack::Server::CGI;
- Plack::Server::CGI->run($self->as_psgi_app);
+ Plack::Server::CGI->run($self->to_psgi_app);
}
sub _run_fcgi {
my $self = shift;
require Plack::Server::FCGI;
- Plack::Server::FCGI->run($self->as_psgi_app);
+ Plack::Server::FCGI->run($self->to_psgi_app);
}
sub to_psgi_app {
my $request = GET($path);
my $response;
- Plack::Test::test_psgi($self->as_psgi_app, sub { $response = shift->($request) });
+ Plack::Test::test_psgi($self->to_psgi_app, sub { $response = shift->($request) });
print $response->as_string;
}
sub dispatch_request {
sub (/) {
- $self->show_landing(@_);
+ shift->show_landing(@_);
},
sub(/...) {
sub (GET + /user) {
- $self->show_users(@_);
+ shift->show_users(@_);
},
sub (/user/*) {
sub (GET) {
- $self->show_user(@_);
+ shift->show_user(@_);
},
sub (POST + %:id=&:@roles~) {
- $self->process_post(@_);
+ shift->process_post(@_);
}
},
}