{
    "mode": "perldoc",
    "parameter": "B::Concise",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/B%3A%3AConcise/json",
    "generated": "2026-06-09T20:23:04Z",
    "synopsis": "perl -MO=Concise[,OPTIONS] foo.pl\nuse B::Concise qw(setstyle addcallback);",
    "sections": {
        "NAME": {
            "content": "B::Concise - Walk Perl syntax tree, printing concise info about ops\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "perl -MO=Concise[,OPTIONS] foo.pl\n\nuse B::Concise qw(setstyle addcallback);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This compiler backend prints the internal OPs of a Perl program's syntax tree in one of several\nspace-efficient text formats suitable for debugging the inner workings of perl or other compiler\nbackends. It can print OPs in the order they appear in the OP tree, in the order they will\nexecute, or in a text approximation to their tree structure, and the format of the information\ndisplayed is customizable. Its function is similar to that of perl's -Dx debugging flag or the\nB::Terse module, but it is more sophisticated and flexible.\n",
            "subsections": []
        },
        "EXAMPLE": {
            "content": "Here's two outputs (or 'renderings'), using the -exec and -basic (i.e. default) formatting\nconventions on the same code snippet.\n\n% perl -MO=Concise,-exec -e '$a = $b + 42'\n1  <0> enter\n2  <;> nextstate(main 1 -e:1) v\n3  <#> gvsv[*b] s\n4  <$> const[IV 42] s\n*  5  <2> add[t3] sK/2\n6  <#> gvsv[*a] s\n7  <2> sassign vKS/2\n8  <@> leave[1 ref] vKP/REFC\n\nIn this -exec rendering, each opcode is executed in the order shown. The add opcode, marked with\n'*', is discussed in more detail.\n\nThe 1st column is the op's sequence number, starting at 1, and is displayed in base 36 by\ndefault. Here they're purely linear; the sequences are very helpful when looking at code with\nloops and branches.\n\nThe symbol between angle brackets indicates the op's type, for example; <2> is a BINOP, <@> a\nLISTOP, and <#> is a PADOP, which is used in threaded perls. (see \"OP class abbreviations\").\n\nThe opname, as in 'add[t1]', may be followed by op-specific information in parentheses or\nbrackets (ex '[t1]').\n\nThe op-flags (ex 'sK/2') are described in (\"OP flags abbreviations\").\n\n% perl -MO=Concise -e '$a = $b + 42'\n8  <@> leave[1 ref] vKP/REFC ->(end)\n1     <0> enter ->2\n2     <;> nextstate(main 1 -e:1) v ->3\n7     <2> sassign vKS/2 ->8\n*  5        <2> add[t1] sK/2 ->6\n-           <1> ex-rv2sv sK/1 ->4\n3              <$> gvsv(*b) s ->4\n4           <$> const(IV 42) s ->5\n-        <1> ex-rv2sv sKRM*/1 ->7\n6           <$> gvsv(*a) s ->7\n\nThe default rendering is top-down, so they're not in execution order. This form reflects the way\nthe stack is used to parse and evaluate expressions; the add operates on the two terms below it\nin the tree.\n\nNullops appear as \"ex-opname\", where *opname* is an op that has been optimized away by perl.\nThey're displayed with a sequence-number of '-', because they are not executed (they don't\nappear in previous example), they're printed here because they reflect the parse.\n\nThe arrow points to the sequence number of the next op; they're not displayed in -exec mode, for\nobvious reasons.\n\nNote that because this rendering was done on a non-threaded perl, the PADOPs in the previous\nexamples are now SVOPs, and some (but not all) of the square brackets have been replaced by\nround ones. This is a subtle feature to provide some visual distinction between renderings on\nthreaded and un-threaded perls.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Arguments that don't start with a hyphen are taken to be the names of subroutines or formats to\nrender; if no such functions are specified, the main body of the program (outside any\nsubroutines, and not including use'd or require'd files) is rendered. Passing \"BEGIN\",\n\"UNITCHECK\", \"CHECK\", \"INIT\", or \"END\" will cause all of the corresponding special blocks to be\nprinted. Arguments must follow options.\n\nOptions affect how things are rendered (ie printed). They're presented here by their visual\neffect, 1st being strongest. They're grouped according to how they interrelate; within each\ngroup the options are mutually exclusive (unless otherwise stated).\n",
            "subsections": [
                {
                    "name": "Options for Opcode Ordering",
                    "content": "These options control the 'vertical display' of opcodes. The display 'order' is also called\n'mode' elsewhere in this document.\n"
                },
                {
                    "name": "-basic",
                    "content": "Print OPs in the order they appear in the OP tree (a preorder traversal, starting at the\nroot). The indentation of each OP shows its level in the tree, and the '->' at the end of\nthe line indicates the next opcode in execution order. This mode is the default, so the flag\nis included simply for completeness.\n"
                },
                {
                    "name": "-exec",
                    "content": "Print OPs in the order they would normally execute (for the majority of constructs this is a\npostorder traversal of the tree, ending at the root). In most cases the OP that usually\nfollows a given OP will appear directly below it; alternate paths are shown by indentation.\nIn cases like loops when control jumps out of a linear path, a 'goto' line is generated.\n"
                },
                {
                    "name": "-tree",
                    "content": "Print OPs in a text approximation of a tree, with the root of the tree at the left and\n'left-to-right' order of children transformed into 'top-to-bottom'. Because this mode grows\nboth to the right and down, it isn't suitable for large programs (unless you have a very\nwide terminal).\n"
                },
                {
                    "name": "Options for Line-Style",
                    "content": "These options select the line-style (or just style) used to render each opcode, and dictates\nwhat info is actually printed into each line.\n"
                },
                {
                    "name": "-concise",
                    "content": "Use the author's favorite set of formatting conventions. This is the default, of course.\n"
                },
                {
                    "name": "-terse",
                    "content": "Use formatting conventions that emulate the output of B::Terse. The basic mode is almost\nindistinguishable from the real B::Terse, and the exec mode looks very similar, but is in a\nmore logical order and lacks curly brackets. B::Terse doesn't have a tree mode, so the tree\nmode is only vaguely reminiscent of B::Terse.\n"
                },
                {
                    "name": "-linenoise",
                    "content": "Use formatting conventions in which the name of each OP, rather than being written out in\nfull, is represented by a one- or two-character abbreviation. This is mainly a joke.\n"
                },
                {
                    "name": "-debug",
                    "content": "Use formatting conventions reminiscent of CPAN module B::Debug; these aren't very concise at\nall.\n"
                },
                {
                    "name": "-env",
                    "content": "Use formatting conventions read from the environment variables \"BCONCISEFORMAT\",\n\"BCONCISEGOTOFORMAT\", and \"BCONCISETREEFORMAT\".\n"
                },
                {
                    "name": "Options for tree-specific formatting",
                    "content": ""
                },
                {
                    "name": "-compact",
                    "content": "Use a tree format in which the minimum amount of space is used for the lines connecting\nnodes (one character in most cases). This squeezes out a few precious columns of screen real\nestate.\n"
                },
                {
                    "name": "-loose",
                    "content": "Use a tree format that uses longer edges to separate OP nodes. This format tends to look\nbetter than the compact one, especially in ASCII, and is the default.\n\n-vt Use tree connecting characters drawn from the VT100 line-drawing set. This looks better if\nyour terminal supports it.\n"
                },
                {
                    "name": "-ascii",
                    "content": "Draw the tree with standard ASCII characters like \"+\" and \"|\". These don't look as clean as\nthe VT100 characters, but they'll work with almost any terminal (or the horizontal scrolling\nmode of less(1)) and are suitable for text documentation or email. This is the default.\n\nThese are pairwise exclusive, i.e. compact or loose, vt or ascii.\n"
                },
                {
                    "name": "Options controlling sequence numbering",
                    "content": "-base*n*\nPrint OP sequence numbers in base *n*. If *n* is greater than 10, the digit for 11 will be\n'a', and so on. If *n* is greater than 36, the digit for 37 will be 'A', and so on until 62.\nValues greater than 62 are not currently supported. The default is 36.\n"
                },
                {
                    "name": "-bigendian",
                    "content": "Print sequence numbers with the most significant digit first. This is the usual convention\nfor Arabic numerals, and the default.\n"
                },
                {
                    "name": "-littleendian",
                    "content": "Print sequence numbers with the least significant digit first. This is obviously mutually\nexclusive with bigendian.\n"
                },
                {
                    "name": "Other options",
                    "content": ""
                },
                {
                    "name": "-src",
                    "content": "With this option, the rendering of each statement (starting with the nextstate OP) will be\npreceded by the 1st line of source code that generates it. For example:\n\n1  <0> enter\n# 1: my $i;\n2  <;> nextstate(main 1 junk.pl:1) v:{\n3  <0> padsv[$i:1,10] vM/LVINTRO\n# 3: for $i (0..9) {\n4  <;> nextstate(main 3 junk.pl:3) v:{\n5  <0> pushmark s\n6  <$> const[IV 0] s\n7  <$> const[IV 9] s\n8  <{> enteriter(next->j last->m redo->9)[$i:1,10] lKS\nk  <0> iter s\nl  <|> and(other->9) vK/1\n# 4:     print \"line \";\n9      <;> nextstate(main 2 junk.pl:4) v\na      <0> pushmark s\nb      <$> const[PV \"line \"] s\nc      <@> print vK\n# 5:     print \"$i\\n\";\n...\n\n-stash=\"somepackage\"\nWith this, \"somepackage\" will be required, then the stash is inspected, and each function is\nrendered.\n\nThe following options are pairwise exclusive.\n"
                },
                {
                    "name": "-main",
                    "content": "Include the main program in the output, even if subroutines were also specified. This\nrendering is normally suppressed when a subroutine name or reference is given.\n"
                },
                {
                    "name": "-nomain",
                    "content": "This restores the default behavior after you've changed it with '-main' (it's not normally\nneeded). If no subroutine name/ref is given, main is rendered, regardless of this flag.\n"
                },
                {
                    "name": "-nobanner",
                    "content": "Renderings usually include a banner line identifying the function name or stringified\nsubref. This suppresses the printing of the banner.\n\nTBC: Remove the stringified coderef; while it provides a 'cookie' for each function\nrendered, the cookies used should be 1,2,3.. not a random hex-address. It also complicates\nstring comparison of two different trees.\n"
                },
                {
                    "name": "-banner",
                    "content": "restores default banner behavior.\n\n-banneris => subref\nTBC: a hookpoint (and an option to set it) for a user-supplied function to produce a banner\nappropriate for users needs. It's not ideal, because the rendering-state variables, which\nare a natural candidate for use in concise.t, are unavailable to the user.\n"
                },
                {
                    "name": "Option Stickiness",
                    "content": "If you invoke Concise more than once in a program, you should know that the options are\n'sticky'. This means that the options you provide in the first call will be remembered for the\n2nd call, unless you re-specify or change them.\n"
                }
            ]
        },
        "ABBREVIATIONS": {
            "content": "The concise style uses symbols to convey maximum info with minimal clutter (like hex addresses).\nWith just a little practice, you can start to see the flowers, not just the branches, in the\ntrees.\n\nOP class abbreviations\nThese symbols appear before the op-name, and indicate the B:: namespace that represents the ops\nin your Perl code.\n\n0      OP (aka BASEOP)  An OP with no children\n1      UNOP             An OP with one child\n+      UNOPAUX         A UNOP with auxillary fields\n2      BINOP            An OP with two children\n|      LOGOP            A control branch OP\n@      LISTOP           An OP that could have lots of children\n/      PMOP             An OP with a regular expression\n$      SVOP             An OP with an SV\n\"      PVOP             An OP with a string\n{      LOOP             An OP that holds pointers for a loop\n;      COP              An OP that marks the start of a statement\n#      PADOP            An OP with a GV on the pad\n.      METHOP           An OP with method call info\n\nOP flags abbreviations\nOP flags are either public or private. The public flags alter the behavior of each opcode in\nconsistent ways, and are represented by 0 or more single characters.\n\nv      OPfWANTVOID    Want nothing (void context)\ns      OPfWANTSCALAR  Want single value (scalar context)\nl      OPfWANTLIST    Want list of any length (list context)\nWant is unknown\nK      OPfKIDS         There is a firstborn child.\nP      OPfPARENS       This operator was parenthesized.\n(Or block needs explicit scope entry.)\nR      OPfREF          Certified reference.\n(Return container, not containee).\nM      OPfMOD          Will modify (lvalue).\nS      OPfSTACKED      Some arg is arriving on the stack.\n*      OPfSPECIAL      Do something weird for this op (see op.h)\n\nPrivate flags, if any are set for an opcode, are displayed after a '/'\n\n8  <@> leave[1 ref] vKP/REFC ->(end)\n7     <2> sassign vKS/2 ->8\n\nThey're opcode specific, and occur less often than the public ones, so they're represented by\nshort mnemonics instead of single-chars; see B::Opprivate and regen/opprivate for more\ndetails.\n",
            "subsections": []
        },
        "FORMATTING SPECIFICATIONS": {
            "content": "For each line-style ('concise', 'terse', 'linenoise', etc.) there are 3 format-specs which\ncontrol how OPs are rendered.\n\nThe first is the 'default' format, which is used in both basic and exec modes to print all\nopcodes. The 2nd, goto-format, is used in exec mode when branches are encountered. They're not\nreal opcodes, and are inserted to look like a closing curly brace. The tree-format is tree\nspecific.\n\nWhen a line is rendered, the correct format-spec is copied and scanned for the following items;\ndata is substituted in, and other manipulations like basic indenting are done, for each opcode\nrendered.\n\nThere are 3 kinds of items that may be populated; special patterns, #vars, and literal text,\nwhich is copied verbatim. (Yes, it's a set of s///g steps.)\n",
            "subsections": [
                {
                    "name": "Special Patterns",
                    "content": "These items are the primitives used to perform indenting, and to select text from amongst\nalternatives.\n\n(x(*exectext*;*basictext*)x)\nGenerates *exectext* in exec mode, or *basictext* in basic mode.\n\n(*(*text*)*)\nGenerates one copy of *text* for each indentation level.\n\n(*(*text1*;*text2*)*)\nGenerates one fewer copies of *text1* than the indentation level, followed by one copy of\n*text2* if the indentation level is more than 0.\n\n(?(*text1*#*varText2*)?)\nIf the value of *var* is true (not empty or zero), generates the value of *var* surrounded\nby *text1* and *Text2*, otherwise nothing.\n\n~   Any number of tildes and surrounding whitespace will be collapsed to a single space.\n\n# Variables\nThese #vars represent opcode properties that you may want as part of your rendering. The '#' is\nintended as a private sigil; a #var's value is interpolated into the style-line, much like \"read\n$this\".\n\nThese vars take 3 forms:\n\n#*var*\nA property named 'var' is assumed to exist for the opcodes, and is interpolated into the\nrendering.\n\n#*varN*\nGenerates the value of *var*, left justified to fill *N* spaces. Note that this means while\nyou can have properties 'foo' and 'foo2', you cannot render 'foo2', but you could with\n'foo2a'. You would be wise not to rely on this behavior going forward ;-)\n\n#*Var*\nThis ucfirst form of #var generates a tag-value form of itself for display; it converts\n'#Var' into a 'Var => #var' style, which is then handled as described above. (Imp-note:\n#Vars cannot be used for conditional-fills, because the => #var transform is done after the\ncheck for #Var's value).\n\nThe following variables are 'defined' by B::Concise; when they are used in a style, their\nrespective values are plugged into the rendering of each opcode.\n\nOnly some of these are used by the standard styles, the others are provided for you to delve\ninto optree mechanics, should you wish to add a new style (see \"addstyle\" below) that uses\nthem. You can also add new ones using \"addcallback\".\n\n#addr\nThe address of the OP, in hexadecimal.\n\n#arg\nThe OP-specific information of the OP (such as the SV for an SVOP, the non-local exit\npointers for a LOOP, etc.) enclosed in parentheses.\n\n#class\nThe B-determined class of the OP, in all caps.\n\n#classsym\nA single symbol abbreviating the class of the OP.\n\n#coplabel\nThe label of the statement or block the OP is the start of, if any.\n\n#exname\nThe name of the OP, or 'ex-foo' if the OP is a null that used to be a foo.\n\n#extarg\nThe target of the OP, or nothing for a nulled OP.\n\n#firstaddr\nThe address of the OP's first child, in hexadecimal.\n\n#flags\nThe OP's flags, abbreviated as a series of symbols.\n\n#flagval\nThe numeric value of the OP's flags.\n\n#hints\nThe COP's hint flags, rendered with abbreviated names if possible. An empty string if this\nis not a COP. Here are the symbols used:\n\n$ strict refs\n& strict subs\n* strict vars\nx$ explicit use/no strict refs\nx& explicit use/no strict subs\nx* explicit use/no strict vars\ni integers\nl locale\nb bytes\n{ block scope\n% localise %^H\n< open in\n> open out\nI overload int\nF overload float\nB overload binary\nS overload string\nR overload re\nT taint\nE eval\nX filetest access\nU utf-8\n\nus      use feature 'unicodestrings'\nfea=NNN feature bundle number\n\n#hintsval\nThe numeric value of the COP's hint flags, or an empty string if this is not a COP.\n\n#hyphseq\nThe sequence number of the OP, or a hyphen if it doesn't have one.\n\n#label\n'NEXT', 'LAST', or 'REDO' if the OP is a target of one of those in exec mode, or empty\notherwise.\n\n#lastaddr\nThe address of the OP's last child, in hexadecimal.\n\n#name\nThe OP's name.\n\n#NAME\nThe OP's name, in all caps.\n\n#next\nThe sequence number of the OP's next OP.\n\n#nextaddr\nThe address of the OP's next OP, in hexadecimal.\n\n#noise\nA one- or two-character abbreviation for the OP's name.\n\n#private\nThe OP's private flags, rendered with abbreviated names if possible.\n\n#privval\nThe numeric value of the OP's private flags.\n\n#seq\nThe sequence number of the OP. Note that this is a sequence number generated by B::Concise.\n\n#opt\nWhether or not the op has been optimized by the peephole optimizer.\n\n#sibaddr\nThe address of the OP's next youngest sibling, in hexadecimal.\n\n#svaddr\nThe address of the OP's SV, if it has an SV, in hexadecimal.\n\n#svclass\nThe class of the OP's SV, if it has one, in all caps (e.g., 'IV').\n\n#svval\nThe value of the OP's SV, if it has one, in a short human-readable format.\n\n#targ\nThe numeric value of the OP's targ.\n\n#targarg\nThe name of the variable the OP's targ refers to, if any, otherwise the letter t followed by\nthe OP's targ in decimal.\n\n#targarglife\nSame as #targarg, but followed by the COP sequence numbers that delimit the variable's\nlifetime (or 'end' for a variable in an open scope) for a variable.\n\n#typenum\nThe numeric value of the OP's type, in decimal.\n"
                }
            ]
        },
        "One-Liner Command tips": {
            "content": "perl -MO=Concise,bar foo.pl\nRenders only bar() from foo.pl. To see main, drop the ',bar'. To see both, add ',-main'\n\nperl -MDigest::MD5=md5 -MO=Concise,md5 -e1\nIdentifies md5 as an XS function. The export is needed so that BC can find it in main.\n\nperl -MPOSIX -MO=Concise,POSIXARGMAX -e1\nIdentifies POSIXARGMAX as a constant sub, optimized to an IV. Although POSIX isn't\nentirely consistent across platforms, this is likely to be present in virtually all of them.\n\nperl -MPOSIX -MO=Concise,a -e 'print POSIXSAVEDIDS'\nThis renders a print statement, which includes a call to the function. It's identical to\nrendering a file with a use call and that single statement, except for the filename which\nappears in the nextstate ops.\n\nperl -MPOSIX -MO=Concise,a -e 'sub a{POSIXSAVEDIDS}'\nThis is very similar to previous, only the first two ops differ. This subroutine rendering\nis more representative, insofar as a single main program will have many subs.\n\nperl -MB::Concise -e 'B::Concise::compile(\"-exec\",\"-src\", \\%B::Concise::)->()'\nThis renders all functions in the B::Concise package with the source lines. It eschews the O\nframework so that the stashref can be passed directly to B::Concise::compile(). See -stash\noption for a more convenient way to render a package.\n",
            "subsections": []
        },
        "Using B::Concise outside of the O framework": {
            "content": "The common (and original) usage of B::Concise was for command-line renderings of simple code, as\ngiven in EXAMPLE. But you can also use B::Concise from your code, and call compile() directly,\nand repeatedly. By doing so, you can avoid the compile-time only operation of O.pm, and even use\nthe debugger to step through B::Concise::compile() itself.\n\nOnce you're doing this, you may alter Concise output by adding new rendering styles, and by\noptionally adding callback routines which populate new variables, if such were referenced from\nthose (just added) styles.\n",
            "subsections": [
                {
                    "name": "Example: Altering Concise Renderings",
                    "content": "use B::Concise qw(setstyle addcallback);\naddstyle($yourStyleName => $defaultfmt, $gotofmt, $treefmt);\naddcallback\n( sub {\nmy ($h, $op, $format, $level, $stylename) = @;\n$h->{variable} = somefunc($op);\n});\n$walker = B::Concise::compile(@options,@subnames,@subrefs);\n$walker->();\n\nsetstyle()\nsetstyle accepts 3 arguments, and updates the three format-specs comprising a line-style\n(basic-exec, goto, tree). It has one minor drawback though; it doesn't register the style under\na new name. This can become an issue if you render more than once and switch styles. Thus you\nmay prefer to use addstyle() and/or setstylestandard() instead.\n\nsetstylestandard($name)\nThis restores one of the standard line-styles: \"terse\", \"concise\", \"linenoise\", \"debug\", \"env\",\ninto effect. It also accepts style names previously defined with addstyle().\n\naddstyle ()\nThis subroutine accepts a new style name and three style arguments as above, and creates,\nregisters, and selects the newly named style. It is an error to re-add a style; call"
                },
                {
                    "name": "set_style_standard",
                    "content": "addcallback ()\nIf your newly minted styles refer to any new #variables, you'll need to define a callback\nsubroutine that will populate (or modify) those variables. They are then available for use in\nthe style you've chosen.\n\nThe callbacks are called for each opcode visited by Concise, in the same order as they are\nadded. Each subroutine is passed five parameters.\n\n1. A hashref, containing the variable names and values which are\npopulated into the report-line for the op\n2. the op, as a B<B::OP> object\n3. a reference to the format string\n4. the formatting (indent) level\n5. the selected stylename\n\nTo define your own variables, simply add them to the hash, or change existing values if you need\nto. The level and format are passed in as references to scalars, but it is unlikely that they\nwill need to be changed or even used.\n\nRunning B::Concise::compile()\ncompile accepts options as described above in \"OPTIONS\", and arguments, which are either\ncoderefs, or subroutine names.\n\nIt constructs and returns a $treewalker coderef, which when invoked, traverses, or walks, and\nrenders the optrees of the given arguments to STDOUT. You can reuse this, and can change the\nrendering style used each time; thereafter the coderef renders in the new style.\n\nwalkoutput lets you change the print destination from STDOUT to another open filehandle, or\ninto a string passed as a ref (unless you've built perl with -Uuseperlio).\n\nmy $walker = B::Concise::compile('-terse','aFuncName', \\&aSubRef); # 1\nwalkoutput(\\my $buf);\n$walker->();                          # 1 renders -terse\nsetstylestandard('concise');        # 2\n$walker->();                          # 2 renders -concise\n$walker->(@new);                      # 3 renders whatever\nprint \"3 different renderings: terse, concise, and @new: $buf\\n\";\n\nWhen $walker is called, it traverses the subroutines supplied when it was created, and renders\nthem using the current style. You can change the style afterwards in several different ways:\n\n1. call C<compile>, altering style or mode/order\n2. call C<setstylestandard>\n3. call $walker, passing @new options\n\nPassing new options to the $walker is the easiest way to change amongst any pre-defined styles\n(the ones you add are automatically recognized as options), and is the only way to alter\nrendering order without calling compile again. Note however that rendering state is still shared\namongst multiple $walker objects, so they must still be used in a coordinated manner.\n\nB::Concise::resetsequence()\nThis function (not exported) lets you reset the sequence numbers (note that they're numbered\narbitrarily, their goal being to be human readable). Its purpose is mostly to support testing,\ni.e. to compare the concise output from two identical anonymous subroutines (but different\ninstances). Without the reset, B::Concise, seeing that they're separate optrees, generates\ndifferent sequence numbers in the output.\n"
                },
                {
                    "name": "Errors",
                    "content": "Errors in rendering (non-existent function-name, non-existent coderef) are written to the\nSTDOUT, or wherever you've set it via walkoutput().\n\nErrors using the various *style* calls, and bad args to walkoutput(), result in die(). Use an\neval if you wish to catch these errors and continue processing.\n"
                }
            ]
        },
        "AUTHOR": {
            "content": "Stephen McCamant, <smcc@CSUA.Berkeley.EDU>.\n",
            "subsections": []
        }
    },
    "summary": "B::Concise - Walk Perl syntax tree, printing concise info about ops",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print OPs in the order they appear in the OP tree (a preorder traversal, starting at the root). The indentation of each OP shows its level in the tree, and the '->' at the end of the line indicates the next opcode in execution order. This mode is the default, so the flag is included simply for completeness."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print OPs in the order they would normally execute (for the majority of constructs this is a postorder traversal of the tree, ending at the root). In most cases the OP that usually follows a given OP will appear directly below it; alternate paths are shown by indentation. In cases like loops when control jumps out of a linear path, a 'goto' line is generated."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print OPs in a text approximation of a tree, with the root of the tree at the left and 'left-to-right' order of children transformed into 'top-to-bottom'. Because this mode grows both to the right and down, it isn't suitable for large programs (unless you have a very wide terminal)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use the author's favorite set of formatting conventions. This is the default, of course."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use formatting conventions that emulate the output of B::Terse. The basic mode is almost indistinguishable from the real B::Terse, and the exec mode looks very similar, but is in a more logical order and lacks curly brackets. B::Terse doesn't have a tree mode, so the tree mode is only vaguely reminiscent of B::Terse."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use formatting conventions in which the name of each OP, rather than being written out in full, is represented by a one- or two-character abbreviation. This is mainly a joke."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use formatting conventions reminiscent of CPAN module B::Debug; these aren't very concise at all."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use formatting conventions read from the environment variables \"BCONCISEFORMAT\", \"BCONCISEGOTOFORMAT\", and \"BCONCISETREEFORMAT\"."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use a tree format in which the minimum amount of space is used for the lines connecting nodes (one character in most cases). This squeezes out a few precious columns of screen real estate."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use a tree format that uses longer edges to separate OP nodes. This format tends to look better than the compact one, especially in ASCII, and is the default. -vt Use tree connecting characters drawn from the VT100 line-drawing set. This looks better if your terminal supports it."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Draw the tree with standard ASCII characters like \"+\" and \"|\". These don't look as clean as the VT100 characters, but they'll work with almost any terminal (or the horizontal scrolling mode of less(1)) and are suitable for text documentation or email. This is the default. These are pairwise exclusive, i.e. compact or loose, vt or ascii."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print sequence numbers with the most significant digit first. This is the usual convention for Arabic numerals, and the default."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print sequence numbers with the least significant digit first. This is obviously mutually exclusive with bigendian."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "With this option, the rendering of each statement (starting with the nextstate OP) will be preceded by the 1st line of source code that generates it. For example: 1 <0> enter # 1: my $i; 2 <;> nextstate(main 1 junk.pl:1) v:{ 3 <0> padsv[$i:1,10] vM/LVINTRO # 3: for $i (0..9) { 4 <;> nextstate(main 3 junk.pl:3) v:{ 5 <0> pushmark s 6 <$> const[IV 0] s 7 <$> const[IV 9] s 8 <{> enteriter(next->j last->m redo->9)[$i:1,10] lKS k <0> iter s l <|> and(other->9) vK/1 # 4: print \"line \"; 9 <;> nextstate(main 2 junk.pl:4) v a <0> pushmark s b <$> const[PV \"line \"] s c <@> print vK # 5: print \"$i\\n\"; ... -stash=\"somepackage\" With this, \"somepackage\" will be required, then the stash is inspected, and each function is rendered. The following options are pairwise exclusive."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Include the main program in the output, even if subroutines were also specified. This rendering is normally suppressed when a subroutine name or reference is given."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This restores the default behavior after you've changed it with '-main' (it's not normally needed). If no subroutine name/ref is given, main is rendered, regardless of this flag."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Renderings usually include a banner line identifying the function name or stringified subref. This suppresses the printing of the banner. TBC: Remove the stringified coderef; while it provides a 'cookie' for each function rendered, the cookies used should be 1,2,3.. not a random hex-address. It also complicates string comparison of two different trees."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "restores default banner behavior. -banneris => subref TBC: a hookpoint (and an option to set it) for a user-supplied function to produce a banner appropriate for users needs. It's not ideal, because the rendering-state variables, which are a natural candidate for use in concise.t, are unavailable to the user."
        }
    ],
    "examples": [
        "Here's two outputs (or 'renderings'), using the -exec and -basic (i.e. default) formatting",
        "conventions on the same code snippet.",
        "% perl -MO=Concise,-exec -e '$a = $b + 42'",
        "1  <0> enter",
        "2  <;> nextstate(main 1 -e:1) v",
        "3  <#> gvsv[*b] s",
        "4  <$> const[IV 42] s",
        "*  5  <2> add[t3] sK/2",
        "6  <#> gvsv[*a] s",
        "7  <2> sassign vKS/2",
        "8  <@> leave[1 ref] vKP/REFC",
        "In this -exec rendering, each opcode is executed in the order shown. The add opcode, marked with",
        "'*', is discussed in more detail.",
        "The 1st column is the op's sequence number, starting at 1, and is displayed in base 36 by",
        "default. Here they're purely linear; the sequences are very helpful when looking at code with",
        "loops and branches.",
        "The symbol between angle brackets indicates the op's type, for example; <2> is a BINOP, <@> a",
        "LISTOP, and <#> is a PADOP, which is used in threaded perls. (see \"OP class abbreviations\").",
        "The opname, as in 'add[t1]', may be followed by op-specific information in parentheses or",
        "brackets (ex '[t1]').",
        "The op-flags (ex 'sK/2') are described in (\"OP flags abbreviations\").",
        "% perl -MO=Concise -e '$a = $b + 42'",
        "8  <@> leave[1 ref] vKP/REFC ->(end)",
        "1     <0> enter ->2",
        "2     <;> nextstate(main 1 -e:1) v ->3",
        "7     <2> sassign vKS/2 ->8",
        "*  5        <2> add[t1] sK/2 ->6",
        "-           <1> ex-rv2sv sK/1 ->4",
        "3              <$> gvsv(*b) s ->4",
        "4           <$> const(IV 42) s ->5",
        "-        <1> ex-rv2sv sKRM*/1 ->7",
        "6           <$> gvsv(*a) s ->7",
        "The default rendering is top-down, so they're not in execution order. This form reflects the way",
        "the stack is used to parse and evaluate expressions; the add operates on the two terms below it",
        "in the tree.",
        "Nullops appear as \"ex-opname\", where *opname* is an op that has been optimized away by perl.",
        "They're displayed with a sequence-number of '-', because they are not executed (they don't",
        "appear in previous example), they're printed here because they reflect the parse.",
        "The arrow points to the sequence number of the next op; they're not displayed in -exec mode, for",
        "obvious reasons.",
        "Note that because this rendering was done on a non-threaded perl, the PADOPs in the previous",
        "examples are now SVOPs, and some (but not all) of the square brackets have been replaced by",
        "round ones. This is a subtle feature to provide some visual distinction between renderings on",
        "threaded and un-threaded perls."
    ],
    "see_also": []
}