1B::Showlex(3pm)        Perl Programmers Reference Guide        B::Showlex(3pm)
2
3
4

NAME

6       B::Showlex - Show lexical variables used in functions or files
7

SYNOPSIS

9               perl -MO=Showlex[,-OPTIONS][,SUBROUTINE] foo.pl
10

DESCRIPTION

12       When a comma-separated list of subroutine names is given as options,
13       Showlex prints the lexical variables used in those subroutines.  Other‐
14       wise, it prints the file-scope lexicals in the file.
15

EXAMPLES

17       Traditional form:
18
19        $ perl -MO=Showlex -e 'my ($i,$j,$k)=(1,"foo")'
20        Pad of lexical names for comppadlist has 4 entries
21        0: SPECIAL #1 &PL_sv_undef
22        1: PVNV (0x9db0fb0) $i
23        2: PVNV (0x9db0f38) $j
24        3: PVNV (0x9db0f50) $k
25        Pad of lexical values for comppadlist has 5 entries
26        0: SPECIAL #1 &PL_sv_undef
27        1: NULL (0x9da4234)
28        2: NULL (0x9db0f2c)
29        3: NULL (0x9db0f44)
30        4: NULL (0x9da4264)
31        -e syntax OK
32
33       New-style form:
34
35        $ perl -MO=Showlex,-newlex -e 'my ($i,$j,$k)=(1,"foo")'
36        main Pad has 4 entries
37        0: SPECIAL #1 &PL_sv_undef
38        1: PVNV (0xa0c4fb8) "$i" = NULL (0xa0b8234)
39        2: PVNV (0xa0c4f40) "$j" = NULL (0xa0c4f34)
40        3: PVNV (0xa0c4f58) "$k" = NULL (0xa0c4f4c)
41        -e syntax OK
42
43       New form, no specials, outside O framework:
44
45        $ perl -MB::Showlex -e \
46           'my ($i,$j,$k)=(1,"foo"); B::Showlex::compile(-newlex,-nosp)->()'
47        main Pad has 4 entries
48        1: PVNV (0x998ffb0) "$i" = IV (0x9983234) 1
49        2: PVNV (0x998ff68) "$j" = PV (0x998ff5c) "foo"
50        3: PVNV (0x998ff80) "$k" = NULL (0x998ff74)
51
52       Note that this example shows the values of the lexicals, whereas the
53       other examples did not (as they're compile-time only).
54
55       OPTIONS
56
57       The "-newlex" option produces a more readable "name => value" format,
58       and is shown in the second example above.
59
60       The "-nosp" option eliminates reporting of SPECIALs, such as "0: SPE‐
61       CIAL #1 &PL_sv_undef" above.  Reporting of SPECIALs can sometimes over‐
62       whelm your declared lexicals.
63

SEE ALSO

65       "B::Showlex" can also be used outside of the O framework, as in the
66       third example.  See "B::Concise" for a fuller explanation of reasons.
67

TODO

69       Some of the reported info, such as hex addresses, is not particularly
70       valuable.  Other information would be more useful for the typical pro‐
71       grammer, such as line-numbers, pad-slot reuses, etc..  Given this,
72       -newlex isnt a particularly good flag-name.
73

AUTHOR

75       Malcolm Beattie, "mbeattie@sable.ox.ac.uk"
76
77
78
79perl v5.8.8                       2001-09-21                   B::Showlex(3pm)
Impressum