From df5a3819cf43fd65bb6db52619f7b36d3d11063f Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 18 Oct 2010 10:55:15 +0200 Subject: [PATCH] Convert File::Glob::import to $Exporter::ExportLevel and grep. Previously it was using goto & and splice, and was not as simple to read. --- ext/File-Glob/Glob.pm | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ext/File-Glob/Glob.pm b/ext/File-Glob/Glob.pm index 63657fb..4219c7e 100644 --- a/ext/File-Glob/Glob.pm +++ b/ext/File-Glob/Glob.pm @@ -41,23 +41,20 @@ $VERSION = '1.09'; sub import { require Exporter; - my $i = 1; - while ($i < @_) { - given ($_[$i]) { + 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; } - # We didn't match any special tags, so keep this argument. - ++$i; - next; + $passthrough = 1; } - # We matched a special argument, so remove it - splice @_, $i, 1; - } - goto &Exporter::import; + $passthrough; + } @_); } sub AUTOLOAD { -- 2.7.4