summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Tourbin <at@altlinux.ru>2007-04-25 22:12:22 +0400
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-04-26 07:09:32 +0000
commit0f68039566ac464bc1d4ff8f5b574153a1f6e9e9 (patch)
treeb3cf62499afb398090500933b086180d3627091c
parente21694ed6c3a879be835a8269350acf67b5736f9 (diff)
downloadperl-0f68039566ac464bc1d4ff8f5b574153a1f6e9e9.tar.gz
fixed Fcntl::S_IFMT() breakage introduced by change 30674 (blead 26701)
Message-ID: <20070425141222.GA24828@solemn.turbinal> p4raw-id: //depot/perl@31080
-rw-r--r--MANIFEST1
-rw-r--r--ext/Fcntl/Fcntl.pm24
-rw-r--r--ext/Fcntl/t/mode.t17
3 files changed, 31 insertions, 11 deletions
diff --git a/MANIFEST b/MANIFEST
index 0dc43b883a..4bb181b1dc 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -649,6 +649,7 @@ ext/Fcntl/Fcntl.pm Fcntl extension Perl module
ext/Fcntl/Fcntl.xs Fcntl extension external subroutines
ext/Fcntl/Makefile.PL Fcntl extension makefile writer
ext/Fcntl/t/fcntl.t See if Fcntl works
+ext/Fcntl/t/mode.t See if S_ISREG() and S_ISDIR() work
ext/Fcntl/t/syslfs.t See if large files work for sysio
ext/File/Glob/bsd_glob.c File::Glob extension run time code
ext/File/Glob/bsd_glob.h File::Glob extension header file
diff --git a/ext/Fcntl/Fcntl.pm b/ext/Fcntl/Fcntl.pm
index 067c0612ef..83edeb60d8 100644
--- a/ext/Fcntl/Fcntl.pm
+++ b/ext/Fcntl/Fcntl.pm
@@ -55,13 +55,14 @@ See L<perlfunc/stat> about the S_I* constants.
=cut
+use strict;
our($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $AUTOLOAD);
require Exporter;
use XSLoader ();
@ISA = qw(Exporter);
BEGIN {
- $VERSION = "1.05";
+ $VERSION = "1.06";
}
# Items to export into callers namespace by default
@@ -214,18 +215,18 @@ BEGIN {
XSLoader::load 'Fcntl', $VERSION;
}
-sub S_IFMT { @_ ? ( $_[0] & _S_IFMT ) : _S_IFMT }
+sub S_IFMT { @_ ? ( $_[0] & _S_IFMT() ) : _S_IFMT() }
sub S_IMODE { $_[0] & 07777 }
-sub S_ISREG { ( $_[0] & _S_IFMT ) == S_IFREG }
-sub S_ISDIR { ( $_[0] & _S_IFMT ) == S_IFDIR }
-sub S_ISLNK { ( $_[0] & _S_IFMT ) == S_IFLNK }
-sub S_ISSOCK { ( $_[0] & _S_IFMT ) == S_IFSOCK }
-sub S_ISBLK { ( $_[0] & _S_IFMT ) == S_IFBLK }
-sub S_ISCHR { ( $_[0] & _S_IFMT ) == S_IFCHR }
-sub S_ISFIFO { ( $_[0] & _S_IFMT ) == S_IFIFO }
-sub S_ISWHT { ( $_[0] & _S_IFMT ) == S_IFWHT }
-sub S_ISENFMT { ( $_[0] & _S_IFMT ) == S_IFENFMT }
+sub S_ISREG { ( $_[0] & _S_IFMT() ) == S_IFREG() }
+sub S_ISDIR { ( $_[0] & _S_IFMT() ) == S_IFDIR() }
+sub S_ISLNK { ( $_[0] & _S_IFMT() ) == S_IFLNK() }
+sub S_ISSOCK { ( $_[0] & _S_IFMT() ) == S_IFSOCK() }
+sub S_ISBLK { ( $_[0] & _S_IFMT() ) == S_IFBLK() }
+sub S_ISCHR { ( $_[0] & _S_IFMT() ) == S_IFCHR() }
+sub S_ISFIFO { ( $_[0] & _S_IFMT() ) == S_IFIFO() }
+sub S_ISWHT { ( $_[0] & _S_IFMT() ) == S_IFWHT() }
+sub S_ISENFMT { ( $_[0] & _S_IFMT() ) == S_IFENFMT() }
sub AUTOLOAD {
(my $constname = $AUTOLOAD) =~ s/.*:://;
@@ -235,6 +236,7 @@ sub AUTOLOAD {
my (undef,$file,$line) = caller;
die "$error at $file line $line.\n";
}
+ no strict 'refs';
*$AUTOLOAD = sub { $val };
goto &$AUTOLOAD;
}
diff --git a/ext/Fcntl/t/mode.t b/ext/Fcntl/t/mode.t
new file mode 100644
index 0000000000..57135f6d38
--- /dev/null
+++ b/ext/Fcntl/t/mode.t
@@ -0,0 +1,17 @@
+#!./perl -w
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ require './test.pl';
+}
+
+plan tests => 2;
+
+use File::Temp;
+use Fcntl qw(:mode);
+
+my $tmpfile = File::Temp->new;
+my $mode = (stat "$tmpfile")[2];
+ok( S_ISREG($mode), " S_ISREG tmpfile");
+ok(!S_ISDIR($mode), "!S_ISDIR tmpfile");