📄 showlex.html
字号:
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>B::Showlex - Show lexical variables used in functions or files</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body>
<script>writelinks('__top__',2);</script>
<h1><a>B::Showlex - Show lexical variables used in functions or files</a></h1>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#examples">EXAMPLES</a></li>
<ul>
<li><a href="#options">OPTIONS</a></li>
</ul>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#todo">TODO</a></li>
<li><a href="#author">AUTHOR</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>B::Showlex - Show lexical variables used in functions or files</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
perl -MO=Showlex[,-OPTIONS][,SUBROUTINE] foo.pl</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>When a comma-separated list of subroutine names is given as options, Showlex
prints the lexical variables used in those subroutines. Otherwise, it prints
the file-scope lexicals in the file.</p>
<p>
</p>
<hr />
<h1><a name="examples">EXAMPLES</a></h1>
<p>Traditional form:</p>
<pre>
$ perl -MO=Showlex -e 'my ($i,$j,$k)=(1,"foo")'
Pad of lexical names for comppadlist has 4 entries
0: SPECIAL #1 &PL_sv_undef
1: PVNV (0x9db0fb0) $i
2: PVNV (0x9db0f38) $j
3: PVNV (0x9db0f50) $k
Pad of lexical values for comppadlist has 5 entries
0: SPECIAL #1 &PL_sv_undef
1: NULL (0x9da4234)
2: NULL (0x9db0f2c)
3: NULL (0x9db0f44)
4: NULL (0x9da4264)
-e syntax OK</pre>
<p>New-style form:</p>
<pre>
$ perl -MO=Showlex,-newlex -e 'my ($i,$j,$k)=(1,"foo")'
main Pad has 4 entries
0: SPECIAL #1 &PL_sv_undef
1: PVNV (0xa0c4fb8) "$i" = NULL (0xa0b8234)
2: PVNV (0xa0c4f40) "$j" = NULL (0xa0c4f34)
3: PVNV (0xa0c4f58) "$k" = NULL (0xa0c4f4c)
-e syntax OK</pre>
<p>New form, no specials, outside O framework:</p>
<pre>
<span class="operator">$ </span><span class="variable">perl</span> <span class="operator">-</span><span class="variable">MB::Showlex</span> <span class="keyword">-e</span> <span class="operator">\</span>
<span class="string">'my ($i,$j,$k)=(1,"foo"); B::Showlex::compile(-newlex,-nosp)->()'</span>
<span class="variable">main</span> <span class="variable">Pad</span> <span class="variable">has</span> <span class="number">4</span> <span class="variable">entries</span>
<span class="number">1</span><span class="operator">:</span> <span class="variable">PVNV</span> <span class="operator">(</span><span class="number">0x998ffb0</span><span class="operator">)</span> <span class="string">"$i"</span> <span class="operator">=</span> <span class="variable">IV</span> <span class="operator">(</span><span class="number">0x9983234</span><span class="operator">)</span> <span class="number">1</span>
<span class="number">2</span><span class="operator">:</span> <span class="variable">PVNV</span> <span class="operator">(</span><span class="number">0x998ff68</span><span class="operator">)</span> <span class="string">"$j"</span> <span class="operator">=</span> <span class="variable">PV</span> <span class="operator">(</span><span class="number">0x998ff5c</span><span class="operator">)</span> <span class="string">"foo"</span>
<span class="number">3</span><span class="operator">:</span> <span class="variable">PVNV</span> <span class="operator">(</span><span class="number">0x998ff80</span><span class="operator">)</span> <span class="string">"$k"</span> <span class="operator">=</span> <span class="keyword">NULL</span> <span class="operator">(</span><span class="number">0x998ff74</span><span class="operator">)</span>
</pre>
<p>Note that this example shows the values of the lexicals, whereas the other
examples did not (as they're compile-time only).</p>
<p>
</p>
<h2><a name="options">OPTIONS</a></h2>
<p>The <code>-newlex</code> option produces a more readable <code>name => value</code> format,
and is shown in the second example above.</p>
<p>The <code>-nosp</code> option eliminates reporting of SPECIALs, such as <code>0: SPECIAL
#1 &PL_sv_undef</code> above. Reporting of SPECIALs can sometimes overwhelm
your declared lexicals.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><code>B::Showlex</code> can also be used outside of the O framework, as in the third
example. See <code>B::Concise</code> for a fuller explanation of reasons.</p>
<p>
</p>
<hr />
<h1><a name="todo">TODO</a></h1>
<p>Some of the reported info, such as hex addresses, is not particularly
valuable. Other information would be more useful for the typical
programmer, such as line-numbers, pad-slot reuses, etc.. Given this,
-newlex isnt a particularly good flag-name.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Malcolm Beattie, <code>mbeattie@sable.ox.ac.uk</code></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -