Ernesto,

Very odd, when I turned on all your tests, I got one error, which was the second test saying it didn't have anything inside [EMAIL PROTECTED] This was fixed by localizeing $@ inside the DEMOLISHALL routine.

Look at line 50 of Moose::Object here:

  http://code2.0beta.co.uk/moose/svn/Moose/trunk/lib/Moose/Object.pm

And you will see the change i made. I also cleaned up your test a little to make sure that each test was not polluting the previous one, and then added it to the test suite here:

http://code2.0beta.co.uk/moose/svn/Moose/trunk/t/100_bugs/ 011_DEMOLISH_eats_exceptions.t

This should take care of your issues.

(FYI - the Moose svn repo is public readable, so you can grab the latest version of that and Class::MOP if you like, they should be released in the not too distant future).

- Stevan


On Apr 5, 2008, at 4:03 PM, Ernesto wrote:
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





Reply via email to