Devel::Cover::Truth\_Table(3) User Contributed Perl Documentation Devel::Cover::Truth\_Table(3)

# [NAME](#NAME)

Devel::Cover::Truth\_Table - Truth tables for coverage objects.

# [SYNOPSIS](#SYNOPSIS)

```
  use Devel::Cover::Truth_Table;
  # $a || $b
  my $or_tt  = Devel::Cover::Truth_Table->new_primitive('or_3', 0, 1, 1);
  # $c && $d
  my $and_tt = Devel::Cover::Truth_Table->new_primitive('and_3', 1, 0, 1);
  # merge contents of $and_tt into right column of $or_tt, to create
  # $a || ($c && $d)
  $or_tt->right_merge($and_tt);
  # get a (sorted) textual representation
  my @text = $or_tt->sort->text;
  print "$_\n" foreach @text;
  __END__
  A B C |exp|hit
  --------------
  0 0 X | 0 |---
  0 1 0 | 0 |---
  0 1 1 | 1 |+++
  1 X X | 1 |+++
  --------------
```

# [DESCRIPTION](#DESCRIPTION)

This module provides methods for creating and merging conditional primitives ("$a && $b", "$c || $d", etc.) into more complex composite expressions.

# [METHODS](#METHODS)

## [new\_primitive($op, @coverage)](#new_primitive%28$op,_@coverage%29)

Create a new truth table based on one of the built-in primitives, which are the subclasses of Devel::Cover::DB::Condition. $op is one of the following:

[and\_3](#and_3)

"and" or "&&" with three conditional paths.

[or\_3](#or_3)

"or" or "||" with three conditional paths.

[or\_2](#or_2)

"or" or "||" with two conditional paths. (i.e., when the right hand side of the expression is a constant)

[xor\_4](#xor_4)

"xor" with four conditional paths.

@coverage is a list booleans identifying which of the possible paths have been covered.

## **sort()**

Sorts a truth table (in place) and returns the sorted object.

## **text()**

Format a truth table to an array of strings for printing.

## **html()**

Format a truth table in HTML.

## **error()**

## **percentage()**

Determines the proportion of possible conditions that have coverage.

## [right\_merge($sub\_table)](#right_merge%28$sub_table%29)

Merge entries from $sub\_table into right column of table.

## [left\_merge($sub\_table)](#left_merge%28$sub_table%29)

Merge entries from $sub\_table into left column of table.

# [SEE ALSO](#SEE_ALSO)

Devel::Cover

# [LICENSE](#LICENSE)

Copyright 2002 Michael Carman &lt;mjcarman@mchsi.com&gt;

This software is free. It is licensed under the same terms as Perl itself. The latest version should be available from: https://pjcj.net

2026-08-30 perl v5.44.0

---

Document: Devel::Cover::Truth_Table(3pm) from perl-devel-cover 1.52-r5 (Chainguard OS)
Source: https://github.com/pjcj/Devel--Cover
