On 11/28/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote:
>> So any ideas about how to get: >> >> goto &CORE::return; >> >> to work like it reads. >> > The suggestions you were given do exactly what you ask for. Obviously, > read 'goto &CORE::return()' differently from the rest of the list. So > instead of complaining, why don't you explain how you read it, instead > of simply repeating "work like it reads"?Sorry if it came across as complaining, simply trying to clarify I said thanks for the suggestions didn't I? Also perhaps CORE::return is wrong, Ii shoudl have clarified that its was pseudo code better. So assuming '&return' is the perldoc -f goto '&NAME' that is necessary: What I want to do is make it so that "goto &return;" : "exits the current subroutine (losing any changes set by local()) and immediately calls in its place the named subroutine using the current value of @_." - perldoc -f goto I understand return is special (which is why I'm asking about it here ;p) and I understand the philosophies involved, I just want to know how it can be done if nothing else for a learning experience. Definately sorry if I came across as anything but greatful and curious.
Ah, that's a different story. The first step is to write your replacement "return". Since you can't override built-ins at compile time, you'll need to either use subs, or put it in an external module you import with use. See perlsub for the details. After that, any call to return will get your return and 'goto &return' should work as expected. The built-in will still be available as CORE::return. A better solution, though, would probably be to not export it, and call it with 'YourMod::return()' or 'goto &YourMod::return' as needed. That way you won't run into unexpected namespace conflicts. You may want to take a look at the AutoLoader and SelfLoader docs, as well. HTH, -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
