Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
The stupid question is the question not asked
 
PerlMonks  

Re^2: wantarray documentation in 5.8.7

by Smylers (Pilgrim)
on Jul 25, 2005 at 12:29 UTC ( #477779=note: print w/ replies, xml ) Need Help??


in reply to Re: wantarray documentation in 5.8.7
in thread wantarray documentation in 5.8.7

if I use do on a file, I get a context for wantarray to work on even if it's at the top level of the file.
I'm not sure what you mean by this ...

If you use the do operator to evaluate the contents of a file then code in that file gets the context of the do, so in those circumstances wantarray is meaningful to code at the top level of a file.

... but here's an example in which wantarray doesn't seem to work at the top level

Well done. Now the actual purpose of this thread is to find a form of words that distinguishes these cases, so the docs can be patched to avoid the current inaccuracy which suggests that wantarray is never meaningful at the top level.

Smylers


Comment on Re^2: wantarray documentation in 5.8.7
Re^3: wantarray documentation in 5.8.7
by tlm (Prior) on Jul 25, 2005 at 12:44 UTC

    Now the actual purpose of this thread is to find a form of words that distinguishes these cases, so the docs can be patched to avoid the current inaccuracy which suggests that wantarray is never meaningful at the top level.

    The docs say nothing of whether wantarray it is "meaningful" or not at the top level. All they say is that its behavior at the top level is officially unspecified. I.e. two different releases of Perl may exhibit different behaviors and both be within spec.

    the lowliest monk

Re^3: wantarray documentation in 5.8.7
by simonm (Vicar) on Jul 26, 2005 at 17:31 UTC
    Now the actual purpose of this thread is to find a form of words that distinguishes these cases, so the docs can be patched to avoid the current inaccuracy which suggests that wantarray is never meaningful at the top level.

    I would guess, although I have not tested it, that the talk about the "top level" also applies to code entered via -e, even though that's not "a file."

    The distinction seems to be about the "main" source code, so I'd say: "wantarray()'s result is unspecified in the top level of a source file a program's main source code, in a BEGIN , CHECK , INIT or END block, or in a DESTROY method."

    Perhaps "main source code" isn't the right phrase, but it's closer to the point than "a source file."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://477779]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-04-17 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (437 votes), past polls