Mojolicious::Command::Psgi - PSGI Command


Mojolicious documentation Contained in the Mojolicious distribution.

Index


Code Index:

NAME

Top

Mojolicious::Command::Psgi - PSGI Command

SYNOPSIS

Top

  use Mojolicious::Command::Psgi;

  my $psgi = Mojolicious::Command::Psgi->new;
  my $app = $psgi->run;

DESCRIPTION

Top

Mojolicious::Command::Psgi is a command interface to Mojo::Server::PSGI.

ATTRIBUTES

Top

Mojolicious::Command::Psgi inherits all attributes from Mojo::Command and implements the following new ones.

description

  my $description = $psgi->description;
  $psgi           = $psgi->description('Foo!');

Short description of this command, used for the command list.

usage

  my $usage = $psgi->usage;
  $psgi     = $psgi->usage('Foo!');

Usage information for this command, used for the help screen.

METHODS

Top

Mojolicious::Command::Psgi inherits all methods from Mojo::Command and implements the following new ones.

run

  my $app = $psgi->run;

Run this command.

SEE ALSO

Top

Mojolicious, Mojolicious::Guides, http://mojolicio.us.


Mojolicious documentation Contained in the Mojolicious distribution.

package Mojolicious::Command::Psgi;
use Mojo::Base 'Mojo::Command';

use Mojo::Server::PSGI;

has description => <<'EOF';
Start application with PSGI.
EOF
has usage => <<"EOF";
usage: $0 psgi
EOF

# "In the end it was not guns or bombs that defeated the aliens,
#  but that humblest of all God's creatures... the Tyrannosaurus Rex."
sub run {
  my $self = shift;
  my $psgi = Mojo::Server::PSGI->new;

  # Preload
  $psgi->app;

  # Return app callback
  sub { $psgi->run(@_) };
}

1;
__END__