bbfu, you gave me the piece I needed to see the light with:
A corollary to this is the fact that if you were to call new_tmpfile_name multiple times, END would still only be called once and only the first temp file unlinked. I suspect this is not what you mean to happen.
There's no contradiction between how I think END block queuing works once I realized that the program isn't working correctly. There are a lot of temp files not getting deleted. Why did I think it was working? All of my testing (using just a single temp file) worked great. Makes me think of this joke.
Not sure why I didn't trigger to the END-block-in-a-function weirdness when I originally wrote it. Hopefully it was just late!!
tilly thanks for the pointers about File::Temp and ReleaseAction. File::Temp I knew about and purposefully chose not to use. For this application I'm not in danger of a race condition nor do I need the portability or additional functionality. Because of the specific systems this is deployed on, getting the module deployed on all of them is a lot more of a hassle than it should be. ReleaseAction looks very cool and I'll be pulling it down and playing with it soon.
bbfu thanks for triggering the flash of insight. I thought about the eval approach but decided against it.
tye I implemented something almost identical to this shortly after I ran into the problem. merlyn's got an interesting take on it that I'll keep in mind, but I don't need the general case this time around.
buckaduck The conflict I thought I saw with the documentation was with a chart at the end of chapter 18 in the Camel v3. Even though I knew END blocks should all get queued at compile time, when I thought the code was working it looked like they were getting queued at both compile and run time.
Again, thanks for the help. I thought this might be
another case of perl acting a little too smart. Kind of
like when Dominus pointed out that these two lines do the
same thing:
print "\L\uTeStInG\E.\n"; print "\u\LTeStInG\E.\n";
In reply to Re: END blocks created at run time?
by lemmett
in thread END blocks created at run time?
by lemmett
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |