>________________________________ >From: Mark Wood-Patrick <mwoodpatr...@gmail.com> >To: moose@perl.org >Sent: Friday, June 24, 2011 8:51 AM >Subject: defining my own parameterized types > > >I would like to add my own parameterized type e.g. I would like to be able to >create types like: > > SzStr[32]
I wrote http://search.cpan.org/perldoc?MooseX::Types::Parameterizable as a sort of exercise for this, would love for people to give it a go and let me know how it works out. > >Which would allow me to specify the maximum size of a string that an attribute >can have and will validate the size of the data I’m storing in the attribute > >Or to specify that an attribute is a secondary key in some DB like: > > DBKey[User] http://search.cpan.org/dist/MooseX-Attribute-Dependent/ also seems interesting, not sure if either the above exactly fit the bill. > >Where User is a Moose class that provides an in memory version of a DB record >and the attribute would be a weak reference to such an object > >Is this currently possible? I looked at the docs for things like: > > >http://search.cpan.org/dist/Moose/lib/Moose/Meta/TypeConstraint/Parameterized.pm > >but that has: > >METHODS >This class is intentionally not documented because the API is confusing and >needs some work. > >I would appreciate any pointers to examples or docs >Thanks in advance >Mark Wood-Patrick > > > > > > > > > > >