On Thu, Jul 4, 2013 at 5:10 PM, Buddy Burden <barefootco...@gmail.com> wrote:
> Ben,
>
>
>> Create your role Persistent which requires a number of the methods
>> from MooseX::Storage and supplies the API that you want.  If $storage
>> is something that does MooseX::Storage, you can then turn it into a
>> Persistent thing with:
>>
>> Persistent->meta->apply($storage);
>
>
> But this is hiding the implementation from the wrong thing, at least for my
> purposes. :-)
>
> That is, given that $storage is an instance of type Foo (let's say), then
> Persistent doesn't know that Foo is implemented in terms of MooseX::Storage.
> But what I'm looking for is a way that Foo won't know that _Persistent_ is
> implemented in terms of MooseX::Storage.

Well, actually I made it so that Persistent actually isn't implemented
in terms of MooseX::Storage.  And therefore Foo won't know that it is.

> That make sense?  Beause then Foo's code won't need to change if I want to
> swap out back-ends; only Persistent's code will need to change, and then
> everything that is Persistent will magically use the new back-end.
>
>
>                 -- Buddy
>
>
> (PS: how's the new job going? :-) )

So far it seems oddly familiar yet oddly different.  Perhaps in a few
years we can switch off again to keep the amusement going. ;-)

Reply via email to