| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (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 |
.\" |
| 57 |
.IX Title "B::Showlex 3perl" |
| 58 |
.TH B::Showlex 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
B::Showlex \- Show lexical variables used in functions or files |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
.Vb 1 |
| 68 |
\& perl \-MO=Showlex[,\-OPTIONS][,SUBROUTINE] foo.pl |
| 69 |
.Ve |
| 70 |
.SH DESCRIPTION |
| 71 |
.IX Header "DESCRIPTION" |
| 72 |
When a comma-separated list of subroutine names is given as options, Showlex |
| 73 |
prints the lexical variables used in those subroutines. Otherwise, it prints |
| 74 |
the file-scope lexicals in the file. |
| 75 |
.SH EXAMPLES |
| 76 |
.IX Header "EXAMPLES" |
| 77 |
Traditional form: |
| 78 |
.PP |
| 79 |
.Vb 10 |
| 80 |
\& $ perl \-MO=Showlex \-e \*(Aqmy ($i,$j,$k)=(1,"foo")\*(Aq |
| 81 |
\& Pad of lexical names for comppadlist has 4 entries |
| 82 |
\& 0: (0x8caea4) undef |
| 83 |
\& 1: (0x9db0fb0) $i |
| 84 |
\& 2: (0x9db0f38) $j |
| 85 |
\& 3: (0x9db0f50) $k |
| 86 |
\& Pad of lexical values for comppadlist has 5 entries |
| 87 |
\& 0: SPECIAL #1 &PL_sv_undef |
| 88 |
\& 1: NULL (0x9da4234) |
| 89 |
\& 2: NULL (0x9db0f2c) |
| 90 |
\& 3: NULL (0x9db0f44) |
| 91 |
\& 4: NULL (0x9da4264) |
| 92 |
\& \-e syntax OK |
| 93 |
.Ve |
| 94 |
.PP |
| 95 |
New-style form: |
| 96 |
.PP |
| 97 |
.Vb 7 |
| 98 |
\& $ perl \-MO=Showlex,\-newlex \-e \*(Aqmy ($i,$j,$k)=(1,"foo")\*(Aq |
| 99 |
\& main Pad has 4 entries |
| 100 |
\& 0: (0x8caea4) undef |
| 101 |
\& 1: (0xa0c4fb8) "$i" = NULL (0xa0b8234) |
| 102 |
\& 2: (0xa0c4f40) "$j" = NULL (0xa0c4f34) |
| 103 |
\& 3: (0xa0c4f58) "$k" = NULL (0xa0c4f4c) |
| 104 |
\& \-e syntax OK |
| 105 |
.Ve |
| 106 |
.PP |
| 107 |
New form, no specials, outside O framework: |
| 108 |
.PP |
| 109 |
.Vb 6 |
| 110 |
\& $ perl \-MB::Showlex \-e \e |
| 111 |
\& \*(Aqmy ($i,$j,$k)=(1,"foo"); B::Showlex::compile(\-newlex,\-nosp)\->()\*(Aq |
| 112 |
\& main Pad has 4 entries |
| 113 |
\& 1: (0x998ffb0) "$i" = IV (0x9983234) 1 |
| 114 |
\& 2: (0x998ff68) "$j" = PV (0x998ff5c) "foo" |
| 115 |
\& 3: (0x998ff80) "$k" = NULL (0x998ff74) |
| 116 |
.Ve |
| 117 |
.PP |
| 118 |
Note that this example shows the values of the lexicals, whereas the other |
| 119 |
examples did not (as they're compile-time only). |
| 120 |
.SS OPTIONS |
| 121 |
.IX Subsection "OPTIONS" |
| 122 |
The \f(CW\*(C`\-newlex\*(C'\fR option produces a more readable \f(CW\*(C`name => value\*(C'\fR format, |
| 123 |
and is shown in the second example above. |
| 124 |
.PP |
| 125 |
The \f(CW\*(C`\-nosp\*(C'\fR option eliminates reporting of SPECIALs, such as \f(CW\*(C`0: SPECIAL |
| 126 |
#1 &PL_sv_undef\*(C'\fR above. Reporting of SPECIALs can sometimes overwhelm |
| 127 |
your declared lexicals. |
| 128 |
.SH "SEE ALSO" |
| 129 |
.IX Header "SEE ALSO" |
| 130 |
B::Showlex can also be used outside of the O framework, as in the third |
| 131 |
example. See B::Concise for a fuller explanation of reasons. |
| 132 |
.SH TODO |
| 133 |
.IX Header "TODO" |
| 134 |
Some of the reported info, such as hex addresses, is not particularly |
| 135 |
valuable. Other information would be more useful for the typical |
| 136 |
programmer, such as line-numbers, pad-slot reuses, etc.. Given this, |
| 137 |
\&\-newlex is not a particularly good flag-name. |
| 138 |
.SH AUTHOR |
| 139 |
.IX Header "AUTHOR" |
| 140 |
Malcolm Beattie, \f(CW\*(C`[email protected]\*(C'\fR |