Skip to content

Commit

Permalink
removed experimental status from Mojo::IOLoop::Delay and removed defe…
Browse files Browse the repository at this point in the history
…r method from Mojo::IOLoop
  • Loading branch information
kraih committed Jan 12, 2012
1 parent 8858c83 commit e1ff24c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,6 +1,8 @@
This file documents the revision history for Perl extension Mojolicious.

2.44 2012-01-12 00:00:00
- Removed experimental status from Mojo::IOLoop::Delay.
- Removed defer method from Mojo::IOLoop.
- Improved syntax highlighting in perldoc browser slightly.
- Improved Mojo::Base tests.
- Improved documentation.
Expand Down
14 changes: 2 additions & 12 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -138,8 +138,6 @@ EOF
# DEPRECATED in Leaf Fluttering In Wind!
*connection_timeout = \&timeout;

sub defer { shift->timer(0 => @_) }

sub delay {
my ($self, $cb) = @_;
$self = $self->singleton unless ref $self;
Expand Down Expand Up @@ -622,22 +620,14 @@ might change without warning!
...
});
=head2 C<defer>
Mojo::IOLoop->defer(sub {...});
$loop->defer(sub {...});
Invoke callback on next reactor tick. Note that this method is EXPERIMENTAL
and might change without warning!
=head2 C<delay>
my $delay = Mojo::IOLoop->delay;
my $delay = $loop->delay;
my $delay = $loop->delay(sub {...});
Get L<Mojo::IOLoop::Delay> object to synchronize events. Note that this
method is EXPERIMENTAL and might change without warning!
Get L<Mojo::IOLoop::Delay> object to synchronize events and subscribe to
C<finish> event if optional callback is provided.
# Synchronize multiple events
my $delay = Mojo::IOLoop->delay(sub { say 'BOOM!' });
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojo/IOLoop/Delay.pm
Expand Up @@ -54,8 +54,7 @@ Mojo::IOLoop::Delay - Synchronize events
=head1 DESCRIPTION
L<Mojo::IOLoop::Delay> synchronizes events for L<Mojo::IOLoop>. Note that
this module is EXPERIMENTAL and might change without warning!
L<Mojo::IOLoop::Delay> synchronizes events for L<Mojo::IOLoop>.
=head1 EVENTS
Expand Down
8 changes: 4 additions & 4 deletions t/mojo/delay.t
Expand Up @@ -19,7 +19,7 @@ my $delay = Mojo::IOLoop::Delay->new;
my @results;
for my $i (0, 0) {
$delay->begin;
Mojo::IOLoop->defer(sub { push @results, $i; $delay->end });
Mojo::IOLoop->timer(0 => sub { push @results, $i; $delay->end });
}
$delay->wait;
is_deeply \@results, [0, 0], 'right results';
Expand All @@ -30,7 +30,7 @@ my $finished;
$delay->on(finish => sub { shift; $finished = [@_, 'works!'] });
for my $i (0, 0) {
$delay->begin;
Mojo::IOLoop->defer(sub { $delay->end($i) });
Mojo::IOLoop->timer(0 => sub { $delay->end($i) });
}
@results = $delay->wait;
is_deeply $finished, [0, 0, 'works!'], 'right results';
Expand All @@ -40,7 +40,7 @@ is_deeply \@results, [0, 0], 'right results';
$delay = Mojo::IOLoop::Delay->new;
for my $i (3, 3) {
$delay->begin;
Mojo::IOLoop->defer(sub { $delay->end($i) });
Mojo::IOLoop->timer(0 => sub { $delay->end($i) });
}
is $delay->wait, 3, 'right results';

Expand All @@ -49,7 +49,7 @@ $finished = undef;
$delay = Mojo::IOLoop->delay(sub { shift; $finished = [@_, 'too!'] });
for my $i (1, 1) {
my $cb = $delay->begin;
Mojo::IOLoop->defer(sub { $delay->$cb($i) });
Mojo::IOLoop->timer(0 => sub { $delay->$cb($i) });
}
@results = $delay->wait;
is_deeply $finished, [1, 1, 'too!'], 'right results';
Expand Down
4 changes: 2 additions & 2 deletions t/mojo/ioloop.t
Expand Up @@ -34,8 +34,8 @@ is ref $loop->iowatcher, 'MyWatcher', 'right class';

# Double start
my $err;
Mojo::IOLoop->defer(
sub {
Mojo::IOLoop->timer(
0 => sub {
eval { Mojo::IOLoop->start };
$err = $@;
Mojo::IOLoop->stop;
Expand Down
4 changes: 2 additions & 2 deletions t/mojolicious/lite_app.t
Expand Up @@ -461,8 +461,8 @@ get '/redirect_no_render' => sub {
# GET /redirect_callback
get '/redirect_callback' => sub {
my $self = shift;
Mojo::IOLoop->defer(
sub {
Mojo::IOLoop->timer(
0 => sub {
$self->res->code(301);
$self->res->body('Whatever!');
$self->redirect_to('http://127.0.0.1/foo');
Expand Down

0 comments on commit e1ff24c

Please sign in to comment.