Skip to content

Commit

Permalink
small documentation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 23, 2012
1 parent 71f299a commit 6c2cf63
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/Content/MultiPart.pm
Expand Up @@ -142,7 +142,7 @@ sub _parse_multipart {
# Parse
$self->{multi_state} ||= 'multipart_preamble';
my $boundary = $self->boundary;
while (!$self->is_finished) {
until ($self->is_finished) {

# Preamble
if (($self->{multi_state} || '') eq 'multipart_preamble') {
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Reactor.pm
Expand Up @@ -170,7 +170,7 @@ Create a new timer, invoking the callback after a given amount of time in
seconds.
# Invoke as soon as possible
$reactor->timer(0 => sub { say 'First tick.' });
$reactor->timer(0 => sub { say 'Next tick.' });
=head2 C<watch>
Expand Down
5 changes: 1 addition & 4 deletions lib/Mojo/Reactor/EV.pm
Expand Up @@ -60,10 +60,7 @@ sub _timer {
my $id = $self->SUPER::_timer(0, 0, $cb);
weaken $self;
$self->{timers}->{$id}->{watcher} = EV::timer(
$after,
$recurring ? $after : 0,
sub {
my $w = shift;
$after => ($recurring ? $after : 0) => sub {
$self->_sandbox("Timer $id", $self->{timers}->{$id}->{cb});
delete $self->{timers}->{$id} unless $recurring;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojo/Reactor/Poll.pm
Expand Up @@ -27,8 +27,9 @@ sub one_tick {
$self->{running} = 1;

# Wait for one event
my $i = 0;
while (!$i) {
my $i = 0;
my $poll = $self->_poll;
until ($i) {

# Stop automatically if there is nothing to watch
return $self->stop unless keys %{$self->{timers}} || keys %{$self->{io}};
Expand All @@ -40,15 +41,14 @@ sub one_tick {

# I/O
if (keys %{$self->{io}}) {
my $poll = $self->_poll;
$poll->poll($timeout);
++$i and $self->_sandbox('Read', $self->{io}->{fileno $_}->{cb}, 0)
for $poll->handles(POLLIN | POLLHUP | POLLERR);
++$i and $self->_sandbox('Write', $self->{io}->{fileno $_}->{cb}, 1)
for $poll->handles(POLLOUT);
}

# Wait for timeout
# Wait for timeout if poll can't be used
elsif ($timeout) { usleep $timeout * 1000000 }

# Timers
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/CGI.pm
Expand Up @@ -22,7 +22,7 @@ sub run {

# Request body
binmode STDIN;
while (!$req->is_finished) {
until ($req->is_finished) {
my $read = STDIN->read(my $buffer, CHUNK_SIZE, 0);
last unless $read;
$req->parse($buffer);
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/PSGI.pm
Expand Up @@ -21,7 +21,7 @@ sub run {

# Request body
my $len = $env->{CONTENT_LENGTH};
while (!$req->is_finished) {
until ($req->is_finished) {
my $chunk = ($len && $len < CHUNK_SIZE) ? $len : CHUNK_SIZE;
my $read = $env->{'psgi.input'}->read(my $buffer, $chunk, 0);
last unless $read;
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -714,7 +714,7 @@ Less commonly used and more powerful features.

=head2 Internationalization

Thanks to L<Locale::Maketext>, all you need for basic internationalization
Thanks to L<Locale::Maketext> all you need for basic internationalization
support in your application is the plugin L<Mojolicious::Plugin::I18N> and a
few lexicon classes.

Expand All @@ -740,7 +740,7 @@ Preferred languages will be automatically detected from the
C<Accept-Language> header or can be manually changed with the helper
L<Mojolicious::Plugin::I18N/"languages">.

$ ./myapp.pl get / -H 'Accept-Language: de'
$ ./myapp.pl get -H 'Accept-Language: de' /

=head2 Chunked transfer encoding

Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Plugin/PoweredBy.pm
Expand Up @@ -8,8 +8,8 @@ use Mojo::Base 'Mojolicious::Plugin';
# and the octopus ate all his acorns.
# And also he got a racecar. Is any of this getting through to you?"
sub register {
my ($self, $app, $args) = @_;
my $name = $args->{name} || 'Mojolicious (Perl)';
my ($self, $app, $conf) = @_;
my $name = $conf->{name} || 'Mojolicious (Perl)';
$app->hook(before_dispatch =>
sub { shift->res->headers->header('X-Powered-By' => $name) });
}
Expand Down

0 comments on commit 6c2cf63

Please sign in to comment.