perl – 如何打开OO风格的管道?
发布时间:2020-12-15 21:44:47 所属栏目:大数据 来源:网络整理
导读:我用新的样式重写了我的旧代码,如下所示: #old styleopen(FD,"file");#new style$fh = IO::File-new("file","r"); 文件还可以,但我不知道如何打开管道. # read from pipes.open(PIPE,"some_program |");# write to pipes.open(PIPE,"| some_program"); 如何
我用新的样式重写了我的旧代码,如下所示:
#old style open(FD,"file"); #new style $fh = IO::File->new("file","r"); 文件还可以,但我不知道如何打开管道. # read from pipes. open(PIPE,"some_program |"); # write to pipes. open(PIPE,"| some_program"); 如何处理OO Style IO中的管道? 添加: # read from pipes. $pipe = IO::Pipe->new; $pipe->reader('some_program'); $data = <$pipe>; # write from pipes. $pipe = IO::Pipe->new; $pipe->writer('some_program'); print $pipe "foo,bar,baz"; 解决方法
你应该看看
IO::Pipe和
FileHandle.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |