develooper Front page | perl.perl5.porters | Postings from October 1999

Jenda Krynicky
October 26, 1999 12:37
Message ID:
I'd like to propose a few additions to 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*';
	Blah blah blah

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 

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
== == ==
 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About