diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-02-07 11:52:43 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-02-07 11:52:43 +0000 |
commit | 442749d5efa49ff740739d8acc4deb49bf64ff30 (patch) | |
tree | 7a33c0a1daa016726d9028f730f826cae4f88e1c /win32/FindExt.pm | |
parent | 030a108e796cc850037b6c7d5fe44f6ed36c1d97 (diff) | |
download | perl-442749d5efa49ff740739d8acc4deb49bf64ff30.tar.gz |
Remove duplicate code from dynamic_ext(), static_ext() and nonxs_ext(),
extensions() and known_extensions().
Diffstat (limited to 'win32/FindExt.pm')
-rw-r--r-- | win32/FindExt.pm | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/win32/FindExt.pm b/win32/FindExt.pm index 6894689ba1..da0bf547c1 100644 --- a/win32/FindExt.pm +++ b/win32/FindExt.pm @@ -36,31 +36,27 @@ sub scan_ext extensions(); } -sub dynamic_ext -{ - return sort grep $ext{$_} eq 'dynamic',keys %ext; +sub _ext_eq { + my $key = shift; + sub { + sort grep $ext{$_} eq $key, keys %ext; + } } -sub static_ext -{ - return sort grep $ext{$_} eq 'static',keys %ext; -} +*dynamic_ext = _ext_eq('dynamic'); +*static_ext = _ext_eq('static'); +*nonxs_ext = _ext_eq('nonxs'); -sub nonxs_ext -{ - return sort grep $ext{$_} eq 'nonxs',keys %ext; -} - -sub extensions -{ - return sort grep $ext{$_} ne 'known',keys %ext; +sub _ext_ne { + my $key = shift; + sub { + sort grep $ext{$_} ne $key, keys %ext; + } } -sub known_extensions -{ - # faithfully copy Configure in not including nonxs extensions for the nonce - return sort grep $ext{$_} ne 'nonxs',keys %ext; -} +*extensions = _ext_ne('known'); +# faithfully copy Configure in not including nonxs extensions for the nonce +*known_extensions = _ext_ne('nonxs'); sub is_static { |