This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
c3c7c1f24c4b673ac18bd66e34adfd52e08cc65b
[perl5.git] / lib / CORE.pod
1 =head1 NAME
2
3 CORE - Virtual namespace for Perl's core routines
4
5 =head1 SYNOPSIS
6
7         BEGIN
8                 {
9                 *CORE::GLOBAL::hex = sub { 1; };
10                 }
11
12         print hex("0x50"),"\n";                 # prints 1
13         print CORE::hex("0x50"),"\n";           # prints 80
14
15 =head1 DESCRIPTION
16
17 The C<CORE> namespace gives access to the original build-in functions from
18 Perl. There is no C<CORE>-package, and therefore you do not need to use or
19 require the CORE-module prior to accessing routines in this namespace.
20
21 A list of the build-in functions in Perl can be found in L<perlfunc>.
22
23 =head1 OVERRIDING CORE FUNCTIONS
24
25 The C<CORE::GLOBAL> namespace allows you to override the Perl build-in
26 routines with your own version:
27
28         *CORE::GLOBAL::hex = sub 
29                 {
30                 # ... your code here
31                 };
32
33 The new routine will be called whenever a build-in function is called
34 without a qualifying package:
35
36         print hex("0x50"),"\n";                 # prints 1
37
38 If you want access to the original, unaltered routine, use the C<CORE::>
39 prefix:
40
41         print CORE::hex("0x50"),"\n";           # prints 80
42
43 =head1 AUTHOR
44
45 Tels <nospam-abuse@bloodgate.com> 2007.
46
47 =head1 SEE ALSO
48
49 L<perl>, L<perlfunc>.
50
51 =cut