{
    "content": [
        {
            "type": "text",
            "text": "# O (man)\n\n## NAME\n\nO - Generic interface to Perl Compiler backends\n\n## SYNOPSIS\n\nperl -MO=[-q,]Backend[,OPTIONS] foo.pl\n\n## DESCRIPTION\n\nThis is the module that is used as a frontend to the Perl Compiler.\n\n## TLDR\n\n> Orbiton, a simple configuration-free text editor.\n\n- Open a file in editor:\n  `o {{path/to/file}}`\n- Open a file as read-only:\n  `o {{-m|-monitor}} {{path/to/file}}`\n- Save the file:\n  `<Ctrl s>`\n- Quit Orbiton:\n  `<Ctrl q>`\n- Display help:\n  `o {{-h|--help}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CONVENTIONS**\n- **IMPLEMENTATION**\n- **BUGS**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "O",
        "section": "",
        "mode": "man",
        "summary": "O - Generic interface to Perl Compiler backends",
        "synopsis": "perl -MO=[-q,]Backend[,OPTIONS] foo.pl",
        "tldr_summary": "Orbiton, a simple configuration-free text editor.",
        "tldr_examples": [
            {
                "description": "Open a file in editor",
                "command": "o {{path/to/file}}"
            },
            {
                "description": "Open a file as read-only",
                "command": "o {{-m|-monitor}} {{path/to/file}}"
            },
            {
                "description": "Save the file",
                "command": "<Ctrl s>"
            },
            {
                "description": "Quit Orbiton",
                "command": "<Ctrl q>"
            },
            {
                "description": "Display help",
                "command": "o {{-h|--help}}"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "CONVENTIONS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "IMPLEMENTATION",
                "lines": 26,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "O - Generic interface to Perl Compiler backends\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "perl -MO=[-q,]Backend[,OPTIONS] foo.pl\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This is the module that is used as a frontend to the Perl Compiler.\n\nIf you pass the \"-q\" option to the module, then the STDOUT filehandle will be redirected into\nthe variable $O::BEGINoutput during compilation.  This has the effect that any output\nprinted to STDOUT by BEGIN blocks or use'd modules will be stored in this variable rather\nthan printed. It's useful with those backends which produce output themselves (\"Deparse\",\n\"Concise\" etc), so that their output is not confused with that generated by the code being\ncompiled.\n\nThe \"-qq\" option behaves like \"-q\", except that it also closes STDERR after deparsing has\nfinished. This suppresses the \"Syntax OK\" message normally produced by perl.\n",
                "subsections": []
            },
            "CONVENTIONS": {
                "content": "Most compiler backends use the following conventions: OPTIONS consists of a comma-separated\nlist of words (no white-space).  The \"-v\" option usually puts the backend into verbose mode.\nThe \"-ofile\" option generates output to file instead of stdout. The \"-D\" option followed by\nvarious letters turns on various internal debugging flags. See the documentation for the\ndesired backend (named \"B::Backend\" for the example above) to find out about that backend.\n",
                "subsections": []
            },
            "IMPLEMENTATION": {
                "content": "This section is only necessary for those who want to write a compiler backend module that can\nbe used via this module.\n\nThe command-line mentioned in the SYNOPSIS section corresponds to the Perl code\n\nuse O (\"Backend\", OPTIONS);\n\nThe \"O::import\" function loads the appropriate \"B::Backend\" module and calls its \"compile\"\nfunction, passing it OPTIONS. That function is expected to return a sub reference which we'll\ncall CALLBACK. Next, the \"compile-only\" flag is switched on (equivalent to the command-line\noption \"-c\") and a CHECK block is registered which calls CALLBACK. Thus the main Perl program\nmentioned on the command-line is read in, parsed and compiled into internal syntax tree form.\nSince the \"-c\" flag is set, the program does not start running (excepting BEGIN blocks of\ncourse) but the CALLBACK function registered by the compiler backend is called.\n\nIn summary, a compiler backend module should be called \"B::Foo\" for some foo and live in the\nappropriate directory for that name.  It should define a function called \"compile\". When the\nuser types\n\nperl -MO=Foo,OPTIONS foo.pl\n\nthat function is called and is passed those OPTIONS (split on commas). It should return a sub\nref to the main compilation function.  After the user's program is loaded and parsed, that\nreturned sub ref is invoked which can then go ahead and do the compilation, usually by making\nuse of the \"B\" module's functionality.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "The \"-q\" and \"-qq\" options don't work correctly if perl isn't compiled with PerlIO support :\nSTDOUT will be closed instead of being redirected to $O::BEGINoutput.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Malcolm Beattie, \"mbeattie@sable.ox.ac.uk\"\n\n\n\nperl v5.34.0                                 2025-07-25                                     O(3perl)",
                "subsections": []
            }
        }
    }
}