📄 程嶏清单 17-11.txt
字号:
程序清单17-11:set_event_handler.pl
sub set_event_handler {
shift unless ref($_[0]); # 如果第一个参数为包名,就执行shift函数
my ($handle, %args) = @_;
my $callback;
if (exists $args{'write'}) {
$callback = $args{'write'};
if ($callback) {
$wt_callbacks{$handle} = $callback;
$wt_handles->add($handle);
} else {
delete $wt_callbacks{$handle};
$wt_handles->remove($handle);
}
}
if (exists $args{'read'}) {
$callback = $args{'read'};
if ($callback) {
$rd_callbacks{$handle} = $callback;
$rd_handles->add($handle);
} else {
delete $rd_callbacks{$handle};
$rd_handles->remove($handle);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -