in reply to Clean exit using File::Tail

There is an internal variable called %SIG which is used to trap signals, such as:
sub QuitHandler { do_cleanup(); } $SIG{'QUIT'} = \&QuitHandler;
You can catch everything, but be sure that you don't make it impossible to KILL your program.

Replies are listed 'Best First'.
Re: Re: Clean exit using File::Tail
by dserodio (Novice) on May 16, 2001 at 02:29 UTC
    Cool, but how do I tell File::Tail to cleanup, ie read the remaining lines before exiting?

      Looking at the docs for File::Tail I might recommend you upgrade to version .98 if you have .60.

      It appears that you could add the reset_tail=>0 parameter to the 'new' method, then close and reopen the file causing the mod to immediately reread the file. Also you could brutishly set maxinterval very low.
      Untested, though.

      What happens if your QuitHandler calls exit (and/or your File::Tail object goes out of scope)?
      Update: You might also consider calling the nowait method.

      --isotope
      http://www.skylab.org/~isotope/