POE::Wheel::Run::Win32模块,参数不能传递
时间:2010-09-08
来源:互联网
发现POE::Wheel::Run::Win32有一个问题··不知道是模块的问题··还是我代码有问题,
有参数就不能运行test.pl,没参数可以~~·不知道什么问题~~百思不得其解~~~望指教~~
先上代码,代码如下:(和模块自带的例子一样··就是Program 那里改了一下)
复制代码
test.pl的代码如下:
复制代码
有参数就不能运行test.pl,没参数可以~~·不知道什么问题~~百思不得其解~~~望指教~~
先上代码,代码如下:(和模块自带的例子一样··就是Program 那里改了一下)
- use warnings;
- use strict;
-
- use POE qw( Wheel::Run::Win32 );
-
- POE::Session->create(
- inline_states => {
- _start => \&on_start,
- got_child_stdout => \&on_child_stdout,
- got_child_stderr => \&on_child_stderr,
- got_child_close => \&on_child_close,
- got_child_signal => \&on_child_signal,
- }
- );
-
- POE::Kernel->run();
- exit 0;
-
- sub on_start {
- my $child = POE::Wheel::Run::Win32->new(
- Program => sub{exec('test.pl','2.txt');},#有后面那个‘2.txt’就不行···程序会出错,没有参数的话··可以运行
- # Program => 'test.pl',#不行
- StdoutEvent => "got_child_stdout",
- StderrEvent => "got_child_stderr",
- CloseEvent => "got_child_close",
- );
-
- $_[KERNEL]->sig_child($child->PID, "got_child_signal");
-
- # Wheel events include the wheel's ID.
- $_[HEAP]{children_by_wid}{$child->ID} = $child;
-
- # Signal events include the process ID.
- $_[HEAP]{children_by_pid}{$child->PID} = $child;
-
- print(
- "Child pid ", $child->PID,
- " started as wheel ", $child->ID, ".\n"
- );
- }
-
- sub run
- {
- exec 'D:\\test-area\\remote\\test.pl';
- }
- # Wheel event, including the wheel's ID.
- sub on_child_stdout {
- my ($stdout_line, $wheel_id) = @_[ARG0, ARG1];
- my $child = $_[HEAP]{children_by_wid}{$wheel_id};
- print "pid ", $child->PID, " STDOUT: $stdout_line\n";
- }
-
- # Wheel event, including the wheel's ID.
- sub on_child_stderr {
- my ($stderr_line, $wheel_id) = @_[ARG0, ARG1];
- my $child = $_[HEAP]{children_by_wid}{$wheel_id};
- print "pid ", $child->PID, " STDERR: $stderr_line\n";
- }
-
- # Wheel event, including the wheel's ID.
- sub on_child_close {
- my $wheel_id = $_[ARG0];
- my $child = delete $_[HEAP]{children_by_wid}{$wheel_id};
-
- # May have been reaped by on_child_signal().
- unless (defined $child) {
- print "wid $wheel_id closed all pipes.\n";
- return;
- }
-
- print "pid ", $child->PID, " closed all pipes.\n";
- delete $_[HEAP]{children_by_pid}{$child->PID};
- }
-
- sub on_child_signal {
- print "pid $_[ARG1] exited with status $_[ARG2].\n";
- my $child = delete $_[HEAP]{children_by_pid}{$_[ARG1]};
-
- # May have been reaped by on_child_close().
- return unless defined $child;
-
- delete $_[HEAP]{children_by_wid}{$child->ID};
- }
- use strict;
- my $file = shift @ARGV;
- #my $file ='1.txt';
- my $str = 'the return values';
- print $str,"\n";
- open F,">",$file;
- print F $str,"\n";
- close F;
作者: wfnh 发布时间: 2010-09-08
顶上
作者: wfnh 发布时间: 2010-09-08
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28