Hello again-

I have an entire family of foreign classes that I would like to shim or
wrap, so that I have another layer of indirection between my app and those
classes.  The foreign classes all happen to be Moose-based too, but I can't
always assume that in the future.

Currently, I have a parameterized role that makes it relatively easy to set
up a class that has some "delegate" attribute and then hands off whatever
attributes/methods you want. But this is just shorthand for declaring an
"isa" and "handles".  I still have to explicitly construct the wrapping
class and pass the (foreign) delegate to it.

The foreign classes don't come from some kind of abstract factory or
container that I could override.  They just come as is, pre-wired together.
 So I find myself building my own factories to do the wrapping for me.
 Architecturally, I think it makes sense.  And I like using curries to pass
extra state into the wrappers.  But it sure requires a lot of code.

I wonder if there is a more succinct way to do this.  I want to say
something like "for classes X, Y, and Z, always turn them into My::X and
My::Y and My::Z using the interfaces that I want."

Does that make any sense?

-Jeff

Reply via email to