Subject: | delayed objects don't have container attribuet |
It looks like delayed objects don't have their container set properly.
I've attached at test.
I ran through the debugger with this; in &create_delayed_object everything is fine; the
container is put in place properly before the call to call_method 'new'. In &new, the "bless
scalar validate_with" statement ends up dumping the "container" value because it isn't part of
create_contained_objects, from what I could tell.
I think this must be a bug, but maybe my expectations are faulty?
package Now_Later;
use base qw(Class::Container);
__PACKAGE__->valid_params(
now => { isa => 'Now_Later::Now' }
);
__PACKAGE__->contained_objects(
now => 'Now_Later::Now',
later => { class => 'Now_Later::Later', delayed => 1 }
);
package Now_Later::Now;
use base qw(Class::Container);
__PACKAGE__->valid_params();
package Now_Later::Later;
use base qw(Class::Container);
__PACKAGE__->valid_params();
package main;
use Test::More 'no_plan';
my $nl = Now_Later->new;
isa_ok($nl, "Now_Later");
isa_ok($nl->{now}, "Now_Later::Now");
is($nl->container, undef, "parent object has no container");
isa_ok($nl->{now}->container, "Now_Later");
my $later = $nl->create_delayed_object('later');
isa_ok($later, "Now_Later::Later");
isa_ok($later->container, "Now_Later");
1;