Hello,

I would like to run a PERL script, which uses Net::FTP to retrieve a file and Mail::Sender to send it by email, from a PERL CGI.

Unfortunately, the second script never works ("script_that_retrieves_a_file_by_ftp_and_sends_it_by_email.pl" below), probably because the CGI ends before the child script has had a chance to do anything.

Does anyone have any suggestions as to how I could make the CGI wait for the second script to complete?

Many thanks.

Philippe




#!/usr/bin/perl -w

use CGI qw/:standard/;

print header,
start_html('A Simple Example'),
h1('A Simple Example'),
start_form,
"What's your name? ",textfield('name'),p,
"What's the combination?", p,
checkbox_group(-name=>'words',
                  -values=>['eenie','meenie','minie','moe'],
                  -defaults=>['eenie','minie']), p,
"What's your favorite color? ",
popup_menu(-name=>'color',
          -values=>['red','green','blue','chartreuse']),p,
submit,
end_form,
hr;

if (param()) {
my $ret = ` "perl script_that_retrieves_a_file_by_ftp_and_sends_it_by_email.pl" `;
        print "Returned code = ", ($ret >> 8), "<br>\n";
        print "Your name is",em(param('name')),p,
                "The keywords are: ",em(join(", ",param('words'))),p,
                "Your favorite color is ",em(param('color')),
                hr;
}

Reply via email to