Re: Wrapping a method of an instance

[email protected] (Bill Moseley)
Newsgroups perl.moose
Message-ID <CAKhN_m4SmKSu5aZwjmJfjbN2Sq6-KN43AKJ=8DDSe_E=Dr7gGQ@mail.gmail.com>
On Wed, Oct 17, 2012 at 12:31 AM, Tomas Doran <[email protected]> wrote:

>
> >
> > Is it possible to add a modifier like that?
>
>
> Yes, but you probably don't want to.
>
> It's almost certainly better to apply a request role. Have a look at the
> changes I did to C::P::UploadProgress:
>

Yes, I think that's a better approach.   But, you added some hooks in
Catalyst to make it possible.

But, I'd still like to understand Moose a bit better, and this is a good
example.

Granted may not be appropriate in this case, but I'd like to understand how
to programmatically add a method modifier like in my original message.  I
didn't get far looking at the Class::MOP::Method docs.  (I'm also a bit
curious how that's different than monkey patching.)

And more specific to this problem:

I'm a bit lost by this code -- Is that to get at the require_class_accessor
attribute?  Or is there a reason you cannot use "with"?


    Class::MOP::class_of('MooseX::RelatedClassRoles')
      ->apply($c->meta, name => 'request', require_class_accessor => 0);



Thanks,


-- 
Bill Moseley
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.