diff options
Diffstat (limited to 'pod/perlsub.pod')
-rw-r--r-- | pod/perlsub.pod | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pod/perlsub.pod b/pod/perlsub.pod index d08426adab..16babd2092 100644 --- a/pod/perlsub.pod +++ b/pod/perlsub.pod @@ -872,6 +872,12 @@ via the import syntax, and these names may then override the builtin ones: chdir $somewhere; sub chdir { ... } +To unambiguously refer to the builtin form, one may precede the +builtin name with the special package qualifier C<CORE::>. For example, +saying C<CORE::open()> will always refer to the builtin C<open()>, even +if the current package has imported some other subroutine called +C<&open()> from elsewhere. + Library modules should not in general export builtin names like "open" or "chdir" as part of their default @EXPORT list, because these may sneak into someone else's namespace and change the semantics unexpectedly. @@ -887,6 +893,10 @@ and it would import the open override, but if they said they would get the default imports without the overrides. +Note that such overriding is restricted to the package that requests +the import. Some means of "globally" overriding builtins may become +available in future. + =head2 Autoloading If you call a subroutine that is undefined, you would ordinarily get an |