Debian Codegraph @

upstream/opensuse-tumbleweed/man3/O.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "O 3pm"
61 .TH O 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 O \- Generic interface to Perl Compiler backends
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 1
71 \& perl \-MO=[\-q,]Backend[,OPTIONS] foo.pl
72 .Ve
73 .SH DESCRIPTION
74 .IX Header "DESCRIPTION"
75 This is the module that is used as a frontend to the Perl Compiler.
76 .PP
77 If you pass the \f(CW\*(C`\-q\*(C'\fR option to the module, then the STDOUT
78 filehandle will be redirected into the variable \f(CW$O::BEGIN_output\fR
79 during compilation. This has the effect that any output printed
80 to STDOUT by BEGIN blocks or use\*(Aqd modules will be stored in this
81 variable rather than printed. It\*(Aqs useful with those backends which
82 produce output themselves (\f(CW\*(C`Deparse\*(C'\fR, \f(CW\*(C`Concise\*(C'\fR etc), so that
83 their output is not confused with that generated by the code
84 being compiled.
85 .PP
86 The \f(CW\*(C`\-qq\*(C'\fR option behaves like \f(CW\*(C`\-q\*(C'\fR, except that it also closes
87 STDERR after deparsing has finished. This suppresses the "Syntax OK"
88 message normally produced by perl.
89 .SH CONVENTIONS
90 .IX Header "CONVENTIONS"
91 Most compiler backends use the following conventions: OPTIONS
92 consists of a comma\-separated list of words (no white\-space).
93 The \f(CW\*(C`\-v\*(C'\fR option usually puts the backend into verbose mode.
94 The \f(CW\*(C`\-ofile\*(C'\fR option generates output to \fBfile\fR instead of
95 stdout. The \f(CW\*(C`\-D\*(C'\fR option followed by various letters turns on
96 various internal debugging flags. See the documentation for the
97 desired backend (named \f(CW\*(C`B::Backend\*(C'\fR for the example above) to
98 find out about that backend.
99 .SH IMPLEMENTATION
100 .IX Header "IMPLEMENTATION"
101 This section is only necessary for those who want to write a
102 compiler backend module that can be used via this module.
103 .PP
104 The command\-line mentioned in the SYNOPSIS section corresponds to
105 the Perl code
106 .PP
107 .Vb 1
108 \& use O ("Backend", OPTIONS);
109 .Ve
110 .PP
111 The \f(CW\*(C`O::import\*(C'\fR function loads the appropriate \f(CW\*(C`B::Backend\*(C'\fR module
112 and calls its \f(CW\*(C`compile\*(C'\fR function, passing it OPTIONS. That function
113 is expected to return a sub reference which we\*(Aqll call CALLBACK. Next,
114 the "compile\-only" flag is switched on (equivalent to the command\-line
115 option \f(CW\*(C`\-c\*(C'\fR) and a CHECK block is registered which calls
116 CALLBACK. Thus the main Perl program mentioned on the command\-line is
117 read in, parsed and compiled into internal syntax tree form. Since the
118 \&\f(CW\*(C`\-c\*(C'\fR flag is set, the program does not start running (excepting BEGIN
119 blocks of course) but the CALLBACK function registered by the compiler
120 backend is called.
121 .PP
122 In summary, a compiler backend module should be called "B::Foo"
123 for some foo and live in the appropriate directory for that name.
124 It should define a function called \f(CW\*(C`compile\*(C'\fR. When the user types
125 .PP
126 .Vb 1
127 \& perl \-MO=Foo,OPTIONS foo.pl
128 .Ve
129 .PP
130 that function is called and is passed those OPTIONS (split on
131 commas). It should return a sub ref to the main compilation function.
132 After the user\*(Aqs program is loaded and parsed, that returned sub ref
133 is invoked which can then go ahead and do the compilation, usually by
134 making use of the \f(CW\*(C`B\*(C'\fR module\*(Aqs functionality.
135 .SH BUGS
136 .IX Header "BUGS"
137 The \f(CW\*(C`\-q\*(C'\fR and \f(CW\*(C`\-qq\*(C'\fR options don\*(Aqt work correctly if perl isn\*(Aqt
138 compiled with PerlIO support : STDOUT will be closed instead of being
139 redirected to \f(CW$O::BEGIN_output\fR.
140 .SH AUTHOR
141 .IX Header "AUTHOR"
142 Malcolm Beattie, \f(CW\*(C`[email protected]\*(C'\fR