in reply to Using pipe and reading from the stdin

The big problem I would have with something like that, is that it requires you to remember (and type every time you want to use it) which arguments you need to provide to tail. You can do the same thing in perl fairly easily using something like File::Tail, File::Tail::App, or just plain seek.

For example, I would guess your readStdin.pl looks something like this:

while( my $line = <STDIN> ) { # do some stuff with $line }

Using File::Tail::App, you can very easily build the tail part into your application, like so:

use File::Tail::App; tail_app({ new => shift, line_handler => sub { my ( $line ) = @_; # do some stuff with $line }, });

We're not surrounded, we're in a target-rich environment!

Replies are listed 'Best First'.
Re^2: Using pipe and reading from the stdin
by mellin (Scribe) on Oct 26, 2006 at 14:25 UTC

    Ok, i'll look into that File::Tail. When i started, I was thinking of building that tail functionality to the script itself but decided otherwise for no good reason. But like usually, i shouldn't create the already invented wheel, so i'll take a look into that existing package. Thanks