prematurely closed filehandle

J

Jim

Hi,
The problem description is below. I would like for Script 2 to work
within IIS. Any feedback would be greatly appreciated. Thanks!
Jim

Windows XP SP2
ActivePerl 5.8.2 Build 808

Script 1
Run from the command line, this script works just fine, with or without
#!/usr/local/bin/perl -w

#!/usr/local/bin/perl -w
use CGI qw:)standard);
use Win32::OLE;
open RUNBLAST2, "| C:\\Inetpub\\wwwroot\\port\\blast\\blastall -e .01
-p blastp -d C:\\Inetpub\\wwwroot\\port\\blast\\db\\gbpoxpep -F F -m 7
-o C:\\Inetpub\\wwwroot\\webtemp\\152895786322021484375.xml ";
print RUNBLAST2 ">CNPV-WC93:007\nMKSYDDKVKE LYSAIESNDK";
close RUNBLAST2 ;
exit(0);


Script2
Accessed via IIS, this script has a problem:
print() on closed filehandle RUNBLAST2 at
c:\inetpub\wwwroot\port\blast\blast_xml_run_p.pl line 8.
If I remove #!/usr/local/bin/perl -w, the script still doesn't work,
but no error message is returned.

#!/usr/local/bin/perl -w
use CGI qw:)standard);
use Win32::OLE;
print header(), start_html(-title=>'Test',
#-BACKGROUND=>'pebblebackgrd.gif',
-BGCOLOR=>'#FFFFFF');
open RUNBLAST2, "| C:\\Inetpub\\wwwroot\\port\\blast\\blastall -e .01
-p blastp -d C:\\Inetpub\\wwwroot\\port\\blast\\db\\gbpoxpep -F F -m 7
-o C:\\Inetpub\\wwwroot\\webtemp\\152895786322021484376.xml ";
print RUNBLAST2 ">CNPV-WC93:007\nMKSYDDKVKE LYSAIESNDK";
close RUNBLAST2 ;
print end_html();
exit(0);
 
D

Dr.Ruud

Jim schreef:
open RUNBLAST2, "| C:\\Inetpub\\wwwroot\\port\\blast\\blastall -e .01
-p blastp -d C:\\Inetpub\\wwwroot\\port\\blast\\db\\gbpoxpep -F F -m 7
-o C:\\Inetpub\\wwwroot\\webtemp\\152895786322021484375.xml ";

You should always check for the open to succeed.

#!perl
use strict ;
use warnings ;
use CGI qw:)standard) ;
use Win32::OLE ;

my $root = 'C:/Inetpub/wwwroot' ;
my $blast = "$root/port/blast" ;

open RUNBLAST2,
"| $blast/blastall" .
" -e .01" .
" -p blastp" .
" -d $blast/db/gbpoxpep" .
" -F F" .
" -m 7" .
" -o $root/webtemp/152895786322021484375.xml"
or die "Ouch: $!" ;

etc.

(untested)
 
J

Jim

Dr.Ruud said:
Jim schreef:


You should always check for the open to succeed.

#!perl
use strict ;
use warnings ;
use CGI qw:)standard) ;
use Win32::OLE ;

my $root = 'C:/Inetpub/wwwroot' ;
my $blast = "$root/port/blast" ;

open RUNBLAST2,
"| $blast/blastall" .
" -e .01" .
" -p blastp" .
" -d $blast/db/gbpoxpep" .
" -F F" .
" -m 7" .
" -o $root/webtemp/152895786322021484375.xml"
or die "Ouch: $!" ;

etc.

(untested)

Dr. Ruud,

Thank you for the reply and the advice!

This script (below) runs fine from the command line, but not in IIS,
when browsed to from Internet Explorer. The error message is:

Ouch: Bad file descriptor at
c:\inetpub\wwwroot\port\blast\blast_xml_run_p.pl line 13.

Might you have any idea what causes the "Bad file descriptor" message?

Jim


