Hi,
Is it possible to override exec globally, from a required package?
does seem to indicate global override is possible, but this test case did not work:
execover.pl:
package execOverride;
BEGIN {
*CORE::GLOBAL::exec = sub {
my $cmd = shift;
print "Called exec override\n";
CORE::exec($cmd);
};
}
1;
main.pl:
require execover.pl
exec(<something to exec>);
It works fine if the override is in the same file as the exec() call.
Short background:
Semantics for invoking a DCL shell script changed between original OpenVMS perl and HP's currently distributed perl build. Old requires "$@file.com", new requires "@file.com". I have a number of programs that have to work under both perls, and was hoping to make the necessary adjustments to the calls in an exec overload.
It would be painful to add the overload manually to each program needing it (and its something that may be forgotten).
- Tracy
In reply to Overriding exec globally by thughes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |