Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter Bug #5112

Closed
p6rt opened this issue Feb 2, 2016 · 3 comments
Closed

Parameter Bug #5112

p6rt opened this issue Feb 2, 2016 · 3 comments

Comments

@p6rt
Copy link

p6rt commented Feb 2, 2016

Migrated from rt.perl.org#127454 (status was 'resolved')

Searchable as RT127454$

@p6rt
Copy link
Author

p6rt commented Feb 2, 2016

From cchayniepublic@gmail.com

Hello,

I think is a bug, and I think it's in Perl6. I was not able to find a
work around for it in Perl6. My solution was to compile it in Perl.

The reported error is​:

Net​::WebSocket​::Server parameter 'on_tick' expected type is CODE at -e
line 0.

  in method invoke
at /home/ubuntu/.rakudobrew/moar-nom/install/share/perl6/site/sources/286B9E53482EA4E593D57C652B8B62AFB56E5F0E line 482
  in method new
at /home/ubuntu/.rakudobrew/moar-nom/install/share/perl6/site/sources/286B9E53482EA4E593D57C652B8B62AFB56E5F0E line 741
  in block <unit> at ./test.pl line 7

Here is the program, in its entirety.


#!/usr/bin/env perl6

use Inline​::Perl5;

use Net​::WebSocket​::Server​:from<Perl5>;

my $ws = Net​::WebSocket​::Server.new(
  listen => 3000,
  tick_period => 5,
  on_tick => sub {
  my ($serv) = @​_;
  $_.send_utf8(time) for $serv.connections;
  },
  ).start;


Sincerely,

Craig Haynie
Manchester, NH

@p6rt
Copy link
Author

p6rt commented Feb 7, 2016

From @niner

This was actually an issue with Inline​::Perl5 that wrapped Perl 6 Callables in objects and used overload to provide callability. Code in Net​::WebSocket​::Server however expected a real genuine CODE reference and would accept nothing else. So that's what we now create in Inline​::Perl5 v0.4.

Please upgrade Inline​::Perl5 and try again. Should work now.

Thanks for the report!

@p6rt p6rt closed this as completed Feb 7, 2016
@p6rt
Copy link
Author

p6rt commented Feb 7, 2016

@niner - Status changed from 'new' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant