Safe Pipe Opens Supported?
Safe Pipe Opens Supported?
am 30.01.2007 00:27:37 von James Couball
Hello:
Are "Safe Pipe Opens" as described here:
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/lib/Pod /perlipc.htm
l#safe_pipe_opens
supported in ActivePerl?
Whenever I try this statement:
$pid = open(KID_TO_READ, "-|");
I get an error message saying:
'-' is not recognized as an internal or external command,
operable program or batch file.
as if I typed '-' at the command line.
I am using this version of ActivePerl:
>perl -version
This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 33 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 819 [267479] provided by ActiveState
http://www.ActiveState.com
Built Aug 29 2006 12:42:41
Sincerely,
James Couball
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Safe Pipe Opens Supported?
am 30.01.2007 00:35:28 von Jan Dubois
On Mon, 29 Jan 2007 15:27:37 -0800, "James Couball" wrote:
>Are "Safe Pipe Opens" as described here:
>http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/lib/Po d/perlipc.htm
>l#safe_pipe_opens
>
>supported in ActivePerl?
>
>Whenever I try this statement:
>$pid = open(KID_TO_READ, "-|");
You can find out about the portability of builtin functions by reading
perlport.pod:
| open The "|" variants are supported only if ToolServer is installed.
| (Mac OS)
|
| open to "|-" and "-|" are unsupported. (Mac OS, Win32, RISC OS)
|
| Opening a process does not automatically flush output handles on
| some platforms. (SunOS, Solaris, HP-UX)
Also available here:
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/lib/Pod /perlport.html#alphabetical_listing_of_perl_functions
As you can see, your usage above is not supported on Windows.
Cheers,
-Jan
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Safe Pipe Opens Supported?
am 30.01.2007 00:48:30 von James Couball
Thank you for taking the time to point me to the right doc... that is
exactly what I needed. I can see that one will come in handy in the
future.
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?
Sincerely,
James.
-----Original Message-----
From: Jan Dubois [mailto:jand@ActiveState.com]
Sent: Monday, January 29, 2007 3:35 PM
To: James Couball
Cc: activeperl@listserv.ActiveState.com
Subject: Re: Safe Pipe Opens Supported?
On Mon, 29 Jan 2007 15:27:37 -0800, "James Couball"
wrote:
>Are "Safe Pipe Opens" as described here:
>http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/lib/Po d/perlipc.ht
m
>l#safe_pipe_opens
>
>supported in ActivePerl?
>
>Whenever I try this statement:
>$pid = open(KID_TO_READ, "-|");
You can find out about the portability of builtin functions by reading
perlport.pod:
| open The "|" variants are supported only if ToolServer is
installed.
| (Mac OS)
|
| open to "|-" and "-|" are unsupported. (Mac OS, Win32,
RISC OS)
|
| Opening a process does not automatically flush output
handles on
| some platforms. (SunOS, Solaris, HP-UX)
Also available here:
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/lib/Pod /perlport.ht
ml#alphabetical_listing_of_perl_functions
As you can see, your usage above is not supported on Windows.
Cheers,
-Jan
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Safe Pipe Opens Supported?
am 30.01.2007 01:15:49 von Jan Dubois
On Mon, 29 Jan 2007 15:48:30 -0800, "James Couball"
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/Act iveState/Run.html
Cheers,
-Jan
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs