This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove File::Glob::glob() in perl-5.30
authorJames E Keenan <jkeenan@cpan.org>
Sat, 13 Oct 2018 19:48:39 +0000 (15:48 -0400)
committerJames E Keenan <jkeenan@cpan.org>
Wed, 17 Oct 2018 12:14:27 +0000 (08:14 -0400)
For: RT # 133586

ext/File-Glob/Glob.pm
ext/File-Glob/t/basic.t

index 07df494..368a755 100644 (file)
@@ -13,7 +13,7 @@ require XSLoader;
 %EXPORT_TAGS = (
     'glob' => [ qw(
         GLOB_ABEND
-       GLOB_ALPHASORT
+        GLOB_ALPHASORT
         GLOB_ALTDIRFUNC
         GLOB_BRACE
         GLOB_CSH
@@ -29,15 +29,13 @@ require XSLoader;
         GLOB_QUOTE
         GLOB_TILDE
         bsd_glob
-        glob
     ) ],
 );
 $EXPORT_TAGS{bsd_glob} = [@{$EXPORT_TAGS{glob}}];
-pop @{$EXPORT_TAGS{bsd_glob}}; # no "glob"
 
 @EXPORT_OK   = (@{$EXPORT_TAGS{'glob'}}, 'csh_glob');
 
-$VERSION = '1.31';
+$VERSION = '1.32';
 
 sub import {
     require Exporter;
@@ -72,17 +70,11 @@ if ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos)$/) {
     $DEFAULT_FLAGS |= GLOB_NOCASE();
 }
 
-# File::Glob::glob() is deprecated because its prototype is different from
-# CORE::glob() (use bsd_glob() instead)
+# File::Glob::glob() removed in perl-5.30 because its prototype is different
+# from CORE::glob() (use bsd_glob() instead)
 sub glob {
-    use 5.024;
-    use warnings ();
-    warnings::warnif (deprecated =>
-         "File::Glob::glob() will disappear in perl 5.30. " .
-         "Use File::Glob::bsd_glob() instead.") unless state $warned ++;
-
-    splice @_, 1; # no flags
-    goto &bsd_glob;
+    die "File::Glob::glob() was removed in perl 5.30. " .
+         "Use File::Glob::bsd_glob() instead. $!";
 }
 
 1;
index f0363cd..6ac911c 100644 (file)
@@ -44,17 +44,20 @@ if (opendir(D, ".")) {
    @correct = grep { !/^\./ } sort readdir(D);
    closedir D;
 }
-my @a = do {no warnings 'deprecated'; File::Glob::glob("*", 0);};
-@a = sort @a;
-if (GLOB_ERROR) {
-    fail(GLOB_ERROR);
-} else {
-    is_deeply(\@a, \@correct);
+{
+    local $@;
+    my $expect =
+        qr/File::Glob::glob\(\) was removed in perl 5\.30\. Use File::Glob::bsd_glob\(\) instead/;
+    eval { File::Glob::glob("*", 0); };
+    like $@, $expect,
+        "Got expected error message for removal of File::Glob::glob()";
 }
 chdir '..' or die "chdir .. $!";
 
 # look up the user's home directory
 # should return a list with one item, and not set ERROR
+my @a;
+
 SKIP: {
     my ($name, $home);
     skip $^O, 1 if $^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS'