Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added experimental to_psgi method to Mojo::Server::PSGI

  • Loading branch information...
commit 442e16439744906b3554f86656c258ae54067199 1 parent 91115f1
Sebastian Riedel authored
1  Changes
View
@@ -1,6 +1,7 @@
This file documents the revision history for Perl extension Mojolicious.
2.51 2012-02-19 00:00:00
+ - Added EXPERIMENTAL to_psgi method to Mojo::Server::PSGI.
- Removed experimental status from around_dispatch hook.
- Removed experimental status from emit_chain method in
Mojolicious::Plugins.
16 lib/Mojo/Server/PSGI.pm
View
@@ -49,6 +49,11 @@ sub run {
\@headers, Mojo::Server::PSGI::_IO->new(tx => $tx)];
}
+sub to_psgi {
+ (my $self = shift)->app;
+ return sub { $self->run(@_) }
+}
+
# "Wow! Homer must have got one of those robot cars!
# *Car crashes in background*
# Yeah, one of those AMERICAN robot cars."
@@ -105,7 +110,7 @@ Mojo::Server::PSGI - PSGI server
# Resume transaction
$tx->resume;
});
- my $app = sub { $psgi->run(@_) };
+ $psgi->to_psgi;
=head1 DESCRIPTION
@@ -127,7 +132,14 @@ implements the following new ones.
my $res = $psgi->run($env);
-Run PSGI.
+Run L<PSGI>.
+
+=head2 C<to_psgi>
+
+ my $app = $psgi->to_psgi;
+
+Turn L<Mojo> application into L<PSGI> application. Note that this method is
+EXPERIMENTAL and might change without warning!
=head1 SEE ALSO
11 lib/Mojolicious/Command/psgi.pm
View
@@ -8,16 +8,7 @@ has usage => "usage: $0 psgi\n";
# "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;
-
- # Preload
- my $psgi = Mojo::Server::PSGI->new;
- $psgi->app;
-
- # Return app callback
- return sub { $psgi->run(@_) };
-}
+sub run { Mojo::Server::PSGI->new->to_psgi }
1;
__END__
2  lib/Mojolicious/Guides.pod
View
@@ -102,7 +102,7 @@ WebSocket server with support for zero downtime software upgrades
=item L<Mojo::Server::CGI>, L<Mojo::Server::PSGI>
-Transparent CGI and PSGI support out of the box.
+Transparent CGI and L<PSGI> support out of the box.
=item L<Mojo::Template>
8 lib/Mojolicious/Guides/Cookbook.pod
View
@@ -153,10 +153,10 @@ automatically detect that it is executed as a C<CGI> script.
=head2 PSGI/Plack
L<PSGI> is an interface between Perl web frameworks and web servers, and
-L<Plack> is a Perl module and toolkit that contains PSGI middleware, helpers
-and adapters to web servers. L<PSGI> and L<Plack> are inspired by Python's
-WSGI and Ruby's Rack. L<Mojolicious> applications are ridiculously simple to
-deploy with L<Plack>.
+L<Plack> is a Perl module and toolkit that contains L<PSGI> middleware,
+helpers and adapters to web servers. L<PSGI> and L<Plack> are inspired by
+Python's WSGI and Ruby's Rack. L<Mojolicious> applications are ridiculously
+simple to deploy with L<Plack>.
$ plackup ./script/myapp
HTTP::Server::PSGI: Accepting connections at http://0:5000/
2  lib/Mojolicious/Lite.pm
View
@@ -123,7 +123,7 @@ There is also a helper command to generate a small example application.
=head2 Commands
All the normal L<Mojolicious::Commands> are available from the command line.
-Note that CGI and PSGI environments can usually be auto detected and will
+Note that CGI and L<PSGI> environments can usually be auto detected and will
just work without commands.
$ ./myapp.pl daemon
Please sign in to comment.
Something went wrong with that request. Please try again.