On Tue, Aug 10, 2010 at 08:12, Ramprasad Prasad <ramprasad...@gmail.com> wrote:
> On a linux server I need to "tail -f" a file continuosly in perl and
> whenever there is a new entry I insert into a DB
>
> If I use File::Tail::FAM I get this error
> Your vendor has not defined SGI::FAM macro FAM_DEBUG_OFF at
> /usr/lib/perl5/site_perl/5.8.8/File/Tail/FAM.pm line 16
snip

You may want to take a look at this [PerlMonks article][0].

snip
> I wanted to use FAM , because I wanted to tail the file automatically on
> update without wasting IO / CPU. should I use File::Tail insted
snip

There is no wasted IO with File::Tail and very little wasted CPU.  The
major drawback to polling the way File::Tail does is that there can be
more of a lag between when data is added to the file and when you read
it.  SGI's FAM and Linux's inotify have the benefit that the
registered program is notified immediately when new data is available,
but File::Tail will check the file between interval (default 10) and
maxinterval (default 60) seconds.  This means your data will be
between 0 and interval seconds old in the best case senario (lots of
writes) and up to maxinterval seconds old in the worst case senario (a
write that happens after a long period on inactivity).

You may also want to look at [File::ChangeNotify][1] and [Linux::Inotify2][2].

 [0]: http://www.perlmonks.org/?node_id=493745
 [1]: http://search.cpan.org/dist/File-ChangeNotify/lib/File/ChangeNotify.pm
 [2]: http://search.cpan.org/dist/Linux-Inotify2/Inotify2.pm
-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
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