1
1
= begin pod :kind("Programs") :subkind("programs") :category("programs")
2
2
3
- = TITLE Shell environment variables used by Raku
3
+ = TITLE Running Rakudo
4
4
5
- = SUBTITLE The variables you can declare to alter its behavior or gather
6
- additional information .
5
+ = SUBTITLE How to run Rakudo, a Raku implementation, and modify its behavior
6
+ with environment variables .
7
7
8
- The behavior of L < Rakudo|https://rakudo.org > , the Raku interpreter, can be
9
- tweaked by a (growing) number of environment variables; this section attempts to
10
- document all those currently in use. They are interpreter specific in all cases,
11
- except where some use conventional names such as C < PATH > .
8
+ = head1 NAME
9
+
10
+ raku - Rakudo Raku Compiler
11
+
12
+ = head1 SYNOPSIS
13
+
14
+ raku [switches] [--] [programfile] [arguments]
15
+
16
+ = head1 DESCRIPTION
17
+
18
+ With no arguments, enters a REPL. With a C < [programfile] > or the C < -e >
19
+ option, compiles the given program and by default also executes the
20
+ compiled code.
21
+
22
+ -c check syntax only (runs BEGIN and CHECK blocks)
23
+ --doc extract documentation and print it as text
24
+ -e program one line of program, strict is enabled by default
25
+ -h, --help display this help text
26
+ -n run program once for each line of input
27
+ -p same as -n, but also print $_ at the end of lines
28
+ -I path adds the path to the module search path
29
+ -M module loads the module prior to running the program
30
+ --target=[stage] specify compilation stage to emit
31
+ --optimize=[level] use the given level of optimization (0..3)
32
+ --encoding=[mode] specify string encoding mode
33
+ -o, --output=[name] specify name of output file
34
+ -v, --version display version information
35
+ --stagestats display time spent in the compilation stages
36
+ --ll-exception display a low level backtrace on errors
37
+ --profile write profile information as HTML file (MoarVM)
38
+ --profile-filename provide a different filename (also allows .json)
39
+ --doc=[module] Use Pod::To::[module] to render inline documentation.
40
+ --full-cleanup try to free all memory and exit cleanly (MoarVM)
41
+ --debug-port=port listen for incoming debugger connections (MoarVM)
42
+ --debug-suspend pause execution at the entry point (MoarVM)
43
+ --tracing output a line to stderr on every interpreter instr (only
44
+ if enabled in MoarVM)
45
+
46
+ Note that only boolean single-letter options may be bundled.
47
+
48
+ The supported values for C < --target > are:
49
+
50
+ Target Backend Description
51
+ ====== ======= ===========
52
+ parse all a representation of the parse tree
53
+ ast all an abstract syntax tree (before optimizations)
54
+ optimize all an abstract syntax tree (after optimizations)
55
+
56
+ mbc MoarVM MoarVM byte code
57
+ jar JVM JVM archive
58
+
59
+ For C < --profile-filename > , specifying a name ending in C < .json > will write a raw
60
+ JSON profile dump. The default if this is omitted is C < profile-I < [timestamp] > .html > .
61
+
62
+ = head1 ENVIRONMENT VARIABLES
63
+
64
+ Rakudo's behavior can be tweaked by a (growing) number of environment variables;
65
+ this section attempts to document all those currently in use. They are
66
+ interpreter specific in all cases, except where some use conventional names
67
+ such as C < PATH > .
12
68
13
69
The underlying virtual machine is also sensitive to a series of environment
14
70
variables; they are listed L < in this wiki
15
71
page|https://github.com/rakudo/rakudo/wiki/dev-env-vars#moarvm > .
16
72
17
73
= head2 Module loading
18
74
19
- X < |RAKUDOLIB > X < |PERL6LIB >
20
- = item C < RAKUDOLIB > , C < PERL6LIB >
75
+ X < |RAKUDOLIB > X < |RAKULIB > X < | PERL6LIB>
76
+ = item C < RAKUDOLIB > , C < RAKULIB > ( I < Str > ; F < src/core/Inc.pm > )
21
77
22
- C < RAKUDOLIB > and C < PERL6LIB > append a comma-delimited list of paths to the
23
- search list for modules. C < RAKUDOLIB > is evaluated first.
78
+ C < RAKUDOLIB > and C < RAKULIB > append a comma-delimited list of paths to the
79
+ search list for modules. C < RAKUDOLIB > is evaluated first. B < NOTE: > These env
80
+ vars were added in the Rakudo compiler in version 2020.05. The deprecated older
81
+ env var C < PERL6LIB > is still available.
24
82
25
83
X < |RAKUDO_MODULE_DEBUG >
26
- = item C < RAKUDO_MODULE_DEBUG >
84
+ = item C < RAKUDO_MODULE_DEBUG > ( I < Bool > ; F < src/Perl6/ModuleLoader.nqp > )
27
85
28
86
If true, causes the module loader to print debugging information to standard
29
87
error.
@@ -37,46 +95,50 @@ X<|PERL6_EXCEPTIONS_HANDLER>
37
95
If present, the C < print_exception > routine
38
96
will use a class of that name to process the exception for output. Rakudo
39
97
currently ships with C < Exceptions::JSON > (invoked by setting this variable to
40
- C < JSON > ), to override the default output. B < NOTE: > this env var was added in
98
+ C < JSON > ), to override the default output. B < NOTE: > This env var was added in
41
99
version 6.e. Early implementation has been available in Rakudo compiler
42
100
as of version 2019.12, and before that it was available as
43
101
C < PERL6_EXCEPTIONS_HANDLER > .
44
102
45
103
X < |RAKUDO_NO_DEPRECATIONS >
46
- = item C < RAKUDO_NO_DEPRECATIONS >
104
+ = item C < RAKUDO_NO_DEPRECATIONS > ( I < Bool > ; F < src/core.c/Deprecations.pm6 > )
47
105
48
106
If true, suppresses deprecation warnings triggered by the C < is DEPRECATED >
49
107
trait.
50
108
51
109
X < |RAKUDO_DEPRECATIONS_FATAL >
52
- = item C < RAKUDO_DEPRECATIONS_FATAL >
110
+ = item C < RAKUDO_DEPRECATIONS_FATAL > ( I < Bool > ; F < src/core.c/Deprecations.pm6 > )
53
111
54
112
If true, deprecation warnings become thrown exceptions.
55
113
56
114
X < |RAKUDO_VERBOSE_STACKFRAME >
57
- = item C < RAKUDO_VERBOSE_STACKFRAME >
115
+ = item C < RAKUDO_VERBOSE_STACKFRAME > ( I < UInt > ; F < src/core.c/Backtrace.pm6 > )
58
116
59
117
Displays source code in stack frames surrounded by the specified number of
60
118
lines of context; for instance C < RAKUDO_VERBOSE_STACKFRAME = 1 > will use one
61
119
context line.
62
120
63
121
X < |RAKUDO_BACKTRACE_SETTING >
64
- = item C < RAKUDO_BACKTRACE_SETTING >
122
+ = item C < RAKUDO_BACKTRACE_SETTING > ( I < Bool > ; F < src/core.c/Backtrace.pm6 > )
65
123
66
124
Controls whether C < .setting > files are included in backtraces.
67
125
68
126
= head2 Affecting precompilation
69
127
70
128
X < |RAKUDO_PREFIX >
71
- = item C < RAKUDO_PREFIX >
129
+ = item C < RAKUDO_PREFIX > ( I < Str > ; F < src/core.c/CompUnit/RepositoryRegistry.pm6 > )
72
130
73
131
When this is set, Rakudo will look for the standard repositories (perl, vendor,
74
132
site) in the specified directory. This is intended as an escape hatch for
75
133
build-time bootstrapping issues, where Rakudo may be built as an unprivileged
76
134
user without write access to the runtime paths in NQP's config.
77
135
78
- X < |RAKUDO_PRECOMP_DIST > X < |RAKUDO_PRECOMP_LOADING > X < |RAKUDO_PRECOMP_WITH >
79
- = item C < RAKUDO_PRECOMP_DIST > , C < RAKUDO_PRECOMP_LOADING > C < RAKUDO_PRECOMP_WITH > :
136
+ X < |RAKUDO_PRECOMP_DIST >
137
+ = item C < RAKUDO_PRECOMP_DIST > (F < src/core.c/CompUnit/PrecompilationRepository.pm6 > )
138
+ X < |RAKUDO_PRECOMP_LOADING >
139
+ = item C < RAKUDO_PRECOMP_LOADING > (F < src/core.c/CompUnit/PrecompilationRepository.pm6 > )
140
+ X < |RAKUDO_PRECOMP_WITH >
141
+ = item C < RAKUDO_PRECOMP_WITH > (F < src/core.c/CompUnit/PrecompilationRepository.pm6 > )
80
142
81
143
These are internal variables for passing serialized state to precompilation jobs
82
144
in child processes. Please do not set them manually.
@@ -114,24 +176,25 @@ C<~/.perl6/rakudo-history>.
114
176
X < |RAKUDO_DEFAULT_READ_ELEMS >
115
177
= item C < RAKUDO_DEFAULT_READ_ELEMS >
116
178
117
- This specifies the default number of characters to read on an L « C < IO::Handle > |/type/IO::Handle» by
118
- setting the L « C < $*DEFAULT-READ-ELEMS > |/language/variables#$*DEFAULT-READ-ELEMS»
119
- dynamic variable.
179
+ This specifies the default number of characters to read on an
180
+ L « C < IO::Handle > |/type/IO::Handle» by setting the
181
+ L « C < $*DEFAULT-READ-ELEMS > |/language/variables#$*DEFAULT-READ-ELEMS» dynamic
182
+ variable.
120
183
121
184
X < |RAKUDO_ERROR_COLOR >
122
- = item C < RAKUDO_ERROR_COLOR >
185
+ = item C < RAKUDO_ERROR_COLOR > ( I < Bool > ; F < src/core.c/Exception.pm6 > )
123
186
124
187
Controls whether to emit ANSI codes for error highlighting. Defaults to true
125
188
if unset, except on Windows.
126
189
127
190
X < |RAKUDO_MAX_THREADS >
128
- = item C < RAKUDO_MAX_THREADS >
191
+ = item C < RAKUDO_MAX_THREADS > ( I < UInt > ; F < src/core.c/ThreadPoolScheduler.pm6 > )
129
192
130
193
Indicates the maximum number of threads used by default when creating a
131
- C < ThreadPoolScheduler > . Defaults to 64.
194
+ C < ThreadPoolScheduler > . Defaults to 64.
132
195
133
196
X < |TMPDIR > X < |TEMP > X < |TMP >
134
- = item C < TMPDIR > , C < TEMP > , C < TMP > :
197
+ = item C < TMPDIR > , C < TEMP > , C < TMP > ( I < Str > ; F < src/core.c/IO/Spec/ > )
135
198
136
199
The C < IO::Spec::Unix.tmpdir > method will return C < $TMPDIR > if it points to a
137
200
directory with full access permissions for the current user, with a fallback
@@ -141,7 +204,7 @@ C<IO::Spec::Cygwin> and C<IO::Spec::Win32> use more Windows-appropriate lists
141
204
which also include the C < %TEMP% > and C < %TMP% > environment variables.
142
205
143
206
X < |PATH >
144
- = item C < PATH > , C < Path >
207
+ = item C < PATH > , C < Path > ( I < Str > ; F < src/core.c/IO/Spec/ > )
145
208
146
209
The C < IO::Spec::Unix.path > method splits C < $PATH > as a
147
210
shell would; i.e. as a colon-separated list. C < IO::Spec::Cygwin > inherits this
@@ -154,15 +217,45 @@ X<|RAKUDO_SNAPPER>
154
217
Indicates the period in which the telemetry snapper will take a snapshot.
155
218
Defaults to .1 for 10 snapshots per second.
156
219
157
- = head1 AUTHORS
220
+ X < |RAKUDO_HOME >
221
+ = item C < RAKUDO_HOME >
222
+
223
+ Allows to override the Raku installation path. Defaults to
224
+ C < [rakudo_executable_dir]/../share/perl6 > in relocatable builds and the
225
+ absolute path to that folder in non-relocatable builds.
226
+
227
+ X < |NQP_HOME >
228
+ = item C < NQP_HOME >
229
+
230
+ Allows to override the NQP installation path. Defaults to
231
+ C < [rakudo_executable_dir]/../share/nqp > in relocatable builds and the absolute
232
+ path to that folder in non-relocatable builds.
233
+
234
+ = head1 WINDOWS PECULIARITIES
235
+
236
+ X < |rakuw.exe > X < |rakudow.exe >
237
+ = head2 Non-console applications
158
238
159
- Initial version written by the Rakudo contributors, see the
160
- L < CREDITS file|https://github.com/rakudo/rakudo/blob/master/CREDITS > .
239
+ On Windows programs are compiled to either be I < console > applications or
240
+ I < non-console > applications. I < Console > applications always open a console
241
+ window. There is no straightforward way to suppress this window.
242
+
243
+ Rakudo provides a separate set of executables suffixed with a C < 'w' >
244
+ (C < rakuw.exe > , C < rakudow.exe > , ...) that are compiled as I < non-console >
245
+ applications. These do not spawn this console window.
246
+
247
+ B < WARNING > By default these I < non-console > applications will silently swallow
248
+ everything that is printed to C < STDOUT > and C < STDERR > .
249
+
250
+ To receive the output of the program it suffices to redirect it externally:
251
+
252
+ rakuw.exe script.raku >stdout.txt 2>stderr.txt
253
+
254
+ = head1 AUTHORS
161
255
162
- The L < initial version of this manual
163
- page|https://github.com/rakudo/rakudo/blob/master/docs/running.pod > was written
164
- by Reini Urban, Moritz Lenz and the Rakudo contributors.
256
+ Written by the Rakudo contributors, see the CREDITS file.
165
257
166
- = end pod
258
+ This manual page was written by Reini Urban, Moritz Lenz and the Rakudo
259
+ contributors.
167
260
168
261
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
0 commit comments