From 3f7b066fb2f1a8fbf88f5c113878a9476291e460 Mon Sep 17 00:00:00 2001 From: Toby Inkster Date: Tue, 22 Sep 2020 11:55:53 +0100 Subject: [PATCH] Type::Utils shouldn't export 'is' as part of '-all' because there are too many test scripts on CPAN that import '-all' from Type::Utils which will conflict with Test::More --- lib/Type/Utils.pm | 12 +++++++++++- t/20-unit/Type-Utils/warnings.t | 2 +- t/40-regression/rt92571.t | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/Type/Utils.pm b/lib/Type/Utils.pm index eb526dd12..145b06d10 100644 --- a/lib/Type/Utils.pm +++ b/lib/Type/Utils.pm @@ -30,9 +30,15 @@ our @EXPORT_OK = ( extends type subtype match_on_type compile_match_on_type dwim_type english_list - classifier is + classifier >, + "is", ); +our %EXPORT_TAGS = ( + default => \@EXPORT, + all => \@EXPORT_OK, +); +pop @{$EXPORT_TAGS{all}}; # remove 'is' require Exporter::Tiny; our @ISA = 'Exporter::Tiny'; @@ -1101,6 +1107,10 @@ Shortcut for C<< $type->check($value) >> but also if $type is a string, will look it up via C. This function is not exported by default. +This function is not even exported by C<< use Type::Utils -all >>. +You must request it explicitly. + + use Type::Utils "is"; Beware using this in test scripts because it has the same name as a function exported by L. Note that you can rename this function if diff --git a/t/20-unit/Type-Utils/warnings.t b/t/20-unit/Type-Utils/warnings.t index 26da22f1a..ad4884769 100644 --- a/t/20-unit/Type-Utils/warnings.t +++ b/t/20-unit/Type-Utils/warnings.t @@ -33,7 +33,7 @@ use Test::Requires { 'Test::Warnings' => 0.005 }; #warnings added in this versio use Test::Warnings qw( :no_end_test warnings ); use Type::Library -base, -declare => qw/WholeNumber/; -use Type::Utils qw/ -all !is /; +use Type::Utils -all; use Types::Standard qw/Int/; my @warnings = warnings { diff --git a/t/40-regression/rt92571.t b/t/40-regression/rt92571.t index 741c9779e..a4d68583f 100644 --- a/t/40-regression/rt92571.t +++ b/t/40-regression/rt92571.t @@ -30,7 +30,7 @@ use Test::More; use Type::Library -base, -declare => qw[ ArrayRefFromAny ]; use Types::Standard -all; -use Type::Utils qw( -all !is ); +use Type::Utils -all; declare_coercion ArrayRefFromAny, to_type ArrayRef,