View Task #510
Summary: Make cleanup section useful or eliminate it
| Difficulty:
2 |
|
Version goal:
1.4 |
|
| Status:
Unassigned |
|
Description
The code in a <%cleanup> block does not execute if the component explicitly returns, or if an abort or error occurs in that component or one of its children. Since <%cleanup> sections are generally used for important cleanup code that is expected to be called no matter what, this makes <%cleanup> both misleading and fairly useless.
Either we should make the cleanup code execute no matter what (e.g. by creating a hidden lexically scoped object with a DESTROY method), or take it out altogether. The former would consistitute an incompatibility, though probably an acceptable one for a major release.
History
| Oct 25, 2003 02:21 PM |
|
Jonathan Swartz created task.
|
| Oct 25, 2003 02:21 PM |
|
Jonathan Swartz set difficulty to 2.
|
| Oct 26, 2003 09:36 AM |
|
Ken Williams
writes: The latter would constitute an incompatibility too, arguably a bigger one. I'd probably favor the former solution.
|
| Sep 29, 2004 09:37 AM |
|
Jonathan Swartz changed version_goal from 1.3x to 1.3.
|
| Sep 29, 2004 09:37 AM |
|
Jonathan Swartz
writes: If we do this, we should do it right at 1.3, because it's going to be a significant incompatibility no matter what.
|
| Oct 4, 2004 10:19 AM |
|
David Wheeler
writes: A couple of comments:
* I have always treated <%cleanup> as if it were a <%last>, on the assumption that it is basically just the last %perl that runs, in the same way that %init is the first. If you change the behavior of %cleanup, this approach could still be useful, so perhaps it could just be renamed to something like %last, and then the new behavior you describe could be called %cleanup. IOW, I find the current semantics useful, and wouldn't mind keeping them in some form.
* I have found that %cleanup has run for me when I explicitly return from %init. It took me a while to figure out that I needed to abort() to prevent it from running.
Cheers!
David
|
| Dec 12, 2004 05:40 AM |
|
Jonathan Swartz
writes: > * I have found that %cleanup has run for me when I explicitly return from %init
This is false, at least with the default compiler and lexer. The way <%cleanup> is implemented makes it almost impossible for this to be true.
|
| Dec 12, 2004 05:48 AM |
|
Jonathan Swartz changed version_goal from 1.3 to 1.3x.
|
| Dec 12, 2004 05:48 AM |
|
Jonathan Swartz
writes: For now, I've improved the documentation and added a FAQ entry. This isn't important enough to create an incompatibility yet, at least for 1.3.
|
| Dec 12, 2004 05:57 AM |
|
Jonathan Swartz changed version_goal from 1.3x to 1.4.
|