I deliberately chose to use CORE::GLOBAL in my specific case
(despite the unless-you-know-what-you're-doing type of warnings in
"Overriding Built-in Functions", Chap 11.3, the Camel Book).
Only having a vague idea of what the existing code1
looks like, I thought that, all in all, I might be better off replacing
the built-ins globally. As I understand it, Exporter does only
export into a specific namespace, e.g.
_____ MySystem.pm _____
package MySystem;
use Exporter 'import';
@EXPORT = qw(system);
sub system {
print "wrapped system(): @_\n";
}
1;
_____ test.pl _____
#!/usr/bin/perl
use MySystem;
system "echo foo";
package SomeOtherModule;
system "echo bar";
would print
$ ./test.pl
wrapped system(): echo foo
bar
i.e. the second call of system() is not being wrapped...
I'd rather not have to take care of such subleties (not all that
sure I'm not getting myself into other subtleties this way, though... ;)
Could you elaborate on why not to use CORE:: ?
Almut
_____
1
as I mentioned in Using literal Japanese filenames in legacy CP932 encoding with system(), etc., the idea behind writing a jperl
compatibility module is that the large number of existing scripts wouldn't need to be touched
|