strace shows that in the problematic case /dev/tty cannot be opened, erroring with ENXIO (No such device or address). Here are three strace.logs from this section: the first two are successful, the third one fails:
5.30.2, with CPAN.pm 2.22:
13523 11:38:30.984185 write(6, "# Testing Term::ReadLine::Event: AnyEvent version 7.17\n", 55) = 55 <0.000024>
13523 11:38:30.984282 stat("/dev/tty", {st_mode=S_IFCHR|0666, st_rdev=makedev(0x5, 0), ...}) = 0 <0.000024>
13523 11:38:30.984371 openat(AT_FDCWD, "/dev/tty", O_RDONLY|O_CLOEXEC <unfinished ...>
13523 11:38:30.984425 <... openat resumed> ) = 3 <0.000034>
13523 11:38:30.984466 ioctl(3, TCGETS <unfinished ...>
13523 11:38:30.984515 <... ioctl resumed> , {B9600 opost isig icanon echo ...}) = 0 <0.000034>
13523 11:38:30.984565 lseek(3, 0, SEEK_CUR <unfinished ...>
13523 11:38:30.984616 <... lseek resumed> ) = -1 ESPIPE (Illegal seek) <0.000034>
13523 11:38:30.984663 fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x5, 0), ...}) = 0 <0.000025>
13523 11:38:30.984743 close(3) = 0 <0.000056>
13523 11:38:30.984861 openat(AT_FDCWD, "/dev/tty", O_RDONLY|O_CLOEXEC) = 3 <0.000025>
13523 11:38:30.984932 ioctl(3, TCGETS, {B9600 opost isig icanon echo ...}) = 0 <0.000021>
13523 11:38:30.985001 lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) <0.000021>
13523 11:38:30.985080 fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x5, 0), ...}) = 0 <0.000053>
13523 11:38:30.985196 openat(AT_FDCWD, "/dev/tty", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 4 <0.000024>
13523 11:38:30.985268 ioctl(4, TCGETS, {B9600 opost isig icanon echo ...}) = 0 <0.000021>
13523 11:38:30.985335 lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) <0.000016>
13523 11:38:30.985394 fstat(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x5, 0), ...}) = 0 <0.000021>
13523 11:38:30.985462 fcntl(4, F_SETFD, FD_CLOEXEC) = 0 <0.000033>
13523 11:38:30.985552 ioctl(4, TCGETS, {B9600 opost isig icanon echo ...}) = 0 <0.000021>
13523 11:38:30.985620 lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) <0.000016>
13523 11:38:30.985692 stat("/home/cpansand/.cpan/build/2020052410/Term-ReadLine-Event-0.05-1/blib/lib/Term/Cap.pmc", 0x7ffe906cb110) = -1 ENOENT (No such file or directory) <0.000023>
13523 11:38:30.985763 stat("/home/cpansand/.cpan/build/2020052410/Term-ReadLine-Event-0.05-1/blib/lib/Term/Cap.pm", 0x7ffe906cb110) = -1 ENOENT (No such file or directory) <0.000021>
5.31.11, without CPAN.pm:
11258 11:23:15.244113 write(6, "# Testing Term::ReadLine::Event: AnyEvent version 7.17\n", 55) = 55 <0.000022>
11258 11:23:15.244197 stat("/dev/tty", <unfinished ...>
11258 11:23:15.244263 <... stat resumed> {st_mode=S_IFCHR|0666, st_rdev=makedev(0x5, 0), ...}) = 0 <0.000045>
11258 11:23:15.244315 openat(AT_FDCWD, "/dev/tty", O_RDONLY|O_CLOEXEC <unfinished ...>
11258 11:23:15.244367 <... openat resumed> ) = 3 <0.000032>
11258 11:23:15.244413 ioctl(3, TCGETS <unfinished ...>
11258 11:23:15.244462 <... ioctl resumed> , {B9600 opost isig icanon echo ...}) = 0 <0.000034>
11258 11:23:15.244509 lseek(3, 0, SEEK_CUR <unfinished ...>
11258 11:23:15.244558 <... lseek resumed> ) = -1 ESPIPE (Illegal seek) <0.000034>
11258 11:23:15.244598 fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x5, 0), ...}) = 0 <0.000020>
11258 11:23:15.244673 close(3) = 0 <0.000022>
11258 11:23:15.244742 openat(AT_FDCWD, "/dev/tty", O_RDONLY|O_CLOEXEC) = 3 <0.000024>
11258 11:23:15.244813 ioctl(3, TCGETS, {B9600 opost isig icanon echo ...}) = 0 <0.000020>
11258 11:23:15.244880 lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) <0.000020>
11258 11:23:15.244943 fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x5, 0), ...}) = 0 <0.000020>
11258 11:23:15.245012 openat(AT_FDCWD, "/dev/tty", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 4 <0.000023>
11258 11:23:15.245082 ioctl(4, TCGETS, {B9600 opost isig icanon echo ...}) = 0 <0.000020>
11258 11:23:15.245149 lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) <0.000019>
11258 11:23:15.245211 fstat(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x5, 0), ...}) = 0 <0.000019>
11258 11:23:15.245277 fcntl(4, F_SETFD, FD_CLOEXEC) = 0 <0.000019>
11258 11:23:15.245340 ioctl(4, TCGETS, {B9600 opost isig icanon echo ...}) = 0 <0.000020>
11258 11:23:15.245405 lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) <0.000019>
11258 11:23:15.245484 stat("/home/cpansand/.cpan/build/2020052410/Term-ReadLine-Event-0.05-1/blib/lib/Term/Cap.pmc", 0x7ffdf0dcf0f0) = -1 ENOENT (No such file or directory) <0.000022>
11258 11:23:15.245554 stat("/home/cpansand/.cpan/build/2020052410/Term-ReadLine-Event-0.05-1/blib/lib/Term/Cap.pm", 0x7ffdf0dcf0f0) = -1 ENOENT (No such file or directory) <0.000021>
5.31.11, with CPAN.pm 2.77:
27442 11:08:16.192988 write(6, "# Testing Term::ReadLine::Event: AnyEvent version 7.17\n", 55) = 55 <0.000025>
27442 11:08:16.193088 stat("/dev/tty", <unfinished ...>
27442 11:08:16.193145 <... stat resumed> {st_mode=S_IFCHR|0666, st_rdev=makedev(0x5, 0), ...}) = 0 <0.000037>
27442 11:08:16.193198 openat(AT_FDCWD, "/dev/tty", O_RDONLY|O_CLOEXEC <unfinished ...>
27442 11:08:16.193251 <... openat resumed> ) = -1 ENXIO (No such device or address) <0.000031>
27442 11:08:16.193299 openat(AT_FDCWD, "&STDIN", O_RDONLY|O_CLOEXEC <unfinished ...>
27442 11:08:16.193353 <... openat resumed> ) = -1 ENOENT (No such file or directory) <0.000034>
27442 11:08:16.193400 fcntl(2, F_DUPFD_CLOEXEC, 0 <unfinished ...>
27442 11:08:16.193452 <... fcntl resumed> ) = 3 <0.000034>
27442 11:08:16.193492 ioctl(3, TCGETS, 0x7ffcea216f20) = -1 ENOTTY (Inappropriate ioctl for device) <0.000019>
27442 11:08:16.193553 lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) <0.000019>
27442 11:08:16.193620 fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 <0.000019>
27442 11:08:16.193705 stat("/home/cpansand/.cpan/build/2020052410/Term-ReadLine-Event-0.05-1/blib/lib/Term/Cap.pmc", 0x7ffcea216f30) = -1 ENOENT (No such file or directory) <0.000028>
27442 11:08:16.193784 stat("/home/cpansand/.cpan/build/2020052410/Term-ReadLine-Event-0.05-1/blib/lib/Term/Cap.pm", 0x7ffcea216f30) = -1 ENOENT (No such file or directory) <0.000025>
I tried the third case also without Test::Reporter, but the problem persists.