From 0bbad7483f446e61b319d774f9c5d184a33ea442 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Mon, 15 Aug 2011 09:28:51 -0700 Subject: [PATCH] &CORE::not and &CORE::getprotobynumber These two are now supported. They were not before, because their prototypes gave them unary precedence, even though these ops both have list precedence. That was corrected in the previous commit. --- gv.c | 5 +---- lib/CORE.pod | 2 +- pod/perldelta.pod | 4 ++-- t/op/coreinline.t | 6 +++--- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/gv.c b/gv.c index 1741bda..aa306c8 100644 --- a/gv.c +++ b/gv.c @@ -1338,15 +1338,12 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, SV *opnumsv; if (code >= 0) return gv; /* not overridable */ /* no support for \&CORE::infix; - no support for &CORE::not or &CORE::getprotobynumber - either, yet, as we cannot get the precedence right; no support for funcs that take labels, as their parsing is weird */ switch (-code) { case KEY_and: case KEY_cmp: case KEY_CORE: case KEY_dump: case KEY_eq: case KEY_ge: - case KEY_getprotobynumber: case KEY_gt: case KEY_le: - case KEY_lt: case KEY_ne: case KEY_not: + case KEY_gt: case KEY_le: case KEY_lt: case KEY_ne: case KEY_or: case KEY_x: case KEY_xor: return gv; } diff --git a/lib/CORE.pod b/lib/CORE.pod index 1a98f76..10fa424 100644 --- a/lib/CORE.pod +++ b/lib/CORE.pod @@ -35,7 +35,7 @@ feature is new in Perl 5.16. You can take references to these and make aliases. However, they can only be called as barewords; i.e., you cannot use ampersand syntax (C<&foo>) or call them through references. See the C example above. This works for all overridable keywords, except -for C, C, C and the infix operators. +for C and the infix operators. =head1 OVERRIDING CORE FUNCTIONS diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 2309a09..8067780 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -37,8 +37,8 @@ must be called as barewords. In other words, you can now do this: BEGIN { *entangle = \&CORE::tie } entangle $variable, $package, @args; -This currently works for overridable keywords other than C, C, -C and the infix operators. +This currently works for overridable keywords other than C and the +infix operators. Work is under way to allow these subroutines to be called through references. diff --git a/t/op/coreinline.t b/t/op/coreinline.t index ce3ce37..fb5c44e 100644 --- a/t/op/coreinline.t +++ b/t/op/coreinline.t @@ -12,7 +12,7 @@ use B::Deparse; my $bd = new B::Deparse '-p'; my %unsupported = map +($_=>1), qw (CORE and cmp dump eq ge gt le - getprotobynumber lt ne not or x xor); + lt ne or x xor); my %args_for = ( dbmopen => '%1,$2,$3', dbmclose => '%1', @@ -77,8 +77,8 @@ while(<$kh>) { next if ($proto =~ /\@/); # These ops currently accept any number of args, despite their # prototypes, if they have any: - next if $word =~ /^(?:chom?p|exec|keys|each|read(?:lin|pip)e|reset - |system|values|l?stat)/x; + next if $word =~ /^(?:chom?p|exec|keys|each|not|read(?:lin|pip)e + |reset|system|values|l?stat)/x; $tests ++; $code = -- 2.7.4