in reply to sending data between CGI scripts

I'm a little unclear on what you're trying to accomplish, here. A CGI script isn't 'running', unless someone accesses the page. You can invoke a script from your currently running script, passing commands either through STDIN (you'd have to fake looking like a webserver invoked you, most likely, to make it happy), you could invoke it with arguments on the command line, or you could invoke the script by accessing via the webserver (basically making your script look like a browser client).

Perhaps a little more detail here, and we could give you some more useful help, or point you towards a better way to accomplish whatever is you're trying to do.

As a side note, having a script named 'login.pl' is questionable, at best. There are certain common names that 'cracking' programs scan for, and by naming a script 'login.pl', you're inviting it to take a closer look at you. There's about a half a dozen common names you want to avoid.

--Chris

e-mail jcwren
  • Comment on (jcwren) Re: sending data between CGI scripts

Replies are listed 'Best First'.
RE: (jcwren) Re: sending data between CGI scripts
by jlistf (Monk) on Jul 18, 2000 at 18:05 UTC
    the idea is that someone requests the main script. this script then uses other scripts to get some information. the first script is running and calls the other scripts to get information. i'm not sure it'll work out the way i planned it though. as for login.pl, it was just a temporary name to give the script so i have some idea whats going on in my program... it would have been changed long before i actually used it for anything important.
      I usually use modules for this purpose. (See perlmod for groovy details.) My main CGI is pretty simple:
      #!/usr/bin/perl -wT use strict; use SuperModule; use CGI; my $q = CGI->new(); # magic here my %actions = ( login => \&do_login, post => \&do_post, pyro => \&set_someone_on_fire ); my $action = $q->param('action'); if (defined $actions{$action}) { $actions{$action}->($q); } else { default_page($q); } sub do_login { # check login parameters here my $q = shift; SuperModule::login($q); # or whatever }
      ...and so forth. It's a layer of abstraction, to be sure, but if you want to put the whole script into your httpd.conf file, it makes mod_perl'ing it a lot easier.
      If the first script needs to call other .cgi scripts, tehn you want to use LWP. If the cgi script is just calling other scripts then you can just system or open it with a pipe.