Re: Could I put commands in a variable
From: Randy W. Sims (RandyS_at_ThePierianSpring.org)
Date: 02/20/04
- Next message: Rob Dixon: "Re: algorithm query"
- Previous message: Chris McMahon: "RE: YA Win32::ODBC question: script hangs on 16th table."
- In reply to: James Edward Gray II: "Re: Could I put commands in a variable"
- Next in thread: Dan Muey: "RE: Could I put commands in a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 20 Feb 2004 09:54:12 -0500 To: James Edward Gray II <james@grayproductions.net>
On 02/20/04 09:38, James Edward Gray II wrote:
> On Feb 20, 2004, at 4:25 AM, Randy W. Sims wrote:
>
>> On 02/19/04 23:21, James Edward Gray II wrote:
>>
>>> On Feb 19, 2004, at 9:22 PM, R. Joseph Newton wrote:
>>>
>>>> I don't know, Rob. I would be interested in hearing of any
>>>> real-world problem that
>>>> would demand this.
>>>
>>> I believe the text book example is a language that lacks support for
>>> something like Java's "finally" block. A goto can guarantee you get
>>> to the code that must be executed, no matter the outcome of the
>>> current block.
>>> James
>>
>>
>> One example of a legitimate use of goto from perlsub:
>>
>> Many "AUTOLOAD" routines load in a definition for the
>> requested subroutine using eval(), then execute that sub-
>> routine using a special form of goto() that erases the
>> stack frame of the "AUTOLOAD" routine without a trace.
>> (See the source to the standard module documented in
>> AutoLoader, for example.)
>
>
> The version of goto() your are talking about here, goto &NAME, is a
> little different from your standard goto(). From 'perldoc -f goto':
Ok, but there is another use I didn't think of until I saw another post
on this list: it can be used to jump out of an eval...
Note that I have never used goto in any perl code, but I do allow that
there can be valid uses of it. I've actually seen it used a lot in code
by some prominent members of the perl community (you can learn a lot
browsing other people's code). It's definately a construct you should be
carefull with.
Randy.
- Next message: Rob Dixon: "Re: algorithm query"
- Previous message: Chris McMahon: "RE: YA Win32::ODBC question: script hangs on 16th table."
- In reply to: James Edward Gray II: "Re: Could I put commands in a variable"
- Next in thread: Dan Muey: "RE: Could I put commands in a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|