in reply to Checking for STDIN

STDIN is for reading, a logfile usually for writing. Do you really want to read from the logfile ?

Also, please put some dividing line between your text and your sig. I don't know if I'm the only one, but having to read your sig everytime because I get the impression it is part of the text is somewhat like getting spam.

Replies are listed 'Best First'.
Re^2: Checking for STDIN
by dbmathis (Scribe) on Jul 30, 2008 at 02:05 UTC
    I have a perl script that at the moment has a command line option -logfile <file> where it gets input by reading the <file> into the script. I would like to be able to check to see if stdin is being piped into my file so that I can change the flow of my script and get my input for the pipe instead.

    When the -t option is used within a cron job the -t test evalutes to false or in my case it would make my script appear to be having input piped to it when in fact in my cron job I have -logfile <file> specified.

    Make sense?
      Sounds like what you actually want to do is check of -logfile was specified.
        I think you are right. Might be the only way.