perl 回调必须是函数引用

来源:互联网 发布:jquery源码分析 编辑:程序博客网 时间:2024/06/03 09:24
[root@wx03 lib]# cat a1.pl use AE;use AnyEvent;##定义watchmy $t = AnyEvent->timer(        after    => 0,        interval => 5,        cb       => sub {print test."\n";}    );    ##不要再每秒打印时间    ##undef $t;    my $cv = AnyEvent->condvar;    $cv->recv;[root@wx03 lib]# perl a1.pl testtest[root@wx03 lib]# cat a1.pl use AE;use AnyEvent;##定义watchmy $t = AnyEvent->timer(        after    => 0,        interval => 5,        cb       =>  print test."\n"    );    ##不要再每秒打印时间    ##undef $t;    my $cv = AnyEvent->condvar;    $cv->recv;[root@wx03 lib]# perl a1.pl test1: callback must be a CODE reference or another callable object at /usr/local/perl/lib/site_perl/5.22.1/x86_64-linux/AnyEvent/Impl/EV.pm line 50.回调必须是一个函数引用或者而另外的回调对象

0 0