summaryrefslogtreecommitdiff
path: root/ext/File-Glob
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-10-18 10:55:15 +0200
committerNicholas Clark <nick@ccl4.org>2010-10-18 10:55:15 +0200
commitdf5a3819cf43fd65bb6db52619f7b36d3d11063f (patch)
treebb4511be36752002618595afc00a84e9234774f6 /ext/File-Glob
parent22bc907ae9b9703f36931e4de30ca013ddb732f6 (diff)
downloadperl-df5a3819cf43fd65bb6db52619f7b36d3d11063f.tar.gz
Convert File::Glob::import to $Exporter::ExportLevel and grep.
Previously it was using goto & and splice, and was not as simple to read.
Diffstat (limited to 'ext/File-Glob')
-rw-r--r--ext/File-Glob/Glob.pm17
1 files changed, 7 insertions, 10 deletions
diff --git a/ext/File-Glob/Glob.pm b/ext/File-Glob/Glob.pm
index 63657fbe29..4219c7eb28 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 {