There is one thing I can't figure out. As far as I know the program called 'less' prints its input on the screen providing a nice interface for examining the contents of another program's output.
less works fine in situations like:
Expand|Select|Wrap|Line Numbers
- perl -e 'print "test"' | less
- ls | less
- cat /etc/passwd | less
linkchk.pl
Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl
- #
- # Usage: ./linkchk.pl filename_containing_urls
- # or cat file | ./linkchk.pl
- use LWP;
- $ua=LWP::UserAgent->new;
- $ua->timeout(3);
- $req=HTTP::Request->new;
- $req->method("HEAD");
- # create and urllist file
- # try ./linkchk.pl urllist | less
- print STDOUT "Why can't ./linkchk.pl urllist|less see this?\n";
- while (<>)
- {
- chomp($line=$_);
- $req->uri($line);
- $res=$ua->request($req);
- if ($res->is_success)
- {
- print STDOUT "$line\n";
- }
- else
- {
- print STDERR "[FAIL] $line\n";
- }
- }
(Fedora9, perl 5.10.0)