John Deighan wrote:
You are right that 'return' will return from either 1) the enclosing eval block or 2) the enclosing function, whichever is "closer". However you misunderstood what I was saying. My structure is more like:

I'm sorry if I seemed to have misunderstood you.

eval {
        ...some code
        func();
        };
if ($@) {
        ...handle if an error occurred
        }


So what's preventing you from doing this then?

  eval {
    ...
    func();
    return;
  };



# --- this possibly in another file
sub func {

... so something
return;
}


I still don't see why you're so anxious to "die" in sub func. Dieing isn't something you'd do in the course of normal operation. And func may be used elsewhere, so that other code would have to know about the altered behaviour as well. That smells like bad interface design.

If func dies when something goes wrong, then my suggesting should still work properly: the eval will break of immediately, and never reaches the next return() statement.

Rhesa
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to