>> 
> 
> You don't; all of the keywords that Moose provides are generated by
> Moose::Exporter, so that they are passed the appropriate metaclass
> instance. Just move the 'no Moose' later. I'm not sure what you mean by
> "with the Moose namespace still on".
> 
> -doy

Sorry, that was very awkward phrasing. Moose exports a lot of keywords.  They 
are very nice for making the top of your modules pretty. On the other hand, 
they are bad for namespace collisions. The most famous one, of course, being 
the "with" keyword within Error.pm.

To avoid the problem, I chose the following principle for module layout:

1. Define attriburtes
2. Define method modifiers using named subroutine references
3. Deal with anything else that could possibly need Moose keywords
4. no Moose
5. Place all the "use" statements for other modules.
5. Write code.

It was all working nicely and looking quite pretty - till inner.  
inner is something that occurs as part of "real code".  You'll be using other 
modules, throwing errors and going about your business - which may be 
inconvenient with Moose keywords still imported.

-Kate


Reply via email to