CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Execute perl script within another script

 



Warren Bell
Deleted

Dec 31, 2000, 9:53 PM

Post #1 of 2 (295 views)
Execute perl script within another script Can't Post

Is there a way to run one perl script and capture, or print out the output from withing another perl script? I have a script that builds a page from a template and a content page. In the content page I have an SSI command that I want my current script that's processing that page to execute. I'm trying to have my script act the same as SSI and keep it backward compatible with SSI tags. IS there any way to execute one CGI script within another?

Example:

for ($b = 0; $b < @template; $b++) {

$_ = $template[$b];

if (//) {

# somehow exec $1 and run it to have the same output as if I ran it with the SSI tag
`$1`;

}

Thanks



rGeoffrey
User / Moderator

Jan 1, 2001, 11:53 AM

Post #2 of 2 (289 views)
Re: Execute perl script within another script [In reply to] Can't Post

I am not going to offer my SSI solution yet because I am still working on it.

But I would like to point out that this...


Code
for ($b = 0; $b < @template; $b++) { 
$_ = $template[$b];
#do something cool with $_
}

is a complicated way of saying...


Code
foreach (@template) { 
#do something cool with $_
}

In perl we have foreach which is built just for this type of thing.

As a refuge from 'C' I did not want to give up on for, but eventually I saw the light, and my perl code is now much better.



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives