diff options
author | Ricardo Signes <rjbs@semiotic.systems> | 2021-06-22 22:27:04 -0400 |
---|---|---|
committer | Ricardo Signes <rjbs@semiotic.systems> | 2021-06-22 22:27:04 -0400 |
commit | 83f55546932132cb075db8f9ad6a13759062acc8 (patch) | |
tree | 7cce0c05ab2d5d582d6dce8006fe85779afd4322 | |
parent | ad951d634e3eef9ef1591789ad39a1687b6514fd (diff) |
thing-we-plan-to-read must not be a directory
-rw-r--r-- | Changes | 2 | ||||
-rw-r--r-- | lib/Mixin/Linewise/Readers.pm | 2 |
2 files changed, 3 insertions, 1 deletions
@@ -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': $!"; |