Search code examples
perlnaming-conventionsmoose

How do you name a class/package/module like


How would you name a package who's sole purpose was to extend another module so you could apply roles to it? I need a package that extends (sub classes) Template::Context with Moose So I can then create roles and traits to apply to it, but I don't know what to name this package (class). Any advice?


Solution

  • Since its Moose-specific role-ification, I'd have Moose in the name. Template::Context::Moosified. Or Template::Context::WithAntlers.

    But having an intermediate subclass just so you can stick roles onto it is weird. You can skip that middleman and simply declare composed classes directly.

    package Template::Context::ForBreakfast;
    
    use Moose;
    extends "Template::Context";
    with "Bacon", "Eggs", "Toast";
    

    The class name should fall out of the role composition.