diff options
author | Felipe Gasper <felipe@felipegasper.com> | 2021-08-05 16:01:44 -0400 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2021-11-25 15:07:56 +1100 |
commit | eb87cedb600ef8f1265ce27b13197ca7cbc33297 (patch) | |
tree | 6503da176300bc8363ce0d90ec70f7bb35c86bf5 /perl.h | |
parent | caa9af33e832c2614fd55d0d5a06dc716baf9c17 (diff) | |
download | perl-eb87cedb600ef8f1265ce27b13197ca7cbc33297.tar.gz |
Add a phase_name() macro.
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -5423,6 +5423,24 @@ EXTCONST char *const PL_phase_names[] = { EXTCONST char *const PL_phase_names[]; #endif +/* +=for apidoc_section $utility + +=for apidoc Amd|char *const|phase_name|enum perl_phase + +Returns the given phase's name as a NUL-terminated string. + +For example, to print a stack trace that includes the current +interpreter phase you might do: + + const char* phase_name = phase_name(PL_phase); + mess("This is weird. (Perl phase: %s)", phase_name); + +=cut +*/ + +#define phase_name(phase) (PL_phase_names[phase]) + #ifndef PERL_CORE /* Do not use this macro. It only exists for extensions that rely on PL_dirty * instead of using the newer PL_phase, which provides everything PL_dirty |