smg1827 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I got a Perl script from my colleague which I am going to run on my server.
This script is written to setup some folder structure and to create some users/group/permission/ownership. So, most part of the script uses backtick to call OS commands with some logic behind it. (my question is not about whether backtick is good or bad).
I want to make a minimum changes to the script so that every backtick with variable interpolation (example: `cd $v` should be recorded as 'cd /var/tmp', same as executed by OS) is recorded on STDOUT/STDERR or to some log file.
I don't want to go and add print statement just before every backticks.
What should be the good minimum change (either internal change or thru some wrapper) with or without any modules would help my scenario?
I am thinking of *analogy* like $SIG{__DIE__} = sub {}
I am looking for a summary of chmod, chown, mkdir OS commands executed by this perl script.
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: record every backtick on STDOUT or some log file
by kennethk (Abbot) on Apr 23, 2012 at 21:05 UTC | |
|
Re: record every backtick on STDOUT or some log file
by Anonymous Monk on Apr 24, 2012 at 06:09 UTC | |
by Anonymous Monk on Apr 24, 2012 at 06:11 UTC | |
|
Re: record every backtick on STDOUT or some log file
by Anonymous Monk on Apr 23, 2012 at 22:18 UTC | |
|
Re: record every backtick on STDOUT or some log file
by thargas (Deacon) on Apr 25, 2012 at 11:42 UTC |