Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot, bind-address mysql multiple, sanibleone xxxx, ftp://192.168.100.100/, www.xxxcon

Links

XODOX
Impressum

#1: Use of "caller" is ambiguous

Posted on 2007-10-11 19:04:25 by Ferry Bolhar

Hi,

when writing

*{caller . '::vtx_get_page'} = sub {....};

Perl complains with

Use of "caller" without parentheses is ambiguous

Why is this expression ambiguous?

Greetings, Ferry
--

Report this message

#2: Re: Use of "caller" is ambiguous

Posted on 2007-10-11 19:17:44 by Paul Lalli

On Oct 11, 1:04 pm, "Ferry Bolhar" <ferry.bol...@chello.at> wrote:
> Hi,
>
> when writing
>
> *{caller . '::vtx_get_page'} = sub {....};
>
> Perl complains with
>
> Use of "caller" without parentheses is ambiguous
>
> Why is this expression ambiguous?

Hmm. I'm not entirely sure. `perldoc perldiag` says about this
warning:
Warning: Use of "%s" without parentheses is ambiguous
(S ambiguous) You wrote a unary operator followed by
something that looks like a binary operator that could
also have been interpreted as a term or unary operator.

But I don't see how that applies here. Obviously, "caller" is the
unary operator, but I don't see how the binary operator "." could also
be interpreted as a term or unary operator. `perldoc perlop`
certainly doesn't make reference to any unary "." operator.

I'm curious to see what other responses you get in this thread...

FWIW, you can reduce the issue to something as simple as:
perl -wle'$x = caller . "foo";'

Paul Lalli

Report this message

#3: Re: Use of "caller" is ambiguous

Posted on 2007-10-11 23:57:28 by Michele Dondi

On Thu, 11 Oct 2007 19:04:25 +0200, "Ferry Bolhar"
<ferry.bolhar@chello.at> wrote:

>*{caller . '::vtx_get_page'} = sub {....};
>
>Perl complains with
>
>Use of "caller" without parentheses is ambiguous
>
>Why is this expression ambiguous?

I don't know, but I often get the same behaviour with another
construct, which is also surprising. I've never dared to ask and just
added parens without doing so.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Report this message

#4: Re: Use of "caller" is ambiguous

Posted on 2007-10-12 01:00:19 by Ben Morrow

Quoth "Ferry Bolhar" <ferry.bolhar@chello.at>:
>
> when writing
>
> *{caller . '::vtx_get_page'} = sub {....};
>
> Perl complains with
>
> Use of "caller" without parentheses is ambiguous
>
> Why is this expression ambiguous?

It's not. However, the analogous expression

caller + 5

*is* ambiguous ( caller(+5) rather than caller() + 5 ) and the warning
code either isn't smart enough to tell the difference, or is assuming
you aren't.

That's my story, anyway, and I'm sticking to it. If I do too much poking
around in toke.c my brain will dribble out of my ears... :)

For example, with 5.8.8:

~% perl -wle'print rand-10'
Warning: Use of "rand-10" without parentheses is ambiguous at -e
line 1.
-5.64649815977649

Ben

Report this message

#5: Re: Use of "caller" is ambiguous

Posted on 2007-10-12 14:59:30 by Michele Dondi

On Thu, 11 Oct 2007 23:57:28 +0200, Michele Dondi
<bik.mido@tiscalinet.it> wrote:

>>Why is this expression ambiguous?
>
>I don't know, but I often get the same behaviour with another
>construct, which is also surprising. I've never dared to ask and just
>added parens without doing so.

I forgot to add that for some reason I can't remember *which*
construct it is, but it was perhaps implicit.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Report this message