Skip to content

Commit c7d59f7

Browse files
committed
perldelta for non-ampable CORE::__CLASS__
1 parent 0c0c125 commit c7d59f7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pod/perldelta.pod

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,27 @@ manager will later use a regex to expand these into links.
428428

429429
XXX
430430

431+
=item * C<&CORE::__CLASS__> no longer returns filenames
432+
433+
C<CORE::__CLASS__> would work as expected when used as a bareword or aliased:
434+
435+
use feature qw(class);
436+
class Foo {
437+
BEGIN { *cls = \&CORE::__CLASS__; }
438+
method bar() {
439+
my $class1 = CORE::__CLASS__; # ok
440+
my $class2 = cls; # ok
441+
}
442+
}
443+
444+
But when called with an ampersand (C<&CORE::__CLASS__()>) or through a
445+
reference (C<< my $ref = \&CORE::__CLASS__; $ref->() >>), it would return the
446+
current filename instead. These runtime calls now throw an error of the form
447+
C<&CORE::__CLASS__ cannot be called directly> instead of returning wrong
448+
results.
449+
450+
[GH #23737]
451+
431452
=item * C<parse_subsignature()> can now handle empty subroutine signatures
432453

433454
Previously, calling the C<parse_subsignature()> API function with an empty

0 commit comments

Comments
 (0)