in reply to Re^5: Poll: Is your $^X an absolute path? (system @list)
in thread Poll: Is your $^X an absolute path?
I think the safe thing is to always surround the first argument with double-quotes if more than one argument is provided and it doesn't already seem to have double quotes. (If only one argument is provided, we have to assume the user provided a valid command line on the current platform.) So, ignoring error reporting, something like this:
sub system { $_[0] = qq{"$_[0]"} if @_ > 1 && substr($_[0],0,1) ne q{"}; CORE::system( @_ ); }
On reflection, that seems simple enough that maybe we can get some p5p person to patch it.
Some references about how spaces are handled in program names:
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Poll: Is your $^X an absolute path? (system @list)
by tye (Sage) on Aug 18, 2006 at 14:27 UTC | |
by xdg (Monsignor) on Aug 18, 2006 at 14:51 UTC | |
by BrowserUk (Patriarch) on Aug 18, 2006 at 15:07 UTC | |
by tye (Sage) on Aug 18, 2006 at 15:21 UTC | |
by BrowserUk (Patriarch) on Aug 18, 2006 at 15:28 UTC | |
| |
by tye (Sage) on Aug 18, 2006 at 15:13 UTC | |
by xdg (Monsignor) on Aug 18, 2006 at 16:08 UTC | |
by tye (Sage) on Aug 18, 2006 at 16:37 UTC |