open3.pm

[prev] [thread] [next] [Date index for 2005/02/09]

From: Femi Oshagbemi
Subject: open3.pm
Date: 15:34 on 09 Feb 2005
Hello, im very new to perl, modperl and apache but im doing a university 
project to use modperl to provide a connection to a localised Gnu Octave 
installation.

I have come against a problem when trying to run this simple test program:-

package Apache::OctavePrototype;

use FileHandle;
use IPC::Open2;
use Apache::Const -compile => ':common';
use Apache::Request;
use Apache::Process;
use Apache::Upload;

sub handler {

    my $r = Apache::Request->new(shift);
    my $octave_cmd = $r->param('octave_cmd') || 'No Command';
    my $output_text;
    $r->content_type('text/html');

	my $pid = open2( \*ReaderFH, \*WriterFH, "sh.exe -e /bin/start_octave.sh");

	my($read);
	for (1..11)
	{
		$read = <ReaderFH>;
		$output_text = $output_text.$read;
	}

                $r->print($output_text);

	return OK;
}

1;
__END__


I get an error generated in the apache error log file:-

C:/Perl/site/lib/Apache2/Apache/OctavePrototype.pm line 19\n
[Wed Feb 09 13:25:34 2005] [error] [client 127.0.0.1] open2: Can't close: No 
such file or directory at


Traced to the lines in the IPC:Open3 module :-

foreach $fd (@$fds) {
	$fd->{handle}->fdopen($fd->{tmp_copy}, $fd->{mode});
	$fd->{tmp_copy}->close or croak "Can't close: $!";
    }


Im using a perl/apache binary - Perl-5.8-win32-bin.exe downloaded form 
http://httpd.apache.org/ and windows xp.


Anyone with any help or ideas please let me know

thanks in advance


open3.pm
Femi Oshagbemi 15:34 on 09 Feb 2005

Re: open3.pm
Stas Bekman 23:35 on 09 Feb 2005

Generated at 10:21 on 11 Feb 2005 by mariachi v0.52