On Tue, 30 Mar 2004 21:35:21 -0700
Bryan Harris <[EMAIL PROTECTED]> wrote:


> > Please keep in mind that doing this breaks the de facto Unix
> > standard for filters.  A simply command which is a filter (e.g takes
> > input from STDIN and sends output to STDOUT) is written without any
> > consideration whether the input is a terminal, pipe, socket or
> > otherwise. This makes it very simple to use the command in a
> > pipeline or standalone from the terminal.

> Strangely, I find that we almost always want our scripts to act this
> way. If any files or data is passed to the script, then it uses it. 
> Otherwise, it prints usage instructions (since we'd rather not have
> man pages for scripts, and I don't know how to build them anyway).
> 
> I mention this because I'm interested in hearing your thoughts on this
> methodology.

It really comes down to personal taste and what your users expect. My
usual convention for scripts is to use the '-h' or the '--help' flag to
display short help information. It is any easy and standard way to
display help info.

I find the ability of a script to also accept input from a terminal is a
useful learning tool and also lets a user easily see how a simple filter
works. It can be annoying to run a command and then have it seemingly do
nothing as it waits for user input. In those cases, for complex scripts
I have set up prompting when input is from a terminal.

I can certainly see the rationale for your methodology. If you are
comfortable with it and your users are comfortable with it, I would
stick to it.

> By the way, what's a socket?

Usually, a network protocol end-point which for most I/O purposes looks
like a file handle. Instead of reading or writing from a file, the
program reads or writes a socket which is typically connected to
another program via a network protocol which is either local or remote.
See perldoc -f socket.

-- 
Smoot Carl-Mitchell
Systems/Network Architect
email: [EMAIL PROTECTED]
cell: +1 602 421 9005
home: +1 480 922 7313

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to