[tpm] Riddle me this ...
uri at stemsystems.com
Fri Dec 28 20:32:19 PST 2012
On 12/28/2012 10:57 PM, James E Keenan wrote:
> On 12/27/12 11:43 PM, Uri Guttman wrote:
>> i want to clarify my statement there. it is the scalar prototype of not
>> that is causing this as well as its low precedence.
> I'm familiar with prototypes as an aspect of subroutines in Perl (for
> instance, Test::More::is is, under the hood, prototyped $$;$), but not
> with the concept of prototypes for operators. Can you point me toward
> the documentation or source code for that?
perldoc -f prototype
by knowing the prototypes of builtin funcs you can emulate them for
tests and such. look at File::Slurp's test error.t which fakes out
sysread and syswrite so it can test handling errors from them. it
overrides them but the prototype has to match.
perl -le 'print prototype "CORE::not"'
perl -le 'print prototype "CORE::!"'
Can't find an opnumber for "!" at -e line 1.
so 'not' isn't just a lower precedence version of ! but it also is a
named function with a prototype. i am sure ! also has a $ prototype but
you can't get that from the prototype call.
More information about the toronto-pm