{
    "content": [
        {
            "type": "text",
            "text": "# boolean (man)\n\n## NAME\n\nboolean - Boolean support for Perl\n\n## SYNOPSIS\n\nuse boolean;\ndo &always if true;\ndo &never if false;\ndo &maybe if boolean($value)->isTrue;\nand:\nuse boolean ':all';\n$guess = int(rand(2)) % 2 ? true : false;\ndo &something if isTrue($guess);\ndo &somethingelse if isFalse($guess);\n\n## DESCRIPTION\n\nMost programming languages have a native \"Boolean\" data type. Perl does not.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **RATIONALE**\n- **FUNCTIONS**\n- **METHODS**\n- **USE OPTIONS**\n- **DEPRECATIONS**\n- **JSON SUPPORT**\n- **AUTHOR**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "boolean",
        "section": "",
        "mode": "man",
        "summary": "boolean - Boolean support for Perl",
        "synopsis": "use boolean;\ndo &always if true;\ndo &never if false;\ndo &maybe if boolean($value)->isTrue;\nand:\nuse boolean ':all';\n$guess = int(rand(2)) % 2 ? true : false;\ndo &something if isTrue($guess);\ndo &somethingelse if isFalse($guess);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "RATIONALE",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "FUNCTIONS",
                "lines": 30,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "USE OPTIONS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DEPRECATIONS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "JSON SUPPORT",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 8,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "boolean - Boolean support for Perl\n",
                "subsections": []
            },
            "VERSION": {
                "content": "This document describes boolean version 0.46.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use boolean;\n\ndo &always if true;\ndo &never if false;\n\ndo &maybe if boolean($value)->isTrue;\n\nand:\n\nuse boolean ':all';\n\n$guess = int(rand(2)) % 2 ? true : false;\n\ndo &something if isTrue($guess);\ndo &somethingelse if isFalse($guess);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Most programming languages have a native \"Boolean\" data type. Perl does not.\n\nPerl has a simple and well known Truth System. The following scalar values are false:\n\n$false1 = undef;\n$false2 = 0;\n$false3 = 0.0;\n$false4 = '';\n$false5 = '0';\n\nEvery other scalar value is true.\n\nThis module provides basic Boolean support, by defining two special objects: \"true\" and\n\"false\".\n",
                "subsections": []
            },
            "RATIONALE": {
                "content": "When sharing data between programming languages, it is important to support the same group of\nbasic types. In Perlish programming languages, these types include: Hash, Array, String,\nNumber, Null and Boolean. Perl lacks native Boolean support.\n\nData interchange modules like YAML and JSON can now \"use boolean\" to encodedecoderoundtrip\nBoolean values.\n",
                "subsections": []
            },
            "FUNCTIONS": {
                "content": "This module defines the following functions:\n\n\"true\"\nThis  function  returns  a  scalar  value  which  will  evaluate  to true. The value is a\nsingleton object, meaning there is only one \"true\" value in a Perl process at  any  time.\nYou  can  check  to  see  whether the value is the \"true\" object with the isTrue function\ndescribed below.\n\n\"false\"\nThis function returns a scalar value which  will  evaluate  to  false.  The  value  is  a\nsingleton  object, meaning there is only one \"false\" value in a Perl process at any time.\nYou can check to see whether the value is the \"false\" object with  the  isFalse  function\ndescribed below.\n\n\"boolean($scalar)\"\nCasts   the   scalar   value  to  a  boolean  value.  If  $scalar  is  true,  it  returns\n\"boolean::true\", otherwise it returns \"boolean::false\".\n\n\"isTrue($scalar)\"\nReturns \"boolean::true\" if the scalar passed to it is the \"boolean::true\" object. Returns\n\"boolean::false\" otherwise.\n\n\"isFalse($scalar)\"\nReturns \"boolean::true\" if the scalar  passed  to  it  is  the  \"boolean::false\"  object.\nReturns \"boolean::false\" otherwise.\n\n\"isBoolean($scalar)\"\nReturns   \"boolean::true\"   if  the  scalar  passed  to  it  is  the  \"boolean::true\"  or\n\"boolean::false\" object. Returns \"boolean::false\" otherwise.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "Since true and false return objects, you can call methods on them.\n\n\"$boolean->isTrue\"\nSame as isTrue($boolean).\n\n\"$boolean->isFalse\"\nSame as isFalse($boolean).\n",
                "subsections": []
            },
            "USE OPTIONS": {
                "content": "By default this module exports the \"true\", \"false\" and \"boolean\" functions.\n\nThe module also defines these export tags:\n\n\":all\"\nExports \"true\", \"false\", \"boolean\", \"isTrue\", \"isFalse\", \"isBoolean\"\n",
                "subsections": []
            },
            "DEPRECATIONS": {
                "content": "This module offered an export tag, \"-truth\", that overrides the Perl  interpreter's  internal\nvalues  for  true  and  false.  This  has  been  found  to  corrupt  the  interpreter in some\ncircumstances. Also, these overrides will no longer be possible as of Perl  5.22.  Therefore,\nthe \"-truth\" import tag is deprecated.\n",
                "subsections": []
            },
            "JSON SUPPORT": {
                "content": "JSON::MaybeXS  (or  less  preferably  JSON.pm  ) will encode Perl data with boolean.pm values\ncorrectly if you use the \"convertblessed\" option:\n\nuse JSON::MaybeXS;\nuse boolean -truth;\nmy $json = JSON::MaybeXS->new->convertblessed;\nsay $json->encode({false => (0 == 1)});     # Says: '{\"false\":false}',\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Ingy döt Net <ingy@cpan.org>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "Copyright 2007-2016. Ingy döt Net.\n\nThis program is free software; you can redistribute it and/or modify it under the same  terms\nas Perl itself.\n\nSee <http://www.perl.com/perl/misc/Artistic.html>\n\nperl v5.36.0                                 2022-10-13                                 boolean(3pm)",
                "subsections": []
            }
        }
    }
}