Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of rafael (2125)

Monday December 03, 2001
08:27 AM

Overridable builtins

[ #1472 ]
There's no end at learning about Perl.

Contrary to some common belief, (dunno how much common it is), it appears that if you want to test whether a function is overridable, the idiom

$overridable = defined prototype "CORE::$builtin";

does not work (at least with perl 5.6.1). Try with system or exec (on a recent perl). Their prototype is undefined, but they are overridable. And perlfunc/prototype never said it should be otherwise.

FWIW, this minimal code defines a function that gives the correct result :

use Inline C => <<'**END_C**';
I32 overridable(char *name) {
    return keyword(name,strlen(name)) < 0 ? 1 : 0;
}
**END_C**

Perhaps I will put this in a module. With a counterpart that tests if a function is overriden. If I have time.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.