File: Opcode.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 (707 lines) | stat: -rw-r--r-- 47,041 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>Opcode - 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>Opcode</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-O.html">Core modules (O)</a> &gt;
      
    
    Opcode
  

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


  <!--    -->
<ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><li><a href="#NOTE">NOTE</a><li><a href="#WARNING">WARNING</a><li><a href="#Operator-Names-and-Operator-Lists">Operator Names and Operator Lists</a><li><a href="#Opcode-Functions">Opcode Functions</a><li><a href="#Manipulating-Opsets">Manipulating Opsets</a><li><a href="#TO-DO-(maybe)">TO DO (maybe)</a><li><a href="#Predefined-Opcode-Tags">Predefined Opcode Tags</a><li><a href="#SEE-ALSO">SEE ALSO</a><li><a href="#AUTHORS">AUTHORS</a></ul><a name="NAME"></a><h1>NAME</h1>
<p>Opcode - Disable named opcodes when compiling perl code</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">Opcode</span><span class="sc">;</span></li></ol></pre><a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
<p>Perl code is always compiled into an internal format before execution.</p>
<p>Evaluating perl code (e.g. via "eval" or "do 'file'") causes
the code to be compiled into an internal format and then,
provided there was no error in the compilation, executed.
The internal format is based on many distinct <i>opcodes</i>.</p>
<p>By default no opmask is in effect and any code can be compiled.</p>
<p>The Opcode module allow you to define an <i>operator mask</i> to be in
effect when perl <i>next</i> compiles any code.  Attempting to compile code
which contains a masked opcode will cause the compilation to fail
with an error. The code will not be executed.</p>
<a name="NOTE"></a><h1>NOTE</h1>
<p>The Opcode module is not usually used directly. See the ops pragma and
Safe modules for more typical uses.</p>
<a name="WARNING"></a><h1>WARNING</h1>
<p>The authors make <b>no warranty</b>, implied or otherwise, about the
suitability of this software for safety or security purposes.</p>
<p>The authors shall not in any case be liable for special, incidental,
consequential, indirect or other similar damages arising from the use
of this software.</p>
<p>Your mileage will vary. If in any doubt <b>do not use it</b>.</p>
<a name="Operator-Names-and-Operator-Lists"></a><h1>Operator Names and Operator Lists</h1>
<p>The canonical list of operator names is the contents of the array
PL_op_name defined and initialised in file <i>opcode.h</i> of the Perl
source distribution (and installed into the perl library).</p>
<p>Each operator has both a terse name (its opname) and a more verbose or
recognisable descriptive name. The opdesc function can be used to
return a list of descriptions for a list of operators.</p>
<p>Many of the functions and methods listed below take a list of
operators as parameters. Most operator lists can be made up of several
types of element. Each element can be one of</p>
<ul>
<li><a name="an-operator-name-(opname)"></a><b>an operator name (opname)</b>
<p>Operator names are typically small lowercase words like enterloop,
leaveloop, last, next, redo etc. Sometimes they are rather cryptic
like gv2cv, i_ncmp and ftsvtx.</p>
</li>
<li><a name="an-operator-tag-name-(optag)"></a><b>an operator tag name (optag)</b>
<p>Operator tags can be used to refer to groups (or sets) of operators.
Tag names always begin with a colon. The Opcode module defines several
optags and the user can define others using the define_optag function.</p>
</li>
<li><a name="a-negated-opname-or-optag"></a><b>a negated opname or optag</b>
<p>An opname or optag can be prefixed with an exclamation mark, e.g., !mkdir.
Negating an opname or optag means remove the corresponding ops from the
accumulated set of ops at that point.</p>
</li>
<li><a name="an-operator-set-(opset)"></a><b>an operator set (opset)</b>
<p>An <i>opset</i> as a binary string of approximately 44 bytes which holds a
set or zero or more operators.</p>
<p>The opset and opset_to_ops functions can be used to convert from
a list of operators to an opset and <i>vice versa</i>.</p>
<p>Wherever a list of operators can be given you can use one or more opsets.
See also Manipulating Opsets below.</p>
</li>
</ul>
<a name="Opcode-Functions"></a><h1>Opcode Functions</h1>
<p>The Opcode package contains functions for manipulating operator names
tags and sets. All are available for export by the package.</p>
<ul>
<li><a name="opcodes"></a><b>opcodes</b>
<p>In a scalar context opcodes returns the number of opcodes in this
version of perl (around 350 for perl-5.7.0).</p>
<p>In a list context it returns a list of all the operator names.
(Not yet implemented, use @names = opset_to_ops(full_opset).)</p>
</li>
<li><a name="opset-(OP%2c-...)"></a><b>opset (OP, ...)</b>
<p>Returns an opset containing the listed operators.</p>
</li>
<li><a name="opset_to_ops-(OPSET)"></a><b>opset_to_ops (OPSET)</b>
<p>Returns a list of operator names corresponding to those operators in
the set.</p>
</li>
<li><a name="opset_to_hex-(OPSET)"></a><b>opset_to_hex (OPSET)</b>
<p>Returns a string representation of an opset. Can be handy for debugging.</p>
</li>
<li><a name="full_opset"></a><b>full_opset</b>
<p>Returns an opset which includes all operators.</p>
</li>
<li><a name="empty_opset"></a><b>empty_opset</b>
<p>Returns an opset which contains no operators.</p>
</li>
<li><a name="invert_opset-(OPSET)"></a><b>invert_opset (OPSET)</b>
<p>Returns an opset which is the inverse set of the one supplied.</p>
</li>
<li><a name="verify_opset-(OPSET%2c-...)"></a><b>verify_opset (OPSET, ...)</b>
<p>Returns true if the supplied opset looks like a valid opset (is the
right length etc) otherwise it returns false. If an optional second
parameter is true then verify_opset will croak on an invalid opset
instead of returning false.</p>
<p>Most of the other Opcode functions call verify_opset automatically
and will croak if given an invalid opset.</p>
</li>
<li><a name="define_optag-(OPTAG%2c-OPSET)"></a><b>define_optag (OPTAG, OPSET)</b>
<p>Define OPTAG as a symbolic name for OPSET. Optag names always start
with a colon <code class="inline"><span class="j">:</span></code>
.</p>
<p>The optag name used must not be defined already (define_optag will
croak if it is already defined). Optag names are global to the perl
process and optag definitions cannot be altered or deleted once
defined.</p>
<p>It is strongly recommended that applications using Opcode should use a
leading capital letter on their tag names since lowercase names are
reserved for use by the Opcode module. If using Opcode within a module
you should prefix your tags names with the name of your module to
ensure uniqueness and thus avoid clashes with other modules.</p>
</li>
<li><a name="opmask_add-(OPSET)"></a><b>opmask_add (OPSET)</b>
<p>Adds the supplied opset to the current opmask. Note that there is
currently <i>no</i> mechanism for unmasking ops once they have been masked.
This is intentional.</p>
</li>
<li><a name="opmask"></a><b>opmask</b>
<p>Returns an opset corresponding to the current opmask.</p>
</li>
<li><a name="opdesc-(OP%2c-...)"></a><b>opdesc (OP, ...)</b>
<p>This takes a list of operator names and returns the corresponding list
of operator descriptions.</p>
</li>
<li><a name="opdump-(PAT)"></a><b>opdump (PAT)</b>
<p>Dumps to STDOUT a two column list of op names and op descriptions.
If an optional pattern is given then only lines which match the
(case insensitive) pattern will be output.</p>
<p>It's designed to be used as a handy command line utility:</p>
<pre class="verbatim"><ol><li>	<span class="w">perl</span> -<span class="w">MOpcode</span>=<span class="w">opdump</span> -e <span class="w">opdump</span></li><li>	<span class="w">perl</span> -<span class="w">MOpcode</span>=<span class="w">opdump</span> -e <span class="q">&#39;opdump Eval&#39;</span></li></ol></pre></li>
</ul>
<a name="Manipulating-Opsets"></a><h1>Manipulating Opsets</h1>
<p>Opsets may be manipulated using the perl bit vector operators &amp; (and), | (or),
^ (xor) and ~ (negate/invert).</p>
<p>However you should never rely on the numerical position of any opcode
within the opset. In other words both sides of a bit vector operator
should be opsets returned from Opcode functions.</p>
<p>Also, since the number of opcodes in your current version of perl might
not be an exact multiple of eight, there may be unused bits in the last
byte of an upset. This should not cause any problems (Opcode functions
ignore those extra bits) but it does mean that using the ~ operator
will typically not produce the same 'physical' opset 'string' as the
invert_opset function.</p>
<a name="TO-DO-(maybe)"></a><h1>TO DO (maybe)</h1>
<pre class="verbatim"><ol><li>    <span class="i">$bool</span> = <span class="i">opset_eq</span><span class="s">(</span><span class="i">$opset1</span><span class="cm">,</span> <span class="i">$opset2</span><span class="s">)</span>	<span class="w">true</span> <a class="l_k" href="functions/if.html">if</a> <span class="w">opsets</span> <span class="w">are</span> <span class="w">logically</span></li><li>					<span class="w">equivalent</span></li><li>    <span class="i">$yes</span> = <span class="i">opset_can</span><span class="s">(</span><span class="i">$opset</span><span class="cm">,</span> <span class="i">@ops</span><span class="s">)</span>	<span class="w">true</span> <a class="l_k" href="functions/if.html">if</a> <span class="i">$opset</span> <span class="w">has</span> <span class="w">all</span> <span class="i">@ops</span> <span class="w">set</span></li><li></li><li>    <span class="i">@diff</span> = <span class="i">opset_diff</span><span class="s">(</span><span class="i">$opset1</span><span class="cm">,</span> <span class="i">$opset2</span><span class="s">)</span> <span class="cm">=&gt;</span> <span class="s">(</span><span class="q">&#39;foo&#39;</span><span class="cm">,</span> <span class="q">&#39;!bar&#39;</span><span class="cm">,</span> ...<span class="s">)</span></li></ol></pre><a name="Predefined-Opcode-Tags"></a><h1>Predefined Opcode Tags</h1>
<ul>
<li><a name="%3abase_core"></a><b>:base_core</b>
<pre class="verbatim"><ol><li>    <span class="w">null</span> <span class="w">stub</span> <a class="l_k" href="functions/scalar.html">scalar</a> <span class="w">pushmark</span> <a class="l_k" href="functions/wantarray.html">wantarray</a> <span class="w">const</span> <a class="l_k" href="functions/defined.html">defined</a> <a class="l_k" href="functions/undef.html">undef</a></li><li></li><li>    <span class="w">rv2sv</span> <span class="w">sassign</span></li><li></li><li>    <span class="w">rv2av</span> <span class="w">aassign</span> <span class="w">aelem</span> <span class="w">aelemfast</span> <span class="w">aelemfast_lex</span> <span class="w">aslice</span> <span class="w">kvaslice</span></li><li>    <span class="w">av2arylen</span></li><li></li><li>    <span class="w">rv2hv</span> <span class="w">helem</span> <span class="w">hslice</span> <span class="w">kvhslice</span> <a class="l_k" href="functions/each.html">each</a> <a class="l_k" href="functions/values.html">values</a> <a class="l_k" href="functions/keys.html">keys</a> <a class="l_k" href="functions/exists.html">exists</a> <a class="l_k" href="functions/delete.html">delete</a></li><li>    <span class="w">aeach</span> <span class="w">akeys</span> <span class="w">avalues</span> <span class="w">multideref</span> <span class="w">argelem</span> <span class="w">argdefelem</span> <span class="w">argcheck</span></li><li></li><li>    <span class="w">preinc</span> <span class="w">i_preinc</span> <span class="w">predec</span> <span class="w">i_predec</span> <span class="w">postinc</span> <span class="w">i_postinc</span></li><li>    <span class="w">postdec</span> <span class="w">i_postdec</span> <a class="l_k" href="functions/int.html">int</a> <a class="l_k" href="functions/hex.html">hex</a> <a class="l_k" href="functions/oct.html">oct</a> <a class="l_k" href="functions/abs.html">abs</a> <span class="w">pow</span> <span class="w">multiply</span> <span class="w">i_multiply</span></li><li>    <span class="w">divide</span> <span class="w">i_divide</span> <span class="w">modulo</span> <span class="w">i_modulo</span> <span class="w">add</span> <span class="w">i_add</span> <span class="w">subtract</span> <span class="w">i_subtract</span></li><li></li><li>    <span class="w">left_shift</span> <span class="w">right_shift</span> <span class="w">bit_and</span> <span class="w">bit_xor</span> <span class="w">bit_or</span> <span class="w">nbit_and</span></li><li>    <span class="w">nbit_xor</span> <span class="w">nbit_or</span> <span class="w">sbit_and</span> <span class="w">sbit_xor</span> <span class="w">sbit_or</span> <span class="w">negate</span> <span class="w">i_negate</span> <a class="l_k" href="functions/not.html">not</a></li><li>    <span class="w">complement</span> <span class="w">ncomplement</span> <span class="w">scomplement</span></li><li></li><li>    <a class="l_k" href="functions/lt.html">lt</a> <span class="w">i_lt</span> <a class="l_k" href="functions/gt.html">gt</a> <span class="w">i_gt</span> <a class="l_k" href="functions/le.html">le</a> <span class="w">i_le</span> <a class="l_k" href="functions/ge.html">ge</a> <span class="w">i_ge</span> <a class="l_k" href="functions/eq.html">eq</a> <span class="w">i_eq</span> <a class="l_k" href="functions/ne.html">ne</a> <span class="w">i_ne</span> <span class="w">ncmp</span> <span class="w">i_ncmp</span></li><li>    <span class="w">slt</span> <span class="w">sgt</span> <span class="w">sle</span> <span class="w">sge</span> <span class="w">seq</span> <span class="w">sne</span> <span class="w">scmp</span></li><li></li><li>    <a class="l_k" href="functions/substr.html">substr</a> <a class="l_k" href="functions/vec.html">vec</a> <span class="w">stringify</span> <a class="l_k" href="functions/study.html">study</a> <a class="l_k" href="functions/pos.html">pos</a> <a class="l_k" href="functions/length.html">length</a> <a class="l_k" href="functions/index.html">index</a> <a class="l_k" href="functions/rindex.html">rindex</a> <a class="l_k" href="functions/ord.html">ord</a> <a class="l_k" href="functions/chr.html">chr</a></li><li></li><li>    <a class="l_k" href="functions/ucfirst.html">ucfirst</a> <a class="l_k" href="functions/lcfirst.html">lcfirst</a> <a class="l_k" href="functions/uc.html">uc</a> <a class="l_k" href="functions/lc.html">lc</a> <span class="w">fc</span> <a class="l_k" href="functions/quotemeta.html">quotemeta</a> <span class="w">trans</span> <span class="w">transr</span> <a class="l_k" href="functions/chop.html">chop</a> <span class="w">schop</span></li><li>    <a class="l_k" href="functions/chomp.html">chomp</a> <span class="w">schomp</span></li><li></li><li>    <span class="w">match</span> <a class="l_k" href="functions/split.html">split</a> <span class="q">qr</span></li><li></li><li>    <span class="q">    list lslice</span> <a class="l_k" href="functions/splice.html">splice</a> <a class="l_k" href="functions/push.html">push</a> <a class="l_k" href="functions/pop.html">pop</a> <a class="l_k" href="functions/shift.html">shift</a> <a class="l_k" href="functions/unshift.html">unshift</a> <a class="l_k" href="functions/reverse.html">reverse</a></li><li></li><li>    <span class="w">cond_expr</span> <span class="w">flip</span> <span class="w">flop</span> <span class="w">andassign</span> <span class="w">orassign</span> <span class="w">dorassign</span> <a class="l_k" href="functions/and.html">and</a> <a class="l_k" href="functions/or.html">or</a> <span class="w">dor</span> <a class="l_k" href="functions/xor.html">xor</a></li><li></li><li>    <a class="l_k" href="functions/warn.html">warn</a> <a class="l_k" href="functions/die.html">die</a> <span class="w">lineseq</span> <span class="w">nextstate</span> <span class="w">scope</span> <span class="w">enter</span> <span class="w">leave</span></li><li></li><li>    <span class="w">rv2cv</span> <span class="w">anoncode</span> <a class="l_k" href="functions/prototype.html">prototype</a> <span class="w">coreargs</span> <span class="w">avhvswitch</span> <span class="w">anonconst</span></li><li></li><li>    <span class="w">entersub</span> <span class="w">leavesub</span> <span class="w">leavesublv</span> <a class="l_k" href="functions/return.html">return</a> <span class="w">method</span> <span class="w">method_named</span></li><li>    <span class="w">method_super</span> <span class="w">method_redir</span> <span class="w">method_redir_super</span></li><li>     -- <span class="w">XXX</span> <span class="w">loops</span> <span class="w">via</span> <span class="w">recursion</span>?</li><li></li><li>    <span class="w">leaveeval</span> -- <span class="w">needed</span> <a class="l_k" href="functions/for.html">for</a> <span class="w">Safe</span> <span class="w">to</span> <span class="w">operate</span><span class="cm">,</span> <span class="w">is</span> <span class="w">safe</span></li><li>		 <span class="w">without</span> <span class="w">entereval</span></li></ol></pre></li>
<li><a name="%3abase_mem"></a><b>:base_mem</b>
<p>These memory related ops are not included in :base_core because they
can easily be used to implement a resource attack (e.g., consume all
available memory).</p>
<pre class="verbatim"><ol><li>    <span class="w">concat</span> <span class="w">repeat</span> <a class="l_k" href="functions/join.html">join</a> <span class="w">range</span></li><li></li><li>    <span class="w">anonlist</span> <span class="w">anonhash</span></li></ol></pre><p>Note that despite the existence of this optag a memory resource attack
may still be possible using only :base_core ops.</p>
<p>Disabling these ops is a <i>very</i> heavy handed way to attempt to prevent
a memory resource attack. It's probable that a specific memory limit
mechanism will be added to perl in the near future.</p>
</li>
<li><a name="%3abase_loop"></a><b>:base_loop</b>
<p>These loop ops are not included in :base_core because they can easily be
used to implement a resource attack (e.g., consume all available CPU time).</p>
<pre class="verbatim"><ol><li>    <span class="w">grepstart</span> <span class="w">grepwhile</span></li><li>    <span class="w">mapstart</span> <span class="w">mapwhile</span></li><li>    <span class="w">enteriter</span> <span class="w">iter</span></li><li>    <span class="w">enterloop</span> <span class="w">leaveloop</span> <span class="w">unstack</span></li><li>    <a class="l_k" href="functions/last.html">last</a> <a class="l_k" href="functions/next.html">next</a> <a class="l_k" href="functions/redo.html">redo</a></li><li>    <a class="l_k" href="functions/goto.html">goto</a></li></ol></pre></li>
<li><a name="%3abase_io"></a><b>:base_io</b>
<p>These ops enable <i>filehandle</i> (rather than filename) based input and
output. These are safe on the assumption that only pre-existing
filehandles are available for use.  Usually, to create new filehandles
other ops such as open would need to be enabled, if you don't take into
account the magical open of ARGV.</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/readline.html">readline</a> <span class="w">rcatline</span> <a class="l_k" href="functions/getc.html">getc</a> <a class="l_k" href="functions/read.html">read</a></li><li></li><li>    <a class="l_k" href="functions/formline.html">formline</a> <span class="w">enterwrite</span> <span class="w">leavewrite</span></li><li></li><li>    <a class="l_k" href="functions/print.html">print</a> <a class="l_k" href="functions/say.html">say</a> <a class="l_k" href="functions/sysread.html">sysread</a> <a class="l_k" href="functions/syswrite.html">syswrite</a> <a class="l_k" href="functions/send.html">send</a> <a class="l_k" href="functions/recv.html">recv</a></li><li></li><li>    <a class="l_k" href="functions/eof.html">eof</a> <a class="l_k" href="functions/tell.html">tell</a> <a class="l_k" href="functions/seek.html">seek</a> <a class="l_k" href="functions/sysseek.html">sysseek</a></li><li></li><li>    <a class="l_k" href="functions/readdir.html">readdir</a> <a class="l_k" href="functions/telldir.html">telldir</a> <a class="l_k" href="functions/seekdir.html">seekdir</a> <a class="l_k" href="functions/rewinddir.html">rewinddir</a></li></ol></pre></li>
<li><a name="%3abase_orig"></a><b>:base_orig</b>
<p>These are a hotchpotch of opcodes still waiting to be considered</p>
<pre class="verbatim"><ol><li>    <span class="w">gvsv</span> <span class="w">gv</span> <span class="w">gelem</span></li><li></li><li>    <span class="w">padsv</span> <span class="w">padav</span> <span class="w">padhv</span> <span class="w">padcv</span> <span class="w">padany</span> <span class="w">padrange</span> <span class="w">introcv</span> <span class="w">clonecv</span></li><li></li><li>    <span class="w">once</span></li><li></li><li>    <span class="w">rv2gv</span> <span class="w">refgen</span> <span class="w">srefgen</span> <a class="l_k" href="functions/ref.html">ref</a> <span class="w">refassign</span> <span class="w">lvref</span> <span class="w">lvrefslice</span> <span class="w">lvavref</span></li><li></li><li>    <a class="l_k" href="functions/bless.html">bless</a> -- <span class="w">could</span> <span class="w">be</span> <span class="w">used</span> <span class="w">to</span> <span class="w">change</span> <span class="w">ownership</span> <span class="w">of</span> <span class="i">objects</span></li><li>	     <span class="s">(</span><span class="w">reblessing</span><span class="s">)</span></li><li></li><li>     <span class="w">regcmaybe</span> <span class="w">regcreset</span> <span class="w">regcomp</span> <span class="w">subst</span> <span class="w">substcont</span></li><li></li><li>    <a class="l_k" href="functions/sprintf.html">sprintf</a> <span class="w">prtf</span> -- <span class="w">can</span> <span class="w">core</span> <a class="l_k" href="functions/dump.html">dump</a></li><li></li><li>    <a class="l_k" href="functions/crypt.html">crypt</a></li><li></li><li>    <a class="l_k" href="functions/tie.html">tie</a> <a class="l_k" href="functions/untie.html">untie</a></li><li></li><li>    <a class="l_k" href="functions/dbmopen.html">dbmopen</a> <a class="l_k" href="functions/dbmclose.html">dbmclose</a></li><li>    <span class="w">sselect</span> <a class="l_k" href="functions/select.html">select</a></li><li>    <span class="w">pipe_op</span> <span class="w">sockpair</span></li><li></li><li>    <a class="l_k" href="functions/getppid.html">getppid</a> <a class="l_k" href="functions/getpgrp.html">getpgrp</a> <a class="l_k" href="functions/setpgrp.html">setpgrp</a> <a class="l_k" href="functions/getpriority.html">getpriority</a> <a class="l_k" href="functions/setpriority.html">setpriority</a></li><li>    <a class="l_k" href="functions/localtime.html">localtime</a> <a class="l_k" href="functions/gmtime.html">gmtime</a></li><li></li><li>    <span class="w">entertry</span> <span class="w">leavetry</span> -- <span class="w">can</span> <span class="w">be</span> <span class="w">used</span> <span class="w">to</span> <span class="q">&#39;hide&#39;</span> <span class="w">fatal</span> <span class="w">errors</span></li><li></li><li>    <span class="w">entergiven</span> <span class="w">leavegiven</span></li><li>    <span class="w">enterwhen</span> <span class="w">leavewhen</span></li><li>    <a class="l_k" href="functions/break.html">break</a> <a class="l_k" href="functions/continue.html">continue</a></li><li>    <span class="w">smartmatch</span></li><li></li><li>    <span class="w">custom</span> -- <span class="w">where</span> <span class="w">should</span> <span class="w">this</span> <span class="w">go</span></li></ol></pre></li>
<li><a name="%3abase_math"></a><b>:base_math</b>
<p>These ops are not included in :base_core because of the risk of them being
used to generate floating point exceptions (which would have to be caught
using a $SIG{FPE} handler).</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/atan2.html">atan2</a> <a class="l_k" href="functions/sin.html">sin</a> <a class="l_k" href="functions/cos.html">cos</a> <a class="l_k" href="functions/exp.html">exp</a> <a class="l_k" href="functions/log.html">log</a> <a class="l_k" href="functions/sqrt.html">sqrt</a></li></ol></pre><p>These ops are not included in :base_core because they have an effect
beyond the scope of the compartment.</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/rand.html">rand</a> <a class="l_k" href="functions/srand.html">srand</a></li></ol></pre></li>
<li><a name="%3abase_thread"></a><b>:base_thread</b>
<p>These ops are related to multi-threading.</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/lock.html">lock</a></li></ol></pre></li>
<li><a name="%3adefault"></a><b>:default</b>
<p>A handy tag name for a <i>reasonable</i> default set of ops.  (The current ops
allowed are unstable while development continues. It will change.)</p>
<pre class="verbatim"><ol><li>    :base_core :base_mem :base_loop :base_orig :base_thread</li></ol></pre><p>This list used to contain :base_io prior to Opcode 1.07.</p>
<p>If safety matters to you (and why else would you be using the Opcode module?)
then you should not rely on the definition of this, or indeed any other, optag!</p>
</li>
<li><a name="%3afilesys_read"></a><b>:filesys_read</b>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/stat.html">stat</a> <a class="l_k" href="functions/lstat.html">lstat</a> <a class="l_k" href="functions/readlink.html">readlink</a></li><li></li><li>    <span class="w">ftatime</span> <span class="w">ftblk</span> <span class="w">ftchr</span> <span class="w">ftctime</span> <span class="w">ftdir</span> <span class="w">fteexec</span> <span class="w">fteowned</span></li><li>    <span class="w">fteread</span> <span class="w">ftewrite</span> <span class="w">ftfile</span> <span class="w">ftis</span> <span class="w">ftlink</span> <span class="w">ftmtime</span> <span class="w">ftpipe</span></li><li>    <span class="w">ftrexec</span> <span class="w">ftrowned</span> <span class="w">ftrread</span> <span class="w">ftsgid</span> <span class="w">ftsize</span> <span class="w">ftsock</span> <span class="w">ftsuid</span></li><li>    <span class="w">fttty</span> <span class="w">ftzero</span> <span class="w">ftrwrite</span> <span class="w">ftsvtx</span></li><li></li><li>    <span class="w">fttext</span> <span class="w">ftbinary</span></li><li></li><li>    <a class="l_k" href="functions/fileno.html">fileno</a></li></ol></pre></li>
<li><a name="%3asys_db"></a><b>:sys_db</b>
<pre class="verbatim"><ol><li>    ghbyname ghbyaddr ghostent shostent ehostent      -- hosts</li><li>    gnbyname gnbyaddr gnetent snetent enetent         -- networks</li><li>    gpbyname gpbynumber gprotoent sprotoent eprotoent -- protocols</li><li>    gsbyname gsbyport gservent sservent eservent      -- services</li><li></li><li>    gpwnam gpwuid gpwent spwent epwent getlogin       -- users</li><li>    ggrnam ggrgid ggrent sgrent egrent                -- groups</li></ol></pre></li>
<li><a name="%3abrowse"></a><b>:browse</b>
<p>A handy tag name for a <i>reasonable</i> default set of ops beyond the
:default optag.  Like :default (and indeed all the other optags) its
current definition is unstable while development continues. It will change.</p>
<p>The :browse tag represents the next step beyond :default. It it a
superset of the :default ops and adds :filesys_read the :sys_db.
The intent being that scripts can access more (possibly sensitive)
information about your system but not be able to change it.</p>
<pre class="verbatim"><ol><li>    :default :filesys_read :sys_db</li></ol></pre></li>
<li><a name="%3afilesys_open"></a><b>:filesys_open</b>
<pre class="verbatim"><ol><li>    sysopen open close</li><li>    umask binmode</li><li></li><li>    open_dir closedir -- other dir ops are in :base_io</li></ol></pre></li>
<li><a name="%3afilesys_write"></a><b>:filesys_write</b>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/link.html">link</a> <a class="l_k" href="functions/unlink.html">unlink</a> <a class="l_k" href="functions/rename.html">rename</a> <a class="l_k" href="functions/symlink.html">symlink</a> <a class="l_k" href="functions/truncate.html">truncate</a></li><li></li><li>    <a class="l_k" href="functions/mkdir.html">mkdir</a> <a class="l_k" href="functions/rmdir.html">rmdir</a></li><li></li><li>    <a class="l_k" href="functions/utime.html">utime</a> <a class="l_k" href="functions/chmod.html">chmod</a> <a class="l_k" href="functions/chown.html">chown</a></li><li></li><li>    <a class="l_k" href="functions/fcntl.html">fcntl</a> -- <a class="l_k" href="functions/not.html">not</a> <span class="w">strictly</span> <span class="w">filesys</span> <span class="w">related</span><span class="cm">,</span> <span class="w">but</span> <span class="w">possibly</span> <span class="w">as</span></li><li>	     <span class="w">dangerous</span>?</li></ol></pre></li>
<li><a name="%3asubprocess"></a><b>:subprocess</b>
<pre class="verbatim"><ol><li>    <span class="w">backtick</span> <a class="l_k" href="functions/system.html">system</a></li><li></li><li>    <a class="l_k" href="functions/fork.html">fork</a></li><li></li><li>    <a class="l_k" href="functions/wait.html">wait</a> <a class="l_k" href="functions/waitpid.html">waitpid</a></li><li></li><li>    <a class="l_k" href="functions/glob.html">glob</a> -- <span class="w">access</span> <span class="w">to</span> <span class="w">Cshell</span> <span class="w">via</span> <span class="q">&lt;`rm *`&gt;</span></li></ol></pre></li>
<li><a name="%3aownprocess"></a><b>:ownprocess</b>
<pre class="verbatim"><ol><li>    exec exit kill</li><li></li><li>    time tms -- could be used for timing attacks (paranoid?)</li></ol></pre></li>
<li><a name="%3aothers"></a><b>:others</b>
<p>This tag holds groups of assorted specialist opcodes that don't warrant
having optags defined for them.</p>
<p>SystemV Interprocess Communications:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/msgctl.html">msgctl</a> <a class="l_k" href="functions/msgget.html">msgget</a> <a class="l_k" href="functions/msgrcv.html">msgrcv</a> <a class="l_k" href="functions/msgsnd.html">msgsnd</a></li><li></li><li>    <a class="l_k" href="functions/semctl.html">semctl</a> <a class="l_k" href="functions/semget.html">semget</a> <a class="l_k" href="functions/semop.html">semop</a></li><li></li><li>    <a class="l_k" href="functions/shmctl.html">shmctl</a> <a class="l_k" href="functions/shmget.html">shmget</a> <a class="l_k" href="functions/shmread.html">shmread</a> <a class="l_k" href="functions/shmwrite.html">shmwrite</a></li></ol></pre></li>
<li><a name="%3aload"></a><b>:load</b>
<p>This tag holds opcodes related to loading modules and getting information
about calling environment and args.</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/require.html">require</a> <span class="w">dofile</span> </li><li>    <a class="l_k" href="functions/caller.html">caller</a> <span class="w">runcv</span></li></ol></pre></li>
<li><a name="%3astill_to_be_decided"></a><b>:still_to_be_decided</b>
<pre class="verbatim"><ol><li>    chdir</li><li>    flock ioctl</li><li></li><li>    socket getpeername ssockopt</li><li>    bind connect listen accept shutdown gsockopt getsockname</li><li></li><li>    sleep alarm -- changes global timer state and signal handling</li><li>    sort -- assorted problems including core dumps</li><li>    tied -- can be used to access object implementing a tie</li><li>    pack unpack -- can be used to create/use memory pointers</li><li></li><li>    hintseval -- constant op holding eval hints</li><li></li><li>    entereval -- can be used to hide code from initial compile</li><li></li><li>    reset</li><li></li><li>    dbstate -- perl -d version of nextstate(ment) opcode</li></ol></pre></li>
<li><a name="%3adangerous"></a><b>:dangerous</b>
<p>This tag is simply a bucket for opcodes that are unlikely to be used via
a tag name but need to be tagged for completeness and documentation.</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/syscall.html">syscall</a> <a class="l_k" href="functions/dump.html">dump</a> <a class="l_k" href="functions/chroot.html">chroot</a></li></ol></pre></li>
</ul>
<a name="SEE-ALSO"></a><h1>SEE ALSO</h1>
<p><a href="ops.html">ops</a> -- perl pragma interface to Opcode module.</p>
<p><a href="Safe.html">Safe</a> -- Opcode and namespace limited execution compartments</p>
<a name="AUTHORS"></a><h1>AUTHORS</h1>
<p>Originally designed and implemented by Malcolm Beattie,
mbeattie@sable.ox.ac.uk as part of Safe version 1.</p>
<p>Split out from Safe module version 1, named opcode tags and other
changes added by Tim Bunce.</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="#NOTE">NOTE</a><li><a href="#WARNING">WARNING</a><li><a href="#Operator-Names-and-Operator-Lists">Operator Names and Operator Lists</a><li><a href="#Opcode-Functions">Opcode Functions</a><li><a href="#Manipulating-Opsets">Manipulating Opsets</a><li><a href="#TO-DO-(maybe)">TO DO (maybe)</a><li><a href="#Predefined-Opcode-Tags">Predefined Opcode Tags</a><li><a href="#SEE-ALSO">SEE ALSO</a><li><a href="#AUTHORS">AUTHORS</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    = 'Opcode';
  perldoc.pageAddress = 'Opcode.html';
  perldoc.contentPage = 1;
  explorePerl.render();
  explorePerl.addEvents('explore_anchor');
</script>
    
  </body>
</html>