File: Concise.html

package info (click to toggle)
perl-doc-html 5.26.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 39,400 kB
  • sloc: xml: 36; makefile: 7
file content (993 lines) | stat: -rw-r--r-- 55,806 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>B::Concise - perldoc.perl.org</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta http-equiv="Content-Language" content="en-gb">
  <link rel="search" type="application/opensearchdescription+xml" title="Search perldoc.perl.org" href="/static/search.xml"/>
  <link href="../static/css-20100830.css" rel="stylesheet" rev="stylesheet" type="text/css" media="screen">
  <link href="../static/exploreperl.css" rel="stylesheet" rev="stylesheet" type="text/css">
</head>

<body onLoad="perldoc.startup();" onPageShow="if (event.persisted) perldoc.startup();">
    <div id="page">
      
      <div id="header">
	<div id="homepage_link">
	  <a href="../index.html"></a>
	</div>
	<div id="strapline">
	  Perl Programming Documentation
	</div>
	<div id="download_link" class="download">
	  <a href="http://www.perl.org/get.html">Download Perl</a>
	</div>
	<div id="explore_link" class="download">
	  <a id="explore_anchor" href="#">Explore</a>
	</div>
      </div>
      
      <div id="body">
        <div id="left_column">
          <div class="side_group">
            
	    <div class="side_panel doc_panel">
              <p>Manual</p>
              <ul>
                <li><a href="../index-overview.html">Overview</a>
                <li><a href="../index-tutorials.html">Tutorials</a>
                <li><a href="../index-faq.html">FAQs</a>
                <li><a href="../index-history.html">History / Changes</a>
                <li><a href="../index-licence.html">License</a>
              </ul>
            </div>
            <div class="side_panel doc_panel">
              <p>Reference</p>
              <ul>
                <li><a href="../index-language.html">Language</a>
                <li><a href="../index-functions.html">Functions</a>
                <li><a href="../perlop.html">Operators</a>
                <li><a href="../perlvar.html">Special Variables</a>
                <li><a href="../index-pragmas.html">Pragmas</a>
                <li><a href="../index-utilities.html">Utilities</a>
                <li><a href="../index-internals.html">Internals</a>
                <li><a href="../index-platforms.html">Platform Specific</a>
              </ul>
            </div>
            <div class="side_panel doc_panel">
              <p>Modules</p>
              <ul>
		<li>
		
                
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		
                  
		
		
                    <a href="../index-modules-A.html">A</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-B.html">B</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-C.html">C</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-D.html">D</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-E.html">E</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="../index-modules-F.html">F</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-G.html">G</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-H.html">H</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-I.html">I</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-L.html">L</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="../index-modules-M.html">M</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-N.html">N</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-O.html">O</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-P.html">P</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-S.html">S</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="../index-modules-T.html">T</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-U.html">U</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="../index-modules-X.html">X</a>
                    
                
              </ul>
            </div>
            
	      <div class="side_panel doc_panel">
		<p>Tools</p>
		<ul>
		  <li><a href="../preferences.html">Preferences</a>
		</ul>
	      </div>
            
          </div>
        </div>
        <div id="centre_column">
          <div id="content_header">
            <div id="title_bar">
              <div id="page_name">
                <h1>B::Concise</h1>
              </div>
              <div id="perl_version">
                Perl 5 version 26.0 documentation
              </div>
              <div class="page_links" id="page_links_top">
                <a href="#" onClick="toolbar.goToTop();return false;">Go to top</a>
		
              </div>
	      <div class="page_links" id="page_links_bottom">
		
                  <a href="#" id="page_index_toggle">Show page index</a> &bull;
		
                <a href="#" id="recent_pages_toggle">Show recent pages</a>		
	      </div>
	      <div id="search_form">
		<form action="../search.html" method="GET" id="search">
		  <input type="text" name="q" id="search_box" alt="Search">
		</form>
	      </div>
            </div>
            <div id="breadcrumbs">
                
    <a href="../index.html">Home</a> &gt;
    
      
        <a href="../index-modules-B.html">Core modules (B)</a> &gt;
      
    
    B::Concise
  

            </div>
          </div>
          <div id="content_body">
	    <!--[if lt IE 7]>
 <div class="noscript">
   <p>
     <strong>It looks like you're using Internet Explorer 6. This is a very old
     browser which does not offer full support for modern websites.</strong>
   </p>
   <p>
     Unfortunately this means that this website will not work on
     your computer.
   </p>
   <p>
     Don't miss out though! To view the site (and get a better experience from
     many other websites), simply upgrade to
     <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet
Explorer 8</a>
     or download an alternative browser such as
     <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>,
     <a href="http://www.apple.com/safari/download/">Safari</a>, or
     <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
   </p>
   <p>
     All of these browsers are free. If you're using a PC at work, you may
     need to contact your IT administrator.
   </p>
 </div>
<![endif]-->
	    <noscript>
	      <div class="noscript">
	      <p>
                <strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled,
	        or are running a non-JavaScript capable web browser.</strong>
	      </p>
	      <p>
		To get the best experience, please enable JavaScript or download a modern web browser such as <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer 8</a>, <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>, <a href="http://www.apple.com/safari/download/">Safari</a>, or <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
              </p>
	      </div>
	    </noscript>

	    <div id="recent_pages" class="hud_container">
	      <div id="recent_pages_header" class="hud_header">
		<div id="recent_pages_close" class="hud_close"><a href="#" onClick="recentPages.hide();return false;"></a></div>
		<div id="recent_pages_title" class="hud_title"><span class="hud_span_top">Recently read</span></div>
		<div id="recent_pages_topright" class="hud_topright"></div>
	      </div>
	      <div id="recent_pages_content" class="hud_content">
	      </div>
	      <div id="recent_pages_footer" class="hud_footer">
		<div id="recent_pages_bottomleft" class="hud_bottomleft"></div>
		<div id="recent_pages_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
		<div id="recent_pages_resize" class="hud_resize"></div>
	      </div>
	    </div>
  
	    <div id="from_search"></div>
            <h1>B::Concise</h1>


  <!--    -->
<ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><li><a href="#EXAMPLE">EXAMPLE</a><li><a href="#OPTIONS">OPTIONS</a><ul><li><a href="#Options-for-Opcode-Ordering">Options for Opcode Ordering</a><li><a href="#Options-for-Line-Style">Options for Line-Style</a><li><a href="#Options-for-tree-specific-formatting">Options for tree-specific formatting</a><li><a href="#Options-controlling-sequence-numbering">Options controlling sequence numbering</a><li><a href="#Other-options">Other options</a><li><a href="#Option-Stickiness">Option Stickiness</a></ul><li><a href="#ABBREVIATIONS">ABBREVIATIONS</a><ul><li><a href="#OP-class-abbreviations">OP class abbreviations</a><li><a href="#OP-flags-abbreviations">OP flags abbreviations</a></ul><li><a href="#FORMATTING-SPECIFICATIONS">FORMATTING SPECIFICATIONS</a><ul><li><a href="#Special-Patterns">Special Patterns</a><li><a href="#%23-Variables"># Variables</a></ul><li><a href="#One-Liner-Command-tips">One-Liner Command tips</a><li><a href="#Using-B%3a%3aConcise-outside-of-the-O-framework">Using B::Concise outside of the O framework</a><ul><li><a href="#Example%3a-Altering-Concise-Renderings">Example: Altering Concise Renderings</a><li><a href="#set_style()">set_style()</a><li><a href="#set_style_standard(%24name)">set_style_standard($name)</a><li><a href="#add_style-()">add_style ()</a><li><a href="#add_callback-()">add_callback ()</a><li><a href="#Running-B%3a%3aConcise%3a%3acompile()">Running B::Concise::compile()</a><li><a href="#B%3a%3aConcise%3a%3areset_sequence()">B::Concise::reset_sequence()</a><li><a href="#Errors">Errors</a></ul><li><a href="#AUTHOR">AUTHOR</a></ul><a name="NAME"></a><h1>NAME</h1>
<p>B::Concise - Walk Perl syntax tree, printing concise info about ops</p>
<a name="SYNOPSIS"></a><h1>SYNOPSIS</h1>
<pre class="verbatim"><ol><li>    <span class="w">perl</span> -<span class="w">MO</span>=<span class="w">Concise</span><span class="s">[</span><span class="cm">,</span><span class="w">OPTIONS</span><span class="s">]</span> <span class="w">foo</span>.<span class="w">pl</span></li><li></li><li>    <a class="l_k" href="../functions/use.html">use</a> <span class="w">B::Concise</span> <span class="q">qw(set_style add_callback)</span><span class="sc">;</span></li></ol></pre><a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
<p>This compiler backend prints the internal OPs of a Perl program's syntax
tree in one of several space-efficient text formats suitable for debugging
the inner workings of perl or other compiler backends. It can print OPs in
the order they appear in the OP tree, in the order they will execute, or
in a text approximation to their tree structure, and the format of the
information displayed is customizable. Its function is similar to that of
perl's <b>-Dx</b> debugging flag or the <b>B::Terse</b> module, but it is more
sophisticated and flexible.</p>
<a name="EXAMPLE"></a><h1>EXAMPLE</h1>
<p>Here's two outputs (or 'renderings'), using the -exec and -basic
(i.e. default) formatting conventions on the same code snippet.</p>
<pre class="verbatim"><ol><li>    % perl -MO=Concise,-exec -e '$a = $b + 42'</li><li>    1  &lt;0&gt; enter</li><li>    2  &lt;;&gt; nextstate(main 1 -e:1) v</li><li>    3  &lt;#&gt; gvsv[*b] s</li><li>    4  &lt;$&gt; const[IV 42] s</li><li> *  5  &lt;2&gt; add[t3] sK/2</li><li>    6  &lt;#&gt; gvsv[*a] s</li><li>    7  &lt;2&gt; sassign vKS/2</li><li>    8  &lt;@&gt; leave[1 ref] vKP/REFC</li></ol></pre><p>In this -exec rendering, each opcode is executed in the order shown.
The add opcode, marked with '*', is discussed in more detail.</p>
<p>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.</p>
<p>The symbol between angle brackets indicates the op's type, for
example; &lt;2&gt; is a BINOP, &lt;@&gt; a LISTOP, and &lt;#&gt; is a PADOP, which is
used in threaded perls. (see <a href="#OP-class-abbreviations">OP class abbreviations</a>).</p>
<p>The opname, as in <b>'add[t1]'</b>, may be followed by op-specific
information in parentheses or brackets (ex <b>'[t1]'</b>).</p>
<p>The op-flags (ex <b>'sK/2'</b>) are described in (<a href="#OP-flags-abbreviations">OP flags abbreviations</a>).</p>
<pre class="verbatim"><ol><li>    % perl -MO=Concise -e '$a = $b + 42'</li><li>    8  &lt;@&gt; leave[1 ref] vKP/REFC -&gt;(end)</li><li>    1     &lt;0&gt; enter -&gt;2</li><li>    2     &lt;;&gt; nextstate(main 1 -e:1) v -&gt;3</li><li>    7     &lt;2&gt; sassign vKS/2 -&gt;8</li><li> *  5        &lt;2&gt; add[t1] sK/2 -&gt;6</li><li>    -           &lt;1&gt; ex-rv2sv sK/1 -&gt;4</li><li>    3              &lt;$&gt; gvsv(*b) s -&gt;4</li><li>    4           &lt;$&gt; const(IV 42) s -&gt;5</li><li>    -        &lt;1&gt; ex-rv2sv sKRM*/1 -&gt;7</li><li>    6           &lt;$&gt; gvsv(*a) s -&gt;7</li></ol></pre><p>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.</p>
<p>Nullops appear as <code class="inline"><span class="w">ex</span>-<span class="w">opname</span></code>
, where <i>opname</i> 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.</p>
<p>The arrow points to the sequence number of the next op; they're not
displayed in -exec mode, for obvious reasons.</p>
<p>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.</p>
<a name="OPTIONS"></a><h1>OPTIONS</h1>
<p>Arguments that don't start with a hyphen are taken to be the names of
subroutines or formats to render; if no
such functions are specified, the main
body of the program (outside any subroutines, and not including use'd
or require'd files) is rendered.  Passing <code class="inline">BEGIN</code>
, <code class="inline">UNITCHECK</code>
,
<code class="inline">CHECK</code>
, <code class="inline">INIT</code>
, or <code class="inline">END</code>
 will cause all of the corresponding
special blocks to be printed.  Arguments must follow options.</p>
<p>Options affect how things are rendered (ie printed).  They're presented
here by their visual effect, 1st being strongest.  They're grouped
according to how they interrelate; within each group the options are
mutually exclusive (unless otherwise stated).</p>
<a name="Options-for-Opcode-Ordering"></a><h2>Options for Opcode Ordering</h2>
<p>These options control the 'vertical display' of opcodes.  The display
'order' is also called 'mode' elsewhere in this document.</p>
<ul>
<li><a name="*-basic*"></a><b><b>-basic</b></b>
<p>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 '-&gt;' 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.</p>
</li>
<li><a name="*-exec*"></a><b><b>-exec</b></b>
<p>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.</p>
</li>
<li><a name="*-tree*"></a><b><b>-tree</b></b>
<p>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).</p>
</li>
</ul>
<a name="Options-for-Line-Style"></a><h2>Options for Line-Style</h2>
<p>These options select the line-style (or just style) used to render
each opcode, and dictates what info is actually printed into each line.</p>
<ul>
<li><a name="*-concise*"></a><b><b>-concise</b></b>
<p>Use the author's favorite set of formatting conventions. This is the
default, of course.</p>
</li>
<li><a name="*-terse*"></a><b><b>-terse</b></b>
<p>Use formatting conventions that emulate the output of <b>B::Terse</b>. The
basic mode is almost indistinguishable from the real <b>B::Terse</b>, and the
exec mode looks very similar, but is in a more logical order and lacks
curly brackets. <b>B::Terse</b> doesn't have a tree mode, so the tree mode
is only vaguely reminiscent of <b>B::Terse</b>.</p>
</li>
<li><a name="*-linenoise*"></a><b><b>-linenoise</b></b>
<p>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.</p>
</li>
<li><a name="*-debug*"></a><b><b>-debug</b></b>
<p>Use formatting conventions reminiscent of <b>B::Debug</b>; these aren't
very concise at all.</p>
</li>
<li><a name="*-env*"></a><b><b>-env</b></b>
<p>Use formatting conventions read from the environment variables
<code class="inline"><span class="w">B_CONCISE_FORMAT</span></code>
, <code class="inline"><span class="w">B_CONCISE_GOTO_FORMAT</span></code>
, and <code class="inline"><span class="w">B_CONCISE_TREE_FORMAT</span></code>
.</p>
</li>
</ul>
<a name="Options-for-tree-specific-formatting"></a><h2>Options for tree-specific formatting</h2>
<ul>
<li><a name="*-compact*"></a><b><b>-compact</b></b>
<p>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.</p>
</li>
<li><a name="*-loose*"></a><b><b>-loose</b></b>
<p>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.</p>
</li>
<li><a name="*-vt*"></a><b><b>-vt</b></b>
<p>Use tree connecting characters drawn from the VT100 line-drawing set.
This looks better if your terminal supports it.</p>
</li>
<li><a name="*-ascii*"></a><b><b>-ascii</b></b>
<p>Draw the tree with standard ASCII characters like <code class="inline">+</code>
 and <code class="inline">|</code>. 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.</p>
</li>
</ul>
<p>These are pairwise exclusive, i.e. compact or loose, vt or ascii.</p>
<a name="Options-controlling-sequence-numbering"></a><h2>Options controlling sequence numbering</h2>
<ul>
<li><a name="*-base*_n_"></a><b><b>-base</b><i>n</i></b>
<p>Print OP sequence numbers in base <i>n</i>. If <i>n</i> is greater than 10, the
digit for 11 will be 'a', and so on. If <i>n</i> is greater than 36, the digit
for 37 will be 'A', and so on until 62. Values greater than 62 are not
currently supported. The default is 36.</p>
</li>
<li><a name="*-bigendian*"></a><b><b>-bigendian</b></b>
<p>Print sequence numbers with the most significant digit first. This is the
usual convention for Arabic numerals, and the default.</p>
</li>
<li><a name="*-littleendian*"></a><b><b>-littleendian</b></b>
<p>Print sequence numbers with the least significant digit first.  This is
obviously mutually exclusive with bigendian.</p>
</li>
</ul>
<a name="Other-options"></a><h2>Other options</h2>
<ul>
<li><a name="*-src*"></a><b><b>-src</b></b>
<p>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:</p>
<pre class="verbatim"><ol><li>    1  &lt;0&gt; enter</li><li>    # 1: my $i;</li><li>    2  &lt;;&gt; nextstate(main 1 junk.pl:1) v:{</li><li>    3  &lt;0&gt; padsv[$i:1,10] vM/LVINTRO</li><li>    # 3: for $i (0..9) {</li><li>    4  &lt;;&gt; nextstate(main 3 junk.pl:3) v:{</li><li>    5  &lt;0&gt; pushmark s</li><li>    6  &lt;$&gt; const[IV 0] s</li><li>    7  &lt;$&gt; const[IV 9] s</li><li>    8  &lt;{&gt; enteriter(next-&gt;j last-&gt;m redo-&gt;9)[$i:1,10] lKS</li><li>    k  &lt;0&gt; iter s</li><li>    l  &lt;|&gt; and(other-&gt;9) vK/1</li><li>    # 4:     print "line ";</li><li>    9      &lt;;&gt; nextstate(main 2 junk.pl:4) v</li><li>    a      &lt;0&gt; pushmark s</li><li>    b      &lt;$&gt; const[PV "line "] s</li><li>    c      &lt;@&gt; print vK</li><li>    # 5:     print "$i\n";</li><li>    ...</li></ol></pre></li>
<li><a name="*-stash%3d%22somepackage%22*"></a><b><b>-stash="somepackage"</b></b>
<p>With this, "somepackage" will be required, then the stash is
inspected, and each function is rendered.</p>
</li>
</ul>
<p>The following options are pairwise exclusive.</p>
<ul>
<li><a name="*-main*"></a><b><b>-main</b></b>
<p>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.</p>
</li>
<li><a name="*-nomain*"></a><b><b>-nomain</b></b>
<p>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.</p>
</li>
<li><a name="*-nobanner*"></a><b><b>-nobanner</b></b>
<p>Renderings usually include a banner line identifying the function name
or stringified subref.  This suppresses the printing of the banner.</p>
<p>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.</p>
</li>
<li><a name="*-banner*"></a><b><b>-banner</b></b>
<p>restores default banner behavior.</p>
</li>
<li><a name="*-banneris*-%3d%3e-subref"></a><b><b>-banneris</b> =&gt; subref</b>
<p>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.</p>
</li>
</ul>
<a name="Option-Stickiness"></a><h2>Option Stickiness</h2>
<p>If you invoke Concise more than once in a program, you should know that
the options are 'sticky'.  This means that the options you provide in
the first call will be remembered for the 2nd call, unless you
re-specify or change them.</p>
<a name="ABBREVIATIONS"></a><h1>ABBREVIATIONS</h1>
<p>The concise style uses symbols to convey maximum info with minimal
clutter (like hex addresses).  With just a little practice, you can
start to see the flowers, not just the branches, in the trees.</p>
<a name="OP-class-abbreviations"></a><h2>OP class abbreviations</h2>
<p>These symbols appear before the op-name, and indicate the
B:: namespace that represents the ops in your Perl code.</p>
<pre class="verbatim"><ol><li>    <span class="n">0</span>      <span class="w">OP</span> <span class="s">(</span><span class="w">aka</span> <span class="w">BASEOP</span><span class="s">)</span>  <span class="w">An</span> <span class="w">OP</span> <span class="w">with</span> <a class="l_k" href="../functions/no.html">no</a> <span class="w">children</span></li><li>    <span class="n">1</span>      <span class="w">UNOP</span>             <span class="w">An</span> <span class="w">OP</span> <span class="w">with</span> <span class="w">one</span> <span class="w">child</span></li><li>    +      <span class="w">UNOP_AUX</span>         <span class="w">A</span> <span class="w">UNOP</span> <span class="w">with</span> <span class="w">auxillary</span> <span class="w">fields</span></li><li>    <span class="n">2</span>      <span class="w">BINOP</span>            <span class="w">An</span> <span class="w">OP</span> <span class="w">with</span> <span class="w">two</span> <span class="w">children</span></li><li>    |      <span class="w">LOGOP</span>            <span class="w">A</span> <span class="w">control</span> <span class="w">branch</span> <span class="w">OP</span></li><li>    <span class="i">@      LISTOP</span>           <span class="w">An</span> <span class="w">OP</span> <span class="w">that</span> <span class="w">could</span> <span class="w">have</span> <span class="w">lots</span> <span class="w">of</span> <span class="w">children</span></li><li>    /      <span class="w">PMOP</span>             <span class="w">An</span> <span class="w">OP</span> <span class="w">with</span> <span class="w">a</span> <span class="w">regular</span> <span class="w">expression</span></li><li>    <span class="i">$      SVOP</span>             <span class="w">An</span> <span class="w">OP</span> <span class="w">with</span> <span class="w">an</span> <span class="w">SV</span></li><li>    <span class="q">&quot;      PVOP             An OP with a string</span></li><li>    <span class="q">    {      LOOP             An OP that holds pointers for a loop</span></li><li>    <span class="q">    ;      COP              An OP that marks the start of a statement</span></li><li>    <span class="q">    #      PADOP            An OP with a GV on the pad</span></li><li>    <span class="q">    .      METHOP           An OP with method call info</span></li></ol></pre><a name="OP-flags-abbreviations"></a><h2>OP flags abbreviations</h2>
<p>OP flags are either public or private.  The public flags alter the
behavior of each opcode in consistent ways, and are represented by 0
or more single characters.</p>
<pre class="verbatim"><ol><li>    v      OPf_WANT_VOID    Want nothing (void context)</li><li>    s      OPf_WANT_SCALAR  Want single value (scalar context)</li><li>    l      OPf_WANT_LIST    Want list of any length (list context)</li><li>                            Want is unknown</li><li>    K      OPf_KIDS         There is a firstborn child.</li><li>    P      OPf_PARENS       This operator was parenthesized.</li><li>                             (Or block needs explicit scope entry.)</li><li>    R      OPf_REF          Certified reference.</li><li>                             (Return container, not containee).</li><li>    M      OPf_MOD          Will modify (lvalue).</li><li>    S      OPf_STACKED      Some arg is arriving on the stack.</li><li>    *      OPf_SPECIAL      Do something weird for this op (see op.h)</li></ol></pre><p>Private flags, if any are set for an opcode, are displayed after a '/'</p>
<pre class="verbatim"><ol><li>    8  &lt;@&gt; leave[1 ref] vKP/REFC -&gt;(end)</li><li>    7     &lt;2&gt; sassign vKS/2 -&gt;8</li></ol></pre><p>They're opcode specific, and occur less often than the public ones, so
they're represented by short mnemonics instead of single-chars; see
B::Op_private and <i>regen/op_private</i> for more details.</p>
<a name="FORMATTING-SPECIFICATIONS"></a><h1>FORMATTING SPECIFICATIONS</h1>
<p>For each line-style ('concise', 'terse', 'linenoise', etc.) there are
3 format-specs which control how OPs are rendered.</p>
<p>The first is the 'default' format, which is used in both basic and exec
modes to print all opcodes.  The 2nd, goto-format, is used in exec
mode when branches are encountered.  They're not real opcodes, and are
inserted to look like a closing curly brace.  The tree-format is tree
specific.</p>
<p>When a line is rendered, the correct format-spec is copied and scanned
for the following items; data is substituted in, and other
manipulations like basic indenting are done, for each opcode rendered.</p>
<p>There are 3 kinds of items that may be populated; special patterns,
#vars, and literal text, which is copied verbatim.  (Yes, it's a set
of s///g steps.)</p>
<a name="Special-Patterns"></a><h2>Special Patterns</h2>
<p>These items are the primitives used to perform indenting, and to
select text from amongst alternatives.</p>
<ul>
<li><a name="*(x(*_exec_text_*%3b*_basic_text_*)x)*"></a><b><b>(x(</b><i>exec_text</i><b>;</b><i>basic_text</i><b>)x)</b></b>
<p>Generates <i>exec_text</i> in exec mode, or <i>basic_text</i> in basic mode.</p>
</li>
<li><a name="*(*(*_text_*)*)*"></a><b><b>(*(</b><i>text</i><b>)*)</b></b>
<p>Generates one copy of <i>text</i> for each indentation level.</p>
</li>
<li><a name="*(*(*_text1_*%3b*_text2_*)*)*"></a><b><b>(*(</b><i>text1</i><b>;</b><i>text2</i><b>)*)</b></b>
<p>Generates one fewer copies of <i>text1</i> than the indentation level, followed
by one copy of <i>text2</i> if the indentation level is more than 0.</p>
</li>
<li><a name="*(%3f(*_text1_*%23*_var__Text2_*)%3f)*"></a><b><b>(?(</b><i>text1</i><b>#</b><i>var</i><i>Text2</i><b>)?)</b></b>
<p>If the value of <i>var</i> is true (not empty or zero), generates the
value of <i>var</i> surrounded by <i>text1</i> and <i>Text2</i>, otherwise
nothing.</p>
</li>
<li><a name="*~*"></a><b><b>~</b></b>
<p>Any number of tildes and surrounding whitespace will be collapsed to
a single space.</p>
</li>
</ul>
<a name="%23-Variables"></a><h2># Variables</h2>
<p>These #vars represent opcode properties that you may want as part of
your rendering.  The '#' is intended as a private sigil; a #var's
value is interpolated into the style-line, much like "read $this".</p>
<p>These vars take 3 forms:</p>
<ul>
<li><a name="*%23*_var_"></a><b><b>#</b><i>var</i></b>
<p>A property named 'var' is assumed to exist for the opcodes, and is
interpolated into the rendering.</p>
</li>
<li><a name="*%23*_var__N_"></a><b><b>#</b><i>var</i><i>N</i></b>
<p>Generates the value of <i>var</i>, left justified to fill <i>N</i> spaces.
Note that this means while you can have properties 'foo' and 'foo2',
you cannot render 'foo2', but you could with 'foo2a'.  You would be
wise not to rely on this behavior going forward ;-)</p>
</li>
<li><a name="*%23*_Var_"></a><b><b>#</b><i>Var</i></b>
<p>This ucfirst form of #var generates a tag-value form of itself for
display; it converts '#Var' into a 'Var =&gt; #var' style, which is then
handled as described above.  (Imp-note: #Vars cannot be used for
conditional-fills, because the =&gt; #var transform is done after the check
for #Var's value).</p>
</li>
</ul>
<p>The following variables are 'defined' by B::Concise; when they are
used in a style, their respective values are plugged into the
rendering of each opcode.</p>
<p>Only some of these are used by the standard styles, the others are
provided for you to delve into optree mechanics, should you wish to
add a new style (see <a href="#add_style">add_style</a> below) that uses them.  You can
also add new ones using <a href="#add_callback">add_callback</a>.</p>
<ul>
<li><a name="*%23addr*"></a><b><b>#addr</b></b>
<p>The address of the OP, in hexadecimal.</p>
</li>
<li><a name="*%23arg*"></a><b><b>#arg</b></b>
<p>The OP-specific information of the OP (such as the SV for an SVOP, the
non-local exit pointers for a LOOP, etc.) enclosed in parentheses.</p>
</li>
<li><a name="*%23class*"></a><b><b>#class</b></b>
<p>The B-determined class of the OP, in all caps.</p>
</li>
<li><a name="*%23classsym*"></a><b><b>#classsym</b></b>
<p>A single symbol abbreviating the class of the OP.</p>
</li>
<li><a name="*%23coplabel*"></a><b><b>#coplabel</b></b>
<p>The label of the statement or block the OP is the start of, if any.</p>
</li>
<li><a name="*%23exname*"></a><b><b>#exname</b></b>
<p>The name of the OP, or 'ex-foo' if the OP is a null that used to be a foo.</p>
</li>
<li><a name="*%23extarg*"></a><b><b>#extarg</b></b>
<p>The target of the OP, or nothing for a nulled OP.</p>
</li>
<li><a name="*%23firstaddr*"></a><b><b>#firstaddr</b></b>
<p>The address of the OP's first child, in hexadecimal.</p>
</li>
<li><a name="*%23flags*"></a><b><b>#flags</b></b>
<p>The OP's flags, abbreviated as a series of symbols.</p>
</li>
<li><a name="*%23flagval*"></a><b><b>#flagval</b></b>
<p>The numeric value of the OP's flags.</p>
</li>
<li><a name="*%23hints*"></a><b><b>#hints</b></b>
<p>The COP's hint flags, rendered with abbreviated names if possible. An empty
string if this is not a COP. Here are the symbols used:</p>
<pre class="verbatim"><ol><li>    <span class="i">$ strict</span> <span class="w">refs</span></li><li>    <span class="i">&amp; strict</span> <span class="w">subs</span></li><li>    * <span class="w">strict</span> <span class="w">vars</span></li><li>   <span class="w">x</span><span class="i">$ explicit</span> <a class="l_k" href="../functions/use.html">use</a><span class="q">/no strict refs</span></li><li>   <span class="q">   x&amp; explicit use/</span><a class="l_k" href="../functions/no.html">no</a> <span class="w">strict</span> <span class="w">subs</span></li><li>   <span class="w">x</span>* <span class="w">explicit</span> <a class="l_k" href="../functions/use.html">use</a><span class="q">/no strict vars</span></li><li>    <span class="q">    i integers</span></li><li>    <span class="q">    l locale</span></li><li>    <span class="q">    b bytes</span></li><li>    <span class="q">    { block scope</span></li><li>    <span class="q">    % localise %^H</span></li><li>    <span class="q">    &lt; open in</span></li><li>    <span class="q">    &gt; open out</span></li><li>    <span class="q">    I overload int</span></li><li>    <span class="q">    F overload float</span></li><li>    <span class="q">    B overload binary</span></li><li>    <span class="q">    S overload string</span></li><li>    <span class="q">    R overload re</span></li><li>    <span class="q">    T taint</span></li><li>    <span class="q">    E eval</span></li><li>    <span class="q">    X filetest access</span></li><li>    <span class="q">    U utf-8</span></li><li></li><li>    <span class="q">    us      use feature &#39;unicode_strings&#39;</span></li><li>    <span class="q">    fea=NNN feature bundle number</span></li></ol></pre></li>
<li><a name="*%23hintsval*"></a><b><b>#hintsval</b></b>
<p>The numeric value of the COP's hint flags, or an empty string if this is not
a COP.</p>
</li>
<li><a name="*%23hyphseq*"></a><b><b>#hyphseq</b></b>
<p>The sequence number of the OP, or a hyphen if it doesn't have one.</p>
</li>
<li><a name="*%23label*"></a><b><b>#label</b></b>
<p>'NEXT', 'LAST', or 'REDO' if the OP is a target of one of those in exec
mode, or empty otherwise.</p>
</li>
<li><a name="*%23lastaddr*"></a><b><b>#lastaddr</b></b>
<p>The address of the OP's last child, in hexadecimal.</p>
</li>
<li><a name="*%23name*"></a><b><b>#name</b></b>
<p>The OP's name.</p>
</li>
<li><a name="*%23NAME*"></a><b><b>#NAME</b></b>
<p>The OP's name, in all caps.</p>
</li>
<li><a name="*%23next*"></a><b><b>#next</b></b>
<p>The sequence number of the OP's next OP.</p>
</li>
<li><a name="*%23nextaddr*"></a><b><b>#nextaddr</b></b>
<p>The address of the OP's next OP, in hexadecimal.</p>
</li>
<li><a name="*%23noise*"></a><b><b>#noise</b></b>
<p>A one- or two-character abbreviation for the OP's name.</p>
</li>
<li><a name="*%23private*"></a><b><b>#private</b></b>
<p>The OP's private flags, rendered with abbreviated names if possible.</p>
</li>
<li><a name="*%23privval*"></a><b><b>#privval</b></b>
<p>The numeric value of the OP's private flags.</p>
</li>
<li><a name="*%23seq*"></a><b><b>#seq</b></b>
<p>The sequence number of the OP. Note that this is a sequence number
generated by B::Concise.</p>
</li>
<li><a name="*%23seqnum*"></a><b><b>#seqnum</b></b>
<p>5.8.x and earlier only. 5.9 and later do not provide this.</p>
<p>The real sequence number of the OP, as a regular number and not adjusted
to be relative to the start of the real program. (This will generally be
a fairly large number because all of <b>B::Concise</b> is compiled before
your program is).</p>
</li>
<li><a name="*%23opt*"></a><b><b>#opt</b></b>
<p>Whether or not the op has been optimized by the peephole optimizer.</p>
<p>Only available in 5.9 and later.</p>
</li>
<li><a name="*%23sibaddr*"></a><b><b>#sibaddr</b></b>
<p>The address of the OP's next youngest sibling, in hexadecimal.</p>
</li>
<li><a name="*%23svaddr*"></a><b><b>#svaddr</b></b>
<p>The address of the OP's SV, if it has an SV, in hexadecimal.</p>
</li>
<li><a name="*%23svclass*"></a><b><b>#svclass</b></b>
<p>The class of the OP's SV, if it has one, in all caps (e.g., 'IV').</p>
</li>
<li><a name="*%23svval*"></a><b><b>#svval</b></b>
<p>The value of the OP's SV, if it has one, in a short human-readable format.</p>
</li>
<li><a name="*%23targ*"></a><b><b>#targ</b></b>
<p>The numeric value of the OP's targ.</p>
</li>
<li><a name="*%23targarg*"></a><b><b>#targarg</b></b>
<p>The name of the variable the OP's targ refers to, if any, otherwise the
letter t followed by the OP's targ in decimal.</p>
</li>
<li><a name="*%23targarglife*"></a><b><b>#targarglife</b></b>
<p>Same as <b>#targarg</b>, but followed by the COP sequence numbers that delimit
the variable's lifetime (or 'end' for a variable in an open scope) for a
variable.</p>
</li>
<li><a name="*%23typenum*"></a><b><b>#typenum</b></b>
<p>The numeric value of the OP's type, in decimal.</p>
</li>
</ul>
<a name="One-Liner-Command-tips"></a><h1>One-Liner Command tips</h1>
<ul>
<li><a name="perl--MO%3dConcise%2cbar-foo.pl"></a><b>perl -MO=Concise,bar foo.pl</b>
<p>Renders only bar() from foo.pl.  To see main, drop the ',bar'.  To see
both, add ',-main'</p>
</li>
<li><a name="perl--MDigest%3a%3aMD5%3dmd5--MO%3dConcise%2cmd5--e1"></a><b>perl -MDigest::MD5=md5 -MO=Concise,md5 -e1</b>
<p>Identifies md5 as an XS function.  The export is needed so that BC can
find it in main.</p>
</li>
<li><a name="perl--MPOSIX--MO%3dConcise%2c_POSIX_ARG_MAX--e1"></a><b>perl -MPOSIX -MO=Concise,_POSIX_ARG_MAX -e1</b>
<p>Identifies _POSIX_ARG_MAX as a constant sub, optimized to an IV.
Although POSIX isn't entirely consistent across platforms, this is
likely to be present in virtually all of them.</p>
</li>
<li><a name="perl--MPOSIX--MO%3dConcise%2ca--e-'print-_POSIX_SAVED_IDS'"></a><b>perl -MPOSIX -MO=Concise,a -e 'print _POSIX_SAVED_IDS'</b>
<p>This renders a print statement, which includes a call to the function.
It's identical to rendering a file with a use call and that single
statement, except for the filename which appears in the nextstate ops.</p>
</li>
<li><a name="perl--MPOSIX--MO%3dConcise%2ca--e-'sub-a%7b_POSIX_SAVED_IDS%7d'"></a><b>perl -MPOSIX -MO=Concise,a -e 'sub a{_POSIX_SAVED_IDS}'</b>
<p>This is <b>very</b> similar to previous, only the first two ops differ.  This
subroutine rendering is more representative, insofar as a single main
program will have many subs.</p>
</li>
<li><a name="perl--MB%3a%3aConcise--e-'B%3a%3aConcise%3a%3acompile(%22-exec%22%2c%22-src%22%2c-%5c%25B%3a%3aConcise%3a%3a)-%3e()'"></a><b>perl -MB::Concise -e 'B::Concise::compile("-exec","-src", \%B::Concise::)-&gt;()'</b>
<p>This renders all functions in the B::Concise package with the source
lines.  It eschews the O framework so that the stashref can be passed
directly to B::Concise::compile().  See -stash option for a more
convenient way to render a package.</p>
</li>
</ul>
<a name="Using-B%3a%3aConcise-outside-of-the-O-framework"></a><h1>Using B::Concise outside of the O framework</h1>
<p>The common (and original) usage of B::Concise was for command-line
renderings of simple code, as given in EXAMPLE.  But you can also use
<b>B::Concise</b> from your code, and call compile() directly, and
repeatedly.  By doing so, you can avoid the compile-time only
operation of O.pm, and even use the debugger to step through
B::Concise::compile() itself.</p>
<p>Once you're doing this, you may alter Concise output by adding new
rendering styles, and by optionally adding callback routines which
populate new variables, if such were referenced from those (just
added) styles.</p>
<a name="Example%3a-Altering-Concise-Renderings"></a><h2>Example: Altering Concise Renderings</h2>
<pre class="verbatim"><ol><li>    <a class="l_k" href="../functions/use.html">use</a> <span class="w">B::Concise</span> <span class="q">qw(set_style add_callback)</span><span class="sc">;</span></li><li>    <span class="i">add_style</span><span class="s">(</span><span class="i">$yourStyleName</span> <span class="cm">=&gt;</span> <span class="i">$defaultfmt</span><span class="cm">,</span> <span class="i">$gotofmt</span><span class="cm">,</span> <span class="i">$treefmt</span><span class="s">)</span><span class="sc">;</span></li><li>    <span class="i">add_callback</span></li><li>      <span class="s">(</span> <a class="l_k" href="../functions/sub.html">sub</a> <span class="s">{</span></li><li>            <a class="l_k" href="../functions/my.html">my</a> <span class="s">(</span><span class="i">$h</span><span class="cm">,</span> <span class="i">$op</span><span class="cm">,</span> <span class="i">$format</span><span class="cm">,</span> <span class="i">$level</span><span class="cm">,</span> <span class="i">$stylename</span><span class="s">)</span> = <span class="i">@_</span><span class="sc">;</span></li><li>            <span class="i">$h</span>-&gt;{<span class="w">variable</span>} = <span class="i">some_func</span><span class="s">(</span><span class="i">$op</span><span class="s">)</span><span class="sc">;</span></li><li>        <span class="s">}</span><span class="s">)</span><span class="sc">;</span></li><li>    <span class="i">$walker</span> = <span class="i">B::Concise::compile</span><span class="s">(</span><span class="i">@options</span><span class="cm">,</span><span class="i">@subnames</span><span class="cm">,</span><span class="i">@subrefs</span><span class="s">)</span><span class="sc">;</span></li><li>    <span class="i">$walker</span>-&gt;<span class="s">(</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><a name="set_style()"></a><h2>set_style()</h2>
<p><b>set_style</b> accepts 3 arguments, and updates the three format-specs
comprising a line-style (basic-exec, goto, tree).  It has one minor
drawback though; it doesn't register the style under a new name.  This
can become an issue if you render more than once and switch styles.
Thus you may prefer to use add_style() and/or set_style_standard()
instead.</p>
<a name="set_style_standard(%24name)"></a><h2>set_style_standard($name)</h2>
<p>This restores one of the standard line-styles: <code class="inline"><span class="w">terse</span></code>
, <code class="inline"><span class="w">concise</span></code>
,
<code class="inline"><span class="w">linenoise</span></code>
, <code class="inline"><span class="w">debug</span></code>
, <code class="inline"><span class="w">env</span></code>
, into effect.  It also accepts style
names previously defined with add_style().</p>
<a name="add_style-()"></a><h2>add_style ()</h2>
<p>This subroutine accepts a new style name and three style arguments as
above, and creates, registers, and selects the newly named style.  It is
an error to re-add a style; call set_style_standard() to switch between
several styles.</p>
<a name="add_callback-()"></a><h2>add_callback ()</h2>
<p>If your newly minted styles refer to any new #variables, you'll need
to define a callback subroutine that will populate (or modify) those
variables.  They are then available for use in the style you've
chosen.</p>
<p>The callbacks are called for each opcode visited by Concise, in the
same order as they are added.  Each subroutine is passed five
parameters.</p>
<pre class="verbatim"><ol><li>  1. A hashref, containing the variable names and values which are</li><li>     populated into the report-line for the op</li><li>  2. the op, as a B&lt;B::OP&gt; object</li><li>  3. a reference to the format string</li><li>  4. the formatting (indent) level</li><li>  5. the selected stylename</li></ol></pre><p>To define your own variables, simply add them to the hash, or change
existing values if you need to.  The level and format are passed in as
references to scalars, but it is unlikely that they will need to be
changed or even used.</p>
<a name="Running-B%3a%3aConcise%3a%3acompile()"></a><h2>Running B::Concise::compile()</h2>
<p><b>compile</b> accepts options as described above in <a href="#OPTIONS">OPTIONS</a>, and
arguments, which are either coderefs, or subroutine names.</p>
<p>It constructs and returns a $treewalker coderef, which when invoked,
traverses, or walks, and renders the optrees of the given arguments to
STDOUT.  You can reuse this, and can change the rendering style used
each time; thereafter the coderef renders in the new style.</p>
<p><b>walk_output</b> lets you change the print destination from STDOUT to
another open filehandle, or into a string passed as a ref (unless
you've built perl with -Uuseperlio).</p>
<pre class="verbatim"><ol><li>  <a class="l_k" href="../functions/my.html">my</a> <span class="i">$walker</span> = <span class="i">B::Concise::compile</span><span class="s">(</span><span class="q">&#39;-terse&#39;</span><span class="cm">,</span><span class="q">&#39;aFuncName&#39;</span><span class="cm">,</span> \<span class="i">&amp;aSubRef</span><span class="s">)</span><span class="sc">;</span> <span class="c"># 1</span></li><li>  <span class="i">walk_output</span><span class="s">(</span>\<a class="l_k" href="../functions/my.html">my</a> <span class="i">$buf</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="i">$walker</span>-&gt;<span class="s">(</span><span class="s">)</span><span class="sc">;</span>			        <span class="c"># 1 renders -terse</span></li><li>  <span class="i">set_style_standard</span><span class="s">(</span><span class="q">&#39;concise&#39;</span><span class="s">)</span><span class="sc">;</span>	<span class="c"># 2</span></li><li>  <span class="i">$walker</span>-&gt;<span class="s">(</span><span class="s">)</span><span class="sc">;</span>  		        <span class="c"># 2 renders -concise</span></li><li>  <span class="i">$walker</span>-&gt;<span class="s">(</span><span class="i">@new</span><span class="s">)</span><span class="sc">;</span>			<span class="c"># 3 renders whatever</span></li><li>  <a class="l_k" href="../functions/print.html">print</a> <span class="q">&quot;3 different renderings: terse, concise, and @new: $buf\n&quot;</span><span class="sc">;</span></li></ol></pre><p>When $walker is called, it traverses the subroutines supplied when it
was created, and renders them using the current style.  You can change
the style afterwards in several different ways:</p>
<pre class="verbatim"><ol><li>  1. call C&lt;compile&gt;, altering style or mode/order</li><li>  2. call C&lt;set_style_standard&gt;</li><li>  3. call $walker, passing @new options</li></ol></pre><p>Passing new options to the $walker is the easiest way to change
amongst any pre-defined styles (the ones you add are automatically
recognized as options), and is the only way to alter rendering order
without calling compile again.  Note however that rendering state is
still shared amongst multiple $walker objects, so they must still be
used in a coordinated manner.</p>
<a name="B%3a%3aConcise%3a%3areset_sequence()"></a><h2>B::Concise::reset_sequence()</h2>
<p>This function (not exported) lets you reset the sequence numbers (note
that they're numbered arbitrarily, their goal being to be human
readable).  Its purpose is mostly to support testing, i.e. to compare
the concise output from two identical anonymous subroutines (but
different instances).  Without the reset, B::Concise, seeing that
they're separate optrees, generates different sequence numbers in
the output.</p>
<a name="Errors"></a><h2>Errors</h2>
<p>Errors in rendering (non-existent function-name, non-existent coderef)
are written to the STDOUT, or wherever you've set it via
walk_output().</p>
<p>Errors using the various *style* calls, and bad args to walk_output(),
result in die().  Use an eval if you wish to catch these errors and
continue processing.</p>
<a name="AUTHOR"></a><h1>AUTHOR</h1>
<p>Stephen McCamant, &lt;smcc@CSUA.Berkeley.EDU&gt;.</p>




  <div id="page_index" class="hud_container">
    <div id="page_index_header" class="hud_header">
      <div id="page_index_close" class="hud_close"><a href="#" onClick="pageIndex.hide();return false;"></a></div>
      <div id="page_index_title" class="hud_title"><span class="hud_span_top">Page index</span></div>
      <div id="page_index_topright" class="hud_topright"></div>
    </div>
    <div id="page_index_content" class="hud_content">
      <ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><li><a href="#EXAMPLE">EXAMPLE</a><li><a href="#OPTIONS">OPTIONS</a><ul><li><a href="#Options-for-Opcode-Ordering">Options for Opcode Ordering</a><li><a href="#Options-for-Line-Style">Options for Line-Style</a><li><a href="#Options-for-tree-specific-formatting">Options for tree-specific formatting</a><li><a href="#Options-controlling-sequence-numbering">Options controlling sequence numbering</a><li><a href="#Other-options">Other options</a><li><a href="#Option-Stickiness">Option Stickiness</a></ul><li><a href="#ABBREVIATIONS">ABBREVIATIONS</a><ul><li><a href="#OP-class-abbreviations">OP class abbreviations</a><li><a href="#OP-flags-abbreviations">OP flags abbreviations</a></ul><li><a href="#FORMATTING-SPECIFICATIONS">FORMATTING SPECIFICATIONS</a><ul><li><a href="#Special-Patterns">Special Patterns</a><li><a href="#%23-Variables"># Variables</a></ul><li><a href="#One-Liner-Command-tips">One-Liner Command tips</a><li><a href="#Using-B%3a%3aConcise-outside-of-the-O-framework">Using B::Concise outside of the O framework</a><ul><li><a href="#Example%3a-Altering-Concise-Renderings">Example: Altering Concise Renderings</a><li><a href="#set_style()">set_style()</a><li><a href="#set_style_standard(%24name)">set_style_standard($name)</a><li><a href="#add_style-()">add_style ()</a><li><a href="#add_callback-()">add_callback ()</a><li><a href="#Running-B%3a%3aConcise%3a%3acompile()">Running B::Concise::compile()</a><li><a href="#B%3a%3aConcise%3a%3areset_sequence()">B::Concise::reset_sequence()</a><li><a href="#Errors">Errors</a></ul><li><a href="#AUTHOR">AUTHOR</a></ul>
    </div>
    <div id="page_index_footer" class="hud_footer">
      <div id="page_index_bottomleft" class="hud_bottomleft"></div>
      <div id="page_index_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
      <div id="page_index_resize" class="hud_resize"></div>
    </div>
  </div>


	    &nbsp;
          </div>
          <div id="content_footer">
          </div>
        </div>
        <div class="clear"></div>
      </div>
      
    <div id="footer">
      <div id="footer_content">
        <div id="footer_strapline">
          perldoc.perl.org - Official documentation for the Perl programming language
        </div>
        <div id="footer_links">
          <div id="address">
            <p class="name">Contact details</p>
            <p class="address">
	      Site maintained by <a href="mailto:jj@jonallen.info">Jon Allen (JJ)</a><br>
	    </p>
            <p class="contact">
              Documentation maintained by the <a href="http://lists.cpan.org/showlist.cgi?name=perl5-porters">Perl 5 Porters</a>
            </p>
          </div>
          <ul class="f1">
            <li>Manual
              <ul class="f2">
                <li><a href="../index-overview.html">Overview</a>
                <li><a href="../index-tutorials.html">Tutorials</a>
                <li><a href="../index-faq.html">FAQs</a>
                <li><a href="../index-history.html">Changes</a>
              </ul>
            <li>Reference
              <ul class="f2">
                <li><a href="../index-language.html">Language</a>
                <li><a href="../index-functions.html">Functions</a>
                <li><a href="../perlop.html">Operators</a>
                <li><a href="../perlvar.html">Variables</a>
              </ul>
            <li>Modules
              <ul class="f2">
                <li><a href="../index-modules-A.html">Modules</a>
                <li><a href="../index-pragmas.html">Pragmas</a>
                <li><a href="../index-utilities.html">Utilities</a>
              </ul>
            <li>Misc
              <ul class="f2">
                <li><a href="../index-licence.html">License</a>
                <li><a href="../index-internals.html">Internals</a>
                <li><a href="../index-platforms.html">Platforms</a>
              </ul>          </ul>
          <div class="clear"></div>
        </div>
      </div>
      <div id="footer_end">
      </div>
    </div>
      
    </div>
      <script language="JavaScript" type="text/javascript" src="../static/exploreperl.js"></script>
      <script language="JavaScript" src="../static/combined-20100403.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
  perldoc.setPath(1);
  perldoc.pageName    = 'B::Concise';
  perldoc.pageAddress = 'B/Concise.html';
  perldoc.contentPage = 1;
  explorePerl.render();
  explorePerl.addEvents('explore_anchor');
</script>
    
  </body>
</html>