Posted on 2006-11-29 08:21:57-08 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
Posted on 2006-11-29 22:05:38-08 by jdhedden in response to 3653
Re: New argument to Restricted attribute
Thanks for the suggestion. I'll work on it and post a new version of OIO soon.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.