Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Perl6 web-app

1,392 views

Published on

Perl6 web app

Published in: Engineering
  • Be the first to comment

Perl6 web-app

  1. 1. Writing web application on Perl6 (In progress) 2015.09.17 gotanda.pm tokuhirom
  2. 2. MoarVM’s IO has an issue. https://github.com/MoarVM/MoarVM/issues/165
  3. 3. Can’t pass fd between threads
  4. 4. orz
  5. 5. But we can call libc methods via NativeCall
  6. 6. First, call fork(2) via NativeCall
  7. 7. sub fork() returns Int is native { ... }
  8. 8. Easy.
  9. 9. 2nd, call waitpid(2) via NativeCall
  10. 10. module private { our sub waitpid(Int $pid, CArray[int] $status, Int $options) returns Int is native { ... } } sub waitpid(Int $pid, Int $options) is export { my $status = CArray[int].new; $status[0] = 0; my $ret_pid = private::waitpid($pid, $status, $options); return ($ret_pid, $status[0]); }
  11. 11. Easy!(Patches welcome…)
  12. 12. Then,
  13. 13. Let’s implement BSD sockets wrapper.
  14. 14. I don’t recommend to use NativeCall directly.
  15. 15. There’s too many C types/ structs. Too many wrapper types…
  16. 16. Write dll in C. And call it via NativeCall.
  17. 17. Raw::Socket BSD socket wrapper for Perl6
  18. 18. Then, write httpd.
  19. 19. Support features • parse request • send response • pre-fork • shotgun - reload code • Win32 support ← NEW!
  20. 20. Demo
  21. 21. soozy.fushihara.net #perl6
  22. 22. Thanks!

×