Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix example (supply changes)
Otherwise I get this error:

Cannot directly create a Supply. You might want:
 - To use a Supplier in order to get a live supply
 - To use Supply.on-demand to create an on-demand supply
 - To create a Supply using a supply block
  in sub MAIN at chat.pl6 line 10
  in block <unit> at chat.pl6 line 6

I don't know if that's the best way to do it, but at least it works.
  • Loading branch information
AlexDaniel committed Mar 18, 2016
1 parent 4e3c606 commit 3ddc68d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions eg/chat.pl6
Expand Up @@ -7,7 +7,8 @@ sub MAIN(Int :$port=80) {
my $html = $=finish;
$html ~~ s:g/'<<<PORT>>>'/$port/;

my $supply = Supply.new;
my $supplier = Supplier.new;
my $supply = $supplier.Supply;

my $s = HTTP::Server::Tiny.new(port => $port);
$s.run(-> %env {
Expand All @@ -27,7 +28,7 @@ sub MAIN(Int :$port=80) {
say 'ready';
},
on-text => -> $ws, $txt {
$supply.emit($txt);
$supplier.emit($txt);

say 'sent.';
if $txt eq 'quit' {
Expand Down

0 comments on commit 3ddc68d

Please sign in to comment.