From: Alexey Tourbin Date: Wed, 25 Apr 2007 18:12:22 +0000 (+0400) Subject: fixed Fcntl::S_IFMT() breakage introduced by change 30674 (blead 26701) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0f68039566ac464bc1d4ff8f5b574153a1f6e9e9;p=p5sagit%2Fp5-mst-13.2.git fixed Fcntl::S_IFMT() breakage introduced by change 30674 (blead 26701) Message-ID: <20070425141222.GA24828@solemn.turbinal> p4raw-id: //depot/perl@31080 --- diff --git a/MANIFEST b/MANIFEST index 0dc43b8..4bb181b 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 067c061..83edeb6 100644 --- a/ext/Fcntl/Fcntl.pm +++ b/ext/Fcntl/Fcntl.pm @@ -55,13 +55,14 @@ See L 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 0000000..57135f6 --- /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");