summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Signes <rjbs@semiotic.systems>2021-06-22 22:27:04 -0400
committerRicardo Signes <rjbs@semiotic.systems>2021-06-22 22:27:04 -0400
commit83f55546932132cb075db8f9ad6a13759062acc8 (patch)
tree7cce0c05ab2d5d582d6dce8006fe85779afd4322
parentad951d634e3eef9ef1591789ad39a1687b6514fd (diff)
thing-we-plan-to-read must not be a directory
-rw-r--r--Changes2
-rw-r--r--lib/Mixin/Linewise/Readers.pm2
2 files changed, 3 insertions, 1 deletions
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': $!";