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

[Feature request] Adaptive strictness #5

Closed
van-de-bugger opened this issue Nov 5, 2015 · 2 comments
Closed

[Feature request] Adaptive strictness #5

van-de-bugger opened this issue Nov 5, 2015 · 2 comments

Comments

@van-de-bugger
Copy link

I would like to use Test::Version with is_strict = 1. However, it effectively prohibits any trial versions, because any trial version (which contains an underscore) does not pass the test. I have few options to make a trial release:

  1. Drop is_strict completely — but I want it for non-trial releases.
  2. Modify the parameter each before and after each trial release — works but inconvenient.

I would be nice if Test::Version is able to use "adaptive strictness": i. e. perform strict check for non-trial release and perform lax check for trial release.

@plicease
Copy link
Member

plicease commented Nov 5, 2015

This is a good idea! I'll see if I can implement it.

@van-de-bugger
Copy link
Author

Implementation seems trivial. The only problem is interface design.

For example, is_strict could be extended to accept either 0, 1, or adaptive:

use Moose::Util::TypeConstraints qw{ enum };

...

has is_strict => (
  is => 'bare',
  isa => enum( [ qw{ 0 adaptive 1 } ] ),
  default => sub { '0' },
);

sub is_strict {
    my ( $self ) = @_;
    if ( $self->{ is_strict } eq 'adaptive' ) {
        return $self->zilla->is_trial ? '0' : '1';
    } else {
        return $self->{ is_strict };
    };
}

@plicease plicease closed this as completed May 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants