1B::Op_private(3pm)     Perl Programmers Reference Guide     B::Op_private(3pm)
2
3
4

NAME

6       B::Op_private - OP op_private flag definitions
7

SYNOPSIS

9           use B::Op_private;
10
11           # flag details for bit 7 of OP_AELEM's op_private:
12           my $name  = $B::Op_private::bits{aelem}{7}; # OPpLVAL_INTRO
13           my $value = $B::Op_private::defines{$name}; # 128
14           my $label = $B::Op_private::labels{$name};  # LVINTRO
15
16           # the bit field at bits 5..6 of OP_AELEM's op_private:
17           my $bf  = $B::Op_private::bits{aelem}{6};
18           my $mask = $bf->{bitmask}; # etc
19

DESCRIPTION

21       This module provides four global hashes:
22
23           %B::Op_private::bits
24           %B::Op_private::defines
25           %B::Op_private::labels
26           %B::Op_private::ops_using
27
28       which contain information about the per-op meanings of the bits in the
29       op_private field.
30
31   %bits
32       This is indexed by op name and then bit number (0..7). For single bit
33       flags, it returns the name of the define (if any) for that bit:
34
35          $B::Op_private::bits{aelem}{7} eq 'OPpLVAL_INTRO';
36
37       For bit fields, it returns a hash ref containing details about the
38       field.  The same reference will be returned for all bit positions that
39       make up the bit field; so for example these both return the same hash
40       ref:
41
42           $bitfield = $B::Op_private::bits{aelem}{5};
43           $bitfield = $B::Op_private::bits{aelem}{6};
44
45       The general format of this hash ref is
46
47           {
48               # The bit range and mask; these are always present.
49               bitmin        => 5,
50               bitmax        => 6,
51               bitmask       => 0x60,
52
53               # (The remaining keys are optional)
54
55               # The names of any defines that were requested:
56               mask_def      => 'OPpFOO_MASK',
57               baseshift_def => 'OPpFOO_SHIFT',
58               bitcount_def  => 'OPpFOO_BITS',
59
60               # If present, Concise etc will display the value with a 'FOO='
61               # prefix. If it equals '-', then Concise will treat the bit
62               # field as raw bits and not try to interpret it.
63               label         => 'FOO',
64
65               # If present, specifies the names of some defines and the
66               # display labels that are used to assign meaning to particu-
67               # lar integer values within the bit field; e.g. 3 is dis-
68               # played as 'C'.
69               enum          => [ qw(
70                                    1   OPpFOO_A  A
71                                    2   OPpFOO_B  B
72                                    3   OPpFOO_C  C
73                                )],
74
75           };
76
77   %defines
78       This gives the value of every "OPp" define, e.g.
79
80           $B::Op_private::defines{OPpLVAL_INTRO} == 128;
81
82   %labels
83       This gives the short display label for each define, as used by
84       "B::Concise" and "perl -Dx", e.g.
85
86           $B::Op_private::labels{OPpLVAL_INTRO} eq 'LVINTRO';
87
88       If the label equals '-', then Concise will treat the bit as a raw bit
89       and not try to display it symbolically.
90
91   %ops_using
92       For each define, this gives a reference to an array of op names that
93       use the flag.
94
95           @ops_using_lvintro = @{ $B::Op_private::ops_using{OPp_LVAL_INTRO} };
96
97
98
99perl v5.34.0                      2021-10-18                B::Op_private(3pm)
Impressum