Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying constraints using custom accessors? #27

Open
cxw42 opened this issue Mar 6, 2019 · 2 comments · May be fixed by #28
Open

Applying constraints using custom accessors? #27

cxw42 opened this issue Mar 6, 2019 · 2 comments · May be fixed by #28

Comments

@cxw42
Copy link

cxw42 commented Mar 6, 2019

I am enjoying using Class::Tiny! I would like to add type constraints to my setters to enforce preconditions early. It is easy, but repetitive, to copy the sample accessor from the C::T POD and add a constraint check. Is there already a module or C::T feature that does that? I looked on CPAN but couldn't find one. For example, Class::Tiny::Antlers does not provide isa.

If there is an existing way or module, would you be willing to update the C::T POD to reference it? If not, I will write Class::Tiny::ConstrainedAccessor and then send a PR for the POD. Thanks for considering this question and request!

@cxw42
Copy link
Author

cxw42 commented Mar 12, 2019

@xdg
Copy link
Contributor

xdg commented Mar 12, 2019

Thanks

cxw42 added a commit to cxw42/Class-Tiny that referenced this issue Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants