Fwd: [Perl5-syntax] Adding Moose type checking to Method::Signatures

Buddy Burden barefootcoder at gmail.com
Wed Feb 23 17:53:47 GMT 2011


Guys,

Crap! forgot to reply-all.  Fwd'ing ...


---------- Forwarded message ----------
From: Buddy Burden <barefootcoder at gmail.com>
Date: Wed, Feb 23, 2011 at 9:52 AM
Subject: Re: [Perl5-syntax] Adding Moose type checking to Method::Signatures
To: Nick Perez <nick at nickandperla.net>


Nick,

> Nah, I wouldn't do that. I would just access the metaclass for it.
>
> MooseX::Declare::Keyword::Method->meta
>  ->add_around_method_modifier(
>    'parse',
>    sub {
>      # Your code here
>    });

Oooh ... okay, that never would have occurred to me, so thanx much for
that brain bulb. :)

> So I would write a module that rigged up MS how you would like it and
> then have an import method that would access the metaclasses of stuff
> inside MXD and make whatever changes you want.
>
> That way you could have this:
>
> use MooseX::Declare;
> use Replace::MXMS::With::MS;
>
> class Foo { ... }

Okay, that's a little different from what I was thinking ... I was
thinking something more like:

   use MooseX::Declare::Using::MS;

   class Foo { ... }

although, honestly, I'm going to be burying whatever it is in my Moose
policy module for my primary application (a.k.a. $work).  So, for me,
it'll end up being

   use Company::Moose;

   class Company::Foo { ... }

But I would certainly like to come up with something that's nice
enough to put up on CPAN so that others can use it too ... what does
everyone feel about the two styles?  Do you like the MXD
extension-module idea, or a single-line replacement module (which is
obviously derived from MXD in some significant way)? or do you care?

> If you want an example of this in action, take a look at something I
> recently put on CPAN:
> http://cpansearch.perl.org/src/NPEREZ/MongoDBx-AutoDeref-1.110530/lib/MongoDBx/AutoDeref.pm

Excellent! working code. :-)  I'll take a look.


            -- Buddy



-- 

            -- Buddy



More information about the Perl5-syntax mailing list