Book HomeJava and XSLTSearch this book

8.167. Opcode

Permits defining an operator mask (opmask) so that any code containing a masked opcode will not compile or execute when Perl next compiles any code. Not usually used directly; for examples of Opcode's use, see the ops pragma and the Safe module.

Valid opcodes are listed in the array op_name in the file opcode.h. Many Opcode functions and methods take lists of operators, which are composed of elements. Each element can be a:

name (opname) or negated name
Name of operator, usually lowercase. Prefixing the name with an exclamation mark (!) removes it from the accumulated set of operations.

set (opset)
Operator set. Binary string holding a set of zero or more operators.

tag name (optag) or negated tag
Operator tag name; refers to groups (or sets) of operators. Begins with a colon (:). Negated by prefixing with an exclamation mark (!). Several optags are predefined, including the following. See the Opcode module's manpage for the opcodes included in each tag.

:base_core      :base_io        :base_loop
:base_math      :base_mem       :base_orig
:browse         :dangerous      :default
:filesys_open   :filesys_read   :filesys_write
:others         :ownprocess     :still_to_be_decided
:subprocess     :sys_db

8.167.1. Functions

All the following functions can be exported.

define_optag

define_optag (optag, opset)

Defines optag as symbolic name for the set opset.

empty_opset

empty_opset

Returns an empty opset.

full_opset

full_opset

Returns an opset that includes all operators.

invert_opset

invert_opset (opset)

Returns an opset that is the inverse of opset.

opcodes

opcodes

In scalar context, returns the number of opcodes in this version of Perl.

opdesc

opdesc (op, ...)

Takes list of operator names and returns the corresponding list descriptions.

opdump

opdump ([pat])

Writes two-column list of operator names and descriptions to STDOUT. If pat is specified, only lines matching the (case-insensitive) pattern are output.

opmask

opmask

Returns an opset corresponding to the current opmask.

opmask_add

opmask_add (opset)

Adds opset to the current opmask.

opset

opset (op, ...)

Returns an opset containing the listed operators.

opset_to_hex

opset_to_hex (opset)

Returns string representation of opset.

opset_to_ops

opset_to_ops (opset)

Returns list of operator names corresponding to the operators in the set opset.

verify_opset

verify_opset (opset[, ...])

Returns true if opset appears to be a valid opset, else returns false. croak s instead of returning false if optional second parameter is true.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.