in reply to Overwrite built-in wantarray()

It looks unoverrideable to me:

my $p = prototype 'wantarray'; print defined $p ? $p : "(not overrideable)";

Replies are listed 'Best First'.
Re^2: Overwrite built-in wantarray()
by almut (Canon) on Aug 20, 2007 at 23:06 UTC

    I think the conclusion is correct, though the test is not done properly ;) — the function name argument to prototype should've been prefixed with CORE::.

    Compare the results using a function that is overrideable, like open

    for my $func qw(CORE::open open) { my $p = prototype $func; print "$func: ", defined $p ? $p : "(not overrideable)", "\n"; }

    Output:

    CORE::open: *;$@ open: (not overrideable)