benh wrote:
so far the best hack is :

sub location;
has location => (...);

Following this suggestion, I tried it myself (Moose 0.64, Class::MOP 0.75) to solve a related problem, where the auto-generated methods meant to satisfy a role's requirements are delegates to an attribute of the composing class:

    has '_inner' => (
        is      => 'rw',
        isa     => 'MyInnerClass',
        handles => [qw(
            foo_func bar_func
        )],
    );

However, adding ...

    sub foo_func;
    sub bar_func;

... above the has _inner didn't work; I got this compile time error:

Error: You cannot overwrite a locally defined method (foo_func) with a delegation

So, any similar hacks to help with that, prior to Moose roles being smart enough to deal with this?

-- Darren Duncan

Reply via email to