summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2023-02-22 15:24:29 -0700
committerKarl Williamson <khw@cpan.org>2023-03-13 08:14:41 -0600
commit2740baa993c22d700ed17566bbfddb5ac8173168 (patch)
treef60c2b0e5b2c17a72de64bf64fccd8d457374c92 /t
parent6b6b3689b8d05608bf090afff941e9cd41a603a8 (diff)
downloadperl-2740baa993c22d700ed17566bbfddb5ac8173168.tar.gz
loc_tools: Print $^E when upon a libc failure
This makes debugging easier.
Diffstat (limited to 't')
-rw-r--r--t/loc_tools.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/t/loc_tools.pl b/t/loc_tools.pl
index e897ad6286..6150bbf1c0 100644
--- a/t/loc_tools.pl
+++ b/t/loc_tools.pl
@@ -206,8 +206,12 @@ sub _trylocale ($$$$) { # For use only by other functions in this file!
# We definitely don't want the locale set to something that is
# unsupported
- die "Couldn't restore locale '$save_locale', category $category"
- unless setlocale($category, $save_locale);
+ if (! setlocale($category, $save_locale)) {
+ my $error_text = "\$!=$!";
+ $error_text .= "; \$^E=$^E" if $^E != $!;
+ die "Couldn't restore locale '$save_locale', category $category;"
+ . $error_text;
+ }
if ($badutf8) {
_my_fail("Verify locale name doesn't contain malformed utf8");
return;