📄 perltodo.1
字号:
\& sub bloop {\& print join (\*(Aq \*(Aq, No, strict, here), "!\en";\& }.Ve.PPthen \f(CW\*(C`use strict;\*(C'\fR isn't in force within the autoloaded subroutines. It wouldbe more consistent (and less surprising) to arrange for all lexical pragmasin force at the _\|_END_\|_ block to be in force within each autoloaded subroutine..PPThere's a similar problem with SelfLoader..SH "Tasks that need a little sysadmin-type knowledge".IX Header "Tasks that need a little sysadmin-type knowledge"Or if you prefer, tasks that you would learn from, and broaden your skillsbase....Sh "make \s-1HTML\s0 install work".IX Subsection "make HTML install work"There is an \f(CW\*(C`installhtml\*(C'\fR target in the Makefile. It's marked as\&\*(L"experimental\*(R". It would be good to get this tested, make it work reliably, andremove the \*(L"experimental\*(R" tag. This would include.IP "1." 4Checking that cross linking between various parts of the documentation works.In particular that links work between the modules (files with \s-1POD\s0 in \fIlib/\fR)and the core documentation (files in \fIpod/\fR).IP "2." 4Work out how to split \f(CW\*(C`perlfunc\*(C'\fR into chunks, preferably one per functiongroup, preferably with general case code that could be used elsewhere.Challenges here are correctly identifying the groups of functions that gotogether, and making the right named external cross-links point to the rightpage. Things to be aware of are \f(CW\*(C`\-X\*(C'\fR, groups such as \f(CW\*(C`getpwnam\*(C'\fR to\&\f(CW\*(C`endservent\*(C'\fR, two or more \f(CW\*(C`=items\*(C'\fR giving the different parameter lists, suchas.Sp.Vb 3\& =item substr EXPR,OFFSET,LENGTH,REPLACEMENT\& =item substr EXPR,OFFSET,LENGTH\& =item substr EXPR,OFFSET.Ve.Spand different parameter lists having different meanings. (eg \f(CW\*(C`select\*(C'\fR).Sh "compressed man pages".IX Subsection "compressed man pages"Be able to install them. This would probably need a configure test to see howthe system does compressed man pages (same directory/different directory?same filename/different filename), as well as tweaking the \fIinstallman\fR scriptto compress as necessary..Sh "Add a code coverage target to the Makefile".IX Subsection "Add a code coverage target to the Makefile"Make it easy for anyone to run Devel::Cover on the core's tests. The stepsto do this manually are roughly.IP "\(bu" 4do a normal \f(CW\*(C`Configure\*(C'\fR, but include Devel::Cover as a module to install(see \fI\s-1INSTALL\s0\fR for how to do this).IP "\(bu" 4.Sp.Vb 1\& make perl.Ve.IP "\(bu" 4.Sp.Vb 1\& cd t; HARNESS_PERL_SWITCHES=\-MDevel::Cover ./perl \-I../lib harness.Ve.IP "\(bu" 4Process the resulting Devel::Cover database.PPThis just give you the coverage of the \fI.pm\fRs. To also get the C levelcoverage you need to.IP "\(bu" 4Additionally tell \f(CW\*(C`Configure\*(C'\fR to use the appropriate C compiler flags for\&\f(CW\*(C`gcov\*(C'\fR.IP "\(bu" 4.Sp.Vb 1\& make perl.gcov.Ve.Sp(instead of \f(CW\*(C`make perl\*(C'\fR).IP "\(bu" 4After running the tests run \f(CW\*(C`gcov\*(C'\fR to generate all the \fI.gcov\fR files.(Including down in the subdirectories of \fIext/\fR.IP "\(bu" 4(From the top level perl directory) run \f(CW\*(C`gcov2perl\*(C'\fR on all the \f(CW\*(C`.gcov\*(C'\fR filesto get their stats into the cover_db directory..IP "\(bu" 4Then process the Devel::Cover database.PPIt would be good to add a single switch to \f(CW\*(C`Configure\*(C'\fR to specify that youwanted to perform perl level coverage, and another to specify C levelcoverage, and have \f(CW\*(C`Configure\*(C'\fR and the \fIMakefile\fR do all the right thingsautomatically..Sh "Make Config.pm cope with differences between built and installed perl".IX Subsection "Make Config.pm cope with differences between built and installed perl"Quite often vendors ship a perl binary compiled with their (pay-for)compilers. People install a free compiler, such as gcc. To work out how tobuild extensions, Perl interrogates \f(CW%Config\fR, so in this situation\&\f(CW%Config\fR describes compilers that aren't there, and extension buildingfails. This forces people into choosing between re-compiling perl themselvesusing the compiler they have, or only using modules that the vendor ships..PPIt would be good to find a way teach \f(CW\*(C`Config.pm\*(C'\fR about the installation setup,possibly involving probing at install time or later, so that the \f(CW%Config\fR ina binary distribution better describes the installed machine, when theinstalled machine differs from the build machine in some significant way..Sh "linker specification files".IX Subsection "linker specification files"Some platforms mandate that you provide a list of a shared library's externalsymbols to the linker, so the core already has the infrastructure in place todo this for generating shared perl libraries. My understanding is that the\&\s-1GNU\s0 toolchain can accept an optional linker specification file, and restrictvisibility just to symbols declared in that file. It would be good to extend\&\fImakedef.pl\fR to support this format, and to provide a means within\&\f(CW\*(C`Configure\*(C'\fR to enable it. This would allow Unix users to test that theexport list is correct, and to build a perl that does not pollute the globalnamespace with private symbols..Sh "Cross-compile support".IX Subsection "Cross-compile support"Currently \f(CW\*(C`Configure\*(C'\fR understands \f(CW\*(C`\-Dusecrosscompile\*(C'\fR option. This optionarranges for building \f(CW\*(C`miniperl\*(C'\fR for \s-1TARGET\s0 machine, so this \f(CW\*(C`miniperl\*(C'\fR isassumed then to be copied to \s-1TARGET\s0 machine and used as a replacement of full\&\f(CW\*(C`perl\*(C'\fR executable..PPThis could be done little differently. Namely \f(CW\*(C`miniperl\*(C'\fR should be built for\&\s-1HOST\s0 and then full \f(CW\*(C`perl\*(C'\fR with extensions should be compiled for \s-1TARGET\s0.This, however, might require extra trickery for \f(CW%Config:\fR we have one configfirst for \s-1HOST\s0 and then another for \s-1TARGET\s0. Tools like MakeMaker will bemightily confused. Having around two different types of executables andlibraries (\s-1HOST\s0 and \s-1TARGET\s0) makes life interesting for Makefiles andshell (and Perl) scripts. There is \f(CW$Config\fR{run}, normally empty, whichcan be used as an execution wrapper. Also note that in somecross\-compilation/execution environments the \s-1HOST\s0 and the \s-1TARGET\s0 donot see the same filesystem(s), the \f(CW$Config\fR{run} may need to do somefile/directory copying back and forth..Sh "roffitall".IX Subsection "roffitall"Make \fIpod/roffitall\fR be updated by \fIpod/buildtoc\fR..SH "Tasks that need a little C knowledge".IX Header "Tasks that need a little C knowledge"These tasks would need a little C knowledge, but don't need any specificbackground or experience with \s-1XS\s0, or how the Perl interpreter works.Sh "Exterminate PL_na!".IX Subsection "Exterminate PL_na!"\&\f(CW\*(C`PL_na\*(C'\fR festers still in the darkest corners of various typemap files.It needs to be exterminated, replaced by a local variable of type \f(CW\*(C`STRLEN\*(C'\fR..ie n .Sh "Modernize the order of directories in @INC".el .Sh "Modernize the order of directories in \f(CW@INC\fP".IX Subsection "Modernize the order of directories in @INC"The way \f(CW@INC\fR is laid out by default, one cannot upgrade core (dual-life)modules without overwriting files. This causes problems for binarypackage builders. One possible proposal is laid out in thismessage:<http://www.xray.mpe.mpg.de/mailing\-lists/perl5\-porters/2002\-04/msg02380.html>..Sh "\-Duse32bit*".IX Subsection "-Duse32bit*"Natively 64\-bit systems need neither \-Duse64bitint nor \-Duse64bitall.On these systems, it might be the default compilation mode, and thereis currently no guarantee that passing no use64bitall option to theConfigure process will build a 32bit perl. Implementing \-Duse32bit*options would be nice for perl 5.12..Sh "Make it clear from \-v if this is the exact official release".IX Subsection "Make it clear from -v if this is the exact official release"Currently perl from \f(CW\*(C`p4\*(C'\fR/\f(CW\*(C`rsync\*(C'\fR ships with a \fIpatchlevel.h\fR file thatusually defines one local patch, of the form \*(L"\s-1MAINT12345\s0\*(R" or \*(L"\s-1RC1\s0\*(R". The outputof perl \-v doesn't report that a perl isn't an official release, and thisinformation can get lost in bugs reports. Because of this, the minor versionisn't bumped up until \s-1RC\s0 time, to minimise the possibility of versions of perlescaping that believe themselves to be newer than they actually are..PPIt would be useful to find an elegant way to have the \*(L"this is an interimmaintenance release\*(R" or \*(L"this is a release candidate\*(R" in the terse \-v output,and have it so that it's easy for the pumpking to remove this just as therelease tarball is rolled up. This way the version pulled out of rsync wouldalways say \*(L"I'm a development release\*(R" and it would be safe to bump thereported minor version as soon as a release ships, which would aid perldevelopers..PPThis task is really about thinking of an elegant way to arrange the C sourcesuch that it's trivial for the Pumpking to flag \*(L"this is an official release\*(R"when making a tarball, yet leave the default source saying \*(L"I'm not theofficial release\*(R"..Sh "Profile Perl \- am I hot or not?".IX Subsection "Profile Perl - am I hot or not?"The Perl source code is stable enough that it makes sense to profile it,identify and optimise the hotspots. It would be good to measure theperformance of the Perl interpreter using free tools such as cachegrind,gprof, and dtrace, and work to reduce the bottlenecks they reveal..PPAs part of this, the idea of \fIpp_hot.c\fR is that it contains the \fIhot\fR ops,the ops that are most commonly used. The idea is that by grouping them, theirobject code will be adjacent in the executable, so they have a greater chanceof already being in the \s-1CPU\s0 cache (or swapped in) due to being near another opalready in use..PPExcept that it's not clear if these really are the most commonly used ops. Soas part of exercising your skills with coverage and profiling tools you mightwant to determine what ops \fIreally\fR are the most commonly used. And in turnsuggest evictions and promotions to achieve a better \fIpp_hot.c\fR..Sh "Allocate OPs from arenas".IX Subsection "Allocate OPs from arenas"Currently all new \s-1OP\s0 structures are individually \fImalloc()\fRed and \fIfree()\fRd.All \f(CW\*(C`malloc\*(C'\fR implementations have space overheads, and are now as fast ascustom allocates so it would both use less memory and less \s-1CPU\s0 to allocatethe various \s-1OP\s0 structures from arenas. The \s-1SV\s0 arena code can probably bere-used for this..PPNote that Configuring perl with \f(CW\*(C`\-Accflags=\-DPL_OP_SLAB_ALLOC\*(C'\fR will use\&\fIPerl_Slab_alloc()\fR to pack optrees into a contiguous block, which isprobably superior to the use of \s-1OP\s0 arenas, esp. from a cache localitystandpoint. See \*(L"Profile Perl \- am I hot or not?\*(R"..Sh "Improve win32/wince.c".IX Subsection "Improve win32/wince.c"Currently, numerous functions look virtually, if not completely,identical in both \f(CW\*(C`win32/wince.c\*(C'\fR and \f(CW\*(C`win32/win32.c\*(C'\fR files, which can'tbe good..Sh "Use secure \s-1CRT\s0 functions when building with \s-1VC8\s0 on Win32".IX Subsection "Use secure CRT functions when building with VC8 on Win32"Visual \*(C+ 2005 (\s-1VC++\s0 8.x) deprecated a number of \s-1CRT\s0 functions on the basisthat they were \*(L"unsafe\*(R" and introduced differently named secure versions ofthem as replacements, e.g. instead of writing.PP.Vb 1\& FILE* f = fopen(_\|_FILE_\|_, "r");.Ve.PPone should now write.PP.Vb 2\& FILE* f;\& errno_t err = fopen_s(&f, _\|_FILE_\|_, "r");.Ve.PPCurrently, the warnings about these deprecations have been disabled by adding\&\-D_CRT_SECURE_NO_DEPRECATE to the \s-1CFLAGS\s0. It would be nice to remove thatwarning suppressant and actually make use of the new secure \s-1CRT\s0 functions..PPThere is also a similar issue with \s-1POSIX\s0 \s-1CRT\s0 function names like fileno havingbeen deprecated in favour of \s-1ISO\s0 \*(C+ conformant names like _fileno. Thesewarnings are also currently suppressed by adding \-D_CRT_NONSTDC_NO_DEPRECATE. Itmight be nice to do as Microsoft suggest here too, although, unlike the securefunctions issue, there is presumably little or no benefit in this case..Sh "\fIstrcat()\fP, \fIstrcpy()\fP, \fIstrncat()\fP, \fIstrncpy()\fP, \fIsprintf()\fP, \fIvsprintf()\fP".IX Subsection "strcat(), strcpy(), strncat(), strncpy(), sprintf(), vsprintf()"Maybe create a utility that checks after each libperl.a creation thatnone of the above (nor \fIsprintf()\fR, \fIvsprintf()\fR, or *SHUDDER* \fIgets()\fR)ever creep back to libperl.a..PP.Vb 1\& nm libperl.a | ./miniperl \-alne \*(Aq$o = $F[0] if /:$/; print "$o $F[1]" if $F[0] eq "U" && $F[1] =~ /^(?:strn?c(?:at|py)|v?sprintf|gets)$/\*(Aq.Ve.PPNote, of course, that this will only tell whether \fByour\fR platformis using those naughty interfaces..Sh "\-D_FORTIFY_SOURCE=2, \-fstack\-protector".IX Subsection "-D_FORTIFY_SOURCE=2, -fstack-protector"Recent glibcs support \f(CW\*(C`\-D_FORTIFY_SOURCE=2\*(C'\fR and recent gcc(4.1 onwards?) supports \f(CW\*(C`\-fstack\-protector\*(C'\fR, both of which giveprotection against various kinds of buffer overflow problems.These should probably be used for compiling Perl whenever available,Configure and/or hints files should be adjusted to probe for theavailability of these features and enable them as appropriate..SH "Tasks that need a knowledge of XS".IX Header "Tasks that need a knowledge of XS"These tasks would need C knowledge, and roughly the level of knowledge ofthe perl \s-1API\s0 that comes from writing modules that use \s-1XS\s0 to interface toC..Sh "autovivification".IX Subsection "autovivification"Make all autovivification consistent w.r.t \s-1LVALUE/RVALUE\s0 and strict/no strict;.PPThis task is incremental \- even a little bit of work on it will help..Sh "Unicode in Filenames".IX Subsection "Unicode in Filenames"chdir, chmod, chown, chroot, exec, glob, link, lstat, mkdir, open,opendir, qx, readdir, readlink, rename, rmdir, stat, symlink, sysopen,system, truncate, unlink, utime, \-X. All these could potentially acceptUnicode filenames either as input or output (and in the case of systemand qx Unicode in general, as input or output to/from the shell).Whether a filesystem \- an operating system pair understands Unicode infilenames varies..PPKnown combinations that have some level of understanding includeMicrosoft \s-1NTFS\s0, Apple \s-1HFS+\s0 (In Mac \s-1OS\s0 9 and X) and Apple \s-1UFS\s0 (in Mac\&\s-1OS\s0 X), \s-1NFS\s0 v4 is rumored to be Unicode, and of course Plan 9. How tocreate Unicode filenames, what forms of Unicode are accepted and used(\s-1UCS\-2\s0, \s-1UTF\-16\s0, \s-1UTF\-8\s0), what (if any) is the normalization form used,and so on, varies. Finding the right level of interfacing to Perlrequires some thought. Remember that an \s-1OS\s0 does not implicate afilesystem..PP(The Windows \-C command flag \*(L"wide \s-1API\s0 support\*(R" has been at leasttemporarily retired in 5.8.1, and the \-C has been repurposed, seeperlrun.).PPMost probably the right way to do this would be this:\&\*(L"Virtualize operating system access\*(R"..ie n .Sh "Unicode in %ENV".el .Sh "Unicode in \f(CW%ENV\fP".IX Subsection "Unicode in %ENV"Currently the \f(CW%ENV\fR entries are always byte strings.See \*(L"Virtualize operating system access\*(R"..Sh "Unicode and \fIglob()\fP".IX Subsection "Unicode and glob()"Currently glob patterns and filenames returned from \fIFile::Glob::glob()\fRare always byte strings. See \*(L"Virtualize operating system access\*(R"..Sh "Unicode and lc/uc operators".IX Subsection "Unicode and lc/uc operators"Some built-in operators (\f(CW\*(C`lc\*(C'\fR, \f(CW\*(C`uc\*(C'\fR, etc.) behave differently, based onwhat the internal encoding of their argument is. That should not be thecase. Maybe add a pragma to switch behaviour..Sh "use less 'memory'".IX Subsection "use less 'memory'"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -