On Tue, Dec 04, 2007 at 08:40:10AM -0800, Jonathan Lang wrote: : or (I think): : : method test ($value) { : setup(); : when $value { doit() } #[smart-match the calling object $_ against $value.] : }
I know it used to be that way back near the Dawn of Time, but methods don't automatically topicalize anymore unless you explicitly name one of the parameters '$_': method test ($_: $value) { setup(); when $value { doit() } #[smart-match the calling object $_ against $value.] } : (Question: assuming that the above is valid, would breaking out of the : when block be the same as returning from the method? Or would it : qualify as an abnormal termination of the method?) Well, according to S04: "If the smart match succeeds, C<when>'s associated block is executed, and the innermost surrounding block that has C<$_> as one of its formal parameters (either explicit or implicit) is automatically broken out of." So it merely returns normally from the method, which is what you'd generally expect. If you have more questions about switches, S04 probably already discusses it. Larry