develooper Front page | perl.moose | Postings from June 2011

RE: defining my own parameterized types

Thread Previous
From:
Mark Wood-Patrick
Date:
June 26, 2011 07:24
Subject:
RE: defining my own parameterized types
Message ID:
00ea01cc340c$c8c46db0$5a4d4910$@gmail.com
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:mwoodpatrick@gmail.com] 
Sent: Friday, June 24, 2011 8:44 AM
To: 'John Napiorkowski'; moose@perl.org
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:jjn1056@yahoo.com]
Sent: Friday, June 24, 2011 6:02 AM
To: Mark Wood-Patrick; moose@perl.org
Subject: Re: defining my own parameterized types

>________________________________
>From: Mark Wood-Patrick <mwoodpatrick@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/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
>  
>
>
>
>
>
> 
> 
> 
>
>



Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About