{
    "mode": "perldoc",
    "parameter": "Devel::Cover::Truth_Table",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Devel%3A%3ACover%3A%3ATruth_Table/json",
    "generated": "2026-07-05T09:29:30Z",
    "synopsis": "use Devel::Cover::TruthTable;\n# $a || $b\nmy $ortt  = Devel::Cover::TruthTable->newprimitive('or3', 0, 1, 1);\n# $c && $d\nmy $andtt = Devel::Cover::TruthTable->newprimitive('and3', 1, 0, 1);\n# merge contents of $andtt into right column of $ortt, to create\n# $a || ($c && $d)\n$ortt->rightmerge($andtt);\n# get a (sorted) textual representation\nmy @text = $ortt->sort->text;\nprint \"$\\n\" foreach @text;\nEND\nA B C |exp|hit\n--------------\n0 0 X | 0 |---\n0 1 0 | 0 |---\n0 1 1 | 1 |+++\n1 X X | 1 |+++\n--------------",
    "sections": {
        "NAME": {
            "content": "Devel::Cover::TruthTable - Truth tables for coverage objects.\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 1.36\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Devel::Cover::TruthTable;\n\n# $a || $b\nmy $ortt  = Devel::Cover::TruthTable->newprimitive('or3', 0, 1, 1);\n\n# $c && $d\nmy $andtt = Devel::Cover::TruthTable->newprimitive('and3', 1, 0, 1);\n\n# merge contents of $andtt into right column of $ortt, to create\n# $a || ($c && $d)\n$ortt->rightmerge($andtt);\n\n# get a (sorted) textual representation\nmy @text = $ortt->sort->text;\nprint \"$\\n\" foreach @text;\n\nEND\nA B C |exp|hit\n--------------\n0 0 X | 0 |---\n0 1 0 | 0 |---\n0 1 1 | 1 |+++\n1 X X | 1 |+++\n--------------\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module provides methods for creating and merging conditional primitives (\"$a && $b\", \"$c ||\n$d\", etc.) into more complex composite expressions.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "newprimitive($op, @coverage)\nCreate a new truth table based on one of the built-in primitives, which are the subclasses of\nDevel::Cover::DB::Condition. $op is one of the following:\n\nand3\n\"and\" or \"&&\" with three conditional paths.\n\nor3\n\"or\" or \"||\" with three conditional paths.\n\nor2\n\"or\" or \"||\" with two conditional paths. (i.e., when the right hand side of the expression\nis a constant)\n\nxor4\n\"xor\" with four conditional paths.\n\n@coverage is a list booleans identifying which of the possible paths have been covered.\n\nsort()\nSorts a truth table (in place) and returns the sorted object.\n\ntext()\nFormat a truth table to an array of strings for printing.\n\nhtml()\nFormat a truth table in HTML.\n\nerror()\npercentage()\nDetermines the proportion of possible conditions that have coverage.\n\nrightmerge($subtable)\nMerge entries from $subtable into right column of table.\n\nleftmerge($subtable)\nMerge entries from $subtable into left column of table.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Devel::Cover\n",
            "subsections": []
        },
        "BUGS": {
            "content": "None that I'm aware of...\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Copyright 2002 Michael Carman <mjcarman@mchsi.com>\n\nThis software is free. It is licensed under the same terms as Perl itself. The latest version\nshould be available from: http://www.pjcj.net\n",
            "subsections": []
        }
    },
    "summary": "Devel::Cover::TruthTable - Truth tables for coverage objects.",
    "flags": [],
    "examples": [],
    "see_also": []
}