#!perl
use strict;
use warnings;
use CGI qw:)standard);
use Win32::OLE;
my $root = 'C:/Inetpub/wwwroot' ;
my $blast = "$root/port/blast" ;
print header(), start_html(-title=>'Invalid Form Variables',
#-BACKGROUND=>'pebblebackgrd.gif',
-BGCOLOR=>'#FFFFFF');
open RUNBLAST2,
"| $blast/blastall" .
" -e .01" .
" -p blastp" .
" -d $blast/db/gbpoxpep" .
" -F F" .
" -m 7" .
" -o $root/webtemp/1528957863220214843.xml"
or die "Ouch: $!" ;
print RUNBLAST2 ">CNPV-WC93:007\nMKSYDDKVKE LYSAIESNDK";
close RUNBLAST2 ;
print end_html();
exit(0);
 
J

Jim

Jim said:
Dr. Ruud,

Thank you for the reply and the advice!

This script (below) runs fine from the command line, but not in IIS,
when browsed to from Internet Explorer. The error message is:

Ouch: Bad file descriptor at
c:\inetpub\wwwroot\port\blast\blast_xml_run_p.pl line 13.

Might you have any idea what causes the "Bad file descriptor" message?

Jim


#!perl
use strict;
use warnings;
use CGI qw:)standard);
use Win32::OLE;
my $root = 'C:/Inetpub/wwwroot' ;
my $blast = "$root/port/blast" ;
print header(), start_html(-title=>'Invalid Form Variables',
#-BACKGROUND=>'pebblebackgrd.gif',
-BGCOLOR=>'#FFFFFF');
open RUNBLAST2,
"| $blast/blastall" .
" -e .01" .
" -p blastp" .
" -d $blast/db/gbpoxpep" .
" -F F" .
" -m 7" .
" -o $root/webtemp/1528957863220214843.xml"
or die "Ouch: $!" ;
print RUNBLAST2 ">CNPV-WC93:007\nMKSYDDKVKE LYSAIESNDK";
close RUNBLAST2 ;
print end_html();
exit(0);

**************
Clarification:
The "line 13" from the error message corresponds to the "open
BLASTRUN2,..." line.

Jim
 
J

Jim Moon

Jim said:
**************
Clarification:
The "line 13" from the error message corresponds to the "open
BLASTRUN2,..." line.

Jim

I have determined the cause of the error. It was a permissions issue.
Hence "Bad file descriptor". I rarely work with Perl, so my familiarity is
minimal. It is an interesting and useful language though!

--Jim
 
D

Dr.Ruud

Jim Moon schreef:
I have determined the cause of the error. It was a permissions issue.
Hence "Bad file descriptor". I rarely work with Perl, so my
familiarity is minimal. It is an interesting and useful language
though!

Another pointer: perldoc -q browser
 
T

Tad McClellan

Jim Moon said:
"Jim" <[email protected]> wrote in message


Please choose one posting address and stick with it.

^^^^^^^^^^^^

perldoc -q "command line"

My CGI script runs from the command line but not the browser. (500
Server Error)

I have determined the cause of the error. It was a permissions issue.


Then it was not a Perl problem.

Hence "Bad file descriptor". I rarely work with Perl,


That is irrelevant, since you did not have a Perl problem to begin with.
 
J

Jim Moon

Tad McClellan said:
Please choose one posting address and stick with it.

I'll think about it.
^^^^^^^^^^^^

perldoc -q "command line"

My CGI script runs from the command line but not the browser. (500
Server Error)




Then it was not a Perl problem.

Given my unfamiliarity with Perl and no knowledge of what "Bad file
descriptor" might actually mean, I believe that you may be mistaken.
That is irrelevant, since you did not have a Perl problem to begin with.

Given my unfamiliarity with Perl and no knowledge of what "Bad file
descriptor" might actually mean, I believe that you may be mistaken.
 
S

Sherm Pendley

Jim Moon said:
Given my unfamiliarity with Perl and no knowledge of what "Bad file
descriptor" might actually mean, I believe that you may be mistaken.

Given your unfamiliarity with Perl, perhaps you'd be better off taking
advice from those who *are* familiar with it, instead of arguing with
them.

Not a flame, just advice.

sherm--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top