This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/loc_tools.pl: Tidy up
authorKarl Williamson <khw@cpan.org>
Sun, 31 Dec 2017 19:25:25 +0000 (12:25 -0700)
committerKarl Williamson <khw@cpan.org>
Mon, 1 Jan 2018 19:37:50 +0000 (12:37 -0700)
Instead of using $@, use the variable set to $@ just after the eval.
This is cleaner, and avoids an issue should new code be inserted between
them that affects $@

t/loc_tools.pl

index ed24c37..93a0204 100644 (file)
@@ -29,7 +29,7 @@ my $max_bad_category_number = -1000000;
 # where 6 is the value of &POSIX::LC_CTYPE
 my %category_name;
 my %category_number;
-unless ($@) {
+if ($has_locale_h) {
     my $number_for_missing_category = $max_bad_category_number;
     foreach my $name (qw(ALL COLLATE CTYPE MESSAGES MONETARY NUMERIC TIME)) {
         my $number = eval "&POSIX::LC_$name";