Skip to content

Commit ffdc656

Browse files
JRaspasskhwilliamson
authored andcommitted
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.
1 parent 69734ba commit ffdc656

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

lib/utf8.pm

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package utf8;
22

3+
# This file only defines the import/unimport subs, the rest are implemented by
4+
# always-present functions in the perl interpreter itself.
5+
# See also `universal.c` in the perl source
6+
37
use strict;
48
use warnings;
59

610
our $utf8_hint_bits = 0x00800000;
711
our $ascii_hint_bits = 0x00000010; # Turned off when utf8 turned on
812

9-
our $VERSION = '1.27';
10-
our $AUTOLOAD;
13+
our $VERSION = '1.28';
1114

1215
sub import {
1316
$^H |= $utf8_hint_bits;
@@ -18,12 +21,6 @@ sub unimport {
1821
$^H &= ~$utf8_hint_bits;
1922
}
2023

21-
sub AUTOLOAD {
22-
goto &$AUTOLOAD if defined &$AUTOLOAD;
23-
require Carp;
24-
Carp::croak("Undefined subroutine $AUTOLOAD called");
25-
}
26-
2724
1;
2825
__END__
2926

lib/utf8.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ SKIP: {
557557

558558
{
559559
fresh_perl_like ('use utf8; utf8::moo()',
560-
qr/Undefined subroutine utf8::moo/, {stderr=>1},
561-
"Check Carp is loaded for AUTOLOADing errors")
560+
qr/Undefined subroutine &utf8::moo/, {stderr=>1},
561+
"Check undefined subroutines error")
562562
}
563563

564564
{

0 commit comments

Comments
 (0)