A
abstractjoe
Hi,
I wrote a CGI script in Perl(see below) and when I execute ./ in Unix
console it works just fine. However, when I use it in an html page it
doesn't work.
Below is the form tag within my html page.
<form name="the_script" method="POST"
action="http://www.mydomain.com/cgi-bin/the_script.cgi">
<input type="submit" value="the_script">
So, when I hit submit it takes me to the redirect, however when I
check the files to see if they are replaced, nothing...
If I just run the script in Unix via ./ the files are replaced...
weird.
Below is the CGI script:
#! /usr/bin/perl
use File::Find;
use File::Copy;
use File:
ath;
my $top_src = "/usr/local/whatever";
my $dest = "/usr/local/htdocs/whatever";
find sub {
##might need it for later on
##ignore non html files
return unless -f ;
my $more_subdir;
for ( $more_subdir = $File::Find::dir) {
s#^\Q$top_src##;
s#^/##;
}
## don't copy if we already have a later file
if (-e "$dest/$more_subdir/$_" and -M "$dest/$more_subdir/$_" <= -M
$_) {
## tracing: turn off when you're happy
warn "ignoring older $File::Find::name\n";
return;
}
mkpath( ["$dest/$more_subdir"], 0, 0711); # $dest must be an
absolute
## tracing: turn off when you're happy
$content = warn "copying $File::Find::name to
$dest/$more_subdir/$_\n";
copy $_, "$dest/$more_subdir/$_";
}, $top_src;
$url = "http://www.mydomain.com/redirect.html";
print "Location: $url\n\n";
exit;
I wrote a CGI script in Perl(see below) and when I execute ./ in Unix
console it works just fine. However, when I use it in an html page it
doesn't work.
Below is the form tag within my html page.
<form name="the_script" method="POST"
action="http://www.mydomain.com/cgi-bin/the_script.cgi">
<input type="submit" value="the_script">
So, when I hit submit it takes me to the redirect, however when I
check the files to see if they are replaced, nothing...
If I just run the script in Unix via ./ the files are replaced...
weird.
Below is the CGI script:
#! /usr/bin/perl
use File::Find;
use File::Copy;
use File:
my $top_src = "/usr/local/whatever";
my $dest = "/usr/local/htdocs/whatever";
find sub {
##might need it for later on
##ignore non html files
return unless -f ;
my $more_subdir;
for ( $more_subdir = $File::Find::dir) {
s#^\Q$top_src##;
s#^/##;
}
## don't copy if we already have a later file
if (-e "$dest/$more_subdir/$_" and -M "$dest/$more_subdir/$_" <= -M
$_) {
## tracing: turn off when you're happy
warn "ignoring older $File::Find::name\n";
return;
}
mkpath( ["$dest/$more_subdir"], 0, 0711); # $dest must be an
absolute
## tracing: turn off when you're happy
$content = warn "copying $File::Find::name to
$dest/$more_subdir/$_\n";
copy $_, "$dest/$more_subdir/$_";
}, $top_src;
$url = "http://www.mydomain.com/redirect.html";
print "Location: $url\n\n";
exit;