------------------------------------------------ On Fri, 11 Jul 2003 12:13:19 -0700, "Frank B. Ehrenfried" <[EMAIL PROTECTED]> wrote:
> I am going through a chapter in a perl text on cgi - trying to master it. > Appartently, I need to transfer a cgi script to the ISP's server, then invoke > it with the browser. Do you need to invoke it in the automated manner for some reason or is the text meaning just to view it to make sure the CGI worked correctly? Seems odd to take this course of action, aka uploading the coded version over FTP then pull the same thing down automagically over HTTP. Since my ISP does not allow cgi scripts to be run on > their server, I have wriiten a perl script (see below) that executes the cgi > script locally, captures the html output, and ftp's it to the server. Interesting solution, probably have learned more doing this than the book's author probably would have hoped :-). So much for the real time nature of CGI though.... Out of curiosity why write them in a CGI manner if they are not going to be served, or are you looking at alternative hosting solutions? If this is a learning exercise mainly, you might consider downloading and installing a free web server and serving your own CGI, if on windows I would suggest using Cygwin (complete environment not just a server) http://www.cygwin.com but there are others.... The other issue is that by doing it in this manner you still won't be grasping CGI because you won't have to produce a header (cookies, etc.) because that will be handled by the virtue that is a static page rather than an executable, essentially you will have just automated HTML generation (and while a good thing to know) does not encompass CGI (or online applications in general). The > next step would be for the original script to invoke the browser against the > html on the server. This is what I don't know how to do, and was wandering > if there existed a module at CPAN for this. > Yes, in particular LWP (a bundle of modules) specifically designed for automation of HTTP requests, on CPAN naturally: http://search.cpan.org/author/GAAS/libwww-perl-5.69/lib/LWP.pm http://danconia.org > > use Net::FTP; > use HTML::ParseBrowser; > use strict; > > `perl cgi1.cgi > cgi1.html`; > > my $ftp = Net::FTP->new > ( > "my.sanbrunocable.com", > Timeout => 30 > ) or die "Could not connect. \n"; > > my $userName = "user name goes here"; > my $passWord = "pass word goes here"; > > $ftp->login($userName, $passWord) > or die "Could not log in.\n"; > > my $localFile = "cgi1.html"; > > $ftp->put($localFile) > or die "Can not put file. \n"; > > (Now the rest of the code for invoking the brwser goes here!) > > <snip original messages> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]