Skip to content

Commit 4510b39

Browse files
committed
APIify and document several interpreter variables
2 parents 6e23836 + 8008a6e commit 4510b39

File tree

2 files changed

+94
-4
lines changed

2 files changed

+94
-4
lines changed

intrpvar.h

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ PERLVARI(I, tainted, bool, FALSE) /* using variables controlled by $< */
9393
*/
9494
PERLVAR(I, delaymagic, U16) /* ($<,$>) = ... */
9595

96+
/*
97+
=for apidoc Amn|GV *|PL_defgv
98+
99+
The GV representing C<*_>. Useful for access to C<$_>.
100+
101+
=cut
102+
*/
103+
96104
PERLVAR(I, localizing, U8) /* are we processing a local() list? */
97105
PERLVAR(I, in_eval, U8) /* trap "fatal" errors? */
98106
PERLVAR(I, defgv, GV *) /* the *_ glob */
@@ -117,11 +125,27 @@ PERLVAR(I, dowarn, U8)
117125
PERLVARI(I, utf8cache, I8, PERL___I) /* Is the utf8 caching code enabled? */
118126
#undef PERL___I
119127

128+
/*
129+
=for apidoc Amn|HV*|PL_curstash
130+
131+
The stash for the package code will be compiled into.
132+
133+
=cut
134+
*/
120135

121136
/* Stashes */
122137
PERLVAR(I, defstash, HV *) /* main symbol table */
123138
PERLVAR(I, curstash, HV *) /* symbol table for current package */
124139

140+
/*
141+
=for apidoc Amn|COP*|PL_curcop
142+
143+
The currently active COP (control op) roughly representing the current
144+
statement in the source.
145+
146+
=cut
147+
*/
148+
125149
PERLVAR(I, curcop, COP *)
126150
PERLVAR(I, curstack, AV *) /* THE STACK */
127151
PERLVAR(I, curstackinfo, PERL_SI *) /* current stack + context */
@@ -182,6 +206,14 @@ PERLVAR(I, padname_undef, PADNAME)
182206
PERLVAR(I, padname_const, PADNAME)
183207
PERLVAR(I, Sv, SV *) /* used to hold temporary values */
184208

209+
/*
210+
=for apidoc Amn|yy_parser*|PL_parser
211+
212+
The parser state when compiling code.
213+
214+
=cut
215+
*/
216+
185217
PERLVAR(I, parser, yy_parser *) /* current parser state */
186218

187219
PERLVAR(I, stashcache, HV *) /* Cache to speed up S_method_common */
@@ -257,6 +289,37 @@ PERLVAR(I, efloatsize, STRLEN)
257289
PERLVARI(I, dumpindent, U16, 4) /* number of blanks per dump
258290
indentation level */
259291

292+
/*
293+
=for apidoc Amn|U8|PL_exit_flags
294+
295+
Contains flags controlling perl's behaviour on exit():
296+
297+
=over
298+
299+
=item * C<PERL_EXIT_DESTRUCT_END>
300+
301+
If set, END blocks are executed when the interpreter is destroyed.
302+
This is normally set by perl itself after the interpreter is
303+
constructed.
304+
305+
=item * C<PERL_EXIT_ABORT>
306+
307+
Call C<abort()> on exit. This is used internally by perl itself to
308+
abort if exit is called while processing exit.
309+
310+
=item * C<PERL_EXIT_WARN>
311+
312+
Warn on exit.
313+
314+
=item * C<PERL_EXIT_EXPECTED>
315+
316+
Set by the L<perlfunc/exit> operator.
317+
318+
=back
319+
320+
=cut
321+
*/
322+
260323
PERLVAR(I, exit_flags, U8) /* was exit() unexpected, etc. */
261324

262325
PERLVAR(I, utf8locale, bool) /* utf8 locale detected */
@@ -565,6 +628,14 @@ PERLVAR(I, debug, volatile U32) /* flags given to -D switch */
565628

566629
PERLVARI(I, padlist_generation, U32, 1) /* id to identify padlist clones */
567630

631+
/*
632+
=for apidoc Amn|runops_proc_t|PL_runops
633+
634+
See L<perlguts/Pluggable runops>.
635+
636+
=cut
637+
*/
638+
568639
PERLVARI(I, runops, runops_proc_t, RUNOPS_DEFAULT)
569640

570641
PERLVAR(I, subname, SV *) /* name of current subroutine */
@@ -619,8 +690,28 @@ PERLVARI(I, phase, enum perl_phase, PERL_PHASE_CONSTRUCT)
619690

620691
PERLVARI(I, in_load_module, bool, FALSE) /* to prevent recursions in PerlIO_find_layer */
621692

622-
/* This value may be set when embedding for full cleanup */
623-
/* 0=none, 1=full, 2=full with checks */
693+
/*
694+
=for apidoc Amn|signed char|PL_perl_destruct_level
695+
696+
This value may be set when embedding for full cleanup.
697+
698+
Possible values:
699+
700+
=over
701+
702+
=item * 0 - none
703+
704+
=item * 1 - full
705+
706+
=item * 2 or greater - full with checks.
707+
708+
=back
709+
710+
If C<$ENV{PERL_DESTRUCT_LEVEL}> is set to an integer greater than the
711+
value of C<PL_perl_destruct_level> its value is used instead.
712+
713+
=cut
714+
*/
624715
/* mod_perl is special, and also assigns a meaning -1 */
625716
PERLVARI(I, perl_destruct_level, signed char, 0)
626717

pod/perlrun.pod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,8 +1257,7 @@ after compilation.
12571257
=item PERL_DESTRUCT_LEVEL
12581258
X<PERL_DESTRUCT_LEVEL>
12591259

1260-
Relevant only if your Perl executable was built with B<-DDEBUGGING>,
1261-
this controls the behaviour of global destruction of objects and other
1260+
Controls the behaviour of global destruction of objects and other
12621261
references. See L<perlhacktips/PERL_DESTRUCT_LEVEL> for more information.
12631262

12641263
=item PERL_DL_NONLAZY

0 commit comments

Comments
 (0)