Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am using activestate perl 5.8. All i want to do is have the perl script change a 0 to 1. Ive tried doing this directly from perl, Fail; I had perl run a bat file that would delete the old file and copy the new one on top, Fail; I have a VB program that changes it to a 1 now and it works by itself but when i tried accessing it through the script,Fail.

#!C:\perl\bin\perl.exe

use CGI qw(:standard -debug);
use strict;

print "Content-type: text/html\n\n";

#make variables
my $subbutton;

#suck in stuff from form
$subbutton = param('B1');

#Call uptdate text file;
system ("status.exe");


The executable is in the cgi-bin and so is the text file.

Replies are listed 'Best First'.
Re: Wrong Permissions or Something...
by iburrell (Chaplain) on Nov 15, 2002 at 17:17 UTC
    You certainly should be able to change the file from within Perl. There is no reason to resort to an external program. Why is your script failing? What error messages does it report?

    CGI scripts run as the user of the web server. On IIS, this is IUSR_machine. You need to check that the web user has permissions to write to the file you want to change. Otherwise, nothing will be able to change the file when spawned by the web server.

Re: Wrong Permissions or Something...
by strider corinth (Friar) on Nov 15, 2002 at 16:33 UTC
    I'm having a little trouble understanding what you're trying to do. Are you trying to get Perl to change a 0 in a text file to a 1? What is the parameter 'B1' supposed to do, exactly?
    --
    Love justice; desire mercy.