Object-InsideOut - New argument to Restricted attribute

Posted on Wed Nov 29 10:21:57 2006 by gaetan
New argument to Restricted attribute
Hi all, A Restricted attribute (sub M :Restricted { ... }) means that a method can not be called outside the object tree hierarchy. Would it be possible to have a parameter to the Restricted attribute ? This attribute would add additionnal class being able to call this method. For example,
package ClassX; use Object::InsideOut; sub M :Restricted(ClassA) { ... } package ClassY; use Object::InsideOut(ClassX); sub toto { shift->M() # call is OK } package ClassA; use ClassX; sub titi { my $obj = ClassX->new(); $obj->M(); # call is OK } package ClassB; use ClassX; sub tutu { my $obj = ClassX->new(); $obj->M(); # would raise an OIO exception }
I encountered this modelization "problem" when using a delegation mechanism. Thanks, Gaetan
Direct Responses: 3662 | Write a response