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