Mercurial > hg > Others > Abyss-Server
view lib/Abyss/Server.pm6 @ 4:1ad45c44e12f default tip
add time count script
author | e165727 <e165727@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 15 Feb 2020 05:02:22 +0900 |
parents | d7762f4e8bfa |
children |
line wrap: on
line source
use v6.c; unit class Abyss::Server:ver<0.0.1>:auth<cpan:ANATOFUZ>; use MONKEY-SEE-NO-EVAL; use IO::Socket::Unix; use NativeCall; sub close(int32) returns int32 is native { ... } sub dup(int32 $old) returns int32 is native { ... } sub dup2(int32 $new, int32 $old) returns int32 is native { ... } method readeval { my $listen = IO::Socket::Unix.new( :listen, :localhost<localhost>, :localport(3333) ); my $backup = dup(1); say DateTime.now; loop { my $conn = $listen.accept; my $sock_msg; my $buf = $conn.recv(); $sock_msg = $buf; close(1); dup2($conn.native-descriptor(), 1); EVALFILE $sock_msg; dup2($backup, 1); close($backup); $conn.close; } $listen.close; } =begin pod =head1 NAME Abyss::Server - blah blah blah =head1 SYNOPSIS =begin code :lang<perl6> use Abyss::Server; =end code =head1 DESCRIPTION Abyss::Server is ... =head1 AUTHOR AnaTofuZ <anatofuz@gmail.com> =head1 COPYRIGHT AND LICENSE Copyright 2020 AnaTofuZ This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. =end pod