I have a script that executes from an html form submission. Its all run on an internal iis server. The script resides in the cgi-bin on the iis server that reads/and writes to an external js file. It works fine and then all of the sudden I get a software error:
Error opening file during getSubCat \\servername\inetpub\Invalid argument.
I've been banging my head into the wall for a few days now and can't seem to figure out why it produces the error and stops working.
Here's a snippet of the code:
#!/usr/local/bin/perl5
use strict;
use CGI qwstandard);
use CGI::Carp qw /fatalsToBrowser/;
my $CatPage=param('Category');
print header;
print start_html('testpage');
print<<DDP;
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body bgcolor="#FFFFFF" text="#000000">
<script language="JavaScript" type="text/javascript" src=" <table cellspacing="0" cellpadding="0" border="0" valign="top" bgcolor="#ffffff" width="10">
<tr>
<td valign="top" width="1"><img src="/images/transparent.gif" border="0" width="1" height="1"><br></td>
<td valign="top" width="10"> </td>
<td width="1"><img src="/images/transparent.gif" border="0" width="1" height="1"><br></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="750">
<tr valign="top">
<td>
<div align="left"><img src="/images/transparent.gif" width="100" height="2"></div>
</td>
<tr>
<td align="left"><h1><font face="Arial, Helvetica, sans-serif"><b><font size="4"> Category Page Editor</font></b></font></h1>
</td>
</tr>
<tr>
<td align="left"><img src="/images/transparent.gif" width="100" height="18"></td>
</tr>
<tr>
<td align="left" >
<table cellspacing="0" cellpadding="1" border="0" width="100%" >
<tr>
<td align="center" colspan="4" rowspan="2" bgcolor="#CCCCFF" >
<table cellspacing="0" cellpadding="0" border="0" width="100%" >
<tr>
<td align="center"><img src="/images/transparent.gif" width="10" height="18"><br><img src="/images/transparent.gif" width="10" height="8"><font size="3" face="Arial, Helvetica, sans-serif">Step
1: You're editing Category page <b>$CatPage</b>:</font><input type="hidden" name="SubCategory" value="$CatPage"></td>
</tr>
<tr>
<td align="left"><img src="/images/transparent.gif" width="100" height="18"></td>
</tr>
DDP
&getSubCat();
print<<DDP2;
<tr>
<td><img src="/images/transparent.gif" width="10" height="15">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</table>
</body>
DDP2
print end_html;
sub getSubCat {
my %productData;
my @scCategory;
my $xx;
my $count=0;
my $DCcatDB="//pathtodb/product4sub.sdb";
my ($category,$blank);
my $JSexternal = "\\\\servername\\inetpub\\ open (SubCat, ">$JSexternal") || die "Error opening file during getSubCat $JSexternal\n$!\n";
open (FILE, "$DCcatDB") or die "Cannot open database ($DCcatDB):$!\n";
while (<FILE>) {
chomp;
($category,$blank)=split(/,/);
if ($category ne "SubCategory") {
$scCategory[$count]=$category;
$count++;
}
}
close FILE;
@sortSubCat = sort @scCategory;
$subCatCount = $count;
print SubCat "function GetSubCat(subcatnumber) {\n";
print SubCat "var SubCatCount=$count;\n";
print SubCat <<SubCatDiv;
var divwriteInit="<select name=\\"CrateSubCategory"+subcatnumber+"\\" style=\\"font-size: 9.5\\" onChange=\\"ShowHide('catsubdrop"+subcatnumber+"','1','createPage"+subcatnumber+"');showsubCat('catYn"+subcatnumber+"');GetProdGroup('"+subcatnumber+"')\\">"+
"<option value=\\" \\" selected> - - - - - - - - - - - - -"+
"Choose Crate Subcategory - - - - - - - - - - - - - </option>";
var DCSubCat=new Array('300');
SubCatDiv
my $arrayValue=0;
foreach $xx (@sortSubCat) {
print SubCat "DCSubCat[$arrayValue]=\"$xx\";\n";
$arrayValue++;
}
print SubCat <<SubCatDiv2;
var subcatdropdwn;
var subcatdroptotal;
i=0;
var DCsCat;
for (i=0; i < SubCatCount; i++) {
DCsCat=DCSubCat;
subcatdropdwn="<option value=\\""+DCsCat+"\\">"+DCsCat+"</option>";
subcatdroptotal=subcatdroptotal+subcatdropdwn;
}
if (document.getElementById) {
document.getElementById("CrateSubCatDrop"+subcatnumber).innerHTML = divwriteInit+subcatdroptotal+"</select>";
}
SubCatDiv2
print SubCat "}\n";
close SubCat;
}
If I log out off of the server and log back in, the script functions fine - permissions or authentication issue?
Thanks,
Rich
Error opening file during getSubCat \\servername\inetpub\Invalid argument.
I've been banging my head into the wall for a few days now and can't seem to figure out why it produces the error and stops working.
Here's a snippet of the code:
#!/usr/local/bin/perl5
use strict;
use CGI qwstandard);
use CGI::Carp qw /fatalsToBrowser/;
my $CatPage=param('Category');
print header;
print start_html('testpage');
print<<DDP;
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body bgcolor="#FFFFFF" text="#000000">
<script language="JavaScript" type="text/javascript" src=" <table cellspacing="0" cellpadding="0" border="0" valign="top" bgcolor="#ffffff" width="10">
<tr>
<td valign="top" width="1"><img src="/images/transparent.gif" border="0" width="1" height="1"><br></td>
<td valign="top" width="10"> </td>
<td width="1"><img src="/images/transparent.gif" border="0" width="1" height="1"><br></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="750">
<tr valign="top">
<td>
<div align="left"><img src="/images/transparent.gif" width="100" height="2"></div>
</td>
<tr>
<td align="left"><h1><font face="Arial, Helvetica, sans-serif"><b><font size="4"> Category Page Editor</font></b></font></h1>
</td>
</tr>
<tr>
<td align="left"><img src="/images/transparent.gif" width="100" height="18"></td>
</tr>
<tr>
<td align="left" >
<table cellspacing="0" cellpadding="1" border="0" width="100%" >
<tr>
<td align="center" colspan="4" rowspan="2" bgcolor="#CCCCFF" >
<table cellspacing="0" cellpadding="0" border="0" width="100%" >
<tr>
<td align="center"><img src="/images/transparent.gif" width="10" height="18"><br><img src="/images/transparent.gif" width="10" height="8"><font size="3" face="Arial, Helvetica, sans-serif">Step
1: You're editing Category page <b>$CatPage</b>:</font><input type="hidden" name="SubCategory" value="$CatPage"></td>
</tr>
<tr>
<td align="left"><img src="/images/transparent.gif" width="100" height="18"></td>
</tr>
DDP
&getSubCat();
print<<DDP2;
<tr>
<td><img src="/images/transparent.gif" width="10" height="15">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</table>
</body>
DDP2
print end_html;
sub getSubCat {
my %productData;
my @scCategory;
my $xx;
my $count=0;
my $DCcatDB="//pathtodb/product4sub.sdb";
my ($category,$blank);
my $JSexternal = "\\\\servername\\inetpub\\ open (SubCat, ">$JSexternal") || die "Error opening file during getSubCat $JSexternal\n$!\n";
open (FILE, "$DCcatDB") or die "Cannot open database ($DCcatDB):$!\n";
while (<FILE>) {
chomp;
($category,$blank)=split(/,/);
if ($category ne "SubCategory") {
$scCategory[$count]=$category;
$count++;
}
}
close FILE;
@sortSubCat = sort @scCategory;
$subCatCount = $count;
print SubCat "function GetSubCat(subcatnumber) {\n";
print SubCat "var SubCatCount=$count;\n";
print SubCat <<SubCatDiv;
var divwriteInit="<select name=\\"CrateSubCategory"+subcatnumber+"\\" style=\\"font-size: 9.5\\" onChange=\\"ShowHide('catsubdrop"+subcatnumber+"','1','createPage"+subcatnumber+"');showsubCat('catYn"+subcatnumber+"');GetProdGroup('"+subcatnumber+"')\\">"+
"<option value=\\" \\" selected> - - - - - - - - - - - - -"+
"Choose Crate Subcategory - - - - - - - - - - - - - </option>";
var DCSubCat=new Array('300');
SubCatDiv
my $arrayValue=0;
foreach $xx (@sortSubCat) {
print SubCat "DCSubCat[$arrayValue]=\"$xx\";\n";
$arrayValue++;
}
print SubCat <<SubCatDiv2;
var subcatdropdwn;
var subcatdroptotal;
i=0;
var DCsCat;
for (i=0; i < SubCatCount; i++) {
DCsCat=DCSubCat;
subcatdropdwn="<option value=\\""+DCsCat+"\\">"+DCsCat+"</option>";
subcatdroptotal=subcatdroptotal+subcatdropdwn;
}
if (document.getElementById) {
document.getElementById("CrateSubCatDrop"+subcatnumber).innerHTML = divwriteInit+subcatdroptotal+"</select>";
}
SubCatDiv2
print SubCat "}\n";
close SubCat;
}
If I log out off of the server and log back in, the script functions fine - permissions or authentication issue?
Thanks,
Rich