I am attempting to create a top-level script that will call about 35+ other scripts that will each seek to modify/create text files. Not the best approach of doing things and not the most fun either, but needs must.
I call each of these scripts with the ‘system’ command, but I would like to know of methods to find out which files have been created/modified by each script that was called.
The most non-intrusive way is to simply note the timestamps on all files in the work directory before and after running the sub-script, but I worry that might not be robust enough.
So I am wondering whether there is a module/method in Perl which I can quickly put into all the sub-scripts that will catch all file operations and pass that onto the calling script as a return value of some sort?
All help much appreciated and alternative ideas very welcome indeed!
cheers
Like a’r suggested, I would be tempted to use
strace. Replace calls tosystem()with calls to this wrapper:Then you only modify the parent script instead of all of the child scripts.
The
-eopenparameter tostracefilters out only theopencalls. This will also catch calls tofopen(which is a C library routine and not a system call.)