in reply to Referring to another perl script....

Sure, its possible, but is generally more complex than it's worth. You could try:

# %params defined elsewhere, holding CGI input data open(OUT, '|-', '/path/to/cgi') or die $!; foreach my $key (keys %params) { print OUT "$key=$params{$key}\n"; } close(OUT);

It's generally easier to load the second CGI's subroutines into a module and use them from there. The example above will work in one simple (though common) case and fail in a thousand others.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: Referring to another perl script....
by Alex (Initiate) on May 06, 2003 at 16:46 UTC
    HardBurn

    Thanks for your info. But being generally new to perl, I'm a little confused with your code. I know you opened a filehandle 'OUT' to the script I want to use. But what does the '|-' do? Is it some kind of pipe redirection?

    Another thing :) what exactly is a module? Is it like an external sub-routine file, that has functions pre-defined for common uses... like CGI.pm?

    Other than that I understand everything else you posted.


    Thanks!
    Alex