Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mention prove too
  • Loading branch information
kraih committed Nov 26, 2014
1 parent 2d46474 commit 92ca82b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Changes
Expand Up @@ -3404,7 +3404,7 @@
- Improved PSGI support and added psgi command.
- Added automatic environment detection for Plack based servers, there is
no technical way to detect all PSGI compliant servers yet though. That
means "plackup myapp.pl" and "plackup script/myapp" should just work.
means "plackup myapp.pl" and "plackup script/my_app" should just work.
- Added session and flash helpers.
- Added finished callback to WebSocket client and server.
- Added referrer method to Mojo::Headers. (esskar)
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Home.pm
Expand Up @@ -141,14 +141,14 @@ Path to C<lib> directory in which L<Mojolicious> is installed.
=head2 new
my $home = Mojo::Home->new;
my $home = Mojo::Home->new('/home/sri/myapp');
my $home = Mojo::Home->new('/home/sri/my_app');
Construct a new L<Mojo::Home> object and L</"parse"> home directory if
necessary.
=head2 parse
$home = $home->parse('/home/sri/myapp');
$home = $home->parse('/home/sri/my_app');
Parse home directory.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/Hypnotoad.pm
Expand Up @@ -421,7 +421,7 @@ Configure server from application settings.
=head2 run
$hypnotoad->run('script/myapp');
$hypnotoad->run('script/my_app');
Run server for application.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Server/Morbo.pm
Expand Up @@ -146,7 +146,7 @@ L<Mojo::Server::Morbo> implements the following attributes.
=head2 watch
my $watch = $morbo->watch;
$morbo = $morbo->watch(['/home/sri/myapp']);
$morbo = $morbo->watch(['/home/sri/my_app']);
Files and directories to watch for changes, defaults to the application script
as well as the C<lib> and C<templates> directories in the current working
Expand All @@ -166,7 +166,7 @@ its name or C<undef> if there have been no changes.
=head2 run
$morbo->run('script/myapp');
$morbo->run('script/my_app');
Run server for application.
Expand Down
34 changes: 17 additions & 17 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -23,30 +23,30 @@ server with L<Mojo::Server::Daemon>. It is usually used during development and
in the construction of more advanced web servers, but is solid and fast enough
for small to mid sized applications.

$ ./script/myapp daemon
$ ./script/my_app daemon
Server available at http://127.0.0.1:3000.

It is available to every application through the command
L<Mojolicious::Command::daemon>, which has many configuration options and is
known to work on every platform Perl works on with its single-process
architecture.

$ ./script/myapp daemon -h
$ ./script/my_app daemon -h
...List of available options...

Another huge advantage is that it supports TLS and WebSockets out of the box,
a development certificate for testing purposes is built right in, so it just
works, but you can specify all listen locations supported by
L<Mojo::Server::Daemon/"listen">.

$ ./script/myapp daemon -l https://[::]:3000
$ ./script/my_app daemon -l https://[::]:3000
Server available at https://[::]:3000.

On UNIX platforms you can also add preforking and switch to a multi-process
architecture with L<Mojolicious::Command::prefork>, to take advantage of
multiple CPU cores and copy-on-write.

$ ./script/myapp prefork
$ ./script/my_app prefork
Server available at http://127.0.0.1:3000.

Since all built-in web servers are based on the L<Mojo::IOLoop> event loop,
Expand All @@ -56,7 +56,7 @@ by increasing the number of worker processes and decreasing the number of
concurrent connections each worker is allowed to handle (often as low as
C<1>).

$ ./script/myapp prefork -m production -w 10 -c 1
$ ./script/my_app prefork -m production -w 10 -c 1
Server available at http://127.0.0.1:3000.

Your application is preloaded in the manager process during startup, to run
Expand Down Expand Up @@ -85,7 +85,7 @@ It is basically a restarter that forks a new L<Mojo::Server::Daemon> web
server whenever a file in your project changes, and should therefore only be
used during development.

$ morbo ./script/myapp
$ morbo ./script/my_app
Server available at http://127.0.0.1:3000.

=head2 Hypnotoad
Expand All @@ -105,7 +105,7 @@ It is based on the L<Mojo::Server::Prefork> web server, which adds preforking
to L<Mojo::Server::Daemon>, but optimized specifically for production
environments out of the box.

$ hypnotoad ./script/myapp
$ hypnotoad ./script/my_app
Server available at http://127.0.0.1:8080.

It automatically sets the operating mode to C<production> and you can tweak
Expand Down Expand Up @@ -136,7 +136,7 @@ software upgrades (hot deployment). That means you can upgrade L<Mojolicious>,
Perl or even system libraries at runtime without ever stopping the server or
losing a single incoming connection, just by running the command above again.

$ hypnotoad ./script/myapp
$ hypnotoad ./script/my_app
Starting hot deployment for Hypnotoad server 31841.

