Front page | perl.perl5.porters |
Postings from October 1999
Shell.pm
From:
Jenda Krynicky
Date:
October 26, 1999 12:37
Subject:
Shell.pm
Message ID:
OF976537B9.545160EC-ONC1256816.006BBCE3@mccann.cz
I'd like to propose a few additions to Shell.pm module.
1) I think there should be not only $Shell::captureSTDERR, but also
$Shell::dropSTDERR (not sure what name to choose) that would cause
the STDERR of the program to go to /dev/null (whatever the syntax is
for your OS).
2) I don't realy like those GLOBAL switches. I think we could allow
something like :
sub ls;
*ls = new Shell 'ls', STDERR => 0;
Where say "STDERR => 0" means "Don't care about STDERR",
"STDERR => 1" means "Capture STDERR" and "STDERR => -1" means
"Drop STDERR to /dev/null".
3) With this syntax we may even add some preset parameters:
sub SendMsg;
*SendMsg = new Shell 'net', -PARAMS => 'send';
And now
SendMsg 'jkrynicky', "Hi, are you there?";
would be equivalent to calling
net send jkrynicky "Hi, are you there?"
We could even have things like
*foo = new Shell 'foo', -PARAMS => '/bar $1 /baz $2';
with which
foo 'Jenda', 'Krynicky';
would call
foo /bar Jenda /baz Krynicky
4) When we are at it we might add even one more handy feature, we
could allow the user to specify that one of the parameters (the last
one) is to be sent on the programs STDIN, not included on the
command line.
sub sendmail;
*sendmail = new Shell 'sendmail', -params => '-t', -STDIN => 1;
And then
sendmail <<'*END*';
To: perl5-porters@perl.org
From: Jenda@McCann.cz
Subject: Shell.pm
Blah blah blah
.
*END*
would do the right thing, on any OS (as long as you have a
commandline sendmail installed of course.)
Sure, you may do all this with IPC::Open2 and IPC::Open3 and others,
this would just provide the user with a simple and PORTABLE
interface.
I'm willing to write the patch, at least for Win32 and Unix (don't
have access to other OSes), but I would like to get some comments
before I start coding.
Thanks, Jenda
== Jenda@Krynicky.cz == http://Jenda.Krynicky.cz ==
The phenomenon of UFO doesn't say anything about
the presence of intelligence in space.
It just shows how rare it is here on the earth.
A.C.Clarke
-
Shell.pm
by Jenda Krynicky