mirror of git://git.qorg11.net/kill9.git
Fixed raku example
This commit is contained in:
parent
d05f4f6837
commit
b591de609b
|
@ -48,18 +48,18 @@ Class Socket {
|
|||
has Int $.sockfd;
|
||||
|
||||
method new ($path) {
|
||||
my $mfd = create_socket();
|
||||
connect_socket($mfd,$path);
|
||||
self.bless(sockfd => $mfd);
|
||||
my $mfd = create_socket(); # This is a function written in C called with NativeCall
|
||||
connect_socket($mfd,$path); # Idem
|
||||
self.bless(sockfd => $mfd); # Give the attributes to the object
|
||||
}
|
||||
method send($str) {
|
||||
my $len = $str.chars;
|
||||
write_to_sock(self.sockfd, $str, $len);
|
||||
write_to_sock(self.sockfd, $str, $len); # C func
|
||||
}
|
||||
}
|
||||
|
||||
my $sock = Socket.new("path/to/socket");
|
||||
$sock.write("hello from raku!");
|
||||
$sock.send("hello from raku!");
|
||||
</pre>
|
||||
|
||||
Calling C functions from Raku is stupidly easy, to do this only use
|
||||
|
|
Loading…
Reference in New Issue