From d8b7e1731dfe5f3b9dc6c9612fe12b7cf46c62ce Mon Sep 17 00:00:00 2001 From: James Raspass Date: Thu, 18 Sep 2025 03:07:14 +0100 Subject: [PATCH] Remove superfluous &utf8::AUTOLOAD Historically this was used to load utf8_heavy.pl before calling the real functions but now that utf8_heavy.pl is no longer a thing it doesn't serve any purpose. The error message upon calling an unknown sub changes by one character since it now comes from perl proper rather than a hand-rolled one in utf8.pm. I've added a comment, modeled on the one in builtin.pm, to explain where the subs are actually defined. --- lib/utf8.pm | 13 +++++-------- lib/utf8.t | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/utf8.pm b/lib/utf8.pm index 905b5ceb4b35..fca8f127e673 100644 --- a/lib/utf8.pm +++ b/lib/utf8.pm @@ -1,13 +1,16 @@ package utf8; +# This file only defines the import/unimport subs, the rest are implemented by +# always-present functions in the perl interpreter itself. +# See also `universal.c` in the perl source + use strict; use warnings; our $utf8_hint_bits = 0x00800000; our $ascii_hint_bits = 0x00000010; # Turned off when utf8 turned on -our $VERSION = '1.27'; -our $AUTOLOAD; +our $VERSION = '1.28'; sub import { $^H |= $utf8_hint_bits; @@ -18,12 +21,6 @@ sub unimport { $^H &= ~$utf8_hint_bits; } -sub AUTOLOAD { - goto &$AUTOLOAD if defined &$AUTOLOAD; - require Carp; - Carp::croak("Undefined subroutine $AUTOLOAD called"); -} - 1; __END__ diff --git a/lib/utf8.t b/lib/utf8.t index fa69fcbb8862..89ed1dd1bbcb 100644 --- a/lib/utf8.t +++ b/lib/utf8.t @@ -557,8 +557,8 @@ SKIP: { { fresh_perl_like ('use utf8; utf8::moo()', - qr/Undefined subroutine utf8::moo/, {stderr=>1}, - "Check Carp is loaded for AUTOLOADing errors") + qr/Undefined subroutine &utf8::moo/, {stderr=>1}, + "Check undefined subroutines error") } {