mango icon indicating copy to clipboard operation
mango copied to clipboard

Docs refer to `Mojo::IOLoop::Delay`, which has been removed in 9.0

Open AdamWill opened this issue 4 years ago • 3 comments

The examples in the docs include one that relies on Mojo::IOLoop::Delay, which has been removed from Mojolicious 9.0. Not sure if there's an alternative way to do what that example does, @kraih would know.

AdamWill avatar May 07 '21 22:05 AdamWill

I don't think Mango is maintained anymore.

kraih avatar May 07 '21 22:05 kraih

Ah, now I poke through a checkout, there's actually quite a lot of code and test code that use Delay. So this module is incompatible with Mojo 9.

AdamWill avatar May 07 '21 22:05 AdamWill

There is a patch in fortl's fork in commit https://github.com/fortl/mango/commit/90f13e16fd0f8053479fcf2e497672463061e7ea. It's mostly a white-space shuffle. Without it, it boils down to:

--- a/lib/Mango/Auth/SCRAM.pm
+++ b/lib/Mango/Auth/SCRAM.pm
@@ -34,11 +34,9 @@ sub _authenticate {
         password      => $pass
     );
 
-  my $delay = Mojo::IOLoop::Delay->new;
+    my $loop = Mojo::IOLoop->new;
     my $conv_id;
 
-  my $end = $delay->begin;
-
     my $command = $self->_cmd_sasl_start($scram_client->first_msg);
     $mango->_fast($id, $db, $command, sub {
         my ($mango, $err, $doc) = @_;
@@ -54,12 +52,12 @@ sub _authenticate {
             $mango->_fast($id, $db, $command, sub {
                 my ($mango, $err, $doc) = @_;
                 $mango->emit(connection => $id)->_next;
-        $end->();
+                $loop->stop;
             })
         })
     });
 
-  $delay->wait;
+    $loop->start;
 }

ppisar avatar May 10 '21 11:05 ppisar