This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
shmwrite: treat the string as bytes
[perl5.git] / t / loc_tools.pl
index 57e4b2a..15f5448 100644 (file)
@@ -13,6 +13,7 @@
 use Config;
 use strict;
 use warnings;
+use feature 'state';
 
 eval { require POSIX; import POSIX 'locale_h'; };
 my $has_locale_h = ! $@;
@@ -321,7 +322,8 @@ sub locales_enabled(;$) {
         if ($has_LC_ALL) {
             push @categories_numbers, $category_number{'ALL'};
         }
-        $_[0]->@* = @categories_numbers;
+
+        @$categories_ref = @categories_numbers;
     }
 
     return 1;
@@ -446,7 +448,8 @@ sub find_locales ($;$) {
         }
 
         # The rest of the locales are in this file.
-        push @Data, <DATA>; close DATA;
+        state @my_data = <DATA>; close DATA if fileno DATA;
+        push @Data, @my_data;
 
         foreach my $line (@Data) {
             chomp $line;