You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This came to me a bit surprising. I cannot say whether it is a bug or feature. In my code I did not use eval and learned that I need it when I want to survive lax versions.
perl -E '
use CPAN::Meta::Requirements;
say "ok -- CMR version: $CPAN::Meta::Requirements::VERSION";
my $m = CPAN::Meta::Requirements->new;
$m->add_minimum(Foo => 1);
my $ok = eval { $m->accepts_module(Foo => "2.08a") };
say $ok ? "ok -- $ok" : "not ok -- $@";
'
ok -- CMR version: 2.140
not ok -- Can't convert '2.08a': Invalid version format (non-numeric data)
The text was updated successfully, but these errors were encountered:
I think CPAN::Meta::Requirements should be able to (more gracefully) reject non-compliant version strings in all of the APIs that take them (using the validation regex in CPAN::Meta::Validator::version).
Throwing an exception like it currently does seems like the appropriate behavior to me. CPAN::Meta::Requirements->new also accepts a bad_version_hook option to do custom conversions on non-compliant versions.
This came to me a bit surprising. I cannot say whether it is a bug or feature. In my code I did not use eval and learned that I need it when I want to survive lax versions.
The text was updated successfully, but these errors were encountered: