in reply to Re^4: backticks and 'Cannot allocate memory'
in thread backticks and 'Cannot allocate memory'

The problem with qx is that hardly anyone checks whether it succeeds - not even people who pipe up "check the return value of open()" each time someone doesn't write 'or die' after an open command.

It may very well be that the `pwd` fails because the fork fails. It's just hard to make sure by inspecting $!/$? not right after the call.

Is there an alternative way for Cwd::cwd to return the current path without 'pwd'
You could redefine the actual function that does the qx, and rewrite the qx using a pipe-open and an exec. Then you can examine what the open/fork returns.
  • Comment on Re^5: backticks and 'Cannot allocate memory'