http://www.perlmonks.org?node_id=1050950


in reply to [SOLVED] Capture the make status

Yes, the vexing problem of chdir being global. Separate your commands, thus:
use File::chdir qw($CWD); use IPC::System::Simple qw(runx); { local $CWD = '...'; runx [0], 'make', 'this'; }
At the end of the block, the working directory will snap back to what it was before. If the directory cannot be changed, it throws an exception. runx as shown will throw an exception if the return code is not 0.