Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / man / man1 / perlfaq3.1
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "PERLFAQ3 1"
132.TH PERLFAQ3 1 "2006-01-07" "perl v5.8.8" "Perl Programmers Reference Guide"
133.SH "NAME"
134perlfaq3 \- Programming Tools ($Revision: 1.56 $, $Date: 2005/12/31 00:54:37 $)
135.SH "DESCRIPTION"
136.IX Header "DESCRIPTION"
137This section of the \s-1FAQ\s0 answers questions related to programmer tools
138and programming support.
139.Sh "How do I do (anything)?"
140.IX Subsection "How do I do (anything)?"
141Have you looked at \s-1CPAN\s0 (see perlfaq2)? The chances are that
142someone has already written a module that can solve your problem.
143Have you read the appropriate manpages? Here's a brief index:
144.PP
145.Vb 12
146\& Basics perldata, perlvar, perlsyn, perlop, perlsub
147\& Execution perlrun, perldebug
148\& Functions perlfunc
149\& Objects perlref, perlmod, perlobj, perltie
150\& Data Structures perlref, perllol, perldsc
151\& Modules perlmod, perlmodlib, perlsub
152\& Regexes perlre, perlfunc, perlop, perllocale
153\& Moving to perl5 perltrap, perl
154\& Linking w/C perlxstut, perlxs, perlcall, perlguts, perlembed
155\& Various http://www.cpan.org/misc/olddoc/FMTEYEWTK.tgz
156\& (not a man-page but still useful, a collection
157\& of various essays on Perl techniques)
158.Ve
159.PP
160A crude table of contents for the Perl manpage set is found in perltoc.
161.Sh "How can I use Perl interactively?"
162.IX Subsection "How can I use Perl interactively?"
163The typical approach uses the Perl debugger, described in the
164\&\fIperldebug\fR\|(1) manpage, on an \*(L"empty\*(R" program, like this:
165.PP
166.Vb 1
167\& perl -de 42
168.Ve
169.PP
170Now just type in any legal Perl code, and it will be immediately
171evaluated. You can also examine the symbol table, get stack
172backtraces, check variable values, set breakpoints, and other
173operations typically found in symbolic debuggers.
174.Sh "Is there a Perl shell?"
175.IX Subsection "Is there a Perl shell?"
176The psh (Perl sh) is currently at version 1.8. The Perl Shell is a shell
177that combines the interactive nature of a Unix shell with the power of
178Perl. The goal is a full featured shell that behaves as expected for
179normal shell activity and uses Perl syntax and functionality for
180control-flow statements and other things. You can get psh at
181http://sourceforge.net/projects/psh/ .
182.PP
183Zoidberg is a similar project and provides a shell written in perl,
184configured in perl and operated in perl. It is intended as a login shell
185and development environment. It can be found at http://zoidberg.sf.net/
186or your local \s-1CPAN\s0 mirror.
187.PP
188The Shell.pm module (distributed with Perl) makes Perl try commands
189which aren't part of the Perl language as shell commands. perlsh from
190the source distribution is simplistic and uninteresting, but may still
191be what you want.
192.Sh "How do I find which modules are installed on my system?"
193.IX Subsection "How do I find which modules are installed on my system?"
194You can use the ExtUtils::Installed module to show all installed
195distributions, although it can take awhile to do its magic. The
196standard library which comes with Perl just shows up as \*(L"Perl\*(R" (although
197you can get those with Module::CoreList).
198.PP
199.Vb 1
200\& use ExtUtils::Installed;
201.Ve
202.PP
203.Vb 2
204\& my $inst = ExtUtils::Installed->new();
205\& my @modules = $inst->modules();
206.Ve
207.PP
208If you want a list of all of the Perl module filenames, you
209can use File::Find::Rule.
210.PP
211.Vb 1
212\& use File::Find::Rule;
213.Ve
214.PP
215.Vb 1
216\& my @files = File::Find::Rule->file()->name( '*.pm' )->in( @INC );
217.Ve
218.PP
219If you do not have that module, you can do the same thing
220with File::Find which is part of the standard library.
221.PP
222.Vb 2
223\& use File::Find;
224\& my @files;
225.Ve
226.PP
227.Vb 5
228\& find(
229\& sub {
230\& push @files, $File::Find::name
231\& if -f $File::Find::name && /\e.pm$/
232\& },
233.Ve
234.PP
235.Vb 2
236\& @INC
237\& );
238.Ve
239.PP
240.Vb 1
241\& print join "\en", @files;
242.Ve
243.PP
244If you simply need to quickly check to see if a module is
245available, you can check for its documentation. If you can
246read the documentation the module is most likely installed.
247If you cannot read the documentation, the module might not
248have any (in rare cases).
249.PP
250.Vb 1
251\& prompt% perldoc Module::Name
252.Ve
253.PP
254You can also try to include the module in a one-liner to see if
255perl finds it.
256.PP
257.Vb 1
258\& perl -MModule::Name -e1
259.Ve
260.Sh "How do I debug my Perl programs?"
261.IX Subsection "How do I debug my Perl programs?"
262Have you tried \f(CW\*(C`use warnings\*(C'\fR or used \f(CW\*(C`\-w\*(C'\fR? They enable warnings
263to detect dubious practices.
264.PP
265Have you tried \f(CW\*(C`use strict\*(C'\fR? It prevents you from using symbolic
266references, makes you predeclare any subroutines that you call as bare
267words, and (probably most importantly) forces you to predeclare your
268variables with \f(CW\*(C`my\*(C'\fR, \f(CW\*(C`our\*(C'\fR, or \f(CW\*(C`use vars\*(C'\fR.
269.PP
270Did you check the return values of each and every system call? The operating
271system (and thus Perl) tells you whether they worked, and if not
272why.
273.PP
274.Vb 2
275\& open(FH, "> /etc/cantwrite")
276\& or die "Couldn't write to /etc/cantwrite: $!\en";
277.Ve
278.PP
279Did you read perltrap? It's full of gotchas for old and new Perl
280programmers and even has sections for those of you who are upgrading
281from languages like \fIawk\fR and \fIC\fR.
282.PP
283Have you tried the Perl debugger, described in perldebug? You can
284step through your program and see what it's doing and thus work out
285why what it's doing isn't what it should be doing.
286.Sh "How do I profile my Perl programs?"
287.IX Subsection "How do I profile my Perl programs?"
288You should get the Devel::DProf module from the standard distribution
289(or separately on \s-1CPAN\s0) and also use Benchmark.pm from the standard
290distribution. The Benchmark module lets you time specific portions of
291your code, while Devel::DProf gives detailed breakdowns of where your
292code spends its time.
293.PP
294Here's a sample use of Benchmark:
295.PP
296.Vb 1
297\& use Benchmark;
298.Ve
299.PP
300.Vb 2
301\& @junk = `cat /etc/motd`;
302\& $count = 10_000;
303.Ve
304.PP
305.Vb 8
306\& timethese($count, {
307\& 'map' => sub { my @a = @junk;
308\& map { s/a/b/ } @a;
309\& return @a },
310\& 'for' => sub { my @a = @junk;
311\& for (@a) { s/a/b/ };
312\& return @a },
313\& });
314.Ve
315.PP
316This is what it prints (on one machine\*(--your results will be dependent
317on your hardware, operating system, and the load on your machine):
318.PP
319.Vb 3
320\& Benchmark: timing 10000 iterations of for, map...
321\& for: 4 secs ( 3.97 usr 0.01 sys = 3.98 cpu)
322\& map: 6 secs ( 4.97 usr 0.00 sys = 4.97 cpu)
323.Ve
324.PP
325Be aware that a good benchmark is very hard to write. It only tests the
326data you give it and proves little about the differing complexities
327of contrasting algorithms.
328.Sh "How do I cross-reference my Perl programs?"
329.IX Subsection "How do I cross-reference my Perl programs?"
330The B::Xref module can be used to generate cross-reference reports
331for Perl programs.
332.PP
333.Vb 1
334\& perl -MO=Xref[,OPTIONS] scriptname.plx
335.Ve
336.Sh "Is there a pretty-printer (formatter) for Perl?"
337.IX Subsection "Is there a pretty-printer (formatter) for Perl?"
338Perltidy is a Perl script which indents and reformats Perl scripts
339to make them easier to read by trying to follow the rules of the
340perlstyle. If you write Perl scripts, or spend much time reading
341them, you will probably find it useful. It is available at
342http://perltidy.sourceforge.net
343.PP
344Of course, if you simply follow the guidelines in perlstyle,
345you shouldn't need to reformat. The habit of formatting your code
346as you write it will help prevent bugs. Your editor can and should
347help you with this. The perl-mode or newer cperl-mode for emacs
348can provide remarkable amounts of help with most (but not all)
349code, and even less programmable editors can provide significant
350assistance. Tom Christiansen and many other \s-1VI\s0 users swear by
351the following settings in vi and its clones:
352.PP
353.Vb 2
354\& set ai sw=4
355\& map! ^O {^M}^[O^T
356.Ve
357.PP
358Put that in your \fI.exrc\fR file (replacing the caret characters
359with control characters) and away you go. In insert mode, ^T is
360for indenting, ^D is for undenting, and ^O is for blockdenting\*(--
361as it were. A more complete example, with comments, can be found at
362http://www.cpan.org/authors/id/TOMC/scripts/toms.exrc.gz
363.PP
364The a2ps http://www\-inf.enst.fr/%7Edemaille/a2ps/black+white.ps.gz does
365lots of things related to generating nicely printed output of
366documents, as does enscript at http://people.ssh.fi/mtr/genscript/ .
367.Sh "Is there a ctags for Perl?"
368.IX Subsection "Is there a ctags for Perl?"
369(contributed by brian d foy)
370.PP
371Exuberent ctags supports Perl: http://ctags.sourceforge.net/
372.PP
373You might also try pltags: http://www.mscha.com/pltags.zip
374.Sh "Is there an \s-1IDE\s0 or Windows Perl Editor?"
375.IX Subsection "Is there an IDE or Windows Perl Editor?"
376Perl programs are just plain text, so any editor will do.
377.PP
378If you're on Unix, you already have an IDE\*(--Unix itself. The \s-1UNIX\s0
379philosophy is the philosophy of several small tools that each do one
380thing and do it well. It's like a carpenter's toolbox.
381.PP
382If you want an \s-1IDE\s0, check the following (in alphabetical order, not
383order of preference):
384.IP "Eclipse" 4
385.IX Item "Eclipse"
386http://e\-p\-i\-c.sf.net/
387.Sp
388The Eclipse Perl Integration Project integrates Perl
389editing/debugging with Eclipse.
390.IP "Enginsite" 4
391.IX Item "Enginsite"
392http://www.enginsite.com/
393.Sp
394Perl Editor by EngInSite is a complete integrated development
395environment (\s-1IDE\s0) for creating, testing, and debugging Perl scripts;
396the tool runs on Windows 9x/NT/2000/XP or later.
397.IP "Komodo" 4
398.IX Item "Komodo"
399http://www.ActiveState.com/Products/Komodo/
400.Sp
401ActiveState's cross-platform (as of October 2004, that's Windows, Linux,
402and Solaris), multi-language \s-1IDE\s0 has Perl support, including a regular expression
403debugger and remote debugging.
404.IP "Open Perl \s-1IDE\s0" 4
405.IX Item "Open Perl IDE"
406http://open\-perl\-ide.sourceforge.net/
407.Sp
408Open Perl \s-1IDE\s0 is an integrated development environment for writing
409and debugging Perl scripts with ActiveState's ActivePerl distribution
410under Windows 95/98/NT/2000.
411.IP "OptiPerl" 4
412.IX Item "OptiPerl"
413http://www.optiperl.com/
414.Sp
415OptiPerl is a Windows \s-1IDE\s0 with simulated \s-1CGI\s0 environment, including
416debugger and syntax highlighting editor.
417.IP "PerlBuilder" 4
418.IX Item "PerlBuilder"
419http://www.solutionsoft.com/perl.htm
420.Sp
421PerlBuidler is an integrated development environment for Windows that
422supports Perl development.
423.IP "visiPerl+" 4
424.IX Item "visiPerl+"
425http://helpconsulting.net/visiperl/
426.Sp
427From Help Consulting, for Windows.
428.IP "Visual Perl" 4
429.IX Item "Visual Perl"
430http://www.activestate.com/Products/Visual_Perl/
431.Sp
432Visual Perl is a Visual Studio.NET plug-in from ActiveState.
433.IP "Zeus" 4
434.IX Item "Zeus"
435http://www.zeusedit.com/lookmain.html
436.Sp
437Zeus for Window is another Win32 multi-language editor/IDE
438that comes with support for Perl:
439.PP
440For editors: if you're on Unix you probably have vi or a vi clone
441already, and possibly an emacs too, so you may not need to download
442anything. In any emacs the cperl-mode (M\-x cperl\-mode) gives you
443perhaps the best available Perl editing mode in any editor.
444.PP
445If you are using Windows, you can use any editor that lets you work
446with plain text, such as NotePad or WordPad. Word processors, such as
447Microsoft Word or WordPerfect, typically do not work since they insert
448all sorts of behind-the-scenes information, although some allow you to
449save files as \*(L"Text Only\*(R". You can also download text editors designed
450specifically for programming, such as Textpad (
451http://www.textpad.com/ ) and UltraEdit ( http://www.ultraedit.com/ ),
452among others.
453.PP
454If you are using MacOS, the same concerns apply. MacPerl (for Classic
455environments) comes with a simple editor. Popular external editors are
456BBEdit ( http://www.bbedit.com/ ) or Alpha (
457http://www.his.com/~jguyer/Alpha/Alpha8.html ). MacOS X users can use
458Unix editors as well. Neil Bowers (the man behind Geekcruises) has a
459list of Mac editors that can handle Perl (
460http://www.neilbowers.org/macperleditors.html ).
461.IP "\s-1GNU\s0 Emacs" 4
462.IX Item "GNU Emacs"
463http://www.gnu.org/software/emacs/windows/ntemacs.html
464.IP "MicroEMACS" 4
465.IX Item "MicroEMACS"
466http://www.microemacs.de/
467.IP "XEmacs" 4
468.IX Item "XEmacs"
469http://www.xemacs.org/Download/index.html
470.IP "Jed" 4
471.IX Item "Jed"
472http://space.mit.edu/~davis/jed/
473.PP
474or a vi clone such as
475.IP "Elvis" 4
476.IX Item "Elvis"
477ftp://ftp.cs.pdx.edu/pub/elvis/ http://www.fh\-wedel.de/elvis/
478.IP "Vile" 4
479.IX Item "Vile"
480http://dickey.his.com/vile/vile.html
481.IP "Vim" 4
482.IX Item "Vim"
483http://www.vim.org/
484.PP
485For vi lovers in general, Windows or elsewhere:
486.PP
487.Vb 1
488\& http://www.thomer.com/thomer/vi/vi.html
489.Ve
490.PP
491nvi ( http://www.bostic.com/vi/ , available from \s-1CPAN\s0 in src/misc/) is
492yet another vi clone, unfortunately not available for Windows, but in
493\&\s-1UNIX\s0 platforms you might be interested in trying it out, firstly because
494strictly speaking it is not a vi clone, it is the real vi, or the new
495incarnation of it, and secondly because you can embed Perl inside it
496to use Perl as the scripting language. nvi is not alone in this,
497though: at least also vim and vile offer an embedded Perl.
498.PP
499The following are Win32 multilanguage editor/IDESs that support Perl:
500.IP "Codewright" 4
501.IX Item "Codewright"
502http://www.borland.com/codewright/
503.IP "MultiEdit" 4
504.IX Item "MultiEdit"
505http://www.MultiEdit.com/
506.IP "SlickEdit" 4
507.IX Item "SlickEdit"
508http://www.slickedit.com/
509.PP
510There is also a toyedit Text widget based editor written in Perl
511that is distributed with the Tk module on \s-1CPAN\s0. The ptkdb
512( http://world.std.com/~aep/ptkdb/ ) is a Perl/tk based debugger that
513acts as a development environment of sorts. Perl Composer
514( http://perlcomposer.sourceforge.net/ ) is an \s-1IDE\s0 for Perl/Tk
515\&\s-1GUI\s0 creation.
516.PP
517In addition to an editor/IDE you might be interested in a more
518powerful shell environment for Win32. Your options include
519.IP "Bash" 4
520.IX Item "Bash"
521from the Cygwin package ( http://sources.redhat.com/cygwin/ )
522.IP "Ksh" 4
523.IX Item "Ksh"
524from the \s-1MKS\s0 Toolkit ( http://www.mks.com/ ), or the Bourne shell of
525the U/WIN environment ( http://www.research.att.com/sw/tools/uwin/ )
526.IP "Tcsh" 4
527.IX Item "Tcsh"
528ftp://ftp.astron.com/pub/tcsh/ , see also
529http://www.primate.wisc.edu/software/csh\-tcsh\-book/
530.IP "Zsh" 4
531.IX Item "Zsh"
532ftp://ftp.blarg.net/users/amol/zsh/ , see also http://www.zsh.org/
533.PP
534\&\s-1MKS\s0 and U/WIN are commercial (U/WIN is free for educational and
535research purposes), Cygwin is covered by the \s-1GNU\s0 Public License (but
536that shouldn't matter for Perl use). The Cygwin, \s-1MKS\s0, and U/WIN all
537contain (in addition to the shells) a comprehensive set of standard
538\&\s-1UNIX\s0 toolkit utilities.
539.PP
540If you're transferring text files between Unix and Windows using \s-1FTP\s0
541be sure to transfer them in \s-1ASCII\s0 mode so the ends of lines are
542appropriately converted.
543.PP
544On Mac \s-1OS\s0 the MacPerl Application comes with a simple 32k text editor
545that behaves like a rudimentary \s-1IDE\s0. In contrast to the MacPerl Application
546the \s-1MPW\s0 Perl tool can make use of the \s-1MPW\s0 Shell itself as an editor (with
547no 32k limit).
548.IP "Affrus" 4
549.IX Item "Affrus"
550is a full Perl development environment with full debugger support
551( http://www.latenightsw.com ).
552.IP "Alpha" 4
553.IX Item "Alpha"
554is an editor, written and extensible in Tcl, that nonetheless has
555built in support for several popular markup and programming languages
556including Perl and \s-1HTML\s0 ( http://www.his.com/~jguyer/Alpha/Alpha8.html ).
557.IP "BBEdit and BBEdit Lite" 4
558.IX Item "BBEdit and BBEdit Lite"
559are text editors for Mac \s-1OS\s0 that have a Perl sensitivity mode
560( http://web.barebones.com/ ).
561.PP
562Pepper and Pe are programming language sensitive text editors for Mac
563\&\s-1OS\s0 X and BeOS respectively ( http://www.hekkelman.com/ ).
564.Sh "Where can I get Perl macros for vi?"
565.IX Subsection "Where can I get Perl macros for vi?"
566For a complete version of Tom Christiansen's vi configuration file,
567see http://www.cpan.org/authors/Tom_Christiansen/scripts/toms.exrc.gz ,
568the standard benchmark file for vi emulators. The file runs best with nvi,
569the current version of vi out of Berkeley, which incidentally can be built
570with an embedded Perl interpreter\*(--see http://www.cpan.org/src/misc/ .
571.Sh "Where can I get perl-mode for emacs?"
572.IX Subsection "Where can I get perl-mode for emacs?"
573Since Emacs version 19 patchlevel 22 or so, there have been both a
574perl\-mode.el and support for the Perl debugger built in. These should
575come with the standard Emacs 19 distribution.
576.PP
577In the Perl source directory, you'll find a directory called \*(L"emacs\*(R",
578which contains a cperl-mode that color-codes keywords, provides
579context-sensitive help, and other nifty things.
580.PP
581Note that the perl-mode of emacs will have fits with \f(CW"main'foo"\fR
582(single quote), and mess up the indentation and highlighting. You
583are probably using \f(CW"main::foo"\fR in new Perl code anyway, so this
584shouldn't be an issue.
585.Sh "How can I use curses with Perl?"
586.IX Subsection "How can I use curses with Perl?"
587The Curses module from \s-1CPAN\s0 provides a dynamically loadable object
588module interface to a curses library. A small demo can be found at the
589directory http://www.cpan.org/authors/Tom_Christiansen/scripts/rep.gz ;
590this program repeats a command and updates the screen as needed, rendering
591\&\fBrep ps axu\fR similar to \fBtop\fR.
592.Sh "How can I use X or Tk with Perl?"
593.IX Subsection "How can I use X or Tk with Perl?"
594Tk is a completely Perl\-based, object-oriented interface to the Tk toolkit
595that doesn't force you to use Tcl just to get at Tk. Sx is an interface
596to the Athena Widget set. Both are available from \s-1CPAN\s0. See the
597directory http://www.cpan.org/modules/by\-category/08_User_Interfaces/
598.PP
599Invaluable for Perl/Tk programming are the Perl/Tk \s-1FAQ\s0 at
600http://phaseit.net/claird/comp.lang.perl.tk/ptkFAQ.html , the Perl/Tk Reference
601Guide available at
602http://www.cpan.org/authors/Stephen_O_Lidie/ , and the
603online manpages at
604http://www\-users.cs.umn.edu/%7Eamundson/perl/perltk/toc.html .
605.Sh "How can I make my Perl program run faster?"
606.IX Subsection "How can I make my Perl program run faster?"
607The best way to do this is to come up with a better algorithm. This
608can often make a dramatic difference. Jon Bentley's book
609\&\fIProgramming Pearls\fR (that's not a misspelling!) has some good tips
610on optimization, too. Advice on benchmarking boils down to: benchmark
611and profile to make sure you're optimizing the right part, look for
612better algorithms instead of microtuning your code, and when all else
613fails consider just buying faster hardware. You will probably want to
614read the answer to the earlier question \*(L"How do I profile my Perl
615programs?\*(R" if you haven't done so already.
616.PP
617A different approach is to autoload seldom-used Perl code. See the
618AutoSplit and AutoLoader modules in the standard distribution for
619that. Or you could locate the bottleneck and think about writing just
620that part in C, the way we used to take bottlenecks in C code and
621write them in assembler. Similar to rewriting in C, modules that have
622critical sections can be written in C (for instance, the \s-1PDL\s0 module
623from \s-1CPAN\s0).
624.PP
625If you're currently linking your perl executable to a shared
626\&\fIlibc.so\fR, you can often gain a 10\-25% performance benefit by
627rebuilding it to link with a static libc.a instead. This will make a
628bigger perl executable, but your Perl programs (and programmers) may
629thank you for it. See the \fI\s-1INSTALL\s0\fR file in the source distribution
630for more information.
631.PP
632The undump program was an ancient attempt to speed up Perl program by
633storing the already-compiled form to disk. This is no longer a viable
634option, as it only worked on a few architectures, and wasn't a good
635solution anyway.
636.Sh "How can I make my Perl program take less memory?"
637.IX Subsection "How can I make my Perl program take less memory?"
638When it comes to time-space tradeoffs, Perl nearly always prefers to
639throw memory at a problem. Scalars in Perl use more memory than
640strings in C, arrays take more than that, and hashes use even more. While
641there's still a lot to be done, recent releases have been addressing
642these issues. For example, as of 5.004, duplicate hash keys are
643shared amongst all hashes using them, so require no reallocation.
644.PP
645In some cases, using \fIsubstr()\fR or \fIvec()\fR to simulate arrays can be
646highly beneficial. For example, an array of a thousand booleans will
647take at least 20,000 bytes of space, but it can be turned into one
648125\-byte bit vector\*(--a considerable memory savings. The standard
649Tie::SubstrHash module can also help for certain types of data
650structure. If you're working with specialist data structures
651(matrices, for instance) modules that implement these in C may use
652less memory than equivalent Perl modules.
653.PP
654Another thing to try is learning whether your Perl was compiled with
655the system malloc or with Perl's builtin malloc. Whichever one it
656is, try using the other one and see whether this makes a difference.
657Information about malloc is in the \fI\s-1INSTALL\s0\fR file in the source
658distribution. You can find out whether you are using perl's malloc by
659typing \f(CW\*(C`perl \-V:usemymalloc\*(C'\fR.
660.PP
661Of course, the best way to save memory is to not do anything to waste
662it in the first place. Good programming practices can go a long way
663toward this:
664.IP "* Don't slurp!" 4
665.IX Item "Don't slurp!"
666Don't read an entire file into memory if you can process it line
667by line. Or more concretely, use a loop like this:
668.Sp
669.Vb 6
670\& #
671\& # Good Idea
672\& #
673\& while (<FILE>) {
674\& # ...
675\& }
676.Ve
677.Sp
678instead of this:
679.Sp
680.Vb 7
681\& #
682\& # Bad Idea
683\& #
684\& @data = <FILE>;
685\& foreach (@data) {
686\& # ...
687\& }
688.Ve
689.Sp
690When the files you're processing are small, it doesn't much matter which
691way you do it, but it makes a huge difference when they start getting
692larger.
693.IP "* Use map and grep selectively" 4
694.IX Item "Use map and grep selectively"
695Remember that both map and grep expect a \s-1LIST\s0 argument, so doing this:
696.Sp
697.Vb 1
698\& @wanted = grep {/pattern/} <FILE>;
699.Ve
700.Sp
701will cause the entire file to be slurped. For large files, it's better
702to loop:
703.Sp
704.Vb 3
705\& while (<FILE>) {
706\& push(@wanted, $_) if /pattern/;
707\& }
708.Ve
709.IP "* Avoid unnecessary quotes and stringification" 4
710.IX Item "Avoid unnecessary quotes and stringification"
711Don't quote large strings unless absolutely necessary:
712.Sp
713.Vb 1
714\& my $copy = "$large_string";
715.Ve
716.Sp
717makes 2 copies of \f(CW$large_string\fR (one for \f(CW$copy\fR and another for the
718quotes), whereas
719.Sp
720.Vb 1
721\& my $copy = $large_string;
722.Ve
723.Sp
724only makes one copy.
725.Sp
726Ditto for stringifying large arrays:
727.Sp
728.Vb 4
729\& {
730\& local $, = "\en";
731\& print @big_array;
732\& }
733.Ve
734.Sp
735is much more memory-efficient than either
736.Sp
737.Vb 1
738\& print join "\en", @big_array;
739.Ve
740.Sp
741or
742.Sp
743.Vb 4
744\& {
745\& local $" = "\en";
746\& print "@big_array";
747\& }
748.Ve
749.IP "* Pass by reference" 4
750.IX Item "Pass by reference"
751Pass arrays and hashes by reference, not by value. For one thing, it's
752the only way to pass multiple lists or hashes (or both) in a single
753call/return. It also avoids creating a copy of all the contents. This
754requires some judgment, however, because any changes will be propagated
755back to the original data. If you really want to mangle (er, modify) a
756copy, you'll have to sacrifice the memory needed to make one.
757.IP "* Tie large variables to disk." 4
758.IX Item "Tie large variables to disk."
759For \*(L"big\*(R" data stores (i.e. ones that exceed available memory) consider
760using one of the \s-1DB\s0 modules to store it on disk instead of in \s-1RAM\s0. This
761will incur a penalty in access time, but that's probably better than
762causing your hard disk to thrash due to massive swapping.
763.Sh "Is it safe to return a reference to local or lexical data?"
764.IX Subsection "Is it safe to return a reference to local or lexical data?"
765Yes. Perl's garbage collection system takes care of this so
766everything works out right.
767.PP
768.Vb 4
769\& sub makeone {
770\& my @a = ( 1 .. 10 );
771\& return \e@a;
772\& }
773.Ve
774.PP
775.Vb 3
776\& for ( 1 .. 10 ) {
777\& push @many, makeone();
778\& }
779.Ve
780.PP
781.Vb 1
782\& print $many[4][5], "\en";
783.Ve
784.PP
785.Vb 1
786\& print "@many\en";
787.Ve
788.Sh "How can I free an array or hash so my program shrinks?"
789.IX Subsection "How can I free an array or hash so my program shrinks?"
790(contributed by Michael Carman)
791.PP
792You usually can't. Memory allocated to lexicals (i.e. \fImy()\fR variables)
793cannot be reclaimed or reused even if they go out of scope. It is
794reserved in case the variables come back into scope. Memory allocated
795to global variables can be reused (within your program) by using
796\&\fIundef()\fRing and/or \fIdelete()\fR.
797.PP
798On most operating systems, memory allocated to a program can never be
799returned to the system. That's why long-running programs sometimes re\-
800exec themselves. Some operating systems (notably, systems that use
801\&\fImmap\fR\|(2) for allocating large chunks of memory) can reclaim memory that
802is no longer used, but on such systems, perl must be configured and
803compiled to use the \s-1OS\s0's malloc, not perl's.
804.PP
805In general, memory allocation and de-allocation isn't something you can
806or should be worrying about much in Perl.
807.PP
808See also \*(L"How can I make my Perl program take less memory?\*(R"
809.Sh "How can I make my \s-1CGI\s0 script more efficient?"
810.IX Subsection "How can I make my CGI script more efficient?"
811Beyond the normal measures described to make general Perl programs
812faster or smaller, a \s-1CGI\s0 program has additional issues. It may be run
813several times per second. Given that each time it runs it will need
814to be re-compiled and will often allocate a megabyte or more of system
815memory, this can be a killer. Compiling into C \fBisn't going to help
816you\fR because the process start-up overhead is where the bottleneck is.
817.PP
818There are two popular ways to avoid this overhead. One solution
819involves running the Apache \s-1HTTP\s0 server (available from
820http://www.apache.org/ ) with either of the mod_perl or mod_fastcgi
821plugin modules.
822.PP
823With mod_perl and the Apache::Registry module (distributed with
824mod_perl), httpd will run with an embedded Perl interpreter which
825pre-compiles your script and then executes it within the same address
826space without forking. The Apache extension also gives Perl access to
827the internal server \s-1API\s0, so modules written in Perl can do just about
828anything a module written in C can. For more on mod_perl, see
829http://perl.apache.org/
830.PP
831With the \s-1FCGI\s0 module (from \s-1CPAN\s0) and the mod_fastcgi
832module (available from http://www.fastcgi.com/ ) each of your Perl
833programs becomes a permanent \s-1CGI\s0 daemon process.
834.PP
835Both of these solutions can have far-reaching effects on your system
836and on the way you write your \s-1CGI\s0 programs, so investigate them with
837care.
838.PP
839See http://www.cpan.org/modules/by\-category/15_World_Wide_Web_HTML_HTTP_CGI/ .
840.Sh "How can I hide the source for my Perl program?"
841.IX Subsection "How can I hide the source for my Perl program?"
842Delete it. :\-) Seriously, there are a number of (mostly
843unsatisfactory) solutions with varying levels of \*(L"security\*(R".
844.PP
845First of all, however, you \fIcan't\fR take away read permission, because
846the source code has to be readable in order to be compiled and
847interpreted. (That doesn't mean that a \s-1CGI\s0 script's source is
848readable by people on the web, though\*(--only by people with access to
849the filesystem.) So you have to leave the permissions at the socially
850friendly 0755 level.
851.PP
852Some people regard this as a security problem. If your program does
853insecure things and relies on people not knowing how to exploit those
854insecurities, it is not secure. It is often possible for someone to
855determine the insecure things and exploit them without viewing the
856source. Security through obscurity, the name for hiding your bugs
857instead of fixing them, is little security indeed.
858.PP
859You can try using encryption via source filters (Starting from Perl
8605.8 the Filter::Simple and Filter::Util::Call modules are included in
861the standard distribution), but any decent programmer will be able to
862decrypt it. You can try using the byte code compiler and interpreter
863described below, but the curious might still be able to de-compile it.
864You can try using the native-code compiler described below, but
865crackers might be able to disassemble it. These pose varying degrees
866of difficulty to people wanting to get at your code, but none can
867definitively conceal it (true of every language, not just Perl).
868.PP
869It is very easy to recover the source of Perl programs. You simply
870feed the program to the perl interpreter and use the modules in
871the B:: hierarchy. The B::Deparse module should be able to
872defeat most attempts to hide source. Again, this is not
873unique to Perl.
874.PP
875If you're concerned about people profiting from your code, then the
876bottom line is that nothing but a restrictive license will give you
877legal security. License your software and pepper it with threatening
878statements like \*(L"This is unpublished proprietary software of \s-1XYZ\s0 Corp.
879Your access to it does not give you permission to use it blah blah
880blah.\*(R" We are not lawyers, of course, so you should see a lawyer if
881you want to be sure your license's wording will stand up in court.
882.Sh "How can I compile my Perl program into byte code or C?"
883.IX Subsection "How can I compile my Perl program into byte code or C?"
884(contributed by brian d foy)
885.PP
886In general, you can't do this. There are some things that may work
887for your situation though. People usually ask this question
888because they want to distribute their works without giving away
889the source code, and most solutions trade disk space for convenience.
890You probably won't see much of a speed increase either, since most
891solutions simply bundle a Perl interpreter in the final product
892(but see \*(L"How can I make my Perl program run faster?\*(R").
893.PP
894The Perl Archive Toolkit ( http://par.perl.org/index.cgi ) is Perl's
895analog to Java's \s-1JAR\s0. It's freely available and on \s-1CPAN\s0 (
896http://search.cpan.org/dist/PAR/ ).
897.PP
898The B::* namespace, often called \*(L"the Perl compiler\*(R", but is really a way
899for Perl programs to peek at its innards rather than create pre-compiled
900versions of your program. However. the B::Bytecode module can turn your
901script into a bytecode format that could be loaded later by the
902ByteLoader module and executed as a regular Perl script.
903.PP
904There are also some commercial products that may work for you, although
905you have to buy a license for them.
906.PP
907The Perl Dev Kit ( http://www.activestate.com/Products/Perl_Dev_Kit/ )
908from ActiveState can \*(L"Turn your Perl programs into ready-to-run
909executables for \s-1HP\-UX\s0, Linux, Solaris and Windows.\*(R"
910.PP
911Perl2Exe ( http://www.indigostar.com/perl2exe.htm ) is a command line
912program for converting perl scripts to executable files. It targets both
913Windows and unix platforms.
914.Sh "How can I compile Perl into Java?"
915.IX Subsection "How can I compile Perl into Java?"
916You can also integrate Java and Perl with the
917Perl Resource Kit from O'Reilly Media. See
918http://www.oreilly.com/catalog/prkunix/ .
919.PP
920Perl 5.6 comes with Java Perl Lingo, or \s-1JPL\s0. \s-1JPL\s0, still in
921development, allows Perl code to be called from Java. See jpl/README
922in the Perl source tree.
923.ie n .Sh "How can I get ""#!perl"" to work on [\s-1MS\-DOS\s0,NT,...]?"
924.el .Sh "How can I get \f(CW#!perl\fP to work on [\s-1MS\-DOS\s0,NT,...]?"
925.IX Subsection "How can I get #!perl to work on [MS-DOS,NT,...]?"
926For \s-1OS/2\s0 just use
927.PP
928.Vb 1
929\& extproc perl -S -your_switches
930.Ve
931.PP
932as the first line in \f(CW\*(C`*.cmd\*(C'\fR file (\f(CW\*(C`\-S\*(C'\fR due to a bug in cmd.exe's
933\&\*(L"extproc\*(R" handling). For \s-1DOS\s0 one should first invent a corresponding
934batch file and codify it in \f(CW\*(C`ALTERNATE_SHEBANG\*(C'\fR (see the
935\&\fIdosish.h\fR file in the source distribution for more information).
936.PP
937The Win95/NT installation, when using the ActiveState port of Perl,
938will modify the Registry to associate the \f(CW\*(C`.pl\*(C'\fR extension with the
939perl interpreter. If you install another port, perhaps even building
940your own Win95/NT Perl from the standard sources by using a Windows port
941of gcc (e.g., with cygwin or mingw32), then you'll have to modify
942the Registry yourself. In addition to associating \f(CW\*(C`.pl\*(C'\fR with the
943interpreter, \s-1NT\s0 people can use: \f(CW\*(C`SET PATHEXT=%PATHEXT%;.PL\*(C'\fR to let them
944run the program \f(CW\*(C`install\-linux.pl\*(C'\fR merely by typing \f(CW\*(C`install\-linux\*(C'\fR.
945.PP
946Under \*(L"Classic\*(R" MacOS, a perl program will have the appropriate Creator and
947Type, so that double-clicking them will invoke the MacPerl application.
948Under Mac \s-1OS\s0 X, clickable apps can be made from any \f(CW\*(C`#!\*(C'\fR script using Wil
949Sanchez' DropScript utility: http://www.wsanchez.net/software/ .
950.PP
951\&\fI\s-1IMPORTANT\s0!\fR: Whatever you do, \s-1PLEASE\s0 don't get frustrated, and just
952throw the perl interpreter into your cgi-bin directory, in order to
953get your programs working for a web server. This is an \s-1EXTREMELY\s0 big
954security risk. Take the time to figure out how to do it correctly.
955.Sh "Can I write useful Perl programs on the command line?"
956.IX Subsection "Can I write useful Perl programs on the command line?"
957Yes. Read perlrun for more information. Some examples follow.
958(These assume standard Unix shell quoting rules.)
959.PP
960.Vb 2
961\& # sum first and last fields
962\& perl -lane 'print $F[0] + $F[-1]' *
963.Ve
964.PP
965.Vb 2
966\& # identify text files
967\& perl -le 'for(@ARGV) {print if -f && -T _}' *
968.Ve
969.PP
970.Vb 2
971\& # remove (most) comments from C program
972\& perl -0777 -pe 's{/\e*.*?\e*/}{}gs' foo.c
973.Ve
974.PP
975.Vb 2
976\& # make file a month younger than today, defeating reaper daemons
977\& perl -e '$X=24*60*60; utime(time(),time() + 30 * $X,@ARGV)' *
978.Ve
979.PP
980.Vb 2
981\& # find first unused uid
982\& perl -le '$i++ while getpwuid($i); print $i'
983.Ve
984.PP
985.Vb 3
986\& # display reasonable manpath
987\& echo $PATH | perl -nl -072 -e '
988\& s![^/+]*$!man!&&-d&&!$s{$_}++&&push@m,$_;END{print"@m"}'
989.Ve
990.PP
991\&\s-1OK\s0, the last one was actually an Obfuscated Perl Contest entry. :\-)
992.Sh "Why don't Perl one-liners work on my DOS/Mac/VMS system?"
993.IX Subsection "Why don't Perl one-liners work on my DOS/Mac/VMS system?"
994The problem is usually that the command interpreters on those systems
995have rather different ideas about quoting than the Unix shells under
996which the one-liners were created. On some systems, you may have to
997change single-quotes to double ones, which you must \fI\s-1NOT\s0\fR do on Unix
998or Plan9 systems. You might also have to change a single % to a %%.
999.PP
1000For example:
1001.PP
1002.Vb 2
1003\& # Unix
1004\& perl -e 'print "Hello world\en"'
1005.Ve
1006.PP
1007.Vb 2
1008\& # DOS, etc.
1009\& perl -e "print \e"Hello world\en\e""
1010.Ve
1011.PP
1012.Vb 3
1013\& # Mac
1014\& print "Hello world\en"
1015\& (then Run "Myscript" or Shift-Command-R)
1016.Ve
1017.PP
1018.Vb 2
1019\& # MPW
1020\& perl -e 'print "Hello world\en"'
1021.Ve
1022.PP
1023.Vb 2
1024\& # VMS
1025\& perl -e "print ""Hello world\en"""
1026.Ve
1027.PP
1028The problem is that none of these examples are reliable: they depend on the
1029command interpreter. Under Unix, the first two often work. Under \s-1DOS\s0,
1030it's entirely possible that neither works. If 4DOS was the command shell,
1031you'd probably have better luck like this:
1032.PP
1033.Vb 1
1034\& perl -e "print <Ctrl-x>"Hello world\en<Ctrl-x>""
1035.Ve
1036.PP
1037Under the Mac, it depends which environment you are using. The MacPerl
1038shell, or \s-1MPW\s0, is much like Unix shells in its support for several
1039quoting variants, except that it makes free use of the Mac's non-ASCII
1040characters as control characters.
1041.PP
1042Using \fIqq()\fR, q(), and \fIqx()\fR, instead of \*(L"double quotes\*(R", 'single
1043quotes', and `backticks`, may make one-liners easier to write.
1044.PP
1045There is no general solution to all of this. It is a mess.
1046.PP
1047[Some of this answer was contributed by Kenneth Albanowski.]
1048.Sh "Where can I learn about \s-1CGI\s0 or Web programming in Perl?"
1049.IX Subsection "Where can I learn about CGI or Web programming in Perl?"
1050For modules, get the \s-1CGI\s0 or \s-1LWP\s0 modules from \s-1CPAN\s0. For textbooks,
1051see the two especially dedicated to web stuff in the question on
1052books. For problems and questions related to the web, like \*(L"Why
1053do I get 500 Errors\*(R" or \*(L"Why doesn't it run from the browser right
1054when it runs fine on the command line\*(R", see the troubleshooting
1055guides and references in perlfaq9 or in the \s-1CGI\s0 MetaFAQ:
1056.PP
1057.Vb 1
1058\& http://www.perl.org/CGI_MetaFAQ.html
1059.Ve
1060.Sh "Where can I learn about object-oriented Perl programming?"
1061.IX Subsection "Where can I learn about object-oriented Perl programming?"
1062A good place to start is perltoot, and you can use perlobj,
1063perlboot, perltoot, perltooc, and perlbot for reference.
1064.PP
1065A good book on \s-1OO\s0 on Perl is the \*(L"Object\-Oriented Perl\*(R"
1066by Damian Conway from Manning Publications, or \*(L"Learning Perl
1067References, Objects, & Modules\*(R" by Randal Schwartz and Tom
1068Phoenix from O'Reilly Media.
1069.Sh "Where can I learn about linking C with Perl?"
1070.IX Subsection "Where can I learn about linking C with Perl?"
1071If you want to call C from Perl, start with perlxstut,
1072moving on to perlxs, xsubpp, and perlguts. If you want to
1073call Perl from C, then read perlembed, perlcall, and
1074perlguts. Don't forget that you can learn a lot from looking at
1075how the authors of existing extension modules wrote their code and
1076solved their problems.
1077.PP
1078You might not need all the power of \s-1XS\s0. The Inline::C module lets
1079you put C code directly in your Perl source. It handles all the
1080magic to make it work. You still have to learn at least some of
1081the perl \s-1API\s0 but you won't have to deal with the complexity of the
1082\&\s-1XS\s0 support files.
1083.Sh "I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong?"
1084.IX Subsection "I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong?"
1085Download the ExtUtils::Embed kit from \s-1CPAN\s0 and run `make test'. If
1086the tests pass, read the pods again and again and again. If they
1087fail, see perlbug and send a bug report with the output of
1088\&\f(CW\*(C`make test TEST_VERBOSE=1\*(C'\fR along with \f(CW\*(C`perl \-V\*(C'\fR.
1089.Sh "When I tried to run my script, I got this message. What does it mean?"
1090.IX Subsection "When I tried to run my script, I got this message. What does it mean?"
1091A complete list of Perl's error messages and warnings with explanatory
1092text can be found in perldiag. You can also use the splain program
1093(distributed with Perl) to explain the error messages:
1094.PP
1095.Vb 2
1096\& perl program 2>diag.out
1097\& splain [-v] [-p] diag.out
1098.Ve
1099.PP
1100or change your program to explain the messages for you:
1101.PP
1102.Vb 1
1103\& use diagnostics;
1104.Ve
1105.PP
1106or
1107.PP
1108.Vb 1
1109\& use diagnostics -verbose;
1110.Ve
1111.Sh "What's MakeMaker?"
1112.IX Subsection "What's MakeMaker?"
1113This module (part of the standard Perl distribution) is designed to
1114write a Makefile for an extension module from a Makefile.PL. For more
1115information, see ExtUtils::MakeMaker.
1116.SH "AUTHOR AND COPYRIGHT"
1117.IX Header "AUTHOR AND COPYRIGHT"
1118Copyright (c) 1997\-2006 Tom Christiansen, Nathan Torkington, and
1119other authors as noted. All rights reserved.
1120.PP
1121This documentation is free; you can redistribute it and/or modify it
1122under the same terms as Perl itself.
1123.PP
1124Irrespective of its distribution, all code examples here are in the public
1125domain. You are permitted and encouraged to use this code and any
1126derivatives thereof in your own programs for fun or for profit as you
1127see fit. A simple comment in the code giving credit to the \s-1FAQ\s0 would
1128be courteous but is not required.