Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

(Ovid) Re: 'Tailing' a File?

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


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 12, 2001 at 03: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-24 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found