in reply to become another via exec in dispatch table
exec 'perl -e "print map {qq!\t$_\n!}"',@_
will fail with ENOENT (No such file or directory) when @_ isn't empty. When using the multiple argument form of exec the first argument is to be the program to execute. There's no file named perl -e "print map {qq!\t$_\n!}", much less a program.
And when @_ is empty, you have a different problem. perl will run, but the shell will have replaced $_ with something else due to improper quoting.
The solution to both is:
exec 'perl', '-e', 'print map {qq!\t$_\n!}', @_
Are these the problems you were asking about?
PS — If you had a problem with exec, you should have checked what error exec returned.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: become another via exec in dispatch table
by Discipulus (Canon) on Jan 31, 2012 at 10:46 UTC | |
by ikegami (Patriarch) on Jan 31, 2012 at 12:05 UTC | |
by Discipulus (Canon) on Jan 31, 2012 at 12:36 UTC | |
by ikegami (Patriarch) on Jan 31, 2012 at 21:18 UTC | |
by ikegami (Patriarch) on Jan 31, 2012 at 21:24 UTC |