You might also want to enable proxy support if you're using Hypnotoad behind a
Expand All @@ -153,13 +153,13 @@ as you can see above, but on modern operating systems that support the
C<SO_REUSEPORT> socket option, there is also another method available that
works with all built-in web servers.

$ ./script/myapp prefork -P /tmp/first.pid -l http://*:8080?reuse=1
$ ./script/my_app prefork -P /tmp/first.pid -l http://*:8080?reuse=1
Server available at http://127.0.0.1:8080.

All you have to do is start a second web server listening to the same port and
stop the first web server gracefully afterwards.

$ ./script/myapp prefork -P /tmp/second.pid -l http://*:8080?reuse=1
$ ./script/my_app prefork -P /tmp/second.pid -l http://*:8080?reuse=1
Server available at http://127.0.0.1:8080.
$ kill -s TERM `cat /tmp/first.pid`

Expand Down Expand Up @@ -215,7 +215,7 @@ production environments is discouraged though, because as a result of how
C<CGI> works, it is very slow and many web servers are making it exceptionally
hard to configure properly.

ScriptAlias / /home/sri/myapp/script/myapp/
ScriptAlias / /home/sri/my_app/script/my_app/

=head2 PSGI/Plack

Expand All @@ -225,23 +225,23 @@ 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
$ plackup ./script/my_app

L<Plack> provides many server and protocol adapters for you to choose from,
such as C<FCGI>, C<uWSGI> and C<mod_perl>.

$ plackup ./script/myapp -s FCGI -l /tmp/myapp.sock
$ plackup ./script/my_app -s FCGI -l /tmp/myapp.sock

The C<MOJO_REVERSE_PROXY> environment variable can be used to enable proxy
support, this allows L<Mojolicious> to automatically pick up the
C<X-Forwarded-For> and C<X-Forwarded-Proto> headers.

$ MOJO_REVERSE_PROXY=1 plackup ./script/myapp
$ MOJO_REVERSE_PROXY=1 plackup ./script/my_app

If an older server adapter is unable to correctly detect the application home
directory, you can simply use the C<MOJO_HOME> environment variable.

$ MOJO_HOME=/home/sri/myapp plackup ./script/myapp
$ MOJO_HOME=/home/sri/my_app plackup ./script/my_app

There is no need for a C<.psgi> file, just point the server adapter at your
application script, it will automatically act like one if it detects the
Expand All @@ -257,7 +257,7 @@ application logic.

builder {
enable 'Deflater';
require './script/myapp';
require './script/my_app';
};

L<Mojo::Server::PSGI> can be used directly to load and customize applications
Expand All @@ -270,7 +270,7 @@ in the wrapper script.
builder {
enable 'Deflater';
my $server = Mojo::Server::PSGI->new;
$server->load_app('./script/myapp');
$server->load_app('./script/my_app');
$server->app->config(foo => 'bar');
$server->to_psgi_app;
};
Expand Down
7 changes: 4 additions & 3 deletions lib/Test/Mojo.pm
Expand Up @@ -426,10 +426,11 @@ Test::Mojo - Testing Mojo!
L<Test::Mojo> is a test user agent based on L<Mojo::UserAgent>, it is usually
used together with L<Test::More> to test L<Mojolicious> applications. Just run
your tests with the command L<Mojolicious::Command::test>.
your tests with the command L<Mojolicious::Command::test> or L<prove>.
$ ./myapp.pl test t/foo.t
$ ./myapp.pl test -v t/foo.t
$ ./script/my_app test
$ ./script/my_app test -v t/foo.t
$ prove -l -v t/foo.t
If it is not already defined, the C<MOJO_LOG_LEVEL> environment variable will
be set to C<debug> or C<fatal>, depending on the value of the
Expand Down
2 changes: 1 addition & 1 deletion script/hypnotoad
Expand Up @@ -30,7 +30,7 @@ hypnotoad - Hypnotoad HTTP and WebSocket server
Usage: hypnotoad [OPTIONS] [APPLICATION]
hypnotoad ./script/myapp
hypnotoad ./script/my_app
hypnotoad ./myapp.pl
hypnotoad -f ./myapp.pl
Expand Down
2 changes: 1 addition & 1 deletion script/morbo
Expand Up @@ -34,7 +34,7 @@ morbo - Morbo HTTP and WebSocket development server
Usage: morbo [OPTIONS] [APPLICATION]
morbo ./script/myapp
morbo ./script/my_app
morbo ./myapp.pl
morbo -m production -l https://*:443 -l http://[::]:3000 ./myapp.pl
morbo -l 'https://*:443?cert=./server.crt&key=./server.key' ./myapp.pl
Expand Down

0 comments on commit 92ca82b

Please sign in to comment.