Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

(Ovid) Re: 'Tailing' a File?

by Ovid (Cardinal)
on Jan 11, 2001 at 05:14 UTC ( #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? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2022-05-19 03:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?