Skip to content

Commit 4973474

Browse files
committed
document CORE::__CLASS__ as non-ampable
Rearrange documentation slightly to make it clearer what you can(not) do with CORE::chomp, CORE::chop, etc. and add CORE::__CLASS__ to the list.
1 parent 7e96be5 commit 4973474

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/CORE.pod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ CORE package, but is part of Perl's syntax.
3232

3333
For many Perl functions, the CORE package contains real subroutines. This
3434
feature is new in Perl 5.16. You can take references to these and make
35-
aliases. However, some can only be called as barewords; i.e., you cannot
36-
use ampersand syntax (C<&foo>) or call them through references. See the
37-
C<shove> example above. These subroutines exist for all keywords except the following:
35+
aliases. These subroutines exist for all keywords except the following:
3836

3937
C<__DATA__>, C<__END__>, C<and>, C<cmp>, C<default>, C<do>, C<dump>,
4038
C<else>, C<elsif>, C<eq>, C<eval>, C<for>, C<foreach>, C<format>, C<ge>,
@@ -44,14 +42,16 @@ C<print>, C<printf>, C<q>, C<qq>, C<qr>, C<qw>, C<qx>, C<redo>, C<require>,
4442
C<return>, C<s>, C<say>, C<sort>, C<state>, C<sub>, C<tr>, C<unless>,
4543
C<until>, C<use>, C<when>, C<while>, C<x>, C<xor>, C<y>
4644

47-
Calling with
48-
ampersand syntax and through references does not work for the following
49-
functions, as they have special syntax that cannot always be translated
50-
into a simple list (e.g., C<eof> vs C<eof()>):
45+
However, some CORE subroutines can only be aliased and called as barewords;
46+
i.e., you cannot use ampersand syntax (C<&foo>) or call them through
47+
references. See the C<shove> example above. These are:
5148

52-
C<chomp>, C<chop>, C<defined>, C<delete>, C<eof>, C<exec>,
49+
C<__CLASS__>, C<chomp>, C<chop>, C<defined>, C<delete>, C<eof>, C<exec>,
5350
C<exists>, C<lstat>, C<split>, C<stat>, C<system>, C<truncate>, C<unlink>
5451

52+
This is because they have special syntax that cannot always be translated
53+
into a simple list (e.g., C<eof> vs C<eof()>) or other special behavior.
54+
5555
=head1 OVERRIDING CORE FUNCTIONS
5656

5757
To override a Perl built-in routine with your own version, you need to

0 commit comments

Comments
 (0)