I have a Perl script which invokes other programs, i.e. it calls system
and/or exec
and/or open
with a pipe and/or uses the backtick operator.
Can I run this script in such a way that it will print out the arguments to each of the above so that I can see what it is calling into?
For example a program like this which I cannot modify
#!/usr/bin/perl
sub get_arg {return "argument$_[0]";}
system "./foo", get_arg(1), get_arg(2);
print `./foo abc def`;
Invoked something perhaps like this
perl --shell-trace-on ./myscript.pl
Which will in this case output
./foo argument1 argument2
./foo abc def
It is acceptable to throw away myscript.pl's normal output or blend it with this trace.
Thanks a lot.