File::Glob: Drop dependency on given/when
authorBrian Fraser <fraserbn@gmail.com>
Sat, 23 Mar 2013 20:40:54 +0000 (17:40 -0300)
committerKarl Williamson <public@khwilliamson.com>
Wed, 27 Mar 2013 03:06:51 +0000 (21:06 -0600)
ext/File-Glob/Glob.pm

index a9c5a97..379d7f0 100644 (file)
@@ -4,7 +4,6 @@ use strict;
 our($VERSION, @ISA, @EXPORT_OK, @EXPORT_FAIL, %EXPORT_TAGS, $DEFAULT_FLAGS);
 
 require XSLoader;
-use feature 'switch';
 
 @ISA = qw(Exporter);
 
@@ -38,26 +37,31 @@ pop @{$EXPORT_TAGS{bsd_glob}}; # no "glob"
 
 @EXPORT_OK   = (@{$EXPORT_TAGS{'glob'}}, 'csh_glob');
 
-$VERSION = '1.19';
+$VERSION = '1.20';
 
 sub import {
     require Exporter;
     local $Exporter::ExportLevel = $Exporter::ExportLevel + 1;
     Exporter::import(grep {
-       my $passthrough;
-       given ($_) {
-           $DEFAULT_FLAGS &= ~GLOB_NOCASE() when ':case';
-           $DEFAULT_FLAGS |= GLOB_NOCASE() when ':nocase';
-           when (':globally') {
-               no warnings 'redefine';
-               *CORE::GLOBAL::glob = \&File::Glob::csh_glob;
-           }
-           if ($_ eq ':bsd_glob') {
-               no strict; *{caller."::glob"} = \&bsd_glob_override;
-           }
-           $passthrough = 1;
+        my $passthrough;
+        if ($_ eq ':case') {
+            $DEFAULT_FLAGS &= ~GLOB_NOCASE()
+        }
+        elsif ($_ eq ':nocase') {
+            $DEFAULT_FLAGS |= GLOB_NOCASE();
+        }
+        elsif ($_ eq ':globally') {
+           no warnings 'redefine';
+           *CORE::GLOBAL::glob = \&File::Glob::csh_glob;
        }
-       $passthrough;
+        elsif ($_ eq ':bsd_glob') {
+           no strict; *{caller."::glob"} = \&bsd_glob_override;
+            $passthrough = 1;
+       }
+       else {
+            $passthrough = 1;
+        }
+        $passthrough;
     } @_);
 }