If the command line perl program prints to STDOUT, you
could load and 'eval' it.  This will store the results in a 
variable, which your CGI program could print to the
browser.

Of course using 'eval', 'system' or anything like that "safely" is another
whole discussion.  There are many things to think about, such as
trapping 'eval' errors, variable scoping, the integrity of your CGI
program's %ENV hash and other global variables, etc.  If you
wrote the command line perl program yourself, these are easy
to manage.  If you are using a third party program you have much
more to worry about.



----- Original Message ----- 
From: "Paul Lussier" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 05, 2001 11:27 AM
Subject: [Boston.pm] Safe execution of 1 perl prog from another?


> 
> Hi all,
> 
> I have a situation where I need to exec a command-line based perl 
> program from a CGI wrapper.  I want to do this safely, but I also 
> want to see the same output from the command line program in the
> browser that I would normally.
> 
> I'm not quite sure how I should go about doing this, and have it safe 
> as well.  I'm assuming the best option is using the list form of 
> system()?  If so, how do I get STDERR to the browser as well?
> 
> Will 'fatalsToBrowser' accomplish this?  Currently stderr seems to 
> end up in the apache error log.
> 
> Thanks for you input.
> 
> -- 
> 
> Seeya,
> Paul
> ----
> 
>   God Bless America!
> 
> ...we don't need to be perfect to be the best around,
> and we never stop trying to be better. 
>        Tom Clancy, The Bear and The Dragon
> 
> 
> 

Reply via email to