Skip to content

Applying constraints using custom accessors? #27

Description

@cxw42

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions