File: B.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 (1325 lines) | stat: -rw-r--r-- 60,059 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
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>B - 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</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
  

            </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</h1>


  <!--    -->
<ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><li><a href="#OVERVIEW">OVERVIEW</a><li><a href="#Utility-Functions">Utility Functions</a><ul><li><a href="#Functions-Returning-B%3a%3aSV%2c-B%3a%3aAV%2c-B%3a%3aHV%2c-and-B%3a%3aCV-objects">Functions Returning B::SV, B::AV, B::HV, and B::CV objects</a><li><a href="#Functions-for-Examining-the-Symbol-Table">Functions for Examining the Symbol Table</a><li><a href="#Functions-Returning-B%3a%3aOP-objects-or-for-walking-op-trees">Functions Returning B::OP objects or for walking op trees</a><li><a href="#Miscellaneous-Utility-Functions">Miscellaneous Utility Functions</a><li><a href="#Exported-utility-variables">Exported utility variables</a></ul><li><a href="#OVERVIEW-OF-CLASSES">OVERVIEW OF CLASSES</a><ul><li><a href="#SV-RELATED-CLASSES">SV-RELATED CLASSES</a><li><a href="#B%3a%3aSV-Methods">B::SV Methods</a><li><a href="#B%3a%3aIV-Methods">B::IV Methods</a><li><a href="#B%3a%3aNV-Methods">B::NV Methods</a><li><a href="#B%3a%3aRV-Methods">B::RV Methods</a><li><a href="#B%3a%3aPV-Methods">B::PV Methods</a><li><a href="#B%3a%3aPVMG-Methods">B::PVMG Methods</a><li><a href="#B%3a%3aMAGIC-Methods">B::MAGIC Methods</a><li><a href="#B%3a%3aPVLV-Methods">B::PVLV Methods</a><li><a href="#B%3a%3aBM-Methods">B::BM Methods</a><li><a href="#B%3a%3aREGEXP-Methods">B::REGEXP Methods</a><li><a href="#B%3a%3aGV-Methods">B::GV Methods</a><li><a href="#B%3a%3aIO-Methods">B::IO Methods</a><li><a href="#B%3a%3aAV-Methods">B::AV Methods</a><li><a href="#B%3a%3aCV-Methods">B::CV Methods</a><li><a href="#B%3a%3aHV-Methods">B::HV Methods</a><li><a href="#OP-RELATED-CLASSES">OP-RELATED CLASSES</a><li><a href="#B%3a%3aOP-Methods">B::OP Methods</a><li><a href="#B%3a%3aUNOP-Method">B::UNOP Method</a><li><a href="#B%3a%3aUNOP_AUX-Methods-(since-5.22)">B::UNOP_AUX Methods (since 5.22)</a><li><a href="#B%3a%3aBINOP-Method">B::BINOP Method</a><li><a href="#B%3a%3aLOGOP-Method">B::LOGOP Method</a><li><a href="#B%3a%3aLISTOP-Method">B::LISTOP Method</a><li><a href="#B%3a%3aPMOP-Methods">B::PMOP Methods</a><li><a href="#B%3a%3aSVOP-Methods">B::SVOP Methods</a><li><a href="#B%3a%3aPADOP-Method">B::PADOP Method</a><li><a href="#B%3a%3aPVOP-Method">B::PVOP Method</a><li><a href="#B%3a%3aLOOP-Methods">B::LOOP Methods</a><li><a href="#B%3a%3aCOP-Methods">B::COP Methods</a><li><a href="#B%3a%3aMETHOP-Methods-(Since-Perl-5.22)">B::METHOP Methods (Since Perl 5.22)</a><li><a href="#PAD-RELATED-CLASSES">PAD-RELATED CLASSES</a><li><a href="#B%3a%3aPADLIST-Methods">B::PADLIST Methods</a><li><a href="#B%3a%3aPADNAMELIST-Methods">B::PADNAMELIST Methods</a><li><a href="#B%3a%3aPADNAME-Methods">B::PADNAME Methods</a><li><a href="#%24B%3a%3aoverlay">$B::overlay</a></ul><li><a href="#AUTHOR">AUTHOR</a></ul><a name="NAME"></a><h1>NAME</h1>
<p>B - The Perl Compiler Backend</p>
<a name="SYNOPSIS"></a><h1>SYNOPSIS</h1>
<pre class="verbatim"><ol><li>	<a class="l_k" href="functions/use.html">use</a> <span class="w">B</span><span class="sc">;</span></li></ol></pre><a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
<p>The <code class="inline"><span class="w">B</span></code>
 module supplies classes which allow a Perl program to delve
into its own innards.  It is the module used to implement the
"backends" of the Perl compiler.  Usage of the compiler does not
require knowledge of this module: see the <i>O</i> module for the
user-visible part.  The <code class="inline"><span class="w">B</span></code>
 module is of use to those who want to
write new compiler backends.  This documentation assumes that the
reader knows a fair amount about perl's internals including such
things as SVs, OPs and the internal symbol table and syntax tree
of a program.</p>
<a name="OVERVIEW"></a><h1>OVERVIEW</h1>
<p>The <code class="inline"><span class="w">B</span></code>
 module contains a set of utility functions for querying the
current state of the Perl interpreter; typically these functions
return objects from the B::SV and B::OP classes, or their derived
classes.  These classes in turn define methods for querying the
resulting objects about their own internal state.</p>
<a name="Utility-Functions"></a><h1>Utility Functions</h1>
<p>The <code class="inline"><span class="w">B</span></code>
 module exports a variety of functions: some are simple
utility functions, others provide a Perl program with a way to
get an initial "handle" on an internal object.</p>
<a name="Functions-Returning-B%3a%3aSV%2c-B%3a%3aAV%2c-B%3a%3aHV%2c-and-B%3a%3aCV-objects"></a><h2>Functions Returning <code class="inline"><span class="w">B::SV</span></code>
, <code class="inline"><span class="w">B::AV</span></code>
, <code class="inline"><span class="w">B::HV</span></code>
, and <code class="inline"><span class="w">B::CV</span></code>
 objects</h2>
<p>For descriptions of the class hierarchy of these objects and the
methods that can be called on them, see below, <a href="#OVERVIEW-OF-CLASSES">OVERVIEW OF CLASSES</a> and <a href="#SV-RELATED-CLASSES">SV-RELATED CLASSES</a>.</p>
<ul>
<li><a name="sv_undef"></a><b>sv_undef</b>
<p>Returns the SV object corresponding to the C variable <code class="inline"><span class="w">sv_undef</span></code>
.</p>
</li>
<li><a name="sv_yes"></a><b>sv_yes</b>
<p>Returns the SV object corresponding to the C variable <code class="inline"><span class="w">sv_yes</span></code>
.</p>
</li>
<li><a name="sv_no"></a><b>sv_no</b>
<p>Returns the SV object corresponding to the C variable <code class="inline"><span class="w">sv_no</span></code>
.</p>
</li>
<li><a name="svref_2object(SVREF)"></a><b>svref_2object(SVREF)</b>
<p>Takes a reference to any Perl value, and turns the referred-to value
into an object in the appropriate B::OP-derived or B::SV-derived
class.  Apart from functions such as <code class="inline"><span class="w">main_root</span></code>
, this is the primary
way to get an initial "handle" on an internal perl data structure
which can then be followed with the other access methods.</p>
<p>The returned object will only be valid as long as the underlying OPs
and SVs continue to exist.  Do not attempt to use the object after the
underlying structures are freed.</p>
</li>
<li><a name="amagic_generation"></a><b>amagic_generation</b>
<p>Returns the SV object corresponding to the C variable <code class="inline"><span class="w">amagic_generation</span></code>
.
As of Perl 5.18, this is just an alias to <code class="inline"><span class="w">PL_na</span></code>
, so its value is
meaningless.</p>
</li>
<li><a name="init_av"></a><b>init_av</b>
<p>Returns the AV object (i.e. in class B::AV) representing INIT blocks.</p>
</li>
<li><a name="check_av"></a><b>check_av</b>
<p>Returns the AV object (i.e. in class B::AV) representing CHECK blocks.</p>
</li>
<li><a name="unitcheck_av"></a><b>unitcheck_av</b>
<p>Returns the AV object (i.e. in class B::AV) representing UNITCHECK blocks.</p>
</li>
<li><a name="begin_av"></a><b>begin_av</b>
<p>Returns the AV object (i.e. in class B::AV) representing BEGIN blocks.</p>
</li>
<li><a name="end_av"></a><b>end_av</b>
<p>Returns the AV object (i.e. in class B::AV) representing END blocks.</p>
</li>
<li><a name="comppadlist"></a><b>comppadlist</b>
<p>Returns the PADLIST object (i.e. in class B::PADLIST) of the global
comppadlist.  In Perl 5.16 and earlier it returns an AV object (class
B::AV).</p>
</li>
<li><a name="regex_padav"></a><b>regex_padav</b>
<p>Only when perl was compiled with ithreads.</p>
</li>
<li><a name="main_cv"></a><b>main_cv</b>
<p>Return the (faked) CV corresponding to the main part of the Perl
program.</p>
</li>
</ul>
<a name="Functions-for-Examining-the-Symbol-Table"></a><h2>Functions for Examining the Symbol Table</h2>
<ul>
<li><a name="walksymtable(SYMREF%2c-METHOD%2c-RECURSE%2c-PREFIX)"></a><b>walksymtable(SYMREF, METHOD, RECURSE, PREFIX)</b>
<p>Walk the symbol table starting at SYMREF and call METHOD on each
symbol (a B::GV object) visited.  When the walk reaches package
symbols (such as "Foo::") it invokes RECURSE, passing in the symbol
name, and only recurses into the package if that sub returns true.</p>
<p>PREFIX is the name of the SYMREF you're walking.</p>
<p>For example:</p>
<pre class="verbatim"><ol><li>  <span class="c"># Walk CGI&#39;s symbol table calling print_subs on each symbol.</span></li><li>  <span class="c"># Recurse only into CGI::Util::</span></li><li>  <span class="i">walksymtable</span><span class="s">(</span>\<span class="i">%CGI::</span><span class="cm">,</span> <span class="q">&#39;print_subs&#39;</span><span class="cm">,</span></li><li>               <a class="l_k" href="functions/sub.html">sub</a> <span class="s">{</span> <span class="i">$_</span>[<span class="n">0</span>] <a class="l_k" href="functions/eq.html">eq</a> <span class="q">&#39;CGI::Util::&#39;</span> <span class="s">}</span><span class="cm">,</span> <span class="q">&#39;CGI::&#39;</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>print_subs() is a B::GV method you have declared.  Also see <a href="#B%3a%3aGV-Methods">B::GV Methods</a>, below.</p>
</li>
</ul>
<a name="Functions-Returning-B%3a%3aOP-objects-or-for-walking-op-trees"></a><h2>Functions Returning <code class="inline"><span class="w">B::OP</span></code>
 objects or for walking op trees</h2>
<p>For descriptions of the class hierarchy of these objects and the
methods that can be called on them, see below, <a href="#OVERVIEW-OF-CLASSES">OVERVIEW OF CLASSES</a> and <a href="#OP-RELATED-CLASSES">OP-RELATED CLASSES</a>.</p>
<ul>
<li><a name="main_root"></a><b>main_root</b>
<p>Returns the root op (i.e. an object in the appropriate B::OP-derived
class) of the main part of the Perl program.</p>
</li>
<li><a name="main_start"></a><b>main_start</b>
<p>Returns the starting op of the main part of the Perl program.</p>
</li>
<li><a name="walkoptree(OP%2c-METHOD)"></a><b>walkoptree(OP, METHOD)</b>
<p>Does a tree-walk of the syntax tree based at OP and calls METHOD on
each op it visits.  Each node is visited before its children.  If
<code class="inline"><span class="w">walkoptree_debug</span></code>
 (see below) has been called to turn debugging on then
the method <code class="inline"><span class="w">walkoptree_debug</span></code>
 is called on each op before METHOD is
called.</p>
</li>
<li><a name="walkoptree_debug(DEBUG)"></a><b>walkoptree_debug(DEBUG)</b>
<p>Returns the current debugging flag for <code class="inline"><span class="w">walkoptree</span></code>
.  If the optional
DEBUG argument is non-zero, it sets the debugging flag to that.  See
the description of <code class="inline"><span class="w">walkoptree</span></code>
 above for what the debugging flag
does.</p>
</li>
</ul>
<a name="Miscellaneous-Utility-Functions"></a><h2>Miscellaneous Utility Functions</h2>
<ul>
<li><a name="ppname(OPNUM)"></a><b>ppname(OPNUM)</b>
<p>Return the PP function name (e.g. "pp_add") of op number OPNUM.</p>
</li>
<li><a name="hash(STR)"></a><b>hash(STR)</b>
<p>Returns a string in the form "0x..." representing the value of the
internal hash function used by perl on string STR.</p>
</li>
<li><a name="cast_I32(I)"></a><b>cast_I32(I)</b>
<p>Casts I to the internal I32 type used by that perl.</p>
</li>
<li><a name="minus_c"></a><b>minus_c</b>
<p>Does the equivalent of the <code class="inline">-c</code>
 command-line option.  Obviously, this
is only useful in a BEGIN block or else the flag is set too late.</p>
</li>
<li><a name="cstring(STR)"></a><b>cstring(STR)</b>
<p>Returns a double-quote-surrounded escaped version of STR which can
be used as a string in C source code.</p>
</li>
<li><a name="perlstring(STR)"></a><b>perlstring(STR)</b>
<p>Returns a double-quote-surrounded escaped version of STR which can
be used as a string in Perl source code.</p>
</li>
<li><a name="safename(STR)"></a><b>safename(STR)</b>
<p>This function returns the string with the first character modified if it
is a control character.  It converts it to ^X format first, so that "\cG"
becomes "^G".  This is used internally by <a href="#SAFENAME">B::GV::SAFENAME</a>, but
you can call it directly.</p>
</li>
<li><a name="class(OBJ)"></a><b>class(OBJ)</b>
<p>Returns the class of an object without the part of the classname
preceding the first <code class="inline"><span class="q">&quot;::&quot;</span></code>
.  This is used to turn <code class="inline"><span class="q">&quot;B::UNOP&quot;</span></code>
 into
<code class="inline"><span class="q">&quot;UNOP&quot;</span></code>
 for example.</p>
</li>
<li><a name="threadsv_names"></a><b>threadsv_names</b>
<p>This used to provide support for the old 5.005 threading module. It now
does nothing.</p>
</li>
</ul>
<a name="Exported-utility-variables"></a><h2>Exported utility variables</h2>
<ul>
<li><a name="%40optype"></a><b>@optype</b>
<pre class="verbatim"><ol><li>  <a class="l_k" href="functions/my.html">my</a> <span class="i">$op_type</span> = <span class="i">$optype</span>[<span class="i">$op_type_num</span>]<span class="sc">;</span></li></ol></pre><p>A simple mapping of the op type number to its type (like 'COP' or 'BINOP').</p>
</li>
<li><a name="%40specialsv_name"></a><b>@specialsv_name</b>
<pre class="verbatim"><ol><li>  <a class="l_k" href="functions/my.html">my</a> <span class="i">$sv_name</span> = <span class="i">$specialsv_name</span>[<span class="i">$sv_index</span>]<span class="sc">;</span></li></ol></pre><p>Certain SV types are considered 'special'.  They're represented by
B::SPECIAL and are referred to by a number from the specialsv_list.
This array maps that number back to the name of the SV (like 'Nullsv'
or '&amp;PL_sv_undef').</p>
</li>
</ul>
<a name="OVERVIEW-OF-CLASSES"></a><h1>OVERVIEW OF CLASSES</h1>
<p>The C structures used by Perl's internals to hold SV and OP
information (PVIV, AV, HV, ..., OP, SVOP, UNOP, ...) are modelled on a
class hierarchy and the <code class="inline"><span class="w">B</span></code>
 module gives access to them via a true
object hierarchy.  Structure fields which point to other objects
(whether types of SV or types of OP) are represented by the <code class="inline"><span class="w">B</span></code>

module as Perl objects of the appropriate class.</p>
<p>The bulk of the <code class="inline"><span class="w">B</span></code>
 module is the methods for accessing fields of
these structures.</p>
<p>Note that all access is read-only.  You cannot modify the internals by
using this module.  Also, note that the B::OP and B::SV objects created
by this module are only valid for as long as the underlying objects
exist; their creation doesn't increase the reference counts of the
underlying objects.  Trying to access the fields of a freed object will
give incomprehensible results, or worse.</p>
<a name="SV-RELATED-CLASSES"></a><h2>SV-RELATED CLASSES</h2>
<p>B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM (5.9.5 and
earlier), B::PVLV, B::AV, B::HV, B::CV, B::GV, B::FM, B::IO.  These classes
correspond in the obvious way to the underlying C structures of similar names.
The inheritance hierarchy mimics the underlying C "inheritance".  For the
5.10.x branch, (<i>ie</i> 5.10.0, 5.10.1 <i>etc</i>) this is:</p>
<pre class="verbatim"><ol><li>                           B::SV</li><li>                             |</li><li>                +------------+------------+------------+</li><li>                |            |            |            |</li><li>              B::PV        B::IV        B::NV        B::RV</li><li>                  \         /           /</li><li>                   \       /           /</li><li>                    B::PVIV           /</li><li>                         \           /</li><li>                          \         /</li><li>                           \       /</li><li>                            B::PVNV</li><li>                               |</li><li>                               |</li><li>                            B::PVMG</li><li>                               |</li><li>                   +-----+-----+-----+-----+</li><li>                   |     |     |     |     |</li><li>                 B::AV B::GV B::HV B::CV B::IO</li><li>                         |           |</li><li>                         |           |</li><li>                      B::PVLV      B::FM</li></ol></pre><p>For 5.9.0 and earlier, PVLV is a direct subclass of PVMG, and BM is still
present as a distinct type, so the base of this diagram is</p>
<pre class="verbatim"><ol><li>                               |</li><li>                               |</li><li>                            B::PVMG</li><li>                               |</li><li>            +------+-----+-----+-----+-----+-----+</li><li>            |      |     |     |     |     |     |</li><li>         B::PVLV B::BM B::AV B::GV B::HV B::CV B::IO</li><li>                                           |</li><li>                                           |</li><li>                                         B::FM</li></ol></pre><p>For 5.11.0 and later, B::RV is abolished, and IVs can be used to store
references, and a new type B::REGEXP is introduced, giving this structure:</p>
<pre class="verbatim"><ol><li>                           B::SV</li><li>                             |</li><li>                +------------+------------+</li><li>                |            |            |</li><li>              B::PV        B::IV        B::NV</li><li>                  \         /           /</li><li>                   \       /           /</li><li>                    B::PVIV           /</li><li>                         \           /</li><li>                          \         /</li><li>                           \       /</li><li>                            B::PVNV</li><li>                               |</li><li>                               |</li><li>                            B::PVMG</li><li>                               |</li><li>           +-------+-------+---+---+-------+-------+</li><li>           |       |       |       |       |       |</li><li>         B::AV   B::GV   B::HV   B::CV   B::IO B::REGEXP</li><li>                   |               |</li><li>                   |               |</li><li>                B::PVLV          B::FM</li></ol></pre><p>Access methods correspond to the underlying C macros for field access,
usually with the leading "class indication" prefix removed (Sv, Av,
Hv, ...).  The leading prefix is only left in cases where its removal
would cause a clash in method name.  For example, <code class="inline"><span class="w">GvREFCNT</span></code>
 stays
as-is since its abbreviation would clash with the "superclass" method
<code class="inline"><span class="w">REFCNT</span></code>
 (corresponding to the C function <code class="inline"><span class="w">SvREFCNT</span></code>
).</p>
<a name="B%3a%3aSV-Methods"></a><h2>B::SV Methods</h2>
<ul>
<li><a name="REFCNT"></a><b>REFCNT</b>
</li>
<li><a name="FLAGS"></a><b>FLAGS</b>
</li>
<li><a name="object_2svref"></a><b>object_2svref</b>
<p>Returns a reference to the regular scalar corresponding to this
B::SV object.  In other words, this method is the inverse operation
to the svref_2object() subroutine.  This scalar and other data it points
at should be considered read-only: modifying them is neither safe nor
guaranteed to have a sensible effect.</p>
</li>
</ul>
<a name="B%3a%3aIV-Methods"></a><h2>B::IV Methods</h2>
<ul>
<li><a name="IV"></a><b>IV</b>
<p>Returns the value of the IV, <i>interpreted as
a signed integer</i>.  This will be misleading
if <code class="inline"><span class="w">FLAGS</span> <span class="i">&amp; SVf_IVisUV</span></code>
.  Perhaps you want the
<code class="inline"><span class="w">int_value</span></code>
 method instead?</p>
</li>
<li><a name="IVX"></a><b>IVX</b>
</li>
<li><a name="UVX"></a><b>UVX</b>
</li>
<li><a name="int_value"></a><b>int_value</b>
<p>This method returns the value of the IV as an integer.
It differs from <code class="inline"><span class="w">IV</span></code>
 in that it returns the correct
value regardless of whether it's stored signed or
unsigned.</p>
</li>
<li><a name="needs64bits"></a><b>needs64bits</b>
</li>
<li><a name="packiv"></a><b>packiv</b>
</li>
</ul>
<a name="B%3a%3aNV-Methods"></a><h2>B::NV Methods</h2>
<ul>
<li><a name="NV"></a><b>NV</b>
</li>
<li><a name="NVX"></a><b>NVX</b>
</li>
<li><a name="COP_SEQ_RANGE_LOW"></a><b>COP_SEQ_RANGE_LOW</b>
</li>
<li><a name="COP_SEQ_RANGE_HIGH"></a><b>COP_SEQ_RANGE_HIGH</b>
<p>These last two are only valid for pad name SVs.  They only existed in the
B::NV class before Perl 5.22.  In 5.22 they were moved to the B::PADNAME
class.</p>
</li>
</ul>
<a name="B%3a%3aRV-Methods"></a><h2>B::RV Methods</h2>
<ul>
<li><a name="RV"></a><b>RV</b>
</li>
</ul>
<a name="B%3a%3aPV-Methods"></a><h2>B::PV Methods</h2>
<ul>
<li><a name="PV"></a><b>PV</b>
<p>This method is the one you usually want.  It constructs a
string using the length and offset information in the struct:
for ordinary scalars it will return the string that you'd see
from Perl, even if it contains null characters.</p>
</li>
<li><a name="RV"></a><b>RV</b>
<p>Same as B::RV::RV, except that it will die() if the PV isn't
a reference.</p>
</li>
<li><a name="PVX"></a><b>PVX</b>
<p>This method is less often useful.  It assumes that the string
stored in the struct is null-terminated, and disregards the
length information.</p>
<p>It is the appropriate method to use if you need to get the name
of a lexical variable from a padname array.  Lexical variable names
are always stored with a null terminator, and the length field
(CUR) is overloaded for other purposes and can't be relied on here.</p>
</li>
<li><a name="CUR"></a><b>CUR</b>
<p>This method returns the internal length field, which consists of the number
of internal bytes, not necessarily the number of logical characters.</p>
</li>
<li><a name="LEN"></a><b>LEN</b>
<p>This method returns the number of bytes allocated (via malloc) for storing
the string.  This is 0 if the scalar does not "own" the string.</p>
</li>
</ul>
<a name="B%3a%3aPVMG-Methods"></a><h2>B::PVMG Methods</h2>
<ul>
<li><a name="MAGIC"></a><b>MAGIC</b>
</li>
<li><a name="SvSTASH"></a><b>SvSTASH</b>
</li>
</ul>
<a name="B%3a%3aMAGIC-Methods"></a><h2>B::MAGIC Methods</h2>
<ul>
<li><a name="MOREMAGIC"></a><b>MOREMAGIC</b>
</li>
<li><a name="precomp"></a><b>precomp</b>
<p>Only valid on r-magic, returns the string that generated the regexp.</p>
</li>
<li><a name="PRIVATE"></a><b>PRIVATE</b>
</li>
<li><a name="TYPE"></a><b>TYPE</b>
</li>
<li><a name="FLAGS"></a><b>FLAGS</b>
</li>
<li><a name="OBJ"></a><b>OBJ</b>
<p>Will die() if called on r-magic.</p>
</li>
<li><a name="PTR"></a><b>PTR</b>
</li>
<li><a name="REGEX"></a><b>REGEX</b>
<p>Only valid on r-magic, returns the integer value of the REGEX stored
in the MAGIC.</p>
</li>
</ul>
<a name="B%3a%3aPVLV-Methods"></a><h2>B::PVLV Methods</h2>
<ul>
<li><a name="TARGOFF"></a><b>TARGOFF</b>
</li>
<li><a name="TARGLEN"></a><b>TARGLEN</b>
</li>
<li><a name="TYPE"></a><b>TYPE</b>
</li>
<li><a name="TARG"></a><b>TARG</b>
</li>
</ul>
<a name="B%3a%3aBM-Methods"></a><h2>B::BM Methods</h2>
<ul>
<li><a name="USEFUL"></a><b>USEFUL</b>
</li>
<li><a name="PREVIOUS"></a><b>PREVIOUS</b>
</li>
<li><a name="RARE"></a><b>RARE</b>
</li>
<li><a name="TABLE"></a><b>TABLE</b>
</li>
</ul>
<a name="B%3a%3aREGEXP-Methods"></a><h2>B::REGEXP Methods</h2>
<ul>
<li><a name="REGEX"></a><b>REGEX</b>
</li>
<li><a name="precomp"></a><b>precomp</b>
</li>
<li><a name="qr_anoncv"></a><b>qr_anoncv</b>
</li>
<li><a name="compflags"></a><b>compflags</b>
<p>The last two were added in Perl 5.22.</p>
</li>
</ul>
<a name="B%3a%3aGV-Methods"></a><h2>B::GV Methods</h2>
<ul>
<li><a name="is_empty"></a><b>is_empty</b>
<p>This method returns TRUE if the GP field of the GV is NULL.</p>
</li>
<li><a name="NAME"></a><b>NAME</b>
</li>
<li><a name="SAFENAME"></a><b>SAFENAME</b>
<p>This method returns the name of the glob, but if the first
character of the name is a control character, then it converts
it to ^X first, so that *^G would return "^G" rather than "\cG".</p>
<p>It's useful if you want to print out the name of a variable.
If you restrict yourself to globs which exist at compile-time
then the result ought to be unambiguous, because code like
<code class="inline"><span class="i">$</span>{<span class="q">&quot;^G&quot;</span>} = <span class="n">1</span></code>
 is compiled as two ops - a constant string and
a dereference (rv2gv) - so that the glob is created at runtime.</p>
<p>If you're working with globs at runtime, and need to disambiguate
*^G from *{"^G"}, then you should use the raw NAME method.</p>
</li>
<li><a name="STASH"></a><b>STASH</b>
</li>
<li><a name="SV"></a><b>SV</b>
</li>
<li><a name="IO"></a><b>IO</b>
</li>
<li><a name="FORM"></a><b>FORM</b>
</li>
<li><a name="AV"></a><b>AV</b>
</li>
<li><a name="HV"></a><b>HV</b>
</li>
<li><a name="EGV"></a><b>EGV</b>
</li>
<li><a name="CV"></a><b>CV</b>
</li>
<li><a name="CVGEN"></a><b>CVGEN</b>
</li>
<li><a name="LINE"></a><b>LINE</b>
</li>
<li><a name="FILE"></a><b>FILE</b>
</li>
<li><a name="FILEGV"></a><b>FILEGV</b>
</li>
<li><a name="GvREFCNT"></a><b>GvREFCNT</b>
</li>
<li><a name="FLAGS"></a><b>FLAGS</b>
</li>
<li><a name="GPFLAGS"></a><b>GPFLAGS</b>
<p>This last one is present only in perl 5.22.0 and higher.</p>
</li>
</ul>
<a name="B%3a%3aIO-Methods"></a><h2>B::IO Methods</h2>
<p>B::IO objects derive from IO objects and you will get more information from
the IO object itself.</p>
<p>For example:</p>
<pre class="verbatim"><ol><li>  <span class="i">$gvio</span> = <span class="i">B::svref_2object</span><span class="s">(</span>\<span class="i">*main::stdin</span><span class="s">)</span><span class="i">-&gt;IO</span><span class="sc">;</span></li><li>  <span class="i">$IO</span> = <span class="i">$gvio</span><span class="i">-&gt;object_2svref</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="i">$fd</span> = <span class="i">$IO</span><span class="i">-&gt;fileno</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><ul>
<li><a name="LINES"></a><b>LINES</b>
</li>
<li><a name="PAGE"></a><b>PAGE</b>
</li>
<li><a name="PAGE_LEN"></a><b>PAGE_LEN</b>
</li>
<li><a name="LINES_LEFT"></a><b>LINES_LEFT</b>
</li>
<li><a name="TOP_NAME"></a><b>TOP_NAME</b>
</li>
<li><a name="TOP_GV"></a><b>TOP_GV</b>
</li>
<li><a name="FMT_NAME"></a><b>FMT_NAME</b>
</li>
<li><a name="FMT_GV"></a><b>FMT_GV</b>
</li>
<li><a name="BOTTOM_NAME"></a><b>BOTTOM_NAME</b>
</li>
<li><a name="BOTTOM_GV"></a><b>BOTTOM_GV</b>
</li>
<li><a name="SUBPROCESS"></a><b>SUBPROCESS</b>
</li>
<li><a name="IoTYPE"></a><b>IoTYPE</b>
<p>A character symbolizing the type of IO Handle.</p>
<pre class="verbatim"><ol><li>  -     <span class="w">STDIN</span>/<span class="w">OUT</span></li><li>  <span class="w">I</span>     <span class="w">STDIN</span>/<span class="w">OUT</span>/<span class="w">ERR</span></li><li>  &lt;     <a class="l_k" href="functions/read.html">read</a>-<span class="w">only</span></li><li>  &gt;     <a class="l_k" href="functions/write.html">write</a>-<span class="w">only</span></li><li>  <span class="w">a</span>     <span class="w">append</span></li><li>  +     <a class="l_k" href="functions/read.html">read</a> <a class="l_k" href="functions/and.html">and</a> <a class="l_k" href="functions/write.html">write</a></li><li>  <span class="q">s     socket</span></li><li>  <span class="q">  |     pipe</span></li><li>  <span class="q">  I     IMPLICIT</span></li><li>  <span class="q">  #     NUMERIC</span></li><li>  <span class="q">  space closed</span> <span class="w">handle</span></li><li>  \<span class="n">0</span>    <span class="w">closed</span> <span class="w">internal</span> <span class="w">handle</span></li></ol></pre></li>
<li><a name="IoFLAGS"></a><b>IoFLAGS</b>
</li>
<li><a name="IsSTD"></a><b>IsSTD</b>
<p>Takes one argument ( 'stdin' | 'stdout' | 'stderr' ) and returns true
if the IoIFP of the object is equal to the handle whose name was
passed as argument; i.e., $io-&gt;IsSTD('stderr') is true if
IoIFP($io) == PerlIO_stderr().</p>
</li>
</ul>
<a name="B%3a%3aAV-Methods"></a><h2>B::AV Methods</h2>
<ul>
<li><a name="FILL"></a><b>FILL</b>
</li>
<li><a name="MAX"></a><b>MAX</b>
</li>
<li><a name="ARRAY"></a><b>ARRAY</b>
</li>
<li><a name="ARRAYelt"></a><b>ARRAYelt</b>
<p>Like <code class="inline"><span class="w">ARRAY</span></code>
, but takes an index as an argument to get only one element,
rather than a list of all of them.</p>
</li>
<li><a name="OFF"></a><b>OFF</b>
<p>This method is deprecated if running under Perl 5.8, and is no longer present
if running under Perl 5.9</p>
</li>
<li><a name="AvFLAGS"></a><b>AvFLAGS</b>
<p>This method returns the AV specific
flags.  In Perl 5.9 these are now stored
in with the main SV flags, so this method is no longer present.</p>
</li>
</ul>
<a name="B%3a%3aCV-Methods"></a><h2>B::CV Methods</h2>
<ul>
<li><a name="STASH"></a><b>STASH</b>
</li>
<li><a name="START"></a><b>START</b>
</li>
<li><a name="ROOT"></a><b>ROOT</b>
</li>
<li><a name="GV"></a><b>GV</b>
</li>
<li><a name="FILE"></a><b>FILE</b>
</li>
<li><a name="DEPTH"></a><b>DEPTH</b>
</li>
<li><a name="PADLIST"></a><b>PADLIST</b>
<p>Returns a B::PADLIST object under Perl 5.18 or higher, or a B::AV in
earlier versions.</p>
</li>
<li><a name="OUTSIDE"></a><b>OUTSIDE</b>
</li>
<li><a name="OUTSIDE_SEQ"></a><b>OUTSIDE_SEQ</b>
</li>
<li><a name="XSUB"></a><b>XSUB</b>
</li>
<li><a name="XSUBANY"></a><b>XSUBANY</b>
<p>For constant subroutines, returns the constant SV returned by the subroutine.</p>
</li>
<li><a name="CvFLAGS"></a><b>CvFLAGS</b>
</li>
<li><a name="const_sv"></a><b>const_sv</b>
</li>
<li><a name="NAME_HEK"></a><b>NAME_HEK</b>
<p>Returns the name of a lexical sub, otherwise <code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code>.</p>
</li>
</ul>
<a name="B%3a%3aHV-Methods"></a><h2>B::HV Methods</h2>
<ul>
<li><a name="FILL"></a><b>FILL</b>
</li>
<li><a name="MAX"></a><b>MAX</b>
</li>
<li><a name="KEYS"></a><b>KEYS</b>
</li>
<li><a name="RITER"></a><b>RITER</b>
</li>
<li><a name="NAME"></a><b>NAME</b>
</li>
<li><a name="ARRAY"></a><b>ARRAY</b>
</li>
<li><a name="PMROOT"></a><b>PMROOT</b>
<p>This method is not present if running under Perl 5.9, as the PMROOT
information is no longer stored directly in the hash.</p>
</li>
</ul>
<a name="OP-RELATED-CLASSES"></a><h2>OP-RELATED CLASSES</h2>
<p><code class="inline"><span class="w">B::OP</span></code>
, <code class="inline"><span class="w">B::UNOP</span></code>
, <code class="inline"><span class="w">B::UNOP_AUX</span></code>
, <code class="inline"><span class="w">B::BINOP</span></code>
, <code class="inline"><span class="w">B::LOGOP</span></code>
,
<code class="inline"><span class="w">B::LISTOP</span></code>
, <code class="inline"><span class="w">B::PMOP</span></code>
, <code class="inline"><span class="w">B::SVOP</span></code>
, <code class="inline"><span class="w">B::PADOP</span></code>
, <code class="inline"><span class="w">B::PVOP</span></code>
, <code class="inline"><span class="w">B::LOOP</span></code>
,
<code class="inline"><span class="w">B::COP</span></code>
, <code class="inline"><span class="w">B::METHOP</span></code>
.</p>
<p>These classes correspond in the obvious way to the underlying C
structures of similar names.  The inheritance hierarchy mimics the
underlying C "inheritance":</p>
<pre class="verbatim"><ol><li>                                 <span class="w">B::OP</span></li><li>                                   |</li><li>                   +----------+---------+--------+-------+---------+</li><li>                   |          |         |        |       |         |</li><li>                <span class="w">B::UNOP</span>    <span class="w">B::SVOP</span>  <span class="w">B::PADOP</span>  <span class="w">B::COP</span>  <span class="w">B::PVOP</span>  <span class="w">B::METHOP</span></li><li>                   |</li><li>               +---+---+---------+</li><li>               |       |         |</li><li>           <span class="w">B::BINOP</span>  <span class="w">B::LOGOP</span>  <span class="w">B::UNOP_AUX</span></li><li>               |</li><li>               |</li><li>           <span class="w">B::LISTOP</span></li><li>               |</li><li>           +---+---+</li><li>           |       |</li><li>        <span class="w">B::LOOP</span>   <span class="w">B::PMOP</span></li></ol></pre><p>Access methods correspond to the underlying C structure field names,
with the leading "class indication" prefix (<code class="inline"><span class="q">&quot;op_&quot;</span></code>
) removed.</p>
<a name="B%3a%3aOP-Methods"></a><h2>B::OP Methods</h2>
<p>These methods get the values of similarly named fields within the OP
data structure.  See top of <code class="inline"><span class="w">op</span>.<span class="w">h</span></code>
 for more info.</p>
<ul>
<li><a name="next"></a><b>next</b>
</li>
<li><a name="sibling"></a><b>sibling</b>
</li>
<li><a name="parent"></a><b>parent</b>
<p>Returns the OP's parent. If it has no parent, or if your perl wasn't built
with <code class="inline">-<span class="w">DPERL_OP_PARENT</span></code>
, returns NULL.</p>
<p>Note that the global variable <code class="inline"><span class="i">$B::OP::does_parent</span></code>
 is undefined on older
perls that don't support the <code class="inline"><span class="w">parent</span></code>
 method, is defined but false on
perls that support the method but were built without  <code class="inline">-<span class="w">DPERL_OP_PARENT</span></code>
,
and is true otherwise.</p>
</li>
<li><a name="name"></a><b>name</b>
<p>This returns the op name as a string (e.g. "add", "rv2av").</p>
</li>
<li><a name="ppaddr"></a><b>ppaddr</b>
<p>This returns the function name as a string (e.g. "PL_ppaddr[OP_ADD]",
"PL_ppaddr[OP_RV2AV]").</p>
</li>
<li><a name="desc"></a><b>desc</b>
<p>This returns the op description from the global C PL_op_desc array
(e.g. "addition" "array deref").</p>
</li>
<li><a name="targ"></a><b>targ</b>
</li>
<li><a name="type"></a><b>type</b>
</li>
<li><a name="opt"></a><b>opt</b>
</li>
<li><a name="flags"></a><b>flags</b>
</li>
<li><a name="private"></a><b>private</b>
</li>
<li><a name="spare"></a><b>spare</b>
</li>
</ul>
<a name="B%3a%3aUNOP-Method"></a><h2>B::UNOP Method</h2>
<ul>
<li><a name="first"></a><b>first</b>
</li>
</ul>
<a name="B%3a%3aUNOP_AUX-Methods-(since-5.22)"></a><h2>B::UNOP_AUX Methods (since 5.22)</h2>
<ul>
<li><a name="aux_list(cv)"></a><b>aux_list(cv)</b>
<p>This returns a list of the elements of the op's aux data structure,
or a null list if there is no aux. What will be returned depends on the
object's type, but will typically be a collection of <code class="inline"><span class="w">B::IV</span></code>
, <code class="inline"><span class="w">B::GV</span></code>
,
etc. objects. <code class="inline"><span class="w">cv</span></code>
 is the <code class="inline"><span class="w">B::CV</span></code>
 object representing the sub that the
op is contained within.</p>
</li>
<li><a name="string(cv)"></a><b>string(cv)</b>
<p>This returns a textual representation of the object (likely to b useful
for deparsing and debugging), or an empty string if the op type doesn't
support this. <code class="inline"><span class="w">cv</span></code>
 is the <code class="inline"><span class="w">B::CV</span></code>
 object representing the sub that the
op is contained within.</p>
</li>
</ul>
<a name="B%3a%3aBINOP-Method"></a><h2>B::BINOP Method</h2>
<ul>
<li><a name="last"></a><b>last</b>
</li>
</ul>
<a name="B%3a%3aLOGOP-Method"></a><h2>B::LOGOP Method</h2>
<ul>
<li><a name="other"></a><b>other</b>
</li>
</ul>
<a name="B%3a%3aLISTOP-Method"></a><h2>B::LISTOP Method</h2>
<ul>
<li><a name="children"></a><b>children</b>
</li>
</ul>
<a name="B%3a%3aPMOP-Methods"></a><h2>B::PMOP Methods</h2>
<ul>
<li><a name="pmreplroot"></a><b>pmreplroot</b>
</li>
<li><a name="pmreplstart"></a><b>pmreplstart</b>
</li>
<li><a name="pmnext"></a><b>pmnext</b>
<p>Only up to Perl 5.9.4</p>
</li>
<li><a name="pmflags"></a><b>pmflags</b>
</li>
<li><a name="extflags"></a><b>extflags</b>
<p>Since Perl 5.9.5</p>
</li>
<li><a name="precomp"></a><b>precomp</b>
</li>
<li><a name="pmoffset"></a><b>pmoffset</b>
<p>Only when perl was compiled with ithreads.</p>
</li>
<li><a name="code_list"></a><b>code_list</b>
<p>Since perl 5.17.1</p>
</li>
<li><a name="pmregexp"></a><b>pmregexp</b>
<p>Added in perl 5.22, this method returns the B::REGEXP associated with the
op.  While PMOPs do not actually have <code class="inline"><span class="w">pmregexp</span></code>
 fields under threaded
builds, this method returns the regexp under threads nonetheless, for
convenience.</p>
</li>
</ul>
<a name="B%3a%3aSVOP-Methods"></a><h2>B::SVOP Methods</h2>
<ul>
<li><a name="sv"></a><b>sv</b>
</li>
<li><a name="gv"></a><b>gv</b>
</li>
</ul>
<a name="B%3a%3aPADOP-Method"></a><h2>B::PADOP Method</h2>
<ul>
<li><a name="padix"></a><b>padix</b>
</li>
</ul>
<a name="B%3a%3aPVOP-Method"></a><h2>B::PVOP Method</h2>
<ul>
<li><a name="pv"></a><b>pv</b>
</li>
</ul>
<a name="B%3a%3aLOOP-Methods"></a><h2>B::LOOP Methods</h2>
<ul>
<li><a name="redoop"></a><b>redoop</b>
</li>
<li><a name="nextop"></a><b>nextop</b>
</li>
<li><a name="lastop"></a><b>lastop</b>
</li>
</ul>
<a name="B%3a%3aCOP-Methods"></a><h2>B::COP Methods</h2>
<p>The <code class="inline"><span class="w">B::COP</span></code>
 class is used for "nextstate" and "dbstate" ops.  As of Perl
5.22, it is also used for "null" ops that started out as COPs.</p>
<ul>
<li><a name="label"></a><b>label</b>
</li>
<li><a name="stash"></a><b>stash</b>
</li>
<li><a name="stashpv"></a><b>stashpv</b>
</li>
<li><a name="stashoff-(threaded-only)"></a><b>stashoff (threaded only)</b>
</li>
<li><a name="file"></a><b>file</b>
</li>
<li><a name="cop_seq"></a><b>cop_seq</b>
</li>
<li><a name="arybase"></a><b>arybase</b>
</li>
<li><a name="line"></a><b>line</b>
</li>
<li><a name="warnings"></a><b>warnings</b>
</li>
<li><a name="io"></a><b>io</b>
</li>
<li><a name="hints"></a><b>hints</b>
</li>
<li><a name="hints_hash"></a><b>hints_hash</b>
</li>
</ul>
<a name="B%3a%3aMETHOP-Methods-(Since-Perl-5.22)"></a><h2>B::METHOP Methods (Since Perl 5.22)</h2>
<ul>
<li><a name="first"></a><b>first</b>
</li>
<li><a name="meth_sv"></a><b>meth_sv</b>
</li>
</ul>
<a name="PAD-RELATED-CLASSES"></a><h2>PAD-RELATED CLASSES</h2>
<p>Perl 5.18 introduced a new class, B::PADLIST, returned by B::CV's
<code class="inline"><span class="w">PADLIST</span></code>
 method.</p>
<p>Perl 5.22 introduced the B::PADNAMELIST and B::PADNAME classes.</p>
<a name="B%3a%3aPADLIST-Methods"></a><h2>B::PADLIST Methods</h2>
<ul>
<li><a name="MAX"></a><b>MAX</b>
</li>
<li><a name="ARRAY"></a><b>ARRAY</b>
<p>A list of pads.  The first one contains the names.</p>
<p>The first one is a B::PADNAMELIST under Perl 5.22, and a B::AV under
earlier versions.  The rest are currently B::AV objects, but that could
change in future versions.</p>
</li>
<li><a name="ARRAYelt"></a><b>ARRAYelt</b>
<p>Like <code class="inline"><span class="w">ARRAY</span></code>
, but takes an index as an argument to get only one element,
rather than a list of all of them.</p>
</li>
<li><a name="NAMES"></a><b>NAMES</b>
<p>This method, introduced in 5.22, returns the B::PADNAMELIST.  It is
equivalent to <code class="inline"><span class="w">ARRAYelt</span></code>
 with a 0 argument.</p>
</li>
<li><a name="REFCNT"></a><b>REFCNT</b>
</li>
<li><a name="id"></a><b>id</b>
<p>This method, introduced in 5.22, returns an ID shared by clones of the same
padlist.</p>
</li>
<li><a name="outid"></a><b>outid</b>
<p>This method, also added in 5.22, returns the ID of the outer padlist.</p>
</li>
</ul>
<a name="B%3a%3aPADNAMELIST-Methods"></a><h2>B::PADNAMELIST Methods</h2>
<ul>
<li><a name="MAX"></a><b>MAX</b>
</li>
<li><a name="ARRAY"></a><b>ARRAY</b>
</li>
<li><a name="ARRAYelt"></a><b>ARRAYelt</b>
<p>These two methods return the pad names, using B::SPECIAL objects for null
pointers and B::PADNAME objects otherwise.</p>
</li>
<li><a name="REFCNT"></a><b>REFCNT</b>
</li>
</ul>
<a name="B%3a%3aPADNAME-Methods"></a><h2>B::PADNAME Methods</h2>
<ul>
<li><a name="PV"></a><b>PV</b>
</li>
<li><a name="PVX"></a><b>PVX</b>
</li>
<li><a name="LEN"></a><b>LEN</b>
</li>
<li><a name="REFCNT"></a><b>REFCNT</b>
</li>
<li><a name="FLAGS"></a><b>FLAGS</b>
<p>For backward-compatibility, if the PADNAMEt_OUTER flag is set, the FLAGS
method adds the SVf_FAKE flag, too.</p>
</li>
<li><a name="TYPE"></a><b>TYPE</b>
<p>A B::HV object representing the stash for a typed lexical.</p>
</li>
<li><a name="SvSTASH"></a><b>SvSTASH</b>
<p>A backward-compatibility alias for TYPE.</p>
</li>
<li><a name="OURSTASH"></a><b>OURSTASH</b>
<p>A B::HV object representing the stash for 'our' variables.</p>
</li>
<li><a name="PROTOCV"></a><b>PROTOCV</b>
<p>The prototype CV for a 'my' sub.</p>
</li>
<li><a name="COP_SEQ_RANGE_LOW"></a><b>COP_SEQ_RANGE_LOW</b>
</li>
<li><a name="COP_SEQ_RANGE_HIGH"></a><b>COP_SEQ_RANGE_HIGH</b>
<p>Sequence numbers representing the scope within which a lexical is visible.
Meaningless if PADNAMEt_OUTER is set.</p>
</li>
<li><a name="PARENT_PAD_INDEX"></a><b>PARENT_PAD_INDEX</b>
<p>Only meaningful if PADNAMEt_OUTER is set.</p>
</li>
<li><a name="PARENT_FAKELEX_FLAGS"></a><b>PARENT_FAKELEX_FLAGS</b>
<p>Only meaningful if PADNAMEt_OUTER is set.</p>
</li>
</ul>
<a name="%24B%3a%3aoverlay"></a><h2>$B::overlay</h2>
<p>Although the optree is read-only, there is an overlay facility that allows
you to override what values the various B::*OP methods return for a
particular op. <code class="inline"><span class="i">$B::overlay</span></code>
 should be set to reference a two-deep hash:
indexed by OP address, then method name. Whenever a an op method is
called, the value in the hash is returned if it exists. This facility is
used by B::Deparse to "undo" some optimisations. For example:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$B::overlay</span> = <span class="s">{</span><span class="s">}</span><span class="sc">;</span></li><li>    ...</li><li>    <a class="l_k" href="functions/if.html">if</a> <span class="s">(</span><span class="i">$op</span><span class="i">-&gt;name</span> <a class="l_k" href="functions/eq.html">eq</a> <span class="q">&quot;foo&quot;</span><span class="s">)</span> <span class="s">{</span></li><li>        <span class="i">$B::overlay</span>-&gt;{<span class="i">$$op</span>} = <span class="s">{</span></li><li>                <span class="w">name</span> <span class="cm">=&gt;</span> <span class="q">&#39;bar&#39;</span><span class="cm">,</span></li><li>                <span class="w">next</span> <span class="cm">=&gt;</span> <span class="i">$op</span><span class="i">-&gt;next</span><span class="i">-&gt;next</span><span class="cm">,</span></li><li>        <span class="s">}</span><span class="sc">;</span></li><li>    <span class="s">}</span></li><li>    ...</li><li>    <span class="i">$op</span><span class="i">-&gt;name</span> <span class="c"># returns &quot;bar&quot;</span></li><li>    <span class="i">$op</span><span class="i">-&gt;next</span> <span class="c"># returns the next op but one</span></li></ol></pre><a name="AUTHOR"></a><h1>AUTHOR</h1>
<p>Malcolm Beattie, <code class="inline"><span class="w">mbeattie</span><span class="i">@sable</span>.<span class="w">ox</span>.<span class="w">ac</span>.<span class="w">uk</span></code>
</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="#OVERVIEW">OVERVIEW</a><li><a href="#Utility-Functions">Utility Functions</a><ul><li><a href="#Functions-Returning-B%3a%3aSV%2c-B%3a%3aAV%2c-B%3a%3aHV%2c-and-B%3a%3aCV-objects">Functions Returning B::SV, B::AV, B::HV, and B::CV objects</a><li><a href="#Functions-for-Examining-the-Symbol-Table">Functions for Examining the Symbol Table</a><li><a href="#Functions-Returning-B%3a%3aOP-objects-or-for-walking-op-trees">Functions Returning B::OP objects or for walking op trees</a><li><a href="#Miscellaneous-Utility-Functions">Miscellaneous Utility Functions</a><li><a href="#Exported-utility-variables">Exported utility variables</a></ul><li><a href="#OVERVIEW-OF-CLASSES">OVERVIEW OF CLASSES</a><ul><li><a href="#SV-RELATED-CLASSES">SV-RELATED CLASSES</a><li><a href="#B%3a%3aSV-Methods">B::SV Methods</a><li><a href="#B%3a%3aIV-Methods">B::IV Methods</a><li><a href="#B%3a%3aNV-Methods">B::NV Methods</a><li><a href="#B%3a%3aRV-Methods">B::RV Methods</a><li><a href="#B%3a%3aPV-Methods">B::PV Methods</a><li><a href="#B%3a%3aPVMG-Methods">B::PVMG Methods</a><li><a href="#B%3a%3aMAGIC-Methods">B::MAGIC Methods</a><li><a href="#B%3a%3aPVLV-Methods">B::PVLV Methods</a><li><a href="#B%3a%3aBM-Methods">B::BM Methods</a><li><a href="#B%3a%3aREGEXP-Methods">B::REGEXP Methods</a><li><a href="#B%3a%3aGV-Methods">B::GV Methods</a><li><a href="#B%3a%3aIO-Methods">B::IO Methods</a><li><a href="#B%3a%3aAV-Methods">B::AV Methods</a><li><a href="#B%3a%3aCV-Methods">B::CV Methods</a><li><a href="#B%3a%3aHV-Methods">B::HV Methods</a><li><a href="#OP-RELATED-CLASSES">OP-RELATED CLASSES</a><li><a href="#B%3a%3aOP-Methods">B::OP Methods</a><li><a href="#B%3a%3aUNOP-Method">B::UNOP Method</a><li><a href="#B%3a%3aUNOP_AUX-Methods-(since-5.22)">B::UNOP_AUX Methods (since 5.22)</a><li><a href="#B%3a%3aBINOP-Method">B::BINOP Method</a><li><a href="#B%3a%3aLOGOP-Method">B::LOGOP Method</a><li><a href="#B%3a%3aLISTOP-Method">B::LISTOP Method</a><li><a href="#B%3a%3aPMOP-Methods">B::PMOP Methods</a><li><a href="#B%3a%3aSVOP-Methods">B::SVOP Methods</a><li><a href="#B%3a%3aPADOP-Method">B::PADOP Method</a><li><a href="#B%3a%3aPVOP-Method">B::PVOP Method</a><li><a href="#B%3a%3aLOOP-Methods">B::LOOP Methods</a><li><a href="#B%3a%3aCOP-Methods">B::COP Methods</a><li><a href="#B%3a%3aMETHOP-Methods-(Since-Perl-5.22)">B::METHOP Methods (Since Perl 5.22)</a><li><a href="#PAD-RELATED-CLASSES">PAD-RELATED CLASSES</a><li><a href="#B%3a%3aPADLIST-Methods">B::PADLIST Methods</a><li><a href="#B%3a%3aPADNAMELIST-Methods">B::PADNAMELIST Methods</a><li><a href="#B%3a%3aPADNAME-Methods">B::PADNAME Methods</a><li><a href="#%24B%3a%3aoverlay">$B::overlay</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(0);
  perldoc.pageName    = 'B';
  perldoc.pageAddress = 'B.html';
  perldoc.contentPage = 1;
  explorePerl.render();
  explorePerl.addEvents('explore_anchor');
</script>
    
  </body>
</html>