Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

(Ovid) Re: 'Tailing' a File?

by Ovid (Cardinal)
on Jan 11, 2001 at 00:14 UTC ( [id://51045]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to 'Tailing' a File?

You want something like the following:
while (1) { while (<FILE>) { # do something here } sleep $for_a_while; seek( FILE, 0, 1 ); }
The seek above convinces Perl that you're no longer at the EOF, thus allowing you to continuously read from your file as new lines are added.

However, the real problem is: what's wrong with using a module? If it's reliable and tested, so what?

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid) Re: 'Tailing' a File?
by epoptai (Curate) on Jan 11, 2001 at 22:14 UTC
    I used to have to include the unsavory non-standard module disclaimer before i got perl and apache working at home. The sad fact is that many ISPs with Perl/CGI access don't respond favorably to user CPAN requests, and installing modules in non-standard locations can be tricky, especially if there are further non-standard dependencies.

    Take it from someone who tried to install libwww and all dependencies in a user dir :-o

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://51045]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.