From 83f55546932132cb075db8f9ad6a13759062acc8 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Tue, 22 Jun 2021 22:27:04 -0400 Subject: thing-we-plan-to-read must not be a directory --- Changes | 2 ++ lib/Mixin/Linewise/Readers.pm | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index a594e30..995fb86 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Changelog for Mixin-Linewise {{$NEXT}} + - tweak the file test again to exclude directories; (is this going to + turn into something more convoluted in several releases? probably) 0.109 2021-06-20 21:10:22-04:00 America/New_York - use "-r" test instead of "-f" test, to allow use on (say) named diff --git a/lib/Mixin/Linewise/Readers.pm b/lib/Mixin/Linewise/Readers.pm index 057fa3e..9ac4785 100644 --- a/lib/Mixin/Linewise/Readers.pm +++ b/lib/Mixin/Linewise/Readers.pm @@ -95,7 +95,7 @@ sub _mk_read_file { # Check the file Carp::croak "no filename specified" unless $filename; Carp::croak "file '$filename' does not exist" unless -e $filename; - Carp::croak "'$filename' is not readable" unless -r _; + Carp::croak "'$filename' is not readable" unless -r _ && ! -d _; my $handle = IO::File->new($filename, "<:$binmode") or Carp::croak "couldn't read file '$filename': $!"; -- cgit v1.2.3