On Tue, Oct 19, 2021 at 7:45 PM Oodler 577 via perl5-porters < perl5-porters@perl.org> wrote: > * hv@crypt.org <hv@crypt.org> [2021-10-19 21:49:47 +0100]: > > > "Paul \"LeoNerd\" Evans" <leonerd@leonerd.org.uk> wrote: > > [...] > > : try { > > : ## 100 lines here > > : } > > : finally { > > : say "Oh and just do this before you go" > > : } > > [...] > > : { > > : ## 100 lines here > > : } > > : finally { > > : say "Oh and just do this before you go" > > : } > > Replying to Hugo's comment only to honor it; but in the case of > the bare block this seems like a NOOP unless "finally" implies a > "wait" or waitpid for thing, but I don't know what things that > could be other than a child process spawned by either C<fork> or > an explict background shell command via C<system> or C<``> or > C<qx//>, etc. > > LABEL: > { > # do stuff > # spawn a child proc > } > finally { > # do more stuff but what's > # the state of child process? > } > > 1. when does `finally` get executed, does it wait for child pid? > 2. does LABEL: work as expected if one does, `next LABEL;`? > Forking has no relevance to the concept. The difference finally makes, as with defer, is that it runs when the associated scope is exited, even if it's done so via an exception, loop control, etc. -DanThread Previous | Thread Next