Created
June 13, 2019 22:36
-
-
Save Whateverable/0cbb8af44287f473e978d70ec8c97b9d to your computer and use it in GitHub Desktop.
evalable6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my Supplier::Preserving $msg .= new; my $senser = supply { whenever $msg.Supply.on-close({ say "the message supply closed" }) { emit $_; }; }; start { react { whenever $senser { .say; if (False, False, False, True).pick { say "cannot write to closed socket"; die "oh no" }; CATCH { done } } } }; for ^20 { $msg.emit($_); say "sent $_"; }; $msg.done; sleep 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sent 0 | |
sent 1 | |
sent 2 | |
sent 3 | |
sent 4 | |
sent 5 | |
sent 6 | |
sent 7 | |
sent 8 | |
sent 9 | |
sent 10 | |
sent 11 | |
sent 12 | |
sent 13 | |
sent 14 | |
sent 15 | |
sent 16 | |
sent 17 | |
sent 18 | |
sent 19 | |
0 | |
cannot write to closed socket | |
the message supply closed | |
the message supply closed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment