From b8a48bdd395a3c363c75c2dd88f351ca033b3455 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 18 Oct 2010 21:31:10 +0200 Subject: [PATCH] Express @Fcntl::EXPORT_OK in terms of %Fcntl::EXPORT_TAGS. This reduces quite a lot of repetition of symbol names. Note that '&SUBNAME' and 'SUBNAME' are interchangeable to Exporter. --- ext/Fcntl/Fcntl.pm | 71 +++++++++++++++++------------------------------------- 1 file changed, 22 insertions(+), 49 deletions(-) diff --git a/ext/Fcntl/Fcntl.pm b/ext/Fcntl/Fcntl.pm index 834d7ec..4aede8c 100644 --- a/ext/Fcntl/Fcntl.pm +++ b/ext/Fcntl/Fcntl.pm @@ -65,6 +65,26 @@ $VERSION = '1.09'; XSLoader::load(); +# Named groups of exports +%EXPORT_TAGS = ( + 'flock' => [qw(LOCK_SH LOCK_EX LOCK_NB LOCK_UN)], + 'Fcompat' => [qw(FAPPEND FASYNC FCREAT FDEFER FDSYNC FEXCL FLARGEFILE + FNDELAY FNONBLOCK FRSYNC FSYNC FTRUNC)], + 'seek' => [qw(SEEK_SET SEEK_CUR SEEK_END)], + 'mode' => [qw(S_ISUID S_ISGID S_ISVTX S_ISTXT + _S_IFMT S_IFREG S_IFDIR S_IFLNK + S_IFSOCK S_IFBLK S_IFCHR S_IFIFO S_IFWHT S_ENFMT + S_IRUSR S_IWUSR S_IXUSR S_IRWXU + S_IRGRP S_IWGRP S_IXGRP S_IRWXG + S_IROTH S_IWOTH S_IXOTH S_IRWXO + S_IREAD S_IWRITE S_IEXEC + S_ISREG S_ISDIR S_ISLNK S_ISSOCK + S_ISBLK S_ISCHR S_ISFIFO + S_ISWHT S_ISENFMT + S_IFMT S_IMODE + )], +); + # Items to export into callers namespace by default # (move infrequently used names to @EXPORT_OK below) @EXPORT = @@ -140,7 +160,7 @@ XSLoader::load(); ); # Other items we are prepared to export if requested -@EXPORT_OK = qw( +@EXPORT_OK = (qw( DN_ACCESS DN_ATTRIB DN_CREATE @@ -148,67 +168,20 @@ XSLoader::load(); DN_MODIFY DN_MULTISHOT DN_RENAME - FAPPEND - FASYNC - FCREAT - FDEFER - FDSYNC - FEXCL - FLARGEFILE - FNDELAY - FNONBLOCK - FRSYNC - FSYNC - FTRUNC F_GETLEASE F_GETSIG F_NOTIFY F_SETLEASE F_SETSIG - LOCK_EX LOCK_MAND - LOCK_NB LOCK_READ LOCK_RW - LOCK_SH - LOCK_UN LOCK_WRITE O_IGNORE_CTTY O_NOATIME O_NOLINK O_NOTRANS - SEEK_CUR - SEEK_END - SEEK_SET - S_IFSOCK S_IFBLK S_IFCHR S_IFIFO S_IFWHT S_ENFMT - S_IREAD S_IWRITE S_IEXEC - S_IRGRP S_IWGRP S_IXGRP S_IRWXG - S_IROTH S_IWOTH S_IXOTH S_IRWXO - S_IRUSR S_IWUSR S_IXUSR S_IRWXU - S_ISUID S_ISGID S_ISVTX S_ISTXT - _S_IFMT S_IFREG S_IFDIR S_IFLNK - &S_ISREG &S_ISDIR &S_ISLNK &S_ISSOCK &S_ISBLK &S_ISCHR &S_ISFIFO - &S_ISWHT &S_ISENFMT &S_IFMT &S_IMODE -); -# Named groups of exports -%EXPORT_TAGS = ( - 'flock' => [qw(LOCK_SH LOCK_EX LOCK_NB LOCK_UN)], - 'Fcompat' => [qw(FAPPEND FASYNC FCREAT FDEFER FDSYNC FEXCL FLARGEFILE - FNDELAY FNONBLOCK FRSYNC FSYNC FTRUNC)], - 'seek' => [qw(SEEK_SET SEEK_CUR SEEK_END)], - 'mode' => [qw(S_ISUID S_ISGID S_ISVTX S_ISTXT - _S_IFMT S_IFREG S_IFDIR S_IFLNK - S_IFSOCK S_IFBLK S_IFCHR S_IFIFO S_IFWHT S_ENFMT - S_IRUSR S_IWUSR S_IXUSR S_IRWXU - S_IRGRP S_IWGRP S_IXGRP S_IRWXG - S_IROTH S_IWOTH S_IXOTH S_IRWXO - S_IREAD S_IWRITE S_IEXEC - S_ISREG S_ISDIR S_ISLNK S_ISSOCK - S_ISBLK S_ISCHR S_ISFIFO - S_ISWHT S_ISENFMT - S_IFMT S_IMODE - )], -); +), map {@{$_}} values %EXPORT_TAGS); sub AUTOLOAD { (my $constname = $AUTOLOAD) =~ s/.*:://; -- 2.7.4