summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-09-01 21:32:13 +0200
committerNicholas Clark <nick@ccl4.org>2011-09-01 21:54:14 +0200
commit8dad66f8c00f37d97eebfe6fbf34239cf17d17a1 (patch)
treececcc827fb4b3b8e07ccb96f0eece69e56937605 /ext
parent57159ffe11d6b0de0a8ec36d5029dcf05676f957 (diff)
downloadperl-8dad66f8c00f37d97eebfe6fbf34239cf17d17a1.tar.gz
Generate @POSIX::EXPORT_OK from %reimpl, %replacement and an exception list.
This is considerably terser than listing all the entries for @EXPORT_OK longhand. With this change we can no longer delete from %replacement in AUTOLOAD(), as import() and load_imports() may be called after AUTOLOAD() has already been run.
Diffstat (limited to 'ext')
-rw-r--r--ext/POSIX/lib/POSIX.pm64
1 files changed, 5 insertions, 59 deletions
diff --git a/ext/POSIX/lib/POSIX.pm b/ext/POSIX/lib/POSIX.pm
index 94a706bbcc..75785f81e9 100644
--- a/ext/POSIX/lib/POSIX.pm
+++ b/ext/POSIX/lib/POSIX.pm
@@ -189,7 +189,7 @@ eval join ';', map "sub $_", keys %replacement, keys %reimpl;
sub AUTOLOAD {
my ($func) = ($AUTOLOAD =~ /.*::(.*)/);
- if (my $code = delete $reimpl{$func}) {
+ if (my $code = $reimpl{$func}) {
my ($num, $arg) = (0, '');
if ($code =~ s/^(.*?) *=> *//) {
$arg = $1;
@@ -390,65 +390,11 @@ our %EXPORT_TAGS = (
# Doing the de-dup with a temporary hash has the advantage that the SVs in
# @EXPORT are actually shared hash key scalars, which will save some memory.
our @EXPORT = keys %export;
-}
-our @EXPORT_OK = qw(
- abs
- alarm
- atan2
- chdir
- chmod
- chown
- close
- closedir
- cos
- exit
- exp
- fcntl
- fileno
- fork
- getc
- getgrgid
- getgrnam
- getlogin
- getpgrp
- getppid
- getpwnam
- getpwuid
- gmtime
- kill
- lchown
- link
- localtime
- log
- mkdir
- nice
- open
- opendir
- pipe
- printf
- rand
- read
- readdir
- rename
- rewinddir
- rmdir
- sin
- sleep
- sprintf
- sqrt
- srand
- stat
- system
- time
- times
- umask
- unlink
- utime
- wait
- waitpid
- write
-);
+ our @EXPORT_OK = (qw(close lchown nice open pipe read times write
+ printf sprintf),
+ grep {!exists $export{$_}} keys %reimpl, keys %replacement);
+}
require Exporter;
}