From 2b9f61bf2777091bfdddaf08e2df72e8de91cfa0 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 30 Mar 2012 21:18:39 +1100 Subject: [PATCH] [perl #111638] fix -p on File::stat objects --- lib/File/stat.pm | 6 +++++- lib/File/stat.t | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/File/stat.pm b/lib/File/stat.pm index 34c883b..90d53d7 100644 --- a/lib/File/stat.pm +++ b/lib/File/stat.pm @@ -37,10 +37,14 @@ BEGIN { my $val = eval { &{"Fcntl::S_I\U$_"} }; *{"_$_"} = defined $val ? sub { $_[0] & $val ? 1 : "" } : sub { "" }; } - for (qw(SOCK CHR BLK REG DIR FIFO LNK)) { + for (qw(SOCK CHR BLK REG DIR LNK)) { *{"S_IS$_"} = defined eval { &{"Fcntl::S_IF$_"} } ? \&{"Fcntl::S_IS$_"} : sub { "" }; } + # FIFO flag and macro don't quite follow the S_IF/S_IS pattern above + # RT #111638 + *{"S_ISFIFO"} = defined &Fcntl::S_IFIFO + ? \&Fcntl::S_ISFIFO : sub { "" }; } # from doio.c diff --git a/lib/File/stat.t b/lib/File/stat.t index 382f43e..50981c6 100644 --- a/lib/File/stat.t +++ b/lib/File/stat.t @@ -169,7 +169,6 @@ SKIP: my $pstat = File::stat::stat($rh); ok(!-p($stat), "-p should be false on a file"); - local $TODO = "RT #111638 -p overload broken"; ok(-p($pstat), "check -p detects a pipe"); } -- 2.7.4