Branch Coverage

blib/lib/Device/SerialPort.pm
Criterion Covered Total %
branch 4 764 0.5


line true false branch
211 1 0 unless $@
214 0 0 if (defined $$bits{'_SC_CLK_TCK'})
223 0 0 unless $@
228 0 1 if (not defined $from_posix or $from_posix == 0)
237 1 1 unless (defined $ms_per_tick)
254 0 0 unless @_ == 2
272 0 0 if $choice eq $_
285 0 0 if -f $nameOrConf and not -c $nameOrConf
292 0 0 if ($lockfile) { }
299 0 0 unless defined $lockf
304 0 0 unless $ok and defined $ok2
316 0 0 unless (defined $$self{'FD'})
317 0 0 unless ($$self{'FD'} >= 0)
321 0 0 if ($$self{'LOCK'})
338 0 0 unless ($ok)
436 0 0 unless ($self->can_ioctl)
437 0 0 unless nocarp()
469 0 0 if ($$self{'IOSSIOSPEED_BAUD'} != -1 and $self->can_arbitrary_baud)
474 0 0 if ($Babble)
487 0 0 unless @_
490 0 0 unless (open CF, ">$filename")
516 0 0 if ($Babble)
524 0 0 unless @_ == 2
528 0 0 unless (open CF, "<$filename")
535 0 0 unless ($cfg_file_sig eq $signature)
540 0 0 unless ($$self{'NAME'} eq $name)
545 0 0 if ($Babble or not $self)
548 0 0 if ($Babble)
570 0 0 if ($value eq '') { }
0 0 elsif (defined $termios{$key}) { }
576 0 0 unless (defined &$gosub($self, $value))
583 0 0 if ($fault)
592 0 0 unless @_ == 2
603 0 0 unless @_
606 0 0 unless (open CF, "<$filename")
613 0 0 unless ($cfg_file_sig eq $signature)
620 0 0 if $lockfile and not $self
621 0 0 if ($Babble or not $self)
626 0 0 if ($Babble)
631 0 0 if ($self)
632 0 0 if (get_start_values($self, $filename)) { }
670 0 0 if (defined $$bits{'TIOCMBIS'} and defined $$bits{'TIOCMBIC'} and defined $$bits{'TIOCM_RTS'} and defined $$bits{'TIOCSDTR'} && defined $$bits{'TIOCCDTR'} || defined $$bits{'TIOCM_DTR'})
688 0 0 if defined $$bits{'TIOCMGET'}
693 0 0 if defined $$bits{'TIOCMIWAIT'}
698 0 0 if defined $$bits{'TIOCGICOUNT'}
703 0 0 if defined $$bits{'portable_TIOCINQ'} and defined $$bits{'TIOCOUTQ'}
712 0 0 if $self->can_status and defined $$bits{'TIOCSERGETLSR'} and TIOCM_LE()
720 0 0 if (defined $$bits{'TIOCMBIS'} and defined $$bits{'TIOCMBIC'} and defined $$bits{'TIOCM_RTS'})
734 0 0 if defined $$bits{'IOSSIOSPEED'}
740 0 0 unless $Device::SerialPort::IOCTL_VALUE_TERMIOXFLOW
744 0 0 $on ? :
747 0 0 unless $self->ioctl('TCGETX', \$flags)
753 0 0 $on ? :
756 0 0 unless $self->ioctl('TCSETX', \$flags)
766 0 0 if (@_)
767 0 0 if ($_[0] eq 'none') { }
0 0 elsif ($_[0] eq 'xoff') { }
0 0 elsif ($_[0] eq 'rts') { }
769 0 0 if $Device::SerialPort::IOCTL_VALUE_TERMIOXFLOW
774 0 0 if $Device::SerialPort::IOCTL_VALUE_TERMIOXFLOW
779 0 0 if $Device::SerialPort::IOCTL_VALUE_TERMIOXFLOW
783 0 0 if ($$self{'U_MSG'} or $Babble)
790 0 0 if (wantarray)
792 0 0 if $mask == ($$self{'C_IFLAG'} & $mask)
793 0 0 if ($Device::SerialPort::IOCTL_VALUE_TERMIOXFLOW) { }
794 0 0 if $$self{'TERMIOX'} & $Device::SerialPort::IOCTL_VALUE_TERMIOXFLOW
796 0 0 if $$self{'C_CFLAG'} & CRTSCTS()
805 0 0 if (defined $rate)
807 0 0 if (defined $bauds{$rate}) { }
0 0 elsif ($self->can_arbitrary_baud) { }
821 0 0 if ($$self{'U_MSG'} or $Babble)
827 0 0 if (wantarray)
829 0 0 if $bauds{$item} == $$self{'C_OSPEED'}
841 0 0 if (@_)
842 0 0 if ($_[0] eq 'none') { }
0 0 elsif ($_[0] eq 'odd') { }
0 0 elsif ($_[0] eq 'even') { }
853 0 0 if ($$self{'U_MSG'} or $Babble)
858 0 0 unless write_settings($self)
860 0 0 if (wantarray)
861 0 0 unless $$self{'C_CFLAG'} & 256
863 0 0 if $mask == ($$self{'C_CFLAG'} & $mask)
865 0 0 if $mask == ($$self{'C_CFLAG'} & $mask)
871 0 0 if (@_)
872 0 0 if ($_[0] == 8) { }
0 0 elsif ($_[0] == 7) { }
0 0 elsif ($_[0] == 6) { }
0 0 elsif ($_[0] == 5) { }
889 0 0 if ($$self{'U_MSG'} or $Babble)
896 0 0 if (wantarray)
898 0 0 if $mask == 48
899 0 0 if $mask == 32
900 0 0 if $mask == 16
906 0 0 if (@_)
907 0 0 if ($_[0] == 2) { }
0 0 elsif ($_[0] == 1) { }
914 0 0 if ($$self{'U_MSG'} or $Babble)
921 0 0 if (wantarray)
922 0 0 if $$self{'C_CFLAG'} & 64
928 0 0 if (@_)
930 0 0 if $v < 0 or $v > 255
939 0 0 if (@_)
941 0 0 if $v < 0 or $v > 255
950 0 0 if (@_)
952 0 0 if $v < 0 or $v > 255
961 0 0 if (@_)
963 0 0 if $v < 0 or $v > 255
972 0 0 if (@_)
974 0 0 if $v < 0 or $v > 255
983 0 0 if (@_)
985 0 0 if $v < 0 or $v > 255
994 0 0 if (@_)
996 0 0 if $v < 0 or $v > 255
1005 0 0 if (@_)
1007 0 0 if $v < 0 or $v > 255
1016 0 0 if (@_)
1018 0 0 if $v < 0 or $v > 255
1027 0 0 if (@_)
1028 0 0 if (yes_true(shift())) { }
1035 0 0 $$self{'C_LFLAG'} & 8 ? :
1040 0 0 if (@_)
1041 0 0 if (yes_true(shift())) { }
1048 0 0 $$self{'C_LFLAG'} & 16 ? :
1053 0 0 if (@_)
1054 0 0 if (yes_true(shift())) { }
1061 0 0 $$self{'C_LFLAG'} & 32 ? :
1066 0 0 if (@_)
1067 0 0 if (yes_true(shift())) { }
1074 0 0 $$self{'C_LFLAG'} & 64 ? :
1080 0 0 unless ECHOKE()
1081 0 0 if (@_)
1082 0 0 if (yes_true(shift())) { }
1089 0 0 $$self{'C_LFLAG'} & ECHOKE() ? :
1095 0 0 unless ECHOCTL()
1096 0 0 if (@_)
1097 0 0 if (yes_true(shift())) { }
1104 0 0 $$self{'C_LFLAG'} & ECHOCTL() ? :
1110 0 0 if (@_)
1111 0 0 if (yes_true(shift())) { }
1118 0 0 wantarray ? :
1124 0 0 if (@_)
1125 0 0 if (yes_true(shift())) { }
1132 0 0 wantarray ? :
1138 0 0 if (@_)
1139 0 0 if (yes_true(shift())) { }
1146 0 0 $$self{'C_IFLAG'} & 1 ? :
1152 0 0 if (@_)
1153 0 0 if (yes_true(shift())) { }
1160 0 0 $$self{'C_IFLAG'} & 32 ? :
1166 0 0 if (@_)
1167 0 0 if (yes_true(shift())) { }
1174 0 0 $$self{'C_IFLAG'} & 16 ? :
1179 0 0 if (@_)
1180 0 0 if (yes_true(shift())) { }
1187 0 0 $$self{'C_IFLAG'} & 256 ? :
1192 0 0 if (@_)
1193 0 0 if (yes_true(shift())) { }
1200 0 0 $$self{'C_IFLAG'} & 128 ? :
1205 0 0 if (@_)
1206 0 0 if (yes_true(shift())) { }
1213 0 0 $$self{'C_IFLAG'} & 64 ? :
1219 0 0 unless OCRNL()
1220 0 0 if (@_)
1221 0 0 if (yes_true(shift())) { }
1228 0 0 $$self{'C_OFLAG'} & OCRNL() ? :
1234 0 0 unless ONLCR()
1235 0 0 if (@_)
1236 0 0 if (yes_true(shift())) { }
1243 0 0 $$self{'C_OFLAG'} & ONLCR() ? :
1248 0 0 if (@_)
1249 0 0 if (yes_true(shift())) { }
1256 0 0 $$self{'C_OFLAG'} & 1 ? :
1261 0 0 if (@_)
1262 0 0 if (yes_true(shift())) { }
1269 0 0 $$self{'C_LFLAG'} & 1 ? :
1274 0 0 if (@_)
1275 0 0 if (yes_true(shift())) { }
1282 0 0 $$self{'C_LFLAG'} & 2 ? :
1287 0 0 if (@_)
1293 0 0 if (@_)
1299 0 0 if (@_)
1305 0 0 if (@_)
1311 0 0 if (@_)
1317 0 0 if (@_)
1323 0 0 if (@_)
1329 0 0 if (@_)
1335 0 0 unless @_ == 2
0 0 if (@_)
1336 0 0 wantarray ? :
1341 0 0 if (@_)
1352 0 0 if (@_)
1359 0 0 unless @_ == 2
1364 0 0 unless $wanted > 0
1374 0 0 if ($size > $bufsize)
1376 0 0 if ($count_in) { }
0 0 elsif ($done) { }
1384 0 0 unless defined $count_in
1392 0 0 unless @_ == 2
1397 0 0 unless $wanted > 0
1416 0 0 if ($ready > 0)
1419 0 0 if (not defined $got) { }
0 0 elsif ($got == 0 and $wanted != 0) { }
1420 0 0 if &POSIX::EAGAIN == ($ok = POSIX::errno())
1421 0 0 if not $ready and 0 == $ok
1432 0 0 if $Babble
1442 0 0 if (@_)
1444 0 0 if ($] >= 5.005) { }
1447 0 0 if ($re_next) { }
1453 0 0 if ($pat eq '-re')
1466 0 0 if (nocarp() and @_ == 1)
1473 0 0 if @_
1479 0 0 if (@_)
1481 0 0 if $val < 0
1489 0 0 if (@_)
1491 0 0 if ($] >= 5.005) { }
1504 0 0 if @_
1510 0 0 if @_
1518 0 0 if (@_)
1525 0 0 unless ($$self{'_LOOK'})
1529 0 0 if ($size) { }
1531 0 0 unless $count_in
1538 0 0 if ($loc ne '')
1553 0 0 if ($pat eq '-re')
1558 0 0 if ($re_next) { }
0 0 elsif (($mpos = index($lookbuf, $pat)) > -1) { }
1561 0 0 if ($lookbuf =~ s/$pat//s)
1571 0 0 if ($got_match)
1573 0 0 if (scalar @loc_char) { }
1593 0 0 if (@_)
1612 0 0 unless ($$self{'_LOOK'})
1616 0 0 if ($size) { }
1618 0 0 unless $count_in
1625 0 0 if ($loc ne '')
1629 0 0 if ($pat eq '-re')
1634 0 0 if ($re_next) { }
0 0 elsif (($mpos = index($$self{'_LOOK'}, $pat)) > -1) { }
1636 0 0 if ($$self{'_LOOK'} =~ /$pat/s)
1640 0 0 if ($mpos) { }
1641 0 0 if $best_pos and $mpos > $best_pos
1661 0 0 if ($mpos) { }
1662 0 0 if $best_pos and $mpos > $best_pos
1683 0 0 if ($got_match)
1695 0 0 unless @_ == 1
1701 0 0 if (nocarp() and $$self{'_T_INPUT'})
1707 0 0 if ($$self{'C_VMIN'})
1714 0 0 unless (defined $got)
1715 0 0 if ($got == -1)
1716 0 0 if &POSIX::EAGAIN == ($ok = POSIX::errno())
1717 0 0 if 0 == $ok
1724 0 0 unless @_ == 2
1729 0 0 if $wbuf eq ''
1739 0 0 if @_
1740 0 0 if defined POSIX::tcdrain($$self{'FD'})
1746 0 0 if @_
1747 0 0 if defined POSIX::tcflush($$self{'FD'}, 2)
1753 0 0 if @_
1754 0 0 if defined POSIX::tcflush($$self{'FD'}, 0)
1760 0 0 if @_
1761 0 0 if defined POSIX::tcflush($$self{'FD'}, 1)
1767 0 0 if (@_)
1775 0 0 if (@_)
1776 0 0 wantarray ? :
1781 0 0 if (@_)
1782 0 0 wantarray ? :
1787 0 0 if (@_)
1788 0 0 if (yes_true(shift())) { }
1795 0 0 wantarray ? :
1799 0 0 unless @_ == 2
1801 0 0 unless $self->can_write_done
1804 0 0 if $wait
1809 0 0 unless $self->ioctl('TIOCOUTQ', \$mstat)
1811 0 0 if $result
1813 0 0 unless $self->ioctl('TIOCSERGETLSR', \$mstat)
1815 0 0 unless $wait
1816 0 0 if $result
1819 0 0 $result ? :
1823 0 0 unless @_ == 1
1825 0 0 unless $self->can_modemlines
1828 0 0 unless $self->ioctl('TIOCMGET', \$mstat)
1830 0 0 if ($Babble)
1832 0 0 if $result & MS_CTS_ON()
1833 0 0 if $result & MS_DSR_ON()
1834 0 0 if $result & MS_RING_ON()
1835 0 0 if $result & MS_RLSD_ON()
1844 0 0 unless @_ == 2
1847 0 0 unless $self->can_wait_modemlines
1849 0 0 if ($Babble)
1857 0 0 unless @_ == 1
1859 0 0 unless $self->can_intr_count
1864 0 0 if ($Babble)
1872 0 0 if @_
1873 0 0 unless $self->can_status
1877 0 0 unless $self->ioctl('portable_TIOCINQ', \$mstat)
1880 0 0 unless $self->ioctl('TIOCOUTQ', \$mstat)
1884 0 0 if ($Babble or $$self{'_DEBUG'})
1894 0 0 unless @_ == 2
1896 0 0 unless $self->can_dtrdsr
1902 0 0 if (defined $$bits{'TIOCSDTR'} and defined $$bits{'TIOCCDTR'}) { }
1905 0 0 $on ? :
1909 0 0 $on ? :
1911 0 0 unless $rc
1920 0 0 unless @_ == 2
1922 0 0 unless $self->can_rts
1926 0 0 $on ? :
1928 0 0 unless $rc
1933 0 0 unless @_ == 2
1938 0 0 unless $ok
1944 0 0 unless @_ == 2
1946 0 0 unless $self->can_rts
1948 0 0 unless $self->rts_active(1)
1950 0 0 unless $self->rts_active(0)
1956 0 0 unless @_ == 2
1958 0 0 unless $self->can_ioctl
1960 0 0 unless $self->dtr_active(1)
1962 0 0 unless $self->dtr_active(0)
1968 0 0 unless @_ == 2
1970 0 0 unless $self->can_rts
1972 0 0 unless $self->rts_active(0)
1974 0 0 unless $self->rts_active(1)
1980 0 0 unless @_ == 2
1982 0 0 unless $self->can_ioctl
1984 0 0 unless $self->dtr_active(0)
1986 0 0 unless $self->dtr_active(1)
1993 0 0 if (ref $self) { }
1994 0 0 if (@_)
1995 0 0 if (wantarray) { }
1998 0 0 unless nocarp()
2002 0 0 if (@_)
2003 0 0 if (wantarray) { }
2005 0 0 unless nocarp()
2016 0 0 unless defined $$self{'NAME'}
2018 0 0 if ($Babble)
2021 0 0 if ($$self{'FD'})
2025 0 0 if (defined $$self{'TERMIOS'})
2044 0 0 if defined $$self{'HANDLE'} and $$self{'HANDLE'}->opened
2050 0 0 if ($$self{'LOCK'})
2051 0 0 unless (unlink $$self{'LOCK'})
2052 0 0 unless nocarp()
2058 0 0 unless $ok
2065 0 0 unless defined $$self{'NAME'}
2068 0 0 if ($Babble)
2075 0 0 unless (defined($magic = $$bits{$code}))
2080 0 0 unless (CORE::ioctl $$self{'HANDLE'}, $magic, $$ref)
2097 0 0 unless defined $$self{'NAME'}
2098 0 0 if ($$self{'_DEBUG'})
2108 0 0 unless @_
2119 0 0 if @_ < 3
2124 0 0 if (@_)
2126 0 0 unless $self->post_print($out2)
2137 0 0 unless @_
2138 0 0 $, ? :
2139 0 0 if ($$self{'OFS'})
2140 0 0 $\ ? :
2141 0 0 if ($$self{'ORS'})
2150 0 0 if (@_)
2157 0 0 if (@_)
2163 0 0 unless @_
2171 0 0 unless (defined $written)
2174 0 0 unless $written
2188 0 0 unless $fmt
2189 0 0 unless @_
2199 0 0 if @_ < 3
2202 0 0 unless (defined $offset)
2208 0 0 unless defined $$buf
2213 0 0 if ($offset >= 0) { }
2214 0 0 if ($buflen > $offset + $count_in)
2218 0 0 if ($buflen < $offset) { }
2226 0 0 if (-$offset > $count_in)
2242 0 0 if @_
2248 0 0 if (wantarray) { }
2251 0 0 if $was = $self->reset_error
2252 0 0 if ($self->stty_icanon) { }
2254 0 0 unless defined $count_in
2258 0 0 unless defined $string_in
2260 0 0 if ($string_in ne '' or $match ne '')
2265 0 0 if $string_in =~ /$$self{'_CLASTLINE'}/s
2267 0 0 if @lines
2274 0 0 if $was = $self->reset_error
2276 0 0 unless defined $string_in
2278 0 0 if ($string_in ne '' or $match ne '')
2295 0 0 if ($count == 1)
2309 0 0 if ($Babble)