{
    "content": [
        {
            "type": "text",
            "text": "# strictures (man)\n\n## NAME\n\nstrictures - Turn on strict and make most warnings fatal\n\n## SYNOPSIS\n\nuse strictures 2;\nis equivalent to\nuse strict;\nuse warnings FATAL => 'all';\nuse warnings NONFATAL => qw(\nexec\nrecursion\ninternal\nmalloc\nnewline\nexperimental\ndeprecated\nportable\n);\nno warnings 'once';\nexcept when called from a file which matches:\n(caller)[1] =~ /^(?:t|xt|lib|blib)[\\\\\\/]/\nand when either \".git\", \".svn\", \".hg\", or \".bzr\" is present in the current directory (with\nthe intention of only forcing extra tests on the author side) -- or when \".git\", \".svn\",\n\".hg\", or \".bzr\" is present two directories up along with \"dist.ini\" (which would indicate we\nare in a \"dzil test\" operation, via Dist::Zilla) -- or when the \"PERLSTRICTURESEXTRA\"\nenvironment variable is set, in which case it also does the equivalent of\nno indirect 'fatal';\nno multidimensional;\nno bareword::filehandles;\nNote that \"PERLSTRICTURESEXTRA\" may at some point add even more tests, with only a minor\nversion increase, but any changes to the effect of \"use strictures\" in normal mode will\ninvolve a major version bump.\nIf any of the extra testing modules are not present, strictures will complain loudly, once,\nvia \"warn()\", and then shut up. But you really should consider installing them, they're all\ngreat anti-footgun tools.\n\n## DESCRIPTION\n\nI've been writing the equivalent of this module at the top of my code for about a year now. I\nfigured it was time to make it shorter.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CATEGORY SELECTIONS**\n- **VERSIONS**\n- **METHODS** (1 subsections)\n- **EXTRA TESTING RATIONALE**\n- **SEE ALSO**\n- **COMMUNITY AND SUPPORT** (2 subsections)\n- **AUTHOR**\n- **CONTRIBUTORS**\n- **COPYRIGHT**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "strictures",
        "section": "",
        "mode": "man",
        "summary": "strictures - Turn on strict and make most warnings fatal",
        "synopsis": "use strictures 2;\nis equivalent to\nuse strict;\nuse warnings FATAL => 'all';\nuse warnings NONFATAL => qw(\nexec\nrecursion\ninternal\nmalloc\nnewline\nexperimental\ndeprecated\nportable\n);\nno warnings 'once';\nexcept when called from a file which matches:\n(caller)[1] =~ /^(?:t|xt|lib|blib)[\\\\\\/]/\nand when either \".git\", \".svn\", \".hg\", or \".bzr\" is present in the current directory (with\nthe intention of only forcing extra tests on the author side) -- or when \".git\", \".svn\",\n\".hg\", or \".bzr\" is present two directories up along with \"dist.ini\" (which would indicate we\nare in a \"dzil test\" operation, via Dist::Zilla) -- or when the \"PERLSTRICTURESEXTRA\"\nenvironment variable is set, in which case it also does the equivalent of\nno indirect 'fatal';\nno multidimensional;\nno bareword::filehandles;\nNote that \"PERLSTRICTURESEXTRA\" may at some point add even more tests, with only a minor\nversion increase, but any changes to the effect of \"use strictures\" in normal mode will\ninvolve a major version bump.\nIf any of the extra testing modules are not present, strictures will complain loudly, once,\nvia \"warn()\", and then shut up. But you really should consider installing them, they're all\ngreat anti-footgun tools.",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 40,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 25,
                "subsections": []
            },
            {
                "name": "CATEGORY SELECTIONS",
                "lines": 32,
                "subsections": []
            },
            {
                "name": "VERSIONS",
                "lines": 45,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "import",
                        "lines": 7
                    }
                ]
            },
            {
                "name": "EXTRA TESTING RATIONALE",
                "lines": 44,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "COMMUNITY AND SUPPORT",
                "lines": 1,
                "subsections": [
                    {
                        "name": "IRC channel",
                        "lines": 4
                    },
                    {
                        "name": "Git repository",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "CONTRIBUTORS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "strictures - Turn on strict and make most warnings fatal\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use strictures 2;\n\nis equivalent to\n\nuse strict;\nuse warnings FATAL => 'all';\nuse warnings NONFATAL => qw(\nexec\nrecursion\ninternal\nmalloc\nnewline\nexperimental\ndeprecated\nportable\n);\nno warnings 'once';\n\nexcept when called from a file which matches:\n\n(caller)[1] =~ /^(?:t|xt|lib|blib)[\\\\\\/]/\n\nand when either \".git\", \".svn\", \".hg\", or \".bzr\" is present in the current directory (with\nthe intention of only forcing extra tests on the author side) -- or when \".git\", \".svn\",\n\".hg\", or \".bzr\" is present two directories up along with \"dist.ini\" (which would indicate we\nare in a \"dzil test\" operation, via Dist::Zilla) -- or when the \"PERLSTRICTURESEXTRA\"\nenvironment variable is set, in which case it also does the equivalent of\n\nno indirect 'fatal';\nno multidimensional;\nno bareword::filehandles;\n\nNote that \"PERLSTRICTURESEXTRA\" may at some point add even more tests, with only a minor\nversion increase, but any changes to the effect of \"use strictures\" in normal mode will\ninvolve a major version bump.\n\nIf any of the extra testing modules are not present, strictures will complain loudly, once,\nvia \"warn()\", and then shut up. But you really should consider installing them, they're all\ngreat anti-footgun tools.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "I've been writing the equivalent of this module at the top of my code for about a year now. I\nfigured it was time to make it shorter.\n\nThings like the importer in \"use Moose\" don't help me because they turn warnings on but don't\nmake them fatal -- which from my point of view is useless because I want an exception to tell\nme my code isn't warnings-clean.\n\nAny time I see a warning from my code, that indicates a mistake.\n\nAny time my code encounters a mistake, I want a crash -- not spew to STDERR and then unknown\n(and probably undesired) subsequent behaviour.\n\nI also want to ensure that obvious coding mistakes, like indirect object syntax (and not so\nobvious mistakes that cause things to accidentally compile as such) get caught, but not at\nthe cost of an XS dependency and not at the cost of blowing things up on another machine.\n\nTherefore, strictures turns on additional checking, but only when it thinks it's running in a\ntest file in a VCS checkout -- although if this causes undesired behaviour this can be\noverridden by setting the \"PERLSTRICTURESEXTRA\" environment variable.\n\nIf additional useful author side checks come to mind, I'll add them to the\n\"PERLSTRICTURESEXTRA\" code path only -- this will result in a minor version increase (e.g.\n1.000000 to 1.001000 (1.1.0) or similar). Any fixes only to the mechanism of this code will\nresult in a sub-version increase (e.g. 1.000000 to 1.000001 (1.0.1)).\n",
                "subsections": []
            },
            "CATEGORY SELECTIONS": {
                "content": "strictures does not enable fatal warnings for all categories.\n\nexec\nIncludes a warning that can cause your program to continue running unintentionally after\nan internal fork.  Not safe to fatalize.\n\nrecursion\nInfinite recursion will end up overflowing the stack eventually anyway.\n\ninternal\nTriggers deep within perl, in places that are not safe to trap.\n\nmalloc\nTriggers deep within perl, in places that are not safe to trap.\n\nnewline\nIncludes a warning for using stat on a valid but suspect filename, ending in a newline.\n\nexperimental\nExperimental features are used intentionally.\n\ndeprecated\nDeprecations will inherently be added to in the future in unexpected ways, so making them\nfatal won't be reliable.\n\nportable\nDoesn't indicate an actual problem with the program, only that it may not behave properly\nif run on a different machine.\n\nonce\nCan't be fatalized.  Also triggers very inconsistently, so we just disable it.\n",
                "subsections": []
            },
            "VERSIONS": {
                "content": "Depending on the version of strictures requested, different warnings will be enabled.  If no\nspecific version is requested, the current version's behavior will be used.  Versions can be\nrequested using perl's standard mechanism:\n\nuse strictures 2;\n\nOr, by passing in a \"version\" option:\n\nuse strictures version => 2;\n\nVERSION 2\nEquivalent to:\n\nuse strict;\nuse warnings FATAL => 'all';\nuse warnings NONFATAL => qw(\nexec\nrecursion\ninternal\nmalloc\nnewline\nexperimental\ndeprecated\nportable\n);\nno warnings 'once';\n\n# and if in dev mode:\nno indirect 'fatal';\nno multidimensional;\nno bareword::filehandles;\n\nAdditionally, any warnings created by modules using warnings::register or\n\"warnings::registercategories()\" will not be fatalized.\n\nVERSION 1\nEquivalent to:\n\nuse strict;\nuse warnings FATAL => 'all';\n# and if in dev mode:\nno indirect 'fatal';\nno multidimensional;\nno bareword::filehandles;\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "import",
                        "content": "This method does the setup work described above in \"DESCRIPTION\".  Optionally accepts a\n\"version\" option to request a specific version's behavior.\n\nVERSION\nThis method traps the \"strictures->VERSION(1)\" call produced by a use line with a version\nnumber on it and does the version check.\n"
                    }
                ]
            },
            "EXTRA TESTING RATIONALE": {
                "content": "Every so often, somebody complains that they're deploying via \"git pull\" and that they don't\nwant strictures to enable itself in this case -- and that setting \"PERLSTRICTURESEXTRA\" to\n0 isn't acceptable (additional ways to disable extra testing would be welcome but the\ndiscussion never seems to get that far).\n\nIn order to allow us to skip a couple of stages and get straight to a productive\nconversation, here's my current rationale for turning the extra testing on via a heuristic:\n\nThe extra testing is all stuff that only ever blows up at compile time; this is intentional.\nSo the oft-raised concern that it's different code being tested is only sort of the case --\nnone of the modules involved affect the final optree to my knowledge, so the author gets some\nadditional compile time crashes which he/she then fixes, and the rest of the testing is\ncompletely valid for all environments.\n\nThe point of the extra testing -- especially \"no indirect\" -- is to catch mistakes that\nnewbie users won't even realise are mistakes without help. For example,\n\nfoo { ... };\n\nwhere foo is an & prototyped sub that you forgot to import -- this is pernicious to track\ndown since all seems fine until it gets called and you get a crash. Worse still, you can fail\nto have imported it due to a circular require, at which point you have a load order dependent\nbug which I've seen before now only show up in production due to tiny differences between the\nproduction and the development environment. I wrote\n<http://shadow.cat/blog/matt-s-trout/indirect-but-still-fatal/> to explain this particular\nproblem before strictures itself existed.\n\nAs such, in my experience so far strictures' extra testing has avoided production versus\ndevelopment differences, not caused them.\n\nAdditionally, strictures' policy is very much \"try and provide as much protection as possible\nfor newbies -- who won't think about whether there's an option to turn on or not\" -- so\nhaving only the environment variable is not sufficient to achieve that (I get to explain that\nyou need to add \"use strict\" at least once a week on freenode #perl -- newbies sometimes\ncompletely skip steps because they don't understand that that step is important).\n\nI make no claims that the heuristic is perfect -- it's already been evolved significantly\nover time, especially for 1.004 where we changed things to ensure it only fires on files in\nyour checkout (rather than strictures-using modules you happened to have installed, which was\njust silly). However, I hope the above clarifies why a heuristic approach is not only\nnecessary but desirable from a point of view of providing new users with as much safety as\npossible, and will allow any future discussion on the subject to focus on \"how do we minimise\nannoyance to people deploying from checkouts intentionally\".\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "•   indirect\n\n•   multidimensional\n\n•   bareword::filehandles\n",
                "subsections": []
            },
            "COMMUNITY AND SUPPORT": {
                "content": "",
                "subsections": [
                    {
                        "name": "IRC channel",
                        "content": "irc.perl.org #toolchain\n\n(or bug 'mst' in query on there or freenode)\n"
                    },
                    {
                        "name": "Git repository",
                        "content": "Gitweb is on http://git.shadowcat.co.uk/ and the clone URL is:\n\ngit clone git://git.shadowcat.co.uk/p5sagit/strictures.git\n\nThe web interface to the repository is at:\n\nhttp://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git\n"
                    }
                ]
            },
            "AUTHOR": {
                "content": "mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>\n",
                "subsections": []
            },
            "CONTRIBUTORS": {
                "content": "Karen Etheridge (cpan:ETHER) <ether@cpan.org>\n\nMithaldu - Christian Walde (cpan:MITHALDU) <walde.christian@gmail.com>\n\nhaarg - Graham Knop (cpan:HAARG) <haarg@haarg.org>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) 2010 the strictures \"AUTHOR\" and \"CONTRIBUTORS\" as listed above.\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "This library is free software and may be distributed under the same terms as perl itself.\n\n\n\nperl v5.28.1                                 2019-07-15                              strictures(3pm)",
                "subsections": []
            }
        }
    }
}