Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing Perl Script from within another Perl Script

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hello,

This is probably a very simple thing to do (I an a beginner in Perl), but I have not been able to find an answer online. This is what I am trying to do. I have a Perl script (scriptOne.cgi) that is executed when visitor goes to web page ( What I want to do is be able to execute another script (scriptTwo.cgi), when the first script is called. That is, a visitor goes to and scriptOne.cgi calls and executes scriptTwo.cgi

Is this possible? If so, how do I do it? Thanks for your help.

Regards,

Ray

raymasa@hotmail.com
 
whats the 2nd cgi ????
why do u need 2 ?
cause there is many way to everything in perl [lol] ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
I think it's something like this;

<meta http-equiv=&quot;REFRESH&quot; content=&quot;60;url=http://nextpage.com&quot;>

The 60 means wait 60 seconds. You can set this to other values.

Hope this helps!

tgus

____________________________________________________
A father's calling is eternal, and its importance transcends time.
 
tgus??? what did you just recommend?

i've done something similar to this back when i was on a server that would not let my perl scripts end email. i had to write in ASP and pass information to that script. i'll get back to you when i get back to my computer at home, but i believe you should go on ahead and read on URI::LWP if you need to learn about passing info ASAP. [wink]
 
He didn't say he wanted to pass info.
Only that he wanted to start another page.
I figure he was trying to do a redirect.

tgus

____________________________________________________
A father's calling is eternal, and its importance transcends time.
 
isn't that a cheap way of doing it? besides, why'd he wanna do it in the first place? if you're switching between browsers during that time, the content of the first one wouldn't even matter. why not then just get the output of scriptTwo.cgi by running it through scriptOne.cgi so that if there are other procedures that need to be done by both, they will be run. just my two centavos' worth. [sleeping]
 
raymasa, what is it you really want.

Can you explain better what you're trying to accomplish?

Why do you want to call another script? Is there something you can't do in the first script that you think the second one can do?

What have you got so far?

tgus

____________________________________________________
A father's calling is eternal, and its importance transcends time.
 
You might be able to use a system call like:

system (&quot;perl /path/to/scriptTwo.cgi&quot;);

? Not sure about this, but it might work. - Ben Russell
- President of Intracor Technologies (
 
If you were asking how to execute perl from perl (were you?), here are some examples. These are not taint clean!

Option 1 (ScriptOne.cgi exits, replaced by ScriptTwo.cgi)
Code:
#!/usr/local/bin/perl
# ScriptOne.cgi
exec(&quot;ScriptTwo.cgi&quot;);

Option 2 (ScriptOne.cgi waits for ScriptTwo.cgi)
Code:
#!/usr/local/bin/perl
# ScriptOne.cgi
system(&quot;ScriptTwo.cgi&quot;);

Option 3 (ScriptOne.cgi executes ScriptTwo.cgi in situ)
Code:
#!/usr/local/bin/perl
# ScriptOne.cgi
open(SCRIPT2, &quot;<ScriptTwo.cgi&quot;) or die(&quot;Ouch!);
$ScriptTwo = join(&quot;\n&quot;, <SCRIPT2>);
eval $ScriptTwo;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top