Skip Menu |

This queue is for tickets about the Text-Template CPAN distribution.

Report information
The Basics
Id: 73984
Status: rejected
Priority: 0/
Queue: Text-Template

People
Owner: Nobody in particular
Requestors: MPREWITT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.44
Fixed in: (no value)



$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.
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( ... );
I concur with VDB. Caller should ONLY check $ERROR iff the function returned undef. This is standard behaviour. -- Regards, Michael Schout