Re: checking for no input

2003-09-09 Thread Jeff 'japhy' Pinyan
On Sep 9, david said: >Jeff 'Japhy' Pinyan wrote: > >> I really that's too much work. The -t file test should be sufficient: > >your version only checks to see is STDIN is attached to a tty. for example, >run your script from a crontab and you see will it never prints the usage. >(ie, it always t

Re: checking for no input

2003-09-09 Thread david
Jeff 'Japhy' Pinyan wrote: > On Sep 9, Kevin Pfeiffer said: > >>In article <[EMAIL PROTECTED]>, David wrote: >> >>[...] >>> [panda]$ html.pl >>> no input >>> [panda]$ html.pl file.html >>> get file file.html >>> [panda]$ echo "hi" | html.pl >>> get line hi >>> [panda]$ >>> >>> perldoc -f select >

Re: checking for no input

2003-09-09 Thread Jeff 'japhy' Pinyan
On Sep 9, Kevin Pfeiffer said: >In article <[EMAIL PROTECTED]>, David wrote: > >[...] >> [panda]$ html.pl >> no input >> [panda]$ html.pl file.html >> get file file.html >> [panda]$ echo "hi" | html.pl >> get line hi >> [panda]$ >> >> perldoc -f select >> perldoc IO::Select > >Thanks! This is what

Re: checking for no input

2003-09-09 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, David wrote: [...] > [panda]$ html.pl > no input > [panda]$ html.pl file.html > get file file.html > [panda]$ echo "hi" | html.pl > get line hi > [panda]$ > > perldoc -f select > perldoc IO::Select Thanks! This is what I was thinking of; I'll take a look. -- K

Re: checking for no input

2003-09-09 Thread david
Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > >> "R. Joseph Newton" wrote: >>> >>> Kevin Pfeiffer wrote: >>> >>> > I'm looking at HTML::TokeParser. It expects a scalar with a filename >>> > or a reference to a scalar containing the data to parse. >>> > >>> > Thi

Re: checking for no input

2003-09-09 Thread Jeff 'japhy' Pinyan
On Sep 9, R. Joseph Newton said: >> >> Kevin Pfeiffer wrote: >> >> >> >> > I'm looking at HTML::TokeParser. It expects a scalar with a filename or >> >> > a reference to a scalar containing the data to parse. > >Not the provlem at all, Kevin. The problem is those damned extra >operators, in this

Re: checking for no input

2003-09-09 Thread R. Joseph Newton
Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > > > "R. Joseph Newton" wrote: > >> > >> Kevin Pfeiffer wrote: > >> > >> > I'm looking at HTML::TokeParser. It expects a scalar with a filename or > >> > a reference to a scalar containing the data to parse. > >> > > >>

Re: checking for no input

2003-09-09 Thread Jeff 'japhy' Pinyan
I deleted the original message by mistake, but here's your answer: you want to use the -t file test. if (@ARGV) { # getting input via command-line arg $html = shift; } elsif (-t STDIN) { # STDIN is the user's terminal (as opposed to a piped stream) usage(); } else {

Re: checking for no input

2003-09-09 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > "R. Joseph Newton" wrote: >> >> Kevin Pfeiffer wrote: >> >> > I'm looking at HTML::TokeParser. It expects a scalar with a filename or >> > a reference to a scalar containing the data to parse. >> > >> > This works fine: >> > >> > my $html; >

Re: checking for no input

2003-09-08 Thread John W. Krahn
"R. Joseph Newton" wrote: > > Kevin Pfeiffer wrote: > > > I'm looking at HTML::TokeParser. It expects a scalar with a filename or a > > reference to a scalar containing the data to parse. > > > > This works fine: > > > > my $html; > > if (@ARGV) { # get filename for T

Re: checking for no input

2003-09-08 Thread R. Joseph Newton
Kevin Pfeiffer wrote: > I'm looking at HTML::TokeParser. It expects a scalar with a filename or a > reference to a scalar containing the data to parse. > > This works fine: > > my $html; > if (@ARGV) { # get filename for TokeParser > $html = shift; > } else { > my