Open a file from PERL / ASP ?
am 06.10.2007 23:52:55 von jack
Hi I use this all the time with .pl programs and it works great but
as soon as I put in ASP it blows up b/c it cant find the file ;
however same code works as tested in a .pl and the file DOES exist !
Any code that works for within an ASP file would be appreciated !
<%@Language="PerlScript"
if ($var ne '') {
$filename1 = 'e:\temp2\searchlog.txt';
open(OUTFILE,">>$filename1")|| die 'ERROR : external table not
found :'.$filename1."\n";
}
%>
thanks in advance, Jack
Re: Open a file from PERL / ASP ?
am 07.10.2007 23:12:35 von Ben Morrow
Quoth Jack :
> Hi I use this all the time with .pl programs and it works great but
> as soon as I put in ASP it blows up b/c it cant find the file ;
> however same code works as tested in a .pl and the file DOES exist !
> Any code that works for within an ASP file would be appreciated !
> <%@Language="PerlScript"
>
> if ($var ne '') {
> $filename1 = 'e:\temp2\searchlog.txt';
> open(OUTFILE,">>$filename1")|| die 'ERROR : external table not
Use three-arg open and lexical FHs.
open(my $OUTFILE, '>>', $filename1) || die '...';
Use interpolation rather than the . operator.
... || die "ERROR : external table not found :$filename1\n";
> found :'.$filename1."\n";
Since this message is for debugging, leave off the "\n". Then perl will
tell you where the error came from.
Include $! in your error message, then you'll know why the file couldn't
be opened. I suspect you've got a permission problem (that is, the error
is 'Access denied' rather than 'File not found').
Ben