This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid a run-time miniperl check every time SWASHNEW is called
authorFather Chrysostomos <sprout@cpan.org>
Sat, 6 Nov 2010 06:51:06 +0000 (23:51 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 6 Nov 2010 06:51:06 +0000 (23:51 -0700)
lib/utf8_heavy.pl

index 56cfe05..7951bc8 100644 (file)
@@ -100,13 +100,19 @@ sub croak { require Carp; Carp::croak(@_) }
                 # keep going, but return an empty table so only what the code
                 # has compiled in internally (currently ASCII/Latin1 range
                 # matching) will work.
-                if (! defined &DynaLoader::boot_DynaLoader) {
+                BEGIN {
+                    # Poor man's constant, to avoid a run-time check.
+                    $utf8::{miniperl}
+                        = \! defined &DynaLoader::boot_DynaLoader;
+                }
+                if (miniperl) {
                     eval "require '$unicore_dir/Heavy.pl'";
                     last GETFILE if $@;
                 }
                 else {
                     require "$unicore_dir/Heavy.pl";
                 }
+                BEGIN { delete $utf8::{miniperl} }
 
                 # Everything is caseless matching
                 my $property_and_table = lc $type;