我有一个 perl 和 embperl 两种格式的示例程序
Perl 版本可以作为 CGI 运行,但 embperl 版本则不能运行。
任何建议或解决方案的指示将不胜感激
操作系统:Linux 版本 2.6.35.6-48.fc14.i686.PAE (...) (gcc 版本 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) ) #1 SMP 10 月 22 日星期五 15:27: 53 世界标准时间 2010
注意:我最初将这个问题发布给 perlmonks[x] http://www.perlmonks.org/?node_id=1086395和 embperl 邮件列表[x] http://www.gossamer-threads.com/lists/modperl/embperl/106070但没有得到解决方案。
Perl 工作脚本
#!/usr/bin/perl
use warnings;
use strict;
use IPC::Open3;
print "Content-type: text/plain\n\n";
my $cmd = 'ls';
my $pid = open3(*HIS_IN, *HIS_OUT, *HIS_ERR, $cmd);
close(HIS_IN); # give end of file to kid, or feed him
my @outlines = <HIS_OUT>; # read till EOF
my @errlines = <HIS_ERR>; # XXX: block potential if massive
print "STDOUT: ", @outlines, "\n";
print "STDERR: ", @errlines, "\n";
waitpid( $pid, 0 );
my $child_exit_status = $? >> 8;
print "child_exit_status: $child_exit_status\n";
embperl 非工作脚本
[-
use warnings;
use strict;
use IPC::Open3;
my $cmd = 'ls';
my $pid = open3(*HIS_IN, *HIS_OUT, *HIS_ERR, $cmd);
close(HIS_IN); # give end of file to kid, or feed him
my @outlines = <HIS_OUT>; # read till EOF
my @errlines = <HIS_ERR>; # XXX: block potential if massive
print OUT "STDOUT: ", @outlines, "\n";
print OUT "STDERR: ", @errlines, "\n";
waitpid( $pid, 0 );
my $child_exit_status = $? >> 8;
print OUT "child_exit_status: $child_exit_status\n";
-]
这是我收到的输出
STDERR: ls: write error: Bad file descriptor
child_exit_status: 2