Skip to content

Commit

Permalink
fix line length in guides
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 24, 2015
1 parent 0dea7b0 commit 80fbf18
Show file tree
Hide file tree
Showing 8 changed files with 295 additions and 312 deletions.
14 changes: 7 additions & 7 deletions lib/Mojolicious/Guides.pod
Expand Up @@ -46,8 +46,8 @@ A fast and fun way to get started developing web applications with
L<Mojolicious>. The tutorial introduces the L<Mojolicious::Lite> micro web
framework, which is only a thin wrapper around the full web framework. The
simplified notation introduced in the tutorial is commonly used throughout the
guides and is therefore considered a prerequisite, you should definitely take
a look!
guides and is therefore considered a prerequisite, you should definitely take a
look!

=back

Expand Down Expand Up @@ -104,9 +104,9 @@ Minimalistic JSON implementation that just works.

=item L<Mojo::Server::Daemon>

Full featured, highly portable non-blocking I/O HTTP and WebSocket server,
with self-restart support through L<Mojo::Server::Morbo>, perfect for
development and testing.
Full featured, highly portable non-blocking I/O HTTP and WebSocket server, with
self-restart support through L<Mojo::Server::Morbo>, perfect for development
and testing.

=item L<Mojo::Server::Prefork>

Expand Down Expand Up @@ -449,8 +449,8 @@ This is the class hierarchy of the L<Mojolicious> distribution.

=head1 MORE

A lot more documentation and examples by many different authors can be found
in the L<Mojolicious wiki|http://github.com/kraih/mojo/wiki>.
A lot more documentation and examples by many different authors can be found in
the L<Mojolicious wiki|http://github.com/kraih/mojo/wiki>.

=head1 SUPPORT

Expand Down
40 changes: 20 additions & 20 deletions lib/Mojolicious/Guides/Contributing.pod
Expand Up @@ -7,8 +7,8 @@ Mojolicious::Guides::Contributing - Contributing to Mojolicious

=head1 OVERVIEW

There are many ways to contribute to L<Mojolicious>, this guide will show you
a few of them.
There are many ways to contribute to L<Mojolicious>, this guide will show you a
few of them.

=head1 REPORTING BUGS

Expand All @@ -24,10 +24,10 @@ reported by someone else and you can just add a comment confirming it.
If it hasn't been reported yet, try to prepare a test case demonstrating the
bug, you are not expected to fix it yourself, but you'll have to make sure the
developers can replicate your problem. Sending in your whole application
generally does more harm than good, the C<t> directory of this distribution
has many good examples for how to do it right. Writing a test is usually the
hardest part of fixing a bug, so the better your test case the faster it can
be fixed. ;)
generally does more harm than good, the C<t> directory of this distribution has
many good examples for how to do it right. Writing a test is usually the
hardest part of fixing a bug, so the better your test case the faster it can be
fixed. ;)

And don't forget to add a descriptive title and text when you create a new
issue.
Expand Down Expand Up @@ -80,22 +80,22 @@ by discussing it in advance on the
L<mailing-list|http://groups.google.com/group/mojolicious> or the official IRC
channel C<#mojo> on C<irc.perl.org>.

The following mission statement and rules are the foundation of all L<Mojo>
and L<Mojolicious> development. Please make sure that your contribution aligns
well with them before sending a pull request.
The following mission statement and rules are the foundation of all L<Mojo> and
L<Mojolicious> development. Please make sure that your contribution aligns well
with them before sending a pull request.

=head2 Mission statement

L<Mojo> is a runtime environment for Perl real-time web frameworks. It
provides all the basic tools and helpers needed to write simple web
applications and higher level web frameworks, such as L<Mojolicious>.
L<Mojo> is a runtime environment for Perl real-time web frameworks. It provides
all the basic tools and helpers needed to write simple web applications and
higher level web frameworks, such as L<Mojolicious>.

All components should be reusable in other projects, and in a UNIXish way only
loosely coupled.

Especially for people new to Perl it should be as easy as possible to install
L<Mojolicious> and get started. Writing web applications can be one of the
most fun ways to learn a language!
L<Mojolicious> and get started. Writing web applications can be one of the most
fun ways to learn a language!

For developers of other web frameworks, it should be possible to reuse all the
infrastructure and just consider the higher levels of the L<Mojolicious>
Expand All @@ -111,8 +111,8 @@ The web is a moving target, to stay relevant we have to stay in motion too.

Keep it simple, no magic unless absolutely necessary.

The installation process should be as fast and painless as possible. (Less
than a minute on most common hardware is a good rule of thumb)
The installation process should be as fast and painless as possible. (Less than
a minute on most common hardware is a good rule of thumb)

The addition and modification of features is decided by majority vote or the
pumpkin-holder.
Expand Down Expand Up @@ -147,8 +147,8 @@ No inline POD.

Documentation belongs to the guides, module POD is just an API reference.

The main focus of the included documentation should be on examples, no walls
of text. (An example for every one or two sentences is a good rule of thumb)
The main focus of the included documentation should be on examples, no walls of
text. (An example for every one or two sentences is a good rule of thumb)

Everything should be ordered alphabetically if possible, or at least be
consistent if not.
Expand All @@ -162,8 +162,8 @@ everything should look like it was written by a single person.

Functions and methods should be as short as possible, no spaghetti code.

Comments should be correctly capitalized, and funny if possible, punctuation
is optional if it doesn't increase readability.
Comments should be correctly capitalized, and funny if possible, punctuation is
optional if it doesn't increase readability.

No names outside of C<Mojolicious.pm>.

Expand Down
107 changes: 51 additions & 56 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -34,8 +34,8 @@ architecture.
$ ./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
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">.

Expand All @@ -53,16 +53,14 @@ Since all built-in web servers are based on the L<Mojo::IOLoop> event loop,
they scale best with non-blocking operations. But if your application for some
reason needs to perform many blocking operations, you can improve performance
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>).
concurrent connections each worker is allowed to handle (often as low as C<1>).

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

During startup your application is preloaded in the manager process, which
does not run an event loop, so you can use L<Mojo::IOLoop/"next_tick"> to run
code whenever a new worker process has been forked and its event loop gets
started.
During startup your application is preloaded in the manager process, which does
not run an event loop, so you can use L<Mojo::IOLoop/"next_tick"> to run code
whenever a new worker process has been forked and its event loop gets started.

use Mojolicious::Lite;

Expand All @@ -82,19 +80,19 @@ familiar with L<Mojo::Server::Morbo>.
Mojo::Server::Morbo
+- Mojo::Server::Daemon

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. To start applications with it you can use the
L<morbo> script.
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. To start applications with it you can use the L<morbo>
script.

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

=head2 Hypnotoad

For bigger applications L<Mojolicious> contains the UNIX optimized preforking
web server L<Mojo::Server::Hypnotoad>, which can take advantage of multiple
CPU cores and copy-on-write memory management to scale up to thousands of
web server L<Mojo::Server::Hypnotoad>, which can take advantage of multiple CPU
cores and copy-on-write memory management to scale up to thousands of
concurrent client connections.

Mojo::Server::Hypnotoad
Expand Down Expand Up @@ -224,10 +222,10 @@ hard to configure properly.
=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 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>.
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/my_app

Expand Down Expand Up @@ -298,9 +296,8 @@ But you could even use middleware right in your application.

Sometimes you might have to deploy your application in a blackbox environment
where you can't just change the server configuration or behind a reverse proxy
that passes along additional information with C<X-*> headers. In such cases
you can use the hook L<Mojolicious/"before_dispatch"> to rewrite incoming
requests.
that passes along additional information with C<X-*> headers. In such cases you
can use the hook L<Mojolicious/"before_dispatch"> to rewrite incoming requests.

# Change scheme if "X-Forwarded-HTTPS" header is set
$app->hook(before_dispatch => sub {
Expand Down Expand Up @@ -376,10 +373,10 @@ for some reason can't just be integrated with a new reactor backend.

=head1 REAL-TIME WEB

The real-time web is a collection of technologies that include Comet
(long polling), EventSource and WebSockets, which allow content to be pushed
to consumers with long-lived connections as soon as it is generated, instead
of relying on the more traditional pull model. All built-in web servers use
The real-time web is a collection of technologies that include Comet (long
polling), EventSource and WebSockets, which allow content to be pushed to
consumers with long-lived connections as soon as it is generated, instead of
relying on the more traditional pull model. All built-in web servers use
non-blocking I/O and are based on the L<Mojo::IOLoop> event loop, which
provides many very powerful features that allow real-time web applications to
scale up to thousands of concurrent client connections.
Expand Down Expand Up @@ -527,10 +524,10 @@ shouldn't block for too long.
=head2 Exceptions in events

Since timers and other non-blocking operations are running solely in the event
loop, outside of the application, exceptions that get thrown in callbacks
can't get caught and handled automatically. But you can handle them manually
by subscribing to the event L<Mojo::Reactor/"error"> or catching them inside
the callback.
loop, outside of the application, exceptions that get thrown in callbacks can't
get caught and handled automatically. But you can handle them manually by
subscribing to the event L<Mojo::Reactor/"error"> or catching them inside the
callback.

use Mojolicious::Lite;
use Mojo::IOLoop;
Expand Down Expand Up @@ -565,9 +562,9 @@ by L<Mojo::IOLoop> as a fallback.

Mojo::IOLoop->singleton->reactor->unsubscribe('error');

During development or for applications where crashing is simply preferable,
you can also make every exception that gets thrown in a callback fatal by
removing all of its subscribers.
During development or for applications where crashing is simply preferable, you
can also make every exception that gets thrown in a callback fatal by removing
all of its subscribers.

=head2 WebSocket web service

Expand Down Expand Up @@ -639,8 +636,8 @@ connection.

=head2 Testing WebSocket web services

While the message flow on WebSocket connections can be rather dynamic, it
more often than not is quite predictable, which allows this rather pleasant
While the message flow on WebSocket connections can be rather dynamic, it more
often than not is quite predictable, which allows this rather pleasant
L<Test::Mojo> API to be used.

use Test::More;
Expand Down Expand Up @@ -729,8 +726,8 @@ finished.
=head2 Streaming multipart uploads

L<Mojolicious> contains a very sophisticated event system based on
L<Mojo::EventEmitter>, with ready-to-use events on almost all layers, and
which can be combined to solve some of hardest problems in web development.
L<Mojo::EventEmitter>, with ready-to-use events on almost all layers, and which
can be combined to solve some of hardest problems in web development.

use Mojolicious::Lite;
use Scalar::Util 'weaken';
Expand Down Expand Up @@ -1071,10 +1068,10 @@ the entire previous chunk has actually been written.

=head2 Non-blocking

L<Mojo::UserAgent> has been designed from the ground up to be non-blocking,
the whole blocking API is just a simple convenience wrapper. Especially for
high latency tasks like web crawling this can be extremely useful, because you
can keep many concurrent connections active at the same time.
L<Mojo::UserAgent> has been designed from the ground up to be non-blocking, the
whole blocking API is just a simple convenience wrapper. Especially for high
latency tasks like web crawling this can be extremely useful, because you can
keep many concurrent connections active at the same time.

use Mojo::UserAgent;
use Mojo::IOLoop;
Expand Down Expand Up @@ -1121,11 +1118,11 @@ work inside an already running event loop or start one on demand.

WebSockets are not just for the server-side, you can use
L<Mojo::UserAgent/"websocket"> to open new connections, which are always
non-blocking. The WebSocket handshake uses HTTP, and is a normal C<GET>
request with a few additional headers. It can even contain cookies, and is
followed by a C<101> response from the server, notifying our user agent that
the connection has been established and it can start using the bi-directional
WebSocket protocol.
non-blocking. The WebSocket handshake uses HTTP, and is a normal C<GET> request
with a few additional headers. It can even contain cookies, and is followed by
a C<101> response from the server, notifying our user agent that the connection
has been established and it can start using the bi-directional WebSocket
protocol.

use Mojo::UserAgent;
use Mojo::IOLoop;
Expand Down Expand Up @@ -1161,9 +1158,9 @@ WebSocket protocol.
=head2 Command line

Don't you hate checking huge HTML files from the command line? Thanks to the
command L<Mojolicious::Command::get> that is about to change. You can just
pick the parts that actually matter with the CSS selectors from L<Mojo::DOM>
and JSON Pointers from L<Mojo::JSON::Pointer>.
command L<Mojolicious::Command::get> that is about to change. You can just pick
the parts that actually matter with the CSS selectors from L<Mojo::DOM> and
JSON Pointers from L<Mojo::JSON::Pointer>.

$ mojo get http://mojolicio.us 'head > title'

Expand Down Expand Up @@ -1301,8 +1298,7 @@ are an easy way to avoid conflicts.
1;

You can have as many application specific plugins as you like, the only
difference to normal plugins is that you load them using their full class
name.
difference to normal plugins is that you load them using their full class name.

use Mojolicious::Lite;

Expand Down Expand Up @@ -1345,8 +1341,7 @@ that they will be picked up automatically by the command line interface?
1;

Command line arguments are passed right through and there are many useful
attributes and methods in L<Mojolicious::Command> that you can use or
overload.
attributes and methods in L<Mojolicious::Command> that you can use or overload.

$ mojo spy secrets
HelloWorld
Expand Down Expand Up @@ -1404,8 +1399,8 @@ actually much easier than you might think.
$ mv public lib/MyApp/
$ mv templates lib/MyApp/

The trick is to move the C<public> and C<templates> directories so they can
get automatically installed with the modules.
The trick is to move the C<public> and C<templates> directories so they can get
automatically installed with the modules.

# Application
package MyApp;
Expand Down Expand Up @@ -1485,8 +1480,8 @@ response.

=head2 Hello World one-liners

The C<Hello World> example above can get even a little bit shorter in an
L<ojo> one-liner.
The C<Hello World> example above can get even a little bit shorter in an L<ojo>
one-liner.

$ perl -Mojo -E 'a({text => "Hello World!"})->start' daemon

Expand Down

0 comments on commit 80fbf18

Please sign in to comment.