tomazos has asked for the wisdom of the Perl Monks concerning the following question:
sub fileread($) { my ($relpath) = @_; ... }
and I have a directory path:
my $dir = '/path/to/some/dir';
and then I want to execute a system command which will start a subprocess and wait for it to complete:
system(...);
I want to set it up so that whenever a file within $dir (or any of its subdirectories) is accessed by the subprocess, the fileread function is called with the relative path of the file that was accessed. For example if the subprocess reads /path/to/some/dir/foo/bar, than fileread("foo/bar") should be called. If there is also some way of determining the type of access it made (read, write, delete, create, etc), even better.
Anyone know of any CPAN modules that could help? I am working on Linux BTW if there is no cross-platform solution and only a Linux-specific solution? Approximate solutions are also welcome.
Thanks in advance, Andrew.