[tpm] Riddle me this ...
Fulko Hew
fulko.hew at gmail.com
Fri Dec 28 20:28:58 PST 2012
On Fri, Dec 28, 2012 at 10:57 PM, James E Keenan <jkeen at verizon.net> 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?
>
Don't think about prototypes, its seems you are encountering a precedence
issue.
Check out the following, and play with variations on the theme:
perl -e 'use Data::Dumper; sub is {print Dumper($_) foreach (@_); } is(!
1, not 1, "test1");'
$VAR1 = '';
$VAR1 = '';
what you in effect have are
arg 1: ! 1
arg 2: not 1, "test1"
that is, because of precedence, the latter part effectively becomes
not (1, "test1")
Then look what happens when you remove the 'not':
perl -e 'use Data::Dumper; sub is {print Dumper($_) foreach (@_); } is(! 1,
1, "test1");'
$VAR1 = '';
$VAR1 = 1;
$VAR1 = 'test1';
You see the three parameters you think your providing,
so what you really wanted is:
is ( ! 1, (not 1), "test1");
Fulko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20121228/941d2aca/attachment.html>
More information about the toronto-pm
mailing list