Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Moose Role to include Use statements

by tilly (Archbishop)
on Feb 21, 2011 at 15:50 UTC ( #889410=note: print w/ replies, xml ) Need Help??


in reply to Moose Role to include Use statements

Avoiding typing by stuffing things into the most convenient corner without regard to what it is officially for is a fast road to a bad design. If the things in question fit into the role, then load as many as you want. If they are not logically part of the role, don't do this.

However I would not object to creating a new module explicitly to give you all of the utility stuff you want. Name it something like StandardModules and use that instead. That will make it more obvious to the next person where you might be getting random stuff from. (But be very careful about putting things there, because they are going to pollute every namespace.)


Comment on Re: Moose Role to include Use statements
Download Code
Re^2: Moose Role to include Use statements
by Cagao (Monk) on Feb 21, 2011 at 16:13 UTC

    Ahhh true, we're being strict about what is allowed in this module.

    One included module with imported method didn't work when in the Role file anyway so had to abort that approach, and you're right, only things related to that Role should be in there anyway.

    Was just looking for the most-Moose way of doing it.

      One included module with imported method didn't work when in the Role file anyway so had to abort that approach

      This is because Moose recognizes the difference between an imported function and a method. That and roles don't have an import method (and never should IMO anyway).

      -stvn

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://889410]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2014-08-23 00:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (169 votes), past polls