Harry Putnam wrote:
> Shawn H Corey <shawnhco...@gmail.com> writes:
> 
>> http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm
> 
> Thanks that looks useful.  Is there a reason why I should use that
> module as apposed to the kind of code offered in the faq about 
> tail? (perldoc -q  tail) as suggested by another poster (Jim G).
> 
> I mean, I'm not experienced enough to know if there are things the
> module handles that a simple script like the one below does not.
> 
>   open(FILE,"<./named-pipe") or die "Can't Open ./named-pipe: $!";
>   while(<FILE>){
>     print;
>     if(eof){
>       sleep 2;
>       seek (FILE,0,1);
>     }
>   } 
> 
> It seems at least to survive repeated restarts of system logger.
> 
> If I write my script based on this code... what I'd be adding would be
> code to get 1 or 2 rgx from the cmdline, then write the hits to
> various files.
> 
> I'm told there is a systematic way to add my script to solaris bootup,
> and to restart it automatically if need be.  But other than those are
> there other `gotchas' or whatever I'm liable to need the module for?
> 
> 

In the general case, modules usually take care of special cases that you
 may not be aware of.  That makes them the preferred method of solving a
problem.

In this case, the above code is a kludge.  You can tell this because the
program sleeps, rather than waiting on input.  When a program does
something to emulate what it really should be doing, it introduces code
that may not work in all cases.


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to