Brady Fausett wrote: > All, > > Or maybe David, > > I appologize in advance for my lack of sight and/or insight... > > I read those docs. How can I utilize those functions on the web? I am > sorry I must be really dense when it comes to this stuff... I have had > the hardest time getting this to work. I can run my script from a command > prompt great. I guess I need to understand how CGI and perl work together > etc. Here is the an HTML page that is suppose to call the script but it > still isn't working. > > <HTML> > <HEAD> > <TITLE>Upload/Parse Data</TITLE> > </HEAD> > > <BODY> > > <!--#exec cgi="/usr/local/apache/cgi-bin/pw.pl"--> > <BR><B>Upload Successful!</B> > <BR> > </BODY> > </HTML> > > Any ideas? > > Thanks, > Brady >
ok. let assume you have the following: 1. a form where a user can click a button/link and then it calls you CGI script. 2. your CGI script's name is cgi.pl 3. you have another script and it's name is store.pl when the user click the button/link, cgi.pl is called. what cgi.pl does is call store.pl where it will create a file in the file system and then exit. mean while, cgi.pl continue to do whatever it needs to do and sends something back to the browser so the user knows that everything is working properly. you need a way to incoporate store.pl into cgi.pl right? here is a way of incoporating store.pl into cgi.pl: #!/usr/bin/perl -w use strict; #-- #-- assume this is in cgi.pl #-- #-- #-- a lot of code is omitted since i don't have access to #-- your cgi.pl #-- #-- ok. since you already have store.pl and it ran correctly from the #-- the command line. you can simply ask Perl to execute store.pl for #-- you to store something in your file system #-- my @arguments_to_store_pl = ("arg1","arg2","arg3"); #-- put more if you need unless(system("/full/path/to/store.pl",@arguments_to_store_pl)){ #-- #-- something could be wrong, if the system() command #-- return something other than 0 #-- #-- that's why you need to read the docs :-) #-- } #-- #-- once you are here and there is no error. store.pl has been #-- successfully lunched and you should have something stored #-- in your file system(if that's what store.pl does) #-- #-- #-- cgi.pl will keep running from here #-- print "Content-Type: text/html\n\n"; print "Hi, stored.pl has been executed<br>\n"; print "your file has been stored in my server<br>\n"; print "please come back soon!"; #-- #-- or do whatever your cgi.pl is designed to do #-- __END__ the system() command will block until store.pl finish. so if store.pl takes a long time to execute, the user might see a time out error from their browser. if you don't want that to happen. you should use fork() to create a separate process, execute store.pl, and then exit. cgi.pl, in the mean time, will not be blocked and it will keep running whatever that it's designed to do. if you have more questions, feel free to ask :-) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]