📄 perlhack.1
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings. \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote. \*(C+ will.\" give a nicer C++. Capital omega is used to do unbreakable dashes and.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\. ds -- \(*W-. ds PI pi. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch. ds L" "". ds R" "". ds C` "". ds C' ""'br\}.el\{\. ds -- \|\(em\|. ds PI \(*p. ds L" ``. ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD. Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff.if n \{\. ds #H 0. ds #V .8m. ds #F .3m. ds #[ \f1. ds #] \fP.\}.if t \{\. ds #H ((1u-(\\\\n(.fu%2u))*.13m). ds #V .6m. ds #F 0. ds #[ \&. ds #] \&.\}. \" simple accents for nroff and troff.if n \{\. ds ' \&. ds ` \&. ds ^ \&. ds , \&. ds ~ ~. ds /.\}.if t \{\. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u". ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}. \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E. \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'. \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\. ds : e. ds 8 ss. ds o a. ds d- d\h'-1'\(ga. ds D- D\h'-1'\(hy. ds th \o'bp'. ds Th \o'LP'. ds ae ae. ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "PERLHACK 1".TH PERLHACK 1 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification. Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"perlhack \- How to hack at the Perl internals.SH "DESCRIPTION".IX Header "DESCRIPTION"This document attempts to explain how Perl development takes place,and ends with some suggestions for people wanting to become bona fideporters..PPThe perl5\-porters mailing list is where the Perl standard distributionis maintained and developed. The list can get anywhere from 10 to 150messages a day, depending on the heatedness of the debate. Most daysthere are two or three patches, extensions, features, or bugs beingdiscussed at a time..PPA searchable archive of the list is at either:.PP.Vb 1\& http://www.xray.mpe.mpg.de/mailing\-lists/perl5\-porters/.Ve.PPor.PP.Vb 1\& http://archive.develooper.com/perl5\-porters@perl.org/.Ve.PPList subscribers (the porters themselves) come in several flavours.Some are quiet curious lurkers, who rarely pitch in and instead watchthe ongoing development to ensure they're forewarned of new changes orfeatures in Perl. Some are representatives of vendors, who are thereto make sure that Perl continues to compile and work on theirplatforms. Some patch any reported bug that they know how to fix,some are actively patching their pet area (threads, Win32, the regexpengine), while others seem to do nothing but complain. In otherwords, it's your usual mix of technical people..PPOver this group of porters presides Larry Wall. He has the final wordin what does and does not change in the Perl language. Variousreleases of Perl are shepherded by a \*(L"pumpking\*(R", a porterresponsible for gathering patches, deciding on a patch-by-patch,feature-by-feature basis what will and will not go into the release.For instance, Gurusamy Sarathy was the pumpking for the 5.6 release ofPerl, and Jarkko Hietaniemi was the pumpking for the 5.8 release, andRafael Garcia-Suarez holds the pumpking crown for the 5.10 release..PPIn addition, various people are pumpkings for different things. Forinstance, Andy Dougherty and Jarkko Hietaniemi did a grand job as the\&\fIConfigure\fR pumpkin up till the 5.8 release. For the 5.10 releaseH.Merijn Brand took over..PPLarry sees Perl development along the lines of the \s-1US\s0 government:there's the Legislature (the porters), the Executive branch (thepumpkings), and the Supreme Court (Larry). The legislature candiscuss and submit patches to the executive branch all they like, butthe executive branch is free to veto them. Rarely, the Supreme Courtwill side with the executive branch over the legislature, or thelegislature over the executive branch. Mostly, however, thelegislature and the executive branch are supposed to get along andwork out their differences without impeachment or court cases..PPYou might sometimes see reference to Rule 1 and Rule 2. Larry's poweras Supreme Court is expressed in The Rules:.IP "1." 4Larry is always by definition right about how Perl should behave.This means he has final veto power on the core functionality..IP "2." 4Larry is allowed to change his mind about any matter at a later date,regardless of whether he previously invoked Rule 1..PPGot that? Larry is always right, even when he was wrong. It's rareto see either Rule exercised, but they are often alluded to..PPNew features and extensions to the language are contentious, becausethe criteria used by the pumpkings, Larry, and other porters to decidewhich features should be implemented and incorporated are not codifiedin a few small design goals as with some other languages. Instead,the heuristics are flexible and often difficult to fathom. Here isone person's list, roughly in decreasing order of importance, ofheuristics that new features have to be weighed against:.IP "Does concept match the general goals of Perl?" 4.IX Item "Does concept match the general goals of Perl?"These haven't been written anywhere in stone, but one approximationis:.Sp.Vb 5\& 1. Keep it fast, simple, and useful.\& 2. Keep features/concepts as orthogonal as possible.\& 3. No arbitrary limits (platforms, data sizes, cultures).\& 4. Keep it open and exciting to use/patch/advocate Perl everywhere.\& 5. Either assimilate new technologies, or build bridges to them..Ve.IP "Where is the implementation?" 4.IX Item "Where is the implementation?"All the talk in the world is useless without an implementation. Inalmost every case, the person or people who argue for a new featurewill be expected to be the ones who implement it. Porters capableof coding new features have their own agendas, and are not availableto implement your (possibly good) idea..IP "Backwards compatibility" 4.IX Item "Backwards compatibility"It's a cardinal sin to break existing Perl programs. New warnings arecontentious\*(--some say that a program that emits warnings is notbroken, while others say it is. Adding keywords has the potential tobreak programs, changing the meaning of existing token sequences orfunctions might break programs..IP "Could it be a module instead?" 4.IX Item "Could it be a module instead?"Perl 5 has extension mechanisms, modules and \s-1XS\s0, specifically to avoidthe need to keep changing the Perl interpreter. You can write modulesthat export functions, you can give those functions prototypes so theycan be called like built-in functions, you can even write \s-1XS\s0 code tomess with the runtime data structures of the Perl interpreter if youwant to implement really complicated things. If it can be done in amodule instead of in the core, it's highly unlikely to be added..IP "Is the feature generic enough?" 4.IX Item "Is the feature generic enough?"Is this something that only the submitter wants added to the language,or would it be broadly useful? Sometimes, instead of adding a featurewith a tight focus, the porters might decide to wait until someoneimplements the more generalized feature. For instance, instead ofimplementing a \*(L"delayed evaluation\*(R" feature, the porters are waitingfor a macro system that would permit delayed evaluation and much more..IP "Does it potentially introduce new bugs?" 4.IX Item "Does it potentially introduce new bugs?"Radical rewrites of large chunks of the Perl interpreter have thepotential to introduce new bugs. The smaller and more localized thechange, the better..IP "Does it preclude other desirable features?" 4.IX Item "Does it preclude other desirable features?"A patch is likely to be rejected if it closes off future avenues ofdevelopment. For instance, a patch that placed a true and finalinterpretation on prototypes is likely to be rejected because thereare still options for the future of prototypes that haven't beenaddressed..IP "Is the implementation robust?" 4.IX Item "Is the implementation robust?"Good patches (tight code, complete, correct) stand more chance ofgoing in. Sloppy or incorrect patches might be placed on the backburner until the pumpking has time to fix, or might be discardedaltogether without further notice..IP "Is the implementation generic enough to be portable?" 4.IX Item "Is the implementation generic enough to be portable?"The worst patches make use of a system-specific features. It's highlyunlikely that non-portable additions to the Perl language will beaccepted..IP "Is the implementation tested?" 4.IX Item "Is the implementation tested?"Patches which change behaviour (fixing bugs or introducing new features)must include regression tests to verify that everything works as expected.Without tests provided by the original author, how can anyone else changingperl in the future be sure that they haven't unwittingly broken the behaviourthe patch implements? And without tests, how can the patch's author beconfident that his/her hard work put into the patch won't be accidentally
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -