chaskins has asked for the wisdom of the Perl Monks concerning the following question:

Hi, is there any way to figure out how many times a file is accessed using Perl? Or would anyone have any ideas how I could monitor how many times a file is accessed for a given period?
Thanks
Chris

Replies are listed 'Best First'.
Re: How many times a file is accessed
by scain (Curate) on Aug 01, 2001 at 18:21 UTC
    I suppose it depends on what you mean by accessed. Do you mean read with a web browser? If so you can monitor the access log generated by your web server. Check Apache::Traffic for this.

    If you mean something else, you'll have to be more specific. It might be very difficult to measure in any other context, since there are so many ways to access a file.

    Scott

    Update about Apache::Traffic: I suspect this will not be useful for you, as it appears to only deal with users, not specific files. Nevertheless, it should be quite easy to build a simple parser that parses the access.log file for a given file.