RE: defining my own parameterized types

[email protected] ("Mark Wood-Patrick")
Newsgroups perl.moose
Message-ID <[email protected]>
Some initial feedback, I was able to use this class in my code and it did what I needed so far

Many thanks

Mark

-----Original Message-----
From: Mark Wood-Patrick [mailto:[email protected]] 
Sent: Friday, June 24, 2011 8:44 AM
To: 'John Napiorkowski'; [email protected]
Subject: RE: defining my own parameterized types

Many thanks looks useful I'll get back to you with feedback and any questions I have

Mark

-----Original Message-----
From: John Napiorkowski [mailto:[email protected]]
Sent: Friday, June 24, 2011 6:02 AM
To: Mark Wood-Patrick; [email protected]
Subject: Re: defining my own parameterized types

>________________________________
>From: Mark Wood-Patrick <[email protected]>
>To: [email protected]
>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/Paramet
>erized.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
>  
>
>
>
>
>
> 
> 
> 
>
>
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.