This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In Config, use typeglob aliasing instead of subref to typeglob assignment.
authorNicholas Clark <nick@ccl4.org>
Sat, 19 Feb 2011 17:33:43 +0000 (17:33 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 19 Feb 2011 17:33:43 +0000 (17:33 +0000)
Typeglob aliasing saves just over .5K, because fewer internal structures are
created. In the general case the behaviour of the two differs, but as the
only package variables of these names are subroutines, and we are within our
own namespace, there is no difference here.

configpm

index 2de7676..55404a5 100755 (executable)
--- a/configpm
+++ b/configpm
@@ -707,9 +707,7 @@ $heavy_txt .= <<'ENDOFEND';
 }
 
 sub STORE  { die "\%Config::Config is read-only\n" }
-*DELETE = \&STORE;
-*CLEAR  = \&STORE;
-
+*DELETE = *CLEAR = \*STORE; # Typeglob aliasing uses less space
 
 sub config_sh {
     substr $Config_SH_expanded, 1, $config_sh_len;