Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从perl脚本中连接两个外部进程?_Perl_Sockets_Vim_Xdebug - Fatal编程技术网

如何从perl脚本中连接两个外部进程?

如何从perl脚本中连接两个外部进程?,perl,sockets,vim,xdebug,Perl,Sockets,Vim,Xdebug,我试图做的是让Xdebug调试器在vim会话中的文件上运行,所有这些都来自perl脚本。如果我想从命令行执行此操作,我会打开vim,然后在vim中发出一个命令(特定于调试器),使vim侦听端口9000(在正常模式下按F5),然后在浏览器中打开我要调试的页面,这将启动vim中的调试会话。我成功地做到了这一点 为了在perl中实现这一点,我的想法是使用fork和系统调用 use LWP::Simple; if ($pid = fork) { system('vi -c ":normal ^

我试图做的是让Xdebug调试器在vim会话中的文件上运行,所有这些都来自perl脚本。如果我想从命令行执行此操作,我会打开vim,然后在vim中发出一个命令(特定于调试器),使vim侦听端口9000(在正常模式下按F5),然后在浏览器中打开我要调试的页面,这将启动vim中的调试会话。我成功地做到了这一点

为了在perl中实现这一点,我的想法是使用fork和系统调用

use LWP::Simple;

if ($pid = fork) {
    system('vi -c ":normal ^[[15~"');
} else {
    sleep;
    get 'http://localhost/homepage/index.php?XDEBUG_SESSION_START=1';
    exit(0);
}
(“-c”:normal^[[15~””选项通过等待端口9000上的新连接来启动vim。)


这不起作用。据我所知,问题似乎与套接字有关。有没有一种方法可以让太多进程通过perl中的这种连接相互通信?

使vim中的连接起作用:

vim -c 'let x = system("sleep 2; wget http://localhost/homepage/index.php?XDEBUG_SESSION_START=1; &")' -c 'normal ^[[15~'