Skip to content

Commit

Permalink
switch from 78 to 79 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 19, 2012
1 parent 2558de5 commit 97eae38
Show file tree
Hide file tree
Showing 91 changed files with 589 additions and 695 deletions.
2 changes: 1 addition & 1 deletion .perltidyrc
Expand Up @@ -2,7 +2,7 @@
-b # Just rewrite the file
-w # Show all warnings
-iob # Ignore old breakpoints
-l=78 # 78 character per line
-l=79 # 79 character per line
-mbl=2 # No more than 2 blank lines
-i=2 # Indent level is 2
-ci=2 # Continuation indent is 2
Expand Down
7 changes: 3 additions & 4 deletions lib/Mojo.pm
Expand Up @@ -144,8 +144,7 @@ new ones.
my $app = Mojo->new;
Construct a new L<Mojo> application. Will automatically detect your home
directory and set up logging to C<log/mojo.log> if there's a C<log>
directory.
directory and set up logging to C<log/mojo.log> if there's a C<log> directory.
=head2 C<build_tx>
Expand Down Expand Up @@ -174,8 +173,8 @@ Application configuration.
The handler is the main entry point to your application or framework and will
be called for each new transaction, which will usually be a
L<Mojo::Transaction::HTTP> or L<Mojo::Transaction::WebSocket> object. Meant
to be overloaded in a subclass.
L<Mojo::Transaction::HTTP> or L<Mojo::Transaction::WebSocket> object. Meant to
be overloaded in a subclass.
sub handler {
my ($self, $tx) = @_;
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojo/Asset/File.pm
Expand Up @@ -25,8 +25,7 @@ has handle => sub {
my $base = File::Spec->catfile($self->tmpdir, 'mojo.tmp');
my $name = $path // $base;
until ($handle->open($name, O_CREAT | O_EXCL | O_RDWR)) {
croak qq/Can't open file "$name": $!/
if defined $path || $! != $!{EEXIST};
croak qq/Can't open file "$name": $!/ if defined $path || $! != $!{EEXIST};
$name = "$base." . md5_sum(time . $$ . rand 9999999);
}
$self->path($name);
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojo/Asset/Memory.pm
Expand Up @@ -113,14 +113,14 @@ automatically upgrade to a L<Mojo::Asset::File> object.
my $size = $mem->max_memory_size;
$mem = $mem->max_memory_size(1024);
Maximum size in bytes of data to keep in memory before automatically
upgrading to a L<Mojo::Asset::File> object, defaults to the value of the
Maximum size in bytes of data to keep in memory before automatically upgrading
to a L<Mojo::Asset::File> object, defaults to the value of the
C<MOJO_MAX_MEMORY_SIZE> environment variable or C<262144>.
=head1 METHODS
L<Mojo::Asset::Memory> inherits all methods from L<Mojo::Asset> and
implements the following new ones.
L<Mojo::Asset::Memory> inherits all methods from L<Mojo::Asset> and implements
the following new ones.
=head2 C<new>
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Content.pm
Expand Up @@ -458,8 +458,8 @@ value of the C<MOJO_MAX_LEFTOVER_SIZE> environment variable or C<262144>.
my $relaxed = $content->relaxed;
$content = $content->relaxed(1);
Activate relaxed parsing for HTTP 0.9 and responses that are terminated with
a connection close.
Activate relaxed parsing for HTTP 0.9 and responses that are terminated with a
connection close.
=head1 METHODS
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Content/MultiPart.pm
Expand Up @@ -266,8 +266,8 @@ Emitted when a new L<Mojo::Content::Single> part starts.
=head1 ATTRIBUTES
L<Mojo::Content::MultiPart> inherits all attributes from L<Mojo::Content>
and implements the following new ones.
L<Mojo::Content::MultiPart> inherits all attributes from L<Mojo::Content> and
implements the following new ones.
=head2 C<parts>
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Content/Single.pm
Expand Up @@ -131,8 +131,8 @@ implements the following new ones.
my $single = Mojo::Content::Single->new;
Construct a new L<Mojo::Content::Single> object and subscribe to C<read>
event with default content parser.
Construct a new L<Mojo::Content::Single> object and subscribe to C<read> event
with default content parser.
=head2 C<body_contains>
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojo/DOM.pm
Expand Up @@ -469,8 +469,8 @@ are lowercased and selectors need to be lowercase as well.
say $dom->at('p')->text;
say $dom->p->{id};
If XML processing instructions are found, the parser will automatically
switch into XML mode and everything becomes case sensitive.
If XML processing instructions are found, the parser will automatically switch
into XML mode and everything becomes case sensitive.
my $dom = Mojo::DOM->new('<?xml version="1.0"?><P ID="greeting">Hi!</P>');
say $dom->at('P')->text;
Expand Down Expand Up @@ -568,8 +568,8 @@ Render content of this element to XML.
my $collection = $dom->find('html title');
Find elements with CSS3 selectors and return a L<Mojo::Collection> object.
All selectors from L<Mojo::DOM::CSS> are supported.
Find elements with CSS3 selectors and return a L<Mojo::Collection> object. All
selectors from L<Mojo::DOM::CSS> are supported.
# Find a specific element and extract information
my $id = $dom->find('div')->[23]{id};
Expand Down
7 changes: 3 additions & 4 deletions lib/Mojo/DOM/CSS.pm
Expand Up @@ -150,8 +150,7 @@ sub _compile {
while ($element =~ /$CLASS_ID_RE/g) {

# Class
push @$selector, ['attr', 'class', $self->_regex('~', $1)]
if defined $1;
push @$selector, ['attr', 'class', $self->_regex('~', $1)] if defined $1;

# ID
push @$selector, ['attr', 'id', $self->_regex('', $2)] if defined $2;
Expand Down Expand Up @@ -466,8 +465,8 @@ An C<E> element, root of the document.
=head2 C<E:checked>
A user interface element C<E> which is checked (for instance a radio-button
or checkbox).
A user interface element C<E> which is checked (for instance a radio-button or
checkbox).
my $input = $css->select(':checked');
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Date.pm
Expand Up @@ -84,8 +84,8 @@ Mojo::Date - HTTP 1.1 date container
=head1 DESCRIPTION
L<Mojo::Date> implements HTTP 1.1 date and time functions according to
RFC 2616.
L<Mojo::Date> implements HTTP 1.1 date and time functions according to RFC
2616.
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojo/Headers.pm
Expand Up @@ -163,8 +163,7 @@ sub to_string {
# Format multiline values
my @headers;
for my $name (@{$self->names}) {
push @headers, "$name: " . join("\x0d\x0a ", @$_)
for $self->header($name);
push @headers, "$name: " . join("\x0d\x0a ", @$_) for $self->header($name);
}

# Format headers
Expand Down
35 changes: 16 additions & 19 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -343,14 +343,13 @@ L<Mojo::IOLoop> is a very minimalistic reactor based on L<Mojo::Reactor>, it
has been reduced to the absolute minimal feature set required to build solid
and scalable non-blocking TCP clients and servers.
Optional modules L<EV>, L<IO::Socket::IP> and L<IO::Socket::SSL> are
supported transparently and used if installed. Individual features can also
be disabled with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment
variables.
Optional modules L<EV>, L<IO::Socket::IP> and L<IO::Socket::SSL> are supported
transparently and used if installed. Individual features can also be disabled
with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
A TLS certificate and key are also built right in to make writing test
servers as easy as possible. Also note that for convenience the C<PIPE>
signal will be set to C<IGNORE> when L<Mojo::IOLoop> is loaded.
A TLS certificate and key are also built right in to make writing test servers
as easy as possible. Also note that for convenience the C<PIPE> signal will be
set to C<IGNORE> when L<Mojo::IOLoop> is loaded.
=head1 ATTRIBUTES
Expand All @@ -369,10 +368,9 @@ defaults to L<Mojo::IOLoop::Client>.
my $cb = $loop->lock;
$loop = $loop->lock(sub {...});
A locking callback that decides if this loop is allowed to accept new
incoming connections, used to sync multiple server processes. The callback
should return true or false. Note that exceptions in this callback are not
captured.
A locking callback that decides if this loop is allowed to accept new incoming
connections, used to sync multiple server processes. The callback should
return true or false. Note that exceptions in this callback are not captured.
$loop->lock(sub {
my ($loop, $blocking) = @_;
Expand All @@ -399,8 +397,7 @@ connections indefinitely.
The maximum number of parallel connections this loop is allowed to handle
before stopping to accept new incoming connections, defaults to C<1000>.
Setting the value to C<0> will make this loop stop accepting new connections
and allow it to shutdown gracefully without interrupting existing
connections.
and allow it to shutdown gracefully without interrupting existing connections.
=head2 C<reactor>
Expand Down Expand Up @@ -467,8 +464,8 @@ L<Mojo::IOLoop::Client/"connect">.
my $delay = $loop->delay;
my $delay = $loop->delay(sub {...});
Get L<Mojo::IOLoop::Delay> object to synchronize events and subscribe to
event L<Mojo::IOLoop::Delay/"finish"> if optional callback is provided.
Get L<Mojo::IOLoop::Delay> object to synchronize events and subscribe to event
L<Mojo::IOLoop::Delay/"finish"> if optional callback is provided.
# Synchronize multiple events
my $delay = Mojo::IOLoop->delay(sub { say 'BOOM!' });
Expand Down Expand Up @@ -555,8 +552,8 @@ object from everywhere inside the process.
Mojo::IOLoop->start;
$loop->start;
Start the loop, this will block until C<stop> is called or no events are
being watched anymore.
Start the loop, this will block until C<stop> is called or no events are being
watched anymore.
# Start loop only if it is not running already
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
Expand Down Expand Up @@ -591,8 +588,8 @@ seconds.
=head1 DEBUGGING
You can set the C<MOJO_IOLOOP_DEBUG> environment variable to get some
advanced diagnostics information printed to C<STDERR>.
You can set the C<MOJO_IOLOOP_DEBUG> environment variable to get some advanced
diagnostics information printed to C<STDERR>.
MOJO_IOLOOP_DEBUG=1
Expand Down
7 changes: 2 additions & 5 deletions lib/Mojo/IOLoop/Server.pm
Expand Up @@ -143,11 +143,8 @@ sub listen {
}

sub generate_port {
IO::Socket::INET->new(
Listen => 5,
LocalAddr => '127.0.0.1',
Proto => 'tcp'
)->sockport;
IO::Socket::INET->new(Listen => 5, LocalAddr => '127.0.0.1', Proto => 'tcp')
->sockport;
}

sub start {
Expand Down
10 changes: 5 additions & 5 deletions lib/Mojo/IOLoop/Stream.pm
Expand Up @@ -275,9 +275,9 @@ global L<Mojo::IOLoop> singleton.
my $timeout = $stream->timeout;
$stream = $stream->timeout(45);
Maximum amount of time in seconds stream can be inactive before getting
closed automatically, defaults to C<15>. Setting the value to C<0> will allow
this stream to be inactive indefinitely.
Maximum amount of time in seconds stream can be inactive before getting closed
automatically, defaults to C<15>. Setting the value to C<0> will allow this
stream to be inactive indefinitely.
=head1 METHODS
Expand Down Expand Up @@ -306,8 +306,8 @@ Get handle for stream.
my $success = $stream->is_readable;
Quick non-blocking check if stream is readable, useful for identifying
tainted sockets.
Quick non-blocking check if stream is readable, useful for identifying tainted
sockets.
=head2 C<is_writing>
Expand Down
11 changes: 5 additions & 6 deletions lib/Mojo/JSON.pm
Expand Up @@ -266,8 +266,7 @@ sub _encode_string {
my $string = shift;

# Escape string
$string
=~ s|([\x00-\x1F\x7F\x{2028}\x{2029}\\"/\b\f\n\r\t])|$REVERSE{$1}|gs;
$string =~ s|([\x00-\x1F\x7F\x{2028}\x{2029}\\"/\b\f\n\r\t])|$REVERSE{$1}|gs;

# Stringify
return "\"$string\"";
Expand Down Expand Up @@ -349,11 +348,11 @@ Mojo::JSON - Minimalistic JSON
=head1 DESCRIPTION
L<Mojo::JSON> is a minimalistic and relaxed implementation of RFC 4627. While
it is possibly the fastest pure-Perl JSON parser available, you should not
use it for validation.
it is possibly the fastest pure-Perl JSON parser available, you should not use
it for validation.
It supports normal Perl data types like C<Scalar>, C<Array> reference,
C<Hash> reference and will try to stringify blessed references.
It supports normal Perl data types like C<Scalar>, C<Array> reference, C<Hash>
reference and will try to stringify blessed references.
[1, -2, 3] -> [1, -2, 3]
{"foo": "bar"} -> {foo => 'bar'}
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/JSON/Pointer.pm
Expand Up @@ -50,16 +50,16 @@ Mojo::JSON::Pointer - JSON Pointers
=head1 DESCRIPTION
L<Mojo::JSON::Pointer> implements JSON Pointers as described in
L<http://tools.ietf.org/html/draft-pbryan-zyp-json-pointer-02>.
L<http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer>.
=head1 METHODS
=head2 C<contains>
my $success = $p->contains($data, '/foo/1');
Check if data structure contains a value that can be identified with the
given JSON Pointer.
Check if data structure contains a value that can be identified with the given
JSON Pointer.
# True
$p->contains({foo => 'bar', baz => [4, 5, 6]}, '/foo');
Expand Down
11 changes: 5 additions & 6 deletions lib/Mojo/Message.pm
Expand Up @@ -50,8 +50,7 @@ sub body {
# Callback
if (ref $new eq 'CODE') {
weaken $self;
return $content->unsubscribe('read')
->on(read => sub { $self->$new(pop) });
return $content->unsubscribe('read')->on(read => sub { $self->$new(pop) });
}

# Set text content
Expand Down Expand Up @@ -543,8 +542,8 @@ L<Mojo::DOM>.
my $class = $message->json_class;
$message = $message->json_class('Mojo::JSON');
Class to be used for JSON deserialization with the C<json> method, defaults
to L<Mojo::JSON>.
Class to be used for JSON deserialization with the C<json> method, defaults to
L<Mojo::JSON>.
=head2 C<max_message_size>
Expand Down Expand Up @@ -737,8 +736,8 @@ Alias for L<Mojo::Content/"is_multipart">.
my $value = $message->json('/foo/bar');
Decode JSON message body directly using L<Mojo::JSON> if possible, returns
C<undef> otherwise. An optional JSON Pointer can be used to extract a
specific value with L<Mojo::JSON::Pointer>.
C<undef> otherwise. An optional JSON Pointer can be used to extract a specific
value with L<Mojo::JSON::Pointer>.
say $message->json->{foo}{bar}[23];
say $message->json('/foo/bar/23');
Expand Down

0 comments on commit 97eae38

Please sign in to comment.