version 2, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
PERLUTIL |
|
|
2 |
!!!PERLUTIL |
|
|
3 |
NAME |
|
|
4 |
DESCRIPTION |
|
|
5 |
---- |
|
|
6 |
!!NAME |
|
|
7 |
|
|
|
8 |
|
|
|
9 |
perlutil - utilities packaged with the Perl distribution |
|
|
10 |
!!DESCRIPTION |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
Along with the Perl interpreter itself, the Perl |
|
|
14 |
distribution installs a range of utilities on your system. |
|
|
15 |
There are also several utilities which are used by the Perl |
|
|
16 |
distribution itself as part of the install process. This |
|
|
17 |
document exists to list all of these utilities, explain what |
|
|
18 |
they are for and provide pointers to each module's |
|
|
19 |
documentation, if appropriate. |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
__DOCUMENTATION__ |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
perldoc |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
The main interface to Perl's documentation is |
|
|
29 |
perldoc, although if you're reading this, it's more |
|
|
30 |
than likely that you've already found it. ''perldoc'' |
|
|
31 |
will extract and format the documentation from any file in |
|
|
32 |
the current directory, any Perl module installed on the |
|
|
33 |
system, or any of the standard documentation pages, such as |
|
|
34 |
this one. Use perldoc to get |
|
|
35 |
information on any of the utilities described in this |
|
|
36 |
document. |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
pod2man and pod2text |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
If it's run from a terminal, ''perldoc'' will usually |
|
|
43 |
call ''pod2man'' to translate POD (Plain |
|
|
44 |
Old Documentation - see perlpod for an explanation) into a |
|
|
45 |
man page, and then run ''man'' to display it; if |
|
|
46 |
''man'' isn't available, ''pod2text'' will be used |
|
|
47 |
instead and the output piped through your favourite |
|
|
48 |
pager. |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
pod2html and pod2latex |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
As well as these two, there are two other converters: |
|
|
55 |
''pod2html'' will produce HTML pages from |
|
|
56 |
POD , and ''pod2latex'', which produces |
|
|
57 |
LaTeX files. |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
pod2usage |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
If you just want to know how to use the utilities described |
|
|
64 |
here, ''pod2usage'' will just extract the `` |
|
|
65 |
USAGE '' section; some of the utilities will |
|
|
66 |
automatically call ''pod2usage'' on themselves when you |
|
|
67 |
call them with -help. |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
podselect |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
''pod2usage'' is a special case of ''podselect'', a |
|
|
74 |
utility to extract named sections from documents written in |
|
|
75 |
POD . For instance, while utilities have `` |
|
|
76 |
USAGE '' sections, Perl modules usually have |
|
|
77 |
`` SYNOPSIS '' sections: podselect -s |
|
|
78 |
will extract this section for |
|
|
79 |
a given file. |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
podchecker |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
If you're writing your own documentation in |
|
|
86 |
POD , the ''podchecker'' utility will look |
|
|
87 |
for errors in your markup. |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
splain |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
''splain'' is an interface to perldiag - paste in your |
|
|
94 |
error message to it, and it'll explain it for |
|
|
95 |
you. |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
roffitall |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
The roffitall utility is not installed on your |
|
|
102 |
system but lives in the ''pod/'' directory of your Perl |
|
|
103 |
source kit; it converts all the documentation from the |
|
|
104 |
distribution to ''*roff'' format, and produces a typeset |
2 |
perry |
105 |
!PostScript or text file of the whole lot. |
1 |
perry |
106 |
|
|
|
107 |
|
|
|
108 |
__CONVERTORS__ |
|
|
109 |
|
|
|
110 |
|
|
|
111 |
To help you convert legacy programs to Perl, we've included |
|
|
112 |
three conversion filters: |
|
|
113 |
|
|
|
114 |
|
|
|
115 |
a2p |
|
|
116 |
|
|
|
117 |
|
|
|
118 |
''a2p'' converts ''awk'' scripts to Perl programs; for |
|
|
119 |
example, a2p -F: on the simple ''awk'' script |
|
|
120 |
{print $2} will produce a Perl program based around |
|
|
121 |
this code: |
|
|
122 |
|
|
|
123 |
|
|
|
124 |
while ( |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
s2p |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
Similarly, ''s2p'' converts ''sed'' scripts to Perl |
|
|
131 |
programs. ''s2p'' run on s/foo/bar will produce |
|
|
132 |
a Perl program based around this: |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
while ( |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
find2perl |
|
|
139 |
|
|
|
140 |
|
|
|
141 |
Finally, ''find2perl'' translates find commands |
|
|
142 |
to Perl equivalents which use the File::Find module. As an |
|
|
143 |
example, find2perl . -user root -perm 4000 -print |
|
|
144 |
produces the following callback subroutine for |
|
|
145 |
File::Find: |
|
|
146 |
|
|
|
147 |
|
|
|
148 |
sub wanted { |
|
|
149 |
my ($dev,$ino,$mode,$nlink,$uid,$gid); |
|
|
150 |
(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) |
|
|
151 |
|
|
|
152 |
|
|
|
153 |
As well as these filters for converting other languages, the |
|
|
154 |
pl2pm utility will help you convert old-style Perl 4 |
|
|
155 |
libraries to new-style Perl5 modules. |
|
|
156 |
|
|
|
157 |
|
|
|
158 |
__Development__ |
|
|
159 |
|
|
|
160 |
|
|
|
161 |
There are a set of utilities which help you in developing |
|
|
162 |
Perl programs, and in particular, extending Perl with |
|
|
163 |
C. |
|
|
164 |
|
|
|
165 |
|
|
|
166 |
perlbug |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
''perlbug'' is the recommended way to report bugs in the |
|
|
170 |
perl interpreter itself or any of the standard library |
|
|
171 |
modules back to the developers; please read through the |
|
|
172 |
documentation for ''perlbug'' thoroughly before using it |
|
|
173 |
to submit a bug report. |
|
|
174 |
|
|
|
175 |
|
|
|
176 |
h2ph |
|
|
177 |
|
|
|
178 |
|
|
|
179 |
Back before Perl had the XS system for |
|
|
180 |
connecting with C libraries, programmers used to get library |
|
|
181 |
constants by reading through the C header files. You may |
|
|
182 |
still see require 'syscall.ph' or similar around - |
|
|
183 |
the ''.ph'' file should be created by running ''h2ph'' |
|
|
184 |
on the corresponding ''.h'' file. See the ''h2ph'' |
|
|
185 |
documentation for more on how to convert a whole bunch of |
|
|
186 |
header files at ones. |
|
|
187 |
|
|
|
188 |
|
|
|
189 |
c2ph and pstruct |
|
|
190 |
|
|
|
191 |
|
|
|
192 |
''c2ph'' and ''pstruct'', which are actually the same |
|
|
193 |
program but behave differently depending on how they are |
|
|
194 |
called, provide another way of getting at C with Perl - |
|
|
195 |
they'll convert C structures and union declarations to Perl |
|
|
196 |
code. This is deprecated in favour of ''h2xs'' these |
|
|
197 |
days. |
|
|
198 |
|
|
|
199 |
|
|
|
200 |
h2xs |
|
|
201 |
|
|
|
202 |
|
|
|
203 |
''h2xs'' converts C header files into XS |
|
|
204 |
modules, and will try and write as much glue between C |
|
|
205 |
libraries and Perl modules as it can. It's also very useful |
|
|
206 |
for creating skeletons of pure Perl modules. |
|
|
207 |
|
|
|
208 |
|
|
|
209 |
dprofpp |
|
|
210 |
|
|
|
211 |
|
|
|
212 |
Perl comes with a profiler, the ''Devel::Dprof'' module. |
|
|
213 |
The ''dprofpp'' utility analyzes the output of this |
|
|
214 |
profiler and tells you which subroutines are taking up the |
|
|
215 |
most run time. See Devel::Dprof for more |
|
|
216 |
information. |
|
|
217 |
|
|
|
218 |
|
|
|
219 |
perlcc |
|
|
220 |
|
|
|
221 |
|
|
|
222 |
''perlcc'' is the interface to the experimental Perl |
|
|
223 |
compiler suite. |
|
|
224 |
|
|
|
225 |
|
|
|
226 |
__SEE ALSO__ |
|
|
227 |
|
|
|
228 |
|
|
|
229 |
perldoc, pod2man, perlpod, pod2html, pod2usage, podselect, |
|
|
230 |
podchecker, splain, perldiag, roffitall, a2p, s2p, |
|
|
231 |
find2perl, File::Find, pl2pm, perlbug, h2ph, c2ph, h2xs, |
|
|
232 |
dprofpp, Devel::Dprof, perlcc |
|
|
233 |
---- |