On Fri Jan 13 14:56:51 2012, MPREWITT wrote:
Show quoted text> $ERROR is not cleared at the start the new method. If an error causes
> $ERROR to be set and then a new valid template is created/filled-in,
> $ERROR is still set to the prior error.
>
> I think that setting $ERROR to undef at the top of the new method
> should fix it but it may also need to be set to undef at the top of
> fill_in as well.
It seems it is a standard behavior. Look at POSIX, for example. Functions never clear errno.
It is caller responsibility to read $ERROR ONLY IFF the called function returned undef (in such a case it will be set by the last call). If called function returns success, the called should not check $ERROR (in such a case it does not matter whether the last call cleared $ERROR or not).
BTW, caller can easily clear $ERROR before call:
local $Text::Template::ERROR;
fill_in_string( ... );