小编Shn*_*son的帖子

7
推荐指数
1
解决办法
111
查看次数

如果路径包含非拉丁字符,则会出错

操作系统:Windows 10 Perl6:这是在MoarVM版本2018.04.1上构建的Rakudo Star版本2018.04.1,实现了Perl 6.c.

例:

perl6 C:\Users\quest\Desktop\example.pl
# sucess

perl6 "C:\Users\quest\Desktop\??\Perl 6\web-scraping\request.pl"
# Could not open C:\Users\quest\Desktop\????\Perl 6\web-scraping\request.pl. Failed to open file C:\Users\quest\Desktop\????\Perl 6\web-scraping\request.pl: No such file or directory
Run Code Online (Sandbox Code Playgroud)

Python 3示例:

py "C:\Users\quest\Desktop\??\py\3\timetest.py"
# sucess
Run Code Online (Sandbox Code Playgroud)

perl6

7
推荐指数
1
解决办法
181
查看次数

捕捉并抛出自定义异常

“ CATCH”是否应该在“ throw”之后严格调用?

范例1:

say 'Hello World!';

class E is Exception { method message() { "Just stop already!" } }

CATCH {
    when E {
            .resume;
    }
}

E.new.throw;
Run Code Online (Sandbox Code Playgroud)

错误:

找不到方法“接收器”:在/tmp/739536251/main.pl6第11行的块中没有方法缓存,也没有。^ find_method

范例2:

say 'Hello World!';

class E is Exception { method message() { "Just stop already!" } }

E.new.throw;

CATCH {
    when E {
            .resume;
    }
}
Run Code Online (Sandbox Code Playgroud)

没错

perl6 raku

7
推荐指数
1
解决办法
121
查看次数

Perl 6 udp socket:如何从服务器读取响应?

server-udp.pl

my $socket = IO::Socket::Async.bind-udp('localhost', 3333);
react {
    whenever $socket.Supply -> $v {
        if $v.chars > 0 {
            $v.print;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

client-udp.pl

my $socket = IO::Socket::Async.udp();
await $socket.print-to('localhost', 3333, "\nHello, Perl 6!");
Run Code Online (Sandbox Code Playgroud)

客户端如何读取服务器响应?
也许这还没有实现?

例如在Perl 5中:

client.pl

...
my $data_send = "Test 1234567890";
$client_socket->send( $data_send )
    or die "Client error while sending: $!\n";

# read operation
$client_socket->recv( my $data_rcv , 1024 )
    or die "Client error while received: $!\n";

print "Received data: $data_rcv\n";
...
Run Code Online (Sandbox Code Playgroud)

sockets perl6

5
推荐指数
2
解决办法
431
查看次数

如何在shell函数中转义引号?

这是基于实现Perl 6.d的MoarVM版本2019.03构建的Rakudo Star版本2019.03.1。

Windows 10

例子:

1)错误:

shell 'mysqldump -uroot -ppassword asppmr > D:\b\29-09-2019 19-45-18\asppmr.sql';
Run Code Online (Sandbox Code Playgroud)

mysqldump:[警告]在命令行界面上使用密码可能不安全。mysqldump:找不到表:“ 19-45-18 \ asppmr.sql” Proc.new(in => IO :: Pipe,out => IO :: Pipe,err => IO :: Pipe,exitcode => 6,信号=> 0,pid => 11928,命令=>(“ mysqldump -uroot -ppassword asppmr> D:\ b \ 29-09-2019 19-45-18 \ asppmr.sql”))

2)错误:

shell 'mysqldump -uroot -ppassword asppmr > "D:\b\29-09-2019 19-45-18\asppmr.sql"';
Run Code Online (Sandbox Code Playgroud)

??????????????? ?????? ??????? ??????,????? ?????? ??? ?????? ????。Proc.new(in => IO :: Pipe,out => IO :: Pipe,err => IO :: Pipe,exitcode => 1,信号=> 0,pid …

perl6 raku

5
推荐指数
1
解决办法
97
查看次数

const PHP 解析错误

// define('DOCROOT', realpath(dirname(__DIR__)));
// good

const DOCROOT = realpath(dirname(__DIR__));
// PHP Parse error:  syntax error, unexpected '(', expecting ',' or ';' in
Run Code Online (Sandbox Code Playgroud)

为什么会出错?

php

0
推荐指数
1
解决办法
2695
查看次数

标签 统计

perl6 ×5

raku ×2

sockets ×2

php ×1

udp ×1