From: Nicholas Clark Date: Sat, 7 Feb 2009 11:52:43 +0000 (+0000) Subject: Remove duplicate code from dynamic_ext(), static_ext() and nonxs_ext(), X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=442749d5efa49ff740739d8acc4deb49bf64ff30;p=p5sagit%2Fp5-mst-13.2.git Remove duplicate code from dynamic_ext(), static_ext() and nonxs_ext(), extensions() and known_extensions(). --- diff --git a/win32/FindExt.pm b/win32/FindExt.pm index 6894689..da0bf54 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 {