Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

The main reason for MooseX-Types at the time was that since Moose types are global, you have to be careful about conflicts. Your "MyOffset" type for example is not very distinct. Another module could easily have that type itself. So it became best practice to name them "MyProject::MyType" with a project prefix.

So MooseX-Types is there to do the following for you:

  • Encapsulate your types into a reusable library from which you can import the types into your current package.
  • Provide the types as exported functions so typos can be caught.
  • Handle namespacing of the types so they don't conflict.

The last part is crucial here. Since the declared types are namespaced, your type is actually named "myTypes::myOffset". If you use the bareword you don't have to type out the namespace, among other things.

So basically what zwon++ said is right, just wanted to give some context as to the reasons of why it is this way.

Ordinary morality is for ordinary people. -- Aleister Crowley

In reply to Re: (Solved?) Moose type-constraint is unhappy with defaults ... why? by phaylon
in thread (Solved?) Moose type-constraint is unhappy with defaults ... why? by sundialsvc4

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2023-06-09 05:08 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (35 votes). Check out past polls.