>>>>> "AS" == Aaron Sherman <[EMAIL PROTECTED]> writes:
AS> In timing tests, I find goto to be slightly slower than named labels, AS> but much faster than what I would have had to do in File::Copy to AS> preserve all of the different possible errors (e.g, I don't want the AS> error produced by the "close", I want the error that caused me to close AS> in the first place). There are a bunch of permutations and goto was the AS> only way I found to keep everything I needed, and make it efficient. AS> Feel free to find a better way! see what i do in File::Slurp. i wanted a single error handling sub but also to have the croak in there report back from the original call (say read_file). so i use magic goto (after munging @_). depending on how you want to handle errors it might be a good solution. i can't recall ever using goto label in all my years of perl coding. i can always come up with a better way. one idea i use a lot is early return in a nested sub. that section of code is made into a sub and the early return (maybe in a nested loop) replaces the deep goto label. i call this using subs for flow control. another fun thing in File::Slurp is 5 return statements in a row. all are legit (obviously the first 4 have conditional modifiers on them) and it is fairly clear (and well commented). so show me any goto label code and i bet i can rewrite it without it and keep it clear and efficient. note that i started with structured programming in PL/I so i didn't even have goto in my brain until assembler a couple of months later. but that doesn't include the programmable calculator i taught myself how to use in high school. all it had was gotos and even then i structured my code as much as possible. i have never done spaghetti coding at any point in my career. maybe i have more innate understanding of logic than some but i always wonder how spaghetti coders think (or rather don't think! :). uri -- Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

