Perl CGI Scripting

Hi,

My below cgi script works fine from the command line but not working from the web browser.

#!/usr/bin/perl
use File::Copy;
use CGI;
print "Content-type: text/html\n\n";
print "<html><head><title>LOGS";
print "</title></head>";
print "<body bgcolor=#95B9C7 link=black>";

$infile="/home/jaindin/jaindin_PerlCGI/IN/data_1.xml";
$jobxml="/home/jaindin/jaindin_PerlCGI/IN/data_2.xml";
print "copy $infile $jobxml\n";
copy($infile,$jobxml);         #copy data.xml to jobdata.xml
print "</body></html>\n";

when I run the above program from the command line like ./copy.cgi copy command is working but when I execute it from the URL copy command is not working.Please help.

Technically, isn't the http end of header '\r\n\r\n' ?

Check permissions of the directory. The CGI on the server will run under a different user.

Yes, but there should be an error log entry if there was an access violation. If PERL copy() returns status, it might be nice to print that. Do you get the copy message and no move, or no response at all?

BTW, in html output your need <BR> or <P> to separate lines. Or, you could return a text/plain document.

rdrtx1 is correct.

Accessing your script from a web browser is similar to trying to run it as a different user. Chances are the userid of the web server does not have read/write access to your $infile/$jobxml. If possible, try to get another user to run your program and examine the errors.