Skip Menu |

This queue is for tickets about the Term-Size CPAN distribution.

Report information
The Basics
Id: 76292
Status: resolved
Priority: 0/
Queue: Term-Size

Owner: Nobody in particular
Requestors: leonerd-cpan [...]

Bug Information
Severity: Normal
Broken in: 0.207
Fixed in: 0.208-TRIAL

Subject: Returns false on failure, not undef
Download (untitled) / with headers
text/plain 585b
Documentation says: RETURN VALUES Both functions return undef if there is an error. I find this is not the case. $ perlsh eval: use Term::Size; undef eval: pipe( my $rd, my $wr ); [ Term::Size::chars $rd ] [ '' ] This comes from the use of XSRETURN_NO in PPCODE: if (ioctl(fileno(f), TIOCGWINSZ, &w) == -1) XSRETURN_NO; If instead you use XSRETURN(0) then it will return undef in scalar context, or an empty list in list context. This makes it easy to detect a failure: my ( $cols, $lines ) = chars( $fh ) or die "Cannot get size - $!"; -- Paul Evans
Fixed according to your suggestion since 0.208 trial release. Thanks!

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to