in reply to Maintaining State with Runtime Traits
(Of course, looking at Class::Trait, I see that it offers a lot of functionality beyond that covered by my simple example above.)package Trait::Selected; use Object::InsideOut; my %is_selected :Field :Acc(is_selected);
Class::Trait->apply( $some_class, 'Trait::Selected' );Ah, sweet synergy! This prompted me to add a runtime inheritance mechanism to Object::InsideOut:
My::Class->add_class('Trait::Selected');
What happens when the object goes out of scope? The trait still retains that object’s selected value and it’s tricky to remove.If done using Object::InsideOut, this is no issue at all: The trait will be automatically cleaned up when an object is destroyed.
I just uploaded Object::InsideOut v2.08 (which contains the runtime inheritance feature) to CPAN. Thanks for the idea.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Maintaining State with Runtime Traits
by Ovid (Cardinal) on Oct 11, 2006 at 21:07 UTC |