I think overriding with *CORE::GLOBAL::system does actually work
in most cases... The main reason that system doesn't have a
prototype (which could be specified with Perl's prototype system), and thus is formally not overridable, is its "indirect
object" syntax (without a comma after the first argument — see
exec), which you can't (syntactically) handle with a Perl
routine... As long as you don't need it, you should be fine. (But there
would still be the problem with overriding backticks, as you're saying.)
Update: Here's a sample command using this indirect object syntax
system {'bash'} 'zsh', '-c', 'echo I think I am a $0';
# outputs "I think I am a zsh" (although it's a bash)
which works fine as long as system isn't overridden.
If you try to override it, you'd just get a compile-time error
syntax error at ./685741.pl line 7, near "} 'zsh'"
Execution of ./685741.pl aborted due to compilation errors.
|