On Mon, 29 Jan 2007 15:48:30 -0800, "James Couball"
<[EMAIL PROTECTED]> wrote:

>I am trying to call an external command and capture the output in my
>perl script.  I don't use backticks because my script needs to run on
>both Windows and Linux and I have problems making the shell quoting and
>escaping work for both platforms.  Using exec or system solves this
>problem.
> 
>Is there a way to run an external command using system or exec and
>capture its output that works on Win32?

You can of course redirect the output to a file, and then read the file
once the external command has terminated.

If you are using recent versions of ActivePerl on all you platforms,
then you may want to use the ActiveState::Run::shell_quote() function to
get your arguments quoted and escaped in a platform specific manner.  It
is somewhat simplistic, but does work for all the instances we are
using.

http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/lib/ActiveState/Run.html

Cheers,
-Jan

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to