...
my $obj = Widget::File->new(filename => $testfile, # a real file
otherstuff => ...);
my $dirh = IO::File->new('/', O_RDONLY); # reading a dirhandle forces a read() failure on Linux
$obj->{fh} = $dirh;
# invoke a method that calls read() internally
eval {
$obj->header(); # read()ing from a dirhandle forces an EISDIR error
};
like($@, qr(Error in reading file header - Is a directory at ));
####
./t/File..........NOK 71# Failed test (./t/File.t at line 191)
# ''
# doesn't match '(?-xism:Error in reading file header - Is a directory at )'
./t/File..........ok 73/0# Looks like you failed 1 tests of 73.