defining my own parameterized types

[email protected] ("Mark Wood-Patrick")
Newsgroups perl.moose
Message-ID <[email protected]>
I would like to add my own parameterized type e.g. I would like to be able
to create types like:

 

            SzStr[32]

 

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]

 

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/Parameterize
d.pm

 

but that has:

 


 
<http://search.cpan.org/dist/Moose/lib/Moose/Meta/TypeConstraint/Parameteriz
ed.pm#___top> METHODS Description: ^


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
image001.gif (image/gif, 76 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.