Synopsis
{
package Bar;
use Moo;
with "Moo::BrightChild::Role";
sub ping_parent {
print "Hello ", shift->controlling_parent, "!\n";
}
package Foo;
use Moo;
use MooX::TwoWayRelations;
has_two_way bar => qw/is rw/;
}
my $bar = Bar->new;
my $foo = Foo->new( bar => $bar );
$bar->ping_parent; # greets its parent, $foo
$foo->bar( undef );
$bar->ping_parent; # is now an orphan and greets undefined.
Description
This dist would consist of two modules
MooX::TwoWayRelations - adds the has_two_way function to set up an two-way attribute.
Moo::BrightChild::Role - a child that knows who it's parents is/are.
I'm clueless on implementation details. Thought I'd throw the idea out there (and also hear if it exists). I would not know what names to search for.
Comments
Please sign up to post a review.