DEMOLISH and bad call to new()
[email protected] (Ernesto)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
Hi,
encountering strange errors à la 'sometimes it works, sometimes not'
from my objects I found, that this maybe a bug deep in Moose's bowels.
If you define a class using DEMOLISH and a required typed attribute,
then the very first call to new() without any parameters returns only
'undef' and does not die, as expected, with the error message
'Attribute ... is required'.
Subsequent calls to new with undefined or empty parameters die with the
correct error.
Moreover, if you create another object with no DEMOLISH defined first,
than the subsequent call to new for the class with DEMOLISH will work as
expected.
I boiled this down to a repeatable test - please have a look at
http://dienstleistung-kultur.de/moose/02_demolish_required.t.txt
Xanx!
Yours,
Ernesto