diff --git a/data/miniconda3/man/man1/bzcmp.1 b/data/miniconda3/man/man1/bzcmp.1 new file mode 100644 index 0000000000000000000000000000000000000000..2ba7e12e201289270ebfa24ff05319546d9acccd --- /dev/null +++ b/data/miniconda3/man/man1/bzcmp.1 @@ -0,0 +1 @@ +.so man1/bzdiff.1 diff --git a/data/miniconda3/man/man1/bzegrep.1 b/data/miniconda3/man/man1/bzegrep.1 new file mode 100644 index 0000000000000000000000000000000000000000..b208cf5aec12ae399a3b00a8a94228171186f070 --- /dev/null +++ b/data/miniconda3/man/man1/bzegrep.1 @@ -0,0 +1 @@ +.so man1/bzgrep.1 diff --git a/data/miniconda3/man/man1/bzfgrep.1 b/data/miniconda3/man/man1/bzfgrep.1 new file mode 100644 index 0000000000000000000000000000000000000000..b208cf5aec12ae399a3b00a8a94228171186f070 --- /dev/null +++ b/data/miniconda3/man/man1/bzfgrep.1 @@ -0,0 +1 @@ +.so man1/bzgrep.1 diff --git a/data/miniconda3/man/man1/bzgrep.1 b/data/miniconda3/man/man1/bzgrep.1 new file mode 100644 index 0000000000000000000000000000000000000000..930af8c7fcb8205c91befbc33f0ef99cd85f6e1a --- /dev/null +++ b/data/miniconda3/man/man1/bzgrep.1 @@ -0,0 +1,56 @@ +\"Shamelessly copied from zmore.1 by Philippe Troin +\"for Debian GNU/Linux +.TH BZGREP 1 +.SH NAME +bzgrep, bzfgrep, bzegrep \- search possibly bzip2 compressed files for a regular expression +.SH SYNOPSIS +.B bzgrep +[ grep_options ] +.BI [\ -e\ ] " pattern" +.IR filename ".\|.\|." +.br +.B bzegrep +[ egrep_options ] +.BI [\ -e\ ] " pattern" +.IR filename ".\|.\|." +.br +.B bzfgrep +[ fgrep_options ] +.BI [\ -e\ ] " pattern" +.IR filename ".\|.\|." +.SH DESCRIPTION +.IR Bzgrep +is used to invoke the +.I grep +on bzip2-compressed files. All options specified are passed directly to +.I grep. +If no file is specified, then the standard input is decompressed +if necessary and fed to grep. +Otherwise the given files are uncompressed if necessary and fed to +.I grep. +.PP +If +.I bzgrep +is invoked as +.I bzegrep +or +.I bzfgrep +then +.I egrep +or +.I fgrep +is used instead of +.I grep. +If the GREP environment variable is set, +.I bzgrep +uses it as the +.I grep +program to be invoked. For example: + + for sh: GREP=fgrep bzgrep string files + for csh: (setenv GREP fgrep; bzgrep string files) +.SH AUTHOR +Charles Levert (charles@comm.polymtl.ca). Adapted to bzip2 by Philippe +Troin for Debian GNU/Linux. +.SH "SEE ALSO" +grep(1), egrep(1), fgrep(1), bzdiff(1), bzmore(1), bzless(1), bzip2(1) diff --git a/data/miniconda3/man/man1/bzip2.1 b/data/miniconda3/man/man1/bzip2.1 new file mode 100644 index 0000000000000000000000000000000000000000..0cbcdab00ed82151a5b06951c837692785184082 --- /dev/null +++ b/data/miniconda3/man/man1/bzip2.1 @@ -0,0 +1,454 @@ +.PU +.TH bzip2 1 +.SH NAME +bzip2, bunzip2 \- a block-sorting file compressor, v1.0.8 +.br +bzcat \- decompresses files to stdout +.br +bzip2recover \- recovers data from damaged bzip2 files + +.SH SYNOPSIS +.ll +8 +.B bzip2 +.RB [ " \-cdfkqstvzVL123456789 " ] +[ +.I "filenames \&..." +] +.ll -8 +.br +.B bunzip2 +.RB [ " \-fkvsVL " ] +[ +.I "filenames \&..." +] +.br +.B bzcat +.RB [ " \-s " ] +[ +.I "filenames \&..." +] +.br +.B bzip2recover +.I "filename" + +.SH DESCRIPTION +.I bzip2 +compresses files using the Burrows-Wheeler block sorting +text compression algorithm, and Huffman coding. Compression is +generally considerably better than that achieved by more conventional +LZ77/LZ78-based compressors, and approaches the performance of the PPM +family of statistical compressors. + +The command-line options are deliberately very similar to +those of +.I GNU gzip, +but they are not identical. + +.I bzip2 +expects a list of file names to accompany the +command-line flags. Each file is replaced by a compressed version of +itself, with the name "original_name.bz2". +Each compressed file +has the same modification date, permissions, and, when possible, +ownership as the corresponding original, so that these properties can +be correctly restored at decompression time. File name handling is +naive in the sense that there is no mechanism for preserving original +file names, permissions, ownerships or dates in filesystems which lack +these concepts, or have serious file name length restrictions, such as +MS-DOS. + +.I bzip2 +and +.I bunzip2 +will by default not overwrite existing +files. If you want this to happen, specify the \-f flag. + +If no file names are specified, +.I bzip2 +compresses from standard +input to standard output. In this case, +.I bzip2 +will decline to +write compressed output to a terminal, as this would be entirely +incomprehensible and therefore pointless. + +.I bunzip2 +(or +.I bzip2 \-d) +decompresses all +specified files. Files which were not created by +.I bzip2 +will be detected and ignored, and a warning issued. +.I bzip2 +attempts to guess the filename for the decompressed file +from that of the compressed file as follows: + + filename.bz2 becomes filename + filename.bz becomes filename + filename.tbz2 becomes filename.tar + filename.tbz becomes filename.tar + anyothername becomes anyothername.out + +If the file does not end in one of the recognised endings, +.I .bz2, +.I .bz, +.I .tbz2 +or +.I .tbz, +.I bzip2 +complains that it cannot +guess the name of the original file, and uses the original name +with +.I .out +appended. + +As with compression, supplying no +filenames causes decompression from +standard input to standard output. + +.I bunzip2 +will correctly decompress a file which is the +concatenation of two or more compressed files. The result is the +concatenation of the corresponding uncompressed files. Integrity +testing (\-t) +of concatenated +compressed files is also supported. + +You can also compress or decompress files to the standard output by +giving the \-c flag. Multiple files may be compressed and +decompressed like this. The resulting outputs are fed sequentially to +stdout. Compression of multiple files +in this manner generates a stream +containing multiple compressed file representations. Such a stream +can be decompressed correctly only by +.I bzip2 +version 0.9.0 or +later. Earlier versions of +.I bzip2 +will stop after decompressing +the first file in the stream. + +.I bzcat +(or +.I bzip2 -dc) +decompresses all specified files to +the standard output. + +.I bzip2 +will read arguments from the environment variables +.I BZIP2 +and +.I BZIP, +in that order, and will process them +before any arguments read from the command line. This gives a +convenient way to supply default arguments. + +Compression is always performed, even if the compressed +file is slightly +larger than the original. Files of less than about one hundred bytes +tend to get larger, since the compression mechanism has a constant +overhead in the region of 50 bytes. Random data (including the output +of most file compressors) is coded at about 8.05 bits per byte, giving +an expansion of around 0.5%. + +As a self-check for your protection, +.I +bzip2 +uses 32-bit CRCs to +make sure that the decompressed version of a file is identical to the +original. This guards against corruption of the compressed data, and +against undetected bugs in +.I bzip2 +(hopefully very unlikely). The +chances of data corruption going undetected is microscopic, about one +chance in four billion for each file processed. Be aware, though, that +the check occurs upon decompression, so it can only tell you that +something is wrong. It can't help you +recover the original uncompressed +data. You can use +.I bzip2recover +to try to recover data from +damaged files. + +Return values: 0 for a normal exit, 1 for environmental problems (file +not found, invalid flags, I/O errors, &c), 2 to indicate a corrupt +compressed file, 3 for an internal consistency error (eg, bug) which +caused +.I bzip2 +to panic. + +.SH OPTIONS +.TP +.B \-c --stdout +Compress or decompress to standard output. +.TP +.B \-d --decompress +Force decompression. +.I bzip2, +.I bunzip2 +and +.I bzcat +are +really the same program, and the decision about what actions to take is +done on the basis of which name is used. This flag overrides that +mechanism, and forces +.I bzip2 +to decompress. +.TP +.B \-z --compress +The complement to \-d: forces compression, regardless of the +invocation name. +.TP +.B \-t --test +Check integrity of the specified file(s), but don't decompress them. +This really performs a trial decompression and throws away the result. +.TP +.B \-f --force +Force overwrite of output files. Normally, +.I bzip2 +will not overwrite +existing output files. Also forces +.I bzip2 +to break hard links +to files, which it otherwise wouldn't do. + +bzip2 normally declines to decompress files which don't have the +correct magic header bytes. If forced (-f), however, it will pass +such files through unmodified. This is how GNU gzip behaves. +.TP +.B \-k --keep +Keep (don't delete) input files during compression +or decompression. +.TP +.B \-s --small +Reduce memory usage, for compression, decompression and testing. Files +are decompressed and tested using a modified algorithm which only +requires 2.5 bytes per block byte. This means any file can be +decompressed in 2300k of memory, albeit at about half the normal speed. + +During compression, \-s selects a block size of 200k, which limits +memory use to around the same figure, at the expense of your compression +ratio. In short, if your machine is low on memory (8 megabytes or +less), use \-s for everything. See MEMORY MANAGEMENT below. +.TP +.B \-q --quiet +Suppress non-essential warning messages. Messages pertaining to +I/O errors and other critical events will not be suppressed. +.TP +.B \-v --verbose +Verbose mode -- show the compression ratio for each file processed. +Further \-v's increase the verbosity level, spewing out lots of +information which is primarily of interest for diagnostic purposes. +.TP +.B \-L --license -V --version +Display the software version, license terms and conditions. +.TP +.B \-1 (or \-\-fast) to \-9 (or \-\-best) +Set the block size to 100 k, 200 k .. 900 k when compressing. Has no +effect when decompressing. See MEMORY MANAGEMENT below. +The \-\-fast and \-\-best aliases are primarily for GNU gzip +compatibility. In particular, \-\-fast doesn't make things +significantly faster. +And \-\-best merely selects the default behaviour. +.TP +.B \-- +Treats all subsequent arguments as file names, even if they start +with a dash. This is so you can handle files with names beginning +with a dash, for example: bzip2 \-- \-myfilename. +.TP +.B \--repetitive-fast --repetitive-best +These flags are redundant in versions 0.9.5 and above. They provided +some coarse control over the behaviour of the sorting algorithm in +earlier versions, which was sometimes useful. 0.9.5 and above have an +improved algorithm which renders these flags irrelevant. + +.SH MEMORY MANAGEMENT +.I bzip2 +compresses large files in blocks. The block size affects +both the compression ratio achieved, and the amount of memory needed for +compression and decompression. The flags \-1 through \-9 +specify the block size to be 100,000 bytes through 900,000 bytes (the +default) respectively. At decompression time, the block size used for +compression is read from the header of the compressed file, and +.I bunzip2 +then allocates itself just enough memory to decompress +the file. Since block sizes are stored in compressed files, it follows +that the flags \-1 to \-9 are irrelevant to and so ignored +during decompression. + +Compression and decompression requirements, +in bytes, can be estimated as: + + Compression: 400k + ( 8 x block size ) + + Decompression: 100k + ( 4 x block size ), or + 100k + ( 2.5 x block size ) + +Larger block sizes give rapidly diminishing marginal returns. Most of +the compression comes from the first two or three hundred k of block +size, a fact worth bearing in mind when using +.I bzip2 +on small machines. +It is also important to appreciate that the decompression memory +requirement is set at compression time by the choice of block size. + +For files compressed with the default 900k block size, +.I bunzip2 +will require about 3700 kbytes to decompress. To support decompression +of any file on a 4 megabyte machine, +.I bunzip2 +has an option to +decompress using approximately half this amount of memory, about 2300 +kbytes. Decompression speed is also halved, so you should use this +option only where necessary. The relevant flag is -s. + +In general, try and use the largest block size memory constraints allow, +since that maximises the compression achieved. Compression and +decompression speed are virtually unaffected by block size. + +Another significant point applies to files which fit in a single block +-- that means most files you'd encounter using a large block size. The +amount of real memory touched is proportional to the size of the file, +since the file is smaller than a block. For example, compressing a file +20,000 bytes long with the flag -9 will cause the compressor to +allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560 +kbytes of it. Similarly, the decompressor will allocate 3700k but only +touch 100k + 20000 * 4 = 180 kbytes. + +Here is a table which summarises the maximum memory usage for different +block sizes. Also recorded is the total compressed size for 14 files of +the Calgary Text Compression Corpus totalling 3,141,622 bytes. This +column gives some feel for how compression varies with block size. +These figures tend to understate the advantage of larger block sizes for +larger files, since the Corpus is dominated by smaller files. + + Compress Decompress Decompress Corpus + Flag usage usage -s usage Size + + -1 1200k 500k 350k 914704 + -2 2000k 900k 600k 877703 + -3 2800k 1300k 850k 860338 + -4 3600k 1700k 1100k 846899 + -5 4400k 2100k 1350k 845160 + -6 5200k 2500k 1600k 838626 + -7 6100k 2900k 1850k 834096 + -8 6800k 3300k 2100k 828642 + -9 7600k 3700k 2350k 828642 + +.SH RECOVERING DATA FROM DAMAGED FILES +.I bzip2 +compresses files in blocks, usually 900kbytes long. Each +block is handled independently. If a media or transmission error causes +a multi-block .bz2 +file to become damaged, it may be possible to +recover data from the undamaged blocks in the file. + +The compressed representation of each block is delimited by a 48-bit +pattern, which makes it possible to find the block boundaries with +reasonable certainty. Each block also carries its own 32-bit CRC, so +damaged blocks can be distinguished from undamaged ones. + +.I bzip2recover +is a simple program whose purpose is to search for +blocks in .bz2 files, and write each block out into its own .bz2 +file. You can then use +.I bzip2 +\-t +to test the +integrity of the resulting files, and decompress those which are +undamaged. + +.I bzip2recover +takes a single argument, the name of the damaged file, +and writes a number of files "rec00001file.bz2", +"rec00002file.bz2", etc, containing the extracted blocks. +The output filenames are designed so that the use of +wildcards in subsequent processing -- for example, +"bzip2 -dc rec*file.bz2 > recovered_data" -- processes the files in +the correct order. + +.I bzip2recover +should be of most use dealing with large .bz2 +files, as these will contain many blocks. It is clearly +futile to use it on damaged single-block files, since a +damaged block cannot be recovered. If you wish to minimise +any potential data loss through media or transmission errors, +you might consider compressing with a smaller +block size. + +.SH PERFORMANCE NOTES +The sorting phase of compression gathers together similar strings in the +file. Because of this, files containing very long runs of repeated +symbols, like "aabaabaabaab ..." (repeated several hundred times) may +compress more slowly than normal. Versions 0.9.5 and above fare much +better than previous versions in this respect. The ratio between +worst-case and average-case compression time is in the region of 10:1. +For previous versions, this figure was more like 100:1. You can use the +\-vvvv option to monitor progress in great detail, if you want. + +Decompression speed is unaffected by these phenomena. + +.I bzip2 +usually allocates several megabytes of memory to operate +in, and then charges all over it in a fairly random fashion. This means +that performance, both for compressing and decompressing, is largely +determined by the speed at which your machine can service cache misses. +Because of this, small changes to the code to reduce the miss rate have +been observed to give disproportionately large performance improvements. +I imagine +.I bzip2 +will perform best on machines with very large caches. + +.SH CAVEATS +I/O error messages are not as helpful as they could be. +.I bzip2 +tries hard to detect I/O errors and exit cleanly, but the details of +what the problem is sometimes seem rather misleading. + +This manual page pertains to version 1.0.8 of +.I bzip2. +Compressed data created by this version is entirely forwards and +backwards compatible with the previous public releases, versions +0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and above, but with the following +exception: 0.9.0 and above can correctly decompress multiple +concatenated compressed files. 0.1pl2 cannot do this; it will stop +after decompressing just the first file in the stream. + +.I bzip2recover +versions prior to 1.0.2 used 32-bit integers to represent +bit positions in compressed files, so they could not handle compressed +files more than 512 megabytes long. Versions 1.0.2 and above use +64-bit ints on some platforms which support them (GNU supported +targets, and Windows). To establish whether or not bzip2recover was +built with such a limitation, run it without arguments. In any event +you can build yourself an unlimited version if you can recompile it +with MaybeUInt64 set to be an unsigned 64-bit integer. + + + +.SH AUTHOR +Julian Seward, jseward@acm.org. + +https://sourceware.org/bzip2/ + +The ideas embodied in +.I bzip2 +are due to (at least) the following +people: Michael Burrows and David Wheeler (for the block sorting +transformation), David Wheeler (again, for the Huffman coder), Peter +Fenwick (for the structured coding model in the original +.I bzip, +and many refinements), and Alistair Moffat, Radford Neal and Ian Witten +(for the arithmetic coder in the original +.I bzip). +I am much +indebted for their help, support and advice. See the manual in the +source distribution for pointers to sources of documentation. Christian +von Roques encouraged me to look for faster sorting algorithms, so as to +speed up compression. Bela Lubkin encouraged me to improve the +worst-case compression performance. +Donna Robinson XMLised the documentation. +The bz* scripts are derived from those of GNU gzip. +Many people sent patches, helped +with portability problems, lent machines, gave advice and were generally +helpful. diff --git a/data/miniconda3/man/man1/bzless.1 b/data/miniconda3/man/man1/bzless.1 new file mode 100644 index 0000000000000000000000000000000000000000..b849965938bed4048b65f842a3dc7f69770e66a3 --- /dev/null +++ b/data/miniconda3/man/man1/bzless.1 @@ -0,0 +1 @@ +.so man1/bzmore.1 diff --git a/data/miniconda3/man/man1/enc2xs.1 b/data/miniconda3/man/man1/enc2xs.1 new file mode 100644 index 0000000000000000000000000000000000000000..c027bbc4c4c903b10ea5e4b13ed1f3c05c084000 --- /dev/null +++ b/data/miniconda3/man/man1/enc2xs.1 @@ -0,0 +1,429 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "ENC2XS 1" +.TH ENC2XS 1 "2023-12-23" "perl v5.32.1" "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" +enc2xs \-\- Perl Encode Module Generator +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 3 +\& enc2xs \-[options] +\& enc2xs \-M ModName mapfiles... +\& enc2xs \-C +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fIenc2xs\fR builds a Perl extension for use by Encode from either +Unicode Character Mapping files (.ucm) or Tcl Encoding Files (.enc). +Besides being used internally during the build process of the Encode +module, you can use \fIenc2xs\fR to add your own encoding to perl. +No knowledge of \s-1XS\s0 is necessary. +.SH "Quick Guide" +.IX Header "Quick Guide" +If you want to know as little about Perl as possible but need to +add a new encoding, just read this chapter and forget the rest. +.IP "0." 4 +.IX Item "0." +Have a .ucm file ready. You can get it from somewhere or you can write +your own from scratch or you can grab one from the Encode distribution +and customize it. For the \s-1UCM\s0 format, see the next Chapter. In the +example below, I'll call my theoretical encoding myascii, defined +in \fImy.ucm\fR. \f(CW\*(C`$\*(C'\fR is a shell prompt. +.Sp +.Vb 2 +\& $ ls \-F +\& my.ucm +.Ve +.IP "1." 4 +.IX Item "1." +Issue a command as follows; +.Sp +.Vb 5 +\& $ enc2xs \-M My my.ucm +\& generating Makefile.PL +\& generating My.pm +\& generating README +\& generating Changes +.Ve +.Sp +Now take a look at your current directory. It should look like this. +.Sp +.Vb 2 +\& $ ls \-F +\& Makefile.PL My.pm my.ucm t/ +.Ve +.Sp +The following files were created. +.Sp +.Vb 3 +\& Makefile.PL \- MakeMaker script +\& My.pm \- Encode submodule +\& t/My.t \- test file +.Ve +.RS 4 +.IP "1.1." 4 +.IX Item "1.1." +If you want *.ucm installed together with the modules, do as follows; +.Sp +.Vb 3 +\& $ mkdir Encode +\& $ mv *.ucm Encode +\& $ enc2xs \-M My Encode/*ucm +.Ve +.RE +.RS 4 +.RE +.IP "2." 4 +.IX Item "2." +Edit the files generated. You don't have to if you have no time \s-1AND\s0 no +intention to give it to someone else. But it is a good idea to edit +the pod and to add more tests. +.IP "3." 4 +.IX Item "3." +Now issue a command all Perl Mongers love: +.Sp +.Vb 2 +\& $ perl Makefile.PL +\& Writing Makefile for Encode::My +.Ve +.IP "4." 4 +.IX Item "4." +Now all you have to do is make. +.Sp +.Vb 12 +\& $ make +\& cp My.pm blib/lib/Encode/My.pm +\& /usr/local/bin/perl /usr/local/bin/enc2xs \-Q \-O \e +\& \-o encode_t.c \-f encode_t.fnm +\& Reading myascii (myascii) +\& Writing compiled form +\& 128 bytes in string tables +\& 384 bytes (75%) saved spotting duplicates +\& 1 bytes (0.775%) saved using substrings +\& .... +\& chmod 644 blib/arch/auto/Encode/My/My.bs +\& $ +.Ve +.Sp +The time it takes varies depending on how fast your machine is and +how large your encoding is. Unless you are working on something big +like euc-tw, it won't take too long. +.IP "5." 4 +.IX Item "5." +You can \*(L"make install\*(R" already but you should test first. +.Sp +.Vb 8 +\& $ make test +\& PERL_DL_NONLAZY=1 /usr/local/bin/perl \-Iblib/arch \-Iblib/lib \e +\& \-e \*(Aquse Test::Harness qw(&runtests $verbose); \e +\& $verbose=0; runtests @ARGV;\*(Aq t/*.t +\& t/My....ok +\& All tests successful. +\& Files=1, Tests=2, 0 wallclock secs +\& ( 0.09 cusr + 0.01 csys = 0.09 CPU) +.Ve +.IP "6." 4 +.IX Item "6." +If you are content with the test result, just \*(L"make install\*(R" +.IP "7." 4 +.IX Item "7." +If you want to add your encoding to Encode's demand-loading list +(so you don't have to \*(L"use Encode::YourEncoding\*(R"), run +.Sp +.Vb 1 +\& enc2xs \-C +.Ve +.Sp +to update Encode::ConfigLocal, a module that controls local settings. +After that, \*(L"use Encode;\*(R" is enough to load your encodings on demand. +.SH "The Unicode Character Map" +.IX Header "The Unicode Character Map" +Encode uses the Unicode Character Map (\s-1UCM\s0) format for source character +mappings. This format is used by \s-1IBM\s0's \s-1ICU\s0 package and was adopted +by Nick Ing-Simmons for use with the Encode module. Since \s-1UCM\s0 is +more flexible than Tcl's Encoding Map and far more user-friendly, +this is the recommended format for Encode now. +.PP +A \s-1UCM\s0 file looks like this. +.PP +.Vb 10 +\& # +\& # Comments +\& # +\& "US\-ascii" # Required +\& "ascii" # Optional +\& 1 # Required; usually 1 +\& 1 # Max. # of bytes/char +\& \ex3F # Substitution char +\& # +\& CHARMAP +\& \ex00 |0 # +\& \ex01 |0 # +\& \ex02 |0 # +\& .... +\& \ex7C |0 # VERTICAL LINE +\& \ex7D |0 # RIGHT CURLY BRACKET +\& \ex7E |0 # TILDE +\& \ex7F |0 # +\& END CHARMAP +.Ve +.IP "\(bu" 4 +Anything that follows \f(CW\*(C`#\*(C'\fR is treated as a comment. +.IP "\(bu" 4 +The header section continues until a line containing the word +\&\s-1CHARMAP.\s0 This section has a form of \fI value\fR, one +pair per line. Strings used as values must be quoted. Barewords are +treated as numbers. \fI\exXX\fR represents a byte. +.Sp +Most of the keywords are self-explanatory. \fIsubchar\fR means +substitution character, not subcharacter. When you decode a Unicode +sequence to this encoding but no matching character is found, the byte +sequence defined here will be used. For most cases, the value here is +\&\ex3F; in \s-1ASCII,\s0 this is a question mark. +.IP "\(bu" 4 +\&\s-1CHARMAP\s0 starts the character map section. Each line has a form as +follows: +.Sp +.Vb 5 +\& \exXX.. |0 # comment +\& ^ ^ ^ +\& | | +\- Fallback flag +\& | +\-\-\-\-\-\-\-\- Encoded byte sequence +\& +\-\-\-\-\-\-\-\-\-\-\-\-\-\- Unicode Character ID in hex +.Ve +.Sp +The format is roughly the same as a header section except for the +fallback flag: | followed by 0..3. The meaning of the possible +values is as follows: +.RS 4 +.IP "|0" 4 +.IX Item "|0" +Round trip safe. A character decoded to Unicode encodes back to the +same byte sequence. Most characters have this flag. +.IP "|1" 4 +.IX Item "|1" +Fallback for unicode \-> encoding. When seen, enc2xs adds this +character for the encode map only. +.IP "|2" 4 +.IX Item "|2" +Skip sub-char mapping should there be no code point. +.IP "|3" 4 +.IX Item "|3" +Fallback for encoding \-> unicode. When seen, enc2xs adds this +character for the decode map only. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +And finally, \s-1END OF CHARMAP\s0 ends the section. +.PP +When you are manually creating a \s-1UCM\s0 file, you should copy ascii.ucm +or an existing encoding which is close to yours, rather than write +your own from scratch. +.PP +When you do so, make sure you leave at least \fBU0000\fR to \fBU0020\fR as +is, unless your environment is \s-1EBCDIC.\s0 +.PP +\&\fB\s-1CAVEAT\s0\fR: not all features in \s-1UCM\s0 are implemented. For example, +icu:state is not used. Because of that, you need to write a perl +module if you want to support algorithmical encodings, notably +the \s-1ISO\-2022\s0 series. Such modules include Encode::JP::2022_JP, +Encode::KR::2022_KR, and Encode::TW::HZ. +.SS "Coping with duplicate mappings" +.IX Subsection "Coping with duplicate mappings" +When you create a map, you \s-1SHOULD\s0 make your mappings round-trip safe. +That is, \f(CW\*(C`encode(\*(Aqyour\-encoding\*(Aq, decode(\*(Aqyour\-encoding\*(Aq, $data)) eq +$data\*(C'\fR stands for all characters that are marked as \f(CW\*(C`|0\*(C'\fR. Here is +how to make sure: +.IP "\(bu" 4 +Sort your map in Unicode order. +.IP "\(bu" 4 +When you have a duplicate entry, mark either one with '|1' or '|3'. +.IP "\(bu" 4 +And make sure the '|1' or '|3' entry \s-1FOLLOWS\s0 the '|0' entry. +.PP +Here is an example from big5\-eten. +.PP +.Vb 2 +\& \exF9\exF9 |0 +\& \exA2\exA4 |3 +.Ve +.PP +Internally Encoding \-> Unicode and Unicode \-> Encoding Map looks like +this; +.PP +.Vb 4 +\& E to U U to E +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& \exF9\exF9 => U2550 U2550 => \exF9\exF9 +\& \exA2\exA4 => U2550 +.Ve +.PP +So it is round-trip safe for \exF9\exF9. But if the line above is upside +down, here is what happens. +.PP +.Vb 4 +\& E to U U to E +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& \exA2\exA4 => U2550 U2550 => \exF9\exF9 +\& (\exF9\exF9 => U2550 is now overwritten!) +.Ve +.PP +The Encode package comes with \fIucmlint\fR, a crude but sufficient +utility to check the integrity of a \s-1UCM\s0 file. Check under the +Encode/bin directory for this. +.PP +When in doubt, you can use \fIucmsort\fR, yet another utility under +Encode/bin directory. +.SH "Bookmarks" +.IX Header "Bookmarks" +.IP "\(bu" 4 +\&\s-1ICU\s0 Home Page + +.IP "\(bu" 4 +\&\s-1ICU\s0 Character Mapping Tables + +.IP "\(bu" 4 +ICU:Conversion Data + +.SH "SEE ALSO" +.IX Header "SEE ALSO" +Encode, +perlmod, +perlpod diff --git a/data/miniconda3/man/man1/perl5100delta.1 b/data/miniconda3/man/man1/perl5100delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..6bbe9749258efa03315d88c854f9276ad95a5ea4 --- /dev/null +++ b/data/miniconda3/man/man1/perl5100delta.1 @@ -0,0 +1,1580 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5100DELTA 1" +.TH PERL5100DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5100delta \- what is new for perl 5.10.0 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes the differences between the 5.8.8 release and +the 5.10.0 release. +.PP +Many of the bug fixes in 5.10.0 were already seen in the 5.8.X maintenance +releases; they are not duplicated here and are documented in the set of +man pages named perl58[1\-8]?delta. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.ie n .SS "The ""feature"" pragma" +.el .SS "The \f(CWfeature\fP pragma" +.IX Subsection "The feature pragma" +The \f(CW\*(C`feature\*(C'\fR pragma is used to enable new syntax that would break Perl's +backwards-compatibility with older releases of the language. It's a lexical +pragma, like \f(CW\*(C`strict\*(C'\fR or \f(CW\*(C`warnings\*(C'\fR. +.PP +Currently the following new features are available: \f(CW\*(C`switch\*(C'\fR (adds a +switch statement), \f(CW\*(C`say\*(C'\fR (adds a \f(CW\*(C`say\*(C'\fR built-in function), and \f(CW\*(C`state\*(C'\fR +(adds a \f(CW\*(C`state\*(C'\fR keyword for declaring \*(L"static\*(R" variables). Those +features are described in their own sections of this document. +.PP +The \f(CW\*(C`feature\*(C'\fR pragma is also implicitly loaded when you require a minimal +perl version (with the \f(CW\*(C`use VERSION\*(C'\fR construct) greater than, or equal +to, 5.9.5. See feature for details. +.SS "New \fB\-E\fP command-line switch" +.IX Subsection "New -E command-line switch" +\&\fB\-E\fR is equivalent to \fB\-e\fR, but it implicitly enables all +optional features (like \f(CW\*(C`use feature ":5.10"\*(C'\fR). +.SS "Defined-or operator" +.IX Subsection "Defined-or operator" +A new operator \f(CW\*(C`//\*(C'\fR (defined-or) has been implemented. +The following expression: +.PP +.Vb 1 +\& $a // $b +.Ve +.PP +is merely equivalent to +.PP +.Vb 1 +\& defined $a ? $a : $b +.Ve +.PP +and the statement +.PP +.Vb 1 +\& $c //= $d; +.Ve +.PP +can now be used instead of +.PP +.Vb 1 +\& $c = $d unless defined $c; +.Ve +.PP +The \f(CW\*(C`//\*(C'\fR operator has the same precedence and associativity as \f(CW\*(C`||\*(C'\fR. +Special care has been taken to ensure that this operator Do What You Mean +while not breaking old code, but some edge cases involving the empty +regular expression may now parse differently. See perlop for +details. +.SS "Switch and Smart Match operator" +.IX Subsection "Switch and Smart Match operator" +Perl 5 now has a switch statement. It's available when \f(CW\*(C`use feature +\&\*(Aqswitch\*(Aq\*(C'\fR is in effect. This feature introduces three new keywords, +\&\f(CW\*(C`given\*(C'\fR, \f(CW\*(C`when\*(C'\fR, and \f(CW\*(C`default\*(C'\fR: +.PP +.Vb 6 +\& given ($foo) { +\& when (/^abc/) { $abc = 1; } +\& when (/^def/) { $def = 1; } +\& when (/^xyz/) { $xyz = 1; } +\& default { $nothing = 1; } +\& } +.Ve +.PP +A more complete description of how Perl matches the switch variable +against the \f(CW\*(C`when\*(C'\fR conditions is given in \*(L"Switch statements\*(R" in perlsyn. +.PP +This kind of match is called \fIsmart match\fR, and it's also possible to use +it outside of switch statements, via the new \f(CW\*(C`~~\*(C'\fR operator. See +\&\*(L"Smart matching in detail\*(R" in perlsyn. +.PP +This feature was contributed by Robin Houston. +.SS "Regular expressions" +.IX Subsection "Regular expressions" +.IP "Recursive Patterns" 4 +.IX Item "Recursive Patterns" +It is now possible to write recursive patterns without using the \f(CW\*(C`(??{})\*(C'\fR +construct. This new way is more efficient, and in many cases easier to +read. +.Sp +Each capturing parenthesis can now be treated as an independent pattern +that can be entered by using the \f(CW\*(C`(?PARNO)\*(C'\fR syntax (\f(CW\*(C`PARNO\*(C'\fR standing for +\&\*(L"parenthesis number\*(R"). For example, the following pattern will match +nested balanced angle brackets: +.Sp +.Vb 10 +\& / +\& ^ # start of line +\& ( # start capture buffer 1 +\& < # match an opening angle bracket +\& (?: # match one of: +\& (?> # don\*(Aqt backtrack over the inside of this group +\& [^<>]+ # one or more non angle brackets +\& ) # end non backtracking group +\& | # ... or ... +\& (?1) # recurse to bracket 1 and try it again +\& )* # 0 or more times. +\& > # match a closing angle bracket +\& ) # end capture buffer one +\& $ # end of line +\& /x +.Ve +.Sp +\&\s-1PCRE\s0 users should note that Perl's recursive regex feature allows +backtracking into a recursed pattern, whereas in \s-1PCRE\s0 the recursion is +atomic or \*(L"possessive\*(R" in nature. As in the example above, you can +add (?>) to control this selectively. (Yves Orton) +.IP "Named Capture Buffers" 4 +.IX Item "Named Capture Buffers" +It is now possible to name capturing parenthesis in a pattern and refer to +the captured contents by name. The naming syntax is \f(CW\*(C`(?....)\*(C'\fR. +It's possible to backreference to a named buffer with the \f(CW\*(C`\ek\*(C'\fR +syntax. In code, the new magical hashes \f(CW\*(C`%+\*(C'\fR and \f(CW\*(C`%\-\*(C'\fR can be used to +access the contents of the capture buffers. +.Sp +Thus, to replace all doubled chars with a single copy, one could write +.Sp +.Vb 1 +\& s/(?.)\ek/$+{letter}/g +.Ve +.Sp +Only buffers with defined contents will be \*(L"visible\*(R" in the \f(CW\*(C`%+\*(C'\fR hash, so +it's possible to do something like +.Sp +.Vb 3 +\& foreach my $name (keys %+) { +\& print "content of buffer \*(Aq$name\*(Aq is $+{$name}\en"; +\& } +.Ve +.Sp +The \f(CW\*(C`%\-\*(C'\fR hash is a bit more complete, since it will contain array refs +holding values from all capture buffers similarly named, if there should +be many of them. +.Sp +\&\f(CW\*(C`%+\*(C'\fR and \f(CW\*(C`%\-\*(C'\fR are implemented as tied hashes through the new module +\&\f(CW\*(C`Tie::Hash::NamedCapture\*(C'\fR. +.Sp +Users exposed to the .NET regex engine will find that the perl +implementation differs in that the numerical ordering of the buffers +is sequential, and not \*(L"unnamed first, then named\*(R". Thus in the pattern +.Sp +.Vb 1 +\& /(A)(?B)(C)(?D)/ +.Ve +.Sp +\&\f(CW$1\fR will be 'A', \f(CW$2\fR will be 'B', \f(CW$3\fR will be 'C' and \f(CW$4\fR will be 'D' and not +\&\f(CW$1\fR is 'A', \f(CW$2\fR is 'C' and \f(CW$3\fR is 'B' and \f(CW$4\fR is 'D' that a .NET programmer +would expect. This is considered a feature. :\-) (Yves Orton) +.IP "Possessive Quantifiers" 4 +.IX Item "Possessive Quantifiers" +Perl now supports the \*(L"possessive quantifier\*(R" syntax of the \*(L"atomic match\*(R" +pattern. Basically a possessive quantifier matches as much as it can and never +gives any back. Thus it can be used to control backtracking. The syntax is +similar to non-greedy matching, except instead of using a '?' as the modifier +the '+' is used. Thus \f(CW\*(C`?+\*(C'\fR, \f(CW\*(C`*+\*(C'\fR, \f(CW\*(C`++\*(C'\fR, \f(CW\*(C`{min,max}+\*(C'\fR are now legal +quantifiers. (Yves Orton) +.IP "Backtracking control verbs" 4 +.IX Item "Backtracking control verbs" +The regex engine now supports a number of special-purpose backtrack +control verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL) +and (*ACCEPT). See perlre for their descriptions. (Yves Orton) +.IP "Relative backreferences" 4 +.IX Item "Relative backreferences" +A new syntax \f(CW\*(C`\eg{N}\*(C'\fR or \f(CW\*(C`\egN\*(C'\fR where \*(L"N\*(R" is a decimal integer allows a +safer form of back-reference notation as well as allowing relative +backreferences. This should make it easier to generate and embed patterns +that contain backreferences. See \*(L"Capture buffers\*(R" in perlre. (Yves Orton) +.ie n .IP """\eK"" escape" 4 +.el .IP "\f(CW\eK\fR escape" 4 +.IX Item "K escape" +The functionality of Jeff Pinyan's module Regexp::Keep has been added to +the core. In regular expressions you can now use the special escape \f(CW\*(C`\eK\*(C'\fR +as a way to do something like floating length positive lookbehind. It is +also useful in substitutions like: +.Sp +.Vb 1 +\& s/(foo)bar/$1/g +.Ve +.Sp +that can now be converted to +.Sp +.Vb 1 +\& s/foo\eKbar//g +.Ve +.Sp +which is much more efficient. (Yves Orton) +.IP "Vertical and horizontal whitespace, and linebreak" 4 +.IX Item "Vertical and horizontal whitespace, and linebreak" +Regular expressions now recognize the \f(CW\*(C`\ev\*(C'\fR and \f(CW\*(C`\eh\*(C'\fR escapes that match +vertical and horizontal whitespace, respectively. \f(CW\*(C`\eV\*(C'\fR and \f(CW\*(C`\eH\*(C'\fR +logically match their complements. +.Sp +\&\f(CW\*(C`\eR\*(C'\fR matches a generic linebreak, that is, vertical whitespace, plus +the multi-character sequence \f(CW"\ex0D\ex0A"\fR. +.IP "Optional pre-match and post-match captures with the /p flag" 4 +.IX Item "Optional pre-match and post-match captures with the /p flag" +There is a new flag \f(CW\*(C`/p\*(C'\fR for regular expressions. Using this +makes the engine preserve a copy of the part of the matched string before +the matching substring to the new special variable \f(CW\*(C`${^PREMATCH}\*(C'\fR, the +part after the matching substring to \f(CW\*(C`${^POSTMATCH}\*(C'\fR, and the matched +substring itself to \f(CW\*(C`${^MATCH}\*(C'\fR. +.Sp +Perl is still able to store these substrings to the special variables +\&\f(CW\*(C`$\`\*(C'\fR, \f(CW\*(C`$\*(Aq\*(C'\fR, \f(CW$&\fR, but using these variables anywhere in the program +adds a penalty to all regular expression matches, whereas if you use +the \f(CW\*(C`/p\*(C'\fR flag and the new special variables instead, you pay only for +the regular expressions where the flag is used. +.Sp +For more detail on the new variables, see perlvar; for the use of +the regular expression flag, see perlop and perlre. +.ie n .SS """say()""" +.el .SS "\f(CWsay()\fP" +.IX Subsection "say()" +\&\fBsay()\fR is a new built-in, only available when \f(CW\*(C`use feature \*(Aqsay\*(Aq\*(C'\fR is in +effect, that is similar to \fBprint()\fR, but that implicitly appends a newline +to the printed string. See \*(L"say\*(R" in perlfunc. (Robin Houston) +.ie n .SS "Lexical $_" +.el .SS "Lexical \f(CW$_\fP" +.IX Subsection "Lexical $_" +The default variable \f(CW$_\fR can now be lexicalized, by declaring it like +any other lexical variable, with a simple +.PP +.Vb 1 +\& my $_; +.Ve +.PP +The operations that default on \f(CW$_\fR will use the lexically-scoped +version of \f(CW$_\fR when it exists, instead of the global \f(CW$_\fR. +.PP +In a \f(CW\*(C`map\*(C'\fR or a \f(CW\*(C`grep\*(C'\fR block, if \f(CW$_\fR was previously my'ed, then the +\&\f(CW$_\fR inside the block is lexical as well (and scoped to the block). +.PP +In a scope where \f(CW$_\fR has been lexicalized, you can still have access to +the global version of \f(CW$_\fR by using \f(CW$::_\fR, or, more simply, by +overriding the lexical declaration with \f(CW\*(C`our $_\*(C'\fR. (Rafael Garcia-Suarez) +.ie n .SS "The ""_"" prototype" +.el .SS "The \f(CW_\fP prototype" +.IX Subsection "The _ prototype" +A new prototype character has been added. \f(CW\*(C`_\*(C'\fR is equivalent to \f(CW\*(C`$\*(C'\fR but +defaults to \f(CW$_\fR if the corresponding argument isn't supplied (both \f(CW\*(C`$\*(C'\fR +and \f(CW\*(C`_\*(C'\fR denote a scalar). Due to the optional nature of the argument, +you can only use it at the end of a prototype, or before a semicolon. +.PP +This has a small incompatible consequence: the \fBprototype()\fR function has +been adjusted to return \f(CW\*(C`_\*(C'\fR for some built-ins in appropriate cases (for +example, \f(CW\*(C`prototype(\*(AqCORE::rmdir\*(Aq)\*(C'\fR). (Rafael Garcia-Suarez) +.SS "\s-1UNITCHECK\s0 blocks" +.IX Subsection "UNITCHECK blocks" +\&\f(CW\*(C`UNITCHECK\*(C'\fR, a new special code block has been introduced, in addition to +\&\f(CW\*(C`BEGIN\*(C'\fR, \f(CW\*(C`CHECK\*(C'\fR, \f(CW\*(C`INIT\*(C'\fR and \f(CW\*(C`END\*(C'\fR. +.PP +\&\f(CW\*(C`CHECK\*(C'\fR and \f(CW\*(C`INIT\*(C'\fR blocks, while useful for some specialized purposes, +are always executed at the transition between the compilation and the +execution of the main program, and thus are useless whenever code is +loaded at runtime. On the other hand, \f(CW\*(C`UNITCHECK\*(C'\fR blocks are executed +just after the unit which defined them has been compiled. See perlmod +for more information. (Alex Gough) +.ie n .SS "New Pragma, ""mro""" +.el .SS "New Pragma, \f(CWmro\fP" +.IX Subsection "New Pragma, mro" +A new pragma, \f(CW\*(C`mro\*(C'\fR (for Method Resolution Order) has been added. It +permits to switch, on a per-class basis, the algorithm that perl uses to +find inherited methods in case of a multiple inheritance hierarchy. The +default \s-1MRO\s0 hasn't changed (\s-1DFS,\s0 for Depth First Search). Another \s-1MRO\s0 is +available: the C3 algorithm. See mro for more information. +(Brandon Black) +.PP +Note that, due to changes in the implementation of class hierarchy search, +code that used to undef the \f(CW*ISA\fR glob will most probably break. Anyway, +undef'ing \f(CW*ISA\fR had the side-effect of removing the magic on the \f(CW@ISA\fR +array and should not have been done in the first place. Also, the +cache \f(CW*::ISA::CACHE::\fR no longer exists; to force reset the \f(CW@ISA\fR cache, +you now need to use the \f(CW\*(C`mro\*(C'\fR \s-1API,\s0 or more simply to assign to \f(CW@ISA\fR +(e.g. with \f(CW\*(C`@ISA = @ISA\*(C'\fR). +.ie n .SS "\fBreaddir()\fP may return a ""short filename"" on Windows" +.el .SS "\fBreaddir()\fP may return a ``short filename'' on Windows" +.IX Subsection "readdir() may return a short filename on Windows" +The \fBreaddir()\fR function may return a \*(L"short filename\*(R" when the long +filename contains characters outside the \s-1ANSI\s0 codepage. Similarly +\&\fBCwd::cwd()\fR may return a short directory name, and \fBglob()\fR may return short +names as well. On the \s-1NTFS\s0 file system these short names can always be +represented in the \s-1ANSI\s0 codepage. This will not be true for all other file +system drivers; e.g. the \s-1FAT\s0 filesystem stores short filenames in the \s-1OEM\s0 +codepage, so some files on \s-1FAT\s0 volumes remain unaccessible through the +\&\s-1ANSI\s0 APIs. +.PP +Similarly, $^X, \f(CW@INC\fR, and \f(CW$ENV\fR{\s-1PATH\s0} are preprocessed at startup to make +sure all paths are valid in the \s-1ANSI\s0 codepage (if possible). +.PP +The \fBWin32::GetLongPathName()\fR function now returns the \s-1UTF\-8\s0 encoded +correct long file name instead of using replacement characters to force +the name into the \s-1ANSI\s0 codepage. The new \fBWin32::GetANSIPathName()\fR +function can be used to turn a long pathname into a short one only if the +long one cannot be represented in the \s-1ANSI\s0 codepage. +.PP +Many other functions in the \f(CW\*(C`Win32\*(C'\fR module have been improved to accept +\&\s-1UTF\-8\s0 encoded arguments. Please see Win32 for details. +.SS "\fBreadpipe()\fP is now overridable" +.IX Subsection "readpipe() is now overridable" +The built-in function \fBreadpipe()\fR is now overridable. Overriding it permits +also to override its operator counterpart, \f(CW\*(C`qx//\*(C'\fR (a.k.a. \f(CW\*(C`\`\`\*(C'\fR). +Moreover, it now defaults to \f(CW$_\fR if no argument is provided. (Rafael +Garcia-Suarez) +.SS "Default argument for \fBreadline()\fP" +.IX Subsection "Default argument for readline()" +\&\fBreadline()\fR now defaults to \f(CW*ARGV\fR if no argument is provided. (Rafael +Garcia-Suarez) +.SS "\fBstate()\fP variables" +.IX Subsection "state() variables" +A new class of variables has been introduced. State variables are similar +to \f(CW\*(C`my\*(C'\fR variables, but are declared with the \f(CW\*(C`state\*(C'\fR keyword in place of +\&\f(CW\*(C`my\*(C'\fR. They're visible only in their lexical scope, but their value is +persistent: unlike \f(CW\*(C`my\*(C'\fR variables, they're not undefined at scope entry, +but retain their previous value. (Rafael Garcia-Suarez, Nicholas Clark) +.PP +To use state variables, one needs to enable them by using +.PP +.Vb 1 +\& use feature \*(Aqstate\*(Aq; +.Ve +.PP +or by using the \f(CW\*(C`\-E\*(C'\fR command-line switch in one-liners. +See \*(L"Persistent Private Variables\*(R" in perlsub. +.SS "Stacked filetest operators" +.IX Subsection "Stacked filetest operators" +As a new form of syntactic sugar, it's now possible to stack up filetest +operators. You can now write \f(CW\*(C`\-f \-w \-x $file\*(C'\fR in a row to mean +\&\f(CW\*(C`\-x $file && \-w _ && \-f _\*(C'\fR. See \*(L"\-X\*(R" in perlfunc. +.SS "\s-1\fBUNIVERSAL::DOES\s0()\fP" +.IX Subsection "UNIVERSAL::DOES()" +The \f(CW\*(C`UNIVERSAL\*(C'\fR class has a new method, \f(CW\*(C`DOES()\*(C'\fR. It has been added to +solve semantic problems with the \f(CW\*(C`isa()\*(C'\fR method. \f(CW\*(C`isa()\*(C'\fR checks for +inheritance, while \f(CW\*(C`DOES()\*(C'\fR has been designed to be overridden when +module authors use other types of relations between classes (in addition +to inheritance). (chromatic) +.PP +See \*(L"$obj\->\s-1DOES\s0( \s-1ROLE\s0 )\*(R" in \s-1UNIVERSAL\s0. +.SS "Formats" +.IX Subsection "Formats" +Formats were improved in several ways. A new field, \f(CW\*(C`^*\*(C'\fR, can be used for +variable-width, one-line-at-a-time text. Null characters are now handled +correctly in picture lines. Using \f(CW\*(C`@#\*(C'\fR and \f(CW\*(C`~~\*(C'\fR together will now +produce a compile-time error, as those format fields are incompatible. +perlform has been improved, and miscellaneous bugs fixed. +.SS "Byte-order modifiers for \fBpack()\fP and \fBunpack()\fP" +.IX Subsection "Byte-order modifiers for pack() and unpack()" +There are two new byte-order modifiers, \f(CW\*(C`>\*(C'\fR (big-endian) and \f(CW\*(C`<\*(C'\fR +(little-endian), that can be appended to most \fBpack()\fR and \fBunpack()\fR template +characters and groups to force a certain byte-order for that type or group. +See \*(L"pack\*(R" in perlfunc and perlpacktut for details. +.ie n .SS """no VERSION""" +.el .SS "\f(CWno VERSION\fP" +.IX Subsection "no VERSION" +You can now use \f(CW\*(C`no\*(C'\fR followed by a version number to specify that you +want to use a version of perl older than the specified one. +.ie n .SS """chdir"", ""chmod"" and ""chown"" on filehandles" +.el .SS "\f(CWchdir\fP, \f(CWchmod\fP and \f(CWchown\fP on filehandles" +.IX Subsection "chdir, chmod and chown on filehandles" +\&\f(CW\*(C`chdir\*(C'\fR, \f(CW\*(C`chmod\*(C'\fR and \f(CW\*(C`chown\*(C'\fR can now work on filehandles as well as +filenames, if the system supports respectively \f(CW\*(C`fchdir\*(C'\fR, \f(CW\*(C`fchmod\*(C'\fR and +\&\f(CW\*(C`fchown\*(C'\fR, thanks to a patch provided by Gisle Aas. +.SS "\s-1OS\s0 groups" +.IX Subsection "OS groups" +\&\f(CW$(\fR and \f(CW$)\fR now return groups in the order where the \s-1OS\s0 returns them, +thanks to Gisle Aas. This wasn't previously the case. +.SS "Recursive sort subs" +.IX Subsection "Recursive sort subs" +You can now use recursive subroutines with \fBsort()\fR, thanks to Robin Houston. +.SS "Exceptions in constant folding" +.IX Subsection "Exceptions in constant folding" +The constant folding routine is now wrapped in an exception handler, and +if folding throws an exception (such as attempting to evaluate 0/0), perl +now retains the current optree, rather than aborting the whole program. +Without this change, programs would not compile if they had expressions that +happened to generate exceptions, even though those expressions were in code +that could never be reached at runtime. (Nicholas Clark, Dave Mitchell) +.ie n .SS "Source filters in @INC" +.el .SS "Source filters in \f(CW@INC\fP" +.IX Subsection "Source filters in @INC" +It's possible to enhance the mechanism of subroutine hooks in \f(CW@INC\fR by +adding a source filter on top of the filehandle opened and returned by the +hook. This feature was planned a long time ago, but wasn't quite working +until now. See \*(L"require\*(R" in perlfunc for details. (Nicholas Clark) +.SS "New internal variables" +.IX Subsection "New internal variables" +.ie n .IP """${^RE_DEBUG_FLAGS}""" 4 +.el .IP "\f(CW${^RE_DEBUG_FLAGS}\fR" 4 +.IX Item "${^RE_DEBUG_FLAGS}" +This variable controls what debug flags are in effect for the regular +expression engine when running under \f(CW\*(C`use re "debug"\*(C'\fR. See re for +details. +.ie n .IP """${^CHILD_ERROR_NATIVE}""" 4 +.el .IP "\f(CW${^CHILD_ERROR_NATIVE}\fR" 4 +.IX Item "${^CHILD_ERROR_NATIVE}" +This variable gives the native status returned by the last pipe close, +backtick command, successful call to \fBwait()\fR or \fBwaitpid()\fR, or from the +\&\fBsystem()\fR operator. See perlvar for details. (Contributed by Gisle Aas.) +.ie n .IP """${^RE_TRIE_MAXBUF}""" 4 +.el .IP "\f(CW${^RE_TRIE_MAXBUF}\fR" 4 +.IX Item "${^RE_TRIE_MAXBUF}" +See \*(L"Trie optimisation of literal string alternations\*(R". +.ie n .IP """${^WIN32_SLOPPY_STAT}""" 4 +.el .IP "\f(CW${^WIN32_SLOPPY_STAT}\fR" 4 +.IX Item "${^WIN32_SLOPPY_STAT}" +See \*(L"Sloppy stat on Windows\*(R". +.SS "Miscellaneous" +.IX Subsection "Miscellaneous" +\&\f(CW\*(C`unpack()\*(C'\fR now defaults to unpacking the \f(CW$_\fR variable. +.PP +\&\f(CW\*(C`mkdir()\*(C'\fR without arguments now defaults to \f(CW$_\fR. +.PP +The internal dump output has been improved, so that non-printable characters +such as newline and backspace are output in \f(CW\*(C`\ex\*(C'\fR notation, rather than +octal. +.PP +The \fB\-C\fR option can no longer be used on the \f(CW\*(C`#!\*(C'\fR line. It wasn't +working there anyway, since the standard streams are already set up +at this point in the execution of the perl interpreter. You can use +\&\fBbinmode()\fR instead to get the desired behaviour. +.SS "\s-1UCD 5.0.0\s0" +.IX Subsection "UCD 5.0.0" +The copy of the Unicode Character Database included in Perl 5 has +been updated to version 5.0.0. +.SS "\s-1MAD\s0" +.IX Subsection "MAD" +\&\s-1MAD,\s0 which stands for \fIMiscellaneous Attribute Decoration\fR, is a +still-in-development work leading to a Perl 5 to Perl 6 converter. To +enable it, it's necessary to pass the argument \f(CW\*(C`\-Dmad\*(C'\fR to Configure. The +obtained perl isn't binary compatible with a regular perl 5.10, and has +space and speed penalties; moreover not all regression tests still pass +with it. (Larry Wall, Nicholas Clark) +.SS "\fBkill()\fP on Windows" +.IX Subsection "kill() on Windows" +On Windows platforms, \f(CW\*(C`kill(\-9, $pid)\*(C'\fR now kills a process tree. +(On Unix, this delivers the signal to all processes in the same process +group.) +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +.SS "Packing and \s-1UTF\-8\s0 strings" +.IX Subsection "Packing and UTF-8 strings" +The semantics of \fBpack()\fR and \fBunpack()\fR regarding UTF\-8\-encoded data has been +changed. Processing is now by default character per character instead of +byte per byte on the underlying encoding. Notably, code that used things +like \f(CW\*(C`pack("a*", $string)\*(C'\fR to see through the encoding of string will now +simply get back the original \f(CW$string\fR. Packed strings can also get upgraded +during processing when you store upgraded characters. You can get the old +behaviour by using \f(CW\*(C`use bytes\*(C'\fR. +.PP +To be consistent with \fBpack()\fR, the \f(CW\*(C`C0\*(C'\fR in \fBunpack()\fR templates indicates +that the data is to be processed in character mode, i.e. character by +character; on the contrary, \f(CW\*(C`U0\*(C'\fR in \fBunpack()\fR indicates \s-1UTF\-8\s0 mode, where +the packed string is processed in its UTF\-8\-encoded Unicode form on a byte +by byte basis. This is reversed with regard to perl 5.8.X, but now consistent +between \fBpack()\fR and \fBunpack()\fR. +.PP +Moreover, \f(CW\*(C`C0\*(C'\fR and \f(CW\*(C`U0\*(C'\fR can also be used in \fBpack()\fR templates to specify +respectively character and byte modes. +.PP +\&\f(CW\*(C`C0\*(C'\fR and \f(CW\*(C`U0\*(C'\fR in the middle of a pack or unpack format now switch to the +specified encoding mode, honoring parens grouping. Previously, parens were +ignored. +.PP +Also, there is a new \fBpack()\fR character format, \f(CW\*(C`W\*(C'\fR, which is intended to +replace the old \f(CW\*(C`C\*(C'\fR. \f(CW\*(C`C\*(C'\fR is kept for unsigned chars coded as bytes in +the strings internal representation. \f(CW\*(C`W\*(C'\fR represents unsigned (logical) +character values, which can be greater than 255. It is therefore more +robust when dealing with potentially UTF\-8\-encoded data (as \f(CW\*(C`C\*(C'\fR will wrap +values outside the range 0..255, and not respect the string encoding). +.PP +In practice, that means that pack formats are now encoding-neutral, except +\&\f(CW\*(C`C\*(C'\fR. +.PP +For consistency, \f(CW\*(C`A\*(C'\fR in \fBunpack()\fR format now trims all Unicode whitespace +from the end of the string. Before perl 5.9.2, it used to strip only the +classical \s-1ASCII\s0 space characters. +.SS "Byte/character count feature in \fBunpack()\fP" +.IX Subsection "Byte/character count feature in unpack()" +A new \fBunpack()\fR template character, \f(CW"."\fR, returns the number of bytes or +characters (depending on the selected encoding mode, see above) read so far. +.ie n .SS "The $* and $# variables have been removed" +.el .SS "The \f(CW$*\fP and \f(CW$#\fP variables have been removed" +.IX Subsection "The $* and $# variables have been removed" +\&\f(CW$*\fR, which was deprecated in favor of the \f(CW\*(C`/s\*(C'\fR and \f(CW\*(C`/m\*(C'\fR regexp +modifiers, has been removed. +.PP +The deprecated \f(CW$#\fR variable (output format for numbers) has been +removed. +.PP +Two new severe warnings, \f(CW\*(C`$#/$* is no longer supported\*(C'\fR, have been added. +.SS "\fBsubstr()\fP lvalues are no longer fixed-length" +.IX Subsection "substr() lvalues are no longer fixed-length" +The lvalues returned by the three argument form of \fBsubstr()\fR used to be a +\&\*(L"fixed length window\*(R" on the original string. In some cases this could +cause surprising action at distance or other undefined behaviour. Now the +length of the window adjusts itself to the length of the string assigned to +it. +.ie n .SS "Parsing of ""\-f _""" +.el .SS "Parsing of \f(CW\-f _\fP" +.IX Subsection "Parsing of -f _" +The identifier \f(CW\*(C`_\*(C'\fR is now forced to be a bareword after a filetest +operator. This solves a number of misparsing issues when a global \f(CW\*(C`_\*(C'\fR +subroutine is defined. +.ie n .SS """:unique""" +.el .SS "\f(CW:unique\fP" +.IX Subsection ":unique" +The \f(CW\*(C`:unique\*(C'\fR attribute has been made a no-op, since its current +implementation was fundamentally flawed and not threadsafe. +.SS "Effect of pragmas in eval" +.IX Subsection "Effect of pragmas in eval" +The compile-time value of the \f(CW\*(C`%^H\*(C'\fR hint variable can now propagate into +eval("")uated code. This makes it more useful to implement lexical +pragmas. +.PP +As a side-effect of this, the overloaded-ness of constants now propagates +into eval(""). +.SS "chdir \s-1FOO\s0" +.IX Subsection "chdir FOO" +A bareword argument to \fBchdir()\fR is now recognized as a file handle. +Earlier releases interpreted the bareword as a directory name. +(Gisle Aas) +.SS "Handling of .pmc files" +.IX Subsection "Handling of .pmc files" +An old feature of perl was that before \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`use\*(C'\fR look for a +file with a \fI.pm\fR extension, they will first look for a similar filename +with a \fI.pmc\fR extension. If this file is found, it will be loaded in +place of any potentially existing file ending in a \fI.pm\fR extension. +.PP +Previously, \fI.pmc\fR files were loaded only if more recent than the +matching \fI.pm\fR file. Starting with 5.9.4, they'll be always loaded if +they exist. +.ie n .SS "$^V is now a ""version"" object instead of a v\-string" +.el .SS "$^V is now a \f(CWversion\fP object instead of a v\-string" +.IX Subsection "$^V is now a version object instead of a v-string" +$^V can still be used with the \f(CW%vd\fR format in printf, but any +character-level operations will now access the string representation +of the \f(CW\*(C`version\*(C'\fR object and not the ordinals of a v\-string. +Expressions like \f(CW\*(C`substr($^V, 0, 2)\*(C'\fR or \f(CW\*(C`split //, $^V\*(C'\fR +no longer work and must be rewritten. +.SS "@\- and @+ in patterns" +.IX Subsection "@- and @+ in patterns" +The special arrays \f(CW\*(C`@\-\*(C'\fR and \f(CW\*(C`@+\*(C'\fR are no longer interpolated in regular +expressions. (Sadahiro Tomoyuki) +.ie n .SS "$AUTOLOAD can now be tainted" +.el .SS "\f(CW$AUTOLOAD\fP can now be tainted" +.IX Subsection "$AUTOLOAD can now be tainted" +If you call a subroutine by a tainted name, and if it defers to an +\&\s-1AUTOLOAD\s0 function, then \f(CW$AUTOLOAD\fR will be (correctly) tainted. +(Rick Delaney) +.SS "Tainting and printf" +.IX Subsection "Tainting and printf" +When perl is run under taint mode, \f(CW\*(C`printf()\*(C'\fR and \f(CW\*(C`sprintf()\*(C'\fR will now +reject any tainted format argument. (Rafael Garcia-Suarez) +.SS "undef and signal handlers" +.IX Subsection "undef and signal handlers" +Undefining or deleting a signal handler via \f(CW\*(C`undef $SIG{FOO}\*(C'\fR is now +equivalent to setting it to \f(CW\*(AqDEFAULT\*(Aq\fR. (Rafael Garcia-Suarez) +.SS "strictures and dereferencing in \fBdefined()\fP" +.IX Subsection "strictures and dereferencing in defined()" +\&\f(CW\*(C`use strict \*(Aqrefs\*(Aq\*(C'\fR was ignoring taking a hard reference in an argument +to \fBdefined()\fR, as in : +.PP +.Vb 3 +\& use strict \*(Aqrefs\*(Aq; +\& my $x = \*(Aqfoo\*(Aq; +\& if (defined $$x) {...} +.Ve +.PP +This now correctly produces the run-time error \f(CW\*(C`Can\*(Aqt use string as a +SCALAR ref while "strict refs" in use\*(C'\fR. +.PP +\&\f(CW\*(C`defined @$foo\*(C'\fR and \f(CW\*(C`defined %$bar\*(C'\fR are now also subject to \f(CW\*(C`strict +\&\*(Aqrefs\*(Aq\*(C'\fR (that is, \f(CW$foo\fR and \f(CW$bar\fR shall be proper references there.) +(\f(CW\*(C`defined(@foo)\*(C'\fR and \f(CW\*(C`defined(%bar)\*(C'\fR are discouraged constructs anyway.) +(Nicholas Clark) +.ie n .SS """(?p{})"" has been removed" +.el .SS "\f(CW(?p{})\fP has been removed" +.IX Subsection "(?p{}) has been removed" +The regular expression construct \f(CW\*(C`(?p{})\*(C'\fR, which was deprecated in perl +5.8, has been removed. Use \f(CW\*(C`(??{})\*(C'\fR instead. (Rafael Garcia-Suarez) +.SS "Pseudo-hashes have been removed" +.IX Subsection "Pseudo-hashes have been removed" +Support for pseudo-hashes has been removed from Perl 5.9. (The \f(CW\*(C`fields\*(C'\fR +pragma remains here, but uses an alternate implementation.) +.SS "Removal of the bytecode compiler and of perlcc" +.IX Subsection "Removal of the bytecode compiler and of perlcc" +\&\f(CW\*(C`perlcc\*(C'\fR, the byteloader and the supporting modules (B::C, B::CC, +B::Bytecode, etc.) are no longer distributed with the perl sources. Those +experimental tools have never worked reliably, and, due to the lack of +volunteers to keep them in line with the perl interpreter developments, it +was decided to remove them instead of shipping a broken version of those. +The last version of those modules can be found with perl 5.9.4. +.PP +However the B compiler framework stays supported in the perl core, as with +the more useful modules it has permitted (among others, B::Deparse and +B::Concise). +.SS "Removal of the \s-1JPL\s0" +.IX Subsection "Removal of the JPL" +The \s-1JPL\s0 (Java-Perl Lingo) has been removed from the perl sources tarball. +.SS "Recursive inheritance detected earlier" +.IX Subsection "Recursive inheritance detected earlier" +Perl will now immediately throw an exception if you modify any package's +\&\f(CW@ISA\fR in such a way that it would cause recursive inheritance. +.PP +Previously, the exception would not occur until Perl attempted to make +use of the recursive inheritance while resolving a method or doing a +\&\f(CW\*(C`$foo\->isa($bar)\*(C'\fR lookup. +.SS "warnings::enabled and warnings::warnif changed to favor users of modules" +.IX Subsection "warnings::enabled and warnings::warnif changed to favor users of modules" +The behaviour in 5.10.x favors the person using the module; +The behaviour in 5.8.x favors the module writer; +.PP +Assume the following code: +.PP +.Vb 5 +\& main calls Foo::Bar::baz() +\& Foo::Bar inherits from Foo::Base +\& Foo::Bar::baz() calls Foo::Base::_bazbaz() +\& Foo::Base::_bazbaz() calls: warnings::warnif(\*(Aqsubstr\*(Aq, \*(Aqsome warning +\&message\*(Aq); +.Ve +.PP +On 5.8.x, the code warns when Foo::Bar contains \f(CW\*(C`use warnings;\*(C'\fR +It does not matter if Foo::Base or main have warnings enabled +to disable the warning one has to modify Foo::Bar. +.PP +On 5.10.0 and newer, the code warns when main contains \f(CW\*(C`use warnings;\*(C'\fR +It does not matter if Foo::Base or Foo::Bar have warnings enabled +to disable the warning one has to modify main. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Upgrading individual core modules" +.IX Subsection "Upgrading individual core modules" +Even more core modules are now also available separately through the +\&\s-1CPAN.\s0 If you wish to update one of these modules, you don't need to +wait for a new perl release. From within the cpan shell, running the +\&'r' command will report on modules with upgrades available. See +\&\f(CW\*(C`perldoc CPAN\*(C'\fR for more information. +.SS "Pragmata Changes" +.IX Subsection "Pragmata Changes" +.ie n .IP """feature""" 4 +.el .IP "\f(CWfeature\fR" 4 +.IX Item "feature" +The new pragma \f(CW\*(C`feature\*(C'\fR is used to enable new features that might break +old code. See "The \f(CW\*(C`feature\*(C'\fR pragma" above. +.ie n .IP """mro""" 4 +.el .IP "\f(CWmro\fR" 4 +.IX Item "mro" +This new pragma enables to change the algorithm used to resolve inherited +methods. See "New Pragma, \f(CW\*(C`mro\*(C'\fR" above. +.ie n .IP "Scoping of the ""sort"" pragma" 4 +.el .IP "Scoping of the \f(CWsort\fR pragma" 4 +.IX Item "Scoping of the sort pragma" +The \f(CW\*(C`sort\*(C'\fR pragma is now lexically scoped. Its effect used to be global. +.ie n .IP "Scoping of ""bignum"", ""bigint"", ""bigrat""" 4 +.el .IP "Scoping of \f(CWbignum\fR, \f(CWbigint\fR, \f(CWbigrat\fR" 4 +.IX Item "Scoping of bignum, bigint, bigrat" +The three numeric pragmas \f(CW\*(C`bignum\*(C'\fR, \f(CW\*(C`bigint\*(C'\fR and \f(CW\*(C`bigrat\*(C'\fR are now +lexically scoped. (Tels) +.ie n .IP """base""" 4 +.el .IP "\f(CWbase\fR" 4 +.IX Item "base" +The \f(CW\*(C`base\*(C'\fR pragma now warns if a class tries to inherit from itself. +(Curtis \*(L"Ovid\*(R" Poe) +.ie n .IP """strict"" and ""warnings""" 4 +.el .IP "\f(CWstrict\fR and \f(CWwarnings\fR" 4 +.IX Item "strict and warnings" +\&\f(CW\*(C`strict\*(C'\fR and \f(CW\*(C`warnings\*(C'\fR will now complain loudly if they are loaded via +incorrect casing (as in \f(CW\*(C`use Strict;\*(C'\fR). (Johan Vromans) +.ie n .IP """version""" 4 +.el .IP "\f(CWversion\fR" 4 +.IX Item "version" +The \f(CW\*(C`version\*(C'\fR module provides support for version objects. +.ie n .IP """warnings""" 4 +.el .IP "\f(CWwarnings\fR" 4 +.IX Item "warnings" +The \f(CW\*(C`warnings\*(C'\fR pragma doesn't load \f(CW\*(C`Carp\*(C'\fR anymore. That means that code +that used \f(CW\*(C`Carp\*(C'\fR routines without having loaded it at compile time might +need to be adjusted; typically, the following (faulty) code won't work +anymore, and will require parentheses to be added after the function name: +.Sp +.Vb 3 +\& use warnings; +\& require Carp; +\& Carp::confess \*(Aqargh\*(Aq; +.Ve +.ie n .IP """less""" 4 +.el .IP "\f(CWless\fR" 4 +.IX Item "less" +\&\f(CW\*(C`less\*(C'\fR now does something useful (or at least it tries to). In fact, it +has been turned into a lexical pragma. So, in your modules, you can now +test whether your users have requested to use less \s-1CPU,\s0 or less memory, +less magic, or maybe even less fat. See less for more. (Joshua ben +Jore) +.SS "New modules" +.IX Subsection "New modules" +.IP "\(bu" 4 +\&\f(CW\*(C`encoding::warnings\*(C'\fR, by Audrey Tang, is a module to emit warnings +whenever an \s-1ASCII\s0 character string containing high-bit bytes is implicitly +converted into \s-1UTF\-8.\s0 It's a lexical pragma since Perl 5.9.4; on older +perls, its effect is global. +.IP "\(bu" 4 +\&\f(CW\*(C`Module::CoreList\*(C'\fR, by Richard Clamp, is a small handy module that tells +you what versions of core modules ship with any versions of Perl 5. It +comes with a command-line frontend, \f(CW\*(C`corelist\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`Math::BigInt::FastCalc\*(C'\fR is an XS-enabled, and thus faster, version of +\&\f(CW\*(C`Math::BigInt::Calc\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`Compress::Zlib\*(C'\fR is an interface to the zlib compression library. It +comes with a bundled version of zlib, so having a working zlib is not a +prerequisite to install it. It's used by \f(CW\*(C`Archive::Tar\*(C'\fR (see below). +.IP "\(bu" 4 +\&\f(CW\*(C`IO::Zlib\*(C'\fR is an \f(CW\*(C`IO::\*(C'\fR\-style interface to \f(CW\*(C`Compress::Zlib\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`Archive::Tar\*(C'\fR is a module to manipulate \f(CW\*(C`tar\*(C'\fR archives. +.IP "\(bu" 4 +\&\f(CW\*(C`Digest::SHA\*(C'\fR is a module used to calculate many types of \s-1SHA\s0 digests, +has been included for \s-1SHA\s0 support in the \s-1CPAN\s0 module. +.IP "\(bu" 4 +\&\f(CW\*(C`ExtUtils::CBuilder\*(C'\fR and \f(CW\*(C`ExtUtils::ParseXS\*(C'\fR have been added. +.IP "\(bu" 4 +\&\f(CW\*(C`Hash::Util::FieldHash\*(C'\fR, by Anno Siegel, has been added. This module +provides support for \fIfield hashes\fR: hashes that maintain an association +of a reference with a value, in a thread-safe garbage-collected way. +Such hashes are useful to implement inside-out objects. +.IP "\(bu" 4 +\&\f(CW\*(C`Module::Build\*(C'\fR, by Ken Williams, has been added. It's an alternative to +\&\f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR to build and install perl modules. +.IP "\(bu" 4 +\&\f(CW\*(C`Module::Load\*(C'\fR, by Jos Boumans, has been added. It provides a single +interface to load Perl modules and \fI.pl\fR files. +.IP "\(bu" 4 +\&\f(CW\*(C`Module::Loaded\*(C'\fR, by Jos Boumans, has been added. It's used to mark +modules as loaded or unloaded. +.IP "\(bu" 4 +\&\f(CW\*(C`Package::Constants\*(C'\fR, by Jos Boumans, has been added. It's a simple +helper to list all constants declared in a given package. +.IP "\(bu" 4 +\&\f(CW\*(C`Win32API::File\*(C'\fR, by Tye McQueen, has been added (for Windows builds). +This module provides low-level access to Win32 system \s-1API\s0 calls for +files/dirs. +.IP "\(bu" 4 +\&\f(CW\*(C`Locale::Maketext::Simple\*(C'\fR, needed by \s-1CPANPLUS,\s0 is a simple wrapper around +\&\f(CW\*(C`Locale::Maketext::Lexicon\*(C'\fR. Note that \f(CW\*(C`Locale::Maketext::Lexicon\*(C'\fR isn't +included in the perl core; the behaviour of \f(CW\*(C`Locale::Maketext::Simple\*(C'\fR +gracefully degrades when the later isn't present. +.IP "\(bu" 4 +\&\f(CW\*(C`Params::Check\*(C'\fR implements a generic input parsing/checking mechanism. It +is used by \s-1CPANPLUS.\s0 +.IP "\(bu" 4 +\&\f(CW\*(C`Term::UI\*(C'\fR simplifies the task to ask questions at a terminal prompt. +.IP "\(bu" 4 +\&\f(CW\*(C`Object::Accessor\*(C'\fR provides an interface to create per-object accessors. +.IP "\(bu" 4 +\&\f(CW\*(C`Module::Pluggable\*(C'\fR is a simple framework to create modules that accept +pluggable sub-modules. +.IP "\(bu" 4 +\&\f(CW\*(C`Module::Load::Conditional\*(C'\fR provides simple ways to query and possibly +load installed modules. +.IP "\(bu" 4 +\&\f(CW\*(C`Time::Piece\*(C'\fR provides an object oriented interface to time functions, +overriding the built-ins \fBlocaltime()\fR and \fBgmtime()\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`IPC::Cmd\*(C'\fR helps to find and run external commands, possibly +interactively. +.IP "\(bu" 4 +\&\f(CW\*(C`File::Fetch\*(C'\fR provide a simple generic file fetching mechanism. +.IP "\(bu" 4 +\&\f(CW\*(C`Log::Message\*(C'\fR and \f(CW\*(C`Log::Message::Simple\*(C'\fR are used by the log facility +of \f(CW\*(C`CPANPLUS\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`Archive::Extract\*(C'\fR is a generic archive extraction mechanism +for \fI.tar\fR (plain, gzipped or bzipped) or \fI.zip\fR files. +.IP "\(bu" 4 +\&\f(CW\*(C`CPANPLUS\*(C'\fR provides an \s-1API\s0 and a command-line tool to access the \s-1CPAN\s0 +mirrors. +.IP "\(bu" 4 +\&\f(CW\*(C`Pod::Escapes\*(C'\fR provides utilities that are useful in decoding Pod +E<...> sequences. +.IP "\(bu" 4 +\&\f(CW\*(C`Pod::Simple\*(C'\fR is now the backend for several of the Pod-related modules +included with Perl. +.SS "Selected Changes to Core Modules" +.IX Subsection "Selected Changes to Core Modules" +.ie n .IP """Attribute::Handlers""" 4 +.el .IP "\f(CWAttribute::Handlers\fR" 4 +.IX Item "Attribute::Handlers" +\&\f(CW\*(C`Attribute::Handlers\*(C'\fR can now report the caller's file and line number. +(David Feldman) +.Sp +All interpreted attributes are now passed as array references. (Damian +Conway) +.ie n .IP """B::Lint""" 4 +.el .IP "\f(CWB::Lint\fR" 4 +.IX Item "B::Lint" +\&\f(CW\*(C`B::Lint\*(C'\fR is now based on \f(CW\*(C`Module::Pluggable\*(C'\fR, and so can be extended +with plugins. (Joshua ben Jore) +.ie n .IP """B""" 4 +.el .IP "\f(CWB\fR" 4 +.IX Item "B" +It's now possible to access the lexical pragma hints (\f(CW\*(C`%^H\*(C'\fR) by using the +method \fBB::COP::hints_hash()\fR. It returns a \f(CW\*(C`B::RHE\*(C'\fR object, which in turn +can be used to get a hash reference via the method \fBB::RHE::HASH()\fR. (Joshua +ben Jore) +.ie n .IP """Thread""" 4 +.el .IP "\f(CWThread\fR" 4 +.IX Item "Thread" +As the old 5005thread threading model has been removed, in favor of the +ithreads scheme, the \f(CW\*(C`Thread\*(C'\fR module is now a compatibility wrapper, to +be used in old code only. It has been removed from the default list of +dynamic extensions. +.SH "Utility Changes" +.IX Header "Utility Changes" +.IP "perl \-d" 4 +.IX Item "perl -d" +The Perl debugger can now save all debugger commands for sourcing later; +notably, it can now emulate stepping backwards, by restarting and +rerunning all bar the last command from a saved command history. +.Sp +It can also display the parent inheritance tree of a given class, with the +\&\f(CW\*(C`i\*(C'\fR command. +.IP "ptar" 4 +.IX Item "ptar" +\&\f(CW\*(C`ptar\*(C'\fR is a pure perl implementation of \f(CW\*(C`tar\*(C'\fR that comes with +\&\f(CW\*(C`Archive::Tar\*(C'\fR. +.IP "ptardiff" 4 +.IX Item "ptardiff" +\&\f(CW\*(C`ptardiff\*(C'\fR is a small utility used to generate a diff between the contents +of a tar archive and a directory tree. Like \f(CW\*(C`ptar\*(C'\fR, it comes with +\&\f(CW\*(C`Archive::Tar\*(C'\fR. +.IP "shasum" 4 +.IX Item "shasum" +\&\f(CW\*(C`shasum\*(C'\fR is a command-line utility, used to print or to check \s-1SHA\s0 +digests. It comes with the new \f(CW\*(C`Digest::SHA\*(C'\fR module. +.IP "corelist" 4 +.IX Item "corelist" +The \f(CW\*(C`corelist\*(C'\fR utility is now installed with perl (see \*(L"New modules\*(R" +above). +.IP "h2ph and h2xs" 4 +.IX Item "h2ph and h2xs" +\&\f(CW\*(C`h2ph\*(C'\fR and \f(CW\*(C`h2xs\*(C'\fR have been made more robust with regard to +\&\*(L"modern\*(R" C code. +.Sp +\&\f(CW\*(C`h2xs\*(C'\fR implements a new option \f(CW\*(C`\-\-use\-xsloader\*(C'\fR to force use of +\&\f(CW\*(C`XSLoader\*(C'\fR even in backwards compatible modules. +.Sp +The handling of authors' names that had apostrophes has been fixed. +.Sp +Any enums with negative values are now skipped. +.IP "perlivp" 4 +.IX Item "perlivp" +\&\f(CW\*(C`perlivp\*(C'\fR no longer checks for \fI*.ph\fR files by default. Use the new \f(CW\*(C`\-a\*(C'\fR +option to run \fIall\fR tests. +.IP "find2perl" 4 +.IX Item "find2perl" +\&\f(CW\*(C`find2perl\*(C'\fR now assumes \f(CW\*(C`\-print\*(C'\fR as a default action. Previously, it +needed to be specified explicitly. +.Sp +Several bugs have been fixed in \f(CW\*(C`find2perl\*(C'\fR, regarding \f(CW\*(C`\-exec\*(C'\fR and +\&\f(CW\*(C`\-eval\*(C'\fR. Also the options \f(CW\*(C`\-path\*(C'\fR, \f(CW\*(C`\-ipath\*(C'\fR and \f(CW\*(C`\-iname\*(C'\fR have been +added. +.IP "config_data" 4 +.IX Item "config_data" +\&\f(CW\*(C`config_data\*(C'\fR is a new utility that comes with \f(CW\*(C`Module::Build\*(C'\fR. It +provides a command-line interface to the configuration of Perl modules +that use Module::Build's framework of configurability (that is, +\&\f(CW*::ConfigData\fR modules that contain local configuration information for +their parent modules.) +.IP "cpanp" 4 +.IX Item "cpanp" +\&\f(CW\*(C`cpanp\*(C'\fR, the \s-1CPANPLUS\s0 shell, has been added. (\f(CW\*(C`cpanp\-run\-perl\*(C'\fR, a +helper for \s-1CPANPLUS\s0 operation, has been added too, but isn't intended for +direct use). +.IP "cpan2dist" 4 +.IX Item "cpan2dist" +\&\f(CW\*(C`cpan2dist\*(C'\fR is a new utility that comes with \s-1CPANPLUS.\s0 It's a tool to +create distributions (or packages) from \s-1CPAN\s0 modules. +.IP "pod2html" 4 +.IX Item "pod2html" +The output of \f(CW\*(C`pod2html\*(C'\fR has been enhanced to be more customizable via +\&\s-1CSS.\s0 Some formatting problems were also corrected. (Jari Aalto) +.SH "New Documentation" +.IX Header "New Documentation" +The perlpragma manpage documents how to write one's own lexical +pragmas in pure Perl (something that is possible starting with 5.9.4). +.PP +The new perlglossary manpage is a glossary of terms used in the Perl +documentation, technical and otherwise, kindly provided by O'Reilly Media, +Inc. +.PP +The perlreguts manpage, courtesy of Yves Orton, describes internals of the +Perl regular expression engine. +.PP +The perlreapi manpage describes the interface to the perl interpreter +used to write pluggable regular expression engines (by \*(Aevar Arnfjo\*:r\*(d- +Bjarmason). +.PP +The perlunitut manpage is a tutorial for programming with Unicode and +string encodings in Perl, courtesy of Juerd Waalboer. +.PP +A new manual page, perlunifaq (the Perl Unicode \s-1FAQ\s0), has been added +(Juerd Waalboer). +.PP +The perlcommunity manpage gives a description of the Perl community +on the Internet and in real life. (Edgar \*(L"Trizor\*(R" Bering) +.PP +The \s-1CORE\s0 manual page documents the \f(CW\*(C`CORE::\*(C'\fR namespace. (Tels) +.PP +The long-existing feature of \f(CW\*(C`/(?{...})/\*(C'\fR regexps setting \f(CW$_\fR and \fBpos()\fR +is now documented. +.SH "Performance Enhancements" +.IX Header "Performance Enhancements" +.SS "In-place sorting" +.IX Subsection "In-place sorting" +Sorting arrays in place (\f(CW\*(C`@a = sort @a\*(C'\fR) is now optimized to avoid +making a temporary copy of the array. +.PP +Likewise, \f(CW\*(C`reverse sort ...\*(C'\fR is now optimized to sort in reverse, +avoiding the generation of a temporary intermediate list. +.SS "Lexical array access" +.IX Subsection "Lexical array access" +Access to elements of lexical arrays via a numeric constant between 0 and +255 is now faster. (This used to be only the case for global arrays.) +.SS "XS-assisted \s-1SWASHGET\s0" +.IX Subsection "XS-assisted SWASHGET" +Some pure-perl code that perl was using to retrieve Unicode properties and +transliteration mappings has been reimplemented in \s-1XS.\s0 +.SS "Constant subroutines" +.IX Subsection "Constant subroutines" +The interpreter internals now support a far more memory efficient form of +inlineable constants. Storing a reference to a constant value in a symbol +table is equivalent to a full typeglob referencing a constant subroutine, +but using about 400 bytes less memory. This proxy constant subroutine is +automatically upgraded to a real typeglob with subroutine if necessary. +The approach taken is analogous to the existing space optimisation for +subroutine stub declarations, which are stored as plain scalars in place +of the full typeglob. +.PP +Several of the core modules have been converted to use this feature for +their system dependent constants \- as a result \f(CW\*(C`use POSIX;\*(C'\fR now takes about +200K less memory. +.ie n .SS """PERL_DONT_CREATE_GVSV""" +.el .SS "\f(CWPERL_DONT_CREATE_GVSV\fP" +.IX Subsection "PERL_DONT_CREATE_GVSV" +The new compilation flag \f(CW\*(C`PERL_DONT_CREATE_GVSV\*(C'\fR, introduced as an option +in perl 5.8.8, is turned on by default in perl 5.9.3. It prevents perl +from creating an empty scalar with every new typeglob. See perl589delta +for details. +.SS "Weak references are cheaper" +.IX Subsection "Weak references are cheaper" +Weak reference creation is now \fIO(1)\fR rather than \fIO(n)\fR, courtesy of +Nicholas Clark. Weak reference deletion remains \fIO(n)\fR, but if deletion only +happens at program exit, it may be skipped completely. +.SS "\fBsort()\fP enhancements" +.IX Subsection "sort() enhancements" +Salvador Fandin\*~o provided improvements to reduce the memory usage of \f(CW\*(C`sort\*(C'\fR +and to speed up some cases. +.SS "Memory optimisations" +.IX Subsection "Memory optimisations" +Several internal data structures (typeglobs, GVs, CVs, formats) have been +restructured to use less memory. (Nicholas Clark) +.SS "\s-1UTF\-8\s0 cache optimisation" +.IX Subsection "UTF-8 cache optimisation" +The \s-1UTF\-8\s0 caching code is now more efficient, and used more often. +(Nicholas Clark) +.SS "Sloppy stat on Windows" +.IX Subsection "Sloppy stat on Windows" +On Windows, perl's \fBstat()\fR function normally opens the file to determine +the link count and update attributes that may have been changed through +hard links. Setting ${^WIN32_SLOPPY_STAT} to a true value speeds up +\&\fBstat()\fR by not performing this operation. (Jan Dubois) +.SS "Regular expressions optimisations" +.IX Subsection "Regular expressions optimisations" +.IP "Engine de-recursivised" 4 +.IX Item "Engine de-recursivised" +The regular expression engine is no longer recursive, meaning that +patterns that used to overflow the stack will either die with useful +explanations, or run to completion, which, since they were able to blow +the stack before, will likely take a very long time to happen. If you were +experiencing the occasional stack overflow (or segfault) and upgrade to +discover that now perl apparently hangs instead, look for a degenerate +regex. (Dave Mitchell) +.IP "Single char char-classes treated as literals" 4 +.IX Item "Single char char-classes treated as literals" +Classes of a single character are now treated the same as if the character +had been used as a literal, meaning that code that uses char-classes as an +escaping mechanism will see a speedup. (Yves Orton) +.IP "Trie optimisation of literal string alternations" 4 +.IX Item "Trie optimisation of literal string alternations" +Alternations, where possible, are optimised into more efficient matching +structures. String literal alternations are merged into a trie and are +matched simultaneously. This means that instead of O(N) time for matching +N alternations at a given point, the new code performs in O(1) time. +A new special variable, ${^RE_TRIE_MAXBUF}, has been added to fine-tune +this optimization. (Yves Orton) +.Sp +\&\fBNote:\fR Much code exists that works around perl's historic poor +performance on alternations. Often the tricks used to do so will disable +the new optimisations. Hopefully the utility modules used for this purpose +will be educated about these new optimisations. +.IP "Aho-Corasick start-point optimisation" 4 +.IX Item "Aho-Corasick start-point optimisation" +When a pattern starts with a trie-able alternation and there aren't +better optimisations available, the regex engine will use Aho-Corasick +matching to find the start point. (Yves Orton) +.SH "Installation and Configuration Improvements" +.IX Header "Installation and Configuration Improvements" +.SS "Configuration improvements" +.IX Subsection "Configuration improvements" +.ie n .IP """\-Dusesitecustomize""" 4 +.el .IP "\f(CW\-Dusesitecustomize\fR" 4 +.IX Item "-Dusesitecustomize" +Run-time customization of \f(CW@INC\fR can be enabled by passing the +\&\f(CW\*(C`\-Dusesitecustomize\*(C'\fR flag to Configure. When enabled, this will make perl +run \fI\f(CI$sitelibexp\fI/sitecustomize.pl\fR before anything else. This script can +then be set up to add additional entries to \f(CW@INC\fR. +.IP "Relocatable installations" 4 +.IX Item "Relocatable installations" +There is now Configure support for creating a relocatable perl tree. If +you Configure with \f(CW\*(C`\-Duserelocatableinc\*(C'\fR, then the paths in \f(CW@INC\fR (and +everything else in \f(CW%Config\fR) can be optionally located via the path of the +perl executable. +.Sp +That means that, if the string \f(CW".../"\fR is found at the start of any +path, it's substituted with the directory of $^X. So, the relocation can +be configured on a per-directory basis, although the default with +\&\f(CW\*(C`\-Duserelocatableinc\*(C'\fR is that everything is relocated. The initial +install is done to the original configured prefix. +.IP "\fBstrlcat()\fR and \fBstrlcpy()\fR" 4 +.IX Item "strlcat() and strlcpy()" +The configuration process now detects whether \fBstrlcat()\fR and \fBstrlcpy()\fR are +available. When they are not available, perl's own version is used (from +Russ Allbery's public domain implementation). Various places in the perl +interpreter now use them. (Steve Peters) +.ie n .IP """d_pseudofork"" and ""d_printf_format_null""" 4 +.el .IP "\f(CWd_pseudofork\fR and \f(CWd_printf_format_null\fR" 4 +.IX Item "d_pseudofork and d_printf_format_null" +A new configuration variable, available as \f(CW$Config{d_pseudofork}\fR in +the Config module, has been added, to distinguish real \fBfork()\fR support +from fake pseudofork used on Windows platforms. +.Sp +A new configuration variable, \f(CW\*(C`d_printf_format_null\*(C'\fR, has been added, +to see if printf-like formats are allowed to be \s-1NULL.\s0 +.IP "Configure help" 4 +.IX Item "Configure help" +\&\f(CW\*(C`Configure \-h\*(C'\fR has been extended with the most commonly used options. +.SS "Compilation improvements" +.IX Subsection "Compilation improvements" +.IP "Parallel build" 4 +.IX Item "Parallel build" +Parallel makes should work properly now, although there may still be problems +if \f(CW\*(C`make test\*(C'\fR is instructed to run in parallel. +.IP "Borland's compilers support" 4 +.IX Item "Borland's compilers support" +Building with Borland's compilers on Win32 should work more smoothly. In +particular Steve Hay has worked to side step many warnings emitted by their +compilers and at least one C compiler internal error. +.IP "Static build on Windows" 4 +.IX Item "Static build on Windows" +Perl extensions on Windows now can be statically built into the Perl \s-1DLL.\s0 +.Sp +Also, it's now possible to build a \f(CW\*(C`perl\-static.exe\*(C'\fR that doesn't depend +on the Perl \s-1DLL\s0 on Win32. See the Win32 makefiles for details. +(Vadim Konovalov) +.IP "ppport.h files" 4 +.IX Item "ppport.h files" +All \fIppport.h\fR files in the \s-1XS\s0 modules bundled with perl are now +autogenerated at build time. (Marcus Holland-Moritz) +.IP "\*(C+ compatibility" 4 +.IX Item " compatibility" +Efforts have been made to make perl and the core \s-1XS\s0 modules compilable +with various \*(C+ compilers (although the situation is not perfect with +some of the compilers on some of the platforms tested.) +.IP "Support for Microsoft 64\-bit compiler" 4 +.IX Item "Support for Microsoft 64-bit compiler" +Support for building perl with Microsoft's 64\-bit compiler has been +improved. (ActiveState) +.IP "Visual \*(C+" 4 +.IX Item "Visual " +Perl can now be compiled with Microsoft Visual \*(C+ 2005 (and 2008 Beta 2). +.IP "Win32 builds" 4 +.IX Item "Win32 builds" +All win32 builds (MS-Win, WinCE) have been merged and cleaned up. +.SS "Installation improvements" +.IX Subsection "Installation improvements" +.IP "Module auxiliary files" 4 +.IX Item "Module auxiliary files" +\&\s-1README\s0 files and changelogs for \s-1CPAN\s0 modules bundled with perl are no +longer installed. +.SS "New Or Improved Platforms" +.IX Subsection "New Or Improved Platforms" +Perl has been reported to work on Symbian \s-1OS.\s0 See perlsymbian for more +information. +.PP +Many improvements have been made towards making Perl work correctly on +z/OS. +.PP +Perl has been reported to work on DragonFlyBSD and MidnightBSD. +.PP +Perl has also been reported to work on NexentaOS +( http://www.gnusolaris.org/ ). +.PP +The \s-1VMS\s0 port has been improved. See perlvms. +.PP +Support for Cray \s-1XT4\s0 Catamount/Qk has been added. See +\&\fIhints/catamount.sh\fR in the source code distribution for more +information. +.PP +Vendor patches have been merged for RedHat and Gentoo. +.PP +\&\fBDynaLoader::dl_unload_file()\fR now works on Windows. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "strictures in regexp-eval blocks" 4 +.IX Item "strictures in regexp-eval blocks" +\&\f(CW\*(C`strict\*(C'\fR wasn't in effect in regexp-eval blocks (\f(CW\*(C`/(?{...})/\*(C'\fR). +.IP "Calling \fBCORE::require()\fR" 4 +.IX Item "Calling CORE::require()" +\&\fBCORE::require()\fR and \fBCORE::do()\fR were always parsed as \fBrequire()\fR and \fBdo()\fR +when they were overridden. This is now fixed. +.IP "Subscripts of slices" 4 +.IX Item "Subscripts of slices" +You can now use a non-arrowed form for chained subscripts after a list +slice, like in: +.Sp +.Vb 1 +\& ({foo => "bar"})[0]{foo} +.Ve +.Sp +This used to be a syntax error; a \f(CW\*(C`\->\*(C'\fR was required. +.ie n .IP """no warnings \*(Aqcategory\*(Aq"" works correctly with \-w" 4 +.el .IP "\f(CWno warnings \*(Aqcategory\*(Aq\fR works correctly with \-w" 4 +.IX Item "no warnings category works correctly with -w" +Previously when running with warnings enabled globally via \f(CW\*(C`\-w\*(C'\fR, selective +disabling of specific warning categories would actually turn off all warnings. +This is now fixed; now \f(CW\*(C`no warnings \*(Aqio\*(Aq;\*(C'\fR will only turn off warnings in the +\&\f(CW\*(C`io\*(C'\fR class. Previously it would erroneously turn off all warnings. +.IP "threads improvements" 4 +.IX Item "threads improvements" +Several memory leaks in ithreads were closed. Also, ithreads were made +less memory-intensive. +.Sp +\&\f(CW\*(C`threads\*(C'\fR is now a dual-life module, also available on \s-1CPAN.\s0 It has been +expanded in many ways. A \fBkill()\fR method is available for thread signalling. +One can get thread status, or the list of running or joinable threads. +.Sp +A new \f(CW\*(C`threads\->exit()\*(C'\fR method is used to exit from the application +(this is the default for the main thread) or from the current thread only +(this is the default for all other threads). On the other hand, the \fBexit()\fR +built-in now always causes the whole application to terminate. (Jerry +D. Hedden) +.IP "\fBchr()\fR and negative values" 4 +.IX Item "chr() and negative values" +\&\fBchr()\fR on a negative value now gives \f(CW\*(C`\ex{FFFD}\*(C'\fR, the Unicode replacement +character, unless when the \f(CW\*(C`bytes\*(C'\fR pragma is in effect, where the low +eight bits of the value are used. +.IP "\s-1PERL5SHELL\s0 and tainting" 4 +.IX Item "PERL5SHELL and tainting" +On Windows, the \s-1PERL5SHELL\s0 environment variable is now checked for +taintedness. (Rafael Garcia-Suarez) +.IP "Using *FILE{\s-1IO\s0}" 4 +.IX Item "Using *FILE{IO}" +\&\f(CW\*(C`stat()\*(C'\fR and \f(CW\*(C`\-X\*(C'\fR filetests now treat *FILE{\s-1IO\s0} filehandles like *FILE +filehandles. (Steve Peters) +.IP "Overloading and reblessing" 4 +.IX Item "Overloading and reblessing" +Overloading now works when references are reblessed into another class. +Internally, this has been implemented by moving the flag for \*(L"overloading\*(R" +from the reference to the referent, which logically is where it should +always have been. (Nicholas Clark) +.IP "Overloading and \s-1UTF\-8\s0" 4 +.IX Item "Overloading and UTF-8" +A few bugs related to \s-1UTF\-8\s0 handling with objects that have +stringification overloaded have been fixed. (Nicholas Clark) +.IP "eval memory leaks fixed" 4 +.IX Item "eval memory leaks fixed" +Traditionally, \f(CW\*(C`eval \*(Aqsyntax error\*(Aq\*(C'\fR has leaked badly. Many (but not all) +of these leaks have now been eliminated or reduced. (Dave Mitchell) +.IP "Random device on Windows" 4 +.IX Item "Random device on Windows" +In previous versions, perl would read the file \fI/dev/urandom\fR if it +existed when seeding its random number generator. That file is unlikely +to exist on Windows, and if it did would probably not contain appropriate +data, so perl no longer tries to read it on Windows. (Alex Davies) +.IP "\s-1PERLIO_DEBUG\s0" 4 +.IX Item "PERLIO_DEBUG" +The \f(CW\*(C`PERLIO_DEBUG\*(C'\fR environment variable no longer has any effect for +setuid scripts and for scripts run with \fB\-T\fR. +.Sp +Moreover, with a thread-enabled perl, using \f(CW\*(C`PERLIO_DEBUG\*(C'\fR could lead to +an internal buffer overflow. This has been fixed. +.IP "PerlIO::scalar and read-only scalars" 4 +.IX Item "PerlIO::scalar and read-only scalars" +PerlIO::scalar will now prevent writing to read-only scalars. Moreover, +\&\fBseek()\fR is now supported with PerlIO::scalar\-based filehandles, the +underlying string being zero-filled as needed. (Rafael, Jarkko Hietaniemi) +.IP "\fBstudy()\fR and \s-1UTF\-8\s0" 4 +.IX Item "study() and UTF-8" +\&\fBstudy()\fR never worked for \s-1UTF\-8\s0 strings, but could lead to false results. +It's now a no-op on \s-1UTF\-8\s0 data. (Yves Orton) +.IP "Critical signals" 4 +.IX Item "Critical signals" +The signals \s-1SIGILL, SIGBUS\s0 and \s-1SIGSEGV\s0 are now always delivered in an +\&\*(L"unsafe\*(R" manner (contrary to other signals, that are deferred until the +perl interpreter reaches a reasonably stable state; see +\&\*(L"Deferred Signals (Safe Signals)\*(R" in perlipc). (Rafael) +.ie n .IP "@INC\-hook fix" 4 +.el .IP "\f(CW@INC\fR\-hook fix" 4 +.IX Item "@INC-hook fix" +When a module or a file is loaded through an \f(CW@INC\fR\-hook, and when this hook +has set a filename entry in \f(CW%INC\fR, _\|_FILE_\|_ is now set for this module +accordingly to the contents of that \f(CW%INC\fR entry. (Rafael) +.ie n .IP """\-t"" switch fix" 4 +.el .IP "\f(CW\-t\fR switch fix" 4 +.IX Item "-t switch fix" +The \f(CW\*(C`\-w\*(C'\fR and \f(CW\*(C`\-t\*(C'\fR switches can now be used together without messing +up which categories of warnings are activated. (Rafael) +.IP "Duping \s-1UTF\-8\s0 filehandles" 4 +.IX Item "Duping UTF-8 filehandles" +Duping a filehandle which has the \f(CW\*(C`:utf8\*(C'\fR PerlIO layer set will now +properly carry that layer on the duped filehandle. (Rafael) +.IP "Localisation of hash elements" 4 +.IX Item "Localisation of hash elements" +Localizing a hash element whose key was given as a variable didn't work +correctly if the variable was changed while the \fBlocal()\fR was in effect (as +in \f(CW\*(C`local $h{$x}; ++$x\*(C'\fR). (Bo Lindbergh) +.SH "New or Changed Diagnostics" +.IX Header "New or Changed Diagnostics" +.IP "Use of uninitialized value" 4 +.IX Item "Use of uninitialized value" +Perl will now try to tell you the name of the variable (if any) that was +undefined. +.IP "Deprecated use of \fBmy()\fR in false conditional" 4 +.IX Item "Deprecated use of my() in false conditional" +A new deprecation warning, \fIDeprecated use of \f(BImy()\fI in false conditional\fR, +has been added, to warn against the use of the dubious and deprecated +construct +.Sp +.Vb 1 +\& my $x if 0; +.Ve +.Sp +See perldiag. Use \f(CW\*(C`state\*(C'\fR variables instead. +.IP "!=~ should be !~" 4 +.IX Item "!=~ should be !~" +A new warning, \f(CW\*(C`!=~ should be !~\*(C'\fR, is emitted to prevent this misspelling +of the non-matching operator. +.IP "Newline in left-justified string" 4 +.IX Item "Newline in left-justified string" +The warning \fINewline in left-justified string\fR has been removed. +.ie n .IP "Too late for ""\-T"" option" 4 +.el .IP "Too late for ``\-T'' option" 4 +.IX Item "Too late for -T option" +The error \fIToo late for \*(L"\-T\*(R" option\fR has been reformulated to be more +descriptive. +.ie n .IP """%s"" variable %s masks earlier declaration" 4 +.el .IP "``%s'' variable \f(CW%s\fR masks earlier declaration" 4 +.IX Item "%s variable %s masks earlier declaration" +This warning is now emitted in more consistent cases; in short, when one +of the declarations involved is a \f(CW\*(C`my\*(C'\fR variable: +.Sp +.Vb 3 +\& my $x; my $x; # warns +\& my $x; our $x; # warns +\& our $x; my $x; # warns +.Ve +.Sp +On the other hand, the following: +.Sp +.Vb 1 +\& our $x; our $x; +.Ve +.Sp +now gives a \f(CW\*(C`"our" variable %s redeclared\*(C'\fR warning. +.IP "\fBreaddir()\fR/\fBclosedir()\fR/etc. attempted on invalid dirhandle" 4 +.IX Item "readdir()/closedir()/etc. attempted on invalid dirhandle" +These new warnings are now emitted when a dirhandle is used but is +either closed or not really a dirhandle. +.ie n .IP "Opening dirhandle/filehandle %s also as a file/directory" 4 +.el .IP "Opening dirhandle/filehandle \f(CW%s\fR also as a file/directory" 4 +.IX Item "Opening dirhandle/filehandle %s also as a file/directory" +Two deprecation warnings have been added: (Rafael) +.Sp +.Vb 2 +\& Opening dirhandle %s also as a file +\& Opening filehandle %s also as a directory +.Ve +.IP "Use of \-P is deprecated" 4 +.IX Item "Use of -P is deprecated" +Perl's command-line switch \f(CW\*(C`\-P\*(C'\fR is now deprecated. +.IP "v\-string in use/require is non-portable" 4 +.IX Item "v-string in use/require is non-portable" +Perl will warn you against potential backwards compatibility problems with +the \f(CW\*(C`use VERSION\*(C'\fR syntax. +.IP "perl \-V" 4 +.IX Item "perl -V" +\&\f(CW\*(C`perl \-V\*(C'\fR has several improvements, making it more useable from shell +scripts to get the value of configuration variables. See perlrun for +details. +.SH "Changed Internals" +.IX Header "Changed Internals" +In general, the source code of perl has been refactored, tidied up, +and optimized in many places. Also, memory management and allocation +has been improved in several points. +.PP +When compiling the perl core with gcc, as many gcc warning flags are +turned on as is possible on the platform. (This quest for cleanliness +doesn't extend to \s-1XS\s0 code because we cannot guarantee the tidiness of +code we didn't write.) Similar strictness flags have been added or +tightened for various other C compilers. +.SS "Reordering of SVt_* constants" +.IX Subsection "Reordering of SVt_* constants" +The relative ordering of constants that define the various types of \f(CW\*(C`SV\*(C'\fR +have changed; in particular, \f(CW\*(C`SVt_PVGV\*(C'\fR has been moved before \f(CW\*(C`SVt_PVLV\*(C'\fR, +\&\f(CW\*(C`SVt_PVAV\*(C'\fR, \f(CW\*(C`SVt_PVHV\*(C'\fR and \f(CW\*(C`SVt_PVCV\*(C'\fR. This is unlikely to make any +difference unless you have code that explicitly makes assumptions about that +ordering. (The inheritance hierarchy of \f(CW\*(C`B::*\*(C'\fR objects has been changed +to reflect this.) +.SS "Elimination of SVt_PVBM" +.IX Subsection "Elimination of SVt_PVBM" +Related to this, the internal type \f(CW\*(C`SVt_PVBM\*(C'\fR has been removed. This +dedicated type of \f(CW\*(C`SV\*(C'\fR was used by the \f(CW\*(C`index\*(C'\fR operator and parts of the +regexp engine to facilitate fast Boyer-Moore matches. Its use internally has +been replaced by \f(CW\*(C`SV\*(C'\fRs of type \f(CW\*(C`SVt_PVGV\*(C'\fR. +.SS "New type SVt_BIND" +.IX Subsection "New type SVt_BIND" +A new type \f(CW\*(C`SVt_BIND\*(C'\fR has been added, in readiness for the project to +implement Perl 6 on 5. There deliberately is no implementation yet, and +they cannot yet be created or destroyed. +.SS "Removal of \s-1CPP\s0 symbols" +.IX Subsection "Removal of CPP symbols" +The C preprocessor symbols \f(CW\*(C`PERL_PM_APIVERSION\*(C'\fR and +\&\f(CW\*(C`PERL_XS_APIVERSION\*(C'\fR, which were supposed to give the version number of +the oldest perl binary-compatible (resp. source-compatible) with the +present one, were not used, and sometimes had misleading values. They have +been removed. +.SS "Less space is used by ops" +.IX Subsection "Less space is used by ops" +The \f(CW\*(C`BASEOP\*(C'\fR structure now uses less space. The \f(CW\*(C`op_seq\*(C'\fR field has been +removed and replaced by a single bit bit-field \f(CW\*(C`op_opt\*(C'\fR. \f(CW\*(C`op_type\*(C'\fR is now 9 +bits long. (Consequently, the \f(CW\*(C`B::OP\*(C'\fR class doesn't provide an \f(CW\*(C`seq\*(C'\fR +method anymore.) +.SS "New parser" +.IX Subsection "New parser" +perl's parser is now generated by bison (it used to be generated by +byacc.) As a result, it seems to be a bit more robust. +.PP +Also, Dave Mitchell improved the lexer debugging output under \f(CW\*(C`\-DT\*(C'\fR. +.ie n .SS "Use of ""const""" +.el .SS "Use of \f(CWconst\fP" +.IX Subsection "Use of const" +Andy Lester supplied many improvements to determine which function +parameters and local variables could actually be declared \f(CW\*(C`const\*(C'\fR to the C +compiler. Steve Peters provided new \f(CW*_set\fR macros and reworked the core to +use these rather than assigning to macros in \s-1LVALUE\s0 context. +.SS "Mathoms" +.IX Subsection "Mathoms" +A new file, \fImathoms.c\fR, has been added. It contains functions that are +no longer used in the perl core, but that remain available for binary or +source compatibility reasons. However, those functions will not be +compiled in if you add \f(CW\*(C`\-DNO_MATHOMS\*(C'\fR in the compiler flags. +.ie n .SS """AvFLAGS"" has been removed" +.el .SS "\f(CWAvFLAGS\fP has been removed" +.IX Subsection "AvFLAGS has been removed" +The \f(CW\*(C`AvFLAGS\*(C'\fR macro has been removed. +.ie n .SS """av_*"" changes" +.el .SS "\f(CWav_*\fP changes" +.IX Subsection "av_* changes" +The \f(CW\*(C`av_*()\*(C'\fR functions, used to manipulate arrays, no longer accept null +\&\f(CW\*(C`AV*\*(C'\fR parameters. +.SS "$^H and %^H" +.IX Subsection "$^H and %^H" +The implementation of the special variables $^H and %^H has changed, to +allow implementing lexical pragmas in pure Perl. +.SS "B:: modules inheritance changed" +.IX Subsection "B:: modules inheritance changed" +The inheritance hierarchy of \f(CW\*(C`B::\*(C'\fR modules has changed; \f(CW\*(C`B::NV\*(C'\fR now +inherits from \f(CW\*(C`B::SV\*(C'\fR (it used to inherit from \f(CW\*(C`B::IV\*(C'\fR). +.SS "Anonymous hash and array constructors" +.IX Subsection "Anonymous hash and array constructors" +The anonymous hash and array constructors now take 1 op in the optree +instead of 3, now that pp_anonhash and pp_anonlist return a reference to +a hash/array when the op is flagged with OPf_SPECIAL. (Nicholas Clark) +.SH "Known Problems" +.IX Header "Known Problems" +There's still a remaining problem in the implementation of the lexical +\&\f(CW$_\fR: it doesn't work inside \f(CW\*(C`/(?{...})/\*(C'\fR blocks. (See the \s-1TODO\s0 test in +\&\fIt/op/mydef.t\fR.) +.PP +Stacked filetest operators won't work when the \f(CW\*(C`filetest\*(C'\fR pragma is in +effect, because they rely on the \fBstat()\fR buffer \f(CW\*(C`_\*(C'\fR being populated, and +filetest bypasses \fBstat()\fR. +.SS "\s-1UTF\-8\s0 problems" +.IX Subsection "UTF-8 problems" +The handling of Unicode still is unclean in several places, where it's +dependent on whether a string is internally flagged as \s-1UTF\-8.\s0 This will +be made more consistent in perl 5.12, but that won't be possible without +a certain amount of backwards incompatibility. +.SH "Platform Specific Problems" +.IX Header "Platform Specific Problems" +When compiled with g++ and thread support on Linux, it's reported that the +\&\f(CW$!\fR stops working correctly. This is related to the fact that the glibc +provides two \fBstrerror_r\fR\|(3) implementation, and perl selects the wrong +one. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://rt.perl.org/rt3/ . There may also be +information at http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the \fBperlbug\fR +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file and the perl590delta to perl595delta man pages for +exhaustive details on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5123delta.1 b/data/miniconda3/man/man1/perl5123delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..dfb122e9da4d893b64b49035c31e821c02bdb3de --- /dev/null +++ b/data/miniconda3/man/man1/perl5123delta.1 @@ -0,0 +1,244 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5123DELTA 1" +.TH PERL5123DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5123delta \- what is new for perl v5.12.3 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.12.2 release and +the 5.12.3 release. +.PP +If you are upgrading from an earlier release such as 5.12.1, first read +perl5122delta, which describes differences between 5.12.1 and +5.12.2. The major changes made in 5.12.0 are described in perl5120delta. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +.Vb 2 +\& There are no changes intentionally incompatible with 5.12.2. If any +\& exist, they are bugs and reports are welcome. +.Ve +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.ie n .SS """keys"", ""values"" work on arrays" +.el .SS "\f(CWkeys\fP, \f(CWvalues\fP work on arrays" +.IX Subsection "keys, values work on arrays" +You can now use the \f(CW\*(C`keys\*(C'\fR, \f(CW\*(C`values\*(C'\fR, \f(CW\*(C`each\*(C'\fR builtin functions on arrays +(previously you could only use them on hashes). See perlfunc for details. +This is actually a change introduced in perl 5.12.0, but it was missed from +that release's perldelta. +.SH "Bug Fixes" +.IX Header "Bug Fixes" +\&\*(L"no \s-1VERSION\*(R"\s0 will now correctly deparse with B::Deparse, as will certain +constant expressions. +.PP +Module::Build should be more reliably pass its tests under cygwin. +.PP +Lvalue subroutines are again able to return copy-on-write scalars. This +had been broken since version 5.10.0. +.SH "Platform Specific Notes" +.IX Header "Platform Specific Notes" +.IP "Solaris" 4 +.IX Item "Solaris" +A separate DTrace is now build for miniperl, which means that perl can be +compiled with \-Dusedtrace on Solaris again. +.IP "\s-1VMS\s0" 4 +.IX Item "VMS" +A number of regressions on \s-1VMS\s0 have been fixed. In addition to minor cleanup +of questionable expressions in \fIvms.c\fR, file permissions should no longer be +garbled by the PerlIO layer, and spurious record boundaries should no longer be +introduced by the PerlIO layer during output. +.Sp +For more details and discussion on the latter, see: +.Sp +.Vb 1 +\& http://www.nntp.perl.org/group/perl.vmsperl/2010/11/msg15419.html +.Ve +.IP "\s-1VOS\s0" 4 +.IX Item "VOS" +A few very small changes were made to the build process on \s-1VOS\s0 to better +support the platform. Longer\-than\-32\-character filenames are now supported on +OpenVOS, and build properly without IPv6 support. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.12.3 represents approximately four months of development since +Perl 5.12.2 and contains approximately 2500 lines of changes across +54 files from 16 authors. +.PP +Perl continues to flourish into its third decade thanks to a vibrant +community of users and developers. The following people are known to +have contributed the improvements that became Perl 5.12.3: +.PP +Craig A. Berry, David Golden, David Leadbeater, Father Chrysostomos, Florian +Ragwitz, Jesse Vincent, Karl Williamson, Nick Johnston, Nicolas Kaiser, Paul +Green, Rafael Garcia-Suarez, Rainer Tammer, Ricardo Signes, Steffen Mueller, +Zsba\*'n Ambrus, \*(Aevar Arnfjo\*:r\*(d- Bjarmason +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://rt.perl.org/perlbug/ . There may also be +information at http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the \fBperlbug\fR +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send +it to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes +all the core committers, who will be able +to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for +security issues in the Perl core, not for modules independently +distributed on \s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details +on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5125delta.1 b/data/miniconda3/man/man1/perl5125delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..b1863d0ba8615d78f8caba1125ffa01018c4b2e3 --- /dev/null +++ b/data/miniconda3/man/man1/perl5125delta.1 @@ -0,0 +1,344 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5125DELTA 1" +.TH PERL5125DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5125delta \- what is new for perl v5.12.5 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.12.4 release and +the 5.12.5 release. +.PP +If you are upgrading from an earlier release such as 5.12.3, first read +perl5124delta, which describes differences between 5.12.3 and +5.12.4. +.SH "Security" +.IX Header "Security" +.ie n .SS """Encode"" decode_xs n\-byte heap-overflow (\s-1CVE\-2011\-2939\s0)" +.el .SS "\f(CWEncode\fP decode_xs n\-byte heap-overflow (\s-1CVE\-2011\-2939\s0)" +.IX Subsection "Encode decode_xs n-byte heap-overflow (CVE-2011-2939)" +A bug in \f(CW\*(C`Encode\*(C'\fR could, on certain inputs, cause the heap to overflow. +This problem has been corrected. Bug reported by Robert Zacek. +.ie n .SS """File::Glob::bsd_glob()"" memory error with \s-1GLOB_ALTDIRFUNC\s0 (\s-1CVE\-2011\-2728\s0)." +.el .SS "\f(CWFile::Glob::bsd_glob()\fP memory error with \s-1GLOB_ALTDIRFUNC\s0 (\s-1CVE\-2011\-2728\s0)." +.IX Subsection "File::Glob::bsd_glob() memory error with GLOB_ALTDIRFUNC (CVE-2011-2728)." +Calling \f(CW\*(C`File::Glob::bsd_glob\*(C'\fR with the unsupported flag \s-1GLOB_ALTDIRFUNC\s0 would +cause an access violation / segfault. A Perl program that accepts a flags value from +an external source could expose itself to denial of service or arbitrary code +execution attacks. There are no known exploits in the wild. The problem has been +corrected by explicitly disabling all unsupported flags and setting unused function +pointers to null. Bug reported by Cle\*'ment Lecigne. +.SS "Heap buffer overrun in 'x' string repeat operator (\s-1CVE\-2012\-5195\s0)" +.IX Subsection "Heap buffer overrun in 'x' string repeat operator (CVE-2012-5195)" +Poorly written perl code that allows an attacker to specify the count to +perl's 'x' string repeat operator can already cause a memory exhaustion +denial-of-service attack. A flaw in versions of perl before 5.15.5 can +escalate that into a heap buffer overrun; coupled with versions of glibc +before 2.16, it possibly allows the execution of arbitrary code. +.PP +This problem has been fixed. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +There are no changes intentionally incompatible with 5.12.4. If any +exist, they are bugs and reports are welcome. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules" +.IX Subsection "Updated Modules" +\fIB::Concise\fR +.IX Subsection "B::Concise" +.PP +B::Concise no longer produces mangled output with the \fB\-tree\fR option +[perl #80632]. +.PP +\fIcharnames\fR +.IX Subsection "charnames" +.PP +A regression introduced in Perl 5.8.8 has been fixed, that caused +\&\f(CWcharnames::viacode(0)\fR to return \f(CW\*(C`undef\*(C'\fR instead of the string \*(L"\s-1NULL\*(R"\s0 +[perl #72624]. +.PP +\fIEncode has been upgraded from version 2.39 to version 2.39_01.\fR +.IX Subsection "Encode has been upgraded from version 2.39 to version 2.39_01." +.PP +See \*(L"Security\*(R". +.PP +\fIFile::Glob has been upgraded from version 1.07 to version 1.07_01.\fR +.IX Subsection "File::Glob has been upgraded from version 1.07 to version 1.07_01." +.PP +See \*(L"Security\*(R". +.PP +\fIUnicode::UCD\fR +.IX Subsection "Unicode::UCD" +.PP +The documentation for the \f(CW\*(C`upper\*(C'\fR function now actually says \*(L"upper\*(R", not +\&\*(L"lower\*(R". +.PP +\fIModule::CoreList\fR +.IX Subsection "Module::CoreList" +.PP +Module::CoreList has been updated to version 2.50_02 to add data for +this release. +.SH "Changes to Existing Documentation" +.IX Header "Changes to Existing Documentation" +.SS "perlebcdic" +.IX Subsection "perlebcdic" +The perlebcdic document contains a helpful table to use in \f(CW\*(C`tr///\*(C'\fR to +convert between \s-1EBCDIC\s0 and Latin1/ASCII. Unfortunately, the table was the +inverse of the one it describes. This has been corrected. +.SS "perlunicode" +.IX Subsection "perlunicode" +The section on +User-Defined Case Mappings had +some bad markup and unclear sentences, making parts of it unreadable. This +has been rectified. +.SS "perluniprops" +.IX Subsection "perluniprops" +This document has been corrected to take non-ASCII platforms into account. +.SH "Installation and Configuration Improvements" +.IX Header "Installation and Configuration Improvements" +.SS "Platform Specific Changes" +.IX Subsection "Platform Specific Changes" +.IP "Mac \s-1OS X\s0" 4 +.IX Item "Mac OS X" +There have been configuration and test fixes to make Perl build cleanly on +Lion and Mountain Lion. +.IP "NetBSD" 4 +.IX Item "NetBSD" +The NetBSD hints file was corrected to be compatible with NetBSD 6.* +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +\&\f(CW\*(C`chop\*(C'\fR now correctly handles characters above \*(L"\ex{7fffffff}\*(R" +[perl #73246]. +.IP "\(bu" 4 +\&\f(CW\*(C`($<,$>) = (...)\*(C'\fR stopped working properly in 5.12.0. It is supposed +to make a single \f(CW\*(C`setreuid()\*(C'\fR call, rather than calling \f(CW\*(C`setruid()\*(C'\fR and +\&\f(CW\*(C`seteuid()\*(C'\fR separately. Consequently it did not work properly. This has +been fixed [perl #75212]. +.IP "\(bu" 4 +Fixed a regression of \fBkill()\fR when a match variable is used for the +process \s-1ID\s0 to kill [perl #75812]. +.IP "\(bu" 4 +\&\f(CW\*(C`UNIVERSAL::VERSION\*(C'\fR no longer leaks memory. It started leaking in Perl +5.10.0. +.IP "\(bu" 4 +The C\-level \f(CW\*(C`my_strftime\*(C'\fR functions no longer leaks memory. This fixes a +memory leak in \f(CW\*(C`POSIX::strftime\*(C'\fR [perl #73520]. +.IP "\(bu" 4 +\&\f(CW\*(C`caller\*(C'\fR no longer leaks memory when called from the \s-1DB\s0 package if +\&\f(CW@DB::args\fR was assigned to after the first call to \f(CW\*(C`caller\*(C'\fR. Carp +was triggering this bug [perl #97010]. +.IP "\(bu" 4 +Passing to \f(CW\*(C`index\*(C'\fR an offset beyond the end of the string when the string +is encoded internally in \s-1UTF8\s0 no longer causes panics [perl #75898]. +.IP "\(bu" 4 +Syntax errors in \f(CW\*(C`(?{...})\*(C'\fR blocks in regular expressions no longer +cause panic messages [perl #2353]. +.IP "\(bu" 4 +Perl 5.10.0 introduced some faulty logic that made \*(L"U*\*(R" in the middle of +a pack template equivalent to \*(L"U0\*(R" if the input string was empty. This has +been fixed [perl #90160]. +.SH "Errata" +.IX Header "Errata" +.ie n .SS "\fBsplit()\fP and @_" +.el .SS "\fBsplit()\fP and \f(CW@_\fP" +.IX Subsection "split() and @_" +\&\fBsplit()\fR no longer modifies \f(CW@_\fR when called in scalar or void context. +In void context it now produces a \*(L"Useless use of split\*(R" warning. +This is actually a change introduced in perl 5.12.0, but it was missed from +that release's perl5120delta. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.12.5 represents approximately 17 months of development since Perl 5.12.4 +and contains approximately 1,900 lines of changes across 64 files from 18 +authors. +.PP +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed the +improvements that became Perl 5.12.5: +.PP +Andy Dougherty, Chris 'BinGOs' Williams, Craig A. Berry, David Mitchell, +Dominic Hargreaves, Father Chrysostomos, Florian Ragwitz, George Greer, Goro +Fuji, Jesse Vincent, Karl Williamson, Leon Brocard, Nicholas Clark, Rafael +Garcia-Suarez, Reini Urban, Ricardo Signes, Steve Hay, Tony Cook. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://rt.perl.org/perlbug/ . There may also be +information at http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the \fBperlbug\fR +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send +it to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes all the core committers, who be able +to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for +security issues in the Perl core, not for modules independently +distributed on \s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details +on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5140delta.1 b/data/miniconda3/man/man1/perl5140delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..43b096d5cf5b786b9df9f1238f030ffd3eca1503 --- /dev/null +++ b/data/miniconda3/man/man1/perl5140delta.1 @@ -0,0 +1,3946 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5140DELTA 1" +.TH PERL5140DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5140delta \- what is new for perl v5.14.0 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.12.0 release and +the 5.14.0 release. +.PP +If you are upgrading from an earlier release such as 5.10.0, first read +perl5120delta, which describes differences between 5.10.0 and +5.12.0. +.PP +Some of the bug fixes in this release have been backported to subsequent +releases of 5.12.x. Those are indicated with the 5.12.x version in +parentheses. +.SH "Notice" +.IX Header "Notice" +As described in perlpolicy, the release of Perl 5.14.0 marks the +official end of support for Perl 5.10. Users of Perl 5.10 or earlier +should consider upgrading to a more recent release of Perl. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.SS "Unicode" +.IX Subsection "Unicode" +\fIUnicode Version 6.0 is now supported (mostly)\fR +.IX Subsection "Unicode Version 6.0 is now supported (mostly)" +.PP +Perl comes with the Unicode 6.0 data base updated with +Corrigendum #8 , +with one exception noted below. +See for details on the new +release. Perl does not support any Unicode provisional properties, +including the new ones for this release. +.PP +Unicode 6.0 has chosen to use the name \f(CW\*(C`BELL\*(C'\fR for the character at U+1F514, +which is a symbol that looks like a bell, and is used in Japanese cell +phones. This conflicts with the long-standing Perl usage of having +\&\f(CW\*(C`BELL\*(C'\fR mean the \s-1ASCII\s0 \f(CW\*(C`BEL\*(C'\fR character, U+0007. In Perl 5.14, +\&\f(CW\*(C`\eN{BELL}\*(C'\fR continues to mean U+0007, but its use generates a +deprecation warning message unless such warnings are turned off. The +new name for U+0007 in Perl is \f(CW\*(C`ALERT\*(C'\fR, which corresponds nicely +with the existing shorthand sequence for it, \f(CW"\ea"\fR. \f(CW\*(C`\eN{BEL}\*(C'\fR +means U+0007, with no warning given. The character at U+1F514 has no +name in 5.14, but can be referred to by \f(CW\*(C`\eN{U+1F514}\*(C'\fR. +In Perl 5.16, \f(CW\*(C`\eN{BELL}\*(C'\fR will refer to U+1F514; all code +that uses \f(CW\*(C`\eN{BELL}\*(C'\fR should be converted to use \f(CW\*(C`\eN{ALERT}\*(C'\fR, +\&\f(CW\*(C`\eN{BEL}\*(C'\fR, or \f(CW"\ea"\fR before upgrading. +.PP +\fIFull functionality for \f(CI\*(C`use feature \*(Aqunicode_strings\*(Aq\*(C'\fI\fR +.IX Subsection "Full functionality for use feature unicode_strings" +.PP +This release provides full functionality for \f(CW\*(C`use feature +\&\*(Aqunicode_strings\*(Aq\*(C'\fR. Under its scope, all string operations executed and +regular expressions compiled (even if executed outside its scope) have +Unicode semantics. See \*(L"the 'unicode_strings' feature\*(R" in feature. +However, see \*(L"Inverted bracketed character classes and multi-character folds\*(R", +below. +.PP +This feature avoids most forms of the \*(L"Unicode Bug\*(R" (see +\&\*(L"The \*(R"Unicode Bug"" in perlunicode for details). If there is any +possibility that your code will process Unicode strings, you are +\&\fIstrongly\fR encouraged to use this subpragma to avoid nasty surprises. +.PP +\fI\f(CI\*(C`\eN{\f(CINAME\f(CI}\*(C'\fI and \f(CI\*(C`charnames\*(C'\fI enhancements\fR +.IX Subsection "N{NAME} and charnames enhancements" +.IP "\(bu" 4 +\&\f(CW\*(C`\eN{\f(CINAME\f(CW}\*(C'\fR and \f(CW\*(C`charnames::vianame\*(C'\fR now know about the abbreviated +character names listed by Unicode, such as \s-1NBSP, SHY, LRO, ZWJ,\s0 etc.; all +customary abbreviations for the C0 and C1 control characters (such as +\&\s-1ACK, BEL, CAN,\s0 etc.); and a few new variants of some C1 full names that +are in common usage. +.IP "\(bu" 4 +Unicode has several \fInamed character sequences\fR, in which particular sequences +of code points are given names. \f(CW\*(C`\eN{\f(CINAME\f(CW}\*(C'\fR now recognizes these. +.IP "\(bu" 4 +\&\f(CW\*(C`\eN{\f(CINAME\f(CW}\*(C'\fR, \f(CW\*(C`charnames::vianame\*(C'\fR, and \f(CW\*(C`charnames::viacode\*(C'\fR +now know about every character in Unicode. In earlier releases of +Perl, they didn't know about the Hangul syllables nor several +\&\s-1CJK\s0 (Chinese/Japanese/Korean) characters. +.IP "\(bu" 4 +It is now possible to override Perl's abbreviations with your own custom aliases. +.IP "\(bu" 4 +You can now create a custom alias of the ordinal of a +character, known by \f(CW\*(C`\eN{\f(CINAME\f(CW}\*(C'\fR, \f(CW\*(C`charnames::vianame()\*(C'\fR, and +\&\f(CW\*(C`charnames::viacode()\*(C'\fR. Previously, aliases had to be to official +Unicode character names. This made it impossible to create an alias for +unnamed code points, such as those reserved for private +use. +.IP "\(bu" 4 +The new function \fBcharnames::string_vianame()\fR is a run-time version +of \f(CW\*(C`\eN{\f(CINAME\f(CW}}\*(C'\fR, returning the string of characters whose Unicode +name is its parameter. It can handle Unicode named character +sequences, whereas the pre-existing \fBcharnames::vianame()\fR cannot, +as the latter returns a single code point. +.PP +See charnames for details on all these changes. +.PP +\fINew warnings categories for problematic (non\-)Unicode code points.\fR +.IX Subsection "New warnings categories for problematic (non-)Unicode code points." +.PP +Three new warnings subcategories of \*(L"utf8\*(R" have been added. These +allow you to turn off some \*(L"utf8\*(R" warnings, while allowing +other warnings to remain on. The three categories are: +\&\f(CW\*(C`surrogate\*(C'\fR when \s-1UTF\-16\s0 surrogates are encountered; +\&\f(CW\*(C`nonchar\*(C'\fR when Unicode non-character code points are encountered; +and \f(CW\*(C`non_unicode\*(C'\fR when code points above the legal Unicode +maximum of 0x10FFFF are encountered. +.PP +\fIAny unsigned value can be encoded as a character\fR +.IX Subsection "Any unsigned value can be encoded as a character" +.PP +With this release, Perl is adopting a model that any unsigned value +can be treated as a code point and encoded internally (as utf8) +without warnings, not just the code points that are legal in Unicode. +However, unless utf8 or the corresponding sub-category (see previous +item) of lexical warnings have been explicitly turned off, outputting +or executing a Unicode-defined operation such as upper-casing +on such a code point generates a warning. Attempting to input these +using strict rules (such as with the \f(CW\*(C`:encoding(UTF\-8)\*(C'\fR layer) +will continue to fail. Prior to this release, handling was +inconsistent and in places, incorrect. +.PP +Unicode non-characters, some of which previously were erroneously +considered illegal in places by Perl, contrary to the Unicode Standard, +are now always legal internally. Inputting or outputting them +works the same as with the non-legal Unicode code points, because the Unicode +Standard says they are (only) illegal for \*(L"open interchange\*(R". +.PP +\fIUnicode database files not installed\fR +.IX Subsection "Unicode database files not installed" +.PP +The Unicode database files are no longer installed with Perl. This +doesn't affect any functionality in Perl and saves significant disk +space. If you need these files, you can download them from +. +.SS "Regular Expressions" +.IX Subsection "Regular Expressions" +\fI\f(CI\*(C`(?^...)\*(C'\fI construct signifies default modifiers\fR +.IX Subsection "(?^...) construct signifies default modifiers" +.PP +An \s-1ASCII\s0 caret \f(CW"^"\fR immediately following a \f(CW"(?"\fR in a regular +expression now means that the subexpression does not inherit surrounding +modifiers such as \f(CW\*(C`/i\*(C'\fR, but reverts to the Perl defaults. Any modifiers +following the caret override the defaults. +.PP +Stringification of regular expressions now uses this notation. +For example, \f(CW\*(C`qr/hlagh/i\*(C'\fR would previously be stringified as +\&\f(CW\*(C`(?i\-xsm:hlagh)\*(C'\fR, but now it's stringified as \f(CW\*(C`(?^i:hlagh)\*(C'\fR. +.PP +The main purpose of this change is to allow tests that rely on the +stringification \fInot\fR to have to change whenever new modifiers are added. +See \*(L"Extended Patterns\*(R" in perlre. +.PP +This change is likely to break code that compares stringified regular +expressions with fixed strings containing \f(CW\*(C`?\-xism\*(C'\fR. +.PP +\fI\f(CI\*(C`/d\*(C'\fI, \f(CI\*(C`/l\*(C'\fI, \f(CI\*(C`/u\*(C'\fI, and \f(CI\*(C`/a\*(C'\fI modifiers\fR +.IX Subsection "/d, /l, /u, and /a modifiers" +.PP +Four new regular expression modifiers have been added. These are mutually +exclusive: one only can be turned on at a time. +.IP "\(bu" 4 +The \f(CW\*(C`/l\*(C'\fR modifier says to compile the regular expression as if it were +in the scope of \f(CW\*(C`use locale\*(C'\fR, even if it is not. +.IP "\(bu" 4 +The \f(CW\*(C`/u\*(C'\fR modifier says to compile the regular expression as if it were +in the scope of a \f(CW\*(C`use feature \*(Aqunicode_strings\*(Aq\*(C'\fR pragma. +.IP "\(bu" 4 +The \f(CW\*(C`/d\*(C'\fR (default) modifier is used to override any \f(CW\*(C`use locale\*(C'\fR and +\&\f(CW\*(C`use feature \*(Aqunicode_strings\*(Aq\*(C'\fR pragmas in effect at the time +of compiling the regular expression. +.IP "\(bu" 4 +The \f(CW\*(C`/a\*(C'\fR regular expression modifier restricts \f(CW\*(C`\es\*(C'\fR, \f(CW\*(C`\ed\*(C'\fR and \f(CW\*(C`\ew\*(C'\fR and +the \s-1POSIX\s0 (\f(CW\*(C`[[:posix:]]\*(C'\fR) character classes to the \s-1ASCII\s0 range. Their +complements and \f(CW\*(C`\eb\*(C'\fR and \f(CW\*(C`\eB\*(C'\fR are correspondingly +affected. Otherwise, \f(CW\*(C`/a\*(C'\fR behaves like the \f(CW\*(C`/u\*(C'\fR modifier, in that +case-insensitive matching uses Unicode semantics. +.Sp +If the \f(CW\*(C`/a\*(C'\fR modifier is repeated, then additionally in case-insensitive +matching, no \s-1ASCII\s0 character can match a non-ASCII character. +For example, +.Sp +.Vb 2 +\& "k" =~ /\eN{KELVIN SIGN}/ai +\& "\exDF" =~ /ss/ai +.Ve +.Sp +match but +.Sp +.Vb 2 +\& "k" =~ /\eN{KELVIN SIGN}/aai +\& "\exDF" =~ /ss/aai +.Ve +.Sp +do not match. +.PP +See \*(L"Modifiers\*(R" in perlre for more detail. +.PP +\fINon-destructive substitution\fR +.IX Subsection "Non-destructive substitution" +.PP +The substitution (\f(CW\*(C`s///\*(C'\fR) and transliteration +(\f(CW\*(C`y///\*(C'\fR) operators now support an \f(CW\*(C`/r\*(C'\fR option that +copies the input variable, carries out the substitution on +the copy, and returns the result. The original remains unmodified. +.PP +.Vb 3 +\& my $old = "cat"; +\& my $new = $old =~ s/cat/dog/r; +\& # $old is "cat" and $new is "dog" +.Ve +.PP +This is particularly useful with \f(CW\*(C`map\*(C'\fR. See perlop for more examples. +.PP +\fIRe-entrant regular expression engine\fR +.IX Subsection "Re-entrant regular expression engine" +.PP +It is now safe to use regular expressions within \f(CW\*(C`(?{...})\*(C'\fR and +\&\f(CW\*(C`(??{...})\*(C'\fR code blocks inside regular expressions. +.PP +These blocks are still experimental, however, and still have problems with +lexical (\f(CW\*(C`my\*(C'\fR) variables and abnormal exiting. +.PP +\fI\f(CI\*(C`use re \*(Aq/flags\*(Aq\*(C'\fI\fR +.IX Subsection "use re /flags" +.PP +The \f(CW\*(C`re\*(C'\fR pragma now has the ability to turn on regular expression flags +till the end of the lexical scope: +.PP +.Vb 2 +\& use re "/x"; +\& "foo" =~ / (.+) /; # /x implied +.Ve +.PP +See \*(L"'/flags' mode\*(R" in re for details. +.PP +\fI\eo{...} for octals\fR +.IX Subsection "o{...} for octals" +.PP +There is a new octal escape sequence, \f(CW"\eo"\fR, in doublequote-like +contexts. This construct allows large octal ordinals beyond the +current max of 0777 to be represented. It also allows you to specify a +character in octal which can safely be concatenated with other regex +snippets and which won't be confused with being a backreference to +a regex capture group. See \*(L"Capture groups\*(R" in perlre. +.PP +\fIAdd \f(CI\*(C`\ep{Titlecase}\*(C'\fI as a synonym for \f(CI\*(C`\ep{Title}\*(C'\fI\fR +.IX Subsection "Add p{Titlecase} as a synonym for p{Title}" +.PP +This synonym is added for symmetry with the Unicode property names +\&\f(CW\*(C`\ep{Uppercase}\*(C'\fR and \f(CW\*(C`\ep{Lowercase}\*(C'\fR. +.PP +\fIRegular expression debugging output improvement\fR +.IX Subsection "Regular expression debugging output improvement" +.PP +Regular expression debugging output (turned on by \f(CW\*(C`use re \*(Aqdebug\*(Aq\*(C'\fR) now +uses hexadecimal when escaping non-ASCII characters, instead of octal. +.PP +\fIReturn value of \f(CI\*(C`delete $+{...}\*(C'\fI\fR +.IX Subsection "Return value of delete $+{...}" +.PP +Custom regular expression engines can now determine the return value of +\&\f(CW\*(C`delete\*(C'\fR on an entry of \f(CW\*(C`%+\*(C'\fR or \f(CW\*(C`%\-\*(C'\fR. +.SS "Syntactical Enhancements" +.IX Subsection "Syntactical Enhancements" +\fIArray and hash container functions accept references\fR +.IX Subsection "Array and hash container functions accept references" +.PP +\&\fBWarning:\fR This feature is considered experimental, as the exact behaviour +may change in a future version of Perl. +.PP +All builtin functions that operate directly on array or hash +containers now also accept unblessed hard references to arrays +or hashes: +.PP +.Vb 10 +\& |\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-| +\& | Traditional syntax | Terse syntax | +\& |\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-| +\& | push @$arrayref, @stuff | push $arrayref, @stuff | +\& | unshift @$arrayref, @stuff | unshift $arrayref, @stuff | +\& | pop @$arrayref | pop $arrayref | +\& | shift @$arrayref | shift $arrayref | +\& | splice @$arrayref, 0, 2 | splice $arrayref, 0, 2 | +\& | keys %$hashref | keys $hashref | +\& | keys @$arrayref | keys $arrayref | +\& | values %$hashref | values $hashref | +\& | values @$arrayref | values $arrayref | +\& | ($k,$v) = each %$hashref | ($k,$v) = each $hashref | +\& | ($k,$v) = each @$arrayref | ($k,$v) = each $arrayref | +\& |\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-| +.Ve +.PP +This allows these builtin functions to act on long dereferencing chains +or on the return value of subroutines without needing to wrap them in +\&\f(CW\*(C`@{}\*(C'\fR or \f(CW\*(C`%{}\*(C'\fR: +.PP +.Vb 2 +\& push @{$obj\->tags}, $new_tag; # old way +\& push $obj\->tags, $new_tag; # new way +\& +\& for ( keys %{$hoh\->{genres}{artists}} ) {...} # old way +\& for ( keys $hoh\->{genres}{artists} ) {...} # new way +.Ve +.PP +\fISingle term prototype\fR +.IX Subsection "Single term prototype" +.PP +The \f(CW\*(C`+\*(C'\fR prototype is a special alternative to \f(CW\*(C`$\*(C'\fR that acts like +\&\f(CW\*(C`\e[@%]\*(C'\fR when given a literal array or hash variable, but will otherwise +force scalar context on the argument. See \*(L"Prototypes\*(R" in perlsub. +.PP +\fI\f(CI\*(C`package\*(C'\fI block syntax\fR +.IX Subsection "package block syntax" +.PP +A package declaration can now contain a code block, in which case the +declaration is in scope inside that block only. So \f(CW\*(C`package Foo { ... }\*(C'\fR +is precisely equivalent to \f(CW\*(C`{ package Foo; ... }\*(C'\fR. It also works with +a version number in the declaration, as in \f(CW\*(C`package Foo 1.2 { ... }\*(C'\fR, +which is its most attractive feature. See perlfunc. +.PP +\fIStatement labels can appear in more places\fR +.IX Subsection "Statement labels can appear in more places" +.PP +Statement labels can now occur before any type of statement or declaration, +such as \f(CW\*(C`package\*(C'\fR. +.PP +\fIStacked labels\fR +.IX Subsection "Stacked labels" +.PP +Multiple statement labels can now appear before a single statement. +.PP +\fIUppercase X/B allowed in hexadecimal/binary literals\fR +.IX Subsection "Uppercase X/B allowed in hexadecimal/binary literals" +.PP +Literals may now use either upper case \f(CW\*(C`0X...\*(C'\fR or \f(CW\*(C`0B...\*(C'\fR prefixes, +in addition to the already supported \f(CW\*(C`0x...\*(C'\fR and \f(CW\*(C`0b...\*(C'\fR +syntax [perl #76296]. +.PP +C, Ruby, Python, and \s-1PHP\s0 already support this syntax, and it makes +Perl more internally consistent: a round-trip with \f(CW\*(C`eval sprintf +"%#X", 0x10\*(C'\fR now returns \f(CW16\fR, just like \f(CW\*(C`eval sprintf "%#x", 0x10\*(C'\fR. +.PP +\fIOverridable tie functions\fR +.IX Subsection "Overridable tie functions" +.PP +\&\f(CW\*(C`tie\*(C'\fR, \f(CW\*(C`tied\*(C'\fR and \f(CW\*(C`untie\*(C'\fR can now be overridden [perl #75902]. +.SS "Exception Handling" +.IX Subsection "Exception Handling" +To make them more reliable and consistent, several changes have been made +to how \f(CW\*(C`die\*(C'\fR, \f(CW\*(C`warn\*(C'\fR, and \f(CW$@\fR behave. +.IP "\(bu" 4 +When an exception is thrown inside an \f(CW\*(C`eval\*(C'\fR, the exception is no +longer at risk of being clobbered by destructor code running during unwinding. +Previously, the exception was written into \f(CW$@\fR +early in the throwing process, and would be overwritten if \f(CW\*(C`eval\*(C'\fR was +used internally in the destructor for an object that had to be freed +while exiting from the outer \f(CW\*(C`eval\*(C'\fR. Now the exception is written +into \f(CW$@\fR last thing before exiting the outer \f(CW\*(C`eval\*(C'\fR, so the code +running immediately thereafter can rely on the value in \f(CW$@\fR correctly +corresponding to that \f(CW\*(C`eval\*(C'\fR. (\f(CW$@\fR is still also set before exiting the +\&\f(CW\*(C`eval\*(C'\fR, for the sake of destructors that rely on this.) +.Sp +Likewise, a \f(CW\*(C`local $@\*(C'\fR inside an \f(CW\*(C`eval\*(C'\fR no longer clobbers any +exception thrown in its scope. Previously, the restoration of \f(CW$@\fR upon +unwinding would overwrite any exception being thrown. Now the exception +gets to the \f(CW\*(C`eval\*(C'\fR anyway. So \f(CW\*(C`local $@\*(C'\fR is safe before a \f(CW\*(C`die\*(C'\fR. +.Sp +Exceptions thrown from object destructors no longer modify the \f(CW$@\fR +of the surrounding context. (If the surrounding context was exception +unwinding, this used to be another way to clobber the exception being +thrown.) Previously such an exception was +sometimes emitted as a warning, and then either was +string-appended to the surrounding \f(CW$@\fR or completely replaced the +surrounding \f(CW$@\fR, depending on whether that exception and the surrounding +\&\f(CW$@\fR were strings or objects. Now, an exception in this situation is +always emitted as a warning, leaving the surrounding \f(CW$@\fR untouched. +In addition to object destructors, this also affects any function call +run by \s-1XS\s0 code using the \f(CW\*(C`G_KEEPERR\*(C'\fR flag. +.IP "\(bu" 4 +Warnings for \f(CW\*(C`warn\*(C'\fR can now be objects in the same way as exceptions +for \f(CW\*(C`die\*(C'\fR. If an object-based warning gets the default handling +of writing to standard error, it is stringified as before with the +filename and line number appended. But a \f(CW$SIG{_\|_WARN_\|_}\fR handler now +receives an object-based warning as an object, where previously it +was passed the result of stringifying the object. +.SS "Other Enhancements" +.IX Subsection "Other Enhancements" +\fIAssignment to \f(CI$0\fI sets the legacy process name with \f(BIprctl()\fI on Linux\fR +.IX Subsection "Assignment to $0 sets the legacy process name with prctl() on Linux" +.PP +On Linux the legacy process name is now set with \fBprctl\fR\|(2), in +addition to altering the \s-1POSIX\s0 name via \f(CW\*(C`argv[0]\*(C'\fR, as Perl has done +since version 4.000. Now system utilities that read the legacy process +name such as \fIps\fR, \fItop\fR, and \fIkillall\fR recognize the name you set when +assigning to \f(CW$0\fR. The string you supply is truncated at 16 bytes; +this limitation is imposed by Linux. +.PP +\fI\f(BIsrand()\fI now returns the seed\fR +.IX Subsection "srand() now returns the seed" +.PP +This allows programs that need to have repeatable results not to have to come +up with their own seed-generating mechanism. Instead, they can use \fBsrand()\fR +and stash the return value for future use. One example is a test program with +too many combinations to test comprehensively in the time available for +each run. It can test a random subset each time and, should there be a failure, +log the seed used for that run so this can later be used to produce the same results. +.PP +\fIprintf-like functions understand post\-1980 size modifiers\fR +.IX Subsection "printf-like functions understand post-1980 size modifiers" +.PP +Perl's printf and sprintf operators, and Perl's internal printf replacement +function, now understand the C90 size modifiers \*(L"hh\*(R" (\f(CW\*(C`char\*(C'\fR), \*(L"z\*(R" +(\f(CW\*(C`size_t\*(C'\fR), and \*(L"t\*(R" (\f(CW\*(C`ptrdiff_t\*(C'\fR). Also, when compiled with a C99 +compiler, Perl now understands the size modifier \*(L"j\*(R" (\f(CW\*(C`intmax_t\*(C'\fR) +(but this is not portable). +.PP +So, for example, on any modern machine, \f(CW\*(C`sprintf("%hhd", 257)\*(C'\fR returns \*(L"1\*(R". +.PP +\fINew global variable \f(CI\*(C`${^GLOBAL_PHASE}\*(C'\fI\fR +.IX Subsection "New global variable ${^GLOBAL_PHASE}" +.PP +A new global variable, \f(CW\*(C`${^GLOBAL_PHASE}\*(C'\fR, has been added to allow +introspection of the current phase of the Perl interpreter. It's explained in +detail in \*(L"${^GLOBAL_PHASE}\*(R" in perlvar and in +\&\*(L"\s-1BEGIN, UNITCHECK, CHECK, INIT\s0 and \s-1END\*(R"\s0 in perlmod. +.PP +\fI\f(CI\*(C`\-d:\-foo\*(C'\fI calls \f(CI\*(C`Devel::foo::unimport\*(C'\fI\fR +.IX Subsection "-d:-foo calls Devel::foo::unimport" +.PP +The syntax \fB\-d:foo\fR was extended in 5.6.1 to make \fB\-d:foo=bar\fR +equivalent to \fB\-MDevel::foo=bar\fR, which expands +internally to \f(CW\*(C`use Devel::foo \*(Aqbar\*(Aq\*(C'\fR. +Perl now allows prefixing the module name with \fB\-\fR, with the same +semantics as \fB\-M\fR; that is: +.ie n .IP """\-d:\-foo""" 4 +.el .IP "\f(CW\-d:\-foo\fR" 4 +.IX Item "-d:-foo" +Equivalent to \fB\-M\-Devel::foo\fR: expands to +\&\f(CW\*(C`no Devel::foo\*(C'\fR and calls \f(CW\*(C`Devel::foo\->unimport()\*(C'\fR +if that method exists. +.ie n .IP """\-d:\-foo=bar""" 4 +.el .IP "\f(CW\-d:\-foo=bar\fR" 4 +.IX Item "-d:-foo=bar" +Equivalent to \fB\-M\-Devel::foo=bar\fR: expands to \f(CW\*(C`no Devel::foo \*(Aqbar\*(Aq\*(C'\fR, +and calls \f(CW\*(C`Devel::foo\->unimport("bar")\*(C'\fR if that method exists. +.PP +This is particularly useful for suppressing the default actions of a +\&\f(CW\*(C`Devel::*\*(C'\fR module's \f(CW\*(C`import\*(C'\fR method whilst still loading it for debugging. +.PP +\fIFilehandle method calls load IO::File on demand\fR +.IX Subsection "Filehandle method calls load IO::File on demand" +.PP +When a method call on a filehandle would die because the method cannot +be resolved and IO::File has not been loaded, Perl now loads IO::File +via \f(CW\*(C`require\*(C'\fR and attempts method resolution again: +.PP +.Vb 2 +\& open my $fh, ">", $file; +\& $fh\->binmode(":raw"); # loads IO::File and succeeds +.Ve +.PP +This also works for globs like \f(CW\*(C`STDOUT\*(C'\fR, \f(CW\*(C`STDERR\*(C'\fR, and \f(CW\*(C`STDIN\*(C'\fR: +.PP +.Vb 1 +\& STDOUT\->autoflush(1); +.Ve +.PP +Because this on-demand load happens only if method resolution fails, the +legacy approach of manually loading an IO::File parent class for partial +method support still works as expected: +.PP +.Vb 3 +\& use IO::Handle; +\& open my $fh, ">", $file; +\& $fh\->autoflush(1); # IO::File not loaded +.Ve +.PP +\fIImproved IPv6 support\fR +.IX Subsection "Improved IPv6 support" +.PP +The \f(CW\*(C`Socket\*(C'\fR module provides new affordances for IPv6, +including implementations of the \f(CW\*(C`Socket::getaddrinfo()\*(C'\fR and +\&\f(CW\*(C`Socket::getnameinfo()\*(C'\fR functions, along with related constants and a +handful of new functions. See Socket. +.PP +\fIDTrace probes now include package name\fR +.IX Subsection "DTrace probes now include package name" +.PP +The \f(CW\*(C`DTrace\*(C'\fR probes now include an additional argument, \f(CW\*(C`arg3\*(C'\fR, which contains +the package the subroutine being entered or left was compiled in. +.PP +For example, using the following DTrace script: +.PP +.Vb 4 +\& perl$target:::sub\-entry +\& { +\& printf("%s::%s\en", copyinstr(arg0), copyinstr(arg3)); +\& } +.Ve +.PP +and then running: +.PP +.Vb 1 +\& $ perl \-e \*(Aqsub test { }; test\*(Aq +.Ve +.PP +\&\f(CW\*(C`DTrace\*(C'\fR will print: +.PP +.Vb 1 +\& main::test +.Ve +.SS "New C APIs" +.IX Subsection "New C APIs" +See \*(L"Internal Changes\*(R". +.SH "Security" +.IX Header "Security" +.SS "User-defined regular expression properties" +.IX Subsection "User-defined regular expression properties" +\&\*(L"User-Defined Character Properties\*(R" in perlunicode documented that you can +create custom properties by defining subroutines whose names begin with +\&\*(L"In\*(R" or \*(L"Is\*(R". However, Perl did not actually enforce that naming +restriction, so \f(CW\*(C`\ep{foo::bar}\*(C'\fR could call \fBfoo::bar()\fR if it existed. The documented +convention is now enforced. +.PP +Also, Perl no longer allows tainted regular expressions to invoke a +user-defined property. It simply dies instead [perl #82616]. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +Perl 5.14.0 is not binary-compatible with any previous stable release. +.PP +In addition to the sections that follow, see \*(L"C \s-1API\s0 Changes\*(R". +.SS "Regular Expressions and String Escapes" +.IX Subsection "Regular Expressions and String Escapes" +\fIInverted bracketed character classes and multi-character folds\fR +.IX Subsection "Inverted bracketed character classes and multi-character folds" +.PP +Some characters match a sequence of two or three characters in \f(CW\*(C`/i\*(C'\fR +regular expression matching under Unicode rules. One example is +\&\f(CW\*(C`LATIN SMALL LETTER SHARP S\*(C'\fR which matches the sequence \f(CW\*(C`ss\*(C'\fR. +.PP +.Vb 1 +\& \*(Aqss\*(Aq =~ /\eA[\eN{LATIN SMALL LETTER SHARP S}]\ez/i # Matches +.Ve +.PP +This, however, can lead to very counter-intuitive results, especially +when inverted. Because of this, Perl 5.14 does not use multi-character \f(CW\*(C`/i\*(C'\fR +matching in inverted character classes. +.PP +.Vb 1 +\& \*(Aqss\*(Aq =~ /\eA[^\eN{LATIN SMALL LETTER SHARP S}]+\ez/i # ??? +.Ve +.PP +This should match any sequences of characters that aren't the \f(CW\*(C`SHARP S\*(C'\fR +nor what \f(CW\*(C`SHARP S\*(C'\fR matches under \f(CW\*(C`/i\*(C'\fR. \f(CW"s"\fR isn't \f(CW\*(C`SHARP S\*(C'\fR, but +Unicode says that \f(CW"ss"\fR is what \f(CW\*(C`SHARP S\*(C'\fR matches under \f(CW\*(C`/i\*(C'\fR. So +which one \*(L"wins\*(R"? Do you fail the match because the string has \f(CW\*(C`ss\*(C'\fR or +accept it because it has an \f(CW\*(C`s\*(C'\fR followed by another \f(CW\*(C`s\*(C'\fR? +.PP +Earlier releases of Perl did allow this multi-character matching, +but due to bugs, it mostly did not work. +.PP +\fI\e400\-\e777\fR +.IX Subsection "400-777" +.PP +In certain circumstances, \f(CW\*(C`\e400\*(C'\fR\-\f(CW\*(C`\e777\*(C'\fR in regexes have behaved +differently than they behave in all other doublequote-like contexts. +Since 5.10.1, Perl has issued a deprecation warning when this happens. +Now, these literals behave the same in all doublequote-like contexts, +namely to be equivalent to \f(CW\*(C`\ex{100}\*(C'\fR\-\f(CW\*(C`\ex{1FF}\*(C'\fR, with no deprecation +warning. +.PP +Use of \f(CW\*(C`\e400\*(C'\fR\-\f(CW\*(C`\e777\*(C'\fR in the command-line option \fB\-0\fR retain their +conventional meaning. They slurp whole input files; previously, this +was documented only for \fB\-0777\fR. +.PP +Because of various ambiguities, you should use the new +\&\f(CW\*(C`\eo{...}\*(C'\fR construct to represent characters in octal instead. +.PP +\fIMost \f(CI\*(C`\ep{}\*(C'\fI properties are now immune to case-insensitive matching\fR +.IX Subsection "Most p{} properties are now immune to case-insensitive matching" +.PP +For most Unicode properties, it doesn't make sense to have them match +differently under \f(CW\*(C`/i\*(C'\fR case-insensitive matching. Doing so can lead +to unexpected results and potential security holes. For example +.PP +.Vb 1 +\& m/\ep{ASCII_Hex_Digit}+/i +.Ve +.PP +could previously match non-ASCII characters because of the Unicode +matching rules (although there were several bugs with this). Now +matching under \f(CW\*(C`/i\*(C'\fR gives the same results as non\-\f(CW\*(C`/i\*(C'\fR matching except +for those few properties where people have come to expect differences, +namely the ones where casing is an integral part of their meaning, such +as \f(CW\*(C`m/\ep{Uppercase}/i\*(C'\fR and \f(CW\*(C`m/\ep{Lowercase}/i\*(C'\fR, both of which match +the same code points as matched by \f(CW\*(C`m/\ep{Cased}/i\*(C'\fR. +Details are in \*(L"Unicode Properties\*(R" in perlrecharclass. +.PP +User-defined property handlers that need to match differently under \f(CW\*(C`/i\*(C'\fR +must be changed to read the new boolean parameter passed to them, which +is non-zero if case-insensitive matching is in effect and 0 otherwise. +See \*(L"User-Defined Character Properties\*(R" in perlunicode. +.PP +\fI\ep{} implies Unicode semantics\fR +.IX Subsection "p{} implies Unicode semantics" +.PP +Specifying a Unicode property in the pattern indicates +that the pattern is meant for matching according to Unicode rules, the way +\&\f(CW\*(C`\eN{\f(CINAME\f(CW}\*(C'\fR does. +.PP +\fIRegular expressions retain their localeness when interpolated\fR +.IX Subsection "Regular expressions retain their localeness when interpolated" +.PP +Regular expressions compiled under \f(CW\*(C`use locale\*(C'\fR now retain this when +interpolated into a new regular expression compiled outside a +\&\f(CW\*(C`use locale\*(C'\fR, and vice-versa. +.PP +Previously, one regular expression interpolated into another inherited +the localeness of the surrounding regex, losing whatever state it +originally had. This is considered a bug fix, but may trip up code that +has come to rely on the incorrect behaviour. +.PP +\fIStringification of regexes has changed\fR +.IX Subsection "Stringification of regexes has changed" +.PP +Default regular expression modifiers are now notated using +\&\f(CW\*(C`(?^...)\*(C'\fR. Code relying on the old stringification will fail. +This is so that when new modifiers are added, such code won't +have to keep changing each time this happens, because the stringification +will automatically incorporate the new modifiers. +.PP +Code that needs to work properly with both old\- and new-style regexes +can avoid the whole issue by using (for perls since 5.9.5; see re): +.PP +.Vb 2 +\& use re qw(regexp_pattern); +\& my ($pat, $mods) = regexp_pattern($re_ref); +.Ve +.PP +If the actual stringification is important or older Perls need to be +supported, you can use something like the following: +.PP +.Vb 2 +\& # Accept both old and new\-style stringification +\& my $modifiers = (qr/foobar/ =~ /\eQ(?^/) ? "^" : "\-xism"; +.Ve +.PP +And then use \f(CW$modifiers\fR instead of \f(CW\*(C`\-xism\*(C'\fR. +.PP +\fIRun-time code blocks in regular expressions inherit pragmata\fR +.IX Subsection "Run-time code blocks in regular expressions inherit pragmata" +.PP +Code blocks in regular expressions (\f(CW\*(C`(?{...})\*(C'\fR and \f(CW\*(C`(??{...})\*(C'\fR) previously +did not inherit pragmata (strict, warnings, etc.) if the regular expression +was compiled at run time as happens in cases like these two: +.PP +.Vb 3 +\& use re "eval"; +\& $foo =~ $bar; # when $bar contains (?{...}) +\& $foo =~ /$bar(?{ $finished = 1 })/; +.Ve +.PP +This bug has now been fixed, but code that relied on the buggy behaviour +may need to be fixed to account for the correct behaviour. +.SS "Stashes and Package Variables" +.IX Subsection "Stashes and Package Variables" +\fILocalised tied hashes and arrays are no longed tied\fR +.IX Subsection "Localised tied hashes and arrays are no longed tied" +.PP +In the following: +.PP +.Vb 6 +\& tie @a, ...; +\& { +\& local @a; +\& # here, @a is a now a new, untied array +\& } +\& # here, @a refers again to the old, tied array +.Ve +.PP +Earlier versions of Perl incorrectly tied the new local array. This has +now been fixed. This fix could however potentially cause a change in +behaviour of some code. +.PP +\fIStashes are now always defined\fR +.IX Subsection "Stashes are now always defined" +.PP +\&\f(CW\*(C`defined %Foo::\*(C'\fR now always returns true, even when no symbols have yet been +defined in that package. +.PP +This is a side-effect of removing a special-case kludge in the tokeniser, +added for 5.10.0, to hide side-effects of changes to the internal storage of +hashes. The fix drastically reduces hashes' memory overhead. +.PP +Calling defined on a stash has been deprecated since 5.6.0, warned on +lexicals since 5.6.0, and warned for stashes and other package +variables since 5.12.0. \f(CW\*(C`defined %hash\*(C'\fR has always exposed an +implementation detail: emptying a hash by deleting all entries from it does +not make \f(CW\*(C`defined %hash\*(C'\fR false. Hence \f(CW\*(C`defined %hash\*(C'\fR is not valid code to +determine whether an arbitrary hash is empty. Instead, use the behaviour +of an empty \f(CW%hash\fR always returning false in scalar context. +.PP +\fIClearing stashes\fR +.IX Subsection "Clearing stashes" +.PP +Stash list assignment \f(CW\*(C`%foo:: = ()\*(C'\fR used to make the stash temporarily +anonymous while it was being emptied. Consequently, any of its +subroutines referenced elsewhere would become anonymous, showing up as +\&\*(L"(unknown)\*(R" in \f(CW\*(C`caller\*(C'\fR. They now retain their package names such that +\&\f(CW\*(C`caller\*(C'\fR returns the original sub name if there is still a reference +to its typeglob and \*(L"foo::_\|_ANON_\|_\*(R" otherwise [perl #79208]. +.PP +\fIDereferencing typeglobs\fR +.IX Subsection "Dereferencing typeglobs" +.PP +If you assign a typeglob to a scalar variable: +.PP +.Vb 1 +\& $glob = *foo; +.Ve +.PP +the glob that is copied to \f(CW$glob\fR is marked with a special flag +indicating that the glob is just a copy. This allows subsequent +assignments to \f(CW$glob\fR to overwrite the glob. The original glob, +however, is immutable. +.PP +Some Perl operators did not distinguish between these two types of globs. +This would result in strange behaviour in edge cases: \f(CW\*(C`untie $scalar\*(C'\fR +would not untie the scalar if the last thing assigned to it was a glob +(because it treated it as \f(CW\*(C`untie *$scalar\*(C'\fR, which unties a handle). +Assignment to a glob slot (such as \f(CW\*(C`*$glob = \e@some_array\*(C'\fR) would simply +assign \f(CW\*(C`\e@some_array\*(C'\fR to \f(CW$glob\fR. +.PP +To fix this, the \f(CW\*(C`*{}\*(C'\fR operator (including its \f(CW*foo\fR and \f(CW*$foo\fR forms) +has been modified to make a new immutable glob if its operand is a glob +copy. This allows operators that make a distinction between globs and +scalars to be modified to treat only immutable globs as globs. (\f(CW\*(C`tie\*(C'\fR, +\&\f(CW\*(C`tied\*(C'\fR and \f(CW\*(C`untie\*(C'\fR have been left as they are for compatibility's sake, +but will warn. See \*(L"Deprecations\*(R".) +.PP +This causes an incompatible change in code that assigns a glob to the +return value of \f(CW\*(C`*{}\*(C'\fR when that operator was passed a glob copy. Take the +following code, for instance: +.PP +.Vb 2 +\& $glob = *foo; +\& *$glob = *bar; +.Ve +.PP +The \f(CW*$glob\fR on the second line returns a new immutable glob. That new +glob is made an alias to \f(CW*bar\fR. Then it is discarded. So the second +assignment has no effect. +.PP +See for +more detail. +.PP +\fIMagic variables outside the main package\fR +.IX Subsection "Magic variables outside the main package" +.PP +In previous versions of Perl, magic variables like \f(CW$!\fR, \f(CW%SIG\fR, etc. would +\&\*(L"leak\*(R" into other packages. So \f(CW%foo::SIG\fR could be used to access signals, +\&\f(CW\*(C`${"foo::!"}\*(C'\fR (with strict mode off) to access C's \f(CW\*(C`errno\*(C'\fR, etc. +.PP +This was a bug, or an \*(L"unintentional\*(R" feature, which caused various ill effects, +such as signal handlers being wiped when modules were loaded, etc. +.PP +This has been fixed (or the feature has been removed, depending on how you see +it). +.PP +\fIlocal($_) strips all magic from \f(CI$_\fI\fR +.IX Subsection "local($_) strips all magic from $_" +.PP +\&\fBlocal()\fR on scalar variables gives them a new value but keeps all +their magic intact. This has proven problematic for the default +scalar variable \f(CW$_\fR, where perlsub recommends that any subroutine +that assigns to \f(CW$_\fR should first localize it. This would throw an +exception if \f(CW$_\fR is aliased to a read-only variable, and could in general have +various unintentional side-effects. +.PP +Therefore, as an exception to the general rule, local($_) will not +only assign a new value to \f(CW$_\fR, but also remove all existing magic from +it as well. +.PP +\fIParsing of package and variable names\fR +.IX Subsection "Parsing of package and variable names" +.PP +Parsing the names of packages and package variables has changed: +multiple adjacent pairs of colons, as in \f(CW\*(C`foo::::bar\*(C'\fR, are now all +treated as package separators. +.PP +Regardless of this change, the exact parsing of package separators has +never been guaranteed and is subject to change in future Perl versions. +.SS "Changes to Syntax or to Perl Operators" +.IX Subsection "Changes to Syntax or to Perl Operators" +\fI\f(CI\*(C`given\*(C'\fI return values\fR +.IX Subsection "given return values" +.PP +\&\f(CW\*(C`given\*(C'\fR blocks now return the last evaluated +expression, or an empty list if the block was exited by \f(CW\*(C`break\*(C'\fR. Thus you +can now write: +.PP +.Vb 8 +\& my $type = do { +\& given ($num) { +\& break when undef; +\& "integer" when /^[+\-]?[0\-9]+$/; +\& "float" when /^[+\-]?[0\-9]+(?:\e.[0\-9]+)?$/; +\& "unknown"; +\& } +\& }; +.Ve +.PP +See \*(L"Return value\*(R" in perlsyn for details. +.PP +\fIChange in parsing of certain prototypes\fR +.IX Subsection "Change in parsing of certain prototypes" +.PP +Functions declared with the following prototypes now behave correctly as unary +functions: +.PP +.Vb 6 +\& * +\& \e$ \e% \e@ \e* \e& +\& \e[...] +\& ;$ ;* +\& ;\e$ ;\e% etc. +\& ;\e[...] +.Ve +.PP +Due to this bug fix [perl #75904], functions +using the \f(CW\*(C`(*)\*(C'\fR, \f(CW\*(C`(;$)\*(C'\fR and \f(CW\*(C`(;*)\*(C'\fR prototypes +are parsed with higher precedence than before. So +in the following example: +.PP +.Vb 2 +\& sub foo(;$); +\& foo $a < $b; +.Ve +.PP +the second line is now parsed correctly as \f(CW\*(C`foo($a) < $b\*(C'\fR, rather than +\&\f(CW\*(C`foo($a < $b)\*(C'\fR. This happens when one of these operators is used in +an unparenthesised argument: +.PP +.Vb 10 +\& < > <= >= lt gt le ge +\& == != <=> eq ne cmp ~~ +\& & +\& | ^ +\& && +\& || // +\& .. ... +\& ?: +\& = += \-= *= etc. +\& , => +.Ve +.PP +\fISmart-matching against array slices\fR +.IX Subsection "Smart-matching against array slices" +.PP +Previously, the following code resulted in a successful match: +.PP +.Vb 3 +\& my @a = qw(a y0 z); +\& my @b = qw(a x0 z); +\& @a[0 .. $#b] ~~ @b; +.Ve +.PP +This odd behaviour has now been fixed [perl #77468]. +.PP +\fINegation treats strings differently from before\fR +.IX Subsection "Negation treats strings differently from before" +.PP +The unary negation operator, \f(CW\*(C`\-\*(C'\fR, now treats strings that look like numbers +as numbers [perl #57706]. +.PP +\fINegative zero\fR +.IX Subsection "Negative zero" +.PP +Negative zero (\-0.0), when converted to a string, now becomes \*(L"0\*(R" on all +platforms. It used to become \*(L"\-0\*(R" on some, but \*(L"0\*(R" on others. +.PP +If you still need to determine whether a zero is negative, use +\&\f(CW\*(C`sprintf("%g", $zero) =~ /^\-/\*(C'\fR or the Data::Float module on \s-1CPAN.\s0 +.PP +\fI\f(CI\*(C`:=\*(C'\fI is now a syntax error\fR +.IX Subsection ":= is now a syntax error" +.PP +Previously \f(CW\*(C`my $pi := 4\*(C'\fR was exactly equivalent to \f(CW\*(C`my $pi : = 4\*(C'\fR, +with the \f(CW\*(C`:\*(C'\fR being treated as the start of an attribute list, ending before +the \f(CW\*(C`=\*(C'\fR. The use of \f(CW\*(C`:=\*(C'\fR to mean \f(CW\*(C`: =\*(C'\fR was deprecated in 5.12.0, and is +now a syntax error. This allows future use of \f(CW\*(C`:=\*(C'\fR as a new token. +.PP +Outside the core's tests for it, we find no Perl 5 code on \s-1CPAN\s0 +using this construction, so we believe that this change will have +little impact on real-world codebases. +.PP +If it is absolutely necessary to have empty attribute lists (for example, +because of a code generator), simply avoid the error by adding a space before +the \f(CW\*(C`=\*(C'\fR. +.PP +\fIChange in the parsing of identifiers\fR +.IX Subsection "Change in the parsing of identifiers" +.PP +Characters outside the Unicode \*(L"XIDStart\*(R" set are no longer allowed at the +beginning of an identifier. This means that certain accents and marks +that normally follow an alphabetic character may no longer be the first +character of an identifier. +.SS "Threads and Processes" +.IX Subsection "Threads and Processes" +\fIDirectory handles not copied to threads\fR +.IX Subsection "Directory handles not copied to threads" +.PP +On systems other than Windows that do not have +a \f(CW\*(C`fchdir\*(C'\fR function, newly-created threads no +longer inherit directory handles from their parent threads. Such programs +would usually have crashed anyway [perl #75154]. +.PP +\fI\f(CI\*(C`close\*(C'\fI on shared pipes\fR +.IX Subsection "close on shared pipes" +.PP +To avoid deadlocks, the \f(CW\*(C`close\*(C'\fR function no longer waits for the +child process to exit if the underlying file descriptor is still +in use by another thread. It returns true in such cases. +.PP +\fI\f(BIfork()\fI emulation will not wait for signalled children\fR +.IX Subsection "fork() emulation will not wait for signalled children" +.PP +On Windows parent processes would not terminate until all forked +children had terminated first. However, \f(CW\*(C`kill("KILL", ...)\*(C'\fR is +inherently unstable on pseudo-processes, and \f(CW\*(C`kill("TERM", ...)\*(C'\fR +might not get delivered if the child is blocked in a system call. +.PP +To avoid the deadlock and still provide a safe mechanism to terminate +the hosting process, Perl now no longer waits for children that +have been sent a \s-1SIGTERM\s0 signal. It is up to the parent process to +\&\fBwaitpid()\fR for these children if child-cleanup processing must be +allowed to finish. However, it is also then the responsibility of the +parent to avoid the deadlock by making sure the child process +can't be blocked on I/O. +.PP +See perlfork for more information about the \fBfork()\fR emulation on +Windows. +.SS "Configuration" +.IX Subsection "Configuration" +\fINaming fixes in Policy_sh.SH may invalidate Policy.sh\fR +.IX Subsection "Naming fixes in Policy_sh.SH may invalidate Policy.sh" +.PP +Several long-standing typos and naming confusions in \fIPolicy_sh.SH\fR have +been fixed, standardizing on the variable names used in \fIconfig.sh\fR. +.PP +This will change the behaviour of \fIPolicy.sh\fR if you happen to have been +accidentally relying on its incorrect behaviour. +.PP +\fIPerl source code is read in text mode on Windows\fR +.IX Subsection "Perl source code is read in text mode on Windows" +.PP +Perl scripts used to be read in binary mode on Windows for the benefit +of the ByteLoader module (which is no longer part of core Perl). This +had the side-effect of breaking various operations on the \f(CW\*(C`DATA\*(C'\fR filehandle, +including \fBseek()\fR/\fBtell()\fR, and even simply reading from \f(CW\*(C`DATA\*(C'\fR after filehandles +have been flushed by a call to \fBsystem()\fR, backticks, \fBfork()\fR etc. +.PP +The default build options for Windows have been changed to read Perl source +code on Windows in text mode now. ByteLoader will (hopefully) be updated on +\&\s-1CPAN\s0 to automatically handle this situation [perl #28106]. +.SH "Deprecations" +.IX Header "Deprecations" +See also \*(L"Deprecated C APIs\*(R". +.SS "Omitting a space between a regular expression and subsequent word" +.IX Subsection "Omitting a space between a regular expression and subsequent word" +Omitting the space between a regular expression operator or +its modifiers and the following word is deprecated. For +example, \f(CW\*(C`m/foo/sand $bar\*(C'\fR is for now still parsed +as \f(CW\*(C`m/foo/s and $bar\*(C'\fR, but will now issue a warning. +.ie n .SS """\ec\f(CIX\fP""" +.el .SS "\f(CW\ec\fP\f(CIX\fP\f(CW\fP" +.IX Subsection "cX" +The backslash-c construct was designed as a way of specifying +non-printable characters, but there were no restrictions (on \s-1ASCII\s0 +platforms) on what the character following the \f(CW\*(C`c\*(C'\fR could be. Now, +a deprecation warning is raised if that character isn't an \s-1ASCII\s0 character. +Also, a deprecation warning is raised for \f(CW"\ec{"\fR (which is the same +as simply saying \f(CW";"\fR). +.ie n .SS """\eb{"" and ""\eB{""" +.el .SS "\f(CW``\eb{''\fP and \f(CW``\eB{''\fP" +.IX Subsection """b{"" and ""B{""" +In regular expressions, a literal \f(CW"{"\fR immediately following a \f(CW"\eb"\fR +(not in a bracketed character class) or a \f(CW"\eB{"\fR is now deprecated +to allow for its future use by Perl itself. +.SS "Perl 4\-era .pl libraries" +.IX Subsection "Perl 4-era .pl libraries" +Perl bundles a handful of library files that predate Perl 5. +This bundling is now deprecated for most of these files, which are now +available from \s-1CPAN.\s0 The affected files now warn when run, if they were +installed as part of the core. +.PP +This is a mandatory warning, not obeying \fB\-X\fR or lexical warning bits. +The warning is modelled on that supplied by \fIdeprecate.pm\fR for +deprecated-in-core \fI.pm\fR libraries. It points to the specific \s-1CPAN\s0 +distribution that contains the \fI.pl\fR libraries. The \s-1CPAN\s0 versions, of +course, do not generate the warning. +.ie n .SS "List assignment to $[" +.el .SS "List assignment to \f(CW$[\fP" +.IX Subsection "List assignment to $[" +Assignment to \f(CW$[\fR was deprecated and started to give warnings in +Perl version 5.12.0. This version of Perl (5.14) now also emits a warning +when assigning to \f(CW$[\fR in list context. This fixes an oversight in 5.12.0. +.SS "Use of qw(...) as parentheses" +.IX Subsection "Use of qw(...) as parentheses" +Historically the parser fooled itself into thinking that \f(CW\*(C`qw(...)\*(C'\fR literals +were always enclosed in parentheses, and as a result you could sometimes omit +parentheses around them: +.PP +.Vb 1 +\& for $x qw(a b c) { ... } +.Ve +.PP +The parser no longer lies to itself in this way. Wrap the list literal in +parentheses like this: +.PP +.Vb 1 +\& for $x (qw(a b c)) { ... } +.Ve +.PP +This is being deprecated because the parentheses in \f(CW\*(C`for $i (1,2,3) { ... }\*(C'\fR +are not part of expression syntax. They are part of the statement +syntax, with the \f(CW\*(C`for\*(C'\fR statement wanting literal parentheses. +The synthetic parentheses that a \f(CW\*(C`qw\*(C'\fR expression acquired were only +intended to be treated as part of expression syntax. +.PP +Note that this does not change the behaviour of cases like: +.PP +.Vb 2 +\& use POSIX qw(setlocale localeconv); +\& our @EXPORT = qw(foo bar baz); +.Ve +.PP +where parentheses were never required around the expression. +.ie n .SS """\eN{BELL}""" +.el .SS "\f(CW\eN{BELL}\fP" +.IX Subsection "N{BELL}" +This is because Unicode is using that name for a different character. +See \*(L"Unicode Version 6.0 is now supported (mostly)\*(R" for more +explanation. +.ie n .SS """?PATTERN?""" +.el .SS "\f(CW?PATTERN?\fP" +.IX Subsection "?PATTERN?" +\&\f(CW\*(C`?PATTERN?\*(C'\fR (without the initial \f(CW\*(C`m\*(C'\fR) has been deprecated and now produces +a warning. This is to allow future use of \f(CW\*(C`?\*(C'\fR in new operators. +The match-once functionality is still available as \f(CW\*(C`m?PATTERN?\*(C'\fR. +.SS "Tie functions on scalars holding typeglobs" +.IX Subsection "Tie functions on scalars holding typeglobs" +Calling a tie function (\f(CW\*(C`tie\*(C'\fR, \f(CW\*(C`tied\*(C'\fR, \f(CW\*(C`untie\*(C'\fR) with a scalar argument +acts on a filehandle if the scalar happens to hold a typeglob. +.PP +This is a long-standing bug that will be removed in Perl 5.16, as +there is currently no way to tie the scalar itself when it holds +a typeglob, and no way to untie a scalar that has had a typeglob +assigned to it. +.PP +Now there is a deprecation warning whenever a tie +function is used on a handle without an explicit \f(CW\*(C`*\*(C'\fR. +.SS "User-defined case-mapping" +.IX Subsection "User-defined case-mapping" +This feature is being deprecated due to its many issues, as documented in +\&\*(L"User-Defined Case Mappings (for serious hackers only)\*(R" in perlunicode. +This feature will be removed in Perl 5.16. Instead use the \s-1CPAN\s0 module +Unicode::Casing, which provides improved functionality. +.SS "Deprecated modules" +.IX Subsection "Deprecated modules" +The following module will be removed from the core distribution in a +future release, and should be installed from \s-1CPAN\s0 instead. Distributions +on \s-1CPAN\s0 that require this should add it to their prerequisites. The +core version of these module now issues a deprecation warning. +.PP +If you ship a packaged version of Perl, either alone or as part of a +larger system, then you should carefully consider the repercussions of +core module deprecations. You may want to consider shipping your default +build of Perl with a package for the deprecated module that +installs into \f(CW\*(C`vendor\*(C'\fR or \f(CW\*(C`site\*(C'\fR Perl library directories. This will +inhibit the deprecation warnings. +.PP +Alternatively, you may want to consider patching \fIlib/deprecate.pm\fR +to provide deprecation warnings specific to your packaging system +or distribution of Perl, consistent with how your packaging system +or distribution manages a staged transition from a release where the +installation of a single package provides the given functionality, to +a later release where the system administrator needs to know to install +multiple packages to get that same functionality. +.PP +You can silence these deprecation warnings by installing the module +in question from \s-1CPAN.\s0 To install the latest version of it by role +rather than by name, just install \f(CW\*(C`Task::Deprecations::5_14\*(C'\fR. +.IP "Devel::DProf" 4 +.IX Item "Devel::DProf" +We strongly recommend that you install and use Devel::NYTProf instead +of Devel::DProf, as Devel::NYTProf offers significantly +improved profiling and reporting. +.SH "Performance Enhancements" +.IX Header "Performance Enhancements" +.ie n .SS """Safe signals"" optimisation" +.el .SS "``Safe signals'' optimisation" +.IX Subsection "Safe signals optimisation" +Signal dispatch has been moved from the runloop into control ops. +This should give a few percent speed increase, and eliminates nearly +all the speed penalty caused by the introduction of \*(L"safe signals\*(R" +in 5.8.0. Signals should still be dispatched within the same +statement as they were previously. If this does \fInot\fR happen, or +if you find it possible to create uninterruptible loops, this is a +bug, and reports are encouraged of how to recreate such issues. +.SS "Optimisation of \fBshift()\fP and \fBpop()\fP calls without arguments" +.IX Subsection "Optimisation of shift() and pop() calls without arguments" +Two fewer OPs are used for \fBshift()\fR and \fBpop()\fR calls with no argument (with +implicit \f(CW@_\fR). This change makes \fBshift()\fR 5% faster than \f(CW\*(C`shift @_\*(C'\fR +on non-threaded perls, and 25% faster on threaded ones. +.SS "Optimisation of regexp engine string comparison work" +.IX Subsection "Optimisation of regexp engine string comparison work" +The \f(CW\*(C`foldEQ_utf8\*(C'\fR \s-1API\s0 function for case-insensitive comparison of strings (which +is used heavily by the regexp engine) was substantially refactored and +optimised \*(-- and its documentation much improved as a free bonus. +.SS "Regular expression compilation speed-up" +.IX Subsection "Regular expression compilation speed-up" +Compiling regular expressions has been made faster when upgrading +the regex to utf8 is necessary but this isn't known when the compilation begins. +.SS "String appending is 100 times faster" +.IX Subsection "String appending is 100 times faster" +When doing a lot of string appending, perls built to use the system's +\&\f(CW\*(C`malloc\*(C'\fR could end up allocating a lot more memory than needed in a +inefficient way. +.PP +\&\f(CW\*(C`sv_grow\*(C'\fR, the function used to allocate more memory if necessary +when appending to a string, has been taught to round up the memory +it requests to a certain geometric progression, making it much faster on +certain platforms and configurations. On Win32, it's now about 100 times +faster. +.ie n .SS "Eliminate ""PL_*"" accessor functions under ithreads" +.el .SS "Eliminate \f(CWPL_*\fP accessor functions under ithreads" +.IX Subsection "Eliminate PL_* accessor functions under ithreads" +When \f(CW\*(C`MULTIPLICITY\*(C'\fR was first developed, and interpreter state moved into +an interpreter struct, thread\- and interpreter-local \f(CW\*(C`PL_*\*(C'\fR variables +were defined as macros that called accessor functions (returning the +address of the value) outside the Perl core. The intent was to allow +members within the interpreter struct to change size without breaking +binary compatibility, so that bug fixes could be merged to a maintenance +branch that necessitated such a size change. This mechanism was redundant +and penalised well-behaved code. It has been removed. +.SS "Freeing weak references" +.IX Subsection "Freeing weak references" +When there are many weak references to an object, freeing that object +can under some circumstances take O(\fIN*N\fR) time to free, where +\&\fIN\fR is the number of references. The circumstances in which this can happen +have been reduced [perl #75254] +.SS "Lexical array and hash assignments" +.IX Subsection "Lexical array and hash assignments" +An earlier optimisation to speed up \f(CW\*(C`my @array = ...\*(C'\fR and +\&\f(CW\*(C`my %hash = ...\*(C'\fR assignments caused a bug and was disabled in Perl 5.12.0. +.PP +Now we have found another way to speed up these assignments [perl #82110]. +.ie n .SS "@_ uses less memory" +.el .SS "\f(CW@_\fP uses less memory" +.IX Subsection "@_ uses less memory" +Previously, \f(CW@_\fR was allocated for every subroutine at compile time with +enough space for four entries. Now this allocation is done on demand when +the subroutine is called [perl #72416]. +.SS "Size optimisations to \s-1SV\s0 and \s-1HV\s0 structures" +.IX Subsection "Size optimisations to SV and HV structures" +\&\f(CW\*(C`xhv_fill\*(C'\fR has been eliminated from \f(CW\*(C`struct xpvhv\*(C'\fR, saving 1 \s-1IV\s0 per hash and +on some systems will cause \f(CW\*(C`struct xpvhv\*(C'\fR to become cache-aligned. To avoid +this memory saving causing a slowdown elsewhere, boolean use of \f(CW\*(C`HvFILL\*(C'\fR +now calls \f(CW\*(C`HvTOTALKEYS\*(C'\fR instead (which is equivalent), so while the fill +data when actually required are now calculated on demand, cases when +this needs to be done should be rare. +.PP +The order of structure elements in \s-1SV\s0 bodies has changed. Effectively, +the \s-1NV\s0 slot has swapped location with \s-1STASH\s0 and \s-1MAGIC.\s0 As all access to +\&\s-1SV\s0 members is via macros, this should be completely transparent. This +change allows the space saving for PVHVs documented above, and may reduce +the memory allocation needed for PVIVs on some architectures. +.PP +\&\f(CW\*(C`XPV\*(C'\fR, \f(CW\*(C`XPVIV\*(C'\fR, and \f(CW\*(C`XPVNV\*(C'\fR now allocate only the parts of the \f(CW\*(C`SV\*(C'\fR body +they actually use, saving some space. +.PP +Scalars containing regular expressions now allocate only the part of the \f(CW\*(C`SV\*(C'\fR +body they actually use, saving some space. +.SS "Memory consumption improvements to Exporter" +.IX Subsection "Memory consumption improvements to Exporter" +The \f(CW@EXPORT_FAIL\fR \s-1AV\s0 is no longer created unless needed, hence neither is +the typeglob backing it. This saves about 200 bytes for every package that +uses Exporter but doesn't use this functionality. +.SS "Memory savings for weak references" +.IX Subsection "Memory savings for weak references" +For weak references, the common case of just a single weak reference +per referent has been optimised to reduce the storage required. In this +case it saves the equivalent of one small Perl array per referent. +.ie n .SS """%+"" and ""%\-"" use less memory" +.el .SS "\f(CW%+\fP and \f(CW%\-\fP use less memory" +.IX Subsection "%+ and %- use less memory" +The bulk of the \f(CW\*(C`Tie::Hash::NamedCapture\*(C'\fR module used to be in the Perl +core. It has now been moved to an \s-1XS\s0 module to reduce overhead for +programs that do not use \f(CW\*(C`%+\*(C'\fR or \f(CW\*(C`%\-\*(C'\fR. +.SS "Multiple small improvements to threads" +.IX Subsection "Multiple small improvements to threads" +The internal structures of threading now make fewer \s-1API\s0 calls and fewer +allocations, resulting in noticeably smaller object code. Additionally, +many thread context checks have been deferred so they're done only +as needed (although this is only possible for non-debugging builds). +.SS "Adjacent pairs of nextstate opcodes are now optimized away" +.IX Subsection "Adjacent pairs of nextstate opcodes are now optimized away" +Previously, in code such as +.PP +.Vb 1 +\& use constant DEBUG => 0; +\& +\& sub GAK { +\& warn if DEBUG; +\& print "stuff\en"; +\& } +.Ve +.PP +the ops for \f(CW\*(C`warn if DEBUG\*(C'\fR would be folded to a \f(CW\*(C`null\*(C'\fR op (\f(CW\*(C`ex\-const\*(C'\fR), but +the \f(CW\*(C`nextstate\*(C'\fR op would remain, resulting in a runtime op dispatch of +\&\f(CW\*(C`nextstate\*(C'\fR, \f(CW\*(C`nextstate\*(C'\fR, etc. +.PP +The execution of a sequence of \f(CW\*(C`nextstate\*(C'\fR ops is indistinguishable from just +the last \f(CW\*(C`nextstate\*(C'\fR op so the peephole optimizer now eliminates the first of +a pair of \f(CW\*(C`nextstate\*(C'\fR ops except when the first carries a label, since labels +must not be eliminated by the optimizer, and label usage isn't conclusively known +at compile time. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "New Modules and Pragmata" +.IX Subsection "New Modules and Pragmata" +.IP "\(bu" 4 +CPAN::Meta::YAML 0.003 has been added as a dual-life module. It supports a +subset of \s-1YAML\s0 sufficient for reading and writing \fI\s-1META\s0.yml\fR and \fI\s-1MYMETA\s0.yml\fR files +included with \s-1CPAN\s0 distributions or generated by the module installation +toolchain. It should not be used for any other general \s-1YAML\s0 parsing or +generation task. +.IP "\(bu" 4 +CPAN::Meta version 2.110440 has been added as a dual-life module. It +provides a standard library to read, interpret and write \s-1CPAN\s0 distribution +metadata files (like \fI\s-1META\s0.json\fR and \fI\s-1META\s0.yml\fR) that describe a +distribution, its contents, and the requirements for building it and +installing it. The latest \s-1CPAN\s0 distribution metadata specification is +included as CPAN::Meta::Spec and notes on changes in the specification +over time are given in CPAN::Meta::History. +.IP "\(bu" 4 +HTTP::Tiny 0.012 has been added as a dual-life module. It is a very +small, simple \s-1HTTP/1.1\s0 client designed for simple \s-1GET\s0 requests and file +mirroring. It has been added so that \fI\s-1CPAN\s0.pm\fR and \s-1CPANPLUS\s0 can +\&\*(L"bootstrap\*(R" \s-1HTTP\s0 access to \s-1CPAN\s0 using pure Perl without relying on external +binaries like \fBcurl\fR\|(1) or \fBwget\fR\|(1). +.IP "\(bu" 4 +\&\s-1JSON::PP\s0 2.27105 has been added as a dual-life module to allow \s-1CPAN\s0 +clients to read \fI\s-1META\s0.json\fR files in \s-1CPAN\s0 distributions. +.IP "\(bu" 4 +Module::Metadata 1.000004 has been added as a dual-life module. It gathers +package and \s-1POD\s0 information from Perl module files. It is a standalone module +based on Module::Build::ModuleInfo for use by other module installation +toolchain components. Module::Build::ModuleInfo has been deprecated in +favor of this module instead. +.IP "\(bu" 4 +Perl::OSType 1.002 has been added as a dual-life module. It maps Perl +operating system names (like \*(L"dragonfly\*(R" or \*(L"MSWin32\*(R") to more generic types +with standardized names (like \*(L"Unix\*(R" or \*(L"Windows\*(R"). It has been refactored +out of Module::Build and ExtUtils::CBuilder and consolidates such mappings into +a single location for easier maintenance. +.IP "\(bu" 4 +The following modules were added by the Unicode::Collate +upgrade. See below for details. +.Sp +Unicode::Collate::CJK::Big5 +.Sp +Unicode::Collate::CJK::GB2312 +.Sp +Unicode::Collate::CJK::JISX0208 +.Sp +Unicode::Collate::CJK::Korean +.Sp +Unicode::Collate::CJK::Pinyin +.Sp +Unicode::Collate::CJK::Stroke +.IP "\(bu" 4 +Version::Requirements version 0.101020 has been added as a dual-life +module. It provides a standard library to model and manipulates module +prerequisites and version constraints defined in CPAN::Meta::Spec. +.SS "Updated Modules and Pragma" +.IX Subsection "Updated Modules and Pragma" +.IP "\(bu" 4 +attributes has been upgraded from version 0.12 to 0.14. +.IP "\(bu" 4 +Archive::Extract has been upgraded from version 0.38 to 0.48. +.Sp +Updates since 0.38 include: a safe print method that guards +Archive::Extract from changes to \f(CW\*(C`$\e\*(C'\fR; a fix to the tests when run in core +Perl; support for \s-1TZ\s0 files; a modification for the lzma +logic to favour IO::Uncompress::Unlzma; and a fix +for an issue with NetBSD-current and its new \fBunzip\fR\|(1) +executable. +.IP "\(bu" 4 +Archive::Tar has been upgraded from version 1.54 to 1.76. +.Sp +Important changes since 1.54 include the following: +.RS 4 +.IP "\(bu" 4 +Compatibility with busybox implementations of \fBtar\fR\|(1). +.IP "\(bu" 4 +A fix so that \fBwrite()\fR and \fBcreate_archive()\fR +close only filehandles they themselves opened. +.IP "\(bu" 4 +A bug was fixed regarding the exit code of extract_archive. +.IP "\(bu" 4 +The \fBptar\fR\|(1) utility has a new option to allow safe creation of +tarballs without world-writable files on Windows, allowing those +archives to be uploaded to \s-1CPAN.\s0 +.IP "\(bu" 4 +A new \fBptargrep\fR\|(1) utility for using regular expressions against +the contents of files in a tar archive. +.IP "\(bu" 4 +pax extended headers are now skipped. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +Attribute::Handlers has been upgraded from version 0.87 to 0.89. +.IP "\(bu" 4 +autodie has been upgraded from version 2.06_01 to 2.1001. +.IP "\(bu" 4 +AutoLoader has been upgraded from version 5.70 to 5.71. +.IP "\(bu" 4 +The B module has been upgraded from version 1.23 to 1.29. +.Sp +It no longer crashes when taking apart a \f(CW\*(C`y///\*(C'\fR containing characters +outside the octet range or compiled in a \f(CW\*(C`use utf8\*(C'\fR scope. +.Sp +The size of the shared object has been reduced by about 40%, with no +reduction in functionality. +.IP "\(bu" 4 +B::Concise has been upgraded from version 0.78 to 0.83. +.Sp +B::Concise marks \fBrv2sv()\fR, \fBrv2av()\fR, and \fBrv2hv()\fR ops with the new +\&\f(CW\*(C`OPpDEREF\*(C'\fR flag as \*(L"DREFed\*(R". +.Sp +It no longer produces mangled output with the \fB\-tree\fR option +[perl #80632]. +.IP "\(bu" 4 +B::Debug has been upgraded from version 1.12 to 1.16. +.IP "\(bu" 4 +B::Deparse has been upgraded from version 0.96 to 1.03. +.Sp +The deparsing of a \f(CW\*(C`nextstate\*(C'\fR op has changed when it has both a +change of package relative to the previous nextstate, or a change of +\&\f(CW\*(C`%^H\*(C'\fR or other state and a label. The label was previously emitted +first, but is now emitted last (5.12.1). +.Sp +The \f(CW\*(C`no 5.13.2\*(C'\fR or similar form is now correctly handled by B::Deparse +(5.12.3). +.Sp +B::Deparse now properly handles the code that applies a conditional +pattern match against implicit \f(CW$_\fR as it was fixed in [perl #20444]. +.Sp +Deparsing of \f(CW\*(C`our\*(C'\fR followed by a variable with funny characters +(as permitted under the \f(CW\*(C`use utf8\*(C'\fR pragma) has also been fixed [perl #33752]. +.IP "\(bu" 4 +B::Lint has been upgraded from version 1.11_01 to 1.13. +.IP "\(bu" 4 +base has been upgraded from version 2.15 to 2.16. +.IP "\(bu" 4 +Benchmark has been upgraded from version 1.11 to 1.12. +.IP "\(bu" 4 +bignum has been upgraded from version 0.23 to 0.27. +.IP "\(bu" 4 +Carp has been upgraded from version 1.15 to 1.20. +.Sp +Carp now detects incomplete \fBcaller()\fR +overrides and avoids using bogus \f(CW@DB::args\fR. To provide backtraces, +Carp relies on particular behaviour of the \fBcaller()\fR builtin. +Carp now detects if other code has overridden this with an +incomplete implementation, and modifies its backtrace accordingly. +Previously incomplete overrides would cause incorrect values in +backtraces (best case), or obscure fatal errors (worst case). +.Sp +This fixes certain cases of \*(L"Bizarre copy of \s-1ARRAY\*(R"\s0 caused by modules +overriding \fBcaller()\fR incorrectly (5.12.2). +.Sp +It now also avoids using regular expressions that cause Perl to +load its Unicode tables, so as to avoid the \*(L"\s-1BEGIN\s0 not safe after +errors\*(R" error that ensue if there has been a syntax error +[perl #82854]. +.IP "\(bu" 4 +\&\s-1CGI\s0 has been upgraded from version 3.48 to 3.52. +.Sp +This provides the following security fixes: the \s-1MIME\s0 boundary in +\&\fBmultipart_init()\fR is now random and the handling of +newlines embedded in header values has been improved. +.IP "\(bu" 4 +Compress::Raw::Bzip2 has been upgraded from version 2.024 to 2.033. +.Sp +It has been updated to use \fBbzip2\fR\|(1) 1.0.6. +.IP "\(bu" 4 +Compress::Raw::Zlib has been upgraded from version 2.024 to 2.033. +.IP "\(bu" 4 +constant has been upgraded from version 1.20 to 1.21. +.Sp +Unicode constants work once more. They have been broken since Perl 5.10.0 +[\s-1CPAN RT\s0 #67525]. +.IP "\(bu" 4 +\&\s-1CPAN\s0 has been upgraded from version 1.94_56 to 1.9600. +.Sp +Major highlights: +.RS 4 +.IP "\(bu" 4 +much less configuration dialog hassle +.IP "\(bu" 4 +support for \fI\s-1META/MYMETA\s0.json\fR +.IP "\(bu" 4 +support for local::lib +.IP "\(bu" 4 +support for HTTP::Tiny to reduce the dependency on \s-1FTP\s0 sites +.IP "\(bu" 4 +automatic mirror selection +.IP "\(bu" 4 +iron out all known bugs in configure_requires +.IP "\(bu" 4 +support for distributions compressed with \fBbzip2\fR\|(1) +.IP "\(bu" 4 +allow \fIFoo/Bar.pm\fR on the command line to mean \f(CW\*(C`Foo::Bar\*(C'\fR +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\s-1CPANPLUS\s0 has been upgraded from version 0.90 to 0.9103. +.Sp +A change to \fIcpanp-run-perl\fR +resolves \s-1RT\s0 #55964 +and \s-1RT\s0 #57106 , both +of which related to failures to install distributions that use +\&\f(CW\*(C`Module::Install::DSL\*(C'\fR (5.12.2). +.Sp +A dependency on Config was not recognised as a +core module dependency. This has been fixed. +.Sp +\&\s-1CPANPLUS\s0 now includes support for \fI\s-1META\s0.json\fR and \fI\s-1MYMETA\s0.json\fR. +.IP "\(bu" 4 +CPANPLUS::Dist::Build has been upgraded from version 0.46 to 0.54. +.IP "\(bu" 4 +Data::Dumper has been upgraded from version 2.125 to 2.130_02. +.Sp +The indentation used to be off when \f(CW$Data::Dumper::Terse\fR was set. This +has been fixed [perl #73604]. +.Sp +This upgrade also fixes a crash when using custom sort functions that might +cause the stack to change [perl #74170]. +.Sp +Dumpxs no longer crashes with globs returned by \f(CW*$io_ref\fR +[perl #72332]. +.IP "\(bu" 4 +DB_File has been upgraded from version 1.820 to 1.821. +.IP "\(bu" 4 +DBM_Filter has been upgraded from version 0.03 to 0.04. +.IP "\(bu" 4 +Devel::DProf has been upgraded from version 20080331.00 to 20110228.00. +.Sp +Merely loading Devel::DProf now no longer triggers profiling to start. +Both \f(CW\*(C`use Devel::DProf\*(C'\fR and \f(CW\*(C`perl \-d:DProf ...\*(C'\fR behave as before and start +the profiler. +.Sp +\&\fB\s-1NOTE\s0\fR: Devel::DProf is deprecated and will be removed from a future +version of Perl. We strongly recommend that you install and use +Devel::NYTProf instead, as it offers significantly improved +profiling and reporting. +.IP "\(bu" 4 +Devel::Peek has been upgraded from version 1.04 to 1.07. +.IP "\(bu" 4 +Devel::SelfStubber has been upgraded from version 1.03 to 1.05. +.IP "\(bu" 4 +diagnostics has been upgraded from version 1.19 to 1.22. +.Sp +It now renders pod links slightly better, and has been taught to find +descriptions for messages that share their descriptions with other +messages. +.IP "\(bu" 4 +Digest::MD5 has been upgraded from version 2.39 to 2.51. +.Sp +It is now safe to use this module in combination with threads. +.IP "\(bu" 4 +Digest::SHA has been upgraded from version 5.47 to 5.61. +.Sp +\&\f(CW\*(C`shasum\*(C'\fR now more closely mimics \fBsha1sum\fR\|(1)/\fBmd5sum\fR\|(1). +.Sp +\&\f(CW\*(C`addfile\*(C'\fR accepts all \s-1POSIX\s0 filenames. +.Sp +New \s-1SHA\-512/224\s0 and \s-1SHA\-512/256\s0 transforms (ref. \s-1NIST\s0 Draft \s-1FIPS 180\-4\s0 +[February 2011]) +.IP "\(bu" 4 +DirHandle has been upgraded from version 1.03 to 1.04. +.IP "\(bu" 4 +Dumpvalue has been upgraded from version 1.13 to 1.16. +.IP "\(bu" 4 +DynaLoader has been upgraded from version 1.10 to 1.13. +.Sp +It fixes a buffer overflow when passed a very long file name. +.Sp +It no longer inherits from AutoLoader; hence it no longer +produces weird error messages for unsuccessful method calls on classes that +inherit from DynaLoader [perl #84358]. +.IP "\(bu" 4 +Encode has been upgraded from version 2.39 to 2.42. +.Sp +Now, all 66 Unicode non-characters are treated the same way U+FFFF has +always been treated: in cases when it was disallowed, all 66 are +disallowed, and in cases where it warned, all 66 warn. +.IP "\(bu" 4 +Env has been upgraded from version 1.01 to 1.02. +.IP "\(bu" 4 +Errno has been upgraded from version 1.11 to 1.13. +.Sp +The implementation of Errno has been refactored to use about 55% less memory. +.Sp +On some platforms with unusual header files, like Win32 \fBgcc\fR\|(1) using \f(CW\*(C`mingw64\*(C'\fR +headers, some constants that weren't actually error numbers have been exposed +by Errno. This has been fixed [perl #77416]. +.IP "\(bu" 4 +Exporter has been upgraded from version 5.64_01 to 5.64_03. +.Sp +Exporter no longer overrides \f(CW$SIG{_\|_WARN_\|_}\fR [perl #74472] +.IP "\(bu" 4 +ExtUtils::CBuilder has been upgraded from version 0.27 to 0.280203. +.IP "\(bu" 4 +ExtUtils::Command has been upgraded from version 1.16 to 1.17. +.IP "\(bu" 4 +ExtUtils::Constant has been upgraded from 0.22 to 0.23. +.Sp +The \s-1AUTOLOAD\s0 helper code generated by \f(CW\*(C`ExtUtils::Constant::ProxySubs\*(C'\fR +can now \fBcroak()\fR for missing constants, or generate a complete \f(CW\*(C`AUTOLOAD\*(C'\fR +subroutine in \s-1XS,\s0 allowing simplification of many modules that use it +(Fcntl, File::Glob, GDBM_File, I18N::Langinfo, \s-1POSIX\s0, +Socket). +.Sp +ExtUtils::Constant::ProxySubs can now optionally push the names of all +constants onto the package's \f(CW@EXPORT_OK\fR. +.IP "\(bu" 4 +ExtUtils::Install has been upgraded from version 1.55 to 1.56. +.IP "\(bu" 4 +ExtUtils::MakeMaker has been upgraded from version 6.56 to 6.57_05. +.IP "\(bu" 4 +ExtUtils::Manifest has been upgraded from version 1.57 to 1.58. +.IP "\(bu" 4 +ExtUtils::ParseXS has been upgraded from version 2.21 to 2.2210. +.IP "\(bu" 4 +Fcntl has been upgraded from version 1.06 to 1.11. +.IP "\(bu" 4 +File::Basename has been upgraded from version 2.78 to 2.82. +.IP "\(bu" 4 +File::CheckTree has been upgraded from version 4.4 to 4.41. +.IP "\(bu" 4 +File::Copy has been upgraded from version 2.17 to 2.21. +.IP "\(bu" 4 +File::DosGlob has been upgraded from version 1.01 to 1.04. +.Sp +It allows patterns containing literal parentheses: they no longer need to +be escaped. On Windows, it no longer +adds an extra \fI./\fR to file names +returned when the pattern is a relative glob with a drive specification, +like \fIC:*.pl\fR [perl #71712]. +.IP "\(bu" 4 +File::Fetch has been upgraded from version 0.24 to 0.32. +.Sp +HTTP::Lite is now supported for the \*(L"http\*(R" scheme. +.Sp +The \fBfetch\fR\|(1) utility is supported on FreeBSD, NetBSD, and +Dragonfly \s-1BSD\s0 for the \f(CW\*(C`http\*(C'\fR and \f(CW\*(C`ftp\*(C'\fR schemes. +.IP "\(bu" 4 +File::Find has been upgraded from version 1.15 to 1.19. +.Sp +It improves handling of backslashes on Windows, so that paths like +\&\fIC:\edir\e/file\fR are no longer generated [perl #71710]. +.IP "\(bu" 4 +File::Glob has been upgraded from version 1.07 to 1.12. +.IP "\(bu" 4 +File::Spec has been upgraded from version 3.31 to 3.33. +.Sp +Several portability fixes were made in File::Spec::VMS: a colon is now +recognized as a delimiter in native filespecs; caret-escaped delimiters are +recognized for better handling of extended filespecs; \fBcatpath()\fR returns +an empty directory rather than the current directory if the input directory +name is empty; and \fBabs2rel()\fR properly handles Unix-style input (5.12.2). +.IP "\(bu" 4 +File::stat has been upgraded from 1.02 to 1.05. +.Sp +The \f(CW\*(C`\-x\*(C'\fR and \f(CW\*(C`\-X\*(C'\fR file test operators now work correctly when run +by the superuser. +.IP "\(bu" 4 +Filter::Simple has been upgraded from version 0.84 to 0.86. +.IP "\(bu" 4 +GDBM_File has been upgraded from 1.10 to 1.14. +.Sp +This fixes a memory leak when \s-1DBM\s0 filters are used. +.IP "\(bu" 4 +Hash::Util has been upgraded from 0.07 to 0.11. +.Sp +Hash::Util no longer emits spurious \*(L"uninitialized\*(R" warnings when +recursively locking hashes that have undefined values [perl #74280]. +.IP "\(bu" 4 +Hash::Util::FieldHash has been upgraded from version 1.04 to 1.09. +.IP "\(bu" 4 +I18N::Collate has been upgraded from version 1.01 to 1.02. +.IP "\(bu" 4 +I18N::Langinfo has been upgraded from version 0.03 to 0.08. +.Sp +\&\fBlanginfo()\fR now defaults to using \f(CW$_\fR if there is no argument given, just +as the documentation has always claimed. +.IP "\(bu" 4 +I18N::LangTags has been upgraded from version 0.35 to 0.35_01. +.IP "\(bu" 4 +if has been upgraded from version 0.05 to 0.0601. +.IP "\(bu" 4 +\&\s-1IO\s0 has been upgraded from version 1.25_02 to 1.25_04. +.Sp +This version of \s-1IO\s0 includes a new IO::Select, which now allows IO::Handle +objects (and objects in derived classes) to be removed from an IO::Select set +even if the underlying file descriptor is closed or invalid. +.IP "\(bu" 4 +IPC::Cmd has been upgraded from version 0.54 to 0.70. +.Sp +Resolves an issue with splitting Win32 command lines. An argument +consisting of the single character \*(L"0\*(R" used to be omitted (\s-1CPAN RT\s0 #62961). +.IP "\(bu" 4 +IPC::Open3 has been upgraded from 1.05 to 1.09. +.Sp +\&\fBopen3()\fR now produces an error if the \f(CW\*(C`exec\*(C'\fR call fails, allowing this +condition to be distinguished from a child process that exited with a +non-zero status [perl #72016]. +.Sp +The internal \fBxclose()\fR routine now knows how to handle file descriptors as +documented, so duplicating \f(CW\*(C`STDIN\*(C'\fR in a child process using its file +descriptor now works [perl #76474]. +.IP "\(bu" 4 +IPC::SysV has been upgraded from version 2.01 to 2.03. +.IP "\(bu" 4 +lib has been upgraded from version 0.62 to 0.63. +.IP "\(bu" 4 +Locale::Maketext has been upgraded from version 1.14 to 1.19. +.Sp +Locale::Maketext now supports external caches. +.Sp +This upgrade also fixes an infinite loop in +\&\f(CW\*(C`Locale::Maketext::Guts::_compile()\*(C'\fR when +working with tainted values (\s-1CPAN RT\s0 #40727). +.Sp +\&\f(CW\*(C`\->maketext\*(C'\fR calls now back up and restore \f(CW$@\fR so error +messages are not suppressed (\s-1CPAN RT\s0 #34182). +.IP "\(bu" 4 +Log::Message has been upgraded from version 0.02 to 0.04. +.IP "\(bu" 4 +Log::Message::Simple has been upgraded from version 0.06 to 0.08. +.IP "\(bu" 4 +Math::BigInt has been upgraded from version 1.89_01 to 1.994. +.Sp +This fixes, among other things, incorrect results when computing binomial +coefficients [perl #77640]. +.Sp +It also prevents \f(CW\*(C`sqrt($int)\*(C'\fR from crashing under \f(CW\*(C`use bigrat\*(C'\fR. +[perl #73534]. +.IP "\(bu" 4 +Math::BigInt::FastCalc has been upgraded from version 0.19 to 0.28. +.IP "\(bu" 4 +Math::BigRat has been upgraded from version 0.24 to 0.26_02. +.IP "\(bu" 4 +Memoize has been upgraded from version 1.01_03 to 1.02. +.IP "\(bu" 4 +MIME::Base64 has been upgraded from 3.08 to 3.13. +.Sp +Includes new functions to calculate the length of encoded and decoded +base64 strings. +.Sp +Now provides \fBencode_base64url()\fR and \fBdecode_base64url()\fR functions to process +the base64 scheme for \*(L"\s-1URL\s0 applications\*(R". +.IP "\(bu" 4 +Module::Build has been upgraded from version 0.3603 to 0.3800. +.Sp +A notable change is the deprecation of several modules. +Module::Build::Version has been deprecated and Module::Build now +relies on the version pragma directly. Module::Build::ModuleInfo has +been deprecated in favor of a standalone copy called Module::Metadata. +Module::Build::YAML has been deprecated in favor of CPAN::Meta::YAML. +.Sp +Module::Build now also generates \fI\s-1META\s0.json\fR and \fI\s-1MYMETA\s0.json\fR files +in accordance with version 2 of the \s-1CPAN\s0 distribution metadata specification, +CPAN::Meta::Spec. The older format \fI\s-1META\s0.yml\fR and \fI\s-1MYMETA\s0.yml\fR files are +still generated. +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 2.29 to 2.47. +.Sp +Besides listing the updated core modules of this release, it also stops listing +the \f(CW\*(C`Filespec\*(C'\fR module. That module never existed in core. The scripts +generating Module::CoreList confused it with VMS::Filespec, which actually +is a core module as of Perl 5.8.7. +.IP "\(bu" 4 +Module::Load has been upgraded from version 0.16 to 0.18. +.IP "\(bu" 4 +Module::Load::Conditional has been upgraded from version 0.34 to 0.44. +.IP "\(bu" 4 +The mro pragma has been upgraded from version 1.02 to 1.07. +.IP "\(bu" 4 +NDBM_File has been upgraded from version 1.08 to 1.12. +.Sp +This fixes a memory leak when \s-1DBM\s0 filters are used. +.IP "\(bu" 4 +Net::Ping has been upgraded from version 2.36 to 2.38. +.IP "\(bu" 4 +\&\s-1NEXT\s0 has been upgraded from version 0.64 to 0.65. +.IP "\(bu" 4 +Object::Accessor has been upgraded from version 0.36 to 0.38. +.IP "\(bu" 4 +ODBM_File has been upgraded from version 1.07 to 1.10. +.Sp +This fixes a memory leak when \s-1DBM\s0 filters are used. +.IP "\(bu" 4 +Opcode has been upgraded from version 1.15 to 1.18. +.IP "\(bu" 4 +The overload pragma has been upgraded from 1.10 to 1.13. +.Sp +\&\f(CW\*(C`overload::Method\*(C'\fR can now handle subroutines that are themselves blessed +into overloaded classes [perl #71998]. +.Sp +The documentation has greatly improved. See \*(L"Documentation\*(R" below. +.IP "\(bu" 4 +Params::Check has been upgraded from version 0.26 to 0.28. +.IP "\(bu" 4 +The parent pragma has been upgraded from version 0.223 to 0.225. +.IP "\(bu" 4 +Parse::CPAN::Meta has been upgraded from version 1.40 to 1.4401. +.Sp +The latest Parse::CPAN::Meta can now read \s-1YAML\s0 and \s-1JSON\s0 files using +CPAN::Meta::YAML and \s-1JSON::PP\s0, which are now part of the Perl core. +.IP "\(bu" 4 +PerlIO::encoding has been upgraded from version 0.12 to 0.14. +.IP "\(bu" 4 +PerlIO::scalar has been upgraded from 0.07 to 0.11. +.Sp +A \fBread()\fR after a \fBseek()\fR beyond the end of the string no longer thinks it +has data to read [perl #78716]. +.IP "\(bu" 4 +PerlIO::via has been upgraded from version 0.09 to 0.11. +.IP "\(bu" 4 +Pod::Html has been upgraded from version 1.09 to 1.11. +.IP "\(bu" 4 +Pod::LaTeX has been upgraded from version 0.58 to 0.59. +.IP "\(bu" 4 +Pod::Perldoc has been upgraded from version 3.15_02 to 3.15_03. +.IP "\(bu" 4 +Pod::Simple has been upgraded from version 3.13 to 3.16. +.IP "\(bu" 4 +\&\s-1POSIX\s0 has been upgraded from 1.19 to 1.24. +.Sp +It now includes constants for \s-1POSIX\s0 signal constants. +.IP "\(bu" 4 +The re pragma has been upgraded from version 0.11 to 0.18. +.Sp +The \f(CW\*(C`use re \*(Aq/flags\*(Aq\*(C'\fR subpragma is new. +.Sp +The \fBregmust()\fR function used to crash when called on a regular expression +belonging to a pluggable engine. Now it croaks instead. +.Sp +\&\fBregmust()\fR no longer leaks memory. +.IP "\(bu" 4 +Safe has been upgraded from version 2.25 to 2.29. +.Sp +Coderefs returned by \fBreval()\fR and \fBrdo()\fR are now wrapped via +\&\fBwrap_code_refs()\fR (5.12.1). +.Sp +This fixes a possible infinite loop when looking for coderefs. +.Sp +It adds several \f(CW\*(C`version::vxs::*\*(C'\fR routines to the default share. +.IP "\(bu" 4 +SDBM_File has been upgraded from version 1.06 to 1.09. +.IP "\(bu" 4 +SelfLoader has been upgraded from 1.17 to 1.18. +.Sp +It now works in taint mode [perl #72062]. +.IP "\(bu" 4 +The sigtrap pragma has been upgraded from version 1.04 to 1.05. +.Sp +It no longer tries to modify read-only arguments when generating a +backtrace [perl #72340]. +.IP "\(bu" 4 +Socket has been upgraded from version 1.87 to 1.94. +.Sp +See \*(L"Improved IPv6 support\*(R" above. +.IP "\(bu" 4 +Storable has been upgraded from version 2.22 to 2.27. +.Sp +Includes performance improvement for overloaded classes. +.Sp +This adds support for serialising code references that contain \s-1UTF\-8\s0 strings +correctly. The Storable minor version +number changed as a result, meaning that +Storable users who set \f(CW$Storable::accept_future_minor\fR to a \f(CW\*(C`FALSE\*(C'\fR value +will see errors (see \*(L"\s-1FORWARD COMPATIBILITY\*(R"\s0 in Storable for more details). +.Sp +Freezing no longer gets confused if the Perl stack gets reallocated +during freezing [perl #80074]. +.IP "\(bu" 4 +Sys::Hostname has been upgraded from version 1.11 to 1.16. +.IP "\(bu" 4 +Term::ANSIColor has been upgraded from version 2.02 to 3.00. +.IP "\(bu" 4 +Term::UI has been upgraded from version 0.20 to 0.26. +.IP "\(bu" 4 +Test::Harness has been upgraded from version 3.17 to 3.23. +.IP "\(bu" 4 +Test::Simple has been upgraded from version 0.94 to 0.98. +.Sp +Among many other things, subtests without a \f(CW\*(C`plan\*(C'\fR or \f(CW\*(C`no_plan\*(C'\fR now have an +implicit \fBdone_testing()\fR added to them. +.IP "\(bu" 4 +Thread::Semaphore has been upgraded from version 2.09 to 2.12. +.Sp +It provides two new methods that give more control over the decrementing of +semaphores: \f(CW\*(C`down_nb\*(C'\fR and \f(CW\*(C`down_force\*(C'\fR. +.IP "\(bu" 4 +Thread::Queue has been upgraded from version 2.11 to 2.12. +.IP "\(bu" 4 +The threads pragma has been upgraded from version 1.75 to 1.83. +.IP "\(bu" 4 +The threads::shared pragma has been upgraded from version 1.32 to 1.37. +.IP "\(bu" 4 +Tie::Hash has been upgraded from version 1.03 to 1.04. +.Sp +Calling \f(CW\*(C`Tie::Hash\->TIEHASH()\*(C'\fR used to loop forever. Now it \f(CW\*(C`croak\*(C'\fRs. +.IP "\(bu" 4 +Tie::Hash::NamedCapture has been upgraded from version 0.06 to 0.08. +.IP "\(bu" 4 +Tie::RefHash has been upgraded from version 1.38 to 1.39. +.IP "\(bu" 4 +Time::HiRes has been upgraded from version 1.9719 to 1.9721_01. +.IP "\(bu" 4 +Time::Local has been upgraded from version 1.1901_01 to 1.2000. +.IP "\(bu" 4 +Time::Piece has been upgraded from version 1.15_01 to 1.20_01. +.IP "\(bu" 4 +Unicode::Collate has been upgraded from version 0.52_01 to 0.73. +.Sp +Unicode::Collate has been updated to use Unicode 6.0.0. +.Sp +Unicode::Collate::Locale now supports a plethora of new locales: \fIar, be, +bg, de_\|_phonebook, hu, hy, kk, mk, nso, om, tn, vi, hr, ig, ja, ko, ru, sq, +se, sr, to, uk, zh, zh_\|_big5han, zh_\|_gb2312han, zh_\|_pinyin\fR, and \fIzh_\|_stroke\fR. +.Sp +The following modules have been added: +.Sp +Unicode::Collate::CJK::Big5 for \f(CW\*(C`zh_\|_big5han\*(C'\fR which makes +tailoring of \s-1CJK\s0 Unified Ideographs in the order of \s-1CLDR\s0's big5han ordering. +.Sp +Unicode::Collate::CJK::GB2312 for \f(CW\*(C`zh_\|_gb2312han\*(C'\fR which makes +tailoring of \s-1CJK\s0 Unified Ideographs in the order of \s-1CLDR\s0's gb2312han ordering. +.Sp +Unicode::Collate::CJK::JISX0208 which makes tailoring of 6355 kanji +(\s-1CJK\s0 Unified Ideographs) in the \s-1JIS X 0208\s0 order. +.Sp +Unicode::Collate::CJK::Korean which makes tailoring of \s-1CJK\s0 Unified Ideographs +in the order of \s-1CLDR\s0's Korean ordering. +.Sp +Unicode::Collate::CJK::Pinyin for \f(CW\*(C`zh_\|_pinyin\*(C'\fR which makes +tailoring of \s-1CJK\s0 Unified Ideographs in the order of \s-1CLDR\s0's pinyin ordering. +.Sp +Unicode::Collate::CJK::Stroke for \f(CW\*(C`zh_\|_stroke\*(C'\fR which makes +tailoring of \s-1CJK\s0 Unified Ideographs in the order of \s-1CLDR\s0's stroke ordering. +.Sp +This also sees the switch from using the pure-Perl version of this +module to the \s-1XS\s0 version. +.IP "\(bu" 4 +Unicode::Normalize has been upgraded from version 1.03 to 1.10. +.IP "\(bu" 4 +Unicode::UCD has been upgraded from version 0.27 to 0.32. +.Sp +A new function, \fBUnicode::UCD::num()\fR, has been added. This function +returns the numeric value of the string passed it or \f(CW\*(C`undef\*(C'\fR if the string +in its entirety has no \*(L"safe\*(R" numeric value. (For more detail, and for the +definition of \*(L"safe\*(R", see \*(L"\fBnum()\fR\*(R" in Unicode::UCD.) +.Sp +This upgrade also includes several bug fixes: +.RS 4 +.IP "\fBcharinfo()\fR" 4 +.IX Item "charinfo()" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +It is now updated to Unicode Version 6.0.0 with \fICorrigendum #8\fR, +excepting that, just as with Perl 5.14, the code point at U+1F514 has no name. +.IP "\(bu" 4 +Hangul syllable code points have the correct names, and their +decompositions are always output without requiring Lingua::KO::Hangul::Util +to be installed. +.IP "\(bu" 4 +\&\s-1CJK\s0 (Chinese-Japanese-Korean) code points U+2A700 to U+2B734 +and U+2B740 to U+2B81D are now properly handled. +.IP "\(bu" 4 +Numeric values are now output for those \s-1CJK\s0 code points that have them. +.IP "\(bu" 4 +Names output for code points with multiple aliases are now the +corrected ones. +.RE +.RS 4 +.RE +.IP "\fBcharscript()\fR" 4 +.IX Item "charscript()" +This now correctly returns \*(L"Unknown\*(R" instead of \f(CW\*(C`undef\*(C'\fR for the script +of a code point that hasn't been assigned another one. +.IP "\fBcharblock()\fR" 4 +.IX Item "charblock()" +This now correctly returns \*(L"No_Block\*(R" instead of \f(CW\*(C`undef\*(C'\fR for the block +of a code point that hasn't been assigned to another one. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +The version pragma has been upgraded from 0.82 to 0.88. +.Sp +Because of a bug, now fixed, the \fBis_strict()\fR and \fBis_lax()\fR functions did not +work when exported (5.12.1). +.IP "\(bu" 4 +The warnings pragma has been upgraded from version 1.09 to 1.12. +.Sp +Calling \f(CW\*(C`use warnings\*(C'\fR without arguments is now significantly more efficient. +.IP "\(bu" 4 +The warnings::register pragma has been upgraded from version 1.01 to 1.02. +.Sp +It is now possible to register warning categories other than the names of +packages using warnings::register. See \fBperllexwarn\fR\|(1) for more information. +.IP "\(bu" 4 +XSLoader has been upgraded from version 0.10 to 0.13. +.IP "\(bu" 4 +VMS::DCLsym has been upgraded from version 1.03 to 1.05. +.Sp +Two bugs have been fixed [perl #84086]: +.Sp +The symbol table name was lost when tying a hash, due to a thinko in +\&\f(CW\*(C`TIEHASH\*(C'\fR. The result was that all tied hashes interacted with the +local symbol table. +.Sp +Unless a symbol table name had been explicitly specified in the call +to the constructor, querying the special key \f(CW\*(C`:LOCAL\*(C'\fR failed to +identify objects connected to the local symbol table. +.IP "\(bu" 4 +The Win32 module has been upgraded from version 0.39 to 0.44. +.Sp +This release has several new functions: \fBWin32::GetSystemMetrics()\fR, +\&\fBWin32::GetProductInfo()\fR, \fBWin32::GetOSDisplayName()\fR. +.Sp +The names returned by \fBWin32::GetOSName()\fR and \fBWin32::GetOSDisplayName()\fR +have been corrected. +.IP "\(bu" 4 +XS::Typemap has been upgraded from version 0.03 to 0.05. +.SS "Removed Modules and Pragmata" +.IX Subsection "Removed Modules and Pragmata" +As promised in Perl 5.12.0's release notes, the following modules have +been removed from the core distribution, and if needed should be installed +from \s-1CPAN\s0 instead. +.IP "\(bu" 4 +Class::ISA has been removed from the Perl core. Prior version was 0.36. +.IP "\(bu" 4 +Pod::Plainer has been removed from the Perl core. Prior version was 1.02. +.IP "\(bu" 4 +Switch has been removed from the Perl core. Prior version was 2.16. +.PP +The removal of Shell has been deferred until after 5.14, as the +implementation of Shell shipped with 5.12.0 did not correctly issue the +warning that it was to be removed from core. +.SH "Documentation" +.IX Header "Documentation" +.SS "New Documentation" +.IX Subsection "New Documentation" +\fIperlgpl\fR +.IX Subsection "perlgpl" +.PP +perlgpl has been updated to contain \s-1GPL\s0 version 1, as is included in the +\&\fI\s-1README\s0\fR distributed with Perl (5.12.1). +.PP +\fIPerl 5.12.x delta files\fR +.IX Subsection "Perl 5.12.x delta files" +.PP +The perldelta files for Perl 5.12.1 to 5.12.3 have been added from the +maintenance branch: perl5121delta, perl5122delta, perl5123delta. +.PP +\fIperlpodstyle\fR +.IX Subsection "perlpodstyle" +.PP +New style guide for \s-1POD\s0 documentation, +split mostly from the \s-1NOTES\s0 section of the \fBpod2man\fR\|(1) manpage. +.PP +\fIperlsource, perlinterp, perlhacktut, and perlhacktips\fR +.IX Subsection "perlsource, perlinterp, perlhacktut, and perlhacktips" +.PP +See \*(L"perlhack and perlrepository revamp\*(R", below. +.SS "Changes to Existing Documentation" +.IX Subsection "Changes to Existing Documentation" +\fIperlmodlib is now complete\fR +.IX Subsection "perlmodlib is now complete" +.PP +The perlmodlib manpage that came with Perl 5.12.0 was missing several +modules due to a bug in the script that generates the list. This has been +fixed [perl #74332] (5.12.1). +.PP +\fIReplace incorrect tr/// table in perlebcdic\fR +.IX Subsection "Replace incorrect tr/// table in perlebcdic" +.PP +perlebcdic contains a helpful table to use in \f(CW\*(C`tr///\*(C'\fR to convert +between \s-1EBCDIC\s0 and Latin1/ASCII. The table was the inverse of the one +it describes, though the code that used the table worked correctly for +the specific example given. +.PP +The table has been corrected and the sample code changed to correspond. +.PP +The table has also been changed to hex from octal, and the recipes in the +pod have been altered to print out leading zeros to make all values +the same length. +.PP +\fITricks for user-defined casing\fR +.IX Subsection "Tricks for user-defined casing" +.PP +perlunicode now contains an explanation of how to override, mangle +and otherwise tweak the way Perl handles upper\-, lower\- and other-case +conversions on Unicode data, and how to provide scoped changes to alter +one's own code's behaviour without stomping on anybody else's. +.PP +\fI\s-1INSTALL\s0 explicitly states that Perl requires a C89 compiler\fR +.IX Subsection "INSTALL explicitly states that Perl requires a C89 compiler" +.PP +This was already true, but it's now Officially Stated For The Record +(5.12.2). +.PP +\fIExplanation of \f(CI\*(C`\ex\f(CIHH\f(CI\*(C'\fI and \f(CI\*(C`\eo\f(CIOOO\f(CI\*(C'\fI escapes\fR +.IX Subsection "Explanation of xHH and oOOO escapes" +.PP +perlop has been updated with more detailed explanation of these two +character escapes. +.PP +\fI\f(BI\-0\f(BI\s-1NNN\s0\f(BI\fI switch\fR +.IX Subsection "-0NNN switch" +.PP +In perlrun, the behaviour of the \fB\-0NNN\fR switch for \fB\-0400\fR or higher +has been clarified (5.12.2). +.PP +\fIMaintenance policy\fR +.IX Subsection "Maintenance policy" +.PP +perlpolicy now contains the policy on what patches are acceptable for +maintenance branches (5.12.1). +.PP +\fIDeprecation policy\fR +.IX Subsection "Deprecation policy" +.PP +perlpolicy now contains the policy on compatibility and deprecation +along with definitions of terms like \*(L"deprecation\*(R" (5.12.2). +.PP +\fINew descriptions in perldiag\fR +.IX Subsection "New descriptions in perldiag" +.PP +The following existing diagnostics are now documented: +.IP "\(bu" 4 +Ambiguous use of \f(CW%c\fR resolved as operator \f(CW%c\fR +.IP "\(bu" 4 +Ambiguous use of \f(CW%c\fR{%s} resolved to \f(CW%c\fR%s +.IP "\(bu" 4 +Ambiguous use of \f(CW%c\fR{%s[...]} resolved to \f(CW%c\fR%s[...] +.IP "\(bu" 4 +Ambiguous use of \f(CW%c\fR{%s{...}} resolved to \f(CW%c\fR%s{...} +.IP "\(bu" 4 +Ambiguous use of \-%s resolved as \-&%s() +.IP "\(bu" 4 +Invalid strict version format (%s) +.IP "\(bu" 4 +Invalid version format (%s) +.IP "\(bu" 4 +Invalid version object +.PP +\fIperlbook\fR +.IX Subsection "perlbook" +.PP +perlbook has been expanded to cover many more popular books. +.PP +\fI\f(CI\*(C`SvTRUE\*(C'\fI macro\fR +.IX Subsection "SvTRUE macro" +.PP +The documentation for the \f(CW\*(C`SvTRUE\*(C'\fR macro in +perlapi was simply wrong in stating that +get-magic is not processed. It has been corrected. +.PP +\fIop manipulation functions\fR +.IX Subsection "op manipulation functions" +.PP +Several \s-1API\s0 functions that process optrees have been newly documented. +.PP +\fIperlvar revamp\fR +.IX Subsection "perlvar revamp" +.PP +perlvar reorders the variables and groups them by topic. Each variable +introduced after Perl 5.000 notes the first version in which it is +available. perlvar also has a new section for deprecated variables to +note when they were removed. +.PP +\fIArray and hash slices in scalar context\fR +.IX Subsection "Array and hash slices in scalar context" +.PP +These are now documented in perldata. +.PP +\fI\f(CI\*(C`use locale\*(C'\fI and formats\fR +.IX Subsection "use locale and formats" +.PP +perlform and perllocale have been corrected to state that +\&\f(CW\*(C`use locale\*(C'\fR affects formats. +.PP +\fIoverload\fR +.IX Subsection "overload" +.PP +overload's documentation has practically undergone a rewrite. It +is now much more straightforward and clear. +.PP +\fIperlhack and perlrepository revamp\fR +.IX Subsection "perlhack and perlrepository revamp" +.PP +The perlhack document is now much shorter, and focuses on the Perl 5 +development process and submitting patches to Perl. The technical content +has been moved to several new documents, perlsource, perlinterp, +perlhacktut, and perlhacktips. This technical content has +been only lightly edited. +.PP +The perlrepository document has been renamed to perlgit. This new +document is just a how-to on using git with the Perl source code. +Any other content that used to be in perlrepository has been moved +to perlhack. +.PP +\fITime::Piece examples\fR +.IX Subsection "Time::Piece examples" +.PP +Examples in perlfaq4 have been updated to show the use of +Time::Piece. +.SH "Diagnostics" +.IX Header "Diagnostics" +The following additions or changes have been made to diagnostic output, +including warnings and fatal error messages. For the complete list of +diagnostic messages, see perldiag. +.SS "New Diagnostics" +.IX Subsection "New Diagnostics" +\fINew Errors\fR +.IX Subsection "New Errors" +.IP "Closure prototype called" 4 +.IX Item "Closure prototype called" +This error occurs when a subroutine reference passed to an attribute +handler is called, if the subroutine is a closure [perl #68560]. +.ie n .IP "Insecure user-defined property %s" 4 +.el .IP "Insecure user-defined property \f(CW%s\fR" 4 +.IX Item "Insecure user-defined property %s" +Perl detected tainted data when trying to compile a regular +expression that contains a call to a user-defined character property +function, meaning \f(CW\*(C`\ep{IsFoo}\*(C'\fR or \f(CW\*(C`\ep{InFoo}\*(C'\fR. +See \*(L"User-Defined Character Properties\*(R" in perlunicode and perlsec. +.IP "panic: gp_free failed to free glob pointer \- something is repeatedly re-creating entries" 4 +.IX Item "panic: gp_free failed to free glob pointer - something is repeatedly re-creating entries" +This new error is triggered if a destructor called on an object in a +typeglob that is being freed creates a new typeglob entry containing an +object with a destructor that creates a new entry containing an object etc. +.IP "Parsing code internal error (%s)" 4 +.IX Item "Parsing code internal error (%s)" +This new fatal error is produced when parsing +code supplied by an extension violates the +parser's \s-1API\s0 in a detectable way. +.ie n .IP "refcnt: fd %d%s" 4 +.el .IP "refcnt: fd \f(CW%d\fR%s" 4 +.IX Item "refcnt: fd %d%s" +This new error only occurs if an internal consistency check fails when a +pipe is about to be closed. +.ie n .IP "Regexp modifier ""/%c"" may not appear twice" 4 +.el .IP "Regexp modifier ``/%c'' may not appear twice" 4 +.IX Item "Regexp modifier /%c may not appear twice" +The regular expression pattern has one of the +mutually exclusive modifiers repeated. +.ie n .IP "Regexp modifiers ""/%c"" and ""/%c"" are mutually exclusive" 4 +.el .IP "Regexp modifiers ``/%c'' and ``/%c'' are mutually exclusive" 4 +.IX Item "Regexp modifiers /%c and /%c are mutually exclusive" +The regular expression pattern has more than one of the mutually +exclusive modifiers. +.ie n .IP "Using !~ with %s doesn't make sense" 4 +.el .IP "Using !~ with \f(CW%s\fR doesn't make sense" 4 +.IX Item "Using !~ with %s doesn't make sense" +This error occurs when \f(CW\*(C`!~\*(C'\fR is used with \f(CW\*(C`s///r\*(C'\fR or \f(CW\*(C`y///r\*(C'\fR. +.PP +\fINew Warnings\fR +.IX Subsection "New Warnings" +.ie n .IP """\eb{"" is deprecated; use ""\eb\e{"" instead" 4 +.el .IP "``\eb{'' is deprecated; use ``\eb\e{'' instead" 4 +.IX Item "b{ is deprecated; use b{ instead" +.PD 0 +.ie n .IP """\eB{"" is deprecated; use ""\eB\e{"" instead" 4 +.el .IP "``\eB{'' is deprecated; use ``\eB\e{'' instead" 4 +.IX Item "B{ is deprecated; use B{ instead" +.PD +Use of an unescaped \*(L"{\*(R" immediately following a \f(CW\*(C`\eb\*(C'\fR or \f(CW\*(C`\eB\*(C'\fR is now +deprecated in order to reserve its use for Perl itself in a future release. +.ie n .IP "Operation ""%s"" returns its argument for ..." 4 +.el .IP "Operation ``%s'' returns its argument for ..." 4 +.IX Item "Operation %s returns its argument for ..." +Performing an operation requiring Unicode semantics (such as case-folding) +on a Unicode surrogate or a non-Unicode character now triggers this +warning. +.IP "Use of qw(...) as parentheses is deprecated" 4 +.IX Item "Use of qw(...) as parentheses is deprecated" +See \*(L"Use of qw(...) as parentheses\*(R", above, for details. +.SS "Changes to Existing Diagnostics" +.IX Subsection "Changes to Existing Diagnostics" +.IP "\(bu" 4 +The \*(L"Variable \f(CW$foo\fR is not imported\*(R" warning that precedes a +\&\f(CW\*(C`strict \*(Aqvars\*(Aq\*(C'\fR error has now been assigned the \*(L"misc\*(R" category, so that +\&\f(CW\*(C`no warnings\*(C'\fR will suppress it [perl #73712]. +.IP "\(bu" 4 +\&\fBwarn()\fR and \fBdie()\fR now produce \*(L"Wide character\*(R" warnings when fed a +character outside the byte range if \f(CW\*(C`STDERR\*(C'\fR is a byte-sized handle. +.IP "\(bu" 4 +The \*(L"Layer does not match this perl\*(R" error message has been replaced with +these more helpful messages [perl #73754]: +.RS 4 +.IP "\(bu" 4 +PerlIO layer function table size (%d) does not match size expected by this +perl (%d) +.IP "\(bu" 4 +PerlIO layer instance size (%d) does not match size expected by this perl +(%d) +.RE +.RS 4 +.RE +.IP "\(bu" 4 +The \*(L"Found = in conditional\*(R" warning that is emitted when a constant is +assigned to a variable in a condition is now withheld if the constant is +actually a subroutine or one generated by \f(CW\*(C`use constant\*(C'\fR, since the value +of the constant may not be known at the time the program is written +[perl #77762]. +.IP "\(bu" 4 +Previously, if none of the \fBgethostbyaddr()\fR, \fBgethostbyname()\fR and +\&\fBgethostent()\fR functions were implemented on a given platform, they would +all die with the message \*(L"Unsupported socket function 'gethostent' called\*(R", +with analogous messages for getnet*() and getserv*(). This has been +corrected. +.IP "\(bu" 4 +The warning message about unrecognized regular expression escapes passed +through has been changed to include any literal \*(L"{\*(R" following the +two-character escape. For example, \*(L"\eq{\*(R" is now emitted instead of \*(L"\eq\*(R". +.SH "Utility Changes" +.IX Header "Utility Changes" +\fI\f(BIperlbug\fI\|(1)\fR +.IX Subsection "perlbug" +.IP "\(bu" 4 +perlbug now looks in the \s-1EMAIL\s0 environment variable for a return address +if the REPLY-TO and \s-1REPLYTO\s0 variables are empty. +.IP "\(bu" 4 +perlbug did not previously generate a \*(L"From:\*(R" header, potentially +resulting in dropped mail; it now includes that header. +.IP "\(bu" 4 +The user's address is now used as the Return-Path. +.Sp +Many systems these days don't have a valid Internet domain name, and +perlbug@perl.org does not accept email with a return-path that does +not resolve. So the user's address is now passed to sendmail so it's +less likely to get stuck in a mail queue somewhere [perl #82996]. +.IP "\(bu" 4 +perlbug now always gives the reporter a chance to change the email +address it guesses for them (5.12.2). +.IP "\(bu" 4 +perlbug should no longer warn about uninitialized values when using the \fB\-d\fR +and \fB\-v\fR options (5.12.2). +.PP +\fIperl5db.pl\fR +.IX Subsection "perl5db.pl" +.IP "\(bu" 4 +The remote terminal works after forking and spawns new sessions, one +per forked process. +.PP +\fIptargrep\fR +.IX Subsection "ptargrep" +.IP "\(bu" 4 +ptargrep is a new utility to apply pattern matching to the contents of +files in a tar archive. It comes with \f(CW\*(C`Archive::Tar\*(C'\fR. +.SH "Configuration and Compilation" +.IX Header "Configuration and Compilation" +See also \*(L"Naming fixes in Policy_sh.SH may invalidate Policy.sh\*(R", +above. +.IP "\(bu" 4 +\&\s-1CCINCDIR\s0 and \s-1CCLIBDIR\s0 for the mingw64 cross-compiler are now correctly +under \fI$(\s-1CCHOME\s0)\emingw\einclude\fR and \fI\elib\fR rather than immediately below +\&\fI$(\s-1CCHOME\s0)\fR. +.Sp +This means the \*(L"incpath\*(R", \*(L"libpth\*(R", \*(L"ldflags\*(R", \*(L"lddlflags\*(R" and +\&\*(L"ldflags_nolargefiles\*(R" values in \fIConfig.pm\fR and \fIConfig_heavy.pl\fR are now +set correctly. +.IP "\(bu" 4 +\&\f(CW\*(C`make test.valgrind\*(C'\fR has been adjusted to account for \fIcpan/dist/ext\fR +separation. +.IP "\(bu" 4 +On compilers that support it, \fB\-Wwrite\-strings\fR is now added to cflags by +default. +.IP "\(bu" 4 +The Encode module can now (once again) be included in a static Perl +build. The special-case handling for this situation got broken in Perl +5.11.0, and has now been repaired. +.IP "\(bu" 4 +The previous default size of a PerlIO buffer (4096 bytes) has been increased +to the larger of 8192 bytes and your local \s-1BUFSIZ.\s0 Benchmarks show that doubling +this decade-old default increases read and write performance by around +25% to 50% when using the default layers of perlio on top of unix. To choose +a non-default size, such as to get back the old value or to obtain an even +larger value, configure with: +.Sp +.Vb 1 +\& ./Configure \-Accflags=\-DPERLIOBUF_DEFAULT_BUFSIZ=N +.Ve +.Sp +where N is the desired size in bytes; it should probably be a multiple of +your page size. +.IP "\(bu" 4 +An \*(L"incompatible operand types\*(R" error in ternary expressions when building +with \f(CW\*(C`clang\*(C'\fR has been fixed (5.12.2). +.IP "\(bu" 4 +Perl now skips setuid File::Copy tests on partitions it detects mounted +as \f(CW\*(C`nosuid\*(C'\fR (5.12.2). +.SH "Platform Support" +.IX Header "Platform Support" +.SS "New Platforms" +.IX Subsection "New Platforms" +.IP "\s-1AIX\s0" 4 +.IX Item "AIX" +Perl now builds on \s-1AIX 4.2\s0 (5.12.1). +.SS "Discontinued Platforms" +.IX Subsection "Discontinued Platforms" +.IP "Apollo DomainOS" 4 +.IX Item "Apollo DomainOS" +The last vestiges of support for this platform have been excised from +the Perl distribution. It was officially discontinued in version 5.12.0. +It had not worked for years before that. +.IP "MacOS Classic" 4 +.IX Item "MacOS Classic" +The last vestiges of support for this platform have been excised from the +Perl distribution. It was officially discontinued in an earlier version. +.SS "Platform-Specific Notes" +.IX Subsection "Platform-Specific Notes" +\fI\s-1AIX\s0\fR +.IX Subsection "AIX" +.IP "\(bu" 4 +\&\fI\s-1README\s0.aix\fR has been updated with information about the \s-1XL C/\*(C+ V11\s0 compiler +suite (5.12.2). +.PP +\fI\s-1ARM\s0\fR +.IX Subsection "ARM" +.IP "\(bu" 4 +The \f(CW\*(C`d_u32align\*(C'\fR configuration probe on \s-1ARM\s0 has been fixed (5.12.2). +.PP +\fICygwin\fR +.IX Subsection "Cygwin" +.IP "\(bu" 4 +MakeMaker has been updated to build manpages on cygwin. +.IP "\(bu" 4 +Improved rebase behaviour +.Sp +If a \s-1DLL\s0 is updated on cygwin the old imagebase address is reused. +This solves most rebase errors, especially when updating on core \s-1DLL\s0's. +See +for more information. +.IP "\(bu" 4 +Support for the standard cygwin dll prefix (needed for FFIs) +.IP "\(bu" 4 +Updated build hints file +.PP +\fIFreeBSD 7\fR +.IX Subsection "FreeBSD 7" +.IP "\(bu" 4 +FreeBSD 7 no longer contains \fI/usr/bin/objformat\fR. At build time, +Perl now skips the \fIobjformat\fR check for versions 7 and higher and +assumes \s-1ELF\s0 (5.12.1). +.PP +\fIHP-UX\fR +.IX Subsection "HP-UX" +.IP "\(bu" 4 +Perl now allows \fB\-Duse64bitint\fR without promoting to \f(CW\*(C`use64bitall\*(C'\fR on HP-UX +(5.12.1). +.PP +\fI\s-1IRIX\s0\fR +.IX Subsection "IRIX" +.IP "\(bu" 4 +Conversion of strings to floating-point numbers is now more accurate on +\&\s-1IRIX\s0 systems [perl #32380]. +.PP +\fIMac \s-1OS X\s0\fR +.IX Subsection "Mac OS X" +.IP "\(bu" 4 +Early versions of Mac \s-1OS X\s0 (Darwin) had buggy implementations of the +\&\fBsetregid()\fR, \fBsetreuid()\fR, setrgid(,) and \fBsetruid()\fR functions, so Perl +would pretend they did not exist. +.Sp +These functions are now recognised on Mac \s-1OS 10.5\s0 (Leopard; Darwin 9) and +higher, as they have been fixed [perl #72990]. +.PP +\fIMirBSD\fR +.IX Subsection "MirBSD" +.IP "\(bu" 4 +Previously if you built Perl with a shared \fIlibperl.so\fR on MirBSD (the +default config), it would work up to the installation; however, once +installed, it would be unable to find \fIlibperl\fR. Path handling is now +treated as in the other \s-1BSD\s0 dialects. +.PP +\fINetBSD\fR +.IX Subsection "NetBSD" +.IP "\(bu" 4 +The NetBSD hints file has been changed to make the system malloc the +default. +.PP +\fIOpenBSD\fR +.IX Subsection "OpenBSD" +.IP "\(bu" 4 +OpenBSD > 3.7 has a new malloc implementation which is \fImmap\fR\-based, +and as such can release memory back to the \s-1OS\s0; however, Perl's use of +this malloc causes a substantial slowdown, so we now default to using +Perl's malloc instead [perl #75742]. +.PP +\fIOpenVOS\fR +.IX Subsection "OpenVOS" +.IP "\(bu" 4 +Perl now builds again with OpenVOS (formerly known as Stratus \s-1VOS\s0) +[perl #78132] (5.12.3). +.PP +\fISolaris\fR +.IX Subsection "Solaris" +.IP "\(bu" 4 +DTrace is now supported on Solaris. There used to be build failures, but +these have been fixed [perl #73630] (5.12.3). +.PP +\fI\s-1VMS\s0\fR +.IX Subsection "VMS" +.IP "\(bu" 4 +Extension building on older (pre 7.3\-2) \s-1VMS\s0 systems was broken because +configure.com hit the \s-1DCL\s0 symbol length limit of 1K. We now work within +this limit when assembling the list of extensions in the core build (5.12.1). +.IP "\(bu" 4 +We fixed configuring and building Perl with \fB\-Uuseperlio\fR (5.12.1). +.IP "\(bu" 4 +\&\f(CW\*(C`PerlIOUnix_open\*(C'\fR now honours the default permissions on \s-1VMS.\s0 +.Sp +When \f(CW\*(C`perlio\*(C'\fR became the default and \f(CW\*(C`unix\*(C'\fR became the default bottom layer, +the most common path for creating files from Perl became \f(CW\*(C`PerlIOUnix_open\*(C'\fR, +which has always explicitly used \f(CW0666\fR as the permission mask. This prevents +inheriting permissions from \s-1RMS\s0 defaults and ACLs, so to avoid that problem, +we now pass \f(CW0777\fR to \fBopen()\fR. In the \s-1VMS CRTL,\s0 \f(CW0777\fR has a special +meaning over and above intersecting with the current umask; specifically, it +allows Unix syscalls to preserve native default permissions (5.12.3). +.IP "\(bu" 4 +The shortening of symbols longer than 31 characters in the core C sources +and in extensions is now by default done by the C compiler rather than by +xsubpp (which could only do so for generated symbols in \s-1XS\s0 code). You can +reenable xsubpp's symbol shortening by configuring with \-Uuseshortenedsymbols, +but you'll have some work to do to get the core sources to compile. +.IP "\(bu" 4 +Record-oriented files (record format variable or variable with fixed control) +opened for write by the \f(CW\*(C`perlio\*(C'\fR layer will now be line-buffered to prevent the +introduction of spurious line breaks whenever the perlio buffer fills up. +.IP "\(bu" 4 +\&\fIgit_version.h\fR is now installed on \s-1VMS.\s0 This was an oversight in v5.12.0 which +caused some extensions to fail to build (5.12.2). +.IP "\(bu" 4 +Several memory leaks in \fBstat()\fR have been fixed (5.12.2). +.IP "\(bu" 4 +A memory leak in \fBPerl_rename()\fR due to a double allocation has been +fixed (5.12.2). +.IP "\(bu" 4 +A memory leak in \fBvms_fid_to_name()\fR (used by \fBrealpath()\fR and +\&\fBrealname()\fR> has been fixed (5.12.2). +.PP +\fIWindows\fR +.IX Subsection "Windows" +.PP +See also \*(L"\fBfork()\fR emulation will not wait for signalled children\*(R" and +\&\*(L"Perl source code is read in text mode on Windows\*(R", above. +.IP "\(bu" 4 +Fixed build process for \s-1SDK2003SP1\s0 compilers. +.IP "\(bu" 4 +Compilation with Visual Studio 2010 is now supported. +.IP "\(bu" 4 +When using old 32\-bit compilers, the define \f(CW\*(C`_USE_32BIT_TIME_T\*(C'\fR is now +set in \f(CW$Config{ccflags}\fR. This improves portability when compiling +\&\s-1XS\s0 extensions using new compilers, but for a Perl compiled with old 32\-bit +compilers. +.IP "\(bu" 4 +\&\f(CW$Config{gccversion}\fR is now set correctly when Perl is built using the +mingw64 compiler from [perl #73754]. +.IP "\(bu" 4 +When building Perl with the mingw64 x64 cross-compiler \f(CW\*(C`incpath\*(C'\fR, +\&\f(CW\*(C`libpth\*(C'\fR, \f(CW\*(C`ldflags\*(C'\fR, \f(CW\*(C`lddlflags\*(C'\fR and \f(CW\*(C`ldflags_nolargefiles\*(C'\fR values +in \fIConfig.pm\fR and \fIConfig_heavy.pl\fR were not previously being set +correctly because, with that compiler, the include and lib directories +are not immediately below \f(CW\*(C`$(CCHOME)\*(C'\fR (5.12.2). +.IP "\(bu" 4 +The build process proceeds more smoothly with mingw and dmake when +\&\fIC:\eMSYS\ebin\fR is in the \s-1PATH,\s0 due to a \f(CW\*(C`Cwd\*(C'\fR fix. +.IP "\(bu" 4 +Support for building with Visual \*(C+ 2010 is now underway, but is not yet +complete. See \fI\s-1README\s0.win32\fR or perlwin32 for more details. +.IP "\(bu" 4 +The option to use an externally-supplied \fBcrypt()\fR, or to build with no +\&\fBcrypt()\fR at all, has been removed. Perl supplies its own \fBcrypt()\fR +implementation for Windows, and the political situation that required +this part of the distribution to sometimes be omitted is long gone. +.SH "Internal Changes" +.IX Header "Internal Changes" +.SS "New APIs" +.IX Subsection "New APIs" +\fI\s-1CLONE_PARAMS\s0 structure added to ease correct thread creation\fR +.IX Subsection "CLONE_PARAMS structure added to ease correct thread creation" +.PP +Modules that create threads should now create \f(CW\*(C`CLONE_PARAMS\*(C'\fR structures +by calling the new function \fBPerl_clone_params_new()\fR, and free them with +\&\fBPerl_clone_params_del()\fR. This will ensure compatibility with any future +changes to the internals of the \f(CW\*(C`CLONE_PARAMS\*(C'\fR structure layout, and that +it is correctly allocated and initialised. +.PP +\fINew parsing functions\fR +.IX Subsection "New parsing functions" +.PP +Several functions have been added for parsing Perl statements and +expressions. These functions are meant to be used by \s-1XS\s0 code invoked +during Perl parsing, in a recursive-descent manner, to allow modules to +augment the standard Perl syntax. +.IP "\(bu" 4 +\&\fBparse_stmtseq()\fR +parses a sequence of statements, up to closing brace or \s-1EOF.\s0 +.IP "\(bu" 4 +\&\fBparse_fullstmt()\fR +parses a complete Perl statement, including optional label. +.IP "\(bu" 4 +\&\fBparse_barestmt()\fR +parses a statement without a label. +.IP "\(bu" 4 +\&\fBparse_block()\fR +parses a code block. +.IP "\(bu" 4 +\&\fBparse_label()\fR +parses a statement label, separate from statements. +.IP "\(bu" 4 +\&\f(CW\*(C`parse_fullexpr()\*(C'\fR, +\&\f(CW\*(C`parse_listexpr()\*(C'\fR, +\&\f(CW\*(C`parse_termexpr()\*(C'\fR, and +\&\f(CW\*(C`parse_arithexpr()\*(C'\fR +parse expressions at various precedence levels. +.PP +\fIHints hash \s-1API\s0\fR +.IX Subsection "Hints hash API" +.PP +A new C \s-1API\s0 for introspecting the hinthash \f(CW\*(C`%^H\*(C'\fR at runtime has been +added. See \f(CW\*(C`cop_hints_2hv\*(C'\fR, \f(CW\*(C`cop_hints_fetchpvn\*(C'\fR, \f(CW\*(C`cop_hints_fetchpvs\*(C'\fR, +\&\f(CW\*(C`cop_hints_fetchsv\*(C'\fR, and \f(CW\*(C`hv_copy_hints_hv\*(C'\fR in perlapi for details. +.PP +A new, experimental \s-1API\s0 has been added for accessing the internal +structure that Perl uses for \f(CW\*(C`%^H\*(C'\fR. See the functions beginning with +\&\f(CW\*(C`cophh_\*(C'\fR in perlapi. +.PP +\fIC interface to \f(BIcaller()\fI\fR +.IX Subsection "C interface to caller()" +.PP +The \f(CW\*(C`caller_cx\*(C'\fR function has been added as an XSUB-writer's equivalent of +\&\fBcaller()\fR. See perlapi for details. +.PP +\fICustom per-subroutine check hooks\fR +.IX Subsection "Custom per-subroutine check hooks" +.PP +\&\s-1XS\s0 code in an extension module can now annotate a subroutine (whether +implemented in \s-1XS\s0 or in Perl) so that nominated \s-1XS\s0 code will be called +at compile time (specifically as part of op checking) to change the op +tree of that subroutine. The compile-time check function (supplied by +the extension module) can implement argument processing that can't be +expressed as a prototype, generate customised compile-time warnings, +perform constant folding for a pure function, inline a subroutine +consisting of sufficiently simple ops, replace the whole call with a +custom op, and so on. This was previously all possible by hooking the +\&\f(CW\*(C`entersub\*(C'\fR op checker, but the new mechanism makes it easy to tie the +hook to a specific subroutine. See \*(L"cv_set_call_checker\*(R" in perlapi. +.PP +To help in writing custom check hooks, several subtasks within standard +\&\f(CW\*(C`entersub\*(C'\fR op checking have been separated out and exposed in the \s-1API.\s0 +.PP +\fIImproved support for custom OPs\fR +.IX Subsection "Improved support for custom OPs" +.PP +Custom ops can now be registered with the new \f(CW\*(C`custom_op_register\*(C'\fR C +function and the \f(CW\*(C`XOP\*(C'\fR structure. This will make it easier to add new +properties of custom ops in the future. Two new properties have been added +already, \f(CW\*(C`xop_class\*(C'\fR and \f(CW\*(C`xop_peep\*(C'\fR. +.PP +\&\f(CW\*(C`xop_class\*(C'\fR is one of the OA_*OP constants. It allows B and other +introspection mechanisms to work with custom ops +that aren't BASEOPs. \f(CW\*(C`xop_peep\*(C'\fR is a pointer to +a function that will be called for ops of this +type from \f(CW\*(C`Perl_rpeep\*(C'\fR. +.PP +See \*(L"Custom Operators\*(R" in perlguts and \*(L"Custom Operators\*(R" in perlapi for more +detail. +.PP +The old \f(CW\*(C`PL_custom_op_names\*(C'\fR/\f(CW\*(C`PL_custom_op_descs\*(C'\fR interface is still +supported but discouraged. +.PP +\fIScope hooks\fR +.IX Subsection "Scope hooks" +.PP +It is now possible for \s-1XS\s0 code to hook into Perl's lexical scope +mechanism at compile time, using the new \f(CW\*(C`Perl_blockhook_register\*(C'\fR +function. See \*(L"Compile-time scope hooks\*(R" in perlguts. +.PP +\fIThe recursive part of the peephole optimizer is now hookable\fR +.IX Subsection "The recursive part of the peephole optimizer is now hookable" +.PP +In addition to \f(CW\*(C`PL_peepp\*(C'\fR, for hooking into the toplevel peephole optimizer, a +\&\f(CW\*(C`PL_rpeepp\*(C'\fR is now available to hook into the optimizer recursing into +side-chains of the optree. +.PP +\fINew non-magical variants of existing functions\fR +.IX Subsection "New non-magical variants of existing functions" +.PP +The following functions/macros have been added to the \s-1API.\s0 The \f(CW*_nomg\fR +macros are equivalent to their non\-\f(CW\*(C`_nomg\*(C'\fR variants, except that they ignore +get-magic. Those ending in \f(CW\*(C`_flags\*(C'\fR allow one to specify whether +get-magic is processed. +.PP +.Vb 8 +\& sv_2bool_flags +\& SvTRUE_nomg +\& sv_2nv_flags +\& SvNV_nomg +\& sv_cmp_flags +\& sv_cmp_locale_flags +\& sv_eq_flags +\& sv_collxfrm_flags +.Ve +.PP +In some of these cases, the non\-\f(CW\*(C`_flags\*(C'\fR functions have +been replaced with wrappers around the new functions. +.PP +\fIpv/pvs/sv versions of existing functions\fR +.IX Subsection "pv/pvs/sv versions of existing functions" +.PP +Many functions ending with pvn now have equivalent \f(CW\*(C`pv/pvs/sv\*(C'\fR versions. +.PP +\fIList op-building functions\fR +.IX Subsection "List op-building functions" +.PP +List op-building functions have been added to the +\&\s-1API.\s0 See op_append_elem, +op_append_list, and +op_prepend_elem in perlapi. +.PP +\fI\f(CI\*(C`LINKLIST\*(C'\fI\fR +.IX Subsection "LINKLIST" +.PP +The \s-1LINKLIST\s0 macro, part of op building that +constructs the execution-order op chain, has been added to the \s-1API.\s0 +.PP +\fILocalisation functions\fR +.IX Subsection "Localisation functions" +.PP +The \f(CW\*(C`save_freeop\*(C'\fR, \f(CW\*(C`save_op\*(C'\fR, \f(CW\*(C`save_pushi32ptr\*(C'\fR and \f(CW\*(C`save_pushptrptr\*(C'\fR +functions have been added to the \s-1API.\s0 +.PP +\fIStash names\fR +.IX Subsection "Stash names" +.PP +A stash can now have a list of effective names in addition to its usual +name. The first effective name can be accessed via the \f(CW\*(C`HvENAME\*(C'\fR macro, +which is now the recommended name to use in \s-1MRO\s0 linearisations (\f(CW\*(C`HvNAME\*(C'\fR +being a fallback if there is no \f(CW\*(C`HvENAME\*(C'\fR). +.PP +These names are added and deleted via \f(CW\*(C`hv_ename_add\*(C'\fR and +\&\f(CW\*(C`hv_ename_delete\*(C'\fR. These two functions are \fInot\fR part of the \s-1API.\s0 +.PP +\fINew functions for finding and removing magic\fR +.IX Subsection "New functions for finding and removing magic" +.PP +The \f(CW\*(C`mg_findext()\*(C'\fR and +\&\f(CW\*(C`sv_unmagicext()\*(C'\fR +functions have been added to the \s-1API.\s0 +They allow extension authors to find and remove magic attached to +scalars based on both the magic type and the magic virtual table, similar to how +\&\fBsv_magicext()\fR attaches magic of a certain type and with a given virtual table +to a scalar. This eliminates the need for extensions to walk the list of +\&\f(CW\*(C`MAGIC\*(C'\fR pointers of an \f(CW\*(C`SV\*(C'\fR to find the magic that belongs to them. +.PP +\fI\f(CI\*(C`find_rundefsv\*(C'\fI\fR +.IX Subsection "find_rundefsv" +.PP +This function returns the \s-1SV\s0 representing \f(CW$_\fR, whether it's lexical +or dynamic. +.PP +\fI\f(CI\*(C`Perl_croak_no_modify\*(C'\fI\fR +.IX Subsection "Perl_croak_no_modify" +.PP +\&\fBPerl_croak_no_modify()\fR is short-hand for +\&\f(CW\*(C`Perl_croak("%s", PL_no_modify)\*(C'\fR. +.PP +\fI\f(CI\*(C`PERL_STATIC_INLINE\*(C'\fI define\fR +.IX Subsection "PERL_STATIC_INLINE define" +.PP +The \f(CW\*(C`PERL_STATIC_INLINE\*(C'\fR define has been added to provide the best-guess +incantation to use for static inline functions, if the C compiler supports +C99\-style static inline. If it doesn't, it'll give a plain \f(CW\*(C`static\*(C'\fR. +.PP +\&\f(CW\*(C`HAS_STATIC_INLINE\*(C'\fR can be used to check if the compiler actually supports +inline functions. +.PP +\fINew \f(CI\*(C`pv_escape\*(C'\fI option for hexadecimal escapes\fR +.IX Subsection "New pv_escape option for hexadecimal escapes" +.PP +A new option, \f(CW\*(C`PERL_PV_ESCAPE_NONASCII\*(C'\fR, has been added to \f(CW\*(C`pv_escape\*(C'\fR to +dump all characters above \s-1ASCII\s0 in hexadecimal. Before, one could get all +characters as hexadecimal or the Latin1 non-ASCII as octal. +.PP +\fI\f(CI\*(C`lex_start\*(C'\fI\fR +.IX Subsection "lex_start" +.PP +\&\f(CW\*(C`lex_start\*(C'\fR has been added to the \s-1API,\s0 but is considered experimental. +.PP +\fI\f(BIop_scope()\fI and \f(BIop_lvalue()\fI\fR +.IX Subsection "op_scope() and op_lvalue()" +.PP +The \fBop_scope()\fR and \fBop_lvalue()\fR functions have been added to the \s-1API,\s0 +but are considered experimental. +.SS "C \s-1API\s0 Changes" +.IX Subsection "C API Changes" +\fI\f(CI\*(C`PERL_POLLUTE\*(C'\fI has been removed\fR +.IX Subsection "PERL_POLLUTE has been removed" +.PP +The option to define \f(CW\*(C`PERL_POLLUTE\*(C'\fR to expose older 5.005 symbols for +backwards compatibility has been removed. Its use was always discouraged, +and MakeMaker contains a more specific escape hatch: +.PP +.Vb 1 +\& perl Makefile.PL POLLUTE=1 +.Ve +.PP +This can be used for modules that have not been upgraded to 5.6 naming +conventions (and really should be completely obsolete by now). +.PP +\fICheck \s-1API\s0 compatibility when loading \s-1XS\s0 modules\fR +.IX Subsection "Check API compatibility when loading XS modules" +.PP +When Perl's \s-1API\s0 changes in incompatible ways (which usually happens between +major releases), \s-1XS\s0 modules compiled for previous versions of Perl will no +longer work. They need to be recompiled against the new Perl. +.PP +The \f(CW\*(C`XS_APIVERSION_BOOTCHECK\*(C'\fR macro has been added to ensure that modules +are recompiled and to prevent users from accidentally loading modules +compiled for old perls into newer perls. That macro, which is called when +loading every newly compiled extension, compares the \s-1API\s0 version of the +running perl with the version a module has been compiled for and raises an +exception if they don't match. +.PP +\fIPerl_fetch_cop_label\fR +.IX Subsection "Perl_fetch_cop_label" +.PP +The first argument of the C \s-1API\s0 function \f(CW\*(C`Perl_fetch_cop_label\*(C'\fR has changed +from \f(CW\*(C`struct refcounted_he *\*(C'\fR to \f(CW\*(C`COP *\*(C'\fR, to insulate the user from +implementation details. +.PP +This \s-1API\s0 function was marked as \*(L"may change\*(R", and likely isn't in use outside +the core. (Neither an unpacked \s-1CPAN\s0 nor Google's codesearch finds any other +references to it.) +.PP +\fI\f(BIGvCV()\fI and \f(BIGvGP()\fI are no longer lvalues\fR +.IX Subsection "GvCV() and GvGP() are no longer lvalues" +.PP +The new \fBGvCV_set()\fR and \fBGvGP_set()\fR macros are now provided to replace +assignment to those two macros. +.PP +This allows a future commit to eliminate some backref magic between \s-1GV\s0 +and CVs, which will require complete control over assignment to the +\&\f(CW\*(C`gp_cv\*(C'\fR slot. +.PP +\fI\f(BICvGV()\fI is no longer an lvalue\fR +.IX Subsection "CvGV() is no longer an lvalue" +.PP +Under some circumstances, the \fBCvGV()\fR field of a \s-1CV\s0 is now +reference-counted. To ensure consistent behaviour, direct assignment to +it, for example \f(CW\*(C`CvGV(cv) = gv\*(C'\fR is now a compile-time error. A new macro, +\&\f(CW\*(C`CvGV_set(cv,gv)\*(C'\fR has been introduced to run this operation +safely. Note that modification of this field is not part of the public +\&\s-1API,\s0 regardless of this new macro (and despite its being listed in this section). +.PP +\fI\f(BICvSTASH()\fI is no longer an lvalue\fR +.IX Subsection "CvSTASH() is no longer an lvalue" +.PP +The \fBCvSTASH()\fR macro can now only be used as an rvalue. \fBCvSTASH_set()\fR +has been added to replace assignment to \fBCvSTASH()\fR. This is to ensure +that backreferences are handled properly. These macros are not part of the +\&\s-1API.\s0 +.PP +\fICalling conventions for \f(CI\*(C`newFOROP\*(C'\fI and \f(CI\*(C`newWHILEOP\*(C'\fI\fR +.IX Subsection "Calling conventions for newFOROP and newWHILEOP" +.PP +The way the parser handles labels has been cleaned up and refactored. As a +result, the \fBnewFOROP()\fR constructor function no longer takes a parameter +stating what label is to go in the state op. +.PP +The \fBnewWHILEOP()\fR and \fBnewFOROP()\fR functions no longer accept a line +number as a parameter. +.PP +\fIFlags passed to \f(CI\*(C`uvuni_to_utf8_flags\*(C'\fI and \f(CI\*(C`utf8n_to_uvuni\*(C'\fI\fR +.IX Subsection "Flags passed to uvuni_to_utf8_flags and utf8n_to_uvuni" +.PP +Some of the flags parameters to \fBuvuni_to_utf8_flags()\fR and +\&\fButf8n_to_uvuni()\fR have changed. This is a result of Perl's now allowing +internal storage and manipulation of code points that are problematic +in some situations. Hence, the default actions for these functions has +been complemented to allow these code points. The new flags are +documented in perlapi. Code that requires the problematic code +points to be rejected needs to change to use the new flags. Some flag +names are retained for backward source compatibility, though they do +nothing, as they are now the default. However the flags +\&\f(CW\*(C`UNICODE_ALLOW_FDD0\*(C'\fR, \f(CW\*(C`UNICODE_ALLOW_FFFF\*(C'\fR, \f(CW\*(C`UNICODE_ILLEGAL\*(C'\fR, and +\&\f(CW\*(C`UNICODE_IS_ILLEGAL\*(C'\fR have been removed, as they stem from a +fundamentally broken model of how the Unicode non-character code points +should be handled, which is now described in +\&\*(L"Non-character code points\*(R" in perlunicode. See also the Unicode section +under \*(L"Selected Bug Fixes\*(R". +.SS "Deprecated C APIs" +.IX Subsection "Deprecated C APIs" +.ie n .IP """Perl_ptr_table_clear""" 4 +.el .IP "\f(CWPerl_ptr_table_clear\fR" 4 +.IX Item "Perl_ptr_table_clear" +\&\f(CW\*(C`Perl_ptr_table_clear\*(C'\fR is no longer part of Perl's public \s-1API.\s0 Calling it +now generates a deprecation warning, and it will be removed in a future +release. +.ie n .IP """sv_compile_2op""" 4 +.el .IP "\f(CWsv_compile_2op\fR" 4 +.IX Item "sv_compile_2op" +The \fBsv_compile_2op()\fR \s-1API\s0 function is now deprecated. Searches suggest +that nothing on \s-1CPAN\s0 is using it, so this should have zero impact. +.Sp +It attempted to provide an \s-1API\s0 to compile code down to an optree, but failed +to bind correctly to lexicals in the enclosing scope. It's not possible to +fix this problem within the constraints of its parameters and return value. +.ie n .IP """find_rundefsvoffset""" 4 +.el .IP "\f(CWfind_rundefsvoffset\fR" 4 +.IX Item "find_rundefsvoffset" +The \f(CW\*(C`find_rundefsvoffset\*(C'\fR function has been deprecated. It appeared that +its design was insufficient for reliably getting the lexical \f(CW$_\fR at +run-time. +.Sp +Use the new \f(CW\*(C`find_rundefsv\*(C'\fR function or the \f(CW\*(C`UNDERBAR\*(C'\fR macro +instead. They directly return the right \s-1SV\s0 +representing \f(CW$_\fR, whether it's +lexical or dynamic. +.ie n .IP """CALL_FPTR"" and ""CPERLscope""" 4 +.el .IP "\f(CWCALL_FPTR\fR and \f(CWCPERLscope\fR" 4 +.IX Item "CALL_FPTR and CPERLscope" +Those are left from an old implementation of \f(CW\*(C`MULTIPLICITY\*(C'\fR using \*(C+ objects, +which was removed in Perl 5.8. Nowadays these macros do exactly nothing, so +they shouldn't be used anymore. +.Sp +For compatibility, they are still defined for external \f(CW\*(C`XS\*(C'\fR code. Only +extensions defining \f(CW\*(C`PERL_CORE\*(C'\fR must be updated now. +.SS "Other Internal Changes" +.IX Subsection "Other Internal Changes" +\fIStack unwinding\fR +.IX Subsection "Stack unwinding" +.PP +The protocol for unwinding the C stack at the last stage of a \f(CW\*(C`die\*(C'\fR +has changed how it identifies the target stack frame. This now uses +a separate variable \f(CW\*(C`PL_restartjmpenv\*(C'\fR, where previously it relied on +the \f(CW\*(C`blk_eval.cur_top_env\*(C'\fR pointer in the \f(CW\*(C`eval\*(C'\fR context frame that +has nominally just been discarded. This change means that code running +during various stages of Perl-level unwinding no longer needs to take +care to avoid destroying the ghost frame. +.PP +\fIScope stack entries\fR +.IX Subsection "Scope stack entries" +.PP +The format of entries on the scope stack has been changed, resulting in a +reduction of memory usage of about 10%. In particular, the memory used by +the scope stack to record each active lexical variable has been halved. +.PP +\fIMemory allocation for pointer tables\fR +.IX Subsection "Memory allocation for pointer tables" +.PP +Memory allocation for pointer tables has been changed. Previously +\&\f(CW\*(C`Perl_ptr_table_store\*(C'\fR allocated memory from the same arena system as +\&\f(CW\*(C`SV\*(C'\fR bodies and \f(CW\*(C`HE\*(C'\fRs, with freed memory remaining bound to those arenas +until interpreter exit. Now it allocates memory from arenas private to the +specific pointer table, and that memory is returned to the system when +\&\f(CW\*(C`Perl_ptr_table_free\*(C'\fR is called. Additionally, allocation and release are +both less \s-1CPU\s0 intensive. +.PP +\fI\f(CI\*(C`UNDERBAR\*(C'\fI\fR +.IX Subsection "UNDERBAR" +.PP +The \f(CW\*(C`UNDERBAR\*(C'\fR macro now calls \f(CW\*(C`find_rundefsv\*(C'\fR. \f(CW\*(C`dUNDERBAR\*(C'\fR is now a +noop but should still be used to ensure past and future compatibility. +.PP +\fIString comparison routines renamed\fR +.IX Subsection "String comparison routines renamed" +.PP +The \f(CW\*(C`ibcmp_*\*(C'\fR functions have been renamed and are now called \f(CW\*(C`foldEQ\*(C'\fR, +\&\f(CW\*(C`foldEQ_locale\*(C'\fR, and \f(CW\*(C`foldEQ_utf8\*(C'\fR. The old names are still available as +macros. +.PP +\fI\f(CI\*(C`chop\*(C'\fI and \f(CI\*(C`chomp\*(C'\fI implementations merged\fR +.IX Subsection "chop and chomp implementations merged" +.PP +The opcode bodies for \f(CW\*(C`chop\*(C'\fR and \f(CW\*(C`chomp\*(C'\fR and for \f(CW\*(C`schop\*(C'\fR and \f(CW\*(C`schomp\*(C'\fR +have been merged. The implementation functions \fBPerl_do_chop()\fR and +\&\fBPerl_do_chomp()\fR, never part of the public \s-1API,\s0 have been merged and +moved to a static function in \fIpp.c\fR. This shrinks the Perl binary +slightly, and should not affect any code outside the core (unless it is +relying on the order of side-effects when \f(CW\*(C`chomp\*(C'\fR is passed a \fIlist\fR of +values). +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.SS "I/O" +.IX Subsection "I/O" +.IP "\(bu" 4 +Perl no longer produces this warning: +.Sp +.Vb 2 +\& $ perl \-we \*(Aqopen(my $f, ">", \emy $x); binmode($f, "scalar")\*(Aq +\& Use of uninitialized value in binmode at \-e line 1. +.Ve +.IP "\(bu" 4 +Opening a glob reference via \f(CW\*(C`open($fh, ">", \e*glob)\*(C'\fR no longer +causes the glob to be corrupted when the filehandle is printed to. This would +cause Perl to crash whenever the glob's contents were accessed +[perl #77492]. +.IP "\(bu" 4 +PerlIO no longer crashes when called recursively, such as from a signal +handler. Now it just leaks memory [perl #75556]. +.IP "\(bu" 4 +Most I/O functions were not warning for unopened handles unless the +\&\*(L"closed\*(R" and \*(L"unopened\*(R" warnings categories were both enabled. Now only +\&\f(CW\*(C`use warnings \*(Aqunopened\*(Aq\*(C'\fR is necessary to trigger these warnings, as +had always been the intention. +.IP "\(bu" 4 +There have been several fixes to PerlIO layers: +.Sp +When \f(CW\*(C`binmode(FH, ":crlf")\*(C'\fR pushes the \f(CW\*(C`:crlf\*(C'\fR layer on top of the stack, +it no longer enables crlf layers lower in the stack so as to avoid +unexpected results [perl #38456]. +.Sp +Opening a file in \f(CW\*(C`:raw\*(C'\fR mode now does what it advertises to do (first +open the file, then \f(CW\*(C`binmode\*(C'\fR it), instead of simply leaving off the top +layer [perl #80764]. +.Sp +The three layers \f(CW\*(C`:pop\*(C'\fR, \f(CW\*(C`:utf8\*(C'\fR, and \f(CW\*(C`:bytes\*(C'\fR didn't allow stacking when +opening a file. For example +this: +.Sp +.Vb 1 +\& open(FH, ">:pop:perlio", "some.file") or die $!; +.Ve +.Sp +would throw an \*(L"Invalid argument\*(R" error. This has been fixed in this +release [perl #82484]. +.SS "Regular Expression Bug Fixes" +.IX Subsection "Regular Expression Bug Fixes" +.IP "\(bu" 4 +The regular expression engine no longer loops when matching +\&\f(CW\*(C`"\eN{LATIN SMALL LIGATURE FF}" =~ /f+/i\*(C'\fR and similar expressions +[perl #72998] (5.12.1). +.IP "\(bu" 4 +The trie runtime code should no longer allocate massive amounts of memory, +fixing #74484. +.IP "\(bu" 4 +Syntax errors in \f(CW\*(C`(?{...})\*(C'\fR blocks no longer cause panic messages +[perl #2353]. +.IP "\(bu" 4 +A pattern like \f(CW\*(C`(?:(o){2})?\*(C'\fR no longer causes a \*(L"panic\*(R" error +[perl #39233]. +.IP "\(bu" 4 +A fatal error in regular expressions containing \f(CW\*(C`(.*?)\*(C'\fR when processing +\&\s-1UTF\-8\s0 data has been fixed [perl #75680] (5.12.2). +.IP "\(bu" 4 +An erroneous regular expression engine optimisation that caused regex verbs like +\&\f(CW*COMMIT\fR sometimes to be ignored has been removed. +.IP "\(bu" 4 +The regular expression bracketed character class \f(CW\*(C`[\e8\e9]\*(C'\fR was effectively the +same as \f(CW\*(C`[89\e000]\*(C'\fR, incorrectly matching a \s-1NULL\s0 character. It also gave +incorrect warnings that the \f(CW8\fR and \f(CW9\fR were ignored. Now \f(CW\*(C`[\e8\e9]\*(C'\fR is the +same as \f(CW\*(C`[89]\*(C'\fR and gives legitimate warnings that \f(CW\*(C`\e8\*(C'\fR and \f(CW\*(C`\e9\*(C'\fR are +unrecognized escape sequences, passed-through. +.IP "\(bu" 4 +A regular expression match in the right-hand side of a global substitution +(\f(CW\*(C`s///g\*(C'\fR) that is in the same scope will no longer cause match variables +to have the wrong values on subsequent iterations. This can happen when an +array or hash subscript is interpolated in the right-hand side, as in +\&\f(CW\*(C`s|(.)|@a{ print($1), /./ }|g\*(C'\fR [perl #19078]. +.IP "\(bu" 4 +Several cases in which characters in the Latin\-1 non-ASCII range (0x80 to +0xFF) used not to match themselves, or used to match both a character class +and its complement, have been fixed. For instance, U+00E2 could match both +\&\f(CW\*(C`\ew\*(C'\fR and \f(CW\*(C`\eW\*(C'\fR [perl #78464] [perl #18281] [perl #60156]. +.IP "\(bu" 4 +Matching a Unicode character against an alternation containing characters +that happened to match continuation bytes in the former's \s-1UTF8\s0 +representation (like \f(CW\*(C`qq{\ex{30ab}} =~ /\exab|\exa9/\*(C'\fR) would cause erroneous +warnings [perl #70998]. +.IP "\(bu" 4 +The trie optimisation was not taking empty groups into account, preventing +\&\*(L"foo\*(R" from matching \f(CW\*(C`/\eA(?:(?:)foo|bar|zot)\ez/\*(C'\fR [perl #78356]. +.IP "\(bu" 4 +A pattern containing a \f(CW\*(C`+\*(C'\fR inside a lookahead would sometimes cause an +incorrect match failure in a global match (for example, \f(CW\*(C`/(?=(\eS+))/g\*(C'\fR) +[perl #68564]. +.IP "\(bu" 4 +A regular expression optimisation would sometimes cause a match with a +\&\f(CW\*(C`{n,m}\*(C'\fR quantifier to fail when it should have matched [perl #79152]. +.IP "\(bu" 4 +Case-insensitive matching in regular expressions compiled under +\&\f(CW\*(C`use locale\*(C'\fR now works much more sanely when the pattern or target +string is internally encoded in \s-1UTF8.\s0 Previously, under these +conditions the localeness was completely lost. Now, code points +above 255 are treated as Unicode, but code points between 0 and 255 +are treated using the current locale rules, regardless of whether +the pattern or the string is encoded in \s-1UTF8.\s0 The few case-insensitive +matches that cross the 255/256 boundary are not allowed. For +example, 0xFF does not caselessly match the character at 0x178, +\&\s-1LATIN CAPITAL LETTER Y WITH DIAERESIS,\s0 because 0xFF may not be \s-1LATIN +SMALL LETTER Y\s0 in the current locale, and Perl has no way of knowing +if that character even exists in the locale, much less what code +point it is. +.IP "\(bu" 4 +The \f(CW\*(C`(?|...)\*(C'\fR regular expression construct no longer crashes if the final +branch has more sets of capturing parentheses than any other branch. This +was fixed in Perl 5.10.1 for the case of a single branch, but that fix did +not take multiple branches into account [perl #84746]. +.IP "\(bu" 4 +A bug has been fixed in the implementation of \f(CW\*(C`{...}\*(C'\fR quantifiers in +regular expressions that prevented the code block in +\&\f(CW\*(C`/((\ew+)(?{ print $2 })){2}/\*(C'\fR from seeing the \f(CW$2\fR sometimes +[perl #84294]. +.SS "Syntax/Parsing Bugs" +.IX Subsection "Syntax/Parsing Bugs" +.IP "\(bu" 4 +\&\f(CW\*(C`when (scalar) {...}\*(C'\fR no longer crashes, but produces a syntax error +[perl #74114] (5.12.1). +.IP "\(bu" 4 +A label right before a string eval (\f(CW\*(C`foo: eval $string\*(C'\fR) no longer causes +the label to be associated also with the first statement inside the eval +[perl #74290] (5.12.1). +.IP "\(bu" 4 +The \f(CW\*(C`no 5.13.2\*(C'\fR form of \f(CW\*(C`no\*(C'\fR no longer tries to turn on features or +pragmata (like strict) [perl #70075] (5.12.2). +.IP "\(bu" 4 +\&\f(CW\*(C`BEGIN {require 5.12.0}\*(C'\fR now behaves as documented, rather than behaving +identically to \f(CW\*(C`use 5.12.0\*(C'\fR. Previously, \f(CW\*(C`require\*(C'\fR in a \f(CW\*(C`BEGIN\*(C'\fR block +was erroneously executing the \f(CW\*(C`use feature \*(Aq:5.12.0\*(Aq\*(C'\fR and +\&\f(CW\*(C`use strict\*(C'\fR behaviour, which only \f(CW\*(C`use\*(C'\fR was documented to +provide [perl #69050]. +.IP "\(bu" 4 +A regression introduced in Perl 5.12.0, making +\&\f(CW\*(C`my $x = 3; $x = length(undef)\*(C'\fR result in \f(CW$x\fR set to \f(CW3\fR has been +fixed. \f(CW$x\fR will now be \f(CW\*(C`undef\*(C'\fR [perl #85508] (5.12.2). +.IP "\(bu" 4 +When strict \*(L"refs\*(R" mode is off, \f(CW\*(C`%{...}\*(C'\fR in rvalue context returns +\&\f(CW\*(C`undef\*(C'\fR if its argument is undefined. An optimisation introduced in Perl +5.12.0 to make \f(CW\*(C`keys %{...}\*(C'\fR faster when used as a boolean did not take +this into account, causing \f(CW\*(C`keys %{+undef}\*(C'\fR (and \f(CW\*(C`keys %$foo\*(C'\fR when +\&\f(CW$foo\fR is undefined) to be an error, which it should be so in strict +mode only [perl #81750]. +.IP "\(bu" 4 +Constant-folding used to cause +.Sp +.Vb 1 +\& $text =~ ( 1 ? /phoo/ : /bear/) +.Ve +.Sp +to turn into +.Sp +.Vb 1 +\& $text =~ /phoo/ +.Ve +.Sp +at compile time. Now it correctly matches against \f(CW$_\fR [perl #20444]. +.IP "\(bu" 4 +Parsing Perl code (either with string \f(CW\*(C`eval\*(C'\fR or by loading modules) from +within a \f(CW\*(C`UNITCHECK\*(C'\fR block no longer causes the interpreter to crash +[perl #70614]. +.IP "\(bu" 4 +String \f(CW\*(C`eval\*(C'\fRs no longer fail after 2 billion scopes have been +compiled [perl #83364]. +.IP "\(bu" 4 +The parser no longer hangs when encountering certain Unicode characters, +such as U+387 [perl #74022]. +.IP "\(bu" 4 +Defining a constant with the same name as one of Perl's special blocks +(like \f(CW\*(C`INIT\*(C'\fR) stopped working in 5.12.0, but has now been fixed +[perl #78634]. +.IP "\(bu" 4 +A reference to a literal value used as a hash key (\f(CW$hash{\e"foo"}\fR) used +to be stringified, even if the hash was tied [perl #79178]. +.IP "\(bu" 4 +A closure containing an \f(CW\*(C`if\*(C'\fR statement followed by a constant or variable +is no longer treated as a constant [perl #63540]. +.IP "\(bu" 4 +\&\f(CW\*(C`state\*(C'\fR can now be used with attributes. It +used to mean the same thing as +\&\f(CW\*(C`my\*(C'\fR if any attributes were present [perl #68658]. +.IP "\(bu" 4 +Expressions like \f(CW\*(C`@$a > 3\*(C'\fR no longer cause \f(CW$a\fR to be mentioned in +the \*(L"Use of uninitialized value in numeric gt\*(R" warning when \f(CW$a\fR is +undefined (since it is not part of the \f(CW\*(C`>\*(C'\fR expression, but the operand +of the \f(CW\*(C`@\*(C'\fR) [perl #72090]. +.IP "\(bu" 4 +Accessing an element of a package array with a hard-coded number (as +opposed to an arbitrary expression) would crash if the array did not exist. +Usually the array would be autovivified during compilation, but typeglob +manipulation could remove it, as in these two cases which used to crash: +.Sp +.Vb 2 +\& *d = *a; print $d[0]; +\& undef *d; print $d[0]; +.Ve +.IP "\(bu" 4 +The \fB\-C\fR command-line option, when used on the shebang line, can now be +followed by other options [perl #72434]. +.IP "\(bu" 4 +The \f(CW\*(C`B\*(C'\fR module was returning \f(CW\*(C`B::OP\*(C'\fRs instead of \f(CW\*(C`B::LOGOP\*(C'\fRs for +\&\f(CW\*(C`entertry\*(C'\fR [perl #80622]. This was due to a bug in the Perl core, +not in \f(CW\*(C`B\*(C'\fR itself. +.SS "Stashes, Globs and Method Lookup" +.IX Subsection "Stashes, Globs and Method Lookup" +Perl 5.10.0 introduced a new internal mechanism for caching MROs (method +resolution orders, or lists of parent classes; aka \*(L"isa\*(R" caches) to make +method lookup faster (so \f(CW@ISA\fR arrays would not have to be searched +repeatedly). Unfortunately, this brought with it quite a few bugs. Almost +all of these have been fixed now, along with a few MRO-related bugs that +existed before 5.10.0: +.IP "\(bu" 4 +The following used to have erratic effects on method resolution, because +the \*(L"isa\*(R" caches were not reset or otherwise ended up listing the wrong +classes. These have been fixed. +.RS 4 +.IP "Aliasing packages by assigning to globs [perl #77358]" 4 +.IX Item "Aliasing packages by assigning to globs [perl #77358]" +.PD 0 +.IP "Deleting packages by deleting their containing stash elements" 4 +.IX Item "Deleting packages by deleting their containing stash elements" +.ie n .IP "Undefining the glob containing a package (""undef *Foo::"")" 4 +.el .IP "Undefining the glob containing a package (\f(CWundef *Foo::\fR)" 4 +.IX Item "Undefining the glob containing a package (undef *Foo::)" +.ie n .IP "Undefining an \s-1ISA\s0 glob (""undef *Foo::ISA"")" 4 +.el .IP "Undefining an \s-1ISA\s0 glob (\f(CWundef *Foo::ISA\fR)" 4 +.IX Item "Undefining an ISA glob (undef *Foo::ISA)" +.ie n .IP "Deleting an \s-1ISA\s0 stash element (""delete $Foo::{ISA}"")" 4 +.el .IP "Deleting an \s-1ISA\s0 stash element (\f(CWdelete $Foo::{ISA}\fR)" 4 +.IX Item "Deleting an ISA stash element (delete $Foo::{ISA})" +.ie n .IP "Sharing @ISA arrays between classes (via ""*Foo::ISA = \e@Bar::ISA"" or ""*Foo::ISA = *Bar::ISA"") [perl #77238]" 4 +.el .IP "Sharing \f(CW@ISA\fR arrays between classes (via \f(CW*Foo::ISA = \e@Bar::ISA\fR or \f(CW*Foo::ISA = *Bar::ISA\fR) [perl #77238]" 4 +.IX Item "Sharing @ISA arrays between classes (via *Foo::ISA = @Bar::ISA or *Foo::ISA = *Bar::ISA) [perl #77238]" +.RE +.RS 4 +.PD +.Sp +\&\f(CW\*(C`undef *Foo::ISA\*(C'\fR would even stop a new \f(CW@Foo::ISA\fR array from updating +caches. +.RE +.IP "\(bu" 4 +Typeglob assignments would crash if the glob's stash no longer existed, so +long as the glob assigned to were named \f(CW\*(C`ISA\*(C'\fR or the glob on either side of +the assignment contained a subroutine. +.IP "\(bu" 4 +\&\f(CW\*(C`PL_isarev\*(C'\fR, which is accessible to Perl via \f(CW\*(C`mro::get_isarev\*(C'\fR is now +updated properly when packages are deleted or removed from the \f(CW@ISA\fR of +other classes. This allows many packages to be created and deleted without +causing a memory leak [perl #75176]. +.PP +In addition, various other bugs related to typeglobs and stashes have been +fixed: +.IP "\(bu" 4 +Some work has been done on the internal pointers that link between symbol +tables (stashes), typeglobs, and subroutines. This has the effect that +various edge cases related to deleting stashes or stash entries (for example, +<%FOO:: = ()>), and complex typeglob or code-reference aliasing, will no +longer crash the interpreter. +.IP "\(bu" 4 +Assigning a reference to a glob copy now assigns to a glob slot instead of +overwriting the glob with a scalar [perl #1804] [perl #77508]. +.IP "\(bu" 4 +A bug when replacing the glob of a loop variable within the loop has been fixed +[perl #21469]. This +means the following code will no longer crash: +.Sp +.Vb 3 +\& for $x (...) { +\& *x = *y; +\& } +.Ve +.IP "\(bu" 4 +Assigning a glob to a \s-1PVLV\s0 used to convert it to a plain string. Now it +works correctly, and a \s-1PVLV\s0 can hold a glob. This would happen when a +nonexistent hash or array element was passed to a subroutine: +.Sp +.Vb 2 +\& sub { $_[0] = *foo }\->($hash{key}); +\& # $_[0] would have been the string "*main::foo" +.Ve +.Sp +It also happened when a glob was assigned to, or returned from, an element +of a tied array or hash [perl #36051]. +.IP "\(bu" 4 +When trying to report \f(CW\*(C`Use of uninitialized value $Foo::BAR\*(C'\fR, crashes could +occur if the glob holding the global variable in question had been detached +from its original stash by, for example, \f(CW\*(C`delete $::{"Foo::"}\*(C'\fR. This has +been fixed by disabling the reporting of variable names in those +cases. +.IP "\(bu" 4 +During the restoration of a localised typeglob on scope exit, any +destructors called as a result would be able to see the typeglob in an +inconsistent state, containing freed entries, which could result in a +crash. This would affect code like this: +.Sp +.Vb 5 +\& local *@; +\& eval { die bless [] }; # puts an object in $@ +\& sub DESTROY { +\& local $@; # boom +\& } +.Ve +.Sp +Now the glob entries are cleared before any destructors are called. This +also means that destructors can vivify entries in the glob. So Perl tries +again and, if the entries are re-created too many times, dies with a +\&\*(L"panic: gp_free ...\*(R" error message. +.IP "\(bu" 4 +If a typeglob is freed while a subroutine attached to it is still +referenced elsewhere, the subroutine is renamed to \f(CW\*(C`_\|_ANON_\|_\*(C'\fR in the same +package, unless the package has been undefined, in which case the \f(CW\*(C`_\|_ANON_\|_\*(C'\fR +package is used. This could cause packages to be sometimes autovivified, +such as if the package had been deleted. Now this no longer occurs. +The \f(CW\*(C`_\|_ANON_\|_\*(C'\fR package is also now used when the original package is +no longer attached to the symbol table. This avoids memory leaks in some +cases [perl #87664]. +.IP "\(bu" 4 +Subroutines and package variables inside a package whose name ends with +\&\f(CW\*(C`::\*(C'\fR can now be accessed with a fully qualified name. +.SS "Unicode" +.IX Subsection "Unicode" +.IP "\(bu" 4 +What has become known as \*(L"the Unicode Bug\*(R" is almost completely resolved in +this release. Under \f(CW\*(C`use feature \*(Aqunicode_strings\*(Aq\*(C'\fR (which is +automatically selected by \f(CW\*(C`use 5.012\*(C'\fR and above), the internal +storage format of a string no longer affects the external semantics. +[perl #58182]. +.Sp +There are two known exceptions: +.RS 4 +.IP "1." 4 +The now-deprecated, user-defined case-changing +functions require utf8\-encoded strings to operate. The \s-1CPAN\s0 module +Unicode::Casing has been written to replace this feature without its +drawbacks, and the feature is scheduled to be removed in 5.16. +.IP "2." 4 +\&\fBquotemeta()\fR (and its in-line equivalent \f(CW\*(C`\eQ\*(C'\fR) can also give different +results depending on whether a string is encoded in \s-1UTF\-8.\s0 See +\&\*(L"The \*(R"Unicode Bug"" in perlunicode. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +Handling of Unicode non-character code points has changed. +Previously they were mostly considered illegal, except that in some +place only one of the 66 of them was known. The Unicode Standard +considers them all legal, but forbids their \*(L"open interchange\*(R". +This is part of the change to allow internal use of any code +point (see \*(L"Core Enhancements\*(R"). Together, these changes resolve +[perl #38722], [perl #51918], [perl #51936], and [perl #63446]. +.IP "\(bu" 4 +Case-insensitive \f(CW"/i"\fR regular expression matching of Unicode +characters that match multiple characters now works much more as +intended. For example +.Sp +.Vb 1 +\& "\eN{LATIN SMALL LIGATURE FFI}" =~ /ffi/ui +.Ve +.Sp +and +.Sp +.Vb 1 +\& "ffi" =~ /\eN{LATIN SMALL LIGATURE FFI}/ui +.Ve +.Sp +are both true. Previously, there were many bugs with this feature. +What hasn't been fixed are the places where the pattern contains the +multiple characters, but the characters are split up by other things, +such as in +.Sp +.Vb 1 +\& "\eN{LATIN SMALL LIGATURE FFI}" =~ /(f)(f)i/ui +.Ve +.Sp +or +.Sp +.Vb 1 +\& "\eN{LATIN SMALL LIGATURE FFI}" =~ /ffi*/ui +.Ve +.Sp +or +.Sp +.Vb 1 +\& "\eN{LATIN SMALL LIGATURE FFI}" =~ /[a\-f][f\-m][g\-z]/ui +.Ve +.Sp +None of these match. +.Sp +Also, this matching doesn't fully conform to the current Unicode +Standard, which asks that the matching be made upon the \s-1NFD\s0 +(Normalization Form Decomposed) of the text. However, as of this +writing (April 2010), the Unicode Standard is currently in flux about +what they will recommend doing with regard in such scenarios. It may be +that they will throw out the whole concept of multi-character matches. +[perl #71736]. +.IP "\(bu" 4 +Naming a deprecated character in \f(CW\*(C`\eN{\f(CINAME\f(CW}\*(C'\fR no longer leaks memory. +.IP "\(bu" 4 +We fixed a bug that could cause \f(CW\*(C`\eN{\f(CINAME\f(CW}\*(C'\fR constructs followed by +a single \f(CW"."\fR to be parsed incorrectly [perl #74978] (5.12.1). +.IP "\(bu" 4 +\&\f(CW\*(C`chop\*(C'\fR now correctly handles characters above \f(CW"\ex{7fffffff}"\fR +[perl #73246]. +.IP "\(bu" 4 +Passing to \f(CW\*(C`index\*(C'\fR an offset beyond the end of the string when the string +is encoded internally in \s-1UTF8\s0 no longer causes panics [perl #75898]. +.IP "\(bu" 4 +\&\fBwarn()\fR and \fBdie()\fR now respect utf8\-encoded scalars [perl #45549]. +.IP "\(bu" 4 +Sometimes the \s-1UTF8\s0 length cache would not be reset on a value +returned by substr, causing \f(CW\*(C`length(substr($uni_string, ...))\*(C'\fR to give +wrong answers. With \f(CW\*(C`${^UTF8CACHE}\*(C'\fR set to \-1, it would also produce +a \*(L"panic\*(R" error message [perl #77692]. +.SS "Ties, Overloading and Other Magic" +.IX Subsection "Ties, Overloading and Other Magic" +.IP "\(bu" 4 +Overloading now works properly in conjunction with tied +variables. What formerly happened was that most ops checked their +arguments for overloading \fIbefore\fR checking for magic, so for example +an overloaded object returned by a tied array access would usually be +treated as not overloaded [\s-1RT\s0 #57012]. +.IP "\(bu" 4 +Various instances of magic (like tie methods) being called on tied variables +too many or too few times have been fixed: +.RS 4 +.IP "\(bu" 4 +\&\f(CW\*(C`$tied\->()\*(C'\fR did not always call \s-1FETCH\s0 [perl #8438]. +.IP "\(bu" 4 +Filetest operators and \f(CW\*(C`y///\*(C'\fR and \f(CW\*(C`tr///\*(C'\fR were calling \s-1FETCH\s0 too +many times. +.IP "\(bu" 4 +The \f(CW\*(C`=\*(C'\fR operator used to ignore magic on its right-hand side if the +scalar happened to hold a typeglob (if a typeglob was the last thing +returned from or assigned to a tied scalar) [perl #77498]. +.IP "\(bu" 4 +Dereference operators used to ignore magic if the argument was a +reference already (such as from a previous \s-1FETCH\s0) [perl #72144]. +.IP "\(bu" 4 +\&\f(CW\*(C`splice\*(C'\fR now calls set-magic (so changes made +by \f(CW\*(C`splice @ISA\*(C'\fR are respected by method calls) [perl #78400]. +.IP "\(bu" 4 +In-memory files created by \f(CW\*(C`open($fh, ">", \e$buffer)\*(C'\fR were not calling +\&\s-1FETCH/STORE\s0 at all [perl #43789] (5.12.2). +.IP "\(bu" 4 +\&\fButf8::is_utf8()\fR now respects get-magic (like \f(CW$1\fR) (5.12.1). +.RE +.RS 4 +.RE +.IP "\(bu" 4 +Non-commutative binary operators used to swap their operands if the same +tied scalar was used for both operands and returned a different value for +each \s-1FETCH.\s0 For instance, if \f(CW$t\fR returned 2 the first time and 3 the +second, then \f(CW\*(C`$t/$t\*(C'\fR would evaluate to 1.5. This has been fixed +[perl #87708]. +.IP "\(bu" 4 +String \f(CW\*(C`eval\*(C'\fR now detects taintedness of overloaded or tied +arguments [perl #75716]. +.IP "\(bu" 4 +String \f(CW\*(C`eval\*(C'\fR and regular expression matches against objects with string +overloading no longer cause memory corruption or crashes [perl #77084]. +.IP "\(bu" 4 +readline now honors \f(CW\*(C`<>\*(C'\fR overloading on tied +arguments. +.IP "\(bu" 4 +\&\f(CW\*(C`\*(C'\fR always respects overloading now if the expression is +overloaded. +.Sp +Because \*(L"<>\ as glob\*(R" was parsed differently from +\&\*(L"<>\ as filehandle\*(R" from 5.6 onwards, something like \f(CW\*(C`<$foo[0]>\*(C'\fR did +not handle overloading, even if \f(CW$foo[0]\fR was an overloaded object. This +was contrary to the documentation for overload, and meant that \f(CW\*(C`<>\*(C'\fR +could not be used as a general overloaded iterator operator. +.IP "\(bu" 4 +The fallback behaviour of overloading on binary operators was asymmetric +[perl #71286]. +.IP "\(bu" 4 +Magic applied to variables in the main package no longer affects other packages. +See \*(L"Magic variables outside the main package\*(R" above [perl #76138]. +.IP "\(bu" 4 +Sometimes magic (ties, taintedness, etc.) attached to variables could cause +an object to last longer than it should, or cause a crash if a tied +variable were freed from within a tie method. These have been fixed +[perl #81230]. +.IP "\(bu" 4 +\&\s-1DESTROY\s0 methods of objects implementing ties are no longer able to crash by +accessing the tied variable through a weak reference [perl #86328]. +.IP "\(bu" 4 +Fixed a regression of \fBkill()\fR when a match variable is used for the +process \s-1ID\s0 to kill [perl #75812]. +.IP "\(bu" 4 +\&\f(CW$AUTOLOAD\fR used to remain tainted forever if it ever became tainted. Now +it is correctly untainted if an autoloaded method is called and the method +name was not tainted. +.IP "\(bu" 4 +\&\f(CW\*(C`sprintf\*(C'\fR now dies when passed a tainted scalar for the format. It did +already die for arbitrary expressions, but not for simple scalars +[perl #82250]. +.IP "\(bu" 4 +\&\f(CW\*(C`lc\*(C'\fR, \f(CW\*(C`uc\*(C'\fR, \f(CW\*(C`lcfirst\*(C'\fR, and \f(CW\*(C`ucfirst\*(C'\fR no longer return untainted strings +when the argument is tainted. This has been broken since perl 5.8.9 +[perl #87336]. +.SS "The Debugger" +.IX Subsection "The Debugger" +.IP "\(bu" 4 +The Perl debugger now also works in taint mode [perl #76872]. +.IP "\(bu" 4 +Subroutine redefinition works once more in the debugger [perl #48332]. +.IP "\(bu" 4 +When \fB\-d\fR is used on the shebang (\f(CW\*(C`#!\*(C'\fR) line, the debugger now has access +to the lines of the main program. In the past, this sometimes worked and +sometimes did not, depending on the order in which things happened to be +arranged in memory [perl #71806]. +.IP "\(bu" 4 +A possible memory leak when using \fBcaller()\fR to set +\&\f(CW@DB::args\fR has been fixed (5.12.2). +.IP "\(bu" 4 +Perl no longer stomps on \f(CW$DB::single\fR, \f(CW$DB::trace\fR, and \f(CW$DB::signal\fR +if these variables already have values when \f(CW$^P\fR is assigned to [perl #72422]. +.IP "\(bu" 4 +\&\f(CW\*(C`#line\*(C'\fR directives in string evals were not properly updating the arrays +of lines of code (\f(CW\*(C`@{"_< ..."}\*(C'\fR) that the debugger (or any debugging or +profiling module) uses. In threaded builds, they were not being updated at +all. In non-threaded builds, the line number was ignored, so any change to +the existing line number would cause the lines to be misnumbered +[perl #79442]. +.SS "Threads" +.IX Subsection "Threads" +.IP "\(bu" 4 +Perl no longer accidentally clones lexicals in scope within active stack +frames in the parent when creating a child thread [perl #73086]. +.IP "\(bu" 4 +Several memory leaks in cloning and freeing threaded Perl interpreters have been +fixed [perl #77352]. +.IP "\(bu" 4 +Creating a new thread when directory handles were open used to cause a +crash, because the handles were not cloned, but simply passed to the new +thread, resulting in a double free. +.Sp +Now directory handles are cloned properly on Windows +and on systems that have a \f(CW\*(C`fchdir\*(C'\fR function. On other +systems, new threads simply do not inherit directory +handles from their parent threads [perl #75154]. +.IP "\(bu" 4 +The typeglob \f(CW\*(C`*,\*(C'\fR, which holds the scalar variable \f(CW$,\fR (output field +separator), had the wrong reference count in child threads. +.IP "\(bu" 4 +[perl #78494] When pipes are shared between threads, the \f(CW\*(C`close\*(C'\fR function +(and any implicit close, such as on thread exit) no longer blocks. +.IP "\(bu" 4 +Perl now does a timely cleanup of SVs that are cloned into a new +thread but then discovered to be orphaned (that is, their owners +are \fInot\fR cloned). This eliminates several \*(L"scalars leaked\*(R" +warnings when joining threads. +.SS "Scoping and Subroutines" +.IX Subsection "Scoping and Subroutines" +.IP "\(bu" 4 +Lvalue subroutines are again able to return copy-on-write scalars. This +had been broken since version 5.10.0 [perl #75656] (5.12.3). +.IP "\(bu" 4 +\&\f(CW\*(C`require\*(C'\fR no longer causes \f(CW\*(C`caller\*(C'\fR to return the wrong file name for +the scope that called \f(CW\*(C`require\*(C'\fR and other scopes higher up that had the +same file name [perl #68712]. +.IP "\(bu" 4 +\&\f(CW\*(C`sort\*(C'\fR with a \f(CW\*(C`($$)\*(C'\fR\-prototyped comparison routine used to cause the value +of \f(CW@_\fR to leak out of the sort. Taking a reference to \f(CW@_\fR within the +sorting routine could cause a crash [perl #72334]. +.IP "\(bu" 4 +Match variables (like \f(CW$1\fR) no longer persist between calls to a sort +subroutine [perl #76026]. +.IP "\(bu" 4 +Iterating with \f(CW\*(C`foreach\*(C'\fR over an array returned by an lvalue sub now works +[perl #23790]. +.IP "\(bu" 4 +\&\f(CW$@\fR is now localised during calls to \f(CW\*(C`binmode\*(C'\fR to prevent action at a +distance [perl #78844]. +.IP "\(bu" 4 +Calling a closure prototype (what is passed to an attribute handler for a +closure) now results in a \*(L"Closure prototype called\*(R" error message instead +of a crash [perl #68560]. +.IP "\(bu" 4 +Mentioning a read-only lexical variable from the enclosing scope in a +string \f(CW\*(C`eval\*(C'\fR no longer causes the variable to become writable +[perl #19135]. +.SS "Signals" +.IX Subsection "Signals" +.IP "\(bu" 4 +Within signal handlers, \f(CW$!\fR is now implicitly localized. +.IP "\(bu" 4 +\&\s-1CHLD\s0 signals are no longer unblocked after a signal handler is called if +they were blocked before by \f(CW\*(C`POSIX::sigprocmask\*(C'\fR [perl #82040]. +.IP "\(bu" 4 +A signal handler called within a signal handler could cause leaks or +double-frees. Now fixed [perl #76248]. +.SS "Miscellaneous Memory Leaks" +.IX Subsection "Miscellaneous Memory Leaks" +.IP "\(bu" 4 +Several memory leaks when loading \s-1XS\s0 modules were fixed (5.12.2). +.IP "\(bu" 4 +\&\fBsubstr()\fR, +\&\fBpos()\fR, \fBkeys()\fR, +and \fBvec()\fR could, when used in combination +with lvalues, result in leaking the scalar value they operate on, and cause its +destruction to happen too late. This has now been fixed. +.IP "\(bu" 4 +The postincrement and postdecrement operators, \f(CW\*(C`++\*(C'\fR and \f(CW\*(C`\-\-\*(C'\fR, used to cause +leaks when used on references. This has now been fixed. +.IP "\(bu" 4 +Nested \f(CW\*(C`map\*(C'\fR and \f(CW\*(C`grep\*(C'\fR blocks no longer leak memory when processing +large lists [perl #48004]. +.IP "\(bu" 4 +\&\f(CW\*(C`use \f(CIVERSION\f(CW\*(C'\fR and \f(CW\*(C`no \f(CIVERSION\f(CW\*(C'\fR no longer leak memory [perl #78436] +[perl #69050]. +.IP "\(bu" 4 +\&\f(CW\*(C`.=\*(C'\fR followed by \f(CW\*(C`<>\*(C'\fR or \f(CW\*(C`readline\*(C'\fR would leak memory if \f(CW$/\fR +contained characters beyond the octet range and the scalar assigned to +happened to be encoded as \s-1UTF8\s0 internally [perl #72246]. +.IP "\(bu" 4 +\&\f(CW\*(C`eval \*(AqBEGIN{die}\*(Aq\*(C'\fR no longer leaks memory on non-threaded builds. +.SS "Memory Corruption and Crashes" +.IX Subsection "Memory Corruption and Crashes" +.IP "\(bu" 4 +\&\fBglob()\fR no longer crashes when \f(CW%File::Glob::\fR is empty and +\&\f(CW\*(C`CORE::GLOBAL::glob\*(C'\fR isn't present [perl #75464] (5.12.2). +.IP "\(bu" 4 +\&\fBreadline()\fR has been fixed when interrupted by signals so it no longer +returns the \*(L"same thing\*(R" as before or random memory. +.IP "\(bu" 4 +When assigning a list with duplicated keys to a hash, the assignment used to +return garbage and/or freed values: +.Sp +.Vb 1 +\& @a = %h = (list with some duplicate keys); +.Ve +.Sp +This has now been fixed [perl #31865]. +.IP "\(bu" 4 +The mechanism for freeing objects in globs used to leave dangling +pointers to freed SVs, meaning Perl users could see corrupted state +during destruction. +.Sp +Perl now frees only the affected slots of the \s-1GV,\s0 rather than freeing +the \s-1GV\s0 itself. This makes sure that there are no dangling refs or +corrupted state during destruction. +.IP "\(bu" 4 +The interpreter no longer crashes when freeing deeply-nested arrays of +arrays. Hashes have not been fixed yet [perl #44225]. +.IP "\(bu" 4 +Concatenating long strings under \f(CW\*(C`use encoding\*(C'\fR no longer causes Perl to +crash [perl #78674]. +.IP "\(bu" 4 +Calling \f(CW\*(C`\->import\*(C'\fR on a class lacking an import method could corrupt +the stack, resulting in strange behaviour. For instance, +.Sp +.Vb 1 +\& push @a, "foo", $b = bar\->import; +.Ve +.Sp +would assign \*(L"foo\*(R" to \f(CW$b\fR [perl #63790]. +.IP "\(bu" 4 +The \f(CW\*(C`recv\*(C'\fR function could crash when called with the \s-1MSG_TRUNC\s0 flag +[perl #75082]. +.IP "\(bu" 4 +\&\f(CW\*(C`formline\*(C'\fR no longer crashes when passed a tainted format picture. It also +taints \f(CW$^A\fR now if its arguments are tainted [perl #79138]. +.IP "\(bu" 4 +A bug in how we process filetest operations could cause a segfault. +Filetests don't always expect an op on the stack, so we now use +TOPs only if we're sure that we're not \f(CW\*(C`stat\*(C'\fRing the \f(CW\*(C`_\*(C'\fR filehandle. +This is indicated by \f(CW\*(C`OPf_KIDS\*(C'\fR (as checked in ck_ftst) [perl #74542] +(5.12.1). +.IP "\(bu" 4 +\&\fBunpack()\fR now handles scalar context correctly for \f(CW%32H\fR and \f(CW%32u\fR, +fixing a potential crash. \fBsplit()\fR would crash because the third item +on the stack wasn't the regular expression it expected. \f(CW\*(C`unpack("%2H", +\&...)\*(C'\fR would return both the unpacked result and the checksum on the stack, +as would \f(CW\*(C`unpack("%2u", ...)\*(C'\fR [perl #73814] (5.12.2). +.SS "Fixes to Various Perl Operators" +.IX Subsection "Fixes to Various Perl Operators" +.IP "\(bu" 4 +The \f(CW\*(C`&\*(C'\fR, \f(CW\*(C`|\*(C'\fR, and \f(CW\*(C`^\*(C'\fR bitwise operators no longer coerce read-only arguments +[perl #20661]. +.IP "\(bu" 4 +Stringifying a scalar containing \*(L"\-0.0\*(R" no longer has the effect of turning +false into true [perl #45133]. +.IP "\(bu" 4 +Some numeric operators were converting integers to floating point, +resulting in loss of precision on 64\-bit platforms [perl #77456]. +.IP "\(bu" 4 +\&\fBsprintf()\fR was ignoring locales when called with constant arguments +[perl #78632]. +.IP "\(bu" 4 +Combining the vector (\f(CW%v\fR) flag and dynamic precision would +cause \f(CW\*(C`sprintf\*(C'\fR to confuse the order of its arguments, making it +treat the string as the precision and vice-versa [perl #83194]. +.SS "Bugs Relating to the C \s-1API\s0" +.IX Subsection "Bugs Relating to the C API" +.IP "\(bu" 4 +The C\-level \f(CW\*(C`lex_stuff_pvn\*(C'\fR function would sometimes cause a spurious +syntax error on the last line of the file if it lacked a final semicolon +[perl #74006] (5.12.1). +.IP "\(bu" 4 +The \f(CW\*(C`eval_sv\*(C'\fR and \f(CW\*(C`eval_pv\*(C'\fR C functions now set \f(CW$@\fR correctly when +there is a syntax error and no \f(CW\*(C`G_KEEPERR\*(C'\fR flag, and never set it if the +\&\f(CW\*(C`G_KEEPERR\*(C'\fR flag is present [perl #3719]. +.IP "\(bu" 4 +The \s-1XS\s0 multicall \s-1API\s0 no longer causes subroutines to lose reference counts +if called via the multicall interface from within those very subroutines. +This affects modules like List::Util. Calling one of its functions with an +active subroutine as the first argument could cause a crash [perl #78070]. +.IP "\(bu" 4 +The \f(CW\*(C`SvPVbyte\*(C'\fR function available to \s-1XS\s0 modules now calls magic before +downgrading the \s-1SV,\s0 to avoid warnings about wide characters [perl #72398]. +.IP "\(bu" 4 +The ref types in the typemap for \s-1XS\s0 bindings now support magical variables +[perl #72684]. +.IP "\(bu" 4 +\&\f(CW\*(C`sv_catsv_flags\*(C'\fR no longer calls \f(CW\*(C`mg_get\*(C'\fR on its second argument (the +source string) if the flags passed to it do not include \s-1SV_GMAGIC.\s0 So it +now matches the documentation. +.IP "\(bu" 4 +\&\f(CW\*(C`my_strftime\*(C'\fR no longer leaks memory. This fixes a memory leak in +\&\f(CW\*(C`POSIX::strftime\*(C'\fR [perl #73520]. +.IP "\(bu" 4 +\&\fI\s-1XSUB\s0.h\fR now correctly redefines fgets under \s-1PERL_IMPLICIT_SYS\s0 [perl #55049] +(5.12.1). +.IP "\(bu" 4 +\&\s-1XS\s0 code using \fBfputc()\fR or \fBfputs()\fR on Windows could cause an error +due to their arguments being swapped [perl #72704] (5.12.1). +.IP "\(bu" 4 +A possible segfault in the \f(CW\*(C`T_PTROBJ\*(C'\fR default typemap has been fixed +(5.12.2). +.IP "\(bu" 4 +A bug that could cause \*(L"Unknown error\*(R" messages when +\&\f(CW\*(C`call_sv(code, G_EVAL)\*(C'\fR is called from an \s-1XS\s0 destructor has been fixed +(5.12.2). +.SH "Known Problems" +.IX Header "Known Problems" +This is a list of significant unresolved issues which are regressions +from earlier versions of Perl or which affect widely-used \s-1CPAN\s0 modules. +.IP "\(bu" 4 +\&\f(CW\*(C`List::Util::first\*(C'\fR misbehaves in the presence of a lexical \f(CW$_\fR +(typically introduced by \f(CW\*(C`my $_\*(C'\fR or implicitly by \f(CW\*(C`given\*(C'\fR). The variable +that gets set for each iteration is the package variable \f(CW$_\fR, not the +lexical \f(CW$_\fR. +.Sp +A similar issue may occur in other modules that provide functions which +take a block as their first argument, like +.Sp +.Vb 1 +\& foo { ... $_ ...} list +.Ve +.Sp +See also: +.IP "\(bu" 4 +\&\fBreadline()\fR returns an empty string instead of a cached previous value +when it is interrupted by a signal +.IP "\(bu" 4 +The changes in prototype handling break Switch. A patch has been sent +upstream and will hopefully appear on \s-1CPAN\s0 soon. +.IP "\(bu" 4 +The upgrade to \fIExtUtils\-MakeMaker\-6.57_05\fR has caused +some tests in the \fIModule-Install\fR distribution on \s-1CPAN\s0 to +fail. (Specifically, \fI02_mymeta.t\fR tests 5 and 21; \fI18_all_from.t\fR +tests 6 and 15; \fI19_authors.t\fR tests 5, 13, 21, and 29; and +\&\fI20_authors_with_special_characters.t\fR tests 6, 15, and 23 in version +1.00 of that distribution now fail.) +.IP "\(bu" 4 +On \s-1VMS,\s0 \f(CW\*(C`Time::HiRes\*(C'\fR tests will fail due to a bug in the \s-1CRTL\s0's +implementation of \f(CW\*(C`setitimer\*(C'\fR: previous timer values would be cleared +if a timer expired but not if the timer was reset before expiring. \s-1HP\s0 +OpenVMS Engineering have corrected the problem and will release a patch +in due course (Quix case # \s-1QXCM1001115136\s0). +.IP "\(bu" 4 +On \s-1VMS,\s0 there were a handful of \f(CW\*(C`Module::Build\*(C'\fR test failures we didn't +get to before the release; please watch \s-1CPAN\s0 for updates. +.SH "Errata" +.IX Header "Errata" +.SS "\fBkeys()\fP, \fBvalues()\fP, and \fBeach()\fP work on arrays" +.IX Subsection "keys(), values(), and each() work on arrays" +You can now use the \fBkeys()\fR, \fBvalues()\fR, and \fBeach()\fR builtins on arrays; +previously you could use them only on hashes. See perlfunc for details. +This is actually a change introduced in perl 5.12.0, but it was missed from +that release's perl5120delta. +.ie n .SS "\fBsplit()\fP and @_" +.el .SS "\fBsplit()\fP and \f(CW@_\fP" +.IX Subsection "split() and @_" +\&\fBsplit()\fR no longer modifies \f(CW@_\fR when called in scalar or void context. +In void context it now produces a \*(L"Useless use of split\*(R" warning. +This was also a perl 5.12.0 change that missed the perldelta. +.SH "Obituary" +.IX Header "Obituary" +Randy Kobes, creator of http://kobesearch.cpan.org/ and +contributor/maintainer to several core Perl toolchain modules, passed +away on September 18, 2010 after a battle with lung cancer. The community +was richer for his involvement. He will be missed. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.14.0 represents one year of development since +Perl 5.12.0 and contains nearly 550,000 lines of changes across nearly +3,000 files from 150 authors and committers. +.PP +Perl continues to flourish into its third decade thanks to a vibrant +community of users and developers. The following people are known to +have contributed the improvements that became Perl 5.14.0: +.PP +Aaron Crane, Abhijit Menon-Sen, Abigail, \*(Aevar Arnfjo\*:r\*(d- Bjarmason, +Alastair Douglas, Alexander Alekseev, Alexander Hartmaier, Alexandr +Ciornii, Alex Davies, Alex Vandiver, Ali Polatel, Allen Smith, Andreas +Ko\*:nig, Andrew Rodland, Andy Armstrong, Andy Dougherty, Aristotle +Pagaltzis, Arkturuz, Arvan, A. Sinan Unur, Ben Morrow, Bo Lindbergh, +Boris Ratner, Brad Gilbert, Bram, brian d foy, Brian Phillips, Casey +West, Charles Bailey, Chas. Owens, Chip Salzenberg, Chris 'BinGOs' +Williams, chromatic, Craig A. Berry, Curtis Jewell, Dagfinn Ilmari +Mannsa\*oker, Dan Dascalescu, Dave Rolsky, David Caldwell, David Cantrell, +David Golden, David Leadbeater, David Mitchell, David Wheeler, Eric +Brine, Father Chrysostomos, Fingle Nark, Florian Ragwitz, Frank Wiegand, +Franz Fasching, Gene Sullivan, George Greer, Gerard Goossen, Gisle Aas, +Goro Fuji, Grant McLean, gregor herrmann, H.Merijn Brand, Hongwen Qiu, +Hugo van der Sanden, Ian Goodacre, James E Keenan, James Mastros, Jan +Dubois, Jay Hannah, Jerry D. Hedden, Jesse Vincent, Jim Cromie, Jirka +HruXka, John Peacock, Joshua ben Jore, Joshua Pritikin, Karl Williamson, +Kevin Ryde, kmx, Lars \s-1DXXXXXX XXX,\s0 Larwan Berke, Leon Brocard, Leon +Timmermans, Lubomir Rintel, Lukas Mai, Maik Hentsche, Marty Pauley, +Marvin Humphrey, Matt Johnson, Matt S Trout, Max Maischein, Michael +Breen, Michael Fig, Michael G Schwern, Michael Parker, Michael Stevens, +Michael Witten, Mike Kelly, Moritz Lenz, Nicholas Clark, Nick Cleaton, +Nick Johnston, Nicolas Kaiser, Niko Tyni, Noirin Shirley, Nuno Carvalho, +Paul Evans, Paul Green, Paul Johnson, Paul Marquess, Peter J. Holzer, +Peter John Acklam, Peter Martini, Philippe Bruhat (BooK), Piotr Fusik, +Rafael Garcia-Suarez, Rainer Tammer, Reini Urban, Renee Baecker, Ricardo +Signes, Richard Mo\*:hn, Richard Soderberg, Rob Hoelz, Robin Barker, Ruslan +Zakirov, Salvador Fandin\*~o, Salvador Ortiz Garcia, Shlomi Fish, Sinan +Unur, Sisyphus, Slaven Rezic, Steffen Mu\*:ller, Steve Hay, Steven +Schubiger, Steve Peters, Sullivan Beck, Tatsuhiko Miyagawa, Tim Bunce, +Todd Rinaldo, Tom Christiansen, Tom Hukins, Tony Cook, Tye McQueen, +Vadim Konovalov, Vernon Lyon, Vincent Pit, Walt Mankowski, Wolfram +Humann, Yves Orton, Zefram, and Zsba\*'n Ambrus. +.PP +This is woefully incomplete as it's automatically generated from version +control history. In particular, it doesn't include the names of the +(very much appreciated) contributors who reported issues in previous +versions of Perl that helped make Perl 5.14.0 better. For a more complete +list of all of Perl's historical contributors, please see the \f(CW\*(C`AUTHORS\*(C'\fR +file in the Perl 5.14.0 distribution. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 +modules included in Perl's core. We're grateful to the entire \s-1CPAN\s0 +community for helping Perl to flourish. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the Perl +bug database at http://rt.perl.org/perlbug/ . There may also be +information at http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send +it to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes all the core committers, who are able +to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please use this address for +security issues in the Perl core \fIonly\fR, not for modules independently +distributed on \s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details +on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5142delta.1 b/data/miniconda3/man/man1/perl5142delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..cc3047082b90ed904a15358814571b37f0f54f12 --- /dev/null +++ b/data/miniconda3/man/man1/perl5142delta.1 @@ -0,0 +1,321 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5142DELTA 1" +.TH PERL5142DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5142delta \- what is new for perl v5.14.2 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.14.1 release and +the 5.14.2 release. +.PP +If you are upgrading from an earlier release such as 5.14.0, first read +perl5141delta, which describes differences between 5.14.0 and +5.14.1. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +No changes since 5.14.0. +.SH "Security" +.IX Header "Security" +.ie n .SS """File::Glob::bsd_glob()"" memory error with \s-1GLOB_ALTDIRFUNC\s0 (\s-1CVE\-2011\-2728\s0)." +.el .SS "\f(CWFile::Glob::bsd_glob()\fP memory error with \s-1GLOB_ALTDIRFUNC\s0 (\s-1CVE\-2011\-2728\s0)." +.IX Subsection "File::Glob::bsd_glob() memory error with GLOB_ALTDIRFUNC (CVE-2011-2728)." +Calling \f(CW\*(C`File::Glob::bsd_glob\*(C'\fR with the unsupported flag \s-1GLOB_ALTDIRFUNC\s0 would +cause an access violation / segfault. A Perl program that accepts a flags value from +an external source could expose itself to denial of service or arbitrary code +execution attacks. There are no known exploits in the wild. The problem has been +corrected by explicitly disabling all unsupported flags and setting unused function +pointers to null. Bug reported by Cle\*'ment Lecigne. +.ie n .SS """Encode"" decode_xs n\-byte heap-overflow (\s-1CVE\-2011\-2939\s0)" +.el .SS "\f(CWEncode\fP decode_xs n\-byte heap-overflow (\s-1CVE\-2011\-2939\s0)" +.IX Subsection "Encode decode_xs n-byte heap-overflow (CVE-2011-2939)" +A bug in \f(CW\*(C`Encode\*(C'\fR could, on certain inputs, cause the heap to overflow. +This problem has been corrected. Bug reported by Robert Zacek. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +There are no changes intentionally incompatible with 5.14.0. If any +exist, they are bugs and reports are welcome. +.SH "Deprecations" +.IX Header "Deprecations" +There have been no deprecations since 5.14.0. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "New Modules and Pragmata" +.IX Subsection "New Modules and Pragmata" +None +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +\&\s-1CPAN\s0 has been upgraded from version 1.9600 to version 1.9600_01. +.Sp +CPAN::Distribution has been upgraded from version 1.9602 to 1.9602_01. +.Sp +Backported bugfixes from \s-1CPAN\s0 version 1.9800. Ensures proper +detection of \f(CW\*(C`configure_requires\*(C'\fR prerequisites from \s-1CPAN\s0 Meta files +in the case where \f(CW\*(C`dynamic_config\*(C'\fR is true. [rt.cpan.org #68835] +.Sp +Also ensures that \f(CW\*(C`configure_requires\*(C'\fR is only checked in \s-1META\s0 files, +not \s-1MYMETA\s0 files, so protect against \s-1MYMETA\s0 generation that drops +\&\f(CW\*(C`configure_requires\*(C'\fR. +.IP "\(bu" 4 +Encode has been upgraded from version 2.42 to 2.42_01. +.Sp +See \*(L"Security\*(R". +.IP "\(bu" 4 +File::Glob has been upgraded from version 1.12 to version 1.13. +.Sp +See \*(L"Security\*(R". +.IP "\(bu" 4 +PerlIO::scalar has been upgraded from version 0.11 to 0.11_01. +.Sp +It fixes a problem with \f(CW\*(C`open my $fh, ">", \e$scalar\*(C'\fR not working if +\&\f(CW$scalar\fR is a copy-on-write scalar. +.SS "Removed Modules and Pragmata" +.IX Subsection "Removed Modules and Pragmata" +None +.SH "Platform Support" +.IX Header "Platform Support" +.SS "New Platforms" +.IX Subsection "New Platforms" +None +.SS "Discontinued Platforms" +.IX Subsection "Discontinued Platforms" +None +.SS "Platform-Specific Notes" +.IX Subsection "Platform-Specific Notes" +.IP "HP-UX \s-1PA\-RISC/64\s0 now supports gcc\-4.x" 4 +.IX Item "HP-UX PA-RISC/64 now supports gcc-4.x" +A fix to correct the socketsize now makes the test suite pass on HP-UX +PA-RISC for 64bitall builds. +.IP "Building on \s-1OS X 10.7\s0 Lion and Xcode 4 works again" 4 +.IX Item "Building on OS X 10.7 Lion and Xcode 4 works again" +The build system has been updated to work with the build tools under Mac \s-1OS X +10.7.\s0 +.SH "Bug Fixes" +.IX Header "Bug Fixes" +.IP "\(bu" 4 +In \f(CW@INC\fR filters (subroutines returned by subroutines in \f(CW@INC\fR), \f(CW$_\fR used to +misbehave: If returned from a subroutine, it would not be copied, but the +variable itself would be returned; and freeing \f(CW$_\fR (e.g., with \f(CW\*(C`undef *_\*(C'\fR) +would cause perl to crash. This has been fixed [perl #91880]. +.IP "\(bu" 4 +Perl 5.10.0 introduced some faulty logic that made \*(L"U*\*(R" in the middle of +a pack template equivalent to \*(L"U0\*(R" if the input string was empty. This has +been fixed [perl #90160]. +.IP "\(bu" 4 +\&\f(CW\*(C`caller\*(C'\fR no longer leaks memory when called from the \s-1DB\s0 package if +\&\f(CW@DB::args\fR was assigned to after the first call to \f(CW\*(C`caller\*(C'\fR. Carp +was triggering this bug [perl #97010]. +.IP "\(bu" 4 +\&\f(CW\*(C`utf8::decode\*(C'\fR had a nasty bug that would modify copy-on-write scalars' +string buffers in place (i.e., skipping the copy). This could result in +hashes having two elements with the same key [perl #91834]. +.IP "\(bu" 4 +Localising a tied variable used to make it read-only if it contained a +copy-on-write string. +.IP "\(bu" 4 +Elements of restricted hashes (see the fields pragma) containing +copy-on-write values couldn't be deleted, nor could such hashes be cleared +(\f(CW\*(C`%hash = ()\*(C'\fR). +.IP "\(bu" 4 +Locking a hash element that is a glob copy no longer causes subsequent +assignment to it to corrupt the glob. +.IP "\(bu" 4 +A panic involving the combination of the regular expression modifiers +\&\f(CW\*(C`/aa\*(C'\fR introduced in 5.14.0 and the \f(CW\*(C`\eb\*(C'\fR escape sequence has been +fixed [perl #95964]. +.SH "Known Problems" +.IX Header "Known Problems" +This is a list of some significant unfixed bugs, which are regressions +from 5.12.0. +.IP "\(bu" 4 +\&\f(CW\*(C`PERL_GLOBAL_STRUCT\*(C'\fR is broken. +.Sp +Since perl 5.14.0, building with \f(CW\*(C`\-DPERL_GLOBAL_STRUCT\*(C'\fR hasn't been +possible. This means that perl currently doesn't work on any platforms that +require it to be built this way, including Symbian. +.Sp +While \f(CW\*(C`PERL_GLOBAL_STRUCT\*(C'\fR now works again on recent development versions of +perl, it actually working on Symbian again hasn't been verified. +.Sp +We'd be very interested in hearing from anyone working with Perl on Symbian. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.14.2 represents approximately three months of development since +Perl 5.14.1 and contains approximately 1200 lines of changes +across 61 files from 9 authors. +.PP +Perl continues to flourish into its third decade thanks to a vibrant +community of users and developers. The following people are known to +have contributed the improvements that became Perl 5.14.2: +.PP +Craig A. Berry, David Golden, Father Chrysostomos, Florian Ragwitz, H.Merijn +Brand, Karl Williamson, Nicholas Clark, Pau Amma and Ricardo Signes. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://rt.perl.org/perlbug/ . There may also be +information at http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send +it to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes all the core committers, who be able +to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for +security issues in the Perl core, not for modules independently +distributed on \s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details +on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5144delta.1 b/data/miniconda3/man/man1/perl5144delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..8b592ed4cfee311ea768d732cacd2af1bb5a7f7f --- /dev/null +++ b/data/miniconda3/man/man1/perl5144delta.1 @@ -0,0 +1,334 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5144DELTA 1" +.TH PERL5144DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5144delta \- what is new for perl v5.14.4 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.14.3 release and +the 5.14.4 release. +.PP +If you are upgrading from an earlier release such as 5.12.0, first read +perl5140delta, which describes differences between 5.12.0 and +5.14.0. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +No changes since 5.14.0. +.SH "Security" +.IX Header "Security" +This release contains one major, and medium, and a number of minor +security fixes. The latter are included mainly to allow the test suite to +pass cleanly with the clang compiler's address sanitizer facility. +.SS "\s-1CVE\-2013\-1667:\s0 memory exhaustion with arbitrary hash keys" +.IX Subsection "CVE-2013-1667: memory exhaustion with arbitrary hash keys" +With a carefully crafted set of hash keys (for example arguments on a +\&\s-1URL\s0), it is possible to cause a hash to consume a large amount of memory +and \s-1CPU,\s0 and thus possibly to achieve a Denial-of-Service. +.PP +This problem has been fixed. +.SS "memory leak in Encode" +.IX Subsection "memory leak in Encode" +The \s-1UTF\-8\s0 encoding implementation in Encode.xs had a memory leak which has been +fixed. +.SS "[perl #111594] Socket::unpack_sockaddr_un heap-buffer-overflow" +.IX Subsection "[perl #111594] Socket::unpack_sockaddr_un heap-buffer-overflow" +A read buffer overflow could occur when copying \f(CW\*(C`sockaddr\*(C'\fR buffers. +Fairly harmless. +.PP +This problem has been fixed. +.ie n .SS "[perl #111586] SDBM_File: fix off-by-one access to global "".dir""" +.el .SS "[perl #111586] SDBM_File: fix off-by-one access to global ``.dir''" +.IX Subsection "[perl #111586] SDBM_File: fix off-by-one access to global .dir" +An extra byte was being copied for some string literals. Fairly harmless. +.PP +This problem has been fixed. +.SS "off-by-two error in List::Util" +.IX Subsection "off-by-two error in List::Util" +A string literal was being used that included two bytes beyond the +end of the string. Fairly harmless. +.PP +This problem has been fixed. +.SS "[perl #115994] fix segv in regcomp.\fBc:S_join_exact()\fP" +.IX Subsection "[perl #115994] fix segv in regcomp.c:S_join_exact()" +Under debugging builds, while marking optimised-out regex nodes as type +\&\f(CW\*(C`OPTIMIZED\*(C'\fR, it could treat blocks of exact text as if they were nodes, +and thus \s-1SEGV.\s0 Fairly harmless. +.PP +This problem has been fixed. +.SS "[perl #115992] PL_eval_start use-after-free" +.IX Subsection "[perl #115992] PL_eval_start use-after-free" +The statement \f(CW\*(C`local $[;\*(C'\fR, when preceded by an \f(CW\*(C`eval\*(C'\fR, and when not part +of an assignment, could crash. Fairly harmless. +.PP +This problem has been fixed. +.SS "wrap-around with \s-1IO\s0 on long strings" +.IX Subsection "wrap-around with IO on long strings" +Reading or writing strings greater than 2**31 bytes in size could segfault +due to integer wraparound. +.PP +This problem has been fixed. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +There are no changes intentionally incompatible with 5.14.0. If any +exist, they are bugs and reports are welcome. +.SH "Deprecations" +.IX Header "Deprecations" +There have been no deprecations since 5.14.0. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "New Modules and Pragmata" +.IX Subsection "New Modules and Pragmata" +None +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +The following modules have just the minor code fixes as listed above in +\&\*(L"Security\*(R" (version numbers have not changed): +.IP "Socket" 4 +.IX Item "Socket" +.PD 0 +.IP "SDBM_File" 4 +.IX Item "SDBM_File" +.IP "List::Util" 4 +.IX Item "List::Util" +.PD +.PP +Encode has been upgraded from version 2.42_01 to version 2.42_02. +.PP +Module::CoreList has been updated to version 2.49_06 to add data for +this release. +.SS "Removed Modules and Pragmata" +.IX Subsection "Removed Modules and Pragmata" +None. +.SH "Documentation" +.IX Header "Documentation" +.SS "New Documentation" +.IX Subsection "New Documentation" +None. +.SS "Changes to Existing Documentation" +.IX Subsection "Changes to Existing Documentation" +None. +.SH "Diagnostics" +.IX Header "Diagnostics" +No new or changed diagnostics. +.SH "Utility Changes" +.IX Header "Utility Changes" +None +.SH "Configuration and Compilation" +.IX Header "Configuration and Compilation" +No changes. +.SH "Platform Support" +.IX Header "Platform Support" +.SS "New Platforms" +.IX Subsection "New Platforms" +None. +.SS "Discontinued Platforms" +.IX Subsection "Discontinued Platforms" +None. +.SS "Platform-Specific Notes" +.IX Subsection "Platform-Specific Notes" +.IP "\s-1VMS\s0" 4 +.IX Item "VMS" +5.14.3 failed to compile on \s-1VMS\s0 due to incomplete application of a patch +series that allowed \f(CW\*(C`userelocatableinc\*(C'\fR and \f(CW\*(C`usesitecustomize\*(C'\fR to be +used simultaneously. Other platforms were not affected and the problem +has now been corrected. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +In Perl 5.14.0, \f(CW\*(C`$tainted ~~ @array\*(C'\fR stopped working properly. Sometimes +it would erroneously fail (when \f(CW$tainted\fR contained a string that occurs +in the array \fIafter\fR the first element) or erroneously succeed (when +\&\f(CW\*(C`undef\*(C'\fR occurred after the first element) [perl #93590]. +.SH "Known Problems" +.IX Header "Known Problems" +None. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.14.4 represents approximately 5 months of development since Perl 5.14.3 +and contains approximately 1,700 lines of changes across 49 files from 12 +authors. +.PP +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed the +improvements that became Perl 5.14.4: +.PP +Andy Dougherty, Chris 'BinGOs' Williams, Christian Hansen, Craig A. Berry, +Dave Rolsky, David Mitchell, Dominic Hargreaves, Father Chrysostomos, +Florian Ragwitz, Reini Urban, Ricardo Signes, Yves Orton. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://rt.perl.org/perlbug/ . There may also be +information at http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send +it to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes all the core committers, who be able +to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for +security issues in the Perl core, not for modules independently +distributed on \s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details +on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5163delta.1 b/data/miniconda3/man/man1/perl5163delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..fa03a7cce041d96d3f90b7e9f81fb56daf9dd411 --- /dev/null +++ b/data/miniconda3/man/man1/perl5163delta.1 @@ -0,0 +1,246 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5163DELTA 1" +.TH PERL5163DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5163delta \- what is new for perl v5.16.3 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.16.2 release and +the 5.16.3 release. +.PP +If you are upgrading from an earlier release such as 5.16.1, first read +perl5162delta, which describes differences between 5.16.1 and +5.16.2. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +No changes since 5.16.0. +.SH "Security" +.IX Header "Security" +This release contains one major and a number of minor security fixes. +These latter are included mainly to allow the test suite to pass cleanly +with the clang compiler's address sanitizer facility. +.SS "\s-1CVE\-2013\-1667:\s0 memory exhaustion with arbitrary hash keys" +.IX Subsection "CVE-2013-1667: memory exhaustion with arbitrary hash keys" +With a carefully crafted set of hash keys (for example arguments on a +\&\s-1URL\s0), it is possible to cause a hash to consume a large amount of memory +and \s-1CPU,\s0 and thus possibly to achieve a Denial-of-Service. +.PP +This problem has been fixed. +.SS "wrap-around with \s-1IO\s0 on long strings" +.IX Subsection "wrap-around with IO on long strings" +Reading or writing strings greater than 2**31 bytes in size could segfault +due to integer wraparound. +.PP +This problem has been fixed. +.SS "memory leak in Encode" +.IX Subsection "memory leak in Encode" +The \s-1UTF\-8\s0 encoding implementation in Encode.xs had a memory leak which has been +fixed. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +There are no changes intentionally incompatible with 5.16.0. If any +exist, they are bugs and reports are welcome. +.SH "Deprecations" +.IX Header "Deprecations" +There have been no deprecations since 5.16.0. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +Encode has been upgraded from version 2.44 to version 2.44_01. +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 2.76 to version 2.76_02. +.IP "\(bu" 4 +XS::APItest has been upgraded from version 0.38 to version 0.39. +.SH "Known Problems" +.IX Header "Known Problems" +None. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.16.3 represents approximately 4 months of development since Perl 5.16.2 +and contains approximately 870 lines of changes across 39 files from 7 authors. +.PP +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed the +improvements that became Perl 5.16.3: +.PP +Andy Dougherty, Chris 'BinGOs' Williams, Dave Rolsky, David Mitchell, Michael +Schroeder, Ricardo Signes, Yves Orton. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://rt.perl.org/perlbug/ . There may also be +information at http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please +send it to perl5\-security\-report@perl.org. This points to a closed +subscription unarchived mailing list, which includes all the core +committers, who will be able to help assess the impact of issues, figure +out a resolution, and help co-ordinate the release of patches to +mitigate or fix the problem across all platforms on which Perl is +supported. Please only use this address for security issues in the Perl +core, not for modules independently distributed on \s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details +on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5182delta.1 b/data/miniconda3/man/man1/perl5182delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..e6712e4af992f98177b627e3a456d7098efe053e --- /dev/null +++ b/data/miniconda3/man/man1/perl5182delta.1 @@ -0,0 +1,266 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5182DELTA 1" +.TH PERL5182DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5182delta \- what is new for perl v5.18.2 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.18.1 release and the 5.18.2 +release. +.PP +If you are upgrading from an earlier release such as 5.18.0, first read +perl5181delta, which describes differences between 5.18.0 and 5.18.1. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +B has been upgraded from version 1.42_01 to 1.42_02. +.Sp +The fix for [perl #118525] introduced a regression in the behaviour of +\&\f(CW\*(C`B::CV::GV\*(C'\fR, changing the return value from a \f(CW\*(C`B::SPECIAL\*(C'\fR object on +a \f(CW\*(C`NULL\*(C'\fR \f(CW\*(C`CvGV\*(C'\fR to \f(CW\*(C`undef\*(C'\fR. \f(CW\*(C`B::CV::GV\*(C'\fR again returns a +\&\f(CW\*(C`B::SPECIAL\*(C'\fR object in this case. [perl #119413] +.IP "\(bu" 4 +B::Concise has been upgraded from version 0.95 to 0.95_01. +.Sp +This fixes a bug in dumping unexpected SPECIALs. +.IP "\(bu" 4 +English has been upgraded from version 1.06 to 1.06_01. This fixes an +error about the performance of \f(CW\*(C`$\`\*(C'\fR, \f(CW$&\fR, and \f(CW\*(C`$\*(Aq\*(C'\fR. +.IP "\(bu" 4 +File::Glob has been upgraded from version 1.20 to 1.20_01. +.SH "Documentation" +.IX Header "Documentation" +.SS "Changes to Existing Documentation" +.IX Subsection "Changes to Existing Documentation" +.IP "\(bu" 4 +perlrepository has been restored with a pointer to more useful pages. +.IP "\(bu" 4 +perlhack has been updated with the latest changes from blead. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +Perl 5.18.1 introduced a regression along with a bugfix for lexical subs. +Some B::SPECIAL results from B::CV::GV became undefs instead. This broke +Devel::Cover among other libraries. This has been fixed. [perl #119351] +.IP "\(bu" 4 +Perl 5.18.0 introduced a regression whereby \f(CW\*(C`[:^ascii:]\*(C'\fR, if used in the same +character class as other qualifiers, would fail to match characters in the +Latin\-1 block. This has been fixed. [perl #120799] +.IP "\(bu" 4 +Perl 5.18.0 introduced a regression when using \->SUPER::method with \s-1AUTOLOAD\s0 +by looking up \s-1AUTOLOAD\s0 from the current package, rather than the current +packageXs superclass. This has been fixed. [perl #120694] +.IP "\(bu" 4 +Perl 5.18.0 introduced a regression whereby \f(CW\*(C`\-bareword\*(C'\fR was no longer +permitted under the \f(CW\*(C`strict\*(C'\fR and \f(CW\*(C`integer\*(C'\fR pragmata when used together. This +has been fixed. [perl #120288] +.IP "\(bu" 4 +Previously PerlIOBase_dup didn't check if pushing the new layer succeeded +before (optionally) setting the utf8 flag. This could cause +segfaults-by-nullpointer. This has been fixed. +.IP "\(bu" 4 +A buffer overflow with very long identifiers has been fixed. +.IP "\(bu" 4 +A regression from 5.16 in the handling of padranges led to assertion failures +if a keyword plugin declined to handle the second XmyX, but only after creating +a padop. +.Sp +This affected, at least, Devel::CallParser under threaded builds. +.Sp +This has been fixed. +.IP "\(bu" 4 +The construct \f(CW\*(C`$r=qr/.../; /$r/p\*(C'\fR is now handled properly, an issue which +had been worsened by changes 5.18.0. [perl #118213] +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.18.2 represents approximately 3 months of development since Perl +5.18.1 and contains approximately 980 lines of changes across 39 files from 4 +authors. +.PP +Perl continues to flourish into its third decade thanks to a vibrant +community of users and developers. The following people are known to have +contributed the improvements that became Perl 5.18.2: +.PP +Craig A. Berry, David Mitchell, Ricardo Signes, Tony Cook. +.PP +The list above is almost certainly incomplete as it is automatically +generated from version control history. In particular, it does not include +the names of the (very much appreciated) contributors who reported issues to +the Perl bug tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles recently +posted to the comp.lang.perl.misc newsgroup and the perl bug database at +http://rt.perl.org/perlbug/ . There may also be information at +http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug program +included with your release. Be sure to trim your bug down to a tiny but +sufficient test case. Your bug report, along with the output of \f(CW\*(C`perl \-V\*(C'\fR, +will be sent off to perlbug@perl.org to be analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send it +to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes all the core committers, who will be +able to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for +security issues in the Perl core, not for modules independently distributed on +\&\s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5184delta.1 b/data/miniconda3/man/man1/perl5184delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..a7c4dead89498b0d562ea189c4939801c4f375b4 --- /dev/null +++ b/data/miniconda3/man/man1/perl5184delta.1 @@ -0,0 +1,255 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5184DELTA 1" +.TH PERL5184DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5184delta \- what is new for perl v5.18.4 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.18.4 release and the 5.18.2 +release. \fBPlease note:\fR This document ignores perl 5.18.3, a broken release +which existed for a few hours only. +.PP +If you are upgrading from an earlier release such as 5.18.1, first read +perl5182delta, which describes differences between 5.18.1 and 5.18.2. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +Digest::SHA has been upgraded from 5.84_01 to 5.84_02. +.IP "\(bu" 4 +perl5db.pl has been upgraded from version 1.39_10 to 1.39_11. +.Sp +This fixes a crash in tab completion, where available. [perl #120827] Also, +filehandle information is properly reset after a pager is run. [perl #121456] +.SH "Platform Support" +.IX Header "Platform Support" +.SS "Platform-Specific Notes" +.IX Subsection "Platform-Specific Notes" +.IP "Win32" 4 +.IX Item "Win32" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +Introduced by +perl #113536 , a memory +leak on every call to \f(CW\*(C`system\*(C'\fR and backticks (\f(CW\*(C` \`\` \*(C'\fR), on most Win32 Perls +starting from 5.18.0 has been fixed. The memory leak only occurred if you +enabled pseudo-fork in your build of Win32 Perl, and were running that build on +Server 2003 R2 or newer \s-1OS.\s0 The leak does not appear on WinXP \s-1SP3.\s0 +[perl #121676 ] +.RE +.RS 4 +.RE +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +The debugger now properly resets filehandles as needed. [perl #121456] +.IP "\(bu" 4 +A segfault in Digest::SHA has been addressed. [perl #121421] +.IP "\(bu" 4 +perl can again be built with \s-1USE_64_BIT_INT,\s0 with Visual C 2003, 32 bit. +[perl #120925] +.IP "\(bu" 4 +A leading { (brace) in formats is properly parsed again. [perl #119973] +.IP "\(bu" 4 +Copy the values used to perturb hash iteration when cloning an +interpreter. This was fairly harmless but caused \f(CW\*(C`valgrind\*(C'\fR to +complain. [perl #121336] +.IP "\(bu" 4 +In Perl v5.18 \f(CW\*(C`undef *_; goto &sub\*(C'\fR and \f(CW\*(C`local *_; goto &sub\*(C'\fR started +crashing. This has been fixed. [perl #119949] +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.18.4 represents approximately 9 months of development since Perl 5.18.2 +and contains approximately 2,000 lines of changes across 53 files from 13 +authors. +.PP +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed the +improvements that became Perl 5.18.4: +.PP +Daniel Dragan, David Mitchell, Doug Bell, Father Chrysostomos, Hiroo Hayashi, +James E Keenan, Karl Williamson, Mark Shelor, Ricardo Signes, Shlomi Fish, +Smylers, Steve Hay, Tony Cook. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles recently +posted to the comp.lang.perl.misc newsgroup and the perl bug database at +http://rt.perl.org/perlbug/ . There may also be information at +http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug program +included with your release. Be sure to trim your bug down to a tiny but +sufficient test case. Your bug report, along with the output of \f(CW\*(C`perl \-V\*(C'\fR, +will be sent off to perlbug@perl.org to be analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send it +to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes all the core committers, who will be +able to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for +security issues in the Perl core, not for modules independently distributed on +\&\s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5201delta.1 b/data/miniconda3/man/man1/perl5201delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..ff0ca07d4282e5689b8a9c187bbe522762892981 --- /dev/null +++ b/data/miniconda3/man/man1/perl5201delta.1 @@ -0,0 +1,418 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5201DELTA 1" +.TH PERL5201DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5201delta \- what is new for perl v5.20.1 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.20.0 release and the 5.20.1 +release. +.PP +If you are upgrading from an earlier release such as 5.18.0, first read +perl5200delta, which describes differences between 5.18.0 and 5.20.0. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +There are no changes intentionally incompatible with 5.20.0. If any exist, +they are bugs, and we request that you submit a report. See \*(L"Reporting Bugs\*(R" +below. +.SH "Performance Enhancements" +.IX Header "Performance Enhancements" +.IP "\(bu" 4 +An optimization to avoid problems with \s-1COW\s0 and deliberately overallocated PVs +has been disabled because it interfered with another, more important, +optimization, causing a slowdown on some platforms. +[perl #121975] +.IP "\(bu" 4 +Returning a string from a lexical variable could be slow in some cases. This +has now been fixed. +[perl #121977] +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +Config::Perl::V has been upgraded from version 0.20 to 0.22. +.Sp +The list of Perl versions covered has been updated and some flaws in the +parsing have been fixed. +.IP "\(bu" 4 +Exporter has been upgraded from version 5.70 to 5.71. +.Sp +Illegal \s-1POD\s0 syntax in the documentation has been corrected. +.IP "\(bu" 4 +ExtUtils::CBuilder has been upgraded from version 0.280216 to 0.280217. +.Sp +Android builds now link to both \fB\-lperl\fR and \f(CW$Config::Config{perllibs}\fR. +.IP "\(bu" 4 +File::Copy has been upgraded from version 2.29 to 2.30. +.Sp +The documentation now notes that \f(CW\*(C`copy\*(C'\fR will not overwrite read-only files. +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 3.11 to 5.020001. +.Sp +The list of Perl versions covered has been updated. +.IP "\(bu" 4 +The PathTools module collection has been upgraded from version 3.47 to 3.48. +.Sp +Fallbacks are now in place when cross-compiling for Android and +\&\f(CW$Config::Config{sh}\fR is not yet defined. +[perl #121963] +.IP "\(bu" 4 +PerlIO::via has been upgraded from version 0.14 to 0.15. +.Sp +A minor portability improvement has been made to the \s-1XS\s0 implementation. +.IP "\(bu" 4 +Unicode::UCD has been upgraded from version 0.57 to 0.58. +.Sp +The documentation includes many clarifications and fixes. +.IP "\(bu" 4 +utf8 has been upgraded from version 1.13 to 1.13_01. +.Sp +The documentation has some minor formatting improvements. +.IP "\(bu" 4 +version has been upgraded from version 0.9908 to 0.9909. +.Sp +External libraries and Perl may have different ideas of what the locale is. +This is problematic when parsing version strings if the locale's numeric +separator has been changed. Version parsing has been patched to ensure it +handles the locales correctly. +[perl #121930] +.SH "Documentation" +.IX Header "Documentation" +.SS "Changes to Existing Documentation" +.IX Subsection "Changes to Existing Documentation" +\fIperlapi\fR +.IX Subsection "perlapi" +.IP "\(bu" 4 +\&\f(CW\*(C`av_len\*(C'\fR \- Emphasize that this returns the highest index in the array, not the +size of the array. +[perl #120386] +.IP "\(bu" 4 +Note that \f(CW\*(C`SvSetSV\*(C'\fR doesn't do set magic. +.IP "\(bu" 4 +\&\f(CW\*(C`sv_usepvn_flags\*(C'\fR \- Fix documentation to mention the use of \f(CW\*(C`NewX\*(C'\fR instead of +\&\f(CW\*(C`malloc\*(C'\fR. +[perl #121869] +.IP "\(bu" 4 +Clarify where \f(CW\*(C`NUL\*(C'\fR may be embedded or is required to terminate a string. +.PP +\fIperlfunc\fR +.IX Subsection "perlfunc" +.IP "\(bu" 4 +Clarify the meaning of \f(CW\*(C`\-B\*(C'\fR and \f(CW\*(C`\-T\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`\-l\*(C'\fR now notes that it will return false if symlinks aren't supported by the +file system. +[perl #121523] +.IP "\(bu" 4 +Note that \f(CW\*(C`each\*(C'\fR, \f(CW\*(C`keys\*(C'\fR and \f(CW\*(C`values\*(C'\fR may produce different orderings for +tied hashes compared to other perl hashes. +[perl #121404] +.IP "\(bu" 4 +Note that \f(CW\*(C`exec LIST\*(C'\fR and \f(CW\*(C`system LIST\*(C'\fR may fall back to the shell on Win32. +Only \f(CW\*(C`exec PROGRAM LIST\*(C'\fR and \f(CW\*(C`system PROGRAM LIST\*(C'\fR indirect object syntax +will reliably avoid using the shell. This has also been noted in perlport. +[perl #122046] +.IP "\(bu" 4 +Clarify the meaning of \f(CW\*(C`our\*(C'\fR. +[perl #122132] +.PP +\fIperlguts\fR +.IX Subsection "perlguts" +.IP "\(bu" 4 +Explain various ways of modifying an existing \s-1SV\s0's buffer. +[perl #116925] +.PP +\fIperlpolicy\fR +.IX Subsection "perlpolicy" +.IP "\(bu" 4 +We now have a code of conduct for the \fIp5p\fR mailing list, as documented in +\&\*(L"\s-1STANDARDS OF CONDUCT\*(R"\s0 in perlpolicy. +.PP +\fIperlre\fR +.IX Subsection "perlre" +.IP "\(bu" 4 +The \f(CW\*(C`/x\*(C'\fR modifier has been clarified to note that comments cannot be continued +onto the next line by escaping them. +.PP +\fIperlsyn\fR +.IX Subsection "perlsyn" +.IP "\(bu" 4 +Mention the use of empty conditionals in \f(CW\*(C`for\*(C'\fR/\f(CW\*(C`while\*(C'\fR loops for infinite +loops. +.PP +\fIperlxs\fR +.IX Subsection "perlxs" +.IP "\(bu" 4 +Added a discussion of locale issues in \s-1XS\s0 code. +.SH "Diagnostics" +.IX Header "Diagnostics" +The following additions or changes have been made to diagnostic output, +including warnings and fatal error messages. For the complete list of +diagnostic messages, see perldiag. +.SS "Changes to Existing Diagnostics" +.IX Subsection "Changes to Existing Diagnostics" +.IP "\(bu" 4 +Variable length lookbehind not implemented in regex m/%s/ +.Sp +Information about Unicode behaviour has been added. +.SH "Configuration and Compilation" +.IX Header "Configuration and Compilation" +.IP "\(bu" 4 +Building Perl no longer writes to the source tree when configured with +\&\fIConfigure\fR's \fB\-Dmksymlinks\fR option. +[perl #121585] +.SH "Platform Support" +.IX Header "Platform Support" +.SS "Platform-Specific Notes" +.IX Subsection "Platform-Specific Notes" +.IP "Android" 4 +.IX Item "Android" +Build support has been improved for cross-compiling in general and for Android +in particular. +.IP "OpenBSD" 4 +.IX Item "OpenBSD" +Corrected architectures and version numbers used in configuration hints when +building Perl. +.IP "Solaris" 4 +.IX Item "Solaris" +\&\fBc99\fR options have been cleaned up, hints look for \fBsolstudio\fR as well as +\&\fBSUNWspro\fR, and support for native \f(CW\*(C`setenv\*(C'\fR has been added. +.IP "\s-1VMS\s0" 4 +.IX Item "VMS" +An old bug in feature checking, mainly affecting pre\-7.3 systems, has been +fixed. +.IP "Windows" 4 +.IX Item "Windows" +\&\f(CW%I64d\fR is now being used instead of \f(CW%lld\fR for MinGW. +.SH "Internal Changes" +.IX Header "Internal Changes" +.IP "\(bu" 4 +Added \*(L"sync_locale\*(R" in perlapi. +Changing the program's locale should be avoided by \s-1XS\s0 code. Nevertheless, +certain non-Perl libraries called from \s-1XS,\s0 such as \f(CW\*(C`Gtk\*(C'\fR do so. When this +happens, Perl needs to be told that the locale has changed. Use this function +to do so, before returning to Perl. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +A bug has been fixed where zero-length assertions and code blocks inside of a +regex could cause \f(CW\*(C`pos\*(C'\fR to see an incorrect value. +[perl #122460] +.IP "\(bu" 4 +Using \f(CW\*(C`s///e\*(C'\fR on tainted utf8 strings could issue bogus \*(L"Malformed \s-1UTF\-8\s0 +character (unexpected end of string)\*(R" warnings. This has now been fixed. +[perl #122148] +.IP "\(bu" 4 +\&\f(CW\*(C`system\*(C'\fR and friends should now work properly on more Android builds. +.Sp +Due to an oversight, the value specified through \fB\-Dtargetsh\fR to \fIConfigure\fR +would end up being ignored by some of the build process. This caused perls +cross-compiled for Android to end up with defective versions of \f(CW\*(C`system\*(C'\fR, +\&\f(CW\*(C`exec\*(C'\fR and backticks: the commands would end up looking for \fI/bin/sh\fR instead +of \fI/system/bin/sh\fR, and so would fail for the vast majority of devices, +leaving \f(CW$!\fR as \f(CW\*(C`ENOENT\*(C'\fR. +.IP "\(bu" 4 +Many issues have been detected by Coverity and +fixed. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.20.1 represents approximately 4 months of development since Perl 5.20.0 +and contains approximately 12,000 lines of changes across 170 files from 36 +authors. +.PP +Excluding auto-generated files, documentation and release tools, there were +approximately 2,600 lines of changes to 110 .pm, .t, .c and .h files. +.PP +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed +the improvements that became Perl 5.20.1: +.PP +Aaron Crane, Abigail, Alberto Simo\*~es, Alexandr Ciornii, Alexandre (Midnite) +Jousset, Andrew Fresh, Andy Dougherty, Brian Fraser, Chris 'BinGOs' Williams, +Craig A. Berry, Daniel Dragan, David Golden, David Mitchell, H.Merijn Brand, +James E Keenan, Jan Dubois, Jarkko Hietaniemi, John Peacock, kafka, Karen +Etheridge, Karl Williamson, Lukas Mai, Matthew Horsfall, Michael Bunk, Peter +Martini, Rafael Garcia-Suarez, Reini Urban, Ricardo Signes, Shirakata Kentaro, +Smylers, Steve Hay, Thomas Sibley, Todd Rinaldo, Tony Cook, Vladimir Marek, +Yves Orton. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles recently +posted to the comp.lang.perl.misc newsgroup and the perl bug database at +https://rt.perl.org/ . There may also be information at http://www.perl.org/ , +the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug program +included with your release. Be sure to trim your bug down to a tiny but +sufficient test case. Your bug report, along with the output of \f(CW\*(C`perl \-V\*(C'\fR, +will be sent off to perlbug@perl.org to be analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send it +to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes all the core committers, who will be +able to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for +security issues in the Perl core, not for modules independently distributed on +\&\s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5220delta.1 b/data/miniconda3/man/man1/perl5220delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..a3cb32b6f58a0ce52c9d3d9ecb42338775e7eb47 --- /dev/null +++ b/data/miniconda3/man/man1/perl5220delta.1 @@ -0,0 +1,3207 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5220DELTA 1" +.TH PERL5220DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5220delta \- what is new for perl v5.22.0 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.20.0 release and the 5.22.0 +release. +.PP +If you are upgrading from an earlier release such as 5.18.0, first read +perl5200delta, which describes differences between 5.18.0 and 5.20.0. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.SS "New bitwise operators" +.IX Subsection "New bitwise operators" +A new experimental facility has been added that makes the four standard +bitwise operators (\f(CW\*(C`& | ^ ~\*(C'\fR) treat their operands consistently as +numbers, and introduces four new dotted operators (\f(CW\*(C`&. |. ^. ~.\*(C'\fR) that +treat their operands consistently as strings. The same applies to the +assignment variants (\f(CW\*(C`&= |= ^= &.= |.= ^.=\*(C'\fR). +.PP +To use this, enable the \*(L"bitwise\*(R" feature and disable the +\&\*(L"experimental::bitwise\*(R" warnings category. See \*(L"Bitwise String +Operators\*(R" in perlop for details. +[perl #123466] . +.SS "New double-diamond operator" +.IX Subsection "New double-diamond operator" +\&\f(CW\*(C`<<>>\*(C'\fR is like \f(CW\*(C`<>\*(C'\fR but uses three-argument \f(CW\*(C`open\*(C'\fR to open +each file in \f(CW@ARGV\fR. This means that each element of \f(CW@ARGV\fR will be treated +as an actual file name, and \f(CW"|foo"\fR won't be treated as a pipe open. +.ie n .SS "New ""\eb"" boundaries in regular expressions" +.el .SS "New \f(CW\eb\fP boundaries in regular expressions" +.IX Subsection "New b boundaries in regular expressions" +\fI\f(CI\*(C`qr/\eb{gcb}/\*(C'\fI\fR +.IX Subsection "qr/b{gcb}/" +.PP +\&\f(CW\*(C`gcb\*(C'\fR stands for Grapheme Cluster Boundary. It is a Unicode property +that finds the boundary between sequences of characters that look like a +single character to a native speaker of a language. Perl has long had +the ability to deal with these through the \f(CW\*(C`\eX\*(C'\fR regular escape +sequence. Now, there is an alternative way of handling these. See +\&\*(L"\eb{}, \eb, \eB{}, \eB\*(R" in perlrebackslash for details. +.PP +\fI\f(CI\*(C`qr/\eb{wb}/\*(C'\fI\fR +.IX Subsection "qr/b{wb}/" +.PP +\&\f(CW\*(C`wb\*(C'\fR stands for Word Boundary. It is a Unicode property +that finds the boundary between words. This is similar to the plain +\&\f(CW\*(C`\eb\*(C'\fR (without braces) but is more suitable for natural language +processing. It knows, for example, that apostrophes can occur in the +middle of words. See \*(L"\eb{}, \eb, \eB{}, \eB\*(R" in perlrebackslash for details. +.PP +\fI\f(CI\*(C`qr/\eb{sb}/\*(C'\fI\fR +.IX Subsection "qr/b{sb}/" +.PP +\&\f(CW\*(C`sb\*(C'\fR stands for Sentence Boundary. It is a Unicode property +to aid in parsing natural language sentences. +See \*(L"\eb{}, \eb, \eB{}, \eB\*(R" in perlrebackslash for details. +.SS "Non-Capturing Regular Expression Flag" +.IX Subsection "Non-Capturing Regular Expression Flag" +Regular expressions now support a \f(CW\*(C`/n\*(C'\fR flag that disables capturing +and filling in \f(CW$1\fR, \f(CW$2\fR, etc inside of groups: +.PP +.Vb 1 +\& "hello" =~ /(hi|hello)/n; # $1 is not set +.Ve +.PP +This is equivalent to putting \f(CW\*(C`?:\*(C'\fR at the beginning of every capturing group. +.PP +See \*(L"n\*(R" in perlre for more information. +.ie n .SS """use re \*(Aqstrict\*(Aq""" +.el .SS "\f(CWuse re \*(Aqstrict\*(Aq\fP" +.IX Subsection "use re strict" +This applies stricter syntax rules to regular expression patterns +compiled within its scope. This will hopefully alert you to typos and +other unintentional behavior that backwards-compatibility issues prevent +us from reporting in normal regular expression compilations. Because the +behavior of this is subject to change in future Perl releases as we gain +experience, using this pragma will raise a warning of category +\&\f(CW\*(C`experimental::re_strict\*(C'\fR. +See 'strict' in re. +.SS "Unicode 7.0 (with correction) is now supported" +.IX Subsection "Unicode 7.0 (with correction) is now supported" +For details on what is in this release, see +. +The version of Unicode 7.0 that comes with Perl includes +a correction dealing with glyph shaping in Arabic +(see ). +.ie n .SS """use\ locale"" can restrict which locale categories are affected" +.el .SS "\f(CWuse\ locale\fP can restrict which locale categories are affected" +.IX Subsection "uselocale can restrict which locale categories are affected" +It is now possible to pass a parameter to \f(CW\*(C`use\ locale\*(C'\fR to specify +a subset of locale categories to be locale-aware, with the remaining +ones unaffected. See \*(L"The \*(R"use locale\*(L" pragma\*(R" in perllocale for details. +.SS "Perl now supports \s-1POSIX 2008\s0 locale currency additions" +.IX Subsection "Perl now supports POSIX 2008 locale currency additions" +On platforms that are able to handle \s-1POSIX.1\-2008,\s0 the +hash returned by +\&\f(CW\*(C`POSIX::localeconv()\*(C'\fR +includes the international currency fields added by that version of the +\&\s-1POSIX\s0 standard. These are +\&\f(CW\*(C`int_n_cs_precedes\*(C'\fR, +\&\f(CW\*(C`int_n_sep_by_space\*(C'\fR, +\&\f(CW\*(C`int_n_sign_posn\*(C'\fR, +\&\f(CW\*(C`int_p_cs_precedes\*(C'\fR, +\&\f(CW\*(C`int_p_sep_by_space\*(C'\fR, +and +\&\f(CW\*(C`int_p_sign_posn\*(C'\fR. +.SS "Better heuristics on older platforms for determining locale UTF\-8ness" +.IX Subsection "Better heuristics on older platforms for determining locale UTF-8ness" +On platforms that implement neither the C99 standard nor the \s-1POSIX 2001\s0 +standard, determining if the current locale is \s-1UTF\-8\s0 or not depends on +heuristics. These are improved in this release. +.SS "Aliasing via reference" +.IX Subsection "Aliasing via reference" +Variables and subroutines can now be aliased by assigning to a reference: +.PP +.Vb 2 +\& \e$c = \e$d; +\& \e&x = \e&y; +.Ve +.PP +Aliasing can also be accomplished +by using a backslash before a \f(CW\*(C`foreach\*(C'\fR iterator variable; this is +perhaps the most useful idiom this feature provides: +.PP +.Vb 1 +\& foreach \e%hash (@array_of_hash_refs) { ... } +.Ve +.PP +This feature is experimental and must be enabled via \f(CW\*(C`use\ feature\ \*(Aqrefaliasing\*(Aq\*(C'\fR. It will warn unless the \f(CW\*(C`experimental::refaliasing\*(C'\fR +warnings category is disabled. +.PP +See \*(L"Assigning to References\*(R" in perlref +.ie n .SS """prototype"" with no arguments" +.el .SS "\f(CWprototype\fP with no arguments" +.IX Subsection "prototype with no arguments" +\&\f(CW\*(C`prototype()\*(C'\fR with no arguments now infers \f(CW$_\fR. +[perl #123514] . +.ie n .SS "New "":const"" subroutine attribute" +.el .SS "New \f(CW:const\fP subroutine attribute" +.IX Subsection "New :const subroutine attribute" +The \f(CW\*(C`const\*(C'\fR attribute can be applied to an anonymous subroutine. It +causes the new sub to be executed immediately whenever one is created +(\fIi.e.\fR when the \f(CW\*(C`sub\*(C'\fR expression is evaluated). Its value is captured +and used to create a new constant subroutine that is returned. This +feature is experimental. See \*(L"Constant Functions\*(R" in perlsub. +.ie n .SS """fileno"" now works on directory handles" +.el .SS "\f(CWfileno\fP now works on directory handles" +.IX Subsection "fileno now works on directory handles" +When the relevant support is available in the operating system, the +\&\f(CW\*(C`fileno\*(C'\fR builtin now works on directory handles, yielding the +underlying file descriptor in the same way as for filehandles. On +operating systems without such support, \f(CW\*(C`fileno\*(C'\fR on a directory handle +continues to return the undefined value, as before, but also sets \f(CW$!\fR to +indicate that the operation is not supported. +.PP +Currently, this uses either a \f(CW\*(C`dd_fd\*(C'\fR member in the \s-1OS\s0 \f(CW\*(C`DIR\*(C'\fR +structure, or a \f(CWdirfd(3)\fR function as specified by \s-1POSIX.1\-2008.\s0 +.SS "List form of pipe open implemented for Win32" +.IX Subsection "List form of pipe open implemented for Win32" +The list form of pipe: +.PP +.Vb 1 +\& open my $fh, "\-|", "program", @arguments; +.Ve +.PP +is now implemented on Win32. It has the same limitations as \f(CW\*(C`system +LIST\*(C'\fR on Win32, since the Win32 \s-1API\s0 doesn't accept program arguments +as a list. +.SS "Assignment to list repetition" +.IX Subsection "Assignment to list repetition" +\&\f(CW\*(C`(...) x ...\*(C'\fR can now be used within a list that is assigned to, as long +as the left-hand side is a valid lvalue. This allows \f(CW\*(C`(undef,undef,$foo)\ =\ that_function()\*(C'\fR to be written as \f(CW\*(C`((undef)x2,\ $foo)\ =\ that_function()\*(C'\fR. +.SS "Infinity and NaN (not-a-number) handling improved" +.IX Subsection "Infinity and NaN (not-a-number) handling improved" +Floating point values are able to hold the special values infinity, negative +infinity, and NaN (not-a-number). Now we more robustly recognize and +propagate the value in computations, and on output normalize them to the strings +\&\f(CW\*(C`Inf\*(C'\fR, \f(CW\*(C`\-Inf\*(C'\fR, and \f(CW\*(C`NaN\*(C'\fR. +.PP +See also the \s-1POSIX\s0 enhancements. +.SS "Floating point parsing has been improved" +.IX Subsection "Floating point parsing has been improved" +Parsing and printing of floating point values has been improved. +.PP +As a completely new feature, hexadecimal floating point literals +(like \f(CW\*(C`0x1.23p\-4\*(C'\fR) are now supported, and they can be output with +\&\f(CW\*(C`printf\ "%a"\*(C'\fR. See \*(L"Scalar value constructors\*(R" in perldata for more +details. +.SS "Packing infinity or not-a-number into a character is now fatal" +.IX Subsection "Packing infinity or not-a-number into a character is now fatal" +Before, when trying to pack infinity or not-a-number into a +(signed) character, Perl would warn, and assumed you tried to +pack \f(CW0xFF\fR; if you gave it as an argument to \f(CW\*(C`chr\*(C'\fR, +\&\f(CW\*(C`U+FFFD\*(C'\fR was returned. +.PP +But now, all such actions (\f(CW\*(C`pack\*(C'\fR, \f(CW\*(C`chr\*(C'\fR, and \f(CW\*(C`print \*(Aq%c\*(Aq\*(C'\fR) +result in a fatal error. +.SS "Experimental C Backtrace \s-1API\s0" +.IX Subsection "Experimental C Backtrace API" +Perl now supports (via a C level \s-1API\s0) retrieving +the C level backtrace (similar to what symbolic debuggers like gdb do). +.PP +The backtrace returns the stack trace of the C call frames, +with the symbol names (function names), the object names (like \*(L"perl\*(R"), +and if it can, also the source code locations (file:line). +.PP +The supported platforms are Linux and \s-1OS X\s0 (some *BSD might work at +least partly, but they have not yet been tested). +.PP +The feature needs to be enabled with \f(CW\*(C`Configure \-Dusecbacktrace\*(C'\fR. +.PP +See \*(L"C backtrace\*(R" in perlhacktips for more information. +.SH "Security" +.IX Header "Security" +.ie n .SS "Perl is now compiled with ""\-fstack\-protector\-strong"" if available" +.el .SS "Perl is now compiled with \f(CW\-fstack\-protector\-strong\fP if available" +.IX Subsection "Perl is now compiled with -fstack-protector-strong if available" +Perl has been compiled with the anti-stack-smashing option +\&\f(CW\*(C`\-fstack\-protector\*(C'\fR since 5.10.1. Now Perl uses the newer variant +called \f(CW\*(C`\-fstack\-protector\-strong\*(C'\fR, if available. +.SS "The Safe module could allow outside packages to be replaced" +.IX Subsection "The Safe module could allow outside packages to be replaced" +Critical bugfix: outside packages could be replaced. Safe has +been patched to 2.38 to address this. +.ie n .SS "Perl is now always compiled with ""\-D_FORTIFY_SOURCE=2"" if available" +.el .SS "Perl is now always compiled with \f(CW\-D_FORTIFY_SOURCE=2\fP if available" +.IX Subsection "Perl is now always compiled with -D_FORTIFY_SOURCE=2 if available" +The 'code hardening' option called \f(CW\*(C`_FORTIFY_SOURCE\*(C'\fR, available in +gcc 4.*, is now always used for compiling Perl, if available. +.PP +Note that this isn't necessarily a huge step since in many platforms +the step had already been taken several years ago: many Linux +distributions (like Fedora) have been using this option for Perl, +and \s-1OS X\s0 has enforced the same for many years. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +.SS "Subroutine signatures moved before attributes" +.IX Subsection "Subroutine signatures moved before attributes" +The experimental sub signatures feature, as introduced in 5.20, parsed +signatures after attributes. In this release, following feedback from users +of the experimental feature, the positioning has been moved such that +signatures occur after the subroutine name (if any) and before the attribute +list (if any). +.ie n .SS """&"" and ""\e&"" prototypes accepts only subs" +.el .SS "\f(CW&\fP and \f(CW\e&\fP prototypes accepts only subs" +.IX Subsection "& and & prototypes accepts only subs" +The \f(CW\*(C`&\*(C'\fR prototype character now accepts only anonymous subs (\f(CW\*(C`sub +{...}\*(C'\fR), things beginning with \f(CW\*(C`\e&\*(C'\fR, or an explicit \f(CW\*(C`undef\*(C'\fR. Formerly +it erroneously also allowed references to arrays, hashes, and lists. +[perl #4539] . +[perl #123062] . +[perl #123062] . +.PP +In addition, the \f(CW\*(C`\e&\*(C'\fR prototype was allowing subroutine calls, whereas +now it only allows subroutines: \f(CW&foo\fR is still permitted as an argument, +while \f(CW\*(C`&foo()\*(C'\fR and \f(CW\*(C`foo()\*(C'\fR no longer are. +[perl #77860] . +.ie n .SS """use encoding"" is now lexical" +.el .SS "\f(CWuse encoding\fP is now lexical" +.IX Subsection "use encoding is now lexical" +The encoding pragma's effect is now limited to lexical scope. This +pragma is deprecated, but in the meantime, it could adversely affect +unrelated modules that are included in the same program; this change +fixes that. +.SS "List slices returning empty lists" +.IX Subsection "List slices returning empty lists" +List slices now return an empty list only if the original list was empty +(or if there are no indices). Formerly, a list slice would return an empty +list if all indices fell outside the original list; now it returns a list +of \f(CW\*(C`undef\*(C'\fR values in that case. +[perl #114498] . +.ie n .SS """\eN{}"" with a sequence of multiple spaces is now a fatal error" +.el .SS "\f(CW\eN{}\fP with a sequence of multiple spaces is now a fatal error" +.IX Subsection "N{} with a sequence of multiple spaces is now a fatal error" +E.g. \f(CW\*(C`\eN{TOO\ \ MANY\ SPACES}\*(C'\fR or \f(CW\*(C`\eN{TRAILING\ SPACE\ }\*(C'\fR. +This has been deprecated since v5.18. +.ie n .SS """use\ UNIVERSAL\ \*(Aq...\*(Aq"" is now a fatal error" +.el .SS "\f(CWuse\ UNIVERSAL\ \*(Aq...\*(Aq\fP is now a fatal error" +.IX Subsection "useUNIVERSAL... is now a fatal error" +Importing functions from \f(CW\*(C`UNIVERSAL\*(C'\fR has been deprecated since v5.12, and +is now a fatal error. \f(CW\*(C`use\ UNIVERSAL\*(C'\fR without any arguments is still +allowed. +.ie n .SS "In double-quotish ""\ec\f(CIX\fP"", \fIX\fP must now be a printable \s-1ASCII\s0 character" +.el .SS "In double-quotish \f(CW\ec\fP\f(CIX\fP\f(CW\fP, \fIX\fP must now be a printable \s-1ASCII\s0 character" +.IX Subsection "In double-quotish cX, X must now be a printable ASCII character" +In prior releases, failure to do this raised a deprecation warning. +.ie n .SS "Splitting the tokens ""(?"" and ""(*"" in regular expressions is now a fatal compilation error." +.el .SS "Splitting the tokens \f(CW(?\fP and \f(CW(*\fP in regular expressions is now a fatal compilation error." +.IX Subsection "Splitting the tokens (? and (* in regular expressions is now a fatal compilation error." +These had been deprecated since v5.18. +.ie n .SS """qr/foo/x"" now ignores all Unicode pattern white space" +.el .SS "\f(CWqr/foo/x\fP now ignores all Unicode pattern white space" +.IX Subsection "qr/foo/x now ignores all Unicode pattern white space" +The \f(CW\*(C`/x\*(C'\fR regular expression modifier allows the pattern to contain +white space and comments (both of which are ignored) for improved +readability. Until now, not all the white space characters that Unicode +designates for this purpose were handled. The additional ones now +recognized are: +.PP +.Vb 5 +\& U+0085 NEXT LINE +\& U+200E LEFT\-TO\-RIGHT MARK +\& U+200F RIGHT\-TO\-LEFT MARK +\& U+2028 LINE SEPARATOR +\& U+2029 PARAGRAPH SEPARATOR +.Ve +.PP +The use of these characters with \f(CW\*(C`/x\*(C'\fR outside bracketed character +classes and when not preceded by a backslash has raised a deprecation +warning since v5.18. Now they will be ignored. +.ie n .SS "Comment lines within ""(?[\ ])"" are now ended only by a ""\en""" +.el .SS "Comment lines within \f(CW(?[\ ])\fP are now ended only by a \f(CW\en\fP" +.IX Subsection "Comment lines within (?[]) are now ended only by a n" +\&\f(CW\*(C`(?[\ ])\*(C'\fR is an experimental feature, introduced in v5.18. It operates +as if \f(CW\*(C`/x\*(C'\fR is always enabled. But there was a difference: comment +lines (following a \f(CW\*(C`#\*(C'\fR character) were terminated by anything matching +\&\f(CW\*(C`\eR\*(C'\fR which includes all vertical whitespace, such as form feeds. For +consistency, this is now changed to match what terminates comment lines +outside \f(CW\*(C`(?[\ ])\*(C'\fR, namely a \f(CW\*(C`\en\*(C'\fR (even if escaped), which is the +same as what terminates a heredoc string and formats. +.ie n .SS """(?[...])"" operators now follow standard Perl precedence" +.el .SS "\f(CW(?[...])\fP operators now follow standard Perl precedence" +.IX Subsection "(?[...]) operators now follow standard Perl precedence" +This experimental feature allows set operations in regular expression patterns. +Prior to this, the intersection operator had the same precedence as the other +binary operators. Now it has higher precedence. This could lead to different +outcomes than existing code expects (though the documentation has always noted +that this change might happen, recommending fully parenthesizing the +expressions). See \*(L"Extended Bracketed Character Classes\*(R" in perlrecharclass. +.ie n .SS "Omitting ""%"" and ""@"" on hash and array names is no longer permitted" +.el .SS "Omitting \f(CW%\fP and \f(CW@\fP on hash and array names is no longer permitted" +.IX Subsection "Omitting % and @ on hash and array names is no longer permitted" +Really old Perl let you omit the \f(CW\*(C`@\*(C'\fR on array names and the \f(CW\*(C`%\*(C'\fR on hash +names in some spots. This has issued a deprecation warning since Perl +5.000, and is no longer permitted. +.ie n .SS """$!"" text is now in English outside the scope of ""use locale""" +.el .SS "\f(CW``$!''\fP text is now in English outside the scope of \f(CWuse locale\fP" +.IX Subsection """$!"" text is now in English outside the scope of use locale" +Previously, the text, unlike almost everything else, always came out +based on the current underlying locale of the program. (Also affected +on some systems is \f(CW"$^E"\fR.) For programs that are unprepared to +handle locale differences, this can cause garbage text to be displayed. +It's better to display text that is translatable via some tool than +garbage text which is much harder to figure out. +.ie n .SS """$!"" text will be returned in \s-1UTF\-8\s0 when appropriate" +.el .SS "\f(CW``$!''\fP text will be returned in \s-1UTF\-8\s0 when appropriate" +.IX Subsection """$!"" text will be returned in UTF-8 when appropriate" +The stringification of \f(CW$!\fR and \f(CW$^E\fR will have the \s-1UTF\-8\s0 flag set +when the text is actually non-ASCII \s-1UTF\-8.\s0 This will enable programs +that are set up to be locale-aware to properly output messages in the +user's native language. Code that needs to continue the 5.20 and +earlier behavior can do the stringification within the scopes of both +\&\f(CW\*(C`use\ bytes\*(C'\fR and \f(CW\*(C`use\ locale\ ":messages"\*(C'\fR. Within these two +scopes, no other Perl operations will +be affected by locale; only \f(CW$!\fR and \f(CW$^E\fR stringification. The +\&\f(CW\*(C`bytes\*(C'\fR pragma causes the \s-1UTF\-8\s0 flag to not be set, just as in previous +Perl releases. This resolves +[perl #112208] . +.ie n .SS "Support for ""?PATTERN?"" without explicit operator has been removed" +.el .SS "Support for \f(CW?PATTERN?\fP without explicit operator has been removed" +.IX Subsection "Support for ?PATTERN? without explicit operator has been removed" +The \f(CW\*(C`m?PATTERN?\*(C'\fR construct, which allows matching a regex only once, +previously had an alternative form that was written directly with a question +mark delimiter, omitting the explicit \f(CW\*(C`m\*(C'\fR operator. This usage has produced +a deprecation warning since 5.14.0. It is now a syntax error, so that the +question mark can be available for use in new operators. +.ie n .SS """defined(@array)"" and ""defined(%hash)"" are now fatal errors" +.el .SS "\f(CWdefined(@array)\fP and \f(CWdefined(%hash)\fP are now fatal errors" +.IX Subsection "defined(@array) and defined(%hash) are now fatal errors" +These have been deprecated since v5.6.1 and have raised deprecation +warnings since v5.16. +.SS "Using a hash or an array as a reference are now fatal errors" +.IX Subsection "Using a hash or an array as a reference are now fatal errors" +For example, \f(CW\*(C`%foo\->{"bar"}\*(C'\fR now causes a fatal compilation +error. These have been deprecated since before v5.8, and have raised +deprecation warnings since then. +.ie n .SS "Changes to the ""*"" prototype" +.el .SS "Changes to the \f(CW*\fP prototype" +.IX Subsection "Changes to the * prototype" +The \f(CW\*(C`*\*(C'\fR character in a subroutine's prototype used to allow barewords to take +precedence over most, but not all, subroutine names. It was never +consistent and exhibited buggy behavior. +.PP +Now it has been changed, so subroutines always take precedence over barewords, +which brings it into conformity with similarly prototyped built-in functions: +.PP +.Vb 6 +\& sub splat(*) { ... } +\& sub foo { ... } +\& splat(foo); # now always splat(foo()) +\& splat(bar); # still splat(\*(Aqbar\*(Aq) as before +\& close(foo); # close(foo()) +\& close(bar); # close(\*(Aqbar\*(Aq) +.Ve +.SH "Deprecations" +.IX Header "Deprecations" +.ie n .SS "Setting ""${^ENCODING}"" to anything but ""undef""" +.el .SS "Setting \f(CW${^ENCODING}\fP to anything but \f(CWundef\fP" +.IX Subsection "Setting ${^ENCODING} to anything but undef" +This variable allows Perl scripts to be written in an encoding other than +\&\s-1ASCII\s0 or \s-1UTF\-8.\s0 However, it affects all modules globally, leading +to wrong answers and segmentation faults. New scripts should be written +in \s-1UTF\-8\s0; old scripts should be converted to \s-1UTF\-8,\s0 which is easily done +with the piconv utility. +.SS "Use of non-graphic characters in single-character variable names" +.IX Subsection "Use of non-graphic characters in single-character variable names" +The syntax for single-character variable names is more lenient than +for longer variable names, allowing the one-character name to be a +punctuation character or even invisible (a non-graphic). Perl v5.20 +deprecated the ASCII-range controls as such a name. Now, all +non-graphic characters that formerly were allowed are deprecated. +The practical effect of this occurs only when not under \f(CW\*(C`use\ utf8\*(C'\fR, and affects just the C1 controls (code points 0x80 through +0xFF), NO-BREAK \s-1SPACE,\s0 and \s-1SOFT HYPHEN.\s0 +.ie n .SS "Inlining of ""sub () { $var }"" with observable side-effects" +.el .SS "Inlining of \f(CWsub () { $var }\fP with observable side-effects" +.IX Subsection "Inlining of sub () { $var } with observable side-effects" +In many cases Perl makes \f(CW\*(C`sub\ ()\ {\ $var\ }\*(C'\fR into an inlinable constant +subroutine, capturing the value of \f(CW$var\fR at the time the \f(CW\*(C`sub\*(C'\fR expression +is evaluated. This can break the closure behavior in those cases where +\&\f(CW$var\fR is subsequently modified, since the subroutine won't return the +changed value. (Note that this all only applies to anonymous subroutines +with an empty prototype (\f(CW\*(C`sub\ ()\*(C'\fR).) +.PP +This usage is now deprecated in those cases where the variable could be +modified elsewhere. Perl detects those cases and emits a deprecation +warning. Such code will likely change in the future and stop producing a +constant. +.PP +If your variable is only modified in the place where it is declared, then +Perl will continue to make the sub inlinable with no warnings. +.PP +.Vb 4 +\& sub make_constant { +\& my $var = shift; +\& return sub () { $var }; # fine +\& } +\& +\& sub make_constant_deprecated { +\& my $var; +\& $var = shift; +\& return sub () { $var }; # deprecated +\& } +\& +\& sub make_constant_deprecated2 { +\& my $var = shift; +\& log_that_value($var); # could modify $var +\& return sub () { $var }; # deprecated +\& } +.Ve +.PP +In the second example above, detecting that \f(CW$var\fR is assigned to only once +is too hard to detect. That it happens in a spot other than the \f(CW\*(C`my\*(C'\fR +declaration is enough for Perl to find it suspicious. +.PP +This deprecation warning happens only for a simple variable for the body of +the sub. (A \f(CW\*(C`BEGIN\*(C'\fR block or \f(CW\*(C`use\*(C'\fR statement inside the sub is ignored, +because it does not become part of the sub's body.) For more complex +cases, such as \f(CW\*(C`sub\ ()\ {\ do_something()\ if\ 0;\ $var\ }\*(C'\fR the behavior has +changed such that inlining does not happen if the variable is modifiable +elsewhere. Such cases should be rare. +.ie n .SS "Use of multiple ""/x"" regexp modifiers" +.el .SS "Use of multiple \f(CW/x\fP regexp modifiers" +.IX Subsection "Use of multiple /x regexp modifiers" +It is now deprecated to say something like any of the following: +.PP +.Vb 3 +\& qr/foo/xx; +\& /(?xax:foo)/; +\& use re qw(/amxx); +.Ve +.PP +That is, now \f(CW\*(C`x\*(C'\fR should only occur once in any string of contiguous +regular expression pattern modifiers. We do not believe there are any +occurrences of this in all of \s-1CPAN.\s0 This is in preparation for a future +Perl release having \f(CW\*(C`/xx\*(C'\fR permit white-space for readability in +bracketed character classes (those enclosed in square brackets: +\&\f(CW\*(C`[...]\*(C'\fR). +.ie n .SS "Using a NO-BREAK space in a character alias for ""\eN{...}"" is now deprecated" +.el .SS "Using a NO-BREAK space in a character alias for \f(CW\eN{...}\fP is now deprecated" +.IX Subsection "Using a NO-BREAK space in a character alias for N{...} is now deprecated" +This non-graphic character is essentially indistinguishable from a +regular space, and so should not be allowed. See +\&\*(L"\s-1CUSTOM ALIASES\*(R"\s0 in charnames. +.ie n .SS "A literal ""{"" should now be escaped in a pattern" +.el .SS "A literal \f(CW``{''\fP should now be escaped in a pattern" +.IX Subsection "A literal ""{"" should now be escaped in a pattern" +If you want a literal left curly bracket (also called a left brace) in a +regular expression pattern, you should now escape it by either +preceding it with a backslash (\f(CW"\e{"\fR) or enclosing it within square +brackets \f(CW"[{]"\fR, or by using \f(CW\*(C`\eQ\*(C'\fR; otherwise a deprecation warning +will be raised. This was first announced as forthcoming in the v5.16 +release; it will allow future extensions to the language to happen. +.SS "Making all warnings fatal is discouraged" +.IX Subsection "Making all warnings fatal is discouraged" +The documentation for fatal warnings notes that +\&\f(CW\*(C`use warnings FATAL => \*(Aqall\*(Aq\*(C'\fR is discouraged, and provides stronger +language about the risks of fatal warnings in general. +.SH "Performance Enhancements" +.IX Header "Performance Enhancements" +.IP "\(bu" 4 +If a method or class name is known at compile time, a hash is precomputed +to speed up run-time method lookup. Also, compound method names like +\&\f(CW\*(C`SUPER::new\*(C'\fR are parsed at compile time, to save having to parse them at +run time. +.IP "\(bu" 4 +Array and hash lookups (especially nested ones) that use only constants +or simple variables as keys, are now considerably faster. See +\&\*(L"Internal Changes\*(R" for more details. +.IP "\(bu" 4 +\&\f(CW\*(C`(...)x1\*(C'\fR, \f(CW\*(C`("constant")x0\*(C'\fR and \f(CW\*(C`($scalar)x0\*(C'\fR are now optimised in list +context. If the right-hand argument is a constant 1, the repetition +operator disappears. If the right-hand argument is a constant 0, the whole +expression is optimised to the empty list, so long as the left-hand +argument is a simple scalar or constant. (That is, \f(CW\*(C`(foo())x0\*(C'\fR is not +subject to this optimisation.) +.IP "\(bu" 4 +\&\f(CW\*(C`substr\*(C'\fR assignment is now optimised into 4\-argument \f(CW\*(C`substr\*(C'\fR at the end +of a subroutine (or as the argument to \f(CW\*(C`return\*(C'\fR). Previously, this +optimisation only happened in void context. +.IP "\(bu" 4 +In \f(CW"\eL..."\fR, \f(CW"\eQ..."\fR, etc., the extra \*(L"stringify\*(R" op is now optimised +away, making these just as fast as \f(CW\*(C`lcfirst\*(C'\fR, \f(CW\*(C`quotemeta\*(C'\fR, etc. +.IP "\(bu" 4 +Assignment to an empty list is now sometimes faster. In particular, it +never calls \f(CW\*(C`FETCH\*(C'\fR on tied arguments on the right-hand side, whereas it +used to sometimes. +.IP "\(bu" 4 +There is a performance improvement of up to 20% when \f(CW\*(C`length\*(C'\fR is applied to +a non-magical, non-tied string, and either \f(CW\*(C`use bytes\*(C'\fR is in scope or the +string doesn't use \s-1UTF\-8\s0 internally. +.IP "\(bu" 4 +On most perl builds with 64\-bit integers, memory usage for non-magical, +non-tied scalars containing only a floating point value has been reduced +by between 8 and 32 bytes, depending on \s-1OS.\s0 +.IP "\(bu" 4 +In \f(CW\*(C`@array = split\*(C'\fR, the assignment can be optimized away, so that \f(CW\*(C`split\*(C'\fR +writes directly to the array. This optimisation was happening only for +package arrays other than \f(CW@_\fR, and only sometimes. Now this +optimisation happens almost all the time. +.IP "\(bu" 4 +\&\f(CW\*(C`join\*(C'\fR is now subject to constant folding. So for example +\&\f(CW\*(C`join\ "\-",\ "a",\ "b"\*(C'\fR is converted at compile-time to \f(CW"a\-b"\fR. +Moreover, \f(CW\*(C`join\*(C'\fR with a scalar or constant for the separator and a +single-item list to join is simplified to a stringification, and the +separator doesn't even get evaluated. +.IP "\(bu" 4 +\&\f(CW\*(C`qq(@array)\*(C'\fR is implemented using two ops: a stringify op and a join op. +If the \f(CW\*(C`qq\*(C'\fR contains nothing but a single array, the stringification is +optimized away. +.IP "\(bu" 4 +\&\f(CW\*(C`our\ $var\*(C'\fR and \f(CW\*(C`our($s,@a,%h)\*(C'\fR in void context are no longer evaluated at +run time. Even a whole sequence of \f(CW\*(C`our\ $foo;\*(C'\fR statements will simply be +skipped over. The same applies to \f(CW\*(C`state\*(C'\fR variables. +.IP "\(bu" 4 +Many internal functions have been refactored to improve performance and reduce +their memory footprints. +[perl #121436] +[perl #121906] +[perl #121969] +.IP "\(bu" 4 +\&\f(CW\*(C`\-T\*(C'\fR and \f(CW\*(C`\-B\*(C'\fR filetests will return sooner when an empty file is detected. +[perl #121489] +.IP "\(bu" 4 +Hash lookups where the key is a constant are faster. +.IP "\(bu" 4 +Subroutines with an empty prototype and a body containing just \f(CW\*(C`undef\*(C'\fR are now +eligible for inlining. +[perl #122728] +.IP "\(bu" 4 +Subroutines in packages no longer need to be stored in typeglobs: +declaring a subroutine will now put a simple sub reference directly in the +stash if possible, saving memory. The typeglob still notionally exists, +so accessing it will cause the stash entry to be upgraded to a typeglob +(\fIi.e.\fR this is just an internal implementation detail). +This optimization does not currently apply to XSUBs or exported +subroutines, and method calls will undo it, since they cache things in +typeglobs. +[perl #120441] +.IP "\(bu" 4 +The functions \f(CW\*(C`utf8::native_to_unicode()\*(C'\fR and \f(CW\*(C`utf8::unicode_to_native()\*(C'\fR +(see utf8) are now optimized out on \s-1ASCII\s0 platforms. There is now not even +a minimal performance hit in writing code portable between \s-1ASCII\s0 and \s-1EBCDIC\s0 +platforms. +.IP "\(bu" 4 +Win32 Perl uses 8 \s-1KB\s0 less of per-process memory than before for every perl +process, because some data is now memory mapped from disk and shared +between processes from the same perl binary. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +Many of the libraries distributed with perl have been upgraded since v5.20.0. +For a complete list of changes, run: +.PP +.Vb 1 +\& corelist \-\-diff 5.20.0 5.22.0 +.Ve +.PP +You can substitute your favorite version in place of 5.20.0, too. +.PP +Some notable changes include: +.IP "\(bu" 4 +Archive::Tar has been upgraded to version 2.04. +.Sp +Tests can now be run in parallel. +.IP "\(bu" 4 +attributes has been upgraded to version 0.27. +.Sp +The usage of \f(CW\*(C`memEQs\*(C'\fR in the \s-1XS\s0 has been corrected. +[perl #122701] +.Sp +Avoid reading beyond the end of a buffer. [perl #122629] +.IP "\(bu" 4 +B has been upgraded to version 1.58. +.Sp +It provides a new \f(CW\*(C`B::safename\*(C'\fR function, based on the existing +\&\f(CW\*(C`B::GV\->SAFENAME\*(C'\fR, that converts \f(CW\*(C`\ecOPEN\*(C'\fR to \f(CW\*(C`^OPEN\*(C'\fR. +.Sp +Nulled COPs are now of class \f(CW\*(C`B::COP\*(C'\fR, rather than \f(CW\*(C`B::OP\*(C'\fR. +.Sp +\&\f(CW\*(C`B::REGEXP\*(C'\fR objects now provide a \f(CW\*(C`qr_anoncv\*(C'\fR method for accessing the +implicit \s-1CV\s0 associated with \f(CW\*(C`qr//\*(C'\fR things containing code blocks, and a +\&\f(CW\*(C`compflags\*(C'\fR method that returns the pertinent flags originating from the +\&\f(CW\*(C`qr//blahblah\*(C'\fR op. +.Sp +\&\f(CW\*(C`B::PMOP\*(C'\fR now provides a \f(CW\*(C`pmregexp\*(C'\fR method returning a \f(CW\*(C`B::REGEXP\*(C'\fR object. +Two new classes, \f(CW\*(C`B::PADNAME\*(C'\fR and \f(CW\*(C`B::PADNAMELIST\*(C'\fR, have been introduced. +.Sp +A bug where, after an ithread creation or psuedofork, special/immortal SVs in +the child ithread/psuedoprocess did not have the correct class of +\&\f(CW\*(C`B::SPECIAL\*(C'\fR, has been fixed. +The \f(CW\*(C`id\*(C'\fR and \f(CW\*(C`outid\*(C'\fR \s-1PADLIST\s0 methods have been added. +.IP "\(bu" 4 +B::Concise has been upgraded to version 0.996. +.Sp +Null ops that are part of the execution chain are now given sequence +numbers. +.Sp +Private flags for nulled ops are now dumped with mnemonics as they would be +for the non-nulled counterparts. +.IP "\(bu" 4 +B::Deparse has been upgraded to version 1.35. +.Sp +It now deparses \f(CW\*(C`+sub : attr { ... }\*(C'\fR correctly at the start of a +statement. Without the initial \f(CW\*(C`+\*(C'\fR, \f(CW\*(C`sub\*(C'\fR would be a statement label. +.Sp +\&\f(CW\*(C`BEGIN\*(C'\fR blocks are now emitted in the right place most of the time, but +the change unfortunately introduced a regression, in that \f(CW\*(C`BEGIN\*(C'\fR blocks +occurring just before the end of the enclosing block may appear below it +instead. +.Sp +\&\f(CW\*(C`B::Deparse\*(C'\fR no longer puts erroneous \f(CW\*(C`local\*(C'\fR here and there, such as for +\&\f(CW\*(C`LIST = tr/a//d\*(C'\fR. [perl #119815] +.Sp +Adjacent \f(CW\*(C`use\*(C'\fR statements are no longer accidentally nested if one +contains a \f(CW\*(C`do\*(C'\fR block. [perl #115066] +.Sp +Parenthesised arrays in lists passed to \f(CW\*(C`\e\*(C'\fR are now correctly deparsed +with parentheses (\fIe.g.\fR, \f(CW\*(C`\e(@a, (@b), @c)\*(C'\fR now retains the parentheses +around \f(CW@b\fR), thus preserving the flattening behavior of referenced +parenthesised arrays. Formerly, it only worked for one array: \f(CW\*(C`\e(@a)\*(C'\fR. +.Sp +\&\f(CW\*(C`local our\*(C'\fR is now deparsed correctly, with the \f(CW\*(C`our\*(C'\fR included. +.Sp +\&\f(CW\*(C`for($foo; !$bar; $baz) {...}\*(C'\fR was deparsed without the \f(CW\*(C`!\*(C'\fR (or \f(CW\*(C`not\*(C'\fR). +This has been fixed. +.Sp +Core keywords that conflict with lexical subroutines are now deparsed with +the \f(CW\*(C`CORE::\*(C'\fR prefix. +.Sp +\&\f(CW\*(C`foreach state $x (...) {...}\*(C'\fR now deparses correctly with \f(CW\*(C`state\*(C'\fR and +not \f(CW\*(C`my\*(C'\fR. +.Sp +\&\f(CW\*(C`our @array = split(...)\*(C'\fR now deparses correctly with \f(CW\*(C`our\*(C'\fR in those +cases where the assignment is optimized away. +.Sp +It now deparses \f(CW\*(C`our(\f(CILIST\f(CW)\*(C'\fR and typed lexical (\f(CW\*(C`my Dog $spot\*(C'\fR) correctly. +.Sp +Deparse \f(CW$#_\fR as that instead of as \f(CW$#{_}\fR. +[perl #123947] +.Sp +\&\s-1BEGIN\s0 blocks at the end of the enclosing scope are now deparsed in the +right place. [perl #77452] +.Sp +\&\s-1BEGIN\s0 blocks were sometimes deparsed as _\|_ANON_\|_, but are now always called +\&\s-1BEGIN.\s0 +.Sp +Lexical subroutines are now fully deparsed. [perl #116553] +.Sp +\&\f(CW\*(C`Anything =~ y///r\*(C'\fR with \f(CW\*(C`/r\*(C'\fR no longer omits the left-hand operand. +.Sp +The op trees that make up regexp code blocks are now deparsed for real. +Formerly, the original string that made up the regular expression was used. +That caused problems with \f(CW\*(C`qr/(?{< qr/.../flags\*(C'\fR followed by \f(CW\*(C`"" =~ QR\*(C'\fR is no longer +without the flags. +.Sp +Deparsing \f(CW\*(C`BEGIN { undef &foo }\*(C'\fR with the \fB\-w\fR switch enabled started to +emit 'uninitialized' warnings in Perl 5.14. This has been fixed. +.Sp +Deparsing calls to subs with a \f(CW\*(C`(;+)\*(C'\fR prototype resulted in an infinite +loop. The \f(CW\*(C`(;$\*(C'\fR) \f(CW\*(C`(_)\*(C'\fR and \f(CW\*(C`(;_)\*(C'\fR prototypes were given the wrong +precedence, causing \f(CW\*(C`foo($a<$b)\*(C'\fR to be deparsed without the parentheses. +.Sp +Deparse now provides a defined state sub in inner subs. +.IP "\(bu" 4 +B::Op_private has been added. +.Sp +B::Op_private provides detailed information about the flags used in the +\&\f(CW\*(C`op_private\*(C'\fR field of perl opcodes. +.IP "\(bu" 4 +bigint, bignum, bigrat have been upgraded to version 0.39. +.Sp +Document in \s-1CAVEATS\s0 that using strings as numbers won't always invoke +the big number overloading, and how to invoke it. [rt.perl.org #123064] +.IP "\(bu" 4 +Carp has been upgraded to version 1.36. +.Sp +\&\f(CW\*(C`Carp::Heavy\*(C'\fR now ignores version mismatches with Carp if Carp is newer +than 1.12, since \f(CW\*(C`Carp::Heavy\*(C'\fR's guts were merged into Carp at that +point. +[perl #121574] +.Sp +Carp now handles non-ASCII platforms better. +.Sp +Off-by-one error fix for Perl < 5.14. +.IP "\(bu" 4 +constant has been upgraded to version 1.33. +.Sp +It now accepts fully-qualified constant names, allowing constants to be defined +in packages other than the caller. +.IP "\(bu" 4 +\&\s-1CPAN\s0 has been upgraded to version 2.11. +.Sp +Add support for \f(CW\*(C`Cwd::getdcwd()\*(C'\fR and introduce workaround for a misbehavior +seen on Strawberry Perl 5.20.1. +.Sp +Fix \f(CW\*(C`chdir()\*(C'\fR after building dependencies bug. +.Sp +Introduce experimental support for plugins/hooks. +.Sp +Integrate the \f(CW\*(C`App::Cpan\*(C'\fR sources. +.Sp +Do not check recursion on optional dependencies. +.Sp +Sanity check \fI\s-1META\s0.yml\fR to contain a hash. +[cpan #95271] +.IP "\(bu" 4 +CPAN::Meta::Requirements has been upgraded to version 2.132. +.Sp +Works around limitations in \f(CW\*(C`version::vpp\*(C'\fR detecting v\-string magic and adds +support for forthcoming ExtUtils::MakeMaker bootstrap \fIversion.pm\fR for +Perls older than 5.10.0. +.IP "\(bu" 4 +Data::Dumper has been upgraded to version 2.158. +.Sp +Fixes \s-1CVE\-2014\-4330\s0 by adding a configuration variable/option to limit +recursion when dumping deep data structures. +.Sp +Changes to resolve Coverity issues. +\&\s-1XS\s0 dumps incorrectly stored the name of code references stored in a +\&\s-1GLOB.\s0 +[perl #122070] +.IP "\(bu" 4 +DynaLoader has been upgraded to version 1.32. +.Sp +Remove \f(CW\*(C`dl_nonlazy\*(C'\fR global if unused in Dynaloader. [perl #122926] +.IP "\(bu" 4 +Encode has been upgraded to version 2.72. +.Sp +\&\f(CW\*(C`piconv\*(C'\fR now has better error handling when the encoding name is nonexistent, +and a build breakage when upgrading Encode in perl\-5.8.2 and earlier has +been fixed. +.Sp +Building in \*(C+ mode on Windows now works. +.IP "\(bu" 4 +Errno has been upgraded to version 1.23. +.Sp +Add \f(CW\*(C`\-P\*(C'\fR to the preprocessor command-line on \s-1GCC 5.\s0 \s-1GCC\s0 added extra +line directives, breaking parsing of error code definitions. [rt.perl.org +#123784] +.IP "\(bu" 4 +experimental has been upgraded to version 0.013. +.Sp +Hardcodes features for Perls older than 5.15.7. +.IP "\(bu" 4 +ExtUtils::CBuilder has been upgraded to version 0.280221. +.Sp +Fixes a regression on Android. +[perl #122675] +.IP "\(bu" 4 +ExtUtils::Manifest has been upgraded to version 1.70. +.Sp +Fixes a bug with \f(CW\*(C`maniread()\*(C'\fR's handling of quoted filenames and improves +\&\f(CW\*(C`manifind()\*(C'\fR to follow symlinks. +[perl #122415] +.IP "\(bu" 4 +ExtUtils::ParseXS has been upgraded to version 3.28. +.Sp +Only declare \f(CW\*(C`file\*(C'\fR unused if we actually define it. +Improve generated \f(CW\*(C`RETVAL\*(C'\fR code generation to avoid repeated +references to \f(CWST(0)\fR. [perl #123278] +Broaden and document the \f(CW\*(C`/OBJ$/\*(C'\fR to \f(CW\*(C`/REF$/\*(C'\fR typemap optimization +for the \f(CW\*(C`DESTROY\*(C'\fR method. [perl #123418] +.IP "\(bu" 4 +Fcntl has been upgraded to version 1.13. +.Sp +Add support for the Linux pipe buffer size \f(CW\*(C`fcntl()\*(C'\fR commands. +.IP "\(bu" 4 +File::Find has been upgraded to version 1.29. +.Sp +\&\f(CW\*(C`find()\*(C'\fR and \f(CW\*(C`finddepth()\*(C'\fR will now warn if passed inappropriate or +misspelled options. +.IP "\(bu" 4 +File::Glob has been upgraded to version 1.24. +.Sp +Avoid \f(CW\*(C`SvIV()\*(C'\fR expanding to call \f(CW\*(C`get_sv()\*(C'\fR three times in a few +places. [perl #123606] +.IP "\(bu" 4 +HTTP::Tiny has been upgraded to version 0.054. +.Sp +\&\f(CW\*(C`keep_alive\*(C'\fR is now fork-safe and thread-safe. +.IP "\(bu" 4 +\&\s-1IO\s0 has been upgraded to version 1.35. +.Sp +The \s-1XS\s0 implementation has been fixed for the sake of older Perls. +.IP "\(bu" 4 +IO::Socket has been upgraded to version 1.38. +.Sp +Document the limitations of the \f(CW\*(C`connected()\*(C'\fR method. [perl #123096] +.IP "\(bu" 4 +IO::Socket::IP has been upgraded to version 0.37. +.Sp +A better fix for subclassing \f(CW\*(C`connect()\*(C'\fR. +[cpan #95983] +[cpan #97050] +.Sp +Implements Timeout for \f(CW\*(C`connect()\*(C'\fR. +[cpan #92075] +.IP "\(bu" 4 +The libnet collection of modules has been upgraded to version 3.05. +.Sp +Support for IPv6 and \s-1SSL\s0 to \f(CW\*(C`Net::FTP\*(C'\fR, \f(CW\*(C`Net::NNTP\*(C'\fR, \f(CW\*(C`Net::POP3\*(C'\fR and \f(CW\*(C`Net::SMTP\*(C'\fR. +Improvements in \f(CW\*(C`Net::SMTP\*(C'\fR authentication. +.IP "\(bu" 4 +Locale::Codes has been upgraded to version 3.34. +.Sp +Fixed a bug in the scripts used to extract data from spreadsheets that +prevented the \s-1SHP\s0 currency code from being found. +[cpan #94229] +.Sp +New codes have been added. +.IP "\(bu" 4 +Math::BigInt has been upgraded to version 1.9997. +.Sp +Synchronize \s-1POD\s0 changes from the \s-1CPAN\s0 release. +\&\f(CW\*(C`Math::BigFloat\->blog(x)\*(C'\fR would sometimes return \f(CW\*(C`blog(2*x)\*(C'\fR when +the accuracy was greater than 70 digits. +The result of \f(CW\*(C`Math::BigFloat\->bdiv()\*(C'\fR in list context now +satisfies \f(CW\*(C`x = quotient * divisor + remainder\*(C'\fR. +.Sp +Correct handling of subclasses. +[cpan #96254] +[cpan #96329] +.IP "\(bu" 4 +Module::Metadata has been upgraded to version 1.000026. +.Sp +Support installations on older perls with an ExtUtils::MakeMaker earlier +than 6.63_03 +.IP "\(bu" 4 +overload has been upgraded to version 1.26. +.Sp +A redundant \f(CW\*(C`ref $sub\*(C'\fR check has been removed. +.IP "\(bu" 4 +The PathTools module collection has been upgraded to version 3.56. +.Sp +A warning from the \fBgcc\fR compiler is now avoided when building the \s-1XS.\s0 +.Sp +Don't turn leading \f(CW\*(C`//\*(C'\fR into \f(CW\*(C`/\*(C'\fR on Cygwin. [perl #122635] +.IP "\(bu" 4 +perl5db.pl has been upgraded to version 1.49. +.Sp +The debugger would cause an assertion failure. +[perl #124127] +.Sp +\&\f(CW\*(C`fork()\*(C'\fR in the debugger under \f(CW\*(C`tmux\*(C'\fR will now create a new window for +the forked process. [perl +#121333] +.Sp +The debugger now saves the current working directory on startup and +restores it when you restart your program with \f(CW\*(C`R\*(C'\fR or \f(CW\*(C`rerun\*(C'\fR. [perl +#121509] +.IP "\(bu" 4 +PerlIO::scalar has been upgraded to version 0.22. +.Sp +Reading from a position well past the end of the scalar now correctly +returns end of file. [perl #123443] +.Sp +Seeking to a negative position still fails, but no longer leaves the +file position set to a negation location. +.Sp +\&\f(CW\*(C`eof()\*(C'\fR on a \f(CW\*(C`PerlIO::scalar\*(C'\fR handle now properly returns true when +the file position is past the 2GB mark on 32\-bit systems. +.Sp +Attempting to write at file positions impossible for the platform now +fail early rather than wrapping at 4GB. +.IP "\(bu" 4 +Pod::Perldoc has been upgraded to version 3.25. +.Sp +Filehandles opened for reading or writing now have \f(CW\*(C`:encoding(UTF\-8)\*(C'\fR set. +[cpan #98019] +.IP "\(bu" 4 +\&\s-1POSIX\s0 has been upgraded to version 1.53. +.Sp +The C99 math functions and constants (for example \f(CW\*(C`acosh\*(C'\fR, \f(CW\*(C`isinf\*(C'\fR, \f(CW\*(C`isnan\*(C'\fR, \f(CW\*(C`round\*(C'\fR, +\&\f(CW\*(C`trunc\*(C'\fR; \f(CW\*(C`M_E\*(C'\fR, \f(CW\*(C`M_SQRT2\*(C'\fR, \f(CW\*(C`M_PI\*(C'\fR) have been added. +.Sp +\&\f(CW\*(C`POSIX::tmpnam()\*(C'\fR now produces a deprecation warning. [perl #122005] +.IP "\(bu" 4 +Safe has been upgraded to version 2.39. +.Sp +\&\f(CW\*(C`reval\*(C'\fR was not propagating void context properly. +.IP "\(bu" 4 +Scalar-List-Utils has been upgraded to version 1.41. +.Sp +A new module, Sub::Util, has been added, containing functions related to +\&\s-1CODE\s0 refs, including \f(CW\*(C`subname\*(C'\fR (inspired by \f(CW\*(C`Sub::Identity\*(C'\fR) and \f(CW\*(C`set_subname\*(C'\fR +(copied and renamed from \f(CW\*(C`Sub::Name\*(C'\fR). +The use of \f(CW\*(C`GetMagic\*(C'\fR in \f(CW\*(C`List::Util::reduce()\*(C'\fR has also been fixed. +[cpan #63211] +.IP "\(bu" 4 +SDBM_File has been upgraded to version 1.13. +.Sp +Simplified the build process. [perl #123413] +.IP "\(bu" 4 +Time::Piece has been upgraded to version 1.29. +.Sp +When pretty printing negative \f(CW\*(C`Time::Seconds\*(C'\fR, the \*(L"minus\*(R" is no longer lost. +.IP "\(bu" 4 +Unicode::Collate has been upgraded to version 1.12. +.Sp +Version 0.67's improved discontiguous contractions is invalidated by default +and is supported as a parameter \f(CW\*(C`long_contraction\*(C'\fR. +.IP "\(bu" 4 +Unicode::Normalize has been upgraded to version 1.18. +.Sp +The \s-1XSUB\s0 implementation has been removed in favor of pure Perl. +.IP "\(bu" 4 +Unicode::UCD has been upgraded to version 0.61. +.Sp +A new function \fBproperty_values()\fR +has been added to return a given property's possible values. +.Sp +A new function \fBcharprop()\fR +has been added to return the value of a given property for a given code +point. +.Sp +A new function \fBcharprops_all()\fR +has been added to return the values of all Unicode properties for a +given code point. +.Sp +A bug has been fixed so that \fBpropaliases()\fR +returns the correct short and long names for the Perl extensions where +it was incorrect. +.Sp +A bug has been fixed so that +\&\fBprop_value_aliases()\fR +returns \f(CW\*(C`undef\*(C'\fR instead of a wrong result for properties that are Perl +extensions. +.Sp +This module now works on \s-1EBCDIC\s0 platforms. +.IP "\(bu" 4 +utf8 has been upgraded to version 1.17 +.Sp +A mismatch between the documentation and the code in \f(CW\*(C`utf8::downgrade()\*(C'\fR +was fixed in favor of the documentation. The optional second argument +is now correctly treated as a perl boolean (true/false semantics) and +not as an integer. +.IP "\(bu" 4 +version has been upgraded to version 0.9909. +.Sp +Numerous changes. See the \fIChanges\fR file in the \s-1CPAN\s0 distribution for +details. +.IP "\(bu" 4 +Win32 has been upgraded to version 0.51. +.Sp +\&\f(CW\*(C`GetOSName()\*(C'\fR now supports Windows 8.1, and building in \*(C+ mode now works. +.IP "\(bu" 4 +Win32API::File has been upgraded to version 0.1202 +.Sp +Building in \*(C+ mode now works. +.IP "\(bu" 4 +XSLoader has been upgraded to version 0.20. +.Sp +Allow XSLoader to load modules from a different namespace. +[perl #122455] +.SS "Removed Modules and Pragmata" +.IX Subsection "Removed Modules and Pragmata" +The following modules (and associated modules) have been removed from the core +perl distribution: +.IP "\(bu" 4 +\&\s-1CGI\s0 +.IP "\(bu" 4 +Module::Build +.SH "Documentation" +.IX Header "Documentation" +.SS "New Documentation" +.IX Subsection "New Documentation" +\fIperlunicook\fR +.IX Subsection "perlunicook" +.PP +This document, by Tom Christiansen, provides examples of handling Unicode in +Perl. +.SS "Changes to Existing Documentation" +.IX Subsection "Changes to Existing Documentation" +\fIperlaix\fR +.IX Subsection "perlaix" +.IP "\(bu" 4 +A note on long doubles has been added. +.PP +\fIperlapi\fR +.IX Subsection "perlapi" +.IP "\(bu" 4 +Note that \f(CW\*(C`SvSetSV\*(C'\fR doesn't do set magic. +.IP "\(bu" 4 +\&\f(CW\*(C`sv_usepvn_flags\*(C'\fR \- fix documentation to mention the use of \f(CW\*(C`Newx\*(C'\fR instead of +\&\f(CW\*(C`malloc\*(C'\fR. +.Sp +[perl #121869] +.IP "\(bu" 4 +Clarify where \f(CW\*(C`NUL\*(C'\fR may be embedded or is required to terminate a string. +.IP "\(bu" 4 +Some documentation that was previously missing due to formatting errors is +now included. +.IP "\(bu" 4 +Entries are now organized into groups rather than by the file where they +are found. +.IP "\(bu" 4 +Alphabetical sorting of entries is now done consistently (automatically +by the \s-1POD\s0 generator) to make entries easier to find when scanning. +.PP +\fIperldata\fR +.IX Subsection "perldata" +.IP "\(bu" 4 +The syntax of single-character variable names has been brought +up-to-date and more fully explained. +.IP "\(bu" 4 +Hexadecimal floating point numbers are described, as are infinity and +NaN. +.PP +\fIperlebcdic\fR +.IX Subsection "perlebcdic" +.IP "\(bu" 4 +This document has been significantly updated in the light of recent +improvements to \s-1EBCDIC\s0 support. +.PP +\fIperlfilter\fR +.IX Subsection "perlfilter" +.IP "\(bu" 4 +Added a \s-1LIMITATIONS\s0 section. +.PP +\fIperlfunc\fR +.IX Subsection "perlfunc" +.IP "\(bu" 4 +Mention that \f(CW\*(C`study()\*(C'\fR is currently a no-op. +.IP "\(bu" 4 +Calling \f(CW\*(C`delete\*(C'\fR or \f(CW\*(C`exists\*(C'\fR on array values is now described as \*(L"strongly +discouraged\*(R" rather than \*(L"deprecated\*(R". +.IP "\(bu" 4 +Improve documentation of \f(CW\*(C`our\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`\-l\*(C'\fR now notes that it will return false if symlinks aren't supported by the +file system. +[perl #121523] +.IP "\(bu" 4 +Note that \f(CW\*(C`exec LIST\*(C'\fR and \f(CW\*(C`system LIST\*(C'\fR may fall back to the shell on +Win32. Only the indirect-object syntax \f(CW\*(C`exec PROGRAM LIST\*(C'\fR and +\&\f(CW\*(C`system PROGRAM LIST\*(C'\fR will reliably avoid using the shell. +.Sp +This has also been noted in perlport. +.Sp +[perl #122046] +.PP +\fIperlguts\fR +.IX Subsection "perlguts" +.IP "\(bu" 4 +The \s-1OOK\s0 example has been updated to account for \s-1COW\s0 changes and a change in the +storage of the offset. +.IP "\(bu" 4 +Details on C level symbols and libperl.t added. +.IP "\(bu" 4 +Information on Unicode handling has been added +.IP "\(bu" 4 +Information on \s-1EBCDIC\s0 handling has been added +.PP +\fIperlhack\fR +.IX Subsection "perlhack" +.IP "\(bu" 4 +A note has been added about running on platforms with non-ASCII +character sets +.IP "\(bu" 4 +A note has been added about performance testing +.PP +\fIperlhacktips\fR +.IX Subsection "perlhacktips" +.IP "\(bu" 4 +Documentation has been added illustrating the perils of assuming that +there is no change to the contents of static memory pointed to by the +return values of Perl's wrappers for C library functions. +.IP "\(bu" 4 +Replacements for \f(CW\*(C`tmpfile\*(C'\fR, \f(CW\*(C`atoi\*(C'\fR, \f(CW\*(C`strtol\*(C'\fR, and \f(CW\*(C`strtoul\*(C'\fR are now +recommended. +.IP "\(bu" 4 +Updated documentation for the \f(CW\*(C`test.valgrind\*(C'\fR \f(CW\*(C`make\*(C'\fR target. +[perl #121431] +.IP "\(bu" 4 +Information is given about writing test files portably to non-ASCII +platforms. +.IP "\(bu" 4 +A note has been added about how to get a C language stack backtrace. +.PP +\fIperlhpux\fR +.IX Subsection "perlhpux" +.IP "\(bu" 4 +Note that the message \*(L"Redeclaration of \*(R"sendpath\*(L" with a different +storage class specifier\*(R" is harmless. +.PP +\fIperllocale\fR +.IX Subsection "perllocale" +.IP "\(bu" 4 +Updated for the enhancements in v5.22, along with some clarifications. +.PP +\fIperlmodstyle\fR +.IX Subsection "perlmodstyle" +.IP "\(bu" 4 +Instead of pointing to the module list, we are now pointing to +PrePAN . +.PP +\fIperlop\fR +.IX Subsection "perlop" +.IP "\(bu" 4 +Updated for the enhancements in v5.22, along with some clarifications. +.PP +\fIperlpodspec\fR +.IX Subsection "perlpodspec" +.IP "\(bu" 4 +The specification of the pod language is changing so that the default +encoding of pods that aren't in \s-1UTF\-8\s0 (unless otherwise indicated) is +\&\s-1CP1252\s0 instead of \s-1ISO 8859\-1\s0 (Latin1). +.PP +\fIperlpolicy\fR +.IX Subsection "perlpolicy" +.IP "\(bu" 4 +We now have a code of conduct for the \fIp5p\fR mailing list, as documented +in \*(L"\s-1STANDARDS OF CONDUCT\*(R"\s0 in perlpolicy. +.IP "\(bu" 4 +The conditions for marking an experimental feature as non-experimental are now +set out. +.IP "\(bu" 4 +Clarification has been made as to what sorts of changes are permissible in +maintenance releases. +.PP +\fIperlport\fR +.IX Subsection "perlport" +.IP "\(bu" 4 +Out-of-date VMS-specific information has been fixed and/or simplified. +.IP "\(bu" 4 +Notes about \s-1EBCDIC\s0 have been added. +.PP +\fIperlre\fR +.IX Subsection "perlre" +.IP "\(bu" 4 +The description of the \f(CW\*(C`/x\*(C'\fR modifier has been clarified to note that +comments cannot be continued onto the next line by escaping them; and +there is now a list of all the characters that are considered whitespace +by this modifier. +.IP "\(bu" 4 +The new \f(CW\*(C`/n\*(C'\fR modifier is described. +.IP "\(bu" 4 +A note has been added on how to make bracketed character class ranges +portable to non-ASCII machines. +.PP +\fIperlrebackslash\fR +.IX Subsection "perlrebackslash" +.IP "\(bu" 4 +Added documentation of \f(CW\*(C`\eb{sb}\*(C'\fR, \f(CW\*(C`\eb{wb}\*(C'\fR, \f(CW\*(C`\eb{gcb}\*(C'\fR, and \f(CW\*(C`\eb{g}\*(C'\fR. +.PP +\fIperlrecharclass\fR +.IX Subsection "perlrecharclass" +.IP "\(bu" 4 +Clarifications have been added to \*(L"Character Ranges\*(R" in perlrecharclass +to the effect \f(CW\*(C`[A\-Z]\*(C'\fR, \f(CW\*(C`[a\-z]\*(C'\fR, \f(CW\*(C`[0\-9]\*(C'\fR and +any subranges thereof in regular expression bracketed character classes +are guaranteed to match exactly what a naive English speaker would +expect them to match, even on platforms (such as \s-1EBCDIC\s0) where perl +has to do extra work to accomplish this. +.IP "\(bu" 4 +The documentation of Bracketed Character Classes has been expanded to cover the +improvements in \f(CW\*(C`qr/[\eN{named sequence}]/\*(C'\fR (see under \*(L"Selected Bug Fixes\*(R"). +.PP +\fIperlref\fR +.IX Subsection "perlref" +.IP "\(bu" 4 +A new section has been added +Assigning to References +.PP +\fIperlsec\fR +.IX Subsection "perlsec" +.IP "\(bu" 4 +Comments added on algorithmic complexity and tied hashes. +.PP +\fIperlsyn\fR +.IX Subsection "perlsyn" +.IP "\(bu" 4 +An ambiguity in the documentation of the \f(CW\*(C`...\*(C'\fR statement has been corrected. +[perl #122661] +.IP "\(bu" 4 +The empty conditional in \f(CW\*(C`for\*(C'\fR and \f(CW\*(C`while\*(C'\fR is now documented +in perlsyn. +.PP +\fIperlunicode\fR +.IX Subsection "perlunicode" +.IP "\(bu" 4 +This has had extensive revisions to bring it up-to-date with current +Unicode support and to make it more readable. Notable is that Unicode +7.0 changed what it should do with non-characters. Perl retains the old +way of handling for reasons of backward compatibility. See +\&\*(L"Noncharacter code points\*(R" in perlunicode. +.PP +\fIperluniintro\fR +.IX Subsection "perluniintro" +.IP "\(bu" 4 +Advice for how to make sure your strings and regular expression patterns are +interpreted as Unicode has been updated. +.PP +\fIperlvar\fR +.IX Subsection "perlvar" +.IP "\(bu" 4 +\&\f(CW$]\fR is no longer listed as being deprecated. Instead, discussion has +been added on the advantages and disadvantages of using it versus +\&\f(CW$^V\fR. \f(CW$OLD_PERL_VERSION\fR was re-added to the documentation as the long +form of \f(CW$]\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`${^ENCODING}\*(C'\fR is now marked as deprecated. +.IP "\(bu" 4 +The entry for \f(CW\*(C`%^H\*(C'\fR has been clarified to indicate it can only handle +simple values. +.PP +\fIperlvms\fR +.IX Subsection "perlvms" +.IP "\(bu" 4 +Out-of-date and/or incorrect material has been removed. +.IP "\(bu" 4 +Updated documentation on environment and shell interaction in \s-1VMS.\s0 +.PP +\fIperlxs\fR +.IX Subsection "perlxs" +.IP "\(bu" 4 +Added a discussion of locale issues in \s-1XS\s0 code. +.SH "Diagnostics" +.IX Header "Diagnostics" +The following additions or changes have been made to diagnostic output, +including warnings and fatal error messages. For the complete list of +diagnostic messages, see perldiag. +.SS "New Diagnostics" +.IX Subsection "New Diagnostics" +\fINew Errors\fR +.IX Subsection "New Errors" +.IP "\(bu" 4 +Bad symbol for scalar +.Sp +(P) An internal request asked to add a scalar entry to something that +wasn't a symbol table entry. +.IP "\(bu" 4 +Can't use a hash as a reference +.Sp +(F) You tried to use a hash as a reference, as in +\&\f(CW\*(C`%foo\->{"bar"}\*(C'\fR or \f(CW\*(C`%$ref\->{"hello"}\*(C'\fR. Versions of perl <= 5.6.1 +used to allow this syntax, but shouldn't have. +.IP "\(bu" 4 +Can't use an array as a reference +.Sp +(F) You tried to use an array as a reference, as in +\&\f(CW\*(C`@foo\->[23]\*(C'\fR or \f(CW\*(C`@$ref\->[99]\*(C'\fR. Versions of perl <= 5.6.1 used to +allow this syntax, but shouldn't have. +.IP "\(bu" 4 +Can't use 'defined(@array)' (Maybe you should just omit the \fBdefined()\fR?) +.Sp +(F) \f(CW\*(C`defined()\*(C'\fR is not useful on arrays because it +checks for an undefined \fIscalar\fR value. If you want to see if the +array is empty, just use \f(CW\*(C`if\ (@array)\ {\ #\ not\ empty\ }\*(C'\fR for example. +.IP "\(bu" 4 +Can't use 'defined(%hash)' (Maybe you should just omit the \fBdefined()\fR?) +.Sp +(F) \f(CW\*(C`defined()\*(C'\fR is not usually right on hashes. +.Sp +Although \f(CW\*(C`defined\ %hash\*(C'\fR is false on a plain not-yet-used hash, it +becomes true in several non-obvious circumstances, including iterators, +weak references, stash names, even remaining true after \f(CW\*(C`undef\ %hash\*(C'\fR. +These things make \f(CW\*(C`defined\ %hash\*(C'\fR fairly useless in practice, so it now +generates a fatal error. +.Sp +If a check for non-empty is what you wanted then just put it in boolean +context (see \*(L"Scalar values\*(R" in perldata): +.Sp +.Vb 3 +\& if (%hash) { +\& # not empty +\& } +.Ve +.Sp +If you had \f(CW\*(C`defined\ %Foo::Bar::QUUX\*(C'\fR to check whether such a package +variable exists then that's never really been reliable, and isn't +a good way to enquire about the features of a package, or whether +it's loaded, etc. +.IP "\(bu" 4 +Cannot chr \f(CW%f\fR +.Sp +(F) You passed an invalid number (like an infinity or not-a-number) to +\&\f(CW\*(C`chr\*(C'\fR. +.IP "\(bu" 4 +Cannot compress \f(CW%f\fR in pack +.Sp +(F) You tried converting an infinity or not-a-number to an unsigned +character, which makes no sense. +.IP "\(bu" 4 +Cannot pack \f(CW%f\fR with '%c' +.Sp +(F) You tried converting an infinity or not-a-number to a character, +which makes no sense. +.IP "\(bu" 4 +Cannot print \f(CW%f\fR with '%c' +.Sp +(F) You tried printing an infinity or not-a-number as a character (\f(CW%c\fR), +which makes no sense. Maybe you meant \f(CW\*(Aq%s\*(Aq\fR, or just stringifying it? +.IP "\(bu" 4 +charnames alias definitions may not contain a sequence of multiple spaces +.Sp +(F) You defined a character name which had multiple space +characters in a row. Change them to single spaces. Usually these +names are defined in the \f(CW\*(C`:alias\*(C'\fR import argument to \f(CW\*(C`use charnames\*(C'\fR, but +they could be defined by a translator installed into \f(CW$^H{charnames}\fR. +See \*(L"\s-1CUSTOM ALIASES\*(R"\s0 in charnames. +.IP "\(bu" 4 +charnames alias definitions may not contain trailing white-space +.Sp +(F) You defined a character name which ended in a space +character. Remove the trailing space(s). Usually these names are +defined in the \f(CW\*(C`:alias\*(C'\fR import argument to \f(CW\*(C`use charnames\*(C'\fR, but they +could be defined by a translator installed into \f(CW$^H{charnames}\fR. +See \*(L"\s-1CUSTOM ALIASES\*(R"\s0 in charnames. +.IP "\(bu" 4 +:const is not permitted on named subroutines +.Sp +(F) The \f(CW\*(C`const\*(C'\fR attribute causes an anonymous subroutine to be run and +its value captured at the time that it is cloned. Named subroutines are +not cloned like this, so the attribute does not make sense on them. +.IP "\(bu" 4 +Hexadecimal float: internal error +.Sp +(F) Something went horribly bad in hexadecimal float handling. +.IP "\(bu" 4 +Hexadecimal float: unsupported long double format +.Sp +(F) You have configured Perl to use long doubles but +the internals of the long double format are unknown, +therefore the hexadecimal float output is impossible. +.IP "\(bu" 4 +Illegal suidscript +.Sp +(F) The script run under suidperl was somehow illegal. +.IP "\(bu" 4 +In '(?...)', the '(' and '?' must be adjacent in regex; marked by <\-\-\ \s-1HERE\s0 in m/%s/ +.Sp +(F) The two-character sequence \f(CW"(?"\fR in +this context in a regular expression pattern should be an +indivisible token, with nothing intervening between the \f(CW"("\fR +and the \f(CW"?"\fR, but you separated them. +.IP "\(bu" 4 +In '(*VERB...)', the '(' and '*' must be adjacent in regex; marked by <\-\-\ \s-1HERE\s0 in m/%s/ +.Sp +(F) The two-character sequence \f(CW"(*"\fR in +this context in a regular expression pattern should be an +indivisible token, with nothing intervening between the \f(CW"("\fR +and the \f(CW"*"\fR, but you separated them. +.IP "\(bu" 4 +Invalid quantifier in {,} in regex; marked by <\-\- \s-1HERE\s0 in m/%s/ +.Sp +(F) The pattern looks like a {min,max} quantifier, but the min or max could not +be parsed as a valid number: either it has leading zeroes, or it represents +too big a number to cope with. The <\-\-\ \s-1HERE\s0 shows where in the regular +expression the problem was discovered. See perlre. +.IP "\(bu" 4 +\&'%s' is an unknown bound type in regex +.Sp +(F) You used \f(CW\*(C`\eb{...}\*(C'\fR or \f(CW\*(C`\eB{...}\*(C'\fR and the \f(CW\*(C`...\*(C'\fR is not known to +Perl. The current valid ones are given in +\&\*(L"\eb{}, \eb, \eB{}, \eB\*(R" in perlrebackslash. +.IP "\(bu" 4 +Missing or undefined argument to require +.Sp +(F) You tried to call \f(CW\*(C`require\*(C'\fR with no argument or with an undefined +value as an argument. \f(CW\*(C`require\*(C'\fR expects either a package name or a +file-specification as an argument. See \*(L"require\*(R" in perlfunc. +.Sp +Formerly, \f(CW\*(C`require\*(C'\fR with no argument or \f(CW\*(C`undef\*(C'\fR warned about a Null filename. +.PP +\fINew Warnings\fR +.IX Subsection "New Warnings" +.IP "\(bu" 4 +\&\eC is deprecated in regex +.Sp +(D deprecated) The \f(CW\*(C`/\eC/\*(C'\fR character class was deprecated in v5.20, and +now emits a warning. It is intended that it will become an error in v5.24. +This character class matches a single byte even if it appears within a +multi-byte character, breaks encapsulation, and can corrupt \s-1UTF\-8\s0 +strings. +.IP "\(bu" 4 +\&\*(L"%s\*(R" is more clearly written simply as \*(L"%s\*(R" in regex; marked by <\-\- \s-1HERE\s0 in m/%s/ +.Sp +(W regexp) (only under \f(CW\*(C`use\ re\ \*(Aqstrict\*(Aq\*(C'\fR or within \f(CW\*(C`(?[...])\*(C'\fR) +.Sp +You specified a character that has the given plainer way of writing it, +and which is also portable to platforms running with different character +sets. +.IP "\(bu" 4 +Argument \*(L"%s\*(R" treated as 0 in increment (++) +.Sp +(W numeric) The indicated string was fed as an argument to the \f(CW\*(C`++\*(C'\fR operator +which expects either a number or a string matching \f(CW\*(C`/^[a\-zA\-Z]*[0\-9]*\ez/\*(C'\fR. +See \*(L"Auto-increment and Auto-decrement\*(R" in perlop for details. +.IP "\(bu" 4 +Both or neither range ends should be Unicode in regex; marked by <\-\- \s-1HERE\s0 in m/%s/ +.Sp +(W regexp) (only under \f(CW\*(C`use\ re\ \*(Aqstrict\*(Aq\*(C'\fR or within \f(CW\*(C`(?[...])\*(C'\fR) +.Sp +In a bracketed character class in a regular expression pattern, you +had a range which has exactly one end of it specified using \f(CW\*(C`\eN{}\*(C'\fR, and +the other end is specified using a non-portable mechanism. Perl treats +the range as a Unicode range, that is, all the characters in it are +considered to be the Unicode characters, and which may be different code +points on some platforms Perl runs on. For example, \f(CW\*(C`[\eN{U+06}\-\ex08]\*(C'\fR +is treated as if you had instead said \f(CW\*(C`[\eN{U+06}\-\eN{U+08}]\*(C'\fR, that is it +matches the characters whose code points in Unicode are 6, 7, and 8. +But that \f(CW\*(C`\ex08\*(C'\fR might indicate that you meant something different, so +the warning gets raised. +.IP "\(bu" 4 +Can't do %s(\*(L"%s\*(R") on non\-UTF\-8 locale; resolved to \*(L"%s\*(R". +.Sp +(W locale) You are 1) running under "\f(CW\*(C`use locale\*(C'\fR"; 2) the current +locale is not a \s-1UTF\-8\s0 one; 3) you tried to do the designated case-change +operation on the specified Unicode character; and 4) the result of this +operation would mix Unicode and locale rules, which likely conflict. +.Sp +The warnings category \f(CW\*(C`locale\*(C'\fR is new. +.IP "\(bu" 4 +:const is experimental +.Sp +(S experimental::const_attr) The \f(CW\*(C`const\*(C'\fR attribute is experimental. +If you want to use the feature, disable the warning with \f(CW\*(C`no warnings +\&\*(Aqexperimental::const_attr\*(Aq\*(C'\fR, but know that in doing so you are taking +the risk that your code may break in a future Perl version. +.IP "\(bu" 4 +gmtime(%f) failed +.Sp +(W overflow) You called \f(CW\*(C`gmtime\*(C'\fR with a number that it could not handle: +too large, too small, or NaN. The returned value is \f(CW\*(C`undef\*(C'\fR. +.IP "\(bu" 4 +Hexadecimal float: exponent overflow +.Sp +(W overflow) The hexadecimal floating point has larger exponent +than the floating point supports. +.IP "\(bu" 4 +Hexadecimal float: exponent underflow +.Sp +(W overflow) The hexadecimal floating point has smaller exponent +than the floating point supports. +.IP "\(bu" 4 +Hexadecimal float: mantissa overflow +.Sp +(W overflow) The hexadecimal floating point literal had more bits in +the mantissa (the part between the \f(CW\*(C`0x\*(C'\fR and the exponent, also known as +the fraction or the significand) than the floating point supports. +.IP "\(bu" 4 +Hexadecimal float: precision loss +.Sp +(W overflow) The hexadecimal floating point had internally more +digits than could be output. This can be caused by unsupported +long double formats, or by 64\-bit integers not being available +(needed to retrieve the digits under some configurations). +.IP "\(bu" 4 +Locale '%s' may not work well.%s +.Sp +(W locale) You are using the named locale, which is a non\-UTF\-8 one, and +which perl has determined is not fully compatible with what it can +handle. The second \f(CW%s\fR gives a reason. +.Sp +The warnings category \f(CW\*(C`locale\*(C'\fR is new. +.IP "\(bu" 4 +localtime(%f) failed +.Sp +(W overflow) You called \f(CW\*(C`localtime\*(C'\fR with a number that it could not handle: +too large, too small, or NaN. The returned value is \f(CW\*(C`undef\*(C'\fR. +.IP "\(bu" 4 +Negative repeat count does nothing +.Sp +(W numeric) You tried to execute the +\&\f(CW\*(C`x\*(C'\fR repetition operator fewer than 0 +times, which doesn't make sense. +.IP "\(bu" 4 +NO-BREAK \s-1SPACE\s0 in a charnames alias definition is deprecated +.Sp +(D deprecated) You defined a character name which contained a no-break +space character. Change it to a regular space. Usually these names are +defined in the \f(CW\*(C`:alias\*(C'\fR import argument to \f(CW\*(C`use charnames\*(C'\fR, but they +could be defined by a translator installed into \f(CW$^H{charnames}\fR. See +\&\*(L"\s-1CUSTOM ALIASES\*(R"\s0 in charnames. +.IP "\(bu" 4 +Non-finite repeat count does nothing +.Sp +(W numeric) You tried to execute the +\&\f(CW\*(C`x\*(C'\fR repetition operator \f(CW\*(C`Inf\*(C'\fR (or +\&\f(CW\*(C`\-Inf\*(C'\fR) or NaN times, which doesn't make sense. +.IP "\(bu" 4 +PerlIO layer ':win32' is experimental +.Sp +(S experimental::win32_perlio) The \f(CW\*(C`:win32\*(C'\fR PerlIO layer is +experimental. If you want to take the risk of using this layer, +simply disable this warning: +.Sp +.Vb 1 +\& no warnings "experimental::win32_perlio"; +.Ve +.IP "\(bu" 4 +Ranges of \s-1ASCII\s0 printables should be some subset of \*(L"0\-9\*(R", \*(L"A\-Z\*(R", or \*(L"a\-z\*(R" in regex; marked by <\-\- \s-1HERE\s0 in m/%s/ +.Sp +(W regexp) (only under \f(CW\*(C`use\ re\ \*(Aqstrict\*(Aq\*(C'\fR or within \f(CW\*(C`(?[...])\*(C'\fR) +.Sp +Stricter rules help to find typos and other errors. Perhaps you didn't +even intend a range here, if the \f(CW"\-"\fR was meant to be some other +character, or should have been escaped (like \f(CW"\e\-"\fR). If you did +intend a range, the one that was used is not portable between \s-1ASCII\s0 and +\&\s-1EBCDIC\s0 platforms, and doesn't have an obvious meaning to a casual +reader. +.Sp +.Vb 7 +\& [3\-7] # OK; Obvious and portable +\& [d\-g] # OK; Obvious and portable +\& [A\-Y] # OK; Obvious and portable +\& [A\-z] # WRONG; Not portable; not clear what is meant +\& [a\-Z] # WRONG; Not portable; not clear what is meant +\& [%\-.] # WRONG; Not portable; not clear what is meant +\& [\ex41\-Z] # WRONG; Not portable; not obvious to non\-geek +.Ve +.Sp +(You can force portability by specifying a Unicode range, which means that +the endpoints are specified by +\&\f(CW\*(C`\eN{...}\*(C'\fR, but the meaning may +still not be obvious.) +The stricter rules require that ranges that start or stop with an \s-1ASCII\s0 +character that is not a control have all their endpoints be a literal +character, and not some escape sequence (like \f(CW"\ex41"\fR), and the ranges +must be all digits, or all uppercase letters, or all lowercase letters. +.IP "\(bu" 4 +Ranges of digits should be from the same group in regex; marked by <\-\- \s-1HERE\s0 in m/%s/ +.Sp +(W regexp) (only under \f(CW\*(C`use\ re\ \*(Aqstrict\*(Aq\*(C'\fR or within \f(CW\*(C`(?[...])\*(C'\fR) +.Sp +Stricter rules help to find typos and other errors. You included a +range, and at least one of the end points is a decimal digit. Under the +stricter rules, when this happens, both end points should be digits in +the same group of 10 consecutive digits. +.IP "\(bu" 4 +Redundant argument in \f(CW%s\fR +.Sp +(W redundant) You called a function with more arguments than were +needed, as indicated by information within other arguments you supplied +(\fIe.g\fR. a printf format). Currently only emitted when a printf-type format +required fewer arguments than were supplied, but might be used in the +future for \fIe.g.\fR \*(L"pack\*(R" in perlfunc. +.Sp +The warnings category \f(CW\*(C`redundant\*(C'\fR is new. See also +[perl #121025] . +.IP "\(bu" 4 +Replacement list is longer than search list +.Sp +This is not a new diagnostic, but in earlier releases was accidentally +not displayed if the transliteration contained wide characters. This is +now fixed, so that you may see this diagnostic in places where you +previously didn't (but should have). +.IP "\(bu" 4 +Use of \eb{} for non\-UTF\-8 locale is wrong. Assuming a \s-1UTF\-8\s0 locale +.Sp +(W locale) You are matching a regular expression using locale rules, +and a Unicode boundary is being matched, but the locale is not a Unicode +one. This doesn't make sense. Perl will continue, assuming a Unicode +(\s-1UTF\-8\s0) locale, but the results could well be wrong except if the locale +happens to be \s-1ISO\-8859\-1\s0 (Latin1) where this message is spurious and can +be ignored. +.Sp +The warnings category \f(CW\*(C`locale\*(C'\fR is new. +.IP "\(bu" 4 +Using /u for '%s' instead of /%s in regex; marked by <\-\- \s-1HERE\s0 in m/%s/ +.Sp +(W regexp) You used a Unicode boundary (\f(CW\*(C`\eb{...}\*(C'\fR or \f(CW\*(C`\eB{...}\*(C'\fR) in a +portion of a regular expression where the character set modifiers \f(CW\*(C`/a\*(C'\fR +or \f(CW\*(C`/aa\*(C'\fR are in effect. These two modifiers indicate an \s-1ASCII\s0 +interpretation, and this doesn't make sense for a Unicode definition. +The generated regular expression will compile so that the boundary uses +all of Unicode. No other portion of the regular expression is affected. +.IP "\(bu" 4 +The bitwise feature is experimental +.Sp +(S experimental::bitwise) This warning is emitted if you use bitwise +operators (\f(CW\*(C`& | ^ ~ &. |. ^. ~.\*(C'\fR) with the \*(L"bitwise\*(R" feature enabled. +Simply suppress the warning if you want to use the feature, but know +that in doing so you are taking the risk of using an experimental +feature which may change or be removed in a future Perl version: +.Sp +.Vb 3 +\& no warnings "experimental::bitwise"; +\& use feature "bitwise"; +\& $x |.= $y; +.Ve +.IP "\(bu" 4 +Unescaped left brace in regex is deprecated, passed through in regex; marked by <\-\- \s-1HERE\s0 in m/%s/ +.Sp +(D deprecated, regexp) You used a literal \f(CW"{"\fR character in a regular +expression pattern. You should change to use \f(CW"\e{"\fR instead, because a future +version of Perl (tentatively v5.26) will consider this to be a syntax error. If +the pattern delimiters are also braces, any matching right brace +(\f(CW"}"\fR) should also be escaped to avoid confusing the parser, for +example, +.Sp +.Vb 1 +\& qr{abc\e{def\e}ghi} +.Ve +.IP "\(bu" 4 +Use of literal non-graphic characters in variable names is deprecated +.Sp +(D deprecated) Using literal non-graphic (including control) +characters in the source to refer to the \fI^FOO\fR variables, like \f(CW$^X\fR and +\&\f(CW\*(C`${^GLOBAL_PHASE}\*(C'\fR is now deprecated. +.IP "\(bu" 4 +Useless use of attribute \*(L"const\*(R" +.Sp +(W misc) The \f(CW\*(C`const\*(C'\fR attribute has no effect except +on anonymous closure prototypes. You applied it to +a subroutine via attributes.pm. This is only useful +inside an attribute handler for an anonymous subroutine. +.IP "\(bu" 4 +Useless use of /d modifier in transliteration operator +.Sp +This is not a new diagnostic, but in earlier releases was accidentally +not displayed if the transliteration contained wide characters. This is +now fixed, so that you may see this diagnostic in places where you +previously didn't (but should have). +.IP "\(bu" 4 +\&\*(L"use re 'strict'\*(R" is experimental +.Sp +(S experimental::re_strict) The things that are different when a regular +expression pattern is compiled under \f(CW\*(Aqstrict\*(Aq\fR are subject to change +in future Perl releases in incompatible ways; there are also proposals +to change how to enable strict checking instead of using this subpragma. +This means that a pattern that compiles today may not in a future Perl +release. This warning is to alert you to that risk. +.IP "\(bu" 4 +Warning: unable to close filehandle properly: \f(CW%s\fR +.Sp +Warning: unable to close filehandle \f(CW%s\fR properly: \f(CW%s\fR +.Sp +(S io) Previously, perl silently ignored any errors when doing an implicit +close of a filehandle, \fIi.e.\fR where the reference count of the filehandle +reached zero and the user's code hadn't already called \f(CW\*(C`close()\*(C'\fR; \fIe.g.\fR +.Sp +.Vb 4 +\& { +\& open my $fh, \*(Aq>\*(Aq, $file or die "open: \*(Aq$file\*(Aq: $!\en"; +\& print $fh, $data or die; +\& } # implicit close here +.Ve +.Sp +In a situation such as disk full, due to buffering, the error may only be +detected during the final close, so not checking the result of the close is +dangerous. +.Sp +So perl now warns in such situations. +.IP "\(bu" 4 +Wide character (U+%X) in \f(CW%s\fR +.Sp +(W locale) While in a single-byte locale (\fIi.e.\fR, a non\-UTF\-8 +one), a multi-byte character was encountered. Perl considers this +character to be the specified Unicode code point. Combining non\-UTF\-8 +locales and Unicode is dangerous. Almost certainly some characters +will have two different representations. For example, in the \s-1ISO 8859\-7\s0 +(Greek) locale, the code point 0xC3 represents a Capital Gamma. But so +also does 0x393. This will make string comparisons unreliable. +.Sp +You likely need to figure out how this multi-byte character got mixed up +with your single-byte locale (or perhaps you thought you had a \s-1UTF\-8\s0 +locale, but Perl disagrees). +.Sp +The warnings category \f(CW\*(C`locale\*(C'\fR is new. +.SS "Changes to Existing Diagnostics" +.IX Subsection "Changes to Existing Diagnostics" +.IP "\(bu" 4 +<> should be quotes +.Sp +This warning has been changed to +<> at require-statement should be quotes +to make the issue more identifiable. +.IP "\(bu" 4 +Argument \*(L"%s\*(R" isn't numeric%s +.Sp +The perldiag entry for this warning has added this clarifying note: +.Sp +.Vb 4 +\& Note that for the Inf and NaN (infinity and not\-a\-number) the +\& definition of "numeric" is somewhat unusual: the strings themselves +\& (like "Inf") are considered numeric, and anything following them is +\& considered non\-numeric. +.Ve +.IP "\(bu" 4 +Global symbol \*(L"%s\*(R" requires explicit package name +.Sp +This message has had '(did you forget to declare \*(L"my \f(CW%s\fR\*(R"?)' appended to it, to +make it more helpful to new Perl programmers. +[perl #121638] +.IP "\(bu" 4 +\&'\*(L"my\*(R" variable &foo::bar can't be in a package' has been reworded to say +\&'subroutine' instead of 'variable'. +.IP "\(bu" 4 +\&\eN{} in character class restricted to one character in regex; marked by +<\-\-\ \s-1HERE\s0 in m/%s/ +.Sp +This message has had \fIcharacter class\fR changed to \fIinverted character +class or as a range end-point is\fR to reflect improvements in +\&\f(CW\*(C`qr/[\eN{named sequence}]/\*(C'\fR (see under \*(L"Selected Bug Fixes\*(R"). +.IP "\(bu" 4 +panic: frexp +.Sp +This message has had ': \f(CW%f\fR' appended to it, to show what the offending +floating point number is. +.IP "\(bu" 4 +\&\fIPossible precedence problem on bitwise \f(CI%c\fI operator\fR reworded as +Possible precedence problem on bitwise \f(CW%s\fR operator. +.IP "\(bu" 4 +Unsuccessful \f(CW%s\fR on filename containing newline +.Sp +This warning is now only produced when the newline is at the end of +the filename. +.IP "\(bu" 4 +"Variable \f(CW%s\fR will not stay shared\*(L" has been changed to say \*(R"Subroutine" +when it is actually a lexical sub that will not stay shared. +.IP "\(bu" 4 +Variable length lookbehind not implemented in regex m/%s/ +.Sp +The perldiag entry for this warning has had information about Unicode +behavior added. +.SS "Diagnostic Removals" +.IX Subsection "Diagnostic Removals" +.IP "\(bu" 4 +\&\*(L"Ambiguous use of \-foo resolved as \-&\fBfoo()\fR\*(R" +.Sp +There is actually no ambiguity here, and this impedes the use of negated +constants; \fIe.g.\fR, \f(CW\*(C`\-Inf\*(C'\fR. +.IP "\(bu" 4 +\&\*(L"Constant is not a \s-1FOO\s0 reference\*(R" +.Sp +Compile-time checking of constant dereferencing (\fIe.g.\fR, \f(CW\*(C`my_constant\->()\*(C'\fR) +has been removed, since it was not taking overloading into account. +[perl #69456] +[perl #122607] +.SH "Utility Changes" +.IX Header "Utility Changes" +.SS "\fIfind2perl\fP, \fIs2p\fP and \fIa2p\fP removal" +.IX Subsection "find2perl, s2p and a2p removal" +.IP "\(bu" 4 +The \fIx2p/\fR directory has been removed from the Perl core. +.Sp +This removes find2perl, s2p and a2p. They have all been released to \s-1CPAN\s0 as +separate distributions (\f(CW\*(C`App::find2perl\*(C'\fR, \f(CW\*(C`App::s2p\*(C'\fR, \f(CW\*(C`App::a2p\*(C'\fR). +.SS "h2ph" +.IX Subsection "h2ph" +.IP "\(bu" 4 +\&\fIh2ph\fR now handles hexadecimal constants in the compiler's predefined +macro definitions, as visible in \f(CW$Config{cppsymbols}\fR. +[perl #123784] . +.SS "encguess" +.IX Subsection "encguess" +.IP "\(bu" 4 +No longer depends on non-core modules. +.SH "Configuration and Compilation" +.IX Header "Configuration and Compilation" +.IP "\(bu" 4 +\&\fIConfigure\fR now checks for \f(CW\*(C`lrintl()\*(C'\fR, \f(CW\*(C`lroundl()\*(C'\fR, \f(CW\*(C`llrintl()\*(C'\fR, and +\&\f(CW\*(C`llroundl()\*(C'\fR. +.IP "\(bu" 4 +\&\fIConfigure\fR with \f(CW\*(C`\-Dmksymlinks\*(C'\fR should now be faster. +[perl #122002] . +.IP "\(bu" 4 +The \f(CW\*(C`pthreads\*(C'\fR and \f(CW\*(C`cl\*(C'\fR libraries will be linked by default if present. +This allows \s-1XS\s0 modules that require threading to work on non-threaded +perls. Note that you must still pass \f(CW\*(C`\-Dusethreads\*(C'\fR if you want a +threaded perl. +.IP "\(bu" 4 +To get more precision and range for floating point numbers one can now +use the \s-1GCC\s0 quadmath library which implements the quadruple precision +floating point numbers on x86 and \s-1IA\-64\s0 platforms. See \fI\s-1INSTALL\s0\fR for +details. +.IP "\(bu" 4 +MurmurHash64A and MurmurHash64B can now be configured as the internal hash +function. +.IP "\(bu" 4 +\&\f(CW\*(C`make test.valgrind\*(C'\fR now supports parallel testing. +.Sp +For example: +.Sp +.Vb 1 +\& TEST_JOBS=9 make test.valgrind +.Ve +.Sp +See \*(L"valgrind\*(R" in perlhacktips for more information. +.Sp +[perl #121431] +.IP "\(bu" 4 +The \s-1MAD\s0 (Misc Attribute Decoration) build option has been removed +.Sp +This was an unmaintained attempt at preserving +the Perl parse tree more faithfully so that automatic conversion of +Perl 5 to Perl 6 would have been easier. +.Sp +This build-time configuration option had been unmaintained for years, +and had probably seriously diverged on both Perl 5 and Perl 6 sides. +.IP "\(bu" 4 +A new compilation flag, \f(CW\*(C`\-DPERL_OP_PARENT\*(C'\fR is available. For details, +see the discussion below at \*(L"Internal Changes\*(R". +.IP "\(bu" 4 +Pathtools no longer tries to load \s-1XS\s0 on miniperl. This speeds up building perl +slightly. +.SH "Testing" +.IX Header "Testing" +.IP "\(bu" 4 +\&\fIt/porting/re_context.t\fR has been added to test that utf8 and its +dependencies only use the subset of the \f(CW\*(C`$1..$n\*(C'\fR capture vars that +\&\f(CW\*(C`Perl_save_re_context()\*(C'\fR is hard-coded to localize, because that function +has no efficient way of determining at runtime what vars to localize. +.IP "\(bu" 4 +Tests for performance issues have been added in the file \fIt/perf/taint.t\fR. +.IP "\(bu" 4 +Some regular expression tests are written in such a way that they will +run very slowly if certain optimizations break. These tests have been +moved into new files, \fIt/re/speed.t\fR and \fIt/re/speed_thr.t\fR, +and are run with a \f(CW\*(C`watchdog()\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`test.pl\*(C'\fR now allows \f(CW\*(C`plan skip_all => $reason\*(C'\fR, to make it +more compatible with \f(CW\*(C`Test::More\*(C'\fR. +.IP "\(bu" 4 +A new test script, \fIop/infnan.t\fR, has been added to test if infinity and NaN are +working correctly. See \*(L"Infinity and NaN (not-a-number) handling improved\*(R". +.SH "Platform Support" +.IX Header "Platform Support" +.SS "Regained Platforms" +.IX Subsection "Regained Platforms" +.IP "\s-1IRIX\s0 and Tru64 platforms are working again." 4 +.IX Item "IRIX and Tru64 platforms are working again." +Some \f(CW\*(C`make test\*(C'\fR failures remain: +[perl #123977] +and [perl #125298] +for \s-1IRIX\s0; [perl #124212] , +[cpan #99605] , and +[cpan #104836] for Tru64. +.IP "z/OS running \s-1EBCDIC\s0 Code Page 1047" 4 +.IX Item "z/OS running EBCDIC Code Page 1047" +Core perl now works on this \s-1EBCDIC\s0 platform. Earlier perls also worked, but, +even though support wasn't officially withdrawn, recent perls would not compile +and run well. Perl 5.20 would work, but had many bugs which have now been +fixed. Many \s-1CPAN\s0 modules that ship with Perl still fail tests, including +\&\f(CW\*(C`Pod::Simple\*(C'\fR. However the version of \f(CW\*(C`Pod::Simple\*(C'\fR currently on \s-1CPAN\s0 should work; +it was fixed too late to include in Perl 5.22. Work is under way to fix many +of the still-broken \s-1CPAN\s0 modules, which likely will be installed on \s-1CPAN\s0 when +completed, so that you may not have to wait until Perl 5.24 to get a working +version. +.SS "Discontinued Platforms" +.IX Subsection "Discontinued Platforms" +.IP "NeXTSTEP/OPENSTEP" 4 +.IX Item "NeXTSTEP/OPENSTEP" +NeXTSTEP was a proprietary operating system bundled with NeXT's +workstations in the early to mid 90s; \s-1OPENSTEP\s0 was an \s-1API\s0 specification +that provided a NeXTSTEP-like environment on a non-NeXTSTEP system. Both +are now long dead, so support for building Perl on them has been removed. +.SS "Platform-Specific Notes" +.IX Subsection "Platform-Specific Notes" +.IP "\s-1EBCDIC\s0" 4 +.IX Item "EBCDIC" +Special handling is required of the perl interpreter on \s-1EBCDIC\s0 platforms +to get \f(CW\*(C`qr/[i\-j]/\*(C'\fR to match only \f(CW"i"\fR and \f(CW"j"\fR, since there are 7 +characters between the +code points for \f(CW"i"\fR and \f(CW"j"\fR. This special handling had only been +invoked when both ends of the range are literals. Now it is also +invoked if any of the \f(CW\*(C`\eN{...}\*(C'\fR forms for specifying a character by +name or Unicode code point is used instead of a literal. See +\&\*(L"Character Ranges\*(R" in perlrecharclass. +.IP "HP-UX" 4 +.IX Item "HP-UX" +The archname now distinguishes use64bitint from use64bitall. +.IP "Android" 4 +.IX Item "Android" +Build support has been improved for cross-compiling in general and for +Android in particular. +.IP "\s-1VMS\s0" 4 +.IX Item "VMS" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +When spawning a subprocess without waiting, the return value is now +the correct \s-1PID.\s0 +.IP "\(bu" 4 +Fix a prototype so linking doesn't fail under the \s-1VMS \*(C+\s0 compiler. +.IP "\(bu" 4 +\&\f(CW\*(C`finite\*(C'\fR, \f(CW\*(C`finitel\*(C'\fR, and \f(CW\*(C`isfinite\*(C'\fR detection has been added to +\&\f(CW\*(C`configure.com\*(C'\fR, environment handling has had some minor changes, and +a fix for legacy feature checking status. +.RE +.RS 4 +.RE +.IP "Win32" 4 +.IX Item "Win32" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +\&\fIminiperl.exe\fR is now built with \f(CW\*(C`\-fno\-strict\-aliasing\*(C'\fR, allowing 64\-bit +builds to complete on \s-1GCC 4.8.\s0 +[perl #123976] +.IP "\(bu" 4 +\&\f(CW\*(C`nmake minitest\*(C'\fR now works on Win32. Due to dependency issues you +need to build \f(CW\*(C`nmake test\-prep\*(C'\fR first, and a small number of the +tests fail. +[perl #123394] +.IP "\(bu" 4 +Perl can now be built in \*(C+ mode on Windows by setting the makefile macro +\&\f(CW\*(C`USE_CPLUSPLUS\*(C'\fR to the value \*(L"define\*(R". +.IP "\(bu" 4 +The list form of piped open has been implemented for Win32. Note: unlike +\&\f(CW\*(C`system LIST\*(C'\fR this does not fall back to the shell. +[perl #121159] +.IP "\(bu" 4 +New \f(CW\*(C`DebugSymbols\*(C'\fR and \f(CW\*(C`DebugFull\*(C'\fR configuration options added to +Windows makefiles. +.IP "\(bu" 4 +Previously, compiling \s-1XS\s0 modules (including \s-1CPAN\s0 ones) using Visual \*(C+ for +Win64 resulted in around a dozen warnings per file from \fIhv_func.h\fR. These +warnings have been silenced. +.IP "\(bu" 4 +Support for building without PerlIO has been removed from the Windows +makefiles. Non-PerlIO builds were all but deprecated in Perl 5.18.0 and are +already not supported by \fIConfigure\fR on \s-1POSIX\s0 systems. +.IP "\(bu" 4 +Between 2 and 6 milliseconds and seven I/O calls have been saved per attempt +to open a perl module for each path in \f(CW@INC\fR. +.IP "\(bu" 4 +Intel C builds are now always built with C99 mode on. +.IP "\(bu" 4 +\&\f(CW%I64d\fR is now being used instead of \f(CW%lld\fR for MinGW. +.IP "\(bu" 4 +In the experimental \f(CW\*(C`:win32\*(C'\fR layer, a crash in \f(CW\*(C`open\*(C'\fR was fixed. Also +opening \fI/dev/null\fR (which works under Win32 Perl's default \f(CW\*(C`:unix\*(C'\fR +layer) was implemented for \f(CW\*(C`:win32\*(C'\fR. +[perl #122224] +.IP "\(bu" 4 +A new makefile option, \f(CW\*(C`USE_LONG_DOUBLE\*(C'\fR, has been added to the Windows +dmake makefile for gcc builds only. Set this to \*(L"define\*(R" if you want perl to +use long doubles to give more accuracy and range for floating point numbers. +.RE +.RS 4 +.RE +.IP "OpenBSD" 4 +.IX Item "OpenBSD" +On OpenBSD, Perl will now default to using the system \f(CW\*(C`malloc\*(C'\fR due to the +security features it provides. Perl's own malloc wrapper has been in use +since v5.14 due to performance reasons, but the OpenBSD project believes +the tradeoff is worth it and would prefer that users who need the speed +specifically ask for it. +.Sp +[perl #122000] . +.IP "Solaris" 4 +.IX Item "Solaris" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +We now look for the Sun Studio compiler in both \fI/opt/solstudio*\fR and +\&\fI/opt/solarisstudio*\fR. +.IP "\(bu" 4 +Builds on Solaris 10 with \f(CW\*(C`\-Dusedtrace\*(C'\fR would fail early since make +didn't follow implied dependencies to build \f(CW\*(C`perldtrace.h\*(C'\fR. Added an +explicit dependency to \f(CW\*(C`depend\*(C'\fR. +[perl #120120] +.IP "\(bu" 4 +C99 options have been cleaned up; hints look for \f(CW\*(C`solstudio\*(C'\fR +as well as \f(CW\*(C`SUNWspro\*(C'\fR; and support for native \f(CW\*(C`setenv\*(C'\fR has been added. +.RE +.RS 4 +.RE +.SH "Internal Changes" +.IX Header "Internal Changes" +.IP "\(bu" 4 +Experimental support has been added to allow ops in the optree to locate +their parent, if any. This is enabled by the non-default build option +\&\f(CW\*(C`\-DPERL_OP_PARENT\*(C'\fR. It is envisaged that this will eventually become +enabled by default, so \s-1XS\s0 code which directly accesses the \f(CW\*(C`op_sibling\*(C'\fR +field of ops should be updated to be future-proofed. +.Sp +On \f(CW\*(C`PERL_OP_PARENT\*(C'\fR builds, the \f(CW\*(C`op_sibling\*(C'\fR field has been renamed +\&\f(CW\*(C`op_sibparent\*(C'\fR and a new flag, \f(CW\*(C`op_moresib\*(C'\fR, added. On the last op in a +sibling chain, \f(CW\*(C`op_moresib\*(C'\fR is false and \f(CW\*(C`op_sibparent\*(C'\fR points to the +parent (if any) rather than being \f(CW\*(C`NULL\*(C'\fR. +.Sp +To make existing code work transparently whether using \f(CW\*(C`PERL_OP_PARENT\*(C'\fR +or not, a number of new macros and functions have been added that should +be used, rather than directly manipulating \f(CW\*(C`op_sibling\*(C'\fR. +.Sp +For the case of just reading \f(CW\*(C`op_sibling\*(C'\fR to determine the next sibling, +two new macros have been added. A simple scan through a sibling chain +like this: +.Sp +.Vb 1 +\& for (; kid\->op_sibling; kid = kid\->op_sibling) { ... } +.Ve +.Sp +should now be written as: +.Sp +.Vb 1 +\& for (; OpHAS_SIBLING(kid); kid = OpSIBLING(kid)) { ... } +.Ve +.Sp +For altering optrees, a general-purpose function \f(CW\*(C`op_sibling_splice()\*(C'\fR +has been added, which allows for manipulation of a chain of sibling ops. +By analogy with the Perl function \f(CW\*(C`splice()\*(C'\fR, it allows you to cut out +zero or more ops from a sibling chain and replace them with zero or more +new ops. It transparently handles all the updating of sibling, parent, +op_last pointers etc. +.Sp +If you need to manipulate ops at a lower level, then three new macros, +\&\f(CW\*(C`OpMORESIB_set\*(C'\fR, \f(CW\*(C`OpLASTSIB_set\*(C'\fR and \f(CW\*(C`OpMAYBESIB_set\*(C'\fR are intended to +be a low-level portable way to set \f(CW\*(C`op_sibling\*(C'\fR / \f(CW\*(C`op_sibparent\*(C'\fR while +also updating \f(CW\*(C`op_moresib\*(C'\fR. The first sets the sibling pointer to a new +sibling, the second makes the op the last sibling, and the third +conditionally does the first or second action. Note that unlike +\&\f(CW\*(C`op_sibling_splice()\*(C'\fR these macros won't maintain consistency in the +parent at the same time (\fIe.g.\fR by updating \f(CW\*(C`op_first\*(C'\fR and \f(CW\*(C`op_last\*(C'\fR where +appropriate). +.Sp +A C\-level \f(CW\*(C`Perl_op_parent()\*(C'\fR function and a Perl-level \f(CW\*(C`B::OP::parent()\*(C'\fR +method have been added. The C function only exists under +\&\f(CW\*(C`PERL_OP_PARENT\*(C'\fR builds (using it is build-time error on vanilla +perls). \f(CW\*(C`B::OP::parent()\*(C'\fR exists always, but on a vanilla build it +always returns \f(CW\*(C`NULL\*(C'\fR. Under \f(CW\*(C`PERL_OP_PARENT\*(C'\fR, they return the parent +of the current op, if any. The variable \f(CW$B::OP::does_parent\fR allows you +to determine whether \f(CW\*(C`B\*(C'\fR supports retrieving an op's parent. +.Sp +\&\f(CW\*(C`PERL_OP_PARENT\*(C'\fR was introduced in 5.21.2, but the interface was +changed considerably in 5.21.11. If you updated your code before the +5.21.11 changes, it may require further revision. The main changes after +5.21.2 were: +.RS 4 +.IP "\(bu" 4 +The \f(CW\*(C`OP_SIBLING\*(C'\fR and \f(CW\*(C`OP_HAS_SIBLING\*(C'\fR macros have been renamed +\&\f(CW\*(C`OpSIBLING\*(C'\fR and \f(CW\*(C`OpHAS_SIBLING\*(C'\fR for consistency with other +op-manipulating macros. +.IP "\(bu" 4 +The \f(CW\*(C`op_lastsib\*(C'\fR field has been renamed \f(CW\*(C`op_moresib\*(C'\fR, and its meaning +inverted. +.IP "\(bu" 4 +The macro \f(CW\*(C`OpSIBLING_set\*(C'\fR has been removed, and has been superseded by +\&\f(CW\*(C`OpMORESIB_set\*(C'\fR \fIet al\fR. +.IP "\(bu" 4 +The \f(CW\*(C`op_sibling_splice()\*(C'\fR function now accepts a null \f(CW\*(C`parent\*(C'\fR argument +where the splicing doesn't affect the first or last ops in the sibling +chain +.RE +.RS 4 +.RE +.IP "\(bu" 4 +Macros have been created to allow \s-1XS\s0 code to better manipulate the \s-1POSIX\s0 locale +category \f(CW\*(C`LC_NUMERIC\*(C'\fR. See \*(L"Locale-related functions and macros\*(R" in perlapi. +.IP "\(bu" 4 +The previous \f(CW\*(C`atoi\*(C'\fR \fIet al\fR replacement function, \f(CW\*(C`grok_atou\*(C'\fR, has now been +superseded by \f(CW\*(C`grok_atoUV\*(C'\fR. See perlclib for details. +.IP "\(bu" 4 +A new function, \f(CW\*(C`Perl_sv_get_backrefs()\*(C'\fR, has been added which allows you +retrieve the weak references, if any, which point at an \s-1SV.\s0 +.IP "\(bu" 4 +The \f(CW\*(C`screaminstr()\*(C'\fR function has been removed. Although marked as +public \s-1API,\s0 it was undocumented and had no usage in \s-1CPAN\s0 modules. Calling +it has been fatal since 5.17.0. +.IP "\(bu" 4 +The \f(CW\*(C`newDEFSVOP()\*(C'\fR, \f(CW\*(C`block_start()\*(C'\fR, \f(CW\*(C`block_end()\*(C'\fR and \f(CW\*(C`intro_my()\*(C'\fR +functions have been added to the \s-1API.\s0 +.IP "\(bu" 4 +The internal \f(CW\*(C`convert\*(C'\fR function in \fIop.c\fR has been renamed +\&\f(CW\*(C`op_convert_list\*(C'\fR and added to the \s-1API.\s0 +.IP "\(bu" 4 +The \f(CW\*(C`sv_magic()\*(C'\fR function no longer forbids \*(L"ext\*(R" magic on read-only +values. After all, perl can't know whether the custom magic will modify +the \s-1SV\s0 or not. +[perl #123103] . +.IP "\(bu" 4 +Accessing \*(L"CvPADLIST\*(R" in perlapi on an \s-1XSUB\s0 is now forbidden. +.Sp +The \f(CW\*(C`CvPADLIST\*(C'\fR field has been reused for a different internal purpose +for XSUBs. So in particular, you can no longer rely on it being \s-1NULL\s0 as a +test of whether a \s-1CV\s0 is an \s-1XSUB.\s0 Use \f(CW\*(C`CvISXSUB()\*(C'\fR instead. +.IP "\(bu" 4 +SVs of type \f(CW\*(C`SVt_NV\*(C'\fR are now sometimes bodiless when the build +configuration and platform allow it: specifically, when \f(CW\*(C`sizeof(NV) <= +sizeof(IV)\*(C'\fR. \*(L"Bodiless\*(R" means that the \s-1NV\s0 value is stored directly in +the head of an \s-1SV,\s0 without requiring a separate body to be allocated. This +trick has already been used for IVs since 5.9.2 (though in the case of +IVs, it is always used, regardless of platform and build configuration). +.IP "\(bu" 4 +The \f(CW$DB::single\fR, \f(CW$DB::signal\fR and \f(CW$DB::trace\fR variables now have set\- and +get-magic that stores their values as IVs, and those IVs are used when +testing their values in \f(CW\*(C`pp_dbstate()\*(C'\fR. This prevents perl from +recursing infinitely if an overloaded object is assigned to any of those +variables. +[perl #122445] . +.IP "\(bu" 4 +\&\f(CW\*(C`Perl_tmps_grow()\*(C'\fR, which is marked as public \s-1API\s0 but is undocumented, has +been removed from the public \s-1API.\s0 This change does not affect \s-1XS\s0 code that +uses the \f(CW\*(C`EXTEND_MORTAL\*(C'\fR macro to pre-extend the mortal stack. +.IP "\(bu" 4 +Perl's internals no longer sets or uses the \f(CW\*(C`SVs_PADMY\*(C'\fR flag. +\&\f(CW\*(C`SvPADMY()\*(C'\fR now returns a true value for anything not marked \f(CW\*(C`PADTMP\*(C'\fR +and \f(CW\*(C`SVs_PADMY\*(C'\fR is now defined as 0. +.IP "\(bu" 4 +The macros \f(CW\*(C`SETsv\*(C'\fR and \f(CW\*(C`SETsvUN\*(C'\fR have been removed. They were no longer used +in the core since commit 6f1401dc2a five years ago, and have not been +found present on \s-1CPAN.\s0 +.IP "\(bu" 4 +The \f(CW\*(C`SvFAKE\*(C'\fR bit (unused on HVs) got informally reserved by +David Mitchell for future work on vtables. +.IP "\(bu" 4 +The \f(CW\*(C`sv_catpvn_flags()\*(C'\fR function accepts \f(CW\*(C`SV_CATBYTES\*(C'\fR and \f(CW\*(C`SV_CATUTF8\*(C'\fR +flags, which specify whether the appended string is bytes or \s-1UTF\-8,\s0 +respectively. (These flags have in fact been present since 5.16.0, but +were formerly not regarded as part of the \s-1API.\s0) +.IP "\(bu" 4 +A new opcode class, \f(CW\*(C`METHOP\*(C'\fR, has been introduced. It holds +information used at runtime to improve the performance +of class/object method calls. +.Sp +\&\f(CW\*(C`OP_METHOD\*(C'\fR and \f(CW\*(C`OP_METHOD_NAMED\*(C'\fR have changed from being +\&\f(CW\*(C`UNOP/SVOP\*(C'\fR to being \f(CW\*(C`METHOP\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`cv_name()\*(C'\fR is a new \s-1API\s0 function that can be passed a \s-1CV\s0 or \s-1GV.\s0 It +returns an \s-1SV\s0 containing the name of the subroutine, for use in +diagnostics. +.Sp +[perl #116735] +[perl #120441] +.IP "\(bu" 4 +\&\f(CW\*(C`cv_set_call_checker_flags()\*(C'\fR is a new \s-1API\s0 function that works like +\&\f(CW\*(C`cv_set_call_checker()\*(C'\fR, except that it allows the caller to specify +whether the call checker requires a full \s-1GV\s0 for reporting the subroutine's +name, or whether it could be passed a \s-1CV\s0 instead. Whatever value is +passed will be acceptable to \f(CW\*(C`cv_name()\*(C'\fR. \f(CW\*(C`cv_set_call_checker()\*(C'\fR +guarantees there will be a \s-1GV,\s0 but it may have to create one on the fly, +which is inefficient. +[perl #116735] +.IP "\(bu" 4 +\&\f(CW\*(C`CvGV\*(C'\fR (which is not part of the \s-1API\s0) is now a more complex macro, which may +call a function and reify a \s-1GV.\s0 For those cases where it has been used as a +boolean, \f(CW\*(C`CvHASGV\*(C'\fR has been added, which will return true for CVs that +notionally have GVs, but without reifying the \s-1GV.\s0 \f(CW\*(C`CvGV\*(C'\fR also returns a \s-1GV\s0 +now for lexical subs. +[perl #120441] +.IP "\(bu" 4 +The \*(L"sync_locale\*(R" in perlapi function has been added to the public \s-1API.\s0 +Changing the program's locale should be avoided by \s-1XS\s0 code. Nevertheless, +certain non-Perl libraries called from \s-1XS\s0 need to do so, such as \f(CW\*(C`Gtk\*(C'\fR. +When this happens, Perl needs to be told that the locale has +changed. Use this function to do so, before returning to Perl. +.IP "\(bu" 4 +The defines and labels for the flags in the \f(CW\*(C`op_private\*(C'\fR field of OPs are now +auto-generated from data in \fIregen/op_private\fR. The noticeable effect of this +is that some of the flag output of \f(CW\*(C`Concise\*(C'\fR might differ slightly, and the +flag output of \f(CW\*(C`perl\ \-Dx\*(C'\fR may differ considerably (they both use the same set +of labels now). Also, debugging builds now have a new assertion in +\&\f(CW\*(C`op_free()\*(C'\fR to ensure that the op doesn't have any unrecognized flags set in +\&\f(CW\*(C`op_private\*(C'\fR. +.IP "\(bu" 4 +The deprecated variable \f(CW\*(C`PL_sv_objcount\*(C'\fR has been removed. +.IP "\(bu" 4 +Perl now tries to keep the locale category \f(CW\*(C`LC_NUMERIC\*(C'\fR set to \*(L"C\*(R" +except around operations that need it to be set to the program's +underlying locale. This protects the many \s-1XS\s0 modules that cannot cope +with the decimal radix character not being a dot. Prior to this +release, Perl initialized this category to \*(L"C\*(R", but a call to +\&\f(CW\*(C`POSIX::setlocale()\*(C'\fR would change it. Now such a call will change the +underlying locale of the \f(CW\*(C`LC_NUMERIC\*(C'\fR category for the program, but the +locale exposed to \s-1XS\s0 code will remain \*(L"C\*(R". There are new macros +to manipulate the \s-1LC_NUMERIC\s0 locale, including +\&\f(CW\*(C`STORE_LC_NUMERIC_SET_TO_NEEDED\*(C'\fR and +\&\f(CW\*(C`STORE_LC_NUMERIC_FORCE_TO_UNDERLYING\*(C'\fR. +See \*(L"Locale-related functions and macros\*(R" in perlapi. +.IP "\(bu" 4 +A new macro \f(CW\*(C`isUTF8_CHAR\*(C'\fR has been written which +efficiently determines if the string given by its parameters begins +with a well-formed \s-1UTF\-8\s0 encoded character. +.IP "\(bu" 4 +The following private \s-1API\s0 functions had their context parameter removed: +\&\f(CW\*(C`Perl_cast_ulong\*(C'\fR, \f(CW\*(C`Perl_cast_i32\*(C'\fR, \f(CW\*(C`Perl_cast_iv\*(C'\fR, \f(CW\*(C`Perl_cast_uv\*(C'\fR, +\&\f(CW\*(C`Perl_cv_const_sv\*(C'\fR, \f(CW\*(C`Perl_mg_find\*(C'\fR, \f(CW\*(C`Perl_mg_findext\*(C'\fR, \f(CW\*(C`Perl_mg_magical\*(C'\fR, +\&\f(CW\*(C`Perl_mini_mktime\*(C'\fR, \f(CW\*(C`Perl_my_dirfd\*(C'\fR, \f(CW\*(C`Perl_sv_backoff\*(C'\fR, \f(CW\*(C`Perl_utf8_hop\*(C'\fR. +.Sp +Note that the prefix-less versions of those functions that are part of the +public \s-1API,\s0 such as \f(CW\*(C`cast_i32()\*(C'\fR, remain unaffected. +.IP "\(bu" 4 +The \f(CW\*(C`PADNAME\*(C'\fR and \f(CW\*(C`PADNAMELIST\*(C'\fR types are now separate types, and no +longer simply aliases for \s-1SV\s0 and \s-1AV.\s0 +[perl #123223] . +.IP "\(bu" 4 +Pad names are now always \s-1UTF\-8.\s0 The \f(CW\*(C`PadnameUTF8\*(C'\fR macro always returns +true. Previously, this was effectively the case already, but any support +for two different internal representations of pad names has now been +removed. +.IP "\(bu" 4 +A new op class, \f(CW\*(C`UNOP_AUX\*(C'\fR, has been added. This is a subclass of +\&\f(CW\*(C`UNOP\*(C'\fR with an \f(CW\*(C`op_aux\*(C'\fR field added, which points to an array of unions +of \s-1UV,\s0 SV* etc. It is intended for where an op needs to store more data +than a simple \f(CW\*(C`op_sv\*(C'\fR or whatever. Currently the only op of this type is +\&\f(CW\*(C`OP_MULTIDEREF\*(C'\fR (see next item). +.IP "\(bu" 4 +A new op has been added, \f(CW\*(C`OP_MULTIDEREF\*(C'\fR, which performs one or more +nested array and hash lookups where the key is a constant or simple +variable. For example the expression \f(CW$a[0]{$k}[$i]\fR, which previously +involved ten \f(CW\*(C`rv2Xv\*(C'\fR, \f(CW\*(C`Xelem\*(C'\fR, \f(CW\*(C`gvsv\*(C'\fR and \f(CW\*(C`const\*(C'\fR ops is now performed +by a single \f(CW\*(C`multideref\*(C'\fR op. It can also handle \f(CW\*(C`local\*(C'\fR, \f(CW\*(C`exists\*(C'\fR and +\&\f(CW\*(C`delete\*(C'\fR. A non-simple index expression, such as \f(CW\*(C`[$i+1]\*(C'\fR is still done +using \f(CW\*(C`aelem\*(C'\fR/\f(CW\*(C`helem\*(C'\fR, and single-level array lookup with a small constant +index is still done using \f(CW\*(C`aelemfast\*(C'\fR. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +\&\f(CW\*(C`close\*(C'\fR now sets \f(CW$!\fR +.Sp +When an I/O error occurs, the fact that there has been an error is recorded +in the handle. \f(CW\*(C`close\*(C'\fR returns false for such a handle. Previously, the +value of \f(CW$!\fR would be untouched by \f(CW\*(C`close\*(C'\fR, so the common convention of +writing \f(CW\*(C`close\ $fh\ or\ die\ $!\*(C'\fR did not work reliably. Now the handle +records the value of \f(CW$!\fR, too, and \f(CW\*(C`close\*(C'\fR restores it. +.IP "\(bu" 4 +\&\f(CW\*(C`no re\*(C'\fR now can turn off everything that \f(CW\*(C`use re\*(C'\fR enables +.Sp +Previously, running \f(CW\*(C`no re\*(C'\fR would turn off only a few things. Now it +can turn off all the enabled things. For example, the only way to +stop debugging, once enabled, was to exit the enclosing block; that is +now fixed. +.IP "\(bu" 4 +\&\f(CW\*(C`pack("D", $x)\*(C'\fR and \f(CW\*(C`pack("F", $x)\*(C'\fR now zero the padding on x86 long +double builds. Under some build options on \s-1GCC 4.8\s0 and later, they used +to either overwrite the zero-initialized padding, or bypass the +initialized buffer entirely. This caused \fIop/pack.t\fR to fail. +[perl #123971] +.IP "\(bu" 4 +Extending an array cloned from a parent thread could result in \*(L"Modification of +a read-only value attempted\*(R" errors when attempting to modify the new elements. +[perl #124127] +.IP "\(bu" 4 +An assertion failure and subsequent crash with \f(CW\*(C`*x=\*(C'\fR has been fixed. +[perl #123790] +.IP "\(bu" 4 +A possible crashing/looping bug related to compiling lexical subs has been +fixed. +[perl #124099] +.IP "\(bu" 4 +\&\s-1UTF\-8\s0 now works correctly in function names, in unquoted HERE-document +terminators, and in variable names used as array indexes. +[perl #124113] +.IP "\(bu" 4 +Repeated global pattern matches in scalar context on large tainted strings were +exponentially slow depending on the current match position in the string. +[perl #123202] +.IP "\(bu" 4 +Various crashes due to the parser getting confused by syntax errors have been +fixed. +[perl #123801] +[perl #123802] +[perl #123955] +[perl #123995] +.IP "\(bu" 4 +\&\f(CW\*(C`split\*(C'\fR in the scope of lexical \f(CW$_\fR has been fixed not to fail assertions. +[perl #123763] +.IP "\(bu" 4 +\&\f(CW\*(C`my $x : attr\*(C'\fR syntax inside various list operators no longer fails +assertions. +[perl #123817] +.IP "\(bu" 4 +An \f(CW\*(C`@\*(C'\fR sign in quotes followed by a non-ASCII digit (which is not a valid +identifier) would cause the parser to crash, instead of simply trying the +\&\f(CW\*(C`@\*(C'\fR as literal. This has been fixed. +[perl #123963] +.IP "\(bu" 4 +\&\f(CW\*(C`*bar::=*foo::=*glob_with_hash\*(C'\fR has been crashing since Perl 5.14, but no +longer does. +[perl #123847] +.IP "\(bu" 4 +\&\f(CW\*(C`foreach\*(C'\fR in scalar context was not pushing an item on to the stack, resulting +in bugs. (\f(CW\*(C`print\ 4,\ scalar\ do\ {\ foreach(@x){}\ }\ +\ 1\*(C'\fR would print 5.) +It has been fixed to return \f(CW\*(C`undef\*(C'\fR. +[perl #124004] +.IP "\(bu" 4 +Several cases of data used to store environment variable contents in core C +code being potentially overwritten before being used have been fixed. +[perl #123748] +.IP "\(bu" 4 +Some patterns starting with \f(CW\*(C`/.*..../\*(C'\fR matched against long strings have +been slow since v5.8, and some of the form \f(CW\*(C`/.*..../i\*(C'\fR have been slow +since v5.18. They are now all fast again. +[perl #123743] . +.IP "\(bu" 4 +The original visible value of \f(CW$/\fR is now preserved when it is set to +an invalid value. Previously if you set \f(CW$/\fR to a reference to an +array, for example, perl would produce a runtime error and not set +\&\f(CW\*(C`PL_rs\*(C'\fR, but Perl code that checked \f(CW$/\fR would see the array +reference. +[perl #123218] . +.IP "\(bu" 4 +In a regular expression pattern, a \s-1POSIX\s0 class, like \f(CW\*(C`[:ascii:]\*(C'\fR, must +be inside a bracketed character class, like \f(CW\*(C`qr/[[:ascii:]]/\*(C'\fR. A +warning is issued when something looking like a \s-1POSIX\s0 class is not +inside a bracketed class. That warning wasn't getting generated when +the \s-1POSIX\s0 class was negated: \f(CW\*(C`[:^ascii:]\*(C'\fR. This is now fixed. +.IP "\(bu" 4 +Perl 5.14.0 introduced a bug whereby \f(CW\*(C`eval\ {\ LABEL:\ }\*(C'\fR would crash. This +has been fixed. +[perl #123652] . +.IP "\(bu" 4 +Various crashes due to the parser getting confused by syntax errors have +been fixed. +[perl #123617] . +[perl #123737] . +[perl #123753] . +[perl #123677] . +.IP "\(bu" 4 +Code like \f(CW\*(C`/$a[/\*(C'\fR used to read the next line of input and treat it as +though it came immediately after the opening bracket. Some invalid code +consequently would parse and run, but some code caused crashes, so this is +now disallowed. +[perl #123712] . +.IP "\(bu" 4 +Fix argument underflow for \f(CW\*(C`pack\*(C'\fR. +[perl #123874] . +.IP "\(bu" 4 +Fix handling of non-strict \f(CW\*(C`\ex{}\*(C'\fR. Now \f(CW\*(C`\ex{}\*(C'\fR is equivalent to \f(CW\*(C`\ex{0}\*(C'\fR +instead of faulting. +.IP "\(bu" 4 +\&\f(CW\*(C`stat \-t\*(C'\fR is now no longer treated as stackable, just like \f(CW\*(C`\-t stat\*(C'\fR. +[perl #123816] . +.IP "\(bu" 4 +The following no longer causes a \s-1SEGV:\s0 \f(CW\*(C`qr{x+(y(?0))*}\*(C'\fR. +.IP "\(bu" 4 +Fixed infinite loop in parsing backrefs in regexp patterns. +.IP "\(bu" 4 +Several minor bug fixes in behavior of Infinity and NaN, including +warnings when stringifying Infinity-like or NaN-like strings. For example, +\&\*(L"NaNcy\*(R" doesn't numify to NaN anymore. +.IP "\(bu" 4 +A bug in regular expression patterns that could lead to segfaults and +other crashes has been fixed. This occurred only in patterns compiled +with \f(CW\*(C`/i\*(C'\fR while taking into account the current \s-1POSIX\s0 locale (which usually +means they have to be compiled within the scope of \f(CW\*(C`use\ locale\*(C'\fR), +and there must be a string of at least 128 consecutive bytes to match. +[perl #123539] . +.IP "\(bu" 4 +\&\f(CW\*(C`s///g\*(C'\fR now works on very long strings (where there are more than 2 +billion iterations) instead of dying with 'Substitution loop'. +[perl #103260] . +[perl #123071] . +.IP "\(bu" 4 +\&\f(CW\*(C`gmtime\*(C'\fR no longer crashes with not-a-number values. +[perl #123495] . +.IP "\(bu" 4 +\&\f(CW\*(C`\e()\*(C'\fR (a reference to an empty list), and \f(CW\*(C`y///\*(C'\fR with lexical \f(CW$_\fR in +scope, could both do a bad write past the end of the stack. They have +both been fixed to extend the stack first. +.IP "\(bu" 4 +\&\f(CW\*(C`prototype()\*(C'\fR with no arguments used to read the previous item on the +stack, so \f(CW\*(C`print\ "foo",\ prototype()\*(C'\fR would print foo's prototype. +It has been fixed to infer \f(CW$_\fR instead. +[perl #123514] . +.IP "\(bu" 4 +Some cases of lexical state subs declared inside predeclared subs could +crash, for example when evalling a string including the name of an outer +variable, but no longer do. +.IP "\(bu" 4 +Some cases of nested lexical state subs inside anonymous subs could cause +\&'Bizarre copy' errors or possibly even crashes. +.IP "\(bu" 4 +When trying to emit warnings, perl's default debugger (\fIperl5db.pl\fR) was +sometimes giving 'Undefined subroutine &DB::db_warn called' instead. This +bug, which started to occur in Perl 5.18, has been fixed. +[perl #123553] . +.IP "\(bu" 4 +Certain syntax errors in substitutions, such as \f(CW\*(C`s/${<>{})//\*(C'\fR, would +crash, and had done so since Perl 5.10. (In some cases the crash did not +start happening till 5.16.) The crash has, of course, been fixed. +[perl #123542] . +.IP "\(bu" 4 +Fix a couple of string grow size calculation overflows; in particular, +a repeat expression like \f(CW\*(C`33\ x\ ~3\*(C'\fR could cause a large buffer +overflow since the new output buffer size was not correctly handled by +\&\f(CW\*(C`SvGROW()\*(C'\fR. An expression like this now properly produces a memory wrap +panic. +[perl #123554] . +.IP "\(bu" 4 +\&\f(CW\*(C`formline("@...", "a");\*(C'\fR would crash. The \f(CW\*(C`FF_CHECKNL\*(C'\fR case in +\&\f(CW\*(C`pp_formline()\*(C'\fR didn't set the pointer used to mark the chop position, +which led to the \f(CW\*(C`FF_MORE\*(C'\fR case crashing with a segmentation fault. +This has been fixed. +[perl #123538] . +.IP "\(bu" 4 +A possible buffer overrun and crash when parsing a literal pattern during +regular expression compilation has been fixed. +[perl #123604] . +.IP "\(bu" 4 +\&\f(CW\*(C`fchmod()\*(C'\fR and \f(CW\*(C`futimes()\*(C'\fR now set \f(CW$!\fR when they fail due to being +passed a closed file handle. +[perl #122703] . +.IP "\(bu" 4 +\&\f(CW\*(C`op_free()\*(C'\fR and \f(CW\*(C`scalarvoid()\*(C'\fR no longer crash due to a stack overflow +when freeing a deeply recursive op tree. +[perl #108276] . +.IP "\(bu" 4 +In Perl 5.20.0, \f(CW$^N\fR accidentally had the internal \s-1UTF\-8\s0 flag turned off +if accessed from a code block within a regular expression, effectively +UTF\-8\-encoding the value. This has been fixed. +[perl #123135] . +.IP "\(bu" 4 +A failed \f(CW\*(C`semctl\*(C'\fR call no longer overwrites existing items on the stack, +which means that \f(CW\*(C`(semctl(\-1,0,0,0))[0]\*(C'\fR no longer gives an +\&\*(L"uninitialized\*(R" warning. +.IP "\(bu" 4 +\&\f(CW\*(C`else{foo()}\*(C'\fR with no space before \f(CW\*(C`foo\*(C'\fR is now better at assigning the +right line number to that statement. +[perl #122695] . +.IP "\(bu" 4 +Sometimes the assignment in \f(CW\*(C`@array = split\*(C'\fR gets optimised so that \f(CW\*(C`split\*(C'\fR +itself writes directly to the array. This caused a bug, preventing this +assignment from being used in lvalue context. So +\&\f(CW\*(C`(@a=split//,"foo")=bar()\*(C'\fR was an error. (This bug probably goes back to +Perl 3, when the optimisation was added.) It has now been fixed. +[perl #123057] . +.IP "\(bu" 4 +When an argument list fails the checks specified by a subroutine +signature (which is still an experimental feature), the resulting error +messages now give the file and line number of the caller, not of the +called subroutine. +[perl #121374] . +.IP "\(bu" 4 +The flip-flop operators (\f(CW\*(C`..\*(C'\fR and \f(CW\*(C`...\*(C'\fR in scalar context) used to maintain +a separate state for each recursion level (the number of times the +enclosing sub was called recursively), contrary to the documentation. Now +each closure has one internal state for each flip-flop. +[perl #122829] . +.IP "\(bu" 4 +The flip-flop operator (\f(CW\*(C`..\*(C'\fR in scalar context) would return the same +scalar each time, unless the containing subroutine was called recursively. +Now it always returns a new scalar. +[perl #122829] . +.IP "\(bu" 4 +\&\f(CW\*(C`use\*(C'\fR, \f(CW\*(C`no\*(C'\fR, statement labels, special blocks (\f(CW\*(C`BEGIN\*(C'\fR) and pod are now +permitted as the first thing in a \f(CW\*(C`map\*(C'\fR or \f(CW\*(C`grep\*(C'\fR block, the block after +\&\f(CW\*(C`print\*(C'\fR or \f(CW\*(C`say\*(C'\fR (or other functions) returning a handle, and within +\&\f(CW\*(C`${...}\*(C'\fR, \f(CW\*(C`@{...}\*(C'\fR, etc. +[perl #122782] . +.IP "\(bu" 4 +The repetition operator \f(CW\*(C`x\*(C'\fR now propagates lvalue context to its left-hand +argument when used in contexts like \f(CW\*(C`foreach\*(C'\fR. That allows +\&\f(CW\*(C`for(($#that_array)x2)\ {\ ...\ }\*(C'\fR to work as expected if the loop modifies +\&\f(CW$_\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`(...) x ...\*(C'\fR in scalar context used to corrupt the stack if one operand +was an object with \*(L"x\*(R" overloading, causing erratic behavior. +[perl #121827] . +.IP "\(bu" 4 +Assignment to a lexical scalar is often optimised away; for example in +\&\f(CW\*(C`my $x; $x = $y + $z\*(C'\fR, the assign operator is optimised away and the add +operator writes its result directly to \f(CW$x\fR. Various bugs related to +this optimisation have been fixed. Certain operators on the right-hand +side would sometimes fail to assign the value at all or assign the wrong +value, or would call \s-1STORE\s0 twice or not at all on tied variables. The +operators affected were \f(CW\*(C`$foo++\*(C'\fR, \f(CW\*(C`$foo\-\-\*(C'\fR, and \f(CW\*(C`\-$foo\*(C'\fR under \f(CW\*(C`use +integer\*(C'\fR, \f(CW\*(C`chomp\*(C'\fR, \f(CW\*(C`chr\*(C'\fR and \f(CW\*(C`setpgrp\*(C'\fR. +.IP "\(bu" 4 +List assignments were sometimes buggy if the same scalar ended up on both +sides of the assignment due to use of \f(CW\*(C`tied\*(C'\fR, \f(CW\*(C`values\*(C'\fR or \f(CW\*(C`each\*(C'\fR. The +result would be the wrong value getting assigned. +.IP "\(bu" 4 +\&\f(CW\*(C`setpgrp($nonzero)\*(C'\fR (with one argument) was accidentally changed in 5.16 +to mean \f(CWsetpgrp(0)\fR. This has been fixed. +.IP "\(bu" 4 +\&\f(CW\*(C`_\|_SUB_\|_\*(C'\fR could return the wrong value or even corrupt memory under the +debugger (the \f(CW\*(C`\-d\*(C'\fR switch) and in subs containing \f(CW\*(C`eval $string\*(C'\fR. +.IP "\(bu" 4 +When \f(CW\*(C`sub\ ()\ {\ $var\ }\*(C'\fR becomes inlinable, it now returns a different +scalar each time, just as a non-inlinable sub would, though Perl still +optimises the copy away in cases where it would make no observable +difference. +.IP "\(bu" 4 +\&\f(CW\*(C`my\ sub\ f\ ()\ {\ $var\ }\*(C'\fR and \f(CW\*(C`sub\ ()\ :\ attr\ {\ $var\ }\*(C'\fR are no longer +eligible for inlining. The former would crash; the latter would just +throw the attributes away. An exception is made for the little-known +\&\f(CW\*(C`:method\*(C'\fR attribute, which does nothing much. +.IP "\(bu" 4 +Inlining of subs with an empty prototype is now more consistent than +before. Previously, a sub with multiple statements, of which all but the last +were optimised away, would be inlinable only if it were an anonymous sub +containing a string \f(CW\*(C`eval\*(C'\fR or \f(CW\*(C`state\*(C'\fR declaration or closing over an +outer lexical variable (or any anonymous sub under the debugger). Now any +sub that gets folded to a single constant after statements have been +optimised away is eligible for inlining. This applies to things like \f(CW\*(C`sub +() { jabber() if DEBUG; 42 }\*(C'\fR. +.Sp +Some subroutines with an explicit \f(CW\*(C`return\*(C'\fR were being made inlinable, +contrary to the documentation, Now \f(CW\*(C`return\*(C'\fR always prevents inlining. +.IP "\(bu" 4 +On some systems, such as \s-1VMS,\s0 \f(CW\*(C`crypt\*(C'\fR can return a non-ASCII string. If a +scalar assigned to had contained a \s-1UTF\-8\s0 string previously, then \f(CW\*(C`crypt\*(C'\fR +would not turn off the \s-1UTF\-8\s0 flag, thus corrupting the return value. This +would happen with \f(CW\*(C`$lexical\ =\ crypt\ ...\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`crypt\*(C'\fR no longer calls \f(CW\*(C`FETCH\*(C'\fR twice on a tied first argument. +.IP "\(bu" 4 +An unterminated here-doc on the last line of a quote-like operator +(\f(CW\*(C`qq[${ <. +.IP "\(bu" 4 +A small, previously intentional, memory leak in +\&\f(CW\*(C`PERL_SYS_INIT\*(C'\fR/\f(CW\*(C`PERL_SYS_INIT3\*(C'\fR on Win32 builds was fixed. This might +affect embedders who repeatedly create and destroy perl engines within +the same process. +.IP "\(bu" 4 +\&\f(CW\*(C`POSIX::localeconv()\*(C'\fR now returns the data for the program's underlying +locale even when called from outside the scope of \f(CW\*(C`use\ locale\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`POSIX::localeconv()\*(C'\fR now works properly on platforms which don't have +\&\f(CW\*(C`LC_NUMERIC\*(C'\fR and/or \f(CW\*(C`LC_MONETARY\*(C'\fR, or for which Perl has been compiled +to disregard either or both of these locale categories. In such +circumstances, there are now no entries for the corresponding values in +the hash returned by \f(CW\*(C`localeconv()\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`POSIX::localeconv()\*(C'\fR now marks appropriately the values it returns as +\&\s-1UTF\-8\s0 or not. Previously they were always returned as bytes, even if +they were supposed to be encoded as \s-1UTF\-8.\s0 +.IP "\(bu" 4 +On Microsoft Windows, within the scope of \f(CW\*(C`use\ locale\*(C'\fR, the following +\&\s-1POSIX\s0 character classes gave results for many locales that did not +conform to the \s-1POSIX\s0 standard: +\&\f(CW\*(C`[[:alnum:]]\*(C'\fR, +\&\f(CW\*(C`[[:alpha:]]\*(C'\fR, +\&\f(CW\*(C`[[:blank:]]\*(C'\fR, +\&\f(CW\*(C`[[:digit:]]\*(C'\fR, +\&\f(CW\*(C`[[:graph:]]\*(C'\fR, +\&\f(CW\*(C`[[:lower:]]\*(C'\fR, +\&\f(CW\*(C`[[:print:]]\*(C'\fR, +\&\f(CW\*(C`[[:punct:]]\*(C'\fR, +\&\f(CW\*(C`[[:upper:]]\*(C'\fR, +\&\f(CW\*(C`[[:word:]]\*(C'\fR, +and +\&\f(CW\*(C`[[:xdigit:]]\*(C'\fR. +This was because the underlying Microsoft implementation does not +follow the standard. Perl now takes special precautions to correct for +this. +.IP "\(bu" 4 +Many issues have been detected by Coverity and +fixed. +.IP "\(bu" 4 +\&\f(CW\*(C`system()\*(C'\fR and friends should now work properly on more Android builds. +.Sp +Due to an oversight, the value specified through \f(CW\*(C`\-Dtargetsh\*(C'\fR to \fIConfigure\fR +would end up being ignored by some of the build process. This caused perls +cross-compiled for Android to end up with defective versions of \f(CW\*(C`system()\*(C'\fR, +\&\f(CW\*(C`exec()\*(C'\fR and backticks: the commands would end up looking for \f(CW\*(C`/bin/sh\*(C'\fR +instead of \f(CW\*(C`/system/bin/sh\*(C'\fR, and so would fail for the vast majority +of devices, leaving \f(CW$!\fR as \f(CW\*(C`ENOENT\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`qr(...\e(...\e)...)\*(C'\fR, +\&\f(CW\*(C`qr[...\e[...\e]...]\*(C'\fR, +and +\&\f(CW\*(C`qr{...\e{...\e}...}\*(C'\fR +now work. Previously it was impossible to escape these three +left-characters with a backslash within a regular expression pattern +where otherwise they would be considered metacharacters, and the pattern +opening delimiter was the character, and the closing delimiter was its +mirror character. +.IP "\(bu" 4 +\&\f(CW\*(C`s///e\*(C'\fR on tainted \s-1UTF\-8\s0 strings corrupted \f(CW\*(C`pos()\*(C'\fR. This bug, +introduced in 5.20, is now fixed. +[perl #122148] . +.IP "\(bu" 4 +A non-word boundary in a regular expression (\f(CW\*(C`\eB\*(C'\fR) did not always +match the end of the string; in particular \f(CW\*(C`q{} =~ /\eB/\*(C'\fR did not +match. This bug, introduced in perl 5.14, is now fixed. +[perl #122090] . +.IP "\(bu" 4 +\&\f(CW\*(C`" P" =~ /(?=.*P)P/\*(C'\fR should match, but did not. This is now fixed. +[perl #122171] . +.IP "\(bu" 4 +Failing to compile \f(CW\*(C`use Foo\*(C'\fR in an \f(CW\*(C`eval\*(C'\fR could leave a spurious +\&\f(CW\*(C`BEGIN\*(C'\fR subroutine definition, which would produce a \*(L"Subroutine +\&\s-1BEGIN\s0 redefined\*(R" warning on the next use of \f(CW\*(C`use\*(C'\fR, or other \f(CW\*(C`BEGIN\*(C'\fR +block. +[perl #122107] . +.IP "\(bu" 4 +\&\f(CW\*(C`method { BLOCK } ARGS\*(C'\fR syntax now correctly parses the arguments if they +begin with an opening brace. +[perl #46947] . +.IP "\(bu" 4 +External libraries and Perl may have different ideas of what the locale is. +This is problematic when parsing version strings if the locale's numeric +separator has been changed. Version parsing has been patched to ensure +it handles the locales correctly. +[perl #121930] . +.IP "\(bu" 4 +A bug has been fixed where zero-length assertions and code blocks inside of a +regex could cause \f(CW\*(C`pos\*(C'\fR to see an incorrect value. +[perl #122460] . +.IP "\(bu" 4 +Dereferencing of constants now works correctly for typeglob constants. Previously +the glob was stringified and its name looked up. Now the glob itself is used. +[perl #69456] +.IP "\(bu" 4 +When parsing a sigil (\f(CW\*(C`$\*(C'\fR \f(CW\*(C`@\*(C'\fR \f(CW\*(C`%\*(C'\fR \f(CW\*(C`&)\*(C'\fR followed by braces, +the parser no +longer tries to guess whether it is a block or a hash constructor (causing a +syntax error when it guesses the latter), since it can only be a block. +.IP "\(bu" 4 +\&\f(CW\*(C`undef\ $reference\*(C'\fR now frees the referent immediately, instead of hanging on +to it until the next statement. +[perl #122556] +.IP "\(bu" 4 +Various cases where the name of a sub is used (autoload, overloading, error +messages) used to crash for lexical subs, but have been fixed. +.IP "\(bu" 4 +Bareword lookup now tries to avoid vivifying packages if it turns out the +bareword is not going to be a subroutine name. +.IP "\(bu" 4 +Compilation of anonymous constants (\fIe.g.\fR, \f(CW\*(C`sub () { 3 }\*(C'\fR) no longer deletes +any subroutine named \f(CW\*(C`_\|_ANON_\|_\*(C'\fR in the current package. Not only was +\&\f(CW\*(C`*_\|_ANON_\|_{CODE}\*(C'\fR cleared, but there was a memory leak, too. This bug goes +back to Perl 5.8.0. +.IP "\(bu" 4 +Stub declarations like \f(CW\*(C`sub f;\*(C'\fR and \f(CW\*(C`sub f ();\*(C'\fR no longer wipe out constants +of the same name declared by \f(CW\*(C`use constant\*(C'\fR. This bug was introduced in Perl +5.10.0. +.IP "\(bu" 4 +\&\f(CW\*(C`qr/[\eN{named sequence}]/\*(C'\fR now works properly in many instances. +.Sp +Some names +known to \f(CW\*(C`\eN{...}\*(C'\fR refer to a sequence of multiple characters, instead of the +usual single character. Bracketed character classes generally only match +single characters, but now special handling has been added so that they can +match named sequences, but not if the class is inverted or the sequence is +specified as the beginning or end of a range. In these cases, the only +behavior change from before is a slight rewording of the fatal error message +given when this class is part of a \f(CW\*(C`?[...])\*(C'\fR construct. When the \f(CW\*(C`[...]\*(C'\fR +stands alone, the same non-fatal warning as before is raised, and only the +first character in the sequence is used, again just as before. +.IP "\(bu" 4 +Tainted constants evaluated at compile time no longer cause unrelated +statements to become tainted. +[perl #122669] +.IP "\(bu" 4 +\&\f(CW\*(C`open\ $$fh,\ ...\*(C'\fR, which vivifies a handle with a name like +\&\f(CW"main::_GEN_0"\fR, was not giving the handle the right reference count, so +a double free could happen. +.IP "\(bu" 4 +When deciding that a bareword was a method name, the parser would get confused +if an \f(CW\*(C`our\*(C'\fR sub with the same name existed, and look up the method in the +package of the \f(CW\*(C`our\*(C'\fR sub, instead of the package of the invocant. +.IP "\(bu" 4 +The parser no longer gets confused by \f(CW\*(C`\eU=\*(C'\fR within a double-quoted string. It +used to produce a syntax error, but now compiles it correctly. +[perl #80368] +.IP "\(bu" 4 +It has always been the intention for the \f(CW\*(C`\-B\*(C'\fR and \f(CW\*(C`\-T\*(C'\fR file test operators to +treat \s-1UTF\-8\s0 encoded files as text. (perlfunc has +been updated to say this.) Previously, it was possible for some files to be +considered \s-1UTF\-8\s0 that actually weren't valid \s-1UTF\-8.\s0 This is now fixed. The +operators now work on \s-1EBCDIC\s0 platforms as well. +.IP "\(bu" 4 +Under some conditions warning messages raised during regular expression pattern +compilation were being output more than once. This has now been fixed. +.IP "\(bu" 4 +Perl 5.20.0 introduced a regression in which a \s-1UTF\-8\s0 encoded regular +expression pattern that contains a single \s-1ASCII\s0 lowercase letter did not +match its uppercase counterpart. That has been fixed in both 5.20.1 and +5.22.0. +[perl #122655] +.IP "\(bu" 4 +Constant folding could incorrectly suppress warnings if lexical warnings +(\f(CW\*(C`use warnings\*(C'\fR or \f(CW\*(C`no warnings\*(C'\fR) were not in effect and \f(CW$^W\fR were +false at compile time and true at run time. +.IP "\(bu" 4 +Loading Unicode tables during a regular expression match could cause assertion +failures under debugging builds if the previous match used the very same +regular expression. +[perl #122747] +.IP "\(bu" 4 +Thread cloning used to work incorrectly for lexical subs, possibly causing +crashes or double frees on exit. +.IP "\(bu" 4 +Since Perl 5.14.0, deleting \f(CW$SomePackage::{_\|_ANON_\|_}\fR and then undefining an +anonymous subroutine could corrupt things internally, resulting in +Devel::Peek crashing or B.pm giving nonsensical data. This has been +fixed. +.IP "\(bu" 4 +\&\f(CW\*(C`(caller\ $n)[3]\*(C'\fR now reports names of lexical subs, instead of +treating them as \f(CW"(unknown)"\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`sort subname LIST\*(C'\fR now supports using a lexical sub as the comparison +routine. +.IP "\(bu" 4 +Aliasing (\fIe.g.\fR, via \f(CW\*(C`*x\ =\ *y\*(C'\fR) could confuse list assignments that mention the +two names for the same variable on either side, causing wrong values to be +assigned. +[perl #15667] +.IP "\(bu" 4 +Long here-doc terminators could cause a bad read on short lines of input. This +has been fixed. It is doubtful that any crash could have occurred. This bug +goes back to when here-docs were introduced in Perl 3.000 twenty-five years +ago. +.IP "\(bu" 4 +An optimization in \f(CW\*(C`split\*(C'\fR to treat \f(CW\*(C`split\ /^/\*(C'\fR like \f(CW\*(C`split\ /^/m\*(C'\fR had the +unfortunate side-effect of also treating \f(CW\*(C`split\ /\eA/\*(C'\fR like \f(CW\*(C`split\ /^/m\*(C'\fR, +which it should not. This has been fixed. (Note, however, that \f(CW\*(C`split\ /^x/\*(C'\fR +does not behave like \f(CW\*(C`split\ /^x/m\*(C'\fR, which is also considered to be a bug and +will be fixed in a future version.) +[perl #122761] +.IP "\(bu" 4 +The little-known \f(CW\*(C`my\ Class\ $var\*(C'\fR syntax (see fields and attributes) +could get confused in the scope of \f(CW\*(C`use utf8\*(C'\fR if \f(CW\*(C`Class\*(C'\fR were a constant +whose value contained Latin\-1 characters. +.IP "\(bu" 4 +Locking and unlocking values via Hash::Util or \f(CW\*(C`Internals::SvREADONLY\*(C'\fR +no longer has any effect on values that were read-only to begin with. +Previously, unlocking such values could result in crashes, hangs or +other erratic behavior. +.IP "\(bu" 4 +Some unterminated \f(CW\*(C`(?(...)...)\*(C'\fR constructs in regular expressions would +either crash or give erroneous error messages. \f(CW\*(C`/(?(1)/\*(C'\fR is one such +example. +.IP "\(bu" 4 +\&\f(CW\*(C`pack\ "w",\ $tied\*(C'\fR no longer calls \s-1FETCH\s0 twice. +.IP "\(bu" 4 +List assignments like \f(CW\*(C`($x,\ $z)\ =\ (1,\ $y)\*(C'\fR now work correctly if \f(CW$x\fR and +\&\f(CW$y\fR have been aliased by \f(CW\*(C`foreach\*(C'\fR. +.IP "\(bu" 4 +Some patterns including code blocks with syntax errors, such as +\&\f(CW\*(C`/\ (?{(^{})/\*(C'\fR, would hang or fail assertions on debugging builds. Now +they produce errors. +.IP "\(bu" 4 +An assertion failure when parsing \f(CW\*(C`sort\*(C'\fR with debugging enabled has been +fixed. +[perl #122771] . +.IP "\(bu" 4 +\&\f(CW\*(C`*a\ =\ *b;\ @a\ =\ split\ //,\ $b[1]\*(C'\fR could do a bad read and produce junk +results. +.IP "\(bu" 4 +In \f(CW\*(C`()\ =\ @array\ =\ split\*(C'\fR, the \f(CW\*(C`()\ =\*(C'\fR at the beginning no longer confuses +the optimizer into assuming a limit of 1. +.IP "\(bu" 4 +Fatal warnings no longer prevent the output of syntax errors. +[perl #122966] . +.IP "\(bu" 4 +Fixed a NaN double-to-long-double conversion error on \s-1VMS.\s0 For quiet NaNs +(and only on Itanium, not Alpha) negative infinity instead of NaN was +produced. +.IP "\(bu" 4 +Fixed the issue that caused \f(CW\*(C`make distclean\*(C'\fR to incorrectly leave some +files behind. +[perl #122820] . +.IP "\(bu" 4 +\&\s-1AIX\s0 now sets the length in \f(CW\*(C`getsockopt\*(C'\fR correctly. +[perl #120835] . +[cpan #91183] . +[cpan #85570] . +.IP "\(bu" 4 +The optimization phase of a regexp compilation could run \*(L"forever\*(R" and +exhaust all memory under certain circumstances; now fixed. +[perl #122283] . +.IP "\(bu" 4 +The test script \fIt/op/crypt.t\fR now uses the \s-1SHA\-256\s0 algorithm if the +default one is disabled, rather than giving failures. +[perl #121591] . +.IP "\(bu" 4 +Fixed an off-by-one error when setting the size of a shared array. +[perl #122950] . +.IP "\(bu" 4 +Fixed a bug that could cause perl to enter an infinite loop during +compilation. In particular, a \f(CWwhile(1)\fR within a sublist, \fIe.g.\fR +.Sp +.Vb 1 +\& sub foo { () = ($a, my $b, ($c, do { while(1) {} })) } +.Ve +.Sp +The bug was introduced in 5.20.0 +[perl #122995] . +.IP "\(bu" 4 +On Win32, if a variable was \f(CW\*(C`local\*(C'\fR\-ized in a pseudo-process that later +forked, restoring the original value in the child pseudo-process caused +memory corruption and a crash in the child pseudo-process (and therefore the +\&\s-1OS\s0 process). +[perl #40565] . +.IP "\(bu" 4 +Calling \f(CW\*(C`write\*(C'\fR on a format with a \f(CW\*(C`^**\*(C'\fR field could produce a panic +in \f(CW\*(C`sv_chop()\*(C'\fR if there were insufficient arguments or if the variable +used to fill the field was empty. +[perl #123245] . +.IP "\(bu" 4 +Non-ASCII lexical sub names now appear without trailing junk when they +appear in error messages. +.IP "\(bu" 4 +The \f(CW\*(C`\e@\*(C'\fR subroutine prototype no longer flattens parenthesized arrays +(taking a reference to each element), but takes a reference to the array +itself. +[perl #47363] . +.IP "\(bu" 4 +A block containing nothing except a C\-style \f(CW\*(C`for\*(C'\fR loop could corrupt the +stack, causing lists outside the block to lose elements or have elements +overwritten. This could happen with \f(CW\*(C`map { for(...){...} } ...\*(C'\fR and with +lists containing \f(CW\*(C`do { for(...){...} }\*(C'\fR. +[perl #123286] . +.IP "\(bu" 4 +\&\f(CW\*(C`scalar()\*(C'\fR now propagates lvalue context, so that +\&\f(CW\*(C`for(scalar($#foo))\ {\ ...\ }\*(C'\fR can modify \f(CW$#foo\fR through \f(CW$_\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`qr/@array(?{block})/\*(C'\fR no longer dies with \*(L"Bizarre copy of \s-1ARRAY\*(R".\s0 +[perl #123344] . +.IP "\(bu" 4 +\&\f(CW\*(C`eval\ \*(Aq$variable\*(Aq\*(C'\fR in nested named subroutines would sometimes look up a +global variable even with a lexical variable in scope. +.IP "\(bu" 4 +In perl 5.20.0, \f(CW\*(C`sort CORE::fake\*(C'\fR where 'fake' is anything other than a +keyword, started chopping off the last 6 characters and treating the result +as a sort sub name. The previous behavior of treating \f(CW\*(C`CORE::fake\*(C'\fR as a +sort sub name has been restored. +[perl #123410] . +.IP "\(bu" 4 +Outside of \f(CW\*(C`use utf8\*(C'\fR, a single-character Latin\-1 lexical variable is +disallowed. The error message for it, "Can't use global \f(CW$foo\fR...", was +giving garbage instead of the variable name. +.IP "\(bu" 4 +\&\f(CW\*(C`readline\*(C'\fR on a nonexistent handle was causing \f(CW\*(C`${^LAST_FH}\*(C'\fR to produce a +reference to an undefined scalar (or fail an assertion). Now +\&\f(CW\*(C`${^LAST_FH}\*(C'\fR ends up undefined. +.IP "\(bu" 4 +\&\f(CW\*(C`(...) x ...\*(C'\fR in void context now applies scalar context to the left-hand +argument, instead of the context the current sub was called in. +[perl #123020] . +.SH "Known Problems" +.IX Header "Known Problems" +.IP "\(bu" 4 +\&\f(CW\*(C`pack\*(C'\fR\-ing a NaN on a perl compiled with Visual C 6 does not behave properly, +leading to a test failure in \fIt/op/infnan.t\fR. +[perl 125203] +.IP "\(bu" 4 +A goal is for Perl to be able to be recompiled to work reasonably well on any +Unicode version. In Perl 5.22, though, the earliest such version is Unicode +5.1 (current is 7.0). +.IP "\(bu" 4 +\&\s-1EBCDIC\s0 platforms +.RS 4 +.IP "\(bu" 4 +The \f(CW\*(C`cmp\*(C'\fR (and hence \f(CW\*(C`sort\*(C'\fR) operators do not necessarily give the +correct results when both operands are UTF-EBCDIC encoded strings and +there is a mixture of \s-1ASCII\s0 and/or control characters, along with other +characters. +.IP "\(bu" 4 +Ranges containing \f(CW\*(C`\eN{...}\*(C'\fR in the \f(CW\*(C`tr///\*(C'\fR (and \f(CW\*(C`y///\*(C'\fR) +transliteration operators are treated differently than the equivalent +ranges in regular expression patterns. They should, but don't, cause +the values in the ranges to all be treated as Unicode code points, and +not native ones. (\*(L"Version 8 Regular Expressions\*(R" in perlre gives +details as to how it should work.) +.IP "\(bu" 4 +Encode and encoding are mostly broken. +.IP "\(bu" 4 +Many \s-1CPAN\s0 modules that are shipped with core show failing tests. +.IP "\(bu" 4 +\&\f(CW\*(C`pack\*(C'\fR/\f(CW\*(C`unpack\*(C'\fR with \f(CW"U0"\fR format may not work properly. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +The following modules are known to have test failures with this version of +Perl. In many cases, patches have been submitted, so there will hopefully be +new releases soon: +.RS 4 +.IP "\(bu" 4 +B::Generate version 1.50 +.IP "\(bu" 4 +B::Utils version 0.25 +.IP "\(bu" 4 +Coro version 6.42 +.IP "\(bu" 4 +Dancer version 1.3130 +.IP "\(bu" 4 +Data::Alias version 1.18 +.IP "\(bu" 4 +Data::Dump::Streamer version 2.38 +.IP "\(bu" 4 +Data::Util version 0.63 +.IP "\(bu" 4 +Devel::Spy version 0.07 +.IP "\(bu" 4 +invoker version 0.34 +.IP "\(bu" 4 +Lexical::Var version 0.009 +.IP "\(bu" 4 +LWP::ConsoleLogger version 0.000018 +.IP "\(bu" 4 +Mason version 2.22 +.IP "\(bu" 4 +NgxQueue version 0.02 +.IP "\(bu" 4 +Padre version 1.00 +.IP "\(bu" 4 +Parse::Keyword 0.08 +.RE +.RS 4 +.RE +.SH "Obituary" +.IX Header "Obituary" +Brian McCauley died on May 8, 2015. He was a frequent poster to Usenet, Perl +Monks, and other Perl forums, and made several \s-1CPAN\s0 contributions under the +nick \s-1NOBULL,\s0 including to the Perl \s-1FAQ.\s0 He attended almost every +YAPC::Europe, and indeed, helped organise YAPC::Europe 2006 and the \s-1QA\s0 +Hackathon 2009. His wit and his delight in intricate systems were +particularly apparent in his love of board games; many Perl mongers will +have fond memories of playing Fluxx and other games with Brian. He will be +missed. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.22.0 represents approximately 12 months of development since Perl 5.20.0 +and contains approximately 590,000 lines of changes across 2,400 files from 94 +authors. +.PP +Excluding auto-generated files, documentation and release tools, there were +approximately 370,000 lines of changes to 1,500 .pm, .t, .c and .h files. +.PP +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed the +improvements that became Perl 5.22.0: +.PP +Aaron Crane, Abhijit Menon-Sen, Abigail, Alberto Simo\*~es, Alex Solovey, Alex +Vandiver, Alexandr Ciornii, Alexandre (Midnite) Jousset, Andreas Ko\*:nig, +Andreas Voegele, Andrew Fresh, Andy Dougherty, Anthony Heading, Aristotle +Pagaltzis, brian d foy, Brian Fraser, Chad Granum, Chris 'BinGOs' Williams, +Craig A. Berry, Dagfinn Ilmari Mannsa\*oker, Daniel Dragan, Darin McBride, Dave +Rolsky, David Golden, David Mitchell, David Wheeler, Dmitri Tikhonov, Doug +Bell, E. Choroba, Ed J, Eric Herman, Father Chrysostomos, George Greer, Glenn +D. Golden, Graham Knop, H.Merijn Brand, Herbert Breunung, Hugo van der Sanden, +James E Keenan, James McCoy, James Raspass, Jan Dubois, Jarkko Hietaniemi, +Jasmine Ngan, Jerry D. Hedden, Jim Cromie, John Goodyear, kafka, Karen +Etheridge, Karl Williamson, Kent Fredric, kmx, Lajos Veres, Leon Timmermans, +Lukas Mai, Mathieu Arnold, Matthew Horsfall, Max Maischein, Michael Bunk, +Nicholas Clark, Niels Thykier, Niko Tyni, Norman Koch, Olivier Mengue\*', Peter +John Acklam, Peter Martini, Petr Pi\*'saX, Philippe Bruhat (BooK), Pierre +Bogossian, Rafael Garcia-Suarez, Randy Stauner, Reini Urban, Ricardo Signes, +Rob Hoelz, Rostislav Skudnov, Sawyer X, Shirakata Kentaro, Shlomi Fish, +Sisyphus, Slaven Rezic, Smylers, Steffen Mu\*:ller, Steve Hay, Sullivan Beck, +syber, Tadeusz SoXnierz, Thomas Sibley, Todd Rinaldo, Tony Cook, Vincent Pit, +Vladimir Marek, Yaroslav Kuzmin, Yves Orton, \*(Aevar Arnfjo\*:r\*(d- Bjarmason. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles recently +posted to the comp.lang.perl.misc newsgroup and the perl bug database at +. There may also be information at +, the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug program +included with your release. Be sure to trim your bug down to a tiny but +sufficient test case. Your bug report, along with the output of \f(CW\*(C`perl \-V\*(C'\fR, +will be sent off to perlbug@perl.org to be analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send it +to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes all the core committers, who will be +able to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for +security issues in the Perl core, not for modules independently distributed on +\&\s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5224delta.1 b/data/miniconda3/man/man1/perl5224delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..a78494382545d59fa9a82fa61cd0968b2898f629 --- /dev/null +++ b/data/miniconda3/man/man1/perl5224delta.1 @@ -0,0 +1,242 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5224DELTA 1" +.TH PERL5224DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5224delta \- what is new for perl v5.22.4 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.22.3 release and the 5.22.4 +release. +.PP +If you are upgrading from an earlier release such as 5.22.2, first read +perl5223delta, which describes differences between 5.22.2 and 5.22.3. +.SH "Security" +.IX Header "Security" +.ie n .SS "Improved handling of '.' in @INC in base.pm" +.el .SS "Improved handling of '.' in \f(CW@INC\fP in base.pm" +.IX Subsection "Improved handling of '.' in @INC in base.pm" +The handling of (the removal of) \f(CW\*(Aq.\*(Aq\fR in \f(CW@INC\fR in base has been +improved. This resolves some problematic behaviour in the approach taken in +Perl 5.22.3, which is probably best described in the following two threads on +the Perl 5 Porters mailing list: +, +. +.ie n .SS """Escaped"" colons and relative paths in \s-1PATH\s0" +.el .SS "``Escaped'' colons and relative paths in \s-1PATH\s0" +.IX Subsection "Escaped colons and relative paths in PATH" +On Unix systems, Perl treats any relative paths in the \s-1PATH\s0 environment +variable as tainted when starting a new process. Previously, it was allowing a +backslash to escape a colon (unlike the \s-1OS\s0), consequently allowing relative +paths to be considered safe if the \s-1PATH\s0 was set to something like \f(CW\*(C`/\e:.\*(C'\fR. The +check has been fixed to treat \f(CW\*(C`.\*(C'\fR as tainted in that example. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +base has been upgraded from version 2.22 to 2.22_01. +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 5.20170114_22 to 5.20170715_22. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +Fixed a crash with \f(CW\*(C`s///l\*(C'\fR where it thought it was dealing with \s-1UTF\-8\s0 when it +wasn't. +[perl #129038] +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.22.4 represents approximately 6 months of development since Perl 5.22.3 +and contains approximately 2,200 lines of changes across 52 files from 16 +authors. +.PP +Excluding auto-generated files, documentation and release tools, there were +approximately 970 lines of changes to 18 .pm, .t, .c and .h files. +.PP +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed +the improvements that became Perl 5.22.4: +.PP +Aaron Crane, Abigail, Aristotle Pagaltzis, Chris 'BinGOs' Williams, David +Mitchell, Eric Herman, Father Chrysostomos, James E Keenan, Karl Williamson, +Lukas Mai, Renee Baecker, Ricardo Signes, Sawyer X, Stevan Little, Steve Hay, +Tony Cook. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles recently +posted to the comp.lang.perl.misc newsgroup and the perl bug database at +https://rt.perl.org/ . There may also be information at +http://www.perl.org/ , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug program +included with your release. Be sure to trim your bug down to a tiny but +sufficient test case. Your bug report, along with the output of \f(CW\*(C`perl \-V\*(C'\fR, +will be sent off to perlbug@perl.org to be analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send it +to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes all the core committers, who will be +able to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for +security issues in the Perl core, not for modules independently distributed on +\&\s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5241delta.1 b/data/miniconda3/man/man1/perl5241delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..41fe3f83af7dbc457c4359a7b65ecc668124475a --- /dev/null +++ b/data/miniconda3/man/man1/perl5241delta.1 @@ -0,0 +1,364 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5241DELTA 1" +.TH PERL5241DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5241delta \- what is new for perl v5.24.1 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.24.0 release and the 5.24.1 +release. +.PP +If you are upgrading from an earlier release such as 5.22.0, first read +perl5240delta, which describes differences between 5.22.0 and 5.24.0. +.SH "Security" +.IX Header "Security" +.SS "\fB\-Di\fP switch is now required for PerlIO debugging output" +.IX Subsection "-Di switch is now required for PerlIO debugging output" +Previously PerlIO debugging output would be sent to the file specified by the +\&\f(CW\*(C`PERLIO_DEBUG\*(C'\fR environment variable if perl wasn't running setuid and the +\&\fB\-T\fR or \fB\-t\fR switches hadn't been parsed yet. +.PP +If perl performed output at a point where it hadn't yet parsed its switches +this could result in perl creating or overwriting the file named by +\&\f(CW\*(C`PERLIO_DEBUG\*(C'\fR even when the \fB\-T\fR switch had been supplied. +.PP +Perl now requires the \fB\-Di\fR switch to produce PerlIO debugging output. By +default this is written to \f(CW\*(C`stderr\*(C'\fR, but can optionally be redirected to a +file by setting the \f(CW\*(C`PERLIO_DEBUG\*(C'\fR environment variable. +.PP +If perl is running setuid or the \fB\-T\fR switch was supplied \f(CW\*(C`PERLIO_DEBUG\*(C'\fR is +ignored and the debugging output is sent to \f(CW\*(C`stderr\*(C'\fR as for any other \fB\-D\fR +switch. +.ie n .SS "Core modules and tools no longer search \fI"".""\fP for optional modules" +.el .SS "Core modules and tools no longer search \fI``.''\fP for optional modules" +.IX Subsection "Core modules and tools no longer search . for optional modules" +The tools and many modules supplied in core no longer search the default +current directory entry in \f(CW@INC\fR for optional modules. For +example, Storable will remove the final \fI\*(L".\*(R"\fR from \f(CW@INC\fR before trying to +load Log::Agent. +.PP +This prevents an attacker injecting an optional module into a process run by +another user where the current directory is writable by the attacker, e.g. the +\&\fI/tmp\fR directory. +.PP +In most cases this removal should not cause problems, but difficulties were +encountered with base, which treats every module name supplied as optional. +These difficulties have not yet been resolved, so for this release there are no +changes to base. We hope to have a fix for base in Perl 5.24.2. +.PP +To protect your own code from this attack, either remove the default \fI\*(L".\*(R"\fR +entry from \f(CW@INC\fR at the start of your script, so: +.PP +.Vb 3 +\& #!/usr/bin/perl +\& use strict; +\& ... +.Ve +.PP +becomes: +.PP +.Vb 4 +\& #!/usr/bin/perl +\& BEGIN { pop @INC if $INC[\-1] eq \*(Aq.\*(Aq } +\& use strict; +\& ... +.Ve +.PP +or for modules, remove \fI\*(L".\*(R"\fR from a localized \f(CW@INC\fR, so: +.PP +.Vb 1 +\& my $can_foo = eval { require Foo; } +.Ve +.PP +becomes: +.PP +.Vb 5 +\& my $can_foo = eval { +\& local @INC = @INC; +\& pop @INC if $INC[\-1] eq \*(Aq.\*(Aq; +\& require Foo; +\& }; +.Ve +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +Other than the security changes above there are no changes intentionally +incompatible with Perl 5.24.0. If any exist, they are bugs, and we request +that you submit a report. See \*(L"Reporting Bugs\*(R" below. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +Archive::Tar has been upgraded from version 2.04 to 2.04_01. +.IP "\(bu" 4 +bignum has been upgraded from version 0.42 to 0.42_01. +.IP "\(bu" 4 +\&\s-1CPAN\s0 has been upgraded from version 2.11 to 2.11_01. +.IP "\(bu" 4 +Digest has been upgraded from version 1.17 to 1.17_01. +.IP "\(bu" 4 +Digest::SHA has been upgraded from version 5.95 to 5.95_01. +.IP "\(bu" 4 +Encode has been upgraded from version 2.80 to 2.80_01. +.IP "\(bu" 4 +ExtUtils::MakeMaker has been upgraded from version 7.10_01 to 7.10_02. +.IP "\(bu" 4 +File::Fetch has been upgraded from version 0.48 to 0.48_01. +.IP "\(bu" 4 +File::Spec has been upgraded from version 3.63 to 3.63_01. +.IP "\(bu" 4 +HTTP::Tiny has been upgraded from version 0.056 to 0.056_001. +.IP "\(bu" 4 +\&\s-1IO\s0 has been upgraded from version 1.36 to 1.36_01. +.IP "\(bu" 4 +The IO-Compress modules have been upgraded from version 2.069 to 2.069_001. +.IP "\(bu" 4 +IPC::Cmd has been upgraded from version 0.92 to 0.92_01. +.IP "\(bu" 4 +\&\s-1JSON::PP\s0 has been upgraded from version 2.27300 to 2.27300_01. +.IP "\(bu" 4 +Locale::Maketext has been upgraded from version 1.26 to 1.26_01. +.IP "\(bu" 4 +Locale::Maketext::Simple has been upgraded from version 0.21 to 0.21_01. +.IP "\(bu" 4 +Memoize has been upgraded from version 1.03 to 1.03_01. +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 5.20160506 to 5.20170114_24. +.IP "\(bu" 4 +Net::Ping has been upgraded from version 2.43 to 2.43_01. +.IP "\(bu" 4 +Parse::CPAN::Meta has been upgraded from version 1.4417 to 1.4417_001. +.IP "\(bu" 4 +Pod::Html has been upgraded from version 1.22 to 1.2201. +.IP "\(bu" 4 +Pod::Perldoc has been upgraded from version 3.25_02 to 3.25_03. +.IP "\(bu" 4 +Storable has been upgraded from version 2.56 to 2.56_01. +.IP "\(bu" 4 +Sys::Syslog has been upgraded from version 0.33 to 0.33_01. +.IP "\(bu" 4 +Test has been upgraded from version 1.28 to 1.28_01. +.IP "\(bu" 4 +Test::Harness has been upgraded from version 3.36 to 3.36_01. +.IP "\(bu" 4 +XSLoader has been upgraded from version 0.21 to 0.22, fixing a security hole +in which binary files could be loaded from a path outside of \f(CW@INC\fR. +[perl #128528] +.SH "Documentation" +.IX Header "Documentation" +.SS "Changes to Existing Documentation" +.IX Subsection "Changes to Existing Documentation" +\fIperlapio\fR +.IX Subsection "perlapio" +.IP "\(bu" 4 +The documentation of \f(CW\*(C`PERLIO_DEBUG\*(C'\fR has been updated. +.PP +\fIperlrun\fR +.IX Subsection "perlrun" +.IP "\(bu" 4 +The new \fB\-Di\fR switch has been documented, and the documentation of +\&\f(CW\*(C`PERLIO_DEBUG\*(C'\fR has been updated. +.SH "Testing" +.IX Header "Testing" +.IP "\(bu" 4 +A new test script, \fIt/run/switchDx.t\fR, has been added to test that the new +\&\fB\-Di\fR switch is working correctly. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +The change to hashbang redirection introduced in Perl 5.24.0, whereby perl +would redirect to another interpreter (Perl 6) if it found a hashbang path +which contains \*(L"perl\*(R" followed by \*(L"6\*(R", has been reverted because it broke in +cases such as \f(CW\*(C`#!/opt/perl64/bin/perl\*(C'\fR. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.24.1 represents approximately 8 months of development since Perl 5.24.0 +and contains approximately 8,100 lines of changes across 240 files from 18 +authors. +.PP +Excluding auto-generated files, documentation and release tools, there were +approximately 2,200 lines of changes to 170 .pm, .t, .c and .h files. +.PP +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed +the improvements that became Perl 5.24.1: +.PP +Aaron Crane, Alex Vandiver, Aristotle Pagaltzis, Chad Granum, Chris 'BinGOs' +Williams, Craig A. Berry, Father Chrysostomos, James E Keenan, Jarkko +Hietaniemi, Karen Etheridge, Leon Timmermans, Matthew Horsfall, Ricardo Signes, +Sawyer X, Se\*'bastien Aperghis-Tramoni, Stevan Little, Steve Hay, Tony Cook. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles recently +posted to the comp.lang.perl.misc newsgroup and the Perl bug database at + . There may also be information at + , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug program +included with your release. Be sure to trim your bug down to a tiny but +sufficient test case. Your bug report, along with the output of \f(CW\*(C`perl \-V\*(C'\fR, +will be sent off to perlbug@perl.org to be analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications which make it +inappropriate to send to a publicly archived mailing list, then see +\&\*(L"\s-1SECURITY VULNERABILITY CONTACT INFORMATION\*(R"\s0 in perlsec for details of how to +report the issue. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5260delta.1 b/data/miniconda3/man/man1/perl5260delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..fb77f5bfaa4b8c618151565913617ebd5c2419db --- /dev/null +++ b/data/miniconda3/man/man1/perl5260delta.1 @@ -0,0 +1,2559 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5260DELTA 1" +.TH PERL5260DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5260delta \- what is new for perl v5.26.0 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes the differences between the 5.24.0 release and the +5.26.0 release. +.SH "Notice" +.IX Header "Notice" +This release includes three updates with widespread effects: +.IP "\(bu" 4 +\&\f(CW"."\fR no longer in \f(CW@INC\fR +.Sp +For security reasons, the current directory (\f(CW"."\fR) is no longer included +by default at the end of the module search path (\f(CW@INC\fR). This may have +widespread implications for the building, testing and installing of +modules, and for the execution of scripts. See the section +"Removal of the current directory (\f(CW"."\fR) from \f(CW@INC\fR" +for the full details. +.IP "\(bu" 4 +\&\f(CW\*(C`do\*(C'\fR may now warn +.Sp +\&\f(CW\*(C`do\*(C'\fR now gives a deprecation warning when it fails to load a file which +it would have loaded had \f(CW"."\fR been in \f(CW@INC\fR. +.IP "\(bu" 4 +In regular expression patterns, a literal left brace \f(CW"{"\fR +should be escaped +.Sp +See "Unescaped literal \f(CW"{"\fR characters in regular expression patterns are no longer permissible". +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.SS "Lexical subroutines are no longer experimental" +.IX Subsection "Lexical subroutines are no longer experimental" +Using the \f(CW\*(C`lexical_subs\*(C'\fR feature introduced in v5.18 no longer emits a warning. Existing +code that disables the \f(CW\*(C`experimental::lexical_subs\*(C'\fR warning category +that the feature previously used will continue to work. The +\&\f(CW\*(C`lexical_subs\*(C'\fR feature has no effect; all Perl code can use lexical +subroutines, regardless of what feature declarations are in scope. +.SS "Indented Here-documents" +.IX Subsection "Indented Here-documents" +This adds a new modifier \f(CW"~"\fR to here-docs that tells the parser +that it should look for \f(CW\*(C`/^\es*$DELIM\en/\*(C'\fR as the closing delimiter. +.PP +These syntaxes are all supported: +.PP +.Vb 8 +\& <<~EOF; +\& <<~\eEOF; +\& <<~\*(AqEOF\*(Aq; +\& <<~"EOF"; +\& <<~\`EOF\`; +\& <<~ \*(AqEOF\*(Aq; +\& <<~ "EOF"; +\& <<~ \`EOF\`; +.Ve +.PP +The \f(CW"~"\fR modifier will strip, from each line in the here-doc, the +same whitespace that appears before the delimiter. +.PP +Newlines will be copied as-is, and lines that don't include the +proper beginning whitespace will cause perl to croak. +.PP +For example: +.PP +.Vb 5 +\& if (1) { +\& print <<~EOF; +\& Hello there +\& EOF +\& } +.Ve +.PP +prints \*(L"Hello there\en\*(R" with no leading whitespace. +.ie n .SS "New regular expression modifier ""/xx""" +.el .SS "New regular expression modifier \f(CW/xx\fP" +.IX Subsection "New regular expression modifier /xx" +Specifying two \f(CW"x"\fR characters to modify a regular expression pattern +does everything that a single one does, but additionally \s-1TAB\s0 and \s-1SPACE\s0 +characters within a bracketed character class are generally ignored and +can be added to improve readability, like +\&\f(CW\*(C`/[\ ^\ A\-Z\ d\-f\ p\-x\ ]/xx\*(C'\fR. Details are at +\&\*(L"/x and /xx\*(R" in perlre. +.ie n .SS """@{^CAPTURE}"", ""%{^CAPTURE}"", and ""%{^CAPTURE_ALL}""" +.el .SS "\f(CW@{^CAPTURE}\fP, \f(CW%{^CAPTURE}\fP, and \f(CW%{^CAPTURE_ALL}\fP" +.IX Subsection "@{^CAPTURE}, %{^CAPTURE}, and %{^CAPTURE_ALL}" +\&\f(CW\*(C`@{^CAPTURE}\*(C'\fR exposes the capture buffers of the last match as an +array. So \f(CW$1\fR is \f(CW\*(C`${^CAPTURE}[0]\*(C'\fR. This is a more efficient equivalent +to code like \f(CW\*(C`substr($matched_string,$\-[0],$+[0]\-$\-[0])\*(C'\fR, and you don't +have to keep track of the \f(CW$matched_string\fR either. This variable has no +single character equivalent. Note that, like the other regex magic variables, +the contents of this variable is dynamic; if you wish to store it beyond +the lifetime of the match you must copy it to another array. +.PP +\&\f(CW\*(C`%{^CAPTURE}\*(C'\fR is equivalent to \f(CW\*(C`%+\*(C'\fR (\fIi.e.\fR, named captures). Other than +being more self-documenting there is no difference between the two forms. +.PP +\&\f(CW\*(C`%{^CAPTURE_ALL}\*(C'\fR is equivalent to \f(CW\*(C`%\-\*(C'\fR (\fIi.e.\fR, all named captures). +Other than being more self-documenting there is no difference between the +two forms. +.SS "Declaring a reference to a variable" +.IX Subsection "Declaring a reference to a variable" +As an experimental feature, Perl now allows the referencing operator to come +after \f(CW\*(C`my()\*(C'\fR, \f(CW\*(C`state()\*(C'\fR, +\&\f(CW\*(C`our()\*(C'\fR, or \f(CW\*(C`local()\*(C'\fR. This syntax must +be enabled with \f(CW\*(C`use feature \*(Aqdeclared_refs\*(Aq\*(C'\fR. It is experimental, and will +warn by default unless \f(CW\*(C`no warnings \*(Aqexperimental::refaliasing\*(Aq\*(C'\fR is in effect. +It is intended mainly for use in assignments to references. For example: +.PP +.Vb 2 +\& use experimental \*(Aqrefaliasing\*(Aq, \*(Aqdeclared_refs\*(Aq; +\& my \e$a = \e$b; +.Ve +.PP +See \*(L"Assigning to References\*(R" in perlref for more details. +.SS "Unicode 9.0 is now supported" +.IX Subsection "Unicode 9.0 is now supported" +A list of changes is at . +Modules that are shipped with core Perl but not maintained by p5p do not +necessarily support Unicode 9.0. Unicode::Normalize does work on 9.0. +.ie n .SS "Use of ""\ep{\f(CIscript\fP}"" uses the improved Script_Extensions property" +.el .SS "Use of \f(CW\ep{\fP\f(CIscript\fP\f(CW}\fP uses the improved Script_Extensions property" +.IX Subsection "Use of p{script} uses the improved Script_Extensions property" +Unicode 6.0 introduced an improved form of the Script (\f(CW\*(C`sc\*(C'\fR) property, and +called it Script_Extensions (\f(CW\*(C`scx\*(C'\fR). Perl now uses this improved +version when a property is specified as just \f(CW\*(C`\ep{\f(CIscript\f(CW}\*(C'\fR. This +should make programs more accurate when determining if a character is +used in a given script, but there is a slight chance of breakage for +programs that very specifically needed the old behavior. The meaning of +compound forms, like \f(CW\*(C`\ep{sc=\f(CIscript\f(CW}\*(C'\fR are unchanged. See +\&\*(L"Scripts\*(R" in perlunicode. +.SS "Perl can now do default collation in \s-1UTF\-8\s0 locales on platforms that support it" +.IX Subsection "Perl can now do default collation in UTF-8 locales on platforms that support it" +Some platforms natively do a reasonable job of collating and sorting in +\&\s-1UTF\-8\s0 locales. Perl now works with those. For portability and full +control, Unicode::Collate is still recommended, but now you may +not need to do anything special to get good-enough results, depending on +your application. See +"Category \f(CW\*(C`LC_COLLATE\*(C'\fR: Collation: Text Comparisons and Sorting" in perllocale. +.ie n .SS "Better locale collation of strings containing embedded ""NUL"" characters" +.el .SS "Better locale collation of strings containing embedded \f(CWNUL\fP characters" +.IX Subsection "Better locale collation of strings containing embedded NUL characters" +In locales that have multi-level character weights, \f(CW\*(C`NUL\*(C'\fRs are now +ignored at the higher priority ones. There are still some gotchas in +some strings, though. See +"Collation of strings containing embedded \f(CW\*(C`NUL\*(C'\fR characters" in perllocale. +.ie n .SS """CORE"" subroutines for hash and array functions callable via reference" +.el .SS "\f(CWCORE\fP subroutines for hash and array functions callable via reference" +.IX Subsection "CORE subroutines for hash and array functions callable via reference" +The hash and array functions in the \f(CW\*(C`CORE\*(C'\fR namespace (\f(CW\*(C`keys\*(C'\fR, \f(CW\*(C`each\*(C'\fR, +\&\f(CW\*(C`values\*(C'\fR, \f(CW\*(C`push\*(C'\fR, \f(CW\*(C`pop\*(C'\fR, \f(CW\*(C`shift\*(C'\fR, \f(CW\*(C`unshift\*(C'\fR and \f(CW\*(C`splice\*(C'\fR) can now +be called with ampersand syntax (\f(CW\*(C`&CORE::keys(\e%hash\*(C'\fR) and via reference +(\f(CW\*(C`my $k = \e&CORE::keys; $k\->(\e%hash)\*(C'\fR). Previously they could only be +used when inlined. +.SS "New Hash Function For 64\-bit Builds" +.IX Subsection "New Hash Function For 64-bit Builds" +We have switched to a hybrid hash function to better balance +performance for short and long keys. +.PP +For short keys, 16 bytes and under, we use an optimised variant of +One At A Time Hard, and for longer keys we use Siphash 1\-3. For very +long keys this is a big improvement in performance. For shorter keys +there is a modest improvement. +.SH "Security" +.IX Header "Security" +.ie n .SS "Removal of the current directory (""."") from @INC" +.el .SS "Removal of the current directory (\f(CW``.''\fP) from \f(CW@INC\fP" +.IX Subsection "Removal of the current directory (""."") from @INC" +The perl binary includes a default set of paths in \f(CW@INC\fR. Historically +it has also included the current directory (\f(CW"."\fR) as the final entry, +unless run with taint mode enabled (\f(CW\*(C`perl \-T\*(C'\fR). While convenient, this has +security implications: for example, where a script attempts to load an +optional module when its current directory is untrusted (such as \fI/tmp\fR), +it could load and execute code from under that directory. +.PP +Starting with v5.26, \f(CW"."\fR is always removed by default, not just under +tainting. This has major implications for installing modules and executing +scripts. +.PP +The following new features have been added to help ameliorate these +issues. +.IP "\(bu" 4 +\&\fIConfigure \-Udefault_inc_excludes_dot\fR +.Sp +There is a new \fIConfigure\fR option, \f(CW\*(C`default_inc_excludes_dot\*(C'\fR (enabled +by default) which builds a perl executable without \f(CW"."\fR; unsetting this +option using \f(CW\*(C`\-U\*(C'\fR reverts perl to the old behaviour. This may fix your +path issues but will reintroduce all the security concerns, so don't +build a perl executable like this unless you're \fIreally\fR confident that +such issues are not a concern in your environment. +.IP "\(bu" 4 +\&\f(CW\*(C`PERL_USE_UNSAFE_INC\*(C'\fR +.Sp +There is a new environment variable recognised by the perl interpreter. +If this variable has the value 1 when the perl interpreter starts up, +then \f(CW"."\fR will be automatically appended to \f(CW@INC\fR (except under tainting). +.Sp +This allows you restore the old perl interpreter behaviour on a +case-by-case basis. But note that this is intended to be a temporary crutch, +and this feature will likely be removed in some future perl version. +It is currently set by the \f(CW\*(C`cpan\*(C'\fR utility and \f(CW\*(C`Test::Harness\*(C'\fR to +ease installation of \s-1CPAN\s0 modules which have not been updated to handle the +lack of dot. Once again, don't use this unless you are sure that this +will not reintroduce any security concerns. +.IP "\(bu" 4 +A new deprecation warning issued by \f(CW\*(C`do\*(C'\fR. +.Sp +While it is well-known that \f(CW\*(C`use\*(C'\fR and \f(CW\*(C`require\*(C'\fR use \f(CW@INC\fR to search +for the file to load, many people don't realise that \f(CW\*(C`do "file"\*(C'\fR also +searches \f(CW@INC\fR if the file is a relative path. With the removal of \f(CW"."\fR, +a simple \f(CW\*(C`do "file.pl"\*(C'\fR will fail to read in and execute \f(CW\*(C`file.pl\*(C'\fR from +the current directory. Since this is commonly expected behaviour, a new +deprecation warning is now issued whenever \f(CW\*(C`do\*(C'\fR fails to load a file which +it otherwise would have found if a dot had been in \f(CW@INC\fR. +.PP +Here are some things script and module authors may need to do to make +their software work in the new regime. +.IP "\(bu" 4 +Script authors +.Sp +If the issue is within your own code (rather than within included +modules), then you have two main options. Firstly, if you are confident +that your script will only be run within a trusted directory (under which +you expect to find trusted files and modules), then add \f(CW"."\fR back into the +path; \fIe.g.\fR: +.Sp +.Vb 6 +\& BEGIN { +\& my $dir = "/some/trusted/directory"; +\& chdir $dir or die "Can\*(Aqt chdir to $dir: $!\en"; +\& # safe now +\& push @INC, \*(Aq.\*(Aq; +\& } +\& +\& use "Foo::Bar"; # may load /some/trusted/directory/Foo/Bar.pm +\& do "config.pl"; # may load /some/trusted/directory/config.pl +.Ve +.Sp +On the other hand, if your script is intended to be run from within +untrusted directories (such as \fI/tmp\fR), then your script suddenly failing +to load files may be indicative of a security issue. You most likely want +to replace any relative paths with full paths; for example, +.Sp +.Vb 1 +\& do "foo_config.pl" +.Ve +.Sp +might become +.Sp +.Vb 1 +\& do "$ENV{HOME}/foo_config.pl" +.Ve +.Sp +If you are absolutely certain that you want your script to load and +execute a file from the current directory, then use a \f(CW\*(C`./\*(C'\fR prefix; for +example: +.Sp +.Vb 1 +\& do "./foo_config.pl" +.Ve +.IP "\(bu" 4 +Installing and using \s-1CPAN\s0 modules +.Sp +If you install a \s-1CPAN\s0 module using an automatic tool like \f(CW\*(C`cpan\*(C'\fR, then +this tool will itself set the \f(CW\*(C`PERL_USE_UNSAFE_INC\*(C'\fR environment variable +while building and testing the module, which may be sufficient to install +a distribution which hasn't been updated to be dot-aware. If you want to +install such a module manually, then you'll need to replace the +traditional invocation: +.Sp +.Vb 1 +\& perl Makefile.PL && make && make test && make install +.Ve +.Sp +with something like +.Sp +.Vb 2 +\& (export PERL_USE_UNSAFE_INC=1; \e +\& perl Makefile.PL && make && make test && make install) +.Ve +.Sp +Note that this only helps build and install an unfixed module. It's +possible for the tests to pass (since they were run under +\&\f(CW\*(C`PERL_USE_UNSAFE_INC=1\*(C'\fR), but for the module itself to fail to perform +correctly in production. In this case, you may have to temporarily modify +your script until a fixed version of the module is released. +For example: +.Sp +.Vb 6 +\& use Foo::Bar; +\& { +\& local @INC = (@INC, \*(Aq.\*(Aq); +\& # assuming read_config() needs \*(Aq.\*(Aq in @INC +\& $config = Foo::Bar\->read_config(); +\& } +.Ve +.Sp +This is only rarely expected to be necessary. Again, if doing this, +assess the resultant risks first. +.IP "\(bu" 4 +Module Authors +.Sp +If you maintain a \s-1CPAN\s0 distribution, it may need updating to run in +a dotless environment. Although \f(CW\*(C`cpan\*(C'\fR and other such tools will +currently set the \f(CW\*(C`PERL_USE_UNSAFE_INC\*(C'\fR during module build, this is a +temporary workaround for the set of modules which rely on \f(CW"."\fR being in +\&\f(CW@INC\fR for installation and testing, and this may mask deeper issues. It +could result in a module which passes tests and installs, but which +fails at run time. +.Sp +During build, test, and install, it will normally be the case that any perl +processes will be executing directly within the root directory of the +untarred distribution, or a known subdirectory of that, such as \fIt/\fR. It +may well be that \fIMakefile.PL\fR or \fIt/foo.t\fR will attempt to include +local modules and configuration files using their direct relative +filenames, which will now fail. +.Sp +However, as described above, automatic tools like \fIcpan\fR will (for now) +set the \f(CW\*(C`PERL_USE_UNSAFE_INC\*(C'\fR environment variable, which introduces +dot during a build. +.Sp +This makes it likely that your existing build and test code will work, but +this may mask issues with your code which only manifest when used after +install. It is prudent to try and run your build process with that +variable explicitly disabled: +.Sp +.Vb 2 +\& (export PERL_USE_UNSAFE_INC=0; \e +\& perl Makefile.PL && make && make test && make install) +.Ve +.Sp +This is more likely to show up any potential problems with your module's +build process, or even with the module itself. Fixing such issues will +ensure both that your module can again be installed manually, and that +it will still build once the \f(CW\*(C`PERL_USE_UNSAFE_INC\*(C'\fR crutch goes away. +.Sp +When fixing issues in tests due to the removal of dot from \f(CW@INC\fR, +reinsertion of dot into \f(CW@INC\fR should be performed with caution, for this +too may suppress real errors in your runtime code. You are encouraged +wherever possible to apply the aforementioned approaches with explicit +absolute/relative paths, or to relocate your needed files into a +subdirectory and insert that subdirectory into \f(CW@INC\fR instead. +.Sp +If your runtime code has problems under the dotless \f(CW@INC\fR, then the comments +above on how to fix for script authors will mostly apply here too. Bear in +mind though that it is considered bad form for a module to globally add a dot to +\&\f(CW@INC\fR, since it introduces both a security risk and hides issues of +accidentally requiring dot in \f(CW@INC\fR, as explained above. +.SS "Escaped colons and relative paths in \s-1PATH\s0" +.IX Subsection "Escaped colons and relative paths in PATH" +On Unix systems, Perl treats any relative paths in the \f(CW\*(C`PATH\*(C'\fR environment +variable as tainted when starting a new process. Previously, it was +allowing a backslash to escape a colon (unlike the \s-1OS\s0), consequently +allowing relative paths to be considered safe if the \s-1PATH\s0 was set to +something like \f(CW\*(C`/\e:.\*(C'\fR. The check has been fixed to treat \f(CW"."\fR as tainted +in that example. +.ie n .SS "New ""\-Di"" switch is now required for PerlIO debugging output" +.el .SS "New \f(CW\-Di\fP switch is now required for PerlIO debugging output" +.IX Subsection "New -Di switch is now required for PerlIO debugging output" +This is used for debugging of code within PerlIO to avoid recursive +calls. Previously this output would be sent to the file specified +by the \f(CW\*(C`PERLIO_DEBUG\*(C'\fR environment variable if perl wasn't running +setuid and the \f(CW\*(C`\-T\*(C'\fR or \f(CW\*(C`\-t\*(C'\fR switches hadn't been parsed yet. +.PP +If perl performed output at a point where it hadn't yet parsed its +switches this could result in perl creating or overwriting the file +named by \f(CW\*(C`PERLIO_DEBUG\*(C'\fR even when the \f(CW\*(C`\-T\*(C'\fR switch had been supplied. +.PP +Perl now requires the \f(CW\*(C`\-Di\*(C'\fR switch to be present before it will produce +PerlIO debugging +output. By default this is written to \f(CW\*(C`stderr\*(C'\fR, but can optionally +be redirected to a file by setting the \f(CW\*(C`PERLIO_DEBUG\*(C'\fR environment +variable. +.PP +If perl is running setuid or the \f(CW\*(C`\-T\*(C'\fR switch was supplied, +\&\f(CW\*(C`PERLIO_DEBUG\*(C'\fR is ignored and the debugging output is sent to +\&\f(CW\*(C`stderr\*(C'\fR as for any other \f(CW\*(C`\-D\*(C'\fR switch. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +.ie n .SS "Unescaped literal ""{"" characters in regular expression patterns are no longer permissible" +.el .SS "Unescaped literal \f(CW``{''\fP characters in regular expression patterns are no longer permissible" +.IX Subsection "Unescaped literal ""{"" characters in regular expression patterns are no longer permissible" +You have to now say something like \f(CW"\e{"\fR or \f(CW"[{]"\fR to specify to +match a \s-1LEFT CURLY BRACKET\s0; otherwise, it is a fatal pattern compilation +error. This change will allow future extensions to the language. +.PP +These have been deprecated since v5.16, with a deprecation message +raised for some uses starting in v5.22. Unfortunately, the code added +to raise the message was buggy and failed to warn in some cases where +it should have. Therefore, enforcement of this ban for these cases is +deferred until Perl 5.30, but the code has been fixed to raise a +default-on deprecation message for them in the meantime. +.PP +Some uses of literal \f(CW"{"\fR occur in contexts where we do not foresee +the meaning ever being anything but the literal, such as the very first +character in the pattern, or after a \f(CW"|"\fR meaning alternation. Thus +.PP +.Vb 1 +\& qr/{fee|{fie/ +.Ve +.PP +matches either of the strings \f(CW\*(C`{fee\*(C'\fR or \f(CW\*(C`{fie\*(C'\fR. To avoid forcing +unnecessary code changes, these uses do not need to be escaped, and no +warning is raised about them, and there are no current plans to change this. +.PP +But it is always correct to escape \f(CW"{"\fR, and the simple rule to +remember is to always do so. +.PP +See Unescaped left brace in regex is illegal here. +.ie n .SS """scalar(%hash)"" return signature changed" +.el .SS "\f(CWscalar(%hash)\fP return signature changed" +.IX Subsection "scalar(%hash) return signature changed" +The value returned for \f(CW\*(C`scalar(%hash)\*(C'\fR will no longer show information about +the buckets allocated in the hash. It will simply return the count of used +keys. It is thus equivalent to \f(CW\*(C`0+keys(%hash)\*(C'\fR. +.PP +A form of backward compatibility is provided via +\&\f(CW\*(C`Hash::Util::bucket_ratio()\*(C'\fR which provides +the same behavior as +\&\f(CW\*(C`scalar(%hash)\*(C'\fR provided in Perl 5.24 and earlier. +.ie n .SS """keys"" returned from an lvalue subroutine" +.el .SS "\f(CWkeys\fP returned from an lvalue subroutine" +.IX Subsection "keys returned from an lvalue subroutine" +\&\f(CW\*(C`keys\*(C'\fR returned from an lvalue subroutine can no longer be assigned +to in list context. +.PP +.Vb 4 +\& sub foo : lvalue { keys(%INC) } +\& (foo) = 3; # death +\& sub bar : lvalue { keys(@_) } +\& (bar) = 3; # also an error +.Ve +.PP +This makes the lvalue sub case consistent with \f(CW\*(C`(keys %hash) = ...\*(C'\fR and +\&\f(CW\*(C`(keys @_) = ...\*(C'\fR, which are also errors. +[perl #128187] +.ie n .SS "The ""${^ENCODING}"" facility has been removed" +.el .SS "The \f(CW${^ENCODING}\fP facility has been removed" +.IX Subsection "The ${^ENCODING} facility has been removed" +The special behaviour associated with assigning a value to this variable +has been removed. As a consequence, the encoding pragma's default mode +is no longer supported. If +you still need to write your source code in encodings other than \s-1UTF\-8,\s0 use a +source filter such as Filter::Encoding on \s-1CPAN\s0 or encoding's \f(CW\*(C`Filter\*(C'\fR +option. +.ie n .SS """POSIX::tmpnam()"" has been removed" +.el .SS "\f(CWPOSIX::tmpnam()\fP has been removed" +.IX Subsection "POSIX::tmpnam() has been removed" +The fundamentally unsafe \f(CW\*(C`tmpnam()\*(C'\fR interface was deprecated in +Perl 5.22 and has now been removed. In its place, you can use, +for example, the File::Temp interfaces. +.SS "require ::Foo::Bar is now illegal." +.IX Subsection "require ::Foo::Bar is now illegal." +Formerly, \f(CW\*(C`require ::Foo::Bar\*(C'\fR would try to read \fI/Foo/Bar.pm\fR. Now any +bareword require which starts with a double colon dies instead. +.SS "Literal control character variable names are no longer permissible" +.IX Subsection "Literal control character variable names are no longer permissible" +A variable name may no longer contain a literal control character under +any circumstances. These previously were allowed in single-character +names on \s-1ASCII\s0 platforms, but have been deprecated there since Perl +5.20. This affects things like \f(CW\*(C`$\f(CI\ecT\f(CW\*(C'\fR, where \fI\ecT\fR is a literal +control (such as a \f(CW\*(C`NAK\*(C'\fR or \f(CW\*(C`NEGATIVE ACKNOWLEDGE\*(C'\fR character) in the +source code. +.ie n .SS """NBSP"" is no longer permissible in ""\eN{...}""" +.el .SS "\f(CWNBSP\fP is no longer permissible in \f(CW\eN{...}\fP" +.IX Subsection "NBSP is no longer permissible in N{...}" +The name of a character may no longer contain non-breaking spaces. It +has been deprecated to do so since Perl 5.22. +.SH "Deprecations" +.IX Header "Deprecations" +.SS "String delimiters that aren't stand-alone graphemes are now deprecated" +.IX Subsection "String delimiters that aren't stand-alone graphemes are now deprecated" +For Perl to eventually allow string delimiters to be Unicode +grapheme clusters (which look like a single character, but may be +a sequence of several ones), we have to stop allowing a single character +delimiter that isn't a grapheme by itself. These are unlikely to exist +in actual code, as they would typically display as attached to the +character in front of them. +.ie n .SS """\ec\f(CIX\fP"" that maps to a printable is no longer deprecated" +.el .SS "\f(CW\ec\fP\f(CIX\fP\f(CW\fP that maps to a printable is no longer deprecated" +.IX Subsection "cX that maps to a printable is no longer deprecated" +This means we have no plans to remove this feature. It still raises a +warning, but only if syntax warnings are enabled. The feature was +originally intended to be a way to express non-printable characters that +don't have a mnemonic (\f(CW\*(C`\et\*(C'\fR and \f(CW\*(C`\en\*(C'\fR are mnemonics for two +non-printable characters, but most non-printables don't have a +mnemonic.) But the feature can be used to specify a few printable +characters, though those are more clearly expressed as the printable +itself. See +. +.SH "Performance Enhancements" +.IX Header "Performance Enhancements" +.IP "\(bu" 4 +A hash in boolean context is now sometimes faster, \fIe.g.\fR +.Sp +.Vb 1 +\& if (!%h) { ... } +.Ve +.Sp +This was already special-cased, but some cases were missed (such as +\&\f(CW\*(C`grep %$_, @AoH\*(C'\fR), and even the ones which weren't have been improved. +.IP "\(bu" 4 +New Faster Hash Function on 64 bit builds +.Sp +We use a different hash function for short and long keys. This should +improve performance and security, especially for long keys. +.IP "\(bu" 4 +readline is faster +.Sp +Reading from a file line-by-line with \f(CW\*(C`readline()\*(C'\fR or \f(CW\*(C`<>\*(C'\fR should +now typically be faster due to a better implementation of the code that +searches for the next newline character. +.IP "\(bu" 4 +Assigning one reference to another, \fIe.g.\fR \f(CW\*(C`$ref1 = $ref2\*(C'\fR has been +optimized in some cases. +.IP "\(bu" 4 +Remove some exceptions to creating Copy-on-Write strings. The string +buffer growth algorithm has been slightly altered so that you're less +likely to encounter a string which can't be COWed. +.IP "\(bu" 4 +Better optimise array and hash assignment: where an array or hash appears +in the \s-1LHS\s0 of a list assignment, such as \f(CW\*(C`(..., @a) = (...);\*(C'\fR, it's +likely to be considerably faster, especially if it involves emptying the +array/hash. For example, this code runs about a third faster compared to +Perl 5.24.0: +.Sp +.Vb 5 +\& my @a; +\& for my $i (1..10_000_000) { +\& @a = (1,2,3); +\& @a = (); +\& } +.Ve +.IP "\(bu" 4 +Converting a single-digit string to a number is now substantially faster. +.IP "\(bu" 4 +The \f(CW\*(C`split\*(C'\fR builtin is now slightly faster in many cases: in particular +for the two specially-handled forms +.Sp +.Vb 2 +\& my @a = split ...; +\& local @a = split ...; +.Ve +.IP "\(bu" 4 +The rather slow implementation for the experimental subroutine signatures +feature has been made much faster; it is now comparable in speed with the +traditional \f(CW\*(C`my ($a, $b, @c) = @_\*(C'\fR. +.IP "\(bu" 4 +Bareword constant strings are now permitted to take part in constant +folding. They were originally exempted from constant folding in August 1999, +during the development of Perl 5.6, to ensure that \f(CW\*(C`use strict "subs"\*(C'\fR +would still apply to bareword constants. That has now been accomplished a +different way, so barewords, like other constants, now gain the performance +benefits of constant folding. +.Sp +This also means that void-context warnings on constant expressions of +barewords now report the folded constant operand, rather than the operation; +this matches the behaviour for non-bareword constants. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +IO::Compress has been upgraded from version 2.069 to 2.074. +.IP "\(bu" 4 +Archive::Tar has been upgraded from version 2.04 to 2.24. +.IP "\(bu" 4 +arybase has been upgraded from version 0.11 to 0.12. +.IP "\(bu" 4 +attributes has been upgraded from version 0.27 to 0.29. +.Sp +The deprecation message for the \f(CW\*(C`:unique\*(C'\fR and \f(CW\*(C`:locked\*(C'\fR attributes +now mention that they will disappear in Perl 5.28. +.IP "\(bu" 4 +B has been upgraded from version 1.62 to 1.68. +.IP "\(bu" 4 +B::Concise has been upgraded from version 0.996 to 0.999. +.Sp +Its output is now more descriptive for \f(CW\*(C`op_private\*(C'\fR flags. +.IP "\(bu" 4 +B::Debug has been upgraded from version 1.23 to 1.24. +.IP "\(bu" 4 +B::Deparse has been upgraded from version 1.37 to 1.40. +.IP "\(bu" 4 +B::Xref has been upgraded from version 1.05 to 1.06. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +base has been upgraded from version 2.23 to 2.25. +.IP "\(bu" 4 +bignum has been upgraded from version 0.42 to 0.47. +.IP "\(bu" 4 +Carp has been upgraded from version 1.40 to 1.42. +.IP "\(bu" 4 +charnames has been upgraded from version 1.43 to 1.44. +.IP "\(bu" 4 +Compress::Raw::Bzip2 has been upgraded from version 2.069 to 2.074. +.IP "\(bu" 4 +Compress::Raw::Zlib has been upgraded from version 2.069 to 2.074. +.IP "\(bu" 4 +Config::Perl::V has been upgraded from version 0.25 to 0.28. +.IP "\(bu" 4 +\&\s-1CPAN\s0 has been upgraded from version 2.11 to 2.18. +.IP "\(bu" 4 +CPAN::Meta has been upgraded from version 2.150005 to 2.150010. +.IP "\(bu" 4 +Data::Dumper has been upgraded from version 2.160 to 2.167. +.Sp +The \s-1XS\s0 implementation now supports Deparse. +.IP "\(bu" 4 +DB_File has been upgraded from version 1.835 to 1.840. +.IP "\(bu" 4 +Devel::Peek has been upgraded from version 1.23 to 1.26. +.IP "\(bu" 4 +Devel::PPPort has been upgraded from version 3.32 to 3.35. +.IP "\(bu" 4 +Devel::SelfStubber has been upgraded from version 1.05 to 1.06. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +diagnostics has been upgraded from version 1.34 to 1.36. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +Digest has been upgraded from version 1.17 to 1.17_01. +.IP "\(bu" 4 +Digest::MD5 has been upgraded from version 2.54 to 2.55. +.IP "\(bu" 4 +Digest::SHA has been upgraded from version 5.95 to 5.96. +.IP "\(bu" 4 +DynaLoader has been upgraded from version 1.38 to 1.42. +.IP "\(bu" 4 +Encode has been upgraded from version 2.80 to 2.88. +.IP "\(bu" 4 +encoding has been upgraded from version 2.17 to 2.19. +.Sp +This module's default mode is no longer supported. It now +dies when imported, unless the \f(CW\*(C`Filter\*(C'\fR option is being used. +.IP "\(bu" 4 +encoding::warnings has been upgraded from version 0.12 to 0.13. +.Sp +This module is no longer supported. It emits a warning to +that effect and then does nothing. +.IP "\(bu" 4 +Errno has been upgraded from version 1.25 to 1.28. +.Sp +It now documents that using \f(CW\*(C`%!\*(C'\fR automatically loads Errno for you. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +ExtUtils::Embed has been upgraded from version 1.33 to 1.34. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +ExtUtils::MakeMaker has been upgraded from version 7.10_01 to 7.24. +.IP "\(bu" 4 +ExtUtils::Miniperl has been upgraded from version 1.05 to 1.06. +.IP "\(bu" 4 +ExtUtils::ParseXS has been upgraded from version 3.31 to 3.34. +.IP "\(bu" 4 +ExtUtils::Typemaps has been upgraded from version 3.31 to 3.34. +.IP "\(bu" 4 +feature has been upgraded from version 1.42 to 1.47. +.IP "\(bu" 4 +File::Copy has been upgraded from version 2.31 to 2.32. +.IP "\(bu" 4 +File::Fetch has been upgraded from version 0.48 to 0.52. +.IP "\(bu" 4 +File::Glob has been upgraded from version 1.26 to 1.28. +.Sp +It now Issues a deprecation message for \f(CW\*(C`File::Glob::glob()\*(C'\fR. +.IP "\(bu" 4 +File::Spec has been upgraded from version 3.63 to 3.67. +.IP "\(bu" 4 +FileHandle has been upgraded from version 2.02 to 2.03. +.IP "\(bu" 4 +Filter::Simple has been upgraded from version 0.92 to 0.93. +.Sp +It no longer treats \f(CW\*(C`no MyFilter\*(C'\fR immediately following \f(CW\*(C`use MyFilter\*(C'\fR as +end-of-file. +[perl #107726] +.IP "\(bu" 4 +Getopt::Long has been upgraded from version 2.48 to 2.49. +.IP "\(bu" 4 +Getopt::Std has been upgraded from version 1.11 to 1.12. +.IP "\(bu" 4 +Hash::Util has been upgraded from version 0.19 to 0.22. +.IP "\(bu" 4 +HTTP::Tiny has been upgraded from version 0.056 to 0.070. +.Sp +Internal 599\-series errors now include the redirect history. +.IP "\(bu" 4 +I18N::LangTags has been upgraded from version 0.40 to 0.42. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +\&\s-1IO\s0 has been upgraded from version 1.36 to 1.38. +.IP "\(bu" 4 +IO::Socket::IP has been upgraded from version 0.37 to 0.38. +.IP "\(bu" 4 +IPC::Cmd has been upgraded from version 0.92 to 0.96. +.IP "\(bu" 4 +IPC::SysV has been upgraded from version 2.06_01 to 2.07. +.IP "\(bu" 4 +\&\s-1JSON::PP\s0 has been upgraded from version 2.27300 to 2.27400_02. +.IP "\(bu" 4 +lib has been upgraded from version 0.63 to 0.64. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +List::Util has been upgraded from version 1.42_02 to 1.46_02. +.IP "\(bu" 4 +Locale::Codes has been upgraded from version 3.37 to 3.42. +.IP "\(bu" 4 +Locale::Maketext has been upgraded from version 1.26 to 1.28. +.IP "\(bu" 4 +Locale::Maketext::Simple has been upgraded from version 0.21 to 0.21_01. +.IP "\(bu" 4 +Math::BigInt has been upgraded from version 1.999715 to 1.999806. +.IP "\(bu" 4 +Math::BigInt::FastCalc has been upgraded from version 0.40 to 0.5005. +.IP "\(bu" 4 +Math::BigRat has been upgraded from version 0.260802 to 0.2611. +.IP "\(bu" 4 +Math::Complex has been upgraded from version 1.59 to 1.5901. +.IP "\(bu" 4 +Memoize has been upgraded from version 1.03 to 1.03_01. +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 5.20170420 to 5.20170530. +.IP "\(bu" 4 +Module::Load::Conditional has been upgraded from version 0.64 to 0.68. +.IP "\(bu" 4 +Module::Metadata has been upgraded from version 1.000031 to 1.000033. +.IP "\(bu" 4 +mro has been upgraded from version 1.18 to 1.20. +.IP "\(bu" 4 +Net::Ping has been upgraded from version 2.43 to 2.55. +.Sp +IPv6 addresses and \f(CW\*(C`AF_INET6\*(C'\fR sockets are now supported, along with several +other enhancements. +.IP "\(bu" 4 +\&\s-1NEXT\s0 has been upgraded from version 0.65 to 0.67. +.IP "\(bu" 4 +Opcode has been upgraded from version 1.34 to 1.39. +.IP "\(bu" 4 +open has been upgraded from version 1.10 to 1.11. +.IP "\(bu" 4 +OS2::Process has been upgraded from version 1.11 to 1.12. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +overload has been upgraded from version 1.26 to 1.28. +.Sp +Its compilation speed has been improved slightly. +.IP "\(bu" 4 +parent has been upgraded from version 0.234 to 0.236. +.IP "\(bu" 4 +perl5db.pl has been upgraded from version 1.50 to 1.51. +.Sp +It now ignores \fI/dev/tty\fR on non-Unix systems. +[perl #113960] +.IP "\(bu" 4 +Perl::OSType has been upgraded from version 1.009 to 1.010. +.IP "\(bu" 4 +perlfaq has been upgraded from version 5.021010 to 5.021011. +.IP "\(bu" 4 +PerlIO has been upgraded from version 1.09 to 1.10. +.IP "\(bu" 4 +PerlIO::encoding has been upgraded from version 0.24 to 0.25. +.IP "\(bu" 4 +PerlIO::scalar has been upgraded from version 0.24 to 0.26. +.IP "\(bu" 4 +Pod::Checker has been upgraded from version 1.60 to 1.73. +.IP "\(bu" 4 +Pod::Functions has been upgraded from version 1.10 to 1.11. +.IP "\(bu" 4 +Pod::Html has been upgraded from version 1.22 to 1.2202. +.IP "\(bu" 4 +Pod::Perldoc has been upgraded from version 3.25_02 to 3.28. +.IP "\(bu" 4 +Pod::Simple has been upgraded from version 3.32 to 3.35. +.IP "\(bu" 4 +Pod::Usage has been upgraded from version 1.68 to 1.69. +.IP "\(bu" 4 +\&\s-1POSIX\s0 has been upgraded from version 1.65 to 1.76. +.Sp +This remedies several defects in making its symbols exportable. +[perl #127821] +.Sp +The \f(CW\*(C`POSIX::tmpnam()\*(C'\fR interface has been removed, +see \*(L"\fBPOSIX::tmpnam()\fR has been removed\*(R". +.Sp +The following deprecated functions have been removed: +.Sp +.Vb 10 +\& POSIX::isalnum +\& POSIX::isalpha +\& POSIX::iscntrl +\& POSIX::isdigit +\& POSIX::isgraph +\& POSIX::islower +\& POSIX::isprint +\& POSIX::ispunct +\& POSIX::isspace +\& POSIX::isupper +\& POSIX::isxdigit +\& POSIX::tolower +\& POSIX::toupper +.Ve +.Sp +Trying to import \s-1POSIX\s0 subs that have no real implementations +(like \f(CW\*(C`POSIX::atend()\*(C'\fR) now fails at import time, instead of +waiting until runtime. +.IP "\(bu" 4 +re has been upgraded from version 0.32 to 0.34 +.Sp +This adds support for the new \f(CW\*(C`/xx\*(C'\fR +regular expression pattern modifier, and a change to the \f(CW\*(C`use\ re\ \*(Aqstrict\*(Aq\*(C'\fR experimental feature. When \f(CW\*(C`re\ \*(Aqstrict\*(Aq\*(C'\fR is enabled, a warning now will be generated for all +unescaped uses of the two characters \f(CW"}"\fR and \f(CW"]"\fR in regular +expression patterns (outside bracketed character classes) that are taken +literally. This brings them more in line with the \f(CW")"\fR character which +is always a metacharacter unless escaped. Being a metacharacter only +sometimes, depending on an action at a distance, can lead to silently +having the pattern mean something quite different than was intended, +which the \f(CW\*(C`re\ \*(Aqstrict\*(Aq\*(C'\fR mode is intended to minimize. +.IP "\(bu" 4 +Safe has been upgraded from version 2.39 to 2.40. +.IP "\(bu" 4 +Scalar::Util has been upgraded from version 1.42_02 to 1.46_02. +.IP "\(bu" 4 +Storable has been upgraded from version 2.56 to 2.62. +.Sp +Fixes +[perl #130098] . +.IP "\(bu" 4 +Symbol has been upgraded from version 1.07 to 1.08. +.IP "\(bu" 4 +Sys::Syslog has been upgraded from version 0.33 to 0.35. +.IP "\(bu" 4 +Term::ANSIColor has been upgraded from version 4.04 to 4.06. +.IP "\(bu" 4 +Term::ReadLine has been upgraded from version 1.15 to 1.16. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +Test has been upgraded from version 1.28 to 1.30. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +Test::Harness has been upgraded from version 3.36 to 3.38. +.IP "\(bu" 4 +Test::Simple has been upgraded from version 1.001014 to 1.302073. +.IP "\(bu" 4 +Thread::Queue has been upgraded from version 3.09 to 3.12. +.IP "\(bu" 4 +Thread::Semaphore has been upgraded from 2.12 to 2.13. +.Sp +Added the \f(CW\*(C`down_timed\*(C'\fR method. +.IP "\(bu" 4 +threads has been upgraded from version 2.07 to 2.15. +.IP "\(bu" 4 +threads::shared has been upgraded from version 1.51 to 1.56. +.IP "\(bu" 4 +Tie::Hash::NamedCapture has been upgraded from version 0.09 to 0.10. +.IP "\(bu" 4 +Time::HiRes has been upgraded from version 1.9733 to 1.9741. +.Sp +It now builds on systems with \*(C+11 compilers (such as G++ 6 and Clang++ +3.9). +.Sp +Now uses \f(CW\*(C`clockid_t\*(C'\fR. +.IP "\(bu" 4 +Time::Local has been upgraded from version 1.2300 to 1.25. +.IP "\(bu" 4 +Unicode::Collate has been upgraded from version 1.14 to 1.19. +.IP "\(bu" 4 +Unicode::UCD has been upgraded from version 0.64 to 0.68. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +version has been upgraded from version 0.9916 to 0.9917. +.IP "\(bu" 4 +VMS::DCLsym has been upgraded from version 1.06 to 1.08. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.IP "\(bu" 4 +warnings has been upgraded from version 1.36 to 1.37. +.IP "\(bu" 4 +XS::Typemap has been upgraded from version 0.14 to 0.15. +.IP "\(bu" 4 +XSLoader has been upgraded from version 0.21 to 0.27. +.Sp +Fixed a security hole in which binary files could be loaded from a path +outside of \f(CW@INC\fR. +.Sp +It now uses 3\-arg \f(CW\*(C`open()\*(C'\fR instead of 2\-arg \f(CW\*(C`open()\*(C'\fR. +[perl #130122] +.SH "Documentation" +.IX Header "Documentation" +.SS "New Documentation" +.IX Subsection "New Documentation" +\fIperldeprecation\fR +.IX Subsection "perldeprecation" +.PP +This file documents all upcoming deprecations, and some of the deprecations +which already have been removed. The purpose of this documentation is +two-fold: document what will disappear, and by which version, and serve +as a guide for people dealing with code which has features that no longer +work after an upgrade of their perl. +.SS "Changes to Existing Documentation" +.IX Subsection "Changes to Existing Documentation" +We have attempted to update the documentation to reflect the changes +listed in this document. If you find any we have missed, send email to +perlbug@perl.org . +.PP +Additionally, all references to Usenet have been removed, and the +following selected changes have been made: +.PP +\fIperlfunc\fR +.IX Subsection "perlfunc" +.IP "\(bu" 4 +Removed obsolete text about \f(CW\*(C`defined()\*(C'\fR +on aggregates that should have been deleted earlier, when the feature +was removed. +.IP "\(bu" 4 +Corrected documentation of \f(CW\*(C`eval()\*(C'\fR, +and \f(CW\*(C`evalbytes()\*(C'\fR. +.IP "\(bu" 4 +Clarified documentation of \f(CW\*(C`seek()\*(C'\fR, +\&\f(CW\*(C`tell()\*(C'\fR and \f(CW\*(C`sysseek()\*(C'\fR +emphasizing that positions are in bytes and not characters. +[perl #128607] +.IP "\(bu" 4 +Clarified documentation of \f(CW\*(C`sort()\*(C'\fR concerning +the variables \f(CW$a\fR and \f(CW$b\fR. +.IP "\(bu" 4 +In \f(CW\*(C`split()\*(C'\fR noted that certain pattern modifiers are +legal, and added a caution about its use in Perls before v5.11. +.IP "\(bu" 4 +Removed obsolete documentation of \f(CW\*(C`study()\*(C'\fR, noting +that it is now a no-op. +.IP "\(bu" 4 +Noted that \f(CW\*(C`vec()\*(C'\fR doesn't work well when the string +contains characters whose code points are above 255. +.PP +\fIperlguts\fR +.IX Subsection "perlguts" +.IP "\(bu" 4 +Added advice on +formatted printing of operands of \f(CW\*(C`Size_t\*(C'\fR and \f(CW\*(C`SSize_t\*(C'\fR +.PP +\fIperlhack\fR +.IX Subsection "perlhack" +.IP "\(bu" 4 +Clarify what editor tab stop rules to use, and note that we are +migrating away from using tabs, replacing them with sequences of \s-1SPACE\s0 +characters. +.PP +\fIperlhacktips\fR +.IX Subsection "perlhacktips" +.IP "\(bu" 4 +Give another reason to use \f(CW\*(C`cBOOL\*(C'\fR to cast an expression to boolean. +.IP "\(bu" 4 +Note that the macros \f(CW\*(C`TRUE\*(C'\fR and \f(CW\*(C`FALSE\*(C'\fR are available to express +boolean values. +.PP +\fIperlinterp\fR +.IX Subsection "perlinterp" +.IP "\(bu" 4 +perlinterp has been expanded to give a more detailed example of how to +hunt around in the parser for how a given operator is handled. +.PP +\fIperllocale\fR +.IX Subsection "perllocale" +.IP "\(bu" 4 +Some locales aren't compatible with Perl. Note that these can cause +core dumps. +.PP +\fIperlmod\fR +.IX Subsection "perlmod" +.IP "\(bu" 4 +Various clarifications have been added. +.PP +\fIperlmodlib\fR +.IX Subsection "perlmodlib" +.IP "\(bu" 4 +Updated the site mirror list. +.PP +\fIperlobj\fR +.IX Subsection "perlobj" +.IP "\(bu" 4 +Added a section on calling methods using their fully qualified names. +.IP "\(bu" 4 +Do not discourage manual \f(CW@ISA\fR. +.PP +\fIperlootut\fR +.IX Subsection "perlootut" +.IP "\(bu" 4 +Mention \f(CW\*(C`Moo\*(C'\fR more. +.PP +\fIperlop\fR +.IX Subsection "perlop" +.IP "\(bu" 4 +Note that white space must be used for quoting operators if the +delimiter is a word character (\fIi.e.\fR, matches \f(CW\*(C`\ew\*(C'\fR). +.IP "\(bu" 4 +Clarify that in regular expression patterns delimited by single quotes, +no variable interpolation is done. +.PP +\fIperlre\fR +.IX Subsection "perlre" +.IP "\(bu" 4 +The first part was extensively rewritten to incorporate various basic +points, that in earlier versions were mentioned in sort of an appendix +on Version 8 regular expressions. +.IP "\(bu" 4 +Note that it is common to have the \f(CW\*(C`/x\*(C'\fR modifier and forget that this +means that \f(CW"#"\fR has to be escaped. +.PP +\fIperlretut\fR +.IX Subsection "perlretut" +.IP "\(bu" 4 +Add introductory material. +.IP "\(bu" 4 +Note that a metacharacter occurring in a context where it can't mean +that, silently loses its meta-ness and matches literally. +\&\f(CW\*(C`use re \*(Aqstrict\*(Aq\*(C'\fR can catch some of these. +.PP +\fIperlunicode\fR +.IX Subsection "perlunicode" +.IP "\(bu" 4 +Corrected the text about Unicode \s-1BYTE ORDER MARK\s0 handling. +.IP "\(bu" 4 +Updated the text to correspond with changes in Unicode UTS#18, concerning +regular expressions, and Perl compatibility with what it says. +.PP +\fIperlvar\fR +.IX Subsection "perlvar" +.IP "\(bu" 4 +Document \f(CW@ISA\fR. It was documented in other places, but not in perlvar. +.SH "Diagnostics" +.IX Header "Diagnostics" +.SS "New Diagnostics" +.IX Subsection "New Diagnostics" +\fINew Errors\fR +.IX Subsection "New Errors" +.IP "\(bu" 4 +A signature parameter must start with \f(CW\*(Aq$\*(Aq\fR, \f(CW\*(Aq@\*(Aq\fR or \f(CW\*(Aq%\*(Aq\fR +.IP "\(bu" 4 +Bareword in require contains \*(L"%s\*(R" +.IP "\(bu" 4 +Bareword in require maps to empty filename +.IP "\(bu" 4 +Bareword in require maps to disallowed filename \*(L"%s\*(R" +.IP "\(bu" 4 +Bareword in require must not start with a double-colon: \*(L"%s\*(R" +.IP "\(bu" 4 +\&\f(CW%s:\fR command not found +.Sp +(A) You've accidentally run your script through \fBbash\fR or another shell +instead of Perl. Check the \f(CW\*(C`#!\*(C'\fR line, or manually feed your script into +Perl yourself. The \f(CW\*(C`#!\*(C'\fR line at the top of your file could look like: +.Sp +.Vb 1 +\& #!/usr/bin/perl +.Ve +.IP "\(bu" 4 +\&\f(CW%s:\fR command not found: \f(CW%s\fR +.Sp +(A) You've accidentally run your script through \fBzsh\fR or another shell +instead of Perl. Check the \f(CW\*(C`#!\*(C'\fR line, or manually feed your script into +Perl yourself. The \f(CW\*(C`#!\*(C'\fR line at the top of your file could look like: +.Sp +.Vb 1 +\& #!/usr/bin/perl +.Ve +.IP "\(bu" 4 +The experimental declared_refs feature is not enabled +.Sp +(F) To declare references to variables, as in \f(CW\*(C`my \e%x\*(C'\fR, you must first enable +the feature: +.Sp +.Vb 2 +\& no warnings "experimental::declared_refs"; +\& use feature "declared_refs"; +.Ve +.Sp +See \*(L"Declaring a reference to a variable\*(R". +.IP "\(bu" 4 +Illegal character following sigil in a subroutine signature +.IP "\(bu" 4 +Indentation on line \f(CW%d\fR of here-doc doesn't match delimiter +.IP "\(bu" 4 +Infinite recursion via empty pattern. +.Sp +Using the empty pattern (which re-executes the last successfully-matched +pattern) inside a code block in another regex, as in \f(CW\*(C`/(?{ s!!new! })/\*(C'\fR, has +always previously yielded a segfault. It now produces this error. +.IP "\(bu" 4 +Malformed \s-1UTF\-8\s0 string in \*(L"%s\*(R" +.IP "\(bu" 4 +Multiple slurpy parameters not allowed +.IP "\(bu" 4 +\&\f(CW\*(Aq#\*(Aq\fR not allowed immediately following a sigil in a subroutine signature +.IP "\(bu" 4 +panic: unknown OA_*: \f(CW%x\fR +.IP "\(bu" 4 +Unescaped left brace in regex is illegal here +.Sp +Unescaped left braces are now illegal in some contexts in regular expression +patterns. In other contexts, they are still just deprecated; they will +be illegal in Perl 5.30. +.IP "\(bu" 4 +Version control conflict marker +.Sp +(F) The parser found a line starting with \f(CW\*(C`<<<<<<<\*(C'\fR, +\&\f(CW\*(C`>>>>>>>\*(C'\fR, or \f(CW\*(C`=======\*(C'\fR. These may be left by a +version control system to mark conflicts after a failed merge operation. +.PP +\fINew Warnings\fR +.IX Subsection "New Warnings" +.IP "\(bu" 4 +Can't determine class of operator \f(CW%s\fR, assuming \f(CW\*(C`BASEOP\*(C'\fR +.IP "\(bu" 4 +Declaring references is experimental +.Sp +(S experimental::declared_refs) This warning is emitted if you use a reference +constructor on the right-hand side of \f(CW\*(C`my()\*(C'\fR, \f(CW\*(C`state()\*(C'\fR, \f(CW\*(C`our()\*(C'\fR, or +\&\f(CW\*(C`local()\*(C'\fR. Simply suppress the warning if you want to use the feature, but +know that in doing so you are taking the risk of using an experimental feature +which may change or be removed in a future Perl version: +.Sp +.Vb 3 +\& no warnings "experimental::declared_refs"; +\& use feature "declared_refs"; +\& $fooref = my \e$foo; +.Ve +.Sp +See \*(L"Declaring a reference to a variable\*(R". +.IP "\(bu" 4 +do \*(L"%s\*(R" failed, '.' is no longer in \f(CW@INC\fR +.Sp +Since \f(CW"."\fR is now removed from \f(CW@INC\fR by default, \f(CW\*(C`do\*(C'\fR will now trigger a warning recommending to fix the \f(CW\*(C`do\*(C'\fR statement. +.IP "\(bu" 4 +\&\f(CW\*(C`File::Glob::glob()\*(C'\fR will disappear in perl 5.30. Use \f(CW\*(C`File::Glob::bsd_glob()\*(C'\fR instead. +.IP "\(bu" 4 +Unescaped literal '%c' in regex; marked by <\-\- \s-1HERE\s0 in m/%s/ +.IP "\(bu" 4 +Use of unassigned code point or non-standalone grapheme for a delimiter will be a fatal error starting in Perl 5.30 +.Sp +See \*(L"Deprecations\*(R" +.SS "Changes to Existing Diagnostics" +.IX Subsection "Changes to Existing Diagnostics" +.IP "\(bu" 4 +When a \f(CW\*(C`require\*(C'\fR fails, we now do not provide \f(CW@INC\fR when the \f(CW\*(C`require\*(C'\fR +is for a file instead of a module. +.IP "\(bu" 4 +When \f(CW@INC\fR is not scanned for a \f(CW\*(C`require\*(C'\fR call, we no longer display +\&\f(CW@INC\fR to avoid confusion. +.IP "\(bu" 4 +Attribute \*(L"locked\*(R" is deprecated, and will disappear in Perl 5.28 +.Sp +This existing warning has had the \fIand will disappear\fR text added in this +release. +.IP "\(bu" 4 +Attribute \*(L"unique\*(R" is deprecated, and will disappear in Perl 5.28 +.Sp +This existing warning has had the \fIand will disappear\fR text added in this +release. +.IP "\(bu" 4 +Calling POSIX::%s() is deprecated +.Sp +This warning has been removed, as the deprecated functions have been +removed from \s-1POSIX.\s0 +.IP "\(bu" 4 +Constants from lexical variables potentially modified elsewhere are deprecated. This will not be allowed in Perl 5.32 +.Sp +This existing warning has had the \fIthis will not be allowed\fR text added +in this release. +.IP "\(bu" 4 +Deprecated use of \f(CW\*(C`my()\*(C'\fR in false conditional. This will be a fatal error in Perl 5.30 +.Sp +This existing warning has had the \fIthis will be a fatal error\fR text added +in this release. +.IP "\(bu" 4 +\&\f(CW\*(C`dump()\*(C'\fR better written as \f(CW\*(C`CORE::dump()\*(C'\fR. \f(CW\*(C`dump()\*(C'\fR will no longer be available in Perl 5.30 +.Sp +This existing warning has had the \fIno longer be available\fR text added in +this release. +.IP "\(bu" 4 +Experimental \f(CW%s\fR on scalar is now forbidden +.Sp +This message is now followed by more helpful text. +[perl #127976] +.IP "\(bu" 4 +Experimental \*(L"%s\*(R" subs not enabled +.Sp +This warning was been removed, as lexical subs are no longer experimental. +.IP "\(bu" 4 +Having more than one /%c regexp modifier is deprecated +.Sp +This deprecation warning has been removed, since \f(CW\*(C`/xx\*(C'\fR now has a new +meaning. +.IP "\(bu" 4 +%s() is deprecated on \f(CW\*(C`:utf8\*(C'\fR handles. This will be a fatal error in Perl 5.30 +\&. +.Sp +where \*(L"%s\*(R" is one of \f(CW\*(C`sysread\*(C'\fR, \f(CW\*(C`recv\*(C'\fR, \f(CW\*(C`syswrite\*(C'\fR, or \f(CW\*(C`send\*(C'\fR. +.Sp +This existing warning has had the \fIthis will be a fatal error\fR text added +in this release. +.Sp +This warning is now enabled by default, as all \f(CW\*(C`deprecated\*(C'\fR category +warnings should be. +.IP "\(bu" 4 +\&\f(CW$*\fR is no longer supported. Its use will be fatal in Perl 5.30 +.Sp +This existing warning has had the \fIits use will be fatal\fR text added in +this release. +.IP "\(bu" 4 +\&\f(CW$#\fR is no longer supported. Its use will be fatal in Perl 5.30 +.Sp +This existing warning has had the \fIits use will be fatal\fR text added in +this release. +.IP "\(bu" 4 +Malformed \s-1UTF\-8\s0 character%s +.Sp +Details as to the exact problem have been added at the end of this +message +.IP "\(bu" 4 +Missing or undefined argument to \f(CW%s\fR +.Sp +This warning used to warn about \f(CW\*(C`require\*(C'\fR, even if it was actually \f(CW\*(C`do\*(C'\fR +which being executed. It now gets the operation name right. +.IP "\(bu" 4 +NO-BREAK \s-1SPACE\s0 in a charnames alias definition is deprecated +.Sp +This warning has been removed as the behavior is now an error. +.IP "\(bu" 4 +Odd name/value argument for subroutine '%s' +.Sp +This warning now includes the name of the offending subroutine. +.IP "\(bu" 4 +Opening dirhandle \f(CW%s\fR also as a file. This will be a fatal error in Perl 5.28 +.Sp +This existing warning has had the \fIthis will be a fatal error\fR text added +in this release. +.IP "\(bu" 4 +Opening filehandle \f(CW%s\fR also as a directory. This will be a fatal error in Perl 5.28 +.Sp +This existing warning has had the \fIthis will be a fatal error\fR text added +in this release. +.IP "\(bu" 4 +panic: ck_split, type=%u +.Sp +panic: pp_split, pm=%p, s=%p +.Sp +These panic errors have been removed. +.IP "\(bu" 4 +Passing malformed \s-1UTF\-8\s0 to \*(L"%s\*(R" is deprecated +.Sp +This warning has been changed to the fatal +Malformed \s-1UTF\-8\s0 string in \*(L"%s\*(R" +.IP "\(bu" 4 +Setting \f(CW$/\fR to a reference to \f(CW%s\fR as a form of slurp is deprecated, treating as undef. This will be fatal in Perl 5.28 +.Sp +This existing warning has had the \fIthis will be fatal\fR text added in +this release. +.IP "\(bu" 4 +\&\f(CW\*(C`${^ENCODING}\*(C'\fR is no longer supported. Its use will be fatal in Perl 5.28 +.Sp +This warning used to be: "Setting \f(CW\*(C`${^ENCODING}\*(C'\fR is deprecated". +.Sp +The special action of the variable \f(CW\*(C`${^ENCODING}\*(C'\fR was formerly used to +implement the \f(CW\*(C`encoding\*(C'\fR pragma. As of Perl 5.26, rather than being +deprecated, assigning to this variable now has no effect except to issue +the warning. +.IP "\(bu" 4 +Too few arguments for subroutine '%s' +.Sp +This warning now includes the name of the offending subroutine. +.IP "\(bu" 4 +Too many arguments for subroutine '%s' +.Sp +This warning now includes the name of the offending subroutine. +.IP "\(bu" 4 +Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <\-\-\ \s-1HERE\s0 in m/%s/ +.Sp +This existing warning has had the \fIhere (and will be fatal...)\fR text +added in this release. +.IP "\(bu" 4 +Unknown charname '' is deprecated. Its use will be fatal in Perl 5.28 +.Sp +This existing warning has had the \fIits use will be fatal\fR text added in +this release. +.IP "\(bu" 4 +Use of bare << to mean <<"" is deprecated. Its use will be fatal in Perl 5.28 +.Sp +This existing warning has had the \fIits use will be fatal\fR text added in +this release. +.IP "\(bu" 4 +Use of code point 0x%s is deprecated; the permissible max is 0x%s. This will be fatal in Perl 5.28 +.Sp +This existing warning has had the \fIthis will be fatal\fR text added in +this release. +.IP "\(bu" 4 +Use of comma-less variable list is deprecated. Its use will be fatal in Perl 5.28 +.Sp +This existing warning has had the \fIits use will be fatal\fR text added in +this release. +.IP "\(bu" 4 +Use of inherited \f(CW\*(C`AUTOLOAD\*(C'\fR for non-method %s() is deprecated. This will be fatal in Perl 5.28 +.Sp +This existing warning has had the \fIthis will be fatal\fR text added in +this release. +.IP "\(bu" 4 +Use of strings with code points over 0xFF as arguments to \f(CW%s\fR operator is deprecated. This will be a fatal error in Perl 5.28 +.Sp +This existing warning has had the \fIthis will be a fatal error\fR text added in +this release. +.SH "Utility Changes" +.IX Header "Utility Changes" +.SS "\fIc2ph\fP and \fIpstruct\fP" +.IX Subsection "c2ph and pstruct" +.IP "\(bu" 4 +These old utilities have long since superceded by h2xs, and are +now gone from the distribution. +.SS "\fIPorting/pod_lib.pl\fP" +.IX Subsection "Porting/pod_lib.pl" +.IP "\(bu" 4 +Removed spurious executable bit. +.IP "\(bu" 4 +Account for the possibility of \s-1DOS\s0 file endings. +.SS "\fIPorting/sync\-with\-cpan\fP" +.IX Subsection "Porting/sync-with-cpan" +.IP "\(bu" 4 +Many improvements. +.SS "\fIperf/benchmarks\fP" +.IX Subsection "perf/benchmarks" +.IP "\(bu" 4 +Tidy file, rename some symbols. +.SS "\fIPorting/checkAUTHORS.pl\fP" +.IX Subsection "Porting/checkAUTHORS.pl" +.IP "\(bu" 4 +Replace obscure character range with \f(CW\*(C`\ew\*(C'\fR. +.SS "\fIt/porting/regen.t\fP" +.IX Subsection "t/porting/regen.t" +.IP "\(bu" 4 +Try to be more helpful when tests fail. +.SS "\fIutils/h2xs.PL\fP" +.IX Subsection "utils/h2xs.PL" +.IP "\(bu" 4 +Avoid infinite loop for enums. +.SS "perlbug" +.IX Subsection "perlbug" +.IP "\(bu" 4 +Long lines in the message body are now wrapped at 900 characters, to stay +well within the 1000\-character limit imposed by \s-1SMTP\s0 mail transfer agents. +This is particularly likely to be important for the list of arguments to +\&\fIConfigure\fR, which can readily exceed the limit if, for example, it names +several non-default installation paths. This change also adds the first unit +tests for perlbug. +[perl #128020] +.SH "Configuration and Compilation" +.IX Header "Configuration and Compilation" +.IP "\(bu" 4 +\&\f(CW\*(C`\-Ddefault_inc_excludes_dot\*(C'\fR has added, and enabled by default. +.IP "\(bu" 4 +The \f(CW\*(C`dtrace\*(C'\fR build process has further changes +[perl #130108] : +.RS 4 +.IP "\(bu" 4 +If the \f(CW\*(C`\-xnolibs\*(C'\fR is available, use that so a \fIdtrace\fR perl can be +built within a FreeBSD jail. +.IP "\(bu" 4 +On systems that build a \fIdtrace\fR object file (FreeBSD, Solaris, and +SystemTap's dtrace emulation), copy the input objects to a separate +directory and process them there, and use those objects in the link, +since \f(CW\*(C`dtrace \-G\*(C'\fR also modifies these objects. +.IP "\(bu" 4 +Add \fIlibelf\fR to the build on FreeBSD 10.x, since \fIdtrace\fR adds +references to \fIlibelf\fR symbols. +.IP "\(bu" 4 +Generate a dummy \fIdtrace_main.o\fR if \f(CW\*(C`dtrace \-G\*(C'\fR fails to build it. A +default build on Solaris generates probes from the unused inline +functions, while they don't on FreeBSD, which causes \f(CW\*(C`dtrace \-G\*(C'\fR to +fail. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +You can now disable perl's use of the \f(CW\*(C`PERL_HASH_SEED\*(C'\fR and +\&\f(CW\*(C`PERL_PERTURB_KEYS\*(C'\fR environment variables by configuring perl with +\&\f(CW\*(C`\-Accflags=NO_PERL_HASH_ENV\*(C'\fR. +.IP "\(bu" 4 +You can now disable perl's use of the \f(CW\*(C`PERL_HASH_SEED_DEBUG\*(C'\fR environment +variable by configuring perl with +\&\f(CW\*(C`\-Accflags=\-DNO_PERL_HASH_SEED_DEBUG\*(C'\fR. +.IP "\(bu" 4 +\&\fIConfigure\fR now zeroes out the alignment bytes when calculating the bytes +for 80\-bit \f(CW\*(C`NaN\*(C'\fR and \f(CW\*(C`Inf\*(C'\fR to make builds more reproducible. +[perl #130133] +.IP "\(bu" 4 +Since v5.18, for testing purposes we have included support for +building perl with a variety of non-standard, and non-recommended +hash functions. Since we do not recommend the use of these functions, +we have removed them and their corresponding build options. Specifically +this includes the following build options: +.Sp +.Vb 8 +\& PERL_HASH_FUNC_SDBM +\& PERL_HASH_FUNC_DJB2 +\& PERL_HASH_FUNC_SUPERFAST +\& PERL_HASH_FUNC_MURMUR3 +\& PERL_HASH_FUNC_ONE_AT_A_TIME +\& PERL_HASH_FUNC_ONE_AT_A_TIME_OLD +\& PERL_HASH_FUNC_MURMUR_HASH_64A +\& PERL_HASH_FUNC_MURMUR_HASH_64B +.Ve +.IP "\(bu" 4 +Remove \*(L"Warning: perl appears in your path\*(R" +.Sp +This install warning is more or less obsolete, since most platforms already +\&\fBwill\fR have a \fI/usr/bin/perl\fR or similar provided by the \s-1OS.\s0 +.IP "\(bu" 4 +Reduce verbosity of \f(CW\*(C`make install.man\*(C'\fR +.Sp +Previously, two progress messages were emitted for each manpage: one by +installman itself, and one by the function in \fIinstall_lib.pl\fR that it calls to +actually install the file. Disabling the second of those in each case saves +over 750 lines of unhelpful output. +.IP "\(bu" 4 +Cleanup for \f(CW\*(C`clang \-Weverything\*(C'\fR support. +[perl #129961] +.IP "\(bu" 4 +\&\fIConfigure\fR: signbit scan was assuming too much, stop assuming negative 0. +.IP "\(bu" 4 +Various compiler warnings have been silenced. +.IP "\(bu" 4 +Several smaller changes have been made to remove impediments to compiling +under \*(C+11. +.IP "\(bu" 4 +Builds using \f(CW\*(C`USE_PAD_RESET\*(C'\fR now work again; this configuration had +bit-rotted. +.IP "\(bu" 4 +A probe for \f(CW\*(C`gai_strerror\*(C'\fR was added to \fIConfigure\fR that checks if +the \f(CW\*(C`gai_strerror()\*(C'\fR routine is available and can be used to +translate error codes returned by \f(CW\*(C`getaddrinfo()\*(C'\fR into human +readable strings. +.IP "\(bu" 4 +\&\fIConfigure\fR now aborts if both \f(CW\*(C`\-Duselongdouble\*(C'\fR and \f(CW\*(C`\-Dusequadmath\*(C'\fR are +requested. +[perl #126203] +.IP "\(bu" 4 +Fixed a bug in which \fIConfigure\fR could append \f(CW\*(C`\-quadmath\*(C'\fR to the +archname even if it was already present. +[perl #128538] +.IP "\(bu" 4 +Clang builds with \f(CW\*(C`\-DPERL_GLOBAL_STRUCT\*(C'\fR or +\&\f(CW\*(C`\-DPERL_GLOBAL_STRUCT_PRIVATE\*(C'\fR have +been fixed (by disabling Thread Safety Analysis for these configurations). +.IP "\(bu" 4 +\&\fImake_ext.pl\fR no longer updates a module's \fIpm_to_blib\fR file when no +files require updates. This could cause dependencies, \fIperlmain.c\fR +in particular, to be rebuilt unnecessarily. +[perl #126710] +.IP "\(bu" 4 +The output of \f(CW\*(C`perl \-V\*(C'\fR has been reformatted so that each configuration +and compile-time option is now listed one per line, to improve +readability. +.IP "\(bu" 4 +\&\fIConfigure\fR now builds \f(CW\*(C`miniperl\*(C'\fR and \f(CW\*(C`generate_uudmap\*(C'\fR if you +invoke it with \f(CW\*(C`\-Dusecrosscompiler\*(C'\fR but not \f(CW\*(C`\-Dtargethost=somehost\*(C'\fR. +This means you can supply your target platform \f(CW\*(C`config.sh\*(C'\fR, generate +the headers and proceed to build your cross-target perl. +[perl #127234] +.IP "\(bu" 4 +Perl built with \f(CW\*(C`\-Accflags=\-DPERL_TRACE_OPS\*(C'\fR now only dumps the operator +counts when the environment variable \f(CW\*(C`PERL_TRACE_OPS\*(C'\fR is set to a +non-zero integer. This allows \f(CW\*(C`make test\*(C'\fR to pass on such a build. +.IP "\(bu" 4 +When building with \s-1GCC 6\s0 and link-time optimization (the \f(CW\*(C`\-flto\*(C'\fR option to +\&\f(CW\*(C`gcc\*(C'\fR), \fIConfigure\fR was treating all probed symbols as present on the +system, regardless of whether they actually exist. This has been fixed. +[perl #128131] +.IP "\(bu" 4 +The \fIt/test.pl\fR library is used for internal testing of Perl itself, and +also copied by several \s-1CPAN\s0 modules. Some of those modules must work on +older versions of Perl, so \fIt/test.pl\fR must in turn avoid newer Perl +features. Compatibility with Perl 5.8 was inadvertently removed some time +ago; it has now been restored. +[perl #128052] +.IP "\(bu" 4 +The build process no longer emits an extra blank line before building each +\&\*(L"simple\*(R" extension (those with only \fI*.pm\fR and \fI*.pod\fR files). +.SH "Testing" +.IX Header "Testing" +Tests were added and changed to reflect the other additions and changes +in this release. Furthermore, these substantive changes were made: +.IP "\(bu" 4 +A new test script, \fIcomp/parser_run.t\fR, has been added that is like +\&\fIcomp/parser.t\fR but with \fItest.pl\fR included so that \f(CW\*(C`runperl()\*(C'\fR and the +like are available for use. +.IP "\(bu" 4 +Tests for locales were erroneously using locales incompatible with Perl. +.IP "\(bu" 4 +Some parts of the test suite that try to exhaustively test edge cases in the +regex implementation have been restricted to running for a maximum of five +minutes. On slow systems they could otherwise take several hours, without +significantly improving our understanding of the correctness of the code +under test. +.IP "\(bu" 4 +A new internal facility allows analysing the time taken by the individual +tests in Perl's own test suite; see \fIPorting/harness\-timer\-report.pl\fR. +.IP "\(bu" 4 +\&\fIt/re/regexp_nonull.t\fR has been added to test that the regular expression +engine can handle scalars that do not have a null byte just past the end of +the string. +.IP "\(bu" 4 +A new test script, \fIt/op/decl\-refs.t\fR, has been added to test the new feature +\&\*(L"Declaring a reference to a variable\*(R". +.IP "\(bu" 4 +A new test script, \fIt/re/keep_tabs.t\fR has been added to contain tests +where \f(CW\*(C`\et\*(C'\fR characters should not be expanded into spaces. +.IP "\(bu" 4 +A new test script, \fIt/re/anyof.t\fR, has been added to test that the \s-1ANYOF\s0 nodes +generated by bracketed character classes are as expected. +.IP "\(bu" 4 +There is now more extensive testing of the Unicode-related \s-1API\s0 macros +and functions. +.IP "\(bu" 4 +Several of the longer running \s-1API\s0 test files have been split into +multiple test files so that they can be run in parallel. +.IP "\(bu" 4 +\&\fIt/harness\fR now tries really hard not to run tests which are located +outside of the Perl source tree. +[perl #124050] +.IP "\(bu" 4 +Prevent debugger tests (\fIlib/perl5db.t\fR) from failing due to the contents +of \f(CW$ENV{PERLDB_OPTS}\fR. +[perl #130445] +.SH "Platform Support" +.IX Header "Platform Support" +.SS "New Platforms" +.IX Subsection "New Platforms" +.IP "NetBSD/VAX" 4 +.IX Item "NetBSD/VAX" +Perl now compiles under NetBSD on \s-1VAX\s0 machines. However, it's not +possible for that platform to implement floating-point infinities and +NaNs compatible with most modern systems, which implement the \s-1IEEE\-754\s0 +floating point standard. The hexadecimal floating point (\f(CW\*(C`0x...p[+\-]n\*(C'\fR +literals, \f(CW\*(C`printf %a\*(C'\fR) is not implemented, either. +The \f(CW\*(C`make test\*(C'\fR passes 98% of tests. +.RS 4 +.IP "\(bu" 4 +Test fixes and minor updates. +.IP "\(bu" 4 +Account for lack of \f(CW\*(C`inf\*(C'\fR, \f(CW\*(C`nan\*(C'\fR, and \f(CW\*(C`\-0.0\*(C'\fR support. +.RE +.RS 4 +.RE +.SS "Platform-Specific Notes" +.IX Subsection "Platform-Specific Notes" +.IP "Darwin" 4 +.IX Item "Darwin" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +Don't treat \f(CW\*(C`\-Dprefix=/usr\*(C'\fR as special: instead require an extra option +\&\f(CW\*(C`\-Ddarwin_distribution\*(C'\fR to produce the same results. +.IP "\(bu" 4 +\&\s-1OS X\s0 El Capitan doesn't implement the \f(CW\*(C`clock_gettime()\*(C'\fR or +\&\f(CW\*(C`clock_getres()\*(C'\fR APIs; emulate them as necessary. +.IP "\(bu" 4 +Deprecated \f(CWsyscall(2)\fR on macOS 10.12. +.RE +.RS 4 +.RE +.IP "\s-1EBCDIC\s0" 4 +.IX Item "EBCDIC" +Several tests have been updated to work (or be skipped) on \s-1EBCDIC\s0 platforms. +.IP "HP-UX" 4 +.IX Item "HP-UX" +The Net::Ping \s-1UDP\s0 test is now skipped on HP-UX. +.IP "Hurd" 4 +.IX Item "Hurd" +The hints for Hurd have been improved, enabling malloc wrap and reporting the +\&\s-1GNU\s0 libc used (previously it was an empty string when reported). +.IP "\s-1VAX\s0" 4 +.IX Item "VAX" +\&\s-1VAX\s0 floating point formats are now supported on NetBSD. +.IP "\s-1VMS\s0" 4 +.IX Item "VMS" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +The path separator for the \f(CW\*(C`PERL5LIB\*(C'\fR and \f(CW\*(C`PERLLIB\*(C'\fR environment entries is +now a colon (\f(CW":"\fR) when running under a Unix shell. There is no change when +running under \s-1DCL\s0 (it's still \f(CW"|"\fR). +.IP "\(bu" 4 +\&\fIconfigure.com\fR now recognizes the VSI-branded C compiler and no longer +recognizes the \*(L"\s-1DEC\s0\*(R"\-branded C compiler (as there hasn't been such a thing for +15 or more years). +.RE +.RS 4 +.RE +.IP "Windows" 4 +.IX Item "Windows" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +Support for compiling perl on Windows using Microsoft Visual Studio 2015 +(containing Visual \*(C+ 14.0) has been added. +.Sp +This version of \s-1VC++\s0 includes a completely rewritten C run-time library, some +of the changes in which mean that work done to resolve a socket +\&\f(CW\*(C`close()\*(C'\fR bug in +perl #120091 and perl #118059 is not workable in its current state with this +version of \s-1VC++.\s0 Therefore, we have effectively reverted that bug fix for +\&\s-1VS2015\s0 onwards on the basis that being able to build with \s-1VS2015\s0 onwards is +more important than keeping the bug fix. We may revisit this in the future to +attempt to fix the bug again in a way that is compatible with \s-1VS2015.\s0 +.Sp +These changes do not affect compilation with \s-1GCC\s0 or with Visual Studio versions +up to and including \s-1VS2013,\s0 \fIi.e.\fR, the bug fix is retained (unchanged) for those +compilers. +.Sp +Note that you may experience compatibility problems if you mix a perl built +with \s-1GCC\s0 or \s-1VS\s0 <= \s-1VS2013\s0 with \s-1XS\s0 modules built with \s-1VS2015,\s0 or if you mix a +perl built with \s-1VS2015\s0 with \s-1XS\s0 modules built with \s-1GCC\s0 or \s-1VS\s0 <= \s-1VS2013.\s0 +Some incompatibility may arise because of the bug fix that has been reverted +for \s-1VS2015\s0 builds of perl, but there may well be incompatibility anyway because +of the rewritten \s-1CRT\s0 in \s-1VS2015\s0 (\fIe.g.\fR, see discussion at +). +.IP "\(bu" 4 +It now automatically detects \s-1GCC\s0 versus Visual C and sets the \s-1VC\s0 version +number on Win32. +.RE +.RS 4 +.RE +.IP "Linux" 4 +.IX Item "Linux" +Drop support for Linux \fIa.out\fR executable format. Linux has used \s-1ELF\s0 for +over twenty years. +.IP "OpenBSD 6" 4 +.IX Item "OpenBSD 6" +OpenBSD 6 still does not support returning \f(CW\*(C`pid\*(C'\fR, \f(CW\*(C`gid\*(C'\fR, or \f(CW\*(C`uid\*(C'\fR with +\&\f(CW\*(C`SA_SIGINFO\*(C'\fR. Make sure to account for it. +.IP "FreeBSD" 4 +.IX Item "FreeBSD" +\&\fIt/uni/overload.t\fR: Skip hanging test on FreeBSD. +.IP "DragonFly \s-1BSD\s0" 4 +.IX Item "DragonFly BSD" +DragonFly \s-1BSD\s0 now has support for \f(CW\*(C`setproctitle()\*(C'\fR. +[perl #130068] . +.SH "Internal Changes" +.IX Header "Internal Changes" +.IP "\(bu" 4 +A new \s-1API\s0 function \f(CW\*(C`sv_setpv_bufsize()\*(C'\fR +allows simultaneously setting the +length and the allocated size of the buffer in an \f(CW\*(C`SV\*(C'\fR, growing the +buffer if necessary. +.IP "\(bu" 4 +A new \s-1API\s0 macro \f(CW\*(C`SvPVCLEAR()\*(C'\fR sets its \f(CW\*(C`SV\*(C'\fR +argument to an empty string, +like Perl-space \f(CW\*(C`$x = \*(Aq\*(Aq\*(C'\fR, but with several optimisations. +.IP "\(bu" 4 +Several new macros and functions for dealing with Unicode and +UTF\-8\-encoded strings have been added to the \s-1API,\s0 as well as some +changes in the +functionality of existing functions (see \*(L"Unicode Support\*(R" in perlapi for +more details): +.RS 4 +.IP "\(bu" 4 +New versions of the \s-1API\s0 macros like \f(CW\*(C`isALPHA_utf8\*(C'\fR and \f(CW\*(C`toLOWER_utf8\*(C'\fR +have been added, each with the suffix \f(CW\*(C`_safe\*(C'\fR, like +\&\f(CW\*(C`isSPACE_utf8_safe\*(C'\fR. These take an extra +parameter, giving an upper +limit of how far into the string it is safe to read. Using the old +versions could cause attempts to read beyond the end of the input buffer +if the \s-1UTF\-8\s0 is not well-formed, and their use now raises a deprecation +warning. Details are at \*(L"Character classification\*(R" in perlapi. +.IP "\(bu" 4 +Macros like \f(CW\*(C`isALPHA_utf8\*(C'\fR and +\&\f(CW\*(C`toLOWER_utf8\*(C'\fR now die if they detect +that their input \s-1UTF\-8\s0 is malformed. A deprecation warning had been +issued since Perl 5.18. +.IP "\(bu" 4 +Several new macros for analysing the validity of utf8 sequences. These +are: +.Sp +\&\f(CW\*(C`UTF8_GOT_ABOVE_31_BIT\*(C'\fR +\&\f(CW\*(C`UTF8_GOT_CONTINUATION\*(C'\fR +\&\f(CW\*(C`UTF8_GOT_EMPTY\*(C'\fR +\&\f(CW\*(C`UTF8_GOT_LONG\*(C'\fR +\&\f(CW\*(C`UTF8_GOT_NONCHAR\*(C'\fR +\&\f(CW\*(C`UTF8_GOT_NON_CONTINUATION\*(C'\fR +\&\f(CW\*(C`UTF8_GOT_OVERFLOW\*(C'\fR +\&\f(CW\*(C`UTF8_GOT_SHORT\*(C'\fR +\&\f(CW\*(C`UTF8_GOT_SUPER\*(C'\fR +\&\f(CW\*(C`UTF8_GOT_SURROGATE\*(C'\fR +\&\f(CW\*(C`UTF8_IS_INVARIANT\*(C'\fR +\&\f(CW\*(C`UTF8_IS_NONCHAR\*(C'\fR +\&\f(CW\*(C`UTF8_IS_SUPER\*(C'\fR +\&\f(CW\*(C`UTF8_IS_SURROGATE\*(C'\fR +\&\f(CW\*(C`UVCHR_IS_INVARIANT\*(C'\fR +\&\f(CW\*(C`isUTF8_CHAR_flags\*(C'\fR +\&\f(CW\*(C`isSTRICT_UTF8_CHAR\*(C'\fR +\&\f(CW\*(C`isC9_STRICT_UTF8_CHAR\*(C'\fR +.IP "\(bu" 4 +Functions that are all extensions of the \f(CW\*(C`is_utf8_string_\f(CI*\f(CW()\*(C'\fR functions, +that apply various restrictions to the \s-1UTF\-8\s0 recognized as valid: +.Sp +\&\f(CW\*(C`is_strict_utf8_string\*(C'\fR, +\&\f(CW\*(C`is_strict_utf8_string_loc\*(C'\fR, +\&\f(CW\*(C`is_strict_utf8_string_loclen\*(C'\fR, +.Sp +\&\f(CW\*(C`is_c9strict_utf8_string\*(C'\fR, +\&\f(CW\*(C`is_c9strict_utf8_string_loc\*(C'\fR, +\&\f(CW\*(C`is_c9strict_utf8_string_loclen\*(C'\fR, +.Sp +\&\f(CW\*(C`is_utf8_string_flags\*(C'\fR, +\&\f(CW\*(C`is_utf8_string_loc_flags\*(C'\fR, +\&\f(CW\*(C`is_utf8_string_loclen_flags\*(C'\fR, +.Sp +\&\f(CW\*(C`is_utf8_fixed_width_buf_flags\*(C'\fR, +\&\f(CW\*(C`is_utf8_fixed_width_buf_loc_flags\*(C'\fR, +\&\f(CW\*(C`is_utf8_fixed_width_buf_loclen_flags\*(C'\fR. +.Sp +\&\f(CW\*(C`is_utf8_invariant_string\*(C'\fR. +\&\f(CW\*(C`is_utf8_valid_partial_char\*(C'\fR. +\&\f(CW\*(C`is_utf8_valid_partial_char_flags\*(C'\fR. +.IP "\(bu" 4 +The functions \f(CW\*(C`utf8n_to_uvchr\*(C'\fR and its +derivatives have had several changes of behaviour. +.Sp +Calling them, while passing a string length of 0 is now asserted against +in \s-1DEBUGGING\s0 builds, and otherwise, returns the Unicode \s-1REPLACEMENT +CHARACTER.\s0 If you have nothing to decode, you shouldn't call the decode +function. +.Sp +They now return the Unicode \s-1REPLACEMENT CHARACTER\s0 if called with \s-1UTF\-8\s0 +that has the overlong malformation and that malformation is allowed by +the input parameters. This malformation is where the \s-1UTF\-8\s0 looks valid +syntactically, but there is a shorter sequence that yields the same code +point. This has been forbidden since Unicode version 3.1. +.Sp +They now accept an input +flag to allow the overflow malformation. This malformation is when the +\&\s-1UTF\-8\s0 may be syntactically valid, but the code point it represents is +not capable of being represented in the word length on the platform. +What \*(L"allowed\*(R" means, in this case, is that the function doesn't return an +error, and it advances the parse pointer to beyond the \s-1UTF\-8\s0 in +question, but it returns the Unicode \s-1REPLACEMENT CHARACTER\s0 as the value +of the code point (since the real value is not representable). +.Sp +They no longer abandon searching for other malformations when the first +one is encountered. A call to one of these functions thus can generate +multiple diagnostics, instead of just one. +.IP "\(bu" 4 +\&\f(CW\*(C`valid_utf8_to_uvchr()\*(C'\fR has been added +to the \s-1API\s0 (although it was +present in core earlier). Like \f(CW\*(C`utf8_to_uvchr_buf()\*(C'\fR, but assumes that +the next character is well-formed. Use with caution. +.IP "\(bu" 4 +A new function, \f(CW\*(C`utf8n_to_uvchr_error\*(C'\fR, +has been added for +use by modules that need to know the details of \s-1UTF\-8\s0 malformations +beyond pass/fail. Previously, the only ways to know why a sequence was +ill-formed was to capture and parse the generated diagnostics or to do +your own analysis. +.IP "\(bu" 4 +There is now a safer version of \fButf8_hop()\fR, called +\&\f(CW\*(C`utf8_hop_safe()\*(C'\fR. +Unlike \fButf8_hop()\fR, \fButf8_hop_safe()\fR won't navigate before the beginning or +after the end of the supplied buffer. +.IP "\(bu" 4 +Two new functions, \f(CW\*(C`utf8_hop_forward()\*(C'\fR and +\&\f(CW\*(C`utf8_hop_back()\*(C'\fR are +similar to \f(CW\*(C`utf8_hop_safe()\*(C'\fR but are for when you know which direction +you wish to travel. +.IP "\(bu" 4 +Two new macros which return useful utf8 byte sequences: +.Sp +\&\f(CW\*(C`BOM_UTF8\*(C'\fR +.Sp +\&\f(CW\*(C`REPLACEMENT_CHARACTER_UTF8\*(C'\fR +.RE +.RS 4 +.RE +.IP "\(bu" 4 +Perl is now built with the \f(CW\*(C`PERL_OP_PARENT\*(C'\fR compiler define enabled by +default. To disable it, use the \f(CW\*(C`PERL_NO_OP_PARENT\*(C'\fR compiler define. +This flag alters how the \f(CW\*(C`op_sibling\*(C'\fR field is used in \f(CW\*(C`OP\*(C'\fR structures, +and has been available optionally since perl 5.22. +.Sp +See \*(L"Internal Changes\*(R" in perl5220delta for more details of what this +build option does. +.IP "\(bu" 4 +Three new ops, \f(CW\*(C`OP_ARGELEM\*(C'\fR, \f(CW\*(C`OP_ARGDEFELEM\*(C'\fR, and \f(CW\*(C`OP_ARGCHECK\*(C'\fR have +been added. These are intended principally to implement the individual +elements of a subroutine signature, plus any overall checking required. +.IP "\(bu" 4 +The \f(CW\*(C`OP_PUSHRE\*(C'\fR op has been eliminated and the \f(CW\*(C`OP_SPLIT\*(C'\fR op has been +changed from class \f(CW\*(C`LISTOP\*(C'\fR to \f(CW\*(C`PMOP\*(C'\fR. +.Sp +Formerly the first child of a split would be a \f(CW\*(C`pushre\*(C'\fR, which would have the +\&\f(CW\*(C`split\*(C'\fR's regex attached to it. Now the regex is attached directly to the +\&\f(CW\*(C`split\*(C'\fR op, and the \f(CW\*(C`pushre\*(C'\fR has been eliminated. +.IP "\(bu" 4 +The \f(CW\*(C`op_class()\*(C'\fR \s-1API\s0 function has been added. This +is like the existing +\&\f(CW\*(C`OP_CLASS()\*(C'\fR macro, but can more accurately determine what struct an op +has been allocated as. For example \f(CW\*(C`OP_CLASS()\*(C'\fR might return +\&\f(CW\*(C`OA_BASEOP_OR_UNOP\*(C'\fR indicating that ops of this type are usually +allocated as an \f(CW\*(C`OP\*(C'\fR or \f(CW\*(C`UNOP\*(C'\fR; while \f(CW\*(C`op_class()\*(C'\fR will return +\&\f(CW\*(C`OPclass_BASEOP\*(C'\fR or \f(CW\*(C`OPclass_UNOP\*(C'\fR as appropriate. +.IP "\(bu" 4 +All parts of the internals now agree that the \f(CW\*(C`sassign\*(C'\fR op is a \f(CW\*(C`BINOP\*(C'\fR; +previously it was listed as a \f(CW\*(C`BASEOP\*(C'\fR in \fIregen/opcodes\fR, which meant +that several parts of the internals had to be special-cased to accommodate +it. This oddity's original motivation was to handle code like \f(CW\*(C`$x ||= 1\*(C'\fR; +that is now handled in a simpler way. +.IP "\(bu" 4 +The output format of the \f(CW\*(C`op_dump()\*(C'\fR function (as +used by \f(CW\*(C`perl \-Dx\*(C'\fR) +has changed: it now displays an \*(L"ASCII-art\*(R" tree structure, and shows more +low-level details about each op, such as its address and class. +.IP "\(bu" 4 +The \f(CW\*(C`PADOFFSET\*(C'\fR type has changed from being unsigned to signed, and +several pad-related variables such as \f(CW\*(C`PL_padix\*(C'\fR have changed from being +of type \f(CW\*(C`I32\*(C'\fR to type \f(CW\*(C`PADOFFSET\*(C'\fR. +.IP "\(bu" 4 +The \f(CW\*(C`DEBUGGING\*(C'\fR\-mode output for regex compilation and execution has been +enhanced. +.IP "\(bu" 4 +Several obscure \s-1SV\s0 flags have been eliminated, sometimes along with the +macros which manipulate them: \f(CW\*(C`SVpbm_VALID\*(C'\fR, \f(CW\*(C`SVpbm_TAIL\*(C'\fR, \f(CW\*(C`SvTAIL_on\*(C'\fR, +\&\f(CW\*(C`SvTAIL_off\*(C'\fR, \f(CW\*(C`SVrepl_EVAL\*(C'\fR, \f(CW\*(C`SvEVALED\*(C'\fR. +.IP "\(bu" 4 +An \s-1OP\s0 \f(CW\*(C`op_private\*(C'\fR flag has been eliminated: \f(CW\*(C`OPpRUNTIME\*(C'\fR. This used to +often get set on \f(CW\*(C`PMOP\*(C'\fR ops, but had become meaningless over time. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +Perl no longer panics when switching into some locales on machines with +buggy \f(CW\*(C`strxfrm()\*(C'\fR implementations in their \fIlibc\fR. +[perl #121734] +.IP "\(bu" 4 +\&\f(CW\*(C` $\-{$name} \*(C'\fR would leak an \f(CW\*(C`AV\*(C'\fR on each access if the regular +expression had no named captures. The same applies to access to any +hash tied with Tie::Hash::NamedCapture and \f(CW\*(C`all => 1\*(C'\fR. +[perl #130822] +.IP "\(bu" 4 +Attempting to use the deprecated variable \f(CW$#\fR as the object in an +indirect object method call could cause a heap use after free or +buffer overflow. +[perl #129274] +.IP "\(bu" 4 +When checking for an indirect object method call, in some rare cases +the parser could reallocate the line buffer but then continue to use +pointers to the old buffer. +[perl #129190] +.IP "\(bu" 4 +Supplying a glob as the format argument to +\&\f(CW\*(C`formline\*(C'\fR would +cause an assertion failure. +[perl #130722] +.IP "\(bu" 4 +Code like \f(CW\*(C` $value1 =~ qr/.../ ~~ $value2 \*(C'\fR would have the match +converted into a \f(CW\*(C`qr//\*(C'\fR operator, leaving extra elements on the stack to +confuse any surrounding expression. +[perl #130705] +.IP "\(bu" 4 +Since v5.24 in some obscure cases, a regex which included code blocks +from multiple sources (\fIe.g.\fR, via embedded via \f(CW\*(C`qr//\*(C'\fR objects) could end up +with the wrong current pad and crash or give weird results. +[perl #129881] +.IP "\(bu" 4 +Occasionally \f(CW\*(C`local()\*(C'\fRs in a code block within a patterns weren't being +undone when the pattern matching backtracked over the code block. +[perl #126697] +.IP "\(bu" 4 +Using \f(CW\*(C`substr()\*(C'\fR to modify a magic variable could access freed memory +in some cases. +[perl #129340] +.IP "\(bu" 4 +Under \f(CW\*(C`use utf8\*(C'\fR, the entire source code is now checked for being \s-1UTF\-8\s0 +well formed, not just quoted strings as before. +[perl #126310] . +.IP "\(bu" 4 +The range operator \f(CW".."\fR on strings now handles its arguments correctly when in +the scope of the \f(CW\*(C`unicode_strings\*(C'\fR +feature. The previous behaviour was sufficiently unexpected that we believe no +correct program could have made use of it. +.IP "\(bu" 4 +The \f(CW\*(C`split\*(C'\fR operator did not ensure enough space was allocated for +its return value in scalar context. It could then write a single +pointer immediately beyond the end of the memory block allocated for +the stack. +[perl #130262] +.IP "\(bu" 4 +Using a large code point with the \f(CW"W"\fR pack template character with +the current output position aligned at just the right point could +cause a write of a single zero byte immediately beyond the end of an +allocated buffer. +[perl #129149] +.IP "\(bu" 4 +Supplying a format's picture argument as part of the format argument list +where the picture specifies modifying the argument could cause an +access to the new freed compiled format. +[perl #129125] +.IP "\(bu" 4 +The \fBsort()\fR operator's built-in numeric comparison +function didn't handle large integers that weren't exactly +representable by a double. This now uses the same code used to +implement the \f(CW\*(C`<=>\*(C'\fR operator. +[perl #130335] +.IP "\(bu" 4 +Fix issues with \f(CW\*(C`/(?{ ... < +.IP "\(bu" 4 +Fixed an assertion failure with \f(CW\*(C`chop\*(C'\fR and \f(CW\*(C`chomp\*(C'\fR, which +could be triggered by \f(CW\*(C`chop(@x =~ tr/1/1/)\*(C'\fR. +[perl #130198] . +.IP "\(bu" 4 +Fixed a comment skipping error in patterns under \f(CW\*(C`/x\*(C'\fR; it could stop +skipping a byte early, which could be in the middle of a \s-1UTF\-8\s0 +character. +[perl #130495] . +.IP "\(bu" 4 +\&\fIperldb\fR now ignores \fI/dev/tty\fR on non-Unix systems. +[perl #113960] ; +.IP "\(bu" 4 +Fix assertion failure for \f(CW\*(C`{}\->$x\*(C'\fR when \f(CW$x\fR isn't defined. +[perl #130496] . +.IP "\(bu" 4 +Fix an assertion error which could be triggered when a lookahead string +in patterns exceeded a minimum length. +[perl #130522] . +.IP "\(bu" 4 +Only warn once per literal number about a misplaced \f(CW"_"\fR. +[perl #70878] . +.IP "\(bu" 4 +The \f(CW\*(C`tr///\*(C'\fR parse code could be looking at uninitialized data after a +perse error. +[perl #129342] . +.IP "\(bu" 4 +In a pattern match, a back-reference (\f(CW\*(C`\e1\*(C'\fR) to an unmatched capture could +read back beyond the start of the string being matched. +[perl #129377] . +.IP "\(bu" 4 +\&\f(CW\*(C`use re \*(Aqstrict\*(Aq\*(C'\fR is supposed to warn if you use a range (such as +\&\f(CW\*(C`/(?[ [ X\-Y ] ])/\*(C'\fR) whose start and end digit aren't from the same group +of 10. It didn't do that for five groups of mathematical digits starting +at \f(CW\*(C`U+1D7E\*(C'\fR. +.IP "\(bu" 4 +A sub containing a \*(L"forward\*(R" declaration with the same name (\fIe.g.\fR, +\&\f(CW\*(C`sub c { sub c; }\*(C'\fR) could sometimes crash or loop infinitely. +[perl #129090] +.IP "\(bu" 4 +A crash in executing a regex with a non-anchored \s-1UTF\-8\s0 substring against a +target string that also used \s-1UTF\-8\s0 has been fixed. +[perl #129350] +.IP "\(bu" 4 +Previously, a shebang line like \f(CW\*(C`#!perl \-i u\*(C'\fR could be erroneously +interpreted as requesting the \f(CW\*(C`\-u\*(C'\fR option. This has been fixed. +[perl #129336] +.IP "\(bu" 4 +The regex engine was previously producing incorrect results in some rare +situations when backtracking past an alternation that matches only one +thing; this +showed up as capture buffers (\f(CW$1\fR, \f(CW$2\fR, \fIetc.\fR) erroneously containing data +from regex execution paths that weren't actually executed for the final +match. +[perl #129897] +.IP "\(bu" 4 +Certain regexes making use of the experimental \f(CW\*(C`regex_sets\*(C'\fR feature could +trigger an assertion failure. This has been fixed. +[perl #129322] +.IP "\(bu" 4 +Invalid assignments to a reference constructor (\fIe.g.\fR, \f(CW\*(C`\eeval=time\*(C'\fR) could +sometimes crash in addition to giving a syntax error. +[perl #125679] +.IP "\(bu" 4 +The parser could sometimes crash if a bareword came after \f(CW\*(C`evalbytes\*(C'\fR. +[perl #129196] +.IP "\(bu" 4 +Autoloading via a method call would warn erroneously (\*(L"Use of inherited +\&\s-1AUTOLOAD\s0 for non-method\*(R") if there was a stub present in the package into +which the invocant had been blessed. The warning is no longer emitted in +such circumstances. +[perl #47047] +.IP "\(bu" 4 +The use of \f(CW\*(C`splice\*(C'\fR on arrays with non-existent elements could cause other +operators to crash. +[perl #129164] +.IP "\(bu" 4 +A possible buffer overrun when a pattern contains a fixed utf8 substring. +[perl #129012] +.IP "\(bu" 4 +Fixed two possible use-after-free bugs in perl's lexer. +[perl #129069] +.IP "\(bu" 4 +Fixed a crash with \f(CW\*(C`s///l\*(C'\fR where it thought it was dealing with \s-1UTF\-8\s0 +when it wasn't. +[perl #129038] +.IP "\(bu" 4 +Fixed a place where the regex parser was not setting the syntax error +correctly on a syntactically incorrect pattern. +[perl #129122] +.IP "\(bu" 4 +The \f(CW\*(C`&.\*(C'\fR operator (and the \f(CW"&"\fR operator, when it treats its arguments as +strings) were failing to append a trailing null byte if at least one string +was marked as utf8 internally. Many code paths (system calls, regexp +compilation) still expect there to be a null byte in the string buffer +just past the end of the logical string. An assertion failure was the +result. +[perl #129287] +.IP "\(bu" 4 +Avoid a heap-after-use error in the parser when creating an error messge +for a syntactically invalid heredoc. +[perl #128988] +.IP "\(bu" 4 +Fix a segfault when run with \f(CW\*(C`\-DC\*(C'\fR options on \s-1DEBUGGING\s0 builds. +[perl #129106] +.IP "\(bu" 4 +Fixed the parser error handling in subroutine attributes for an +\&'\f(CW\*(C`:attr(foo\*(C'\fR' that does not have an ending '\f(CW")"\fR'. +.IP "\(bu" 4 +Fix the perl lexer to correctly handle a backslash as the last char in +quoted-string context. This actually fixed two bugs, +[perl #129064] and +[perl #129176] . +.IP "\(bu" 4 +In the \s-1API\s0 function \f(CW\*(C`gv_fetchmethod_pvn_flags\*(C'\fR, rework separator parsing +to prevent possible string overrun with an invalid \f(CW\*(C`len\*(C'\fR argument. +[perl #129267] +.IP "\(bu" 4 +Problems with in-place array sorts: code like \f(CW\*(C`@a = sort { ... } @a\*(C'\fR, +where the source and destination of the sort are the same plain array, are +optimised to do less copying around. Two side-effects of this optimisation +were that the contents of \f(CW@a\fR as seen by sort routines were +partially sorted; and under some circumstances accessing \f(CW@a\fR during the +sort could crash the interpreter. Both these issues have been fixed, and +Sort functions see the original value of \f(CW@a\fR. +[perl #128340] +.IP "\(bu" 4 +Non-ASCII string delimiters are now reported correctly in error messages +for unterminated strings. +[perl #128701] +.IP "\(bu" 4 +\&\f(CW\*(C`pack("p", ...)\*(C'\fR used to emit its warning (\*(L"Attempt to pack pointer to +temporary value\*(R") erroneously in some cases, but has been fixed. +.IP "\(bu" 4 +\&\f(CW@DB::args\fR is now exempt from \*(L"used once\*(R" warnings. The warnings only +occurred under \fB\-w\fR, because \fIwarnings.pm\fR itself uses \f(CW@DB::args\fR +multiple times. +.IP "\(bu" 4 +The use of built-in arrays or hash slices in a double-quoted string no +longer issues a warning (\*(L"Possible unintended interpolation...\*(R") if the +variable has not been mentioned before. This affected code like +\&\f(CW\*(C`qq|@DB::args|\*(C'\fR and \f(CW\*(C`qq|@SIG{\*(AqCHLD\*(Aq, \*(AqHUP\*(Aq}|\*(C'\fR. (The special variables +\&\f(CW\*(C`@\-\*(C'\fR and \f(CW\*(C`@+\*(C'\fR were already exempt from the warning.) +.IP "\(bu" 4 +\&\f(CW\*(C`gethostent\*(C'\fR and similar functions now perform a null check internally, to +avoid crashing with the torsocks library. This was a regression from v5.22. +[perl #128740] +.IP "\(bu" 4 +\&\f(CW\*(C`defined *{\*(Aq!\*(Aq}\*(C'\fR, \f(CW\*(C`defined *{\*(Aq[\*(Aq}\*(C'\fR, and \f(CW\*(C`defined *{\*(Aq\-\*(Aq}\*(C'\fR no longer leak +memory if the typeglob in question has never been accessed before. +.IP "\(bu" 4 +Mentioning the same constant twice in a row (which is a syntax error) no +longer fails an assertion under debugging builds. This was a regression +from v5.20. +[perl #126482] +.IP "\(bu" 4 +Many issues relating to \f(CW\*(C`printf "%a"\*(C'\fR of hexadecimal floating point +were fixed. In addition, the \*(L"subnormals\*(R" (formerly known as \*(L"denormals\*(R") +floating point numbers are now supported both with the plain \s-1IEEE 754\s0 +floating point numbers (64\-bit or 128\-bit) and the x86 80\-bit +\&\*(L"extended precision\*(R". Note that subnormal hexadecimal floating +point literals will give a warning about \*(L"exponent underflow\*(R". +[perl #128843] +[perl #128889] +[perl #128890] +[perl #128893] +[perl #128909] +[perl #128919] +.IP "\(bu" 4 +A regression in v5.24 with \f(CW\*(C`tr/\eN{U+...}/foo/\*(C'\fR when the code point was between +128 and 255 has been fixed. +[perl #128734] . +.IP "\(bu" 4 +Use of a string delimiter whose code point is above 2**31 now works +correctly on platforms that allow this. Previously, certain characters, +due to truncation, would be confused with other delimiter characters +with special meaning (such as \f(CW"?"\fR in \f(CW\*(C`m?...?\*(C'\fR), resulting +in inconsistent behaviour. Note that this is non-portable, +and is based on Perl's extension to \s-1UTF\-8,\s0 and is probably not +displayable nor enterable by any editor. +[perl #128738] +.IP "\(bu" 4 +\&\f(CW\*(C`@{x\*(C'\fR followed by a newline where \f(CW"x"\fR represents a control or non-ASCII +character no longer produces a garbled syntax error message or a crash. +[perl #128951] +.IP "\(bu" 4 +An assertion failure with \f(CW\*(C`%: = 0\*(C'\fR has been fixed. +[perl #128238] +.IP "\(bu" 4 +In Perl 5.18, the parsing of \f(CW"$foo::$bar"\fR was accidentally changed, such +that it would be treated as \f(CW\*(C`$foo."::".$bar\*(C'\fR. The previous behavior, which +was to parse it as \f(CW\*(C`$foo:: . $bar\*(C'\fR, has been restored. +[perl #128478] +.IP "\(bu" 4 +Since Perl 5.20, line numbers have been off by one when perl is invoked with +the \fB\-x\fR switch. This has been fixed. +[perl #128508] +.IP "\(bu" 4 +Vivifying a subroutine stub in a deleted stash (\fIe.g.\fR, +\&\f(CW\*(C`delete $My::{"Foo::"}; \e&My::Foo::foo\*(C'\fR) no longer crashes. It had begun +crashing in Perl 5.18. +[perl #128532] +.IP "\(bu" 4 +Some obscure cases of subroutines and file handles being freed at the same time +could result in crashes, but have been fixed. The crash was introduced in Perl +5.22. +[perl #128597] +.IP "\(bu" 4 +Code that looks for a variable name associated with an uninitialized value +could cause an assertion failure in cases where magic is involved, such as +\&\f(CW$ISA[0][0]\fR. This has now been fixed. +[perl #128253] +.IP "\(bu" 4 +A crash caused by code generating the warning \*(L"Subroutine \s-1STASH::NAME\s0 +redefined\*(R" in cases such as \f(CW\*(C`sub P::f{} undef *P::; *P::f =sub{};\*(C'\fR has been +fixed. In these cases, where the \s-1STASH\s0 is missing, the warning will now appear +as \*(L"Subroutine \s-1NAME\s0 redefined\*(R". +[perl #128257] +.IP "\(bu" 4 +Fixed an assertion triggered by some code that handles deprecated behavior in +formats, \fIe.g.\fR, in cases like this: +.Sp +.Vb 3 +\& format STDOUT = +\& @ +\& 0"$x" +.Ve +.Sp +[perl #128255] +.IP "\(bu" 4 +A possible divide by zero in string transformation code on Windows has been +avoided, fixing a crash when collating an empty string. +[perl #128618] +.IP "\(bu" 4 +Some regular expression parsing glitches could lead to assertion failures with +regular expressions such as \f(CW\*(C`/(?<=/\*(C'\fR and \f(CW\*(C`/(? +.IP "\(bu" 4 +\&\f(CW\*(C` until ($x = 1) { ... } \*(C'\fR and \f(CW\*(C` ... until $x = 1 \*(C'\fR now properly +warn when syntax warnings are enabled. +[perl #127333] +.IP "\(bu" 4 +\&\fBsocket()\fR now leaves the error code returned by the system in \f(CW$!\fR on +failure. +[perl #128316] +.IP "\(bu" 4 +Assignment variants of any bitwise ops under the \f(CW\*(C`bitwise\*(C'\fR feature would +crash if the left-hand side was an array or hash. +[perl #128204] +.IP "\(bu" 4 +\&\f(CW\*(C`require\*(C'\fR followed by a single colon (as in \f(CW\*(C`foo() ? require : ...\*(C'\fR is +now parsed correctly as \f(CW\*(C`require\*(C'\fR with implicit \f(CW$_\fR, rather than +\&\f(CW\*(C`require ""\*(C'\fR. +[perl #128307] +.IP "\(bu" 4 +Scalar \f(CW\*(C`keys %hash\*(C'\fR can now be assigned to consistently in all scalar +lvalue contexts. Previously it worked for some contexts but not others. +.IP "\(bu" 4 +List assignment to \f(CW\*(C`vec\*(C'\fR or \f(CW\*(C`substr\*(C'\fR with an array or hash for its first +argument used to result in crashes or \*(L"Can't coerce\*(R" error messages at run +time, unlike scalar assignment, which would give an error at compile time. +List assignment now gives a compile-time error, too. +[perl #128260] +.IP "\(bu" 4 +Expressions containing an \f(CW\*(C`&&\*(C'\fR or \f(CW\*(C`||\*(C'\fR operator (or their synonyms \f(CW\*(C`and\*(C'\fR +and \f(CW\*(C`or\*(C'\fR) were being compiled incorrectly in some cases. If the left-hand +side consisted of either a negated bareword constant or a negated \f(CW\*(C`do {}\*(C'\fR +block containing a constant expression, and the right-hand side consisted of +a negated non-foldable expression, one of the negations was effectively +ignored. The same was true of \f(CW\*(C`if\*(C'\fR and \f(CW\*(C`unless\*(C'\fR statement modifiers, +though with the left-hand and right-hand sides swapped. This long-standing +bug has now been fixed. +[perl #127952] +.IP "\(bu" 4 +\&\f(CW\*(C`reset\*(C'\fR with an argument no longer crashes when encountering stash entries +other than globs. +[perl #128106] +.IP "\(bu" 4 +Assignment of hashes to, and deletion of, typeglobs named \f(CW*::::::\fR no +longer causes crashes. +[perl #128086] +.IP "\(bu" 4 +Perl wasn't correctly handling true/false values in the \s-1LHS\s0 of a list +assign; specifically the truth values returned by boolean operators. +This could trigger an assertion failure in something like the following: +.Sp +.Vb 3 +\& for ($x > $y) { +\& ($_, ...) = (...); # here $_ is aliased to a truth value +\& } +.Ve +.Sp +This was a regression from v5.24. +[perl #129991] +.IP "\(bu" 4 +Assertion failure with user-defined Unicode-like properties. +[perl #130010] +.IP "\(bu" 4 +Fix error message for unclosed \f(CW\*(C`\eN{\*(C'\fR in a regex. An unclosed \f(CW\*(C`\eN{\*(C'\fR +could give the wrong error message: +\&\f(CW"\eN{NAME} must be resolved by the lexer"\fR. +.IP "\(bu" 4 +List assignment in list context where the \s-1LHS\s0 contained aggregates and +where there were not enough \s-1RHS\s0 elements, used to skip scalar lvalues. +Previously, \f(CW\*(C`(($a,$b,@c,$d) = (1))\*(C'\fR in list context returned \f(CW\*(C`($a)\*(C'\fR; now +it returns \f(CW\*(C`($a,$b,$d)\*(C'\fR. \f(CW\*(C`(($a,$b,$c) = (1))\*(C'\fR is unchanged: it still +returns \f(CW\*(C`($a,$b,$c)\*(C'\fR. This can be seen in the following: +.Sp +.Vb 2 +\& sub inc { $_++ for @_ } +\& inc(($a,$b,@c,$d) = (10)) +.Ve +.Sp +Formerly, the values of \f(CW\*(C`($a,$b,$d)\*(C'\fR would be left as \f(CW\*(C`(11,undef,undef)\*(C'\fR; +now they are \f(CW\*(C`(11,1,1)\*(C'\fR. +.IP "\(bu" 4 +Code like this: \f(CW\*(C`/(?{ s!!! })/\*(C'\fR could trigger infinite recursion on the C +stack (not the normal perl stack) when the last successful pattern in +scope is itself. We avoid the segfault by simply forbidding the use of +the empty pattern when it would resolve to the currently executing +pattern. +[perl #129903] +.IP "\(bu" 4 +Avoid reading beyond the end of the line buffer in perl's lexer when +there's a short \s-1UTF\-8\s0 character at the end. +[perl #128997] +.IP "\(bu" 4 +Alternations in regular expressions were sometimes failing to match +a utf8 string against a utf8 alternate. +[perl #129950] +.IP "\(bu" 4 +Make \f(CW\*(C`do "a\e0b"\*(C'\fR fail silently (and return \f(CW\*(C`undef\*(C'\fR and set \f(CW$!\fR) +instead of throwing an error. +[perl #129928] +.IP "\(bu" 4 +\&\f(CW\*(C`chdir\*(C'\fR with no argument didn't ensure that there was stack space +available for returning its result. +[perl #129130] +.IP "\(bu" 4 +All error messages related to \f(CW\*(C`do\*(C'\fR now refer to \f(CW\*(C`do\*(C'\fR; some formerly +claimed to be from \f(CW\*(C`require\*(C'\fR instead. +.IP "\(bu" 4 +Executing \f(CW\*(C`undef $x\*(C'\fR where \f(CW$x\fR is tied or magical no longer incorrectly +blames the variable for an uninitialized-value warning encountered by the +tied/magical code. +.IP "\(bu" 4 +Code like \f(CW\*(C`$x = $x . "a"\*(C'\fR was incorrectly failing to yield a +use of uninitialized value +warning when \f(CW$x\fR was a lexical variable with an undefined value. That has +now been fixed. +[perl #127877] +.IP "\(bu" 4 +\&\f(CW\*(C`undef *_; shift\*(C'\fR or \f(CW\*(C`undef *_; pop\*(C'\fR inside a subroutine, with no +argument to \f(CW\*(C`shift\*(C'\fR or \f(CW\*(C`pop\*(C'\fR, began crashing in Perl 5.14, but has now +been fixed. +.IP "\(bu" 4 +\&\f(CW"string$scalar\->$*"\fR now correctly prefers concatenation +overloading to string overloading if \f(CW\*(C`$scalar\->$*\*(C'\fR returns an +overloaded object, bringing it into consistency with \f(CW$$scalar\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`/@0{0*\->@*/*0\*(C'\fR and similar contortions used to crash, but no longer +do, but merely produce a syntax error. +[perl #128171] +.IP "\(bu" 4 +\&\f(CW\*(C`do\*(C'\fR or \f(CW\*(C`require\*(C'\fR with an argument which is a reference or typeglob +which, when stringified, +contains a null character, started crashing in Perl 5.20, but has now been +fixed. +[perl #128182] +.IP "\(bu" 4 +Improve the error message for a missing \f(CW\*(C`tie()\*(C'\fR package/method. This +brings the error messages in line with the ones used for normal method +calls. +.IP "\(bu" 4 +Parsing bad \s-1POSIX\s0 charclasses no longer leaks memory. +[perl #128313] +.SH "Known Problems" +.IX Header "Known Problems" +.IP "\(bu" 4 +G++ 6 handles subnormal (denormal) floating point values differently +than gcc 6 or g++ 5 resulting in \*(L"flush-to-zero\*(R". The end result is +that if you specify very small values using the hexadecimal floating +point format, like \f(CW\*(C`0x1.fffffffffffffp\-1022\*(C'\fR, they become zeros. +[perl #131388] +.SH "Errata From Previous Releases" +.IX Header "Errata From Previous Releases" +.IP "\(bu" 4 +Fixed issues with recursive regexes. The behavior was fixed in Perl 5.24. +[perl #126182] +.SH "Obituary" +.IX Header "Obituary" +Jon Portnoy (\s-1AVENJ\s0), a prolific Perl author and admired Gentoo community +member, has passed away on August 10, 2016. He will be remembered and +missed by all those who he came in contact with, and enriched with his +intellect, wit, and spirit. +.PP +It is with great sadness that we also note Kip Hampton's passing. Probably +best known as the author of the Perl & \s-1XML\s0 column on \s-1XML\s0.com, he was a +core contributor to AxKit, an \s-1XML\s0 server platform that became an Apache +Foundation project. He was a frequent speaker in the early days at +\&\s-1OSCON,\s0 and most recently at \s-1YAPC::NA\s0 in Madison. He was frequently on +irc.perl.org as ubu, generally in the #axkit\-dahut community, the +group responsible for \s-1YAPC::NA\s0 Asheville in 2011. +.PP +Kip and his constant contributions to the community will be greatly +missed. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.26.0 represents approximately 13 months of development since Perl 5.24.0 +and contains approximately 360,000 lines of changes across 2,600 files from 86 +authors. +.PP +Excluding auto-generated files, documentation and release tools, there were +approximately 230,000 lines of changes to 1,800 .pm, .t, .c and .h files. +.PP +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed the +improvements that became Perl 5.26.0: +.PP +Aaron Crane, Abigail, \*(Aevar Arnfjo\*:r\*(d- Bjarmason, Alex Vandiver, Andreas +Ko\*:nig, Andreas Voegele, Andrew Fresh, Andy Lester, Aristotle Pagaltzis, Chad +Granum, Chase Whitener, Chris 'BinGOs' Williams, Chris Lamb, Christian Hansen, +Christian Millour, Colin Newell, Craig A. Berry, Dagfinn Ilmari Mannsa\*oker, Dan +Collins, Daniel Dragan, Dave Cross, Dave Rolsky, David Golden, David H. +Gutteridge, David Mitchell, Dominic Hargreaves, Doug Bell, E. Choroba, Ed Avis, +Father Chrysostomos, Franc\*,ois Perrad, Hauke D, H.Merijn Brand, Hugo van der +Sanden, Ivan Pozdeev, James E Keenan, James Raspass, Jarkko Hietaniemi, Jerry +D. Hedden, Jim Cromie, J. Nick Koston, John Lightsey, Karen Etheridge, Karl +Williamson, Leon Timmermans, Lukas Mai, Matthew Horsfall, Maxwell Carey, Misty +De Meo, Neil Bowers, Nicholas Clark, Nicolas R., Niko Tyni, Pali, Paul +Marquess, Peter Avalos, Petr Pi\*'saX, Pino Toscano, Rafael Garcia-Suarez, Reini +Urban, Renee Baecker, Ricardo Signes, Richard Levitte, Rick Delaney, Salvador +Fandin\*~o, Samuel Thibault, Sawyer X, Se\*'bastien Aperghis-Tramoni, Sergey +Aleynikov, Shlomi Fish, Smylers, Stefan Seifert, Steffen Mu\*:ller, Stevan +Little, Steve Hay, Steven Humphrey, Sullivan Beck, Theo Buehler, Thomas Sibley, +Todd Rinaldo, Tomasz Konojacki, Tony Cook, Unicode Consortium, Yaroslav Kuzmin, +Yves Orton, Zefram. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the perl bug database at +. There may also be information at +, the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug program +included with your release. Be sure to trim your bug down to a tiny but +sufficient test case. Your bug report, along with the output of \f(CW\*(C`perl \-V\*(C'\fR, +will be sent off to \f(CW\*(C`perlbug@perl.org\*(C'\fR to be analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications which make it +inappropriate to send to a publicly archived mailing list, then see +\&\*(L"\s-1SECURITY VULNERABILITY CONTACT INFORMATION\*(R"\s0 in perlsec +for details of how to report the issue. +.SH "Give Thanks" +.IX Header "Give Thanks" +If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, +you can do so by running the \f(CW\*(C`perlthanks\*(C'\fR program: +.PP +.Vb 1 +\& perlthanks +.Ve +.PP +This will send an email to the Perl 5 Porters list with your show of thanks. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5281delta.1 b/data/miniconda3/man/man1/perl5281delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..228bc59acafc361646a277d9a29c7702a30186e4 --- /dev/null +++ b/data/miniconda3/man/man1/perl5281delta.1 @@ -0,0 +1,254 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5281DELTA 1" +.TH PERL5281DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5281delta \- what is new for perl v5.28.1 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.28.0 release and the 5.28.1 +release. +.PP +If you are upgrading from an earlier release such as 5.26.0, first read +perl5280delta, which describes differences between 5.26.0 and 5.28.0. +.SH "Security" +.IX Header "Security" +.SS "[\s-1CVE\-2018\-18311\s0] Integer overflow leading to buffer overflow and segmentation fault" +.IX Subsection "[CVE-2018-18311] Integer overflow leading to buffer overflow and segmentation fault" +Integer arithmetic in \f(CW\*(C`Perl_my_setenv()\*(C'\fR could wrap when the combined length +of the environment variable name and value exceeded around 0x7fffffff. This +could lead to writing beyond the end of an allocated buffer with attacker +supplied data. +.PP +[perl #133204] +.SS "[\s-1CVE\-2018\-18312\s0] Heap-buffer-overflow write in S_regatom (regcomp.c)" +.IX Subsection "[CVE-2018-18312] Heap-buffer-overflow write in S_regatom (regcomp.c)" +A crafted regular expression could cause heap-buffer-overflow write during +compilation, potentially allowing arbitrary code execution. +.PP +[perl #133423] +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +There are no changes intentionally incompatible with 5.28.0. If any exist, +they are bugs, and we request that you submit a report. See +\&\*(L"Reporting Bugs\*(R" below. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 5.20180622 to 5.20181129_28. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +Perl 5.28 introduced an \f(CW\*(C`index()\*(C'\fR optimization when comparing to \-1 (or +indirectly, e.g. >= 0). When this optimization was triggered inside a \f(CW\*(C`when\*(C'\fR +clause it caused a warning (\*(L"Argument \f(CW%s\fR isn't numeric in smart match\*(R"). This +has now been fixed. +[perl #133368] +.IP "\(bu" 4 +Matching of decimal digits in script runs, introduced in Perl 5.28, had a bug +that led to \f(CW"1\eN{THAI DIGIT FIVE}"\fR matching \f(CW\*(C`/^(*sr:\ed+)$/\*(C'\fR when it should +not. This has now been fixed. +.IP "\(bu" 4 +The new in-place editing code no longer leaks directory handles. +[perl #133314] +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.28.1 represents approximately 5 months of development since Perl 5.28.0 +and contains approximately 6,100 lines of changes across 44 files from 12 +authors. +.PP +Excluding auto-generated files, documentation and release tools, there were +approximately 700 lines of changes to 12 .pm, .t, .c and .h files. +.PP +Perl continues to flourish into its fourth decade thanks to a vibrant community +of users and developers. The following people are known to have contributed +the improvements that became Perl 5.28.1: +.PP +Aaron Crane, Abigail, Chris 'BinGOs' Williams, Dagfinn Ilmari Mannsa\*oker, David +Mitchell, James E Keenan, John \s-1SJ\s0 Anderson, Karen Etheridge, Karl Williamson, +Sawyer X, Steve Hay, Tony Cook. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the perl bug database +at . There may also be information at + , the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug program +included with your release. Be sure to trim your bug down to a tiny but +sufficient test case. Your bug report, along with the output of \f(CW\*(C`perl \-V\*(C'\fR, +will be sent off to perlbug@perl.org to be analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications which make it +inappropriate to send to a publicly archived mailing list, then see +\&\*(L"\s-1SECURITY VULNERABILITY CONTACT INFORMATION\*(R"\s0 in perlsec +for details of how to report the issue. +.SH "Give Thanks" +.IX Header "Give Thanks" +If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, +you can do so by running the \f(CW\*(C`perlthanks\*(C'\fR program: +.PP +.Vb 1 +\& perlthanks +.Ve +.PP +This will send an email to the Perl 5 Porters list with your show of thanks. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5301delta.1 b/data/miniconda3/man/man1/perl5301delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..a136298cbc78f910a1289fde94b7c58650a08811 --- /dev/null +++ b/data/miniconda3/man/man1/perl5301delta.1 @@ -0,0 +1,284 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5301DELTA 1" +.TH PERL5301DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5301delta \- what is new for perl v5.30.1 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.30.0 release and the 5.30.1 +release. +.PP +If you are upgrading from an earlier release such as 5.29.0, first read +perl5300delta, which describes differences between 5.29.0 and 5.30.0. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +There are no changes intentionally incompatible with 5.30.1. If any exist, +they are bugs, and we request that you submit a report. See +\&\*(L"Reporting Bugs\*(R" below. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 5.20190522 to 5.20191110. +.SH "Documentation" +.IX Header "Documentation" +.SS "Changes to Existing Documentation" +.IX Subsection "Changes to Existing Documentation" +We have attempted to update the documentation to reflect the changes listed in +this document. If you find any we have missed, send email to +perlbug@perl.org . +.PP +Additionally, documentation has been updated to reference GitHub as the new +canonical repository and to describe the new GitHub pull request workflow. +.SH "Configuration and Compilation" +.IX Header "Configuration and Compilation" +.IP "\(bu" 4 +The \f(CW\*(C`ECHO\*(C'\fR macro is now defined. This is used in a \f(CW\*(C`dtrace\*(C'\fR rule that was +originally changed for FreeBSD, and the FreeBSD make apparently predefines it. +The Solaris make does not predefine \f(CW\*(C`ECHO\*(C'\fR which broke this rule on Solaris. +[perl #17057] +.SH "Testing" +.IX Header "Testing" +Tests were added and changed to reflect the other additions and changes in this +release. +.SH "Platform Support" +.IX Header "Platform Support" +.SS "Platform-Specific Notes" +.IX Subsection "Platform-Specific Notes" +.IP "Win32" 4 +.IX Item "Win32" +The locale tests could crash on Win32 due to a Windows bug, and separately due +to the \s-1CRT\s0 throwing an exception if the locale name wasn't validly encoded in +the current code page. +.Sp +For the second we now decode the locale name ourselves, and always decode it as +\&\s-1UTF\-8.\s0 +.Sp +[perl #16922] +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +Setting \f(CW$)\fR now properly sets supplementary group ids, if you have the +necessary privileges. +[perl #17031] +.IP "\(bu" 4 +\&\f(CW\*(C`readline @foo\*(C'\fR now evaluates \f(CW@foo\fR in scalar context. Previously, it would +be evaluated in list context, and since \fBreadline()\fR pops only one argument from +the stack, the stack could underflow, or be left with unexpected values on it. +[perl #16929] +.IP "\(bu" 4 +\&\fBsv_gets()\fR now recovers better if the target \s-1SV\s0 is modified by a signal handler. +[perl #16960] +.IP "\(bu" 4 +Matching a non\-\f(CW\*(C`SVf_UTF8\*(C'\fR string against a regular expression containing +Unicode literals could leak an \s-1SV\s0 on each match attempt. +[perl #17140] +.IP "\(bu" 4 +\&\f(CW\*(C`sprintf("%.*a", \-10000, $x)\*(C'\fR would cause a buffer overflow due to +mishandling of the negative precision value. +[perl #16942] +.IP "\(bu" 4 +\&\f(CW\*(C`scalar()\*(C'\fR on a reference could cause an erroneous assertion failure during +compilation. +[perl #16969] +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.30.1 represents approximately 6 months of development since Perl 5.30.0 +and contains approximately 4,700 lines of changes across 67 files from 14 +authors. +.PP +Excluding auto-generated files, documentation and release tools, there were +approximately 910 lines of changes to 20 .pm, .t, .c and .h files. +.PP +Perl continues to flourish into its fourth decade thanks to a vibrant community +of users and developers. The following people are known to have contributed +the improvements that became Perl 5.30.1: +.PP +Chris 'BinGOs' Williams, Dan Book, David Mitchell, Hugo van der Sanden, James E +Keenan, Karen Etheridge, Karl Williamson, Manuel Mausz, Max Maischein, Nicolas +R., Sawyer X, Steve Hay, Tom Hukins, Tony Cook. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the perl bug database at +. There may also be information at +, the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the perlbug program +included with your release. Be sure to trim your bug down to a tiny but +sufficient test case. Your bug report, along with the output of \f(CW\*(C`perl \-V\*(C'\fR, +will be sent off to perlbug@perl.org to be analysed by the Perl porting team. +.PP +If the bug you are reporting has security implications which make it +inappropriate to send to a publicly archived mailing list, then see +\&\*(L"\s-1SECURITY VULNERABILITY CONTACT INFORMATION\*(R"\s0 in perlsec for details of how to +report the issue. +.SH "Give Thanks" +.IX Header "Give Thanks" +If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, you +can do so by running the \f(CW\*(C`perlthanks\*(C'\fR program: +.PP +.Vb 1 +\& perlthanks +.Ve +.PP +This will send an email to the Perl 5 Porters list with your show of thanks. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5303delta.1 b/data/miniconda3/man/man1/perl5303delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..8e4c242466030a32472084887133f7ff07a392c0 --- /dev/null +++ b/data/miniconda3/man/man1/perl5303delta.1 @@ -0,0 +1,262 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5303DELTA 1" +.TH PERL5303DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl5303delta \- what is new for perl v5.30.3 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.30.2 release and the 5.30.3 +release. +.PP +If you are upgrading from an earlier release such as 5.30.1, first read +perl5302delta, which describes differences between 5.30.1 and 5.30.2. +.SH "Security" +.IX Header "Security" +.SS "[\s-1CVE\-2020\-10543\s0] Buffer overflow caused by a crafted regular expression" +.IX Subsection "[CVE-2020-10543] Buffer overflow caused by a crafted regular expression" +A signed \f(CW\*(C`size_t\*(C'\fR integer overflow in the storage space calculations for +nested regular expression quantifiers could cause a heap buffer overflow in +Perl's regular expression compiler that overwrites memory allocated after the +regular expression storage space with attacker supplied data. +.PP +The target system needs a sufficient amount of memory to allocate partial +expansions of the nested quantifiers prior to the overflow occurring. This +requirement is unlikely to be met on 64\-bit systems. +.PP +Discovered by: ManhND of The Tarantula Team, VinCSS (a member of Vingroup). +.SS "[\s-1CVE\-2020\-10878\s0] Integer overflow via malformed bytecode produced by a crafted regular expression" +.IX Subsection "[CVE-2020-10878] Integer overflow via malformed bytecode produced by a crafted regular expression" +Integer overflows in the calculation of offsets between instructions for the +regular expression engine could cause corruption of the intermediate language +state of a compiled regular expression. An attacker could abuse this behaviour +to insert instructions into the compiled form of a Perl regular expression. +.PP +Discovered by: Hugo van der Sanden and Slaven Rezic. +.SS "[\s-1CVE\-2020\-12723\s0] Buffer overflow caused by a crafted regular expression" +.IX Subsection "[CVE-2020-12723] Buffer overflow caused by a crafted regular expression" +Recursive calls to \f(CW\*(C`S_study_chunk()\*(C'\fR by Perl's regular expression compiler to +optimize the intermediate language representation of a regular expression could +cause corruption of the intermediate language state of a compiled regular +expression. +.PP +Discovered by: Sergey Aleynikov. +.SS "Additional Note" +.IX Subsection "Additional Note" +An application written in Perl would only be vulnerable to any of the above +flaws if it evaluates regular expressions supplied by the attacker. Evaluating +regular expressions in this fashion is known to be dangerous since the regular +expression engine does not protect against denial of service attacks in this +usage scenario. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +There are no changes intentionally incompatible with Perl 5.30.2. If any +exist, they are bugs, and we request that you submit a report. See +\&\*(L"Reporting Bugs\*(R" below. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 5.20200314 to 5.20200601_30. +.SH "Testing" +.IX Header "Testing" +Tests were added and changed to reflect the other additions and changes in this +release. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.30.3 represents approximately 3 months of development since Perl 5.30.2 +and contains approximately 1,100 lines of changes across 42 files from 7 +authors. +.PP +Excluding auto-generated files, documentation and release tools, there were +approximately 350 lines of changes to 8 .pm, .t, .c and .h files. +.PP +Perl continues to flourish into its fourth decade thanks to a vibrant community +of users and developers. The following people are known to have contributed +the improvements that became Perl 5.30.3: +.PP +Chris 'BinGOs' Williams, Hugo van der Sanden, John Lightsey, Karl Williamson, +Nicolas R., Sawyer X, Steve Hay. +.PP +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please see +the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the perl bug database at +. There may also be information at +, the Perl Home Page. +.PP +If you believe you have an unreported bug, please open an issue at +. Be sure to trim your bug down to a +tiny but sufficient test case. +.PP +If the bug you are reporting has security implications which make it +inappropriate to send to a public issue tracker, then see +\&\*(L"\s-1SECURITY VULNERABILITY CONTACT INFORMATION\*(R"\s0 in perlsec for details of how to +report the issue. +.SH "Give Thanks" +.IX Header "Give Thanks" +If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, you +can do so by running the \f(CW\*(C`perlthanks\*(C'\fR program: +.PP +.Vb 1 +\& perlthanks +.Ve +.PP +This will send an email to the Perl 5 Porters list with your show of thanks. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl5320delta.1 b/data/miniconda3/man/man1/perl5320delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..e63d66b2f8b9bc7397705d17f8f1c640c357bc94 --- /dev/null +++ b/data/miniconda3/man/man1/perl5320delta.1 @@ -0,0 +1,1480 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL5320DELTA 1" +.TH PERL5320DELTA 1 "2020-10-17" "perl v5.32.1" "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" +perl5320delta \- what is new for perl v5.32.0 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.30.0 release and the 5.32.0 +release. +.PP +If you are upgrading from an earlier release such as 5.28.0, first read +perl5300delta, which describes differences between 5.28.0 and 5.30.0. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.SS "The isa Operator" +.IX Subsection "The isa Operator" +A new experimental infix operator called \f(CW\*(C`isa\*(C'\fR tests whether a given object +is an instance of a given class or a class derived from it: +.PP +.Vb 1 +\& if( $obj isa Package::Name ) { ... } +.Ve +.PP +For more detail see \*(L"Class Instance Operator\*(R" in perlop. +.SS "Unicode 13.0 is supported" +.IX Subsection "Unicode 13.0 is supported" +See for details. +.SS "Chained comparisons capability" +.IX Subsection "Chained comparisons capability" +Some comparison operators, as their associativity, \fIchain\fR with some +operators of the same precedence (but never with operators of different +precedence). +.PP +.Vb 1 +\& if ( $x < $y <= $z ) {...} +.Ve +.PP +behaves exactly like: +.PP +.Vb 1 +\& if ( $x < $y && $y <= $z ) {...} +.Ve +.PP +(assuming that \f(CW"$y"\fR is as simple a scalar as it looks.) +.PP +You can read more about this in perlop under +\&\*(L"Operator Precedence and Associativity\*(R" in perlop. +.ie n .SS "New Unicode properties ""Identifier_Status"" and ""Identifier_Type"" supported" +.el .SS "New Unicode properties \f(CWIdentifier_Status\fP and \f(CWIdentifier_Type\fP supported" +.IX Subsection "New Unicode properties Identifier_Status and Identifier_Type supported" +Unicode has revised its regular expression requirements: +. +As part of that they are wanting more properties to be exposed, ones +that aren't part of the strict \s-1UCD\s0 (Unicode character database). These +two are used for examining inputs for security purposes. Details on +their usage is at . +.ie n .SS "It is now possible to write ""qr/\ep{Name=...}/"", or ""qr!\ep{na=/(SMILING|GRINNING) FACE/}!""" +.el .SS "It is now possible to write \f(CWqr/\ep{Name=...}/\fP, or \f(CWqr!\ep{na=/(SMILING|GRINNING) FACE/}!\fP" +.IX Subsection "It is now possible to write qr/p{Name=...}/, or qr!p{na=/(SMILING|GRINNING) FACE/}!" +The Unicode Name property is now accessible in regular expression +patterns, as an alternative to \f(CW\*(C`\eN{...}\*(C'\fR. +A comparison of the two methods is given in +\&\*(L"Comparison of \eN{...} and \ep{name=...}\*(R" in perlunicode. +.PP +The second example above shows that wildcard subpatterns are also usable +in this property. See \*(L"Wildcards in Property Values\*(R" in perlunicode. +.ie n .SS "Improvement of ""POSIX::mblen()"", ""mbtowc"", and ""wctomb""" +.el .SS "Improvement of \f(CWPOSIX::mblen()\fP, \f(CWmbtowc\fP, and \f(CWwctomb\fP" +.IX Subsection "Improvement of POSIX::mblen(), mbtowc, and wctomb" +The \f(CW\*(C`POSIX::mblen()\*(C'\fR, \f(CW\*(C`mbtowc\*(C'\fR, and \f(CW\*(C`wctomb\*(C'\fR functions now +work on shift state locales and are thread-safe on C99 and above +compilers when executed on a platform that has locale thread-safety; the +length parameters are now optional. +.PP +These functions are always executed under the current C language locale. +(See perllocale.) Most locales are stateless, but a few, notably the +very rarely encountered \s-1ISO 2022,\s0 maintain a state between calls to +these functions. Previously the state was cleared on every call, but +now the state is not reset unless the appropriate parameter is \f(CW\*(C`undef\*(C'\fR. +.PP +On threaded perls, the C99 functions \fBmbrlen\fR\|(3), \fBmbrtowc\fR\|(3), and +\&\fBwcrtomb\fR\|(3), when available, are substituted for the plain functions. +This makes these functions thread-safe when executing on a locale +thread-safe platform. +.PP +The string length parameters in \f(CW\*(C`mblen\*(C'\fR and \f(CW\*(C`mbtowc\*(C'\fR are now optional; +useful only if you wish to restrict the length parsed in the source +string to less than the actual length. +.SS "Alpha assertions are no longer experimental" +.IX Subsection "Alpha assertions are no longer experimental" +See \*(L"(*pla:pattern)\*(R" in perlre, \*(L"(*plb:pattern)\*(R" in perlre, +\&\*(L"(*nla:pattern)\*(R" in perlre>, and \*(L"(*nlb:pattern)\*(R" in perlre. +Use of these no longer generates a warning; existing code that disables +the warning category \f(CW\*(C`experimental::alpha_assertions\*(C'\fR will continue to work +without any changes needed. Enabling the category has no effect. +.SS "Script runs are no longer experimental" +.IX Subsection "Script runs are no longer experimental" +See \*(L"Script Runs\*(R" in perlre. Use of these no longer generates a warning; +existing code that disables the warning category +\&\f(CW\*(C`experimental::script_run\*(C'\fR will continue to work without any +changes needed. Enabling the category has no effect. +.SS "Feature checks are now faster" +.IX Subsection "Feature checks are now faster" +Previously feature checks in the parser required a hash lookup when +features were set outside of a feature bundle, this has been optimized +to a bit mask check. [\s-1GH\s0 #17229 ] +.SS "Perl is now developed on GitHub" +.IX Subsection "Perl is now developed on GitHub" +Perl is now developed on GitHub. You can find us at +. +.PP +Non-security bugs should now be reported via GitHub. Security issues should +continue to be reported as documented in perlsec. +.SS "Compiled patterns can now be dumped before optimization" +.IX Subsection "Compiled patterns can now be dumped before optimization" +This is primarily useful for tracking down bugs in the regular +expression compiler. This dump happens on \f(CW\*(C`\-DDEBUGGING\*(C'\fR perls, if you +specify \f(CW\*(C`\-Drv\*(C'\fR on the command line; or on any perl if the pattern is +compiled within the scope of \f(CW\*(C`use\ re\ qw(Debug\ DUMP_PRE_OPTIMIZE)\*(C'\fR or +\&\f(CW\*(C`use\ re\ qw(Debug\ COMPILE\ EXTRA)\*(C'\fR. (All but the second case display +other information as well.) +.SH "Security" +.IX Header "Security" +.SS "[\s-1CVE\-2020\-10543\s0] Buffer overflow caused by a crafted regular expression" +.IX Subsection "[CVE-2020-10543] Buffer overflow caused by a crafted regular expression" +A signed \f(CW\*(C`size_t\*(C'\fR integer overflow in the storage space calculations for +nested regular expression quantifiers could cause a heap buffer overflow in +Perl's regular expression compiler that overwrites memory allocated after the +regular expression storage space with attacker supplied data. +.PP +The target system needs a sufficient amount of memory to allocate partial +expansions of the nested quantifiers prior to the overflow occurring. This +requirement is unlikely to be met on 64\-bit systems. +.PP +Discovered by: ManhND of The Tarantula Team, VinCSS (a member of Vingroup). +.SS "[\s-1CVE\-2020\-10878\s0] Integer overflow via malformed bytecode produced by a crafted regular expression" +.IX Subsection "[CVE-2020-10878] Integer overflow via malformed bytecode produced by a crafted regular expression" +Integer overflows in the calculation of offsets between instructions for the +regular expression engine could cause corruption of the intermediate language +state of a compiled regular expression. An attacker could abuse this behaviour +to insert instructions into the compiled form of a Perl regular expression. +.PP +Discovered by: Hugo van der Sanden and Slaven Rezic. +.SS "[\s-1CVE\-2020\-12723\s0] Buffer overflow caused by a crafted regular expression" +.IX Subsection "[CVE-2020-12723] Buffer overflow caused by a crafted regular expression" +Recursive calls to \f(CW\*(C`S_study_chunk()\*(C'\fR by Perl's regular expression compiler to +optimize the intermediate language representation of a regular expression could +cause corruption of the intermediate language state of a compiled regular +expression. +.PP +Discovered by: Sergey Aleynikov. +.SS "Additional Note" +.IX Subsection "Additional Note" +An application written in Perl would only be vulnerable to any of the above +flaws if it evaluates regular expressions supplied by the attacker. Evaluating +regular expressions in this fashion is known to be dangerous since the regular +expression engine does not protect against denial of service attacks in this +usage scenario. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +.SS "Certain pattern matching features are now prohibited in compiling Unicode property value wildcard subpatterns" +.IX Subsection "Certain pattern matching features are now prohibited in compiling Unicode property value wildcard subpatterns" +These few features are either inappropriate or interfere with the +algorithm used to accomplish this task. The complete list is in +\&\*(L"Wildcards in Property Values\*(R" in perlunicode. +.ie n .SS "Unused functions ""POSIX::mbstowcs"" and ""POSIX::wcstombs"" are removed" +.el .SS "Unused functions \f(CWPOSIX::mbstowcs\fP and \f(CWPOSIX::wcstombs\fP are removed" +.IX Subsection "Unused functions POSIX::mbstowcs and POSIX::wcstombs are removed" +These functions could never have worked due to a defective interface +specification. There is clearly no demand for them, given that no one +has ever complained in the many years the functions were claimed to be +available, hence so-called \*(L"support\*(R" for them is now dropped. +.ie n .SS "A bug fix for ""(?[...])"" may have caused some patterns to no longer compile" +.el .SS "A bug fix for \f(CW(?[...])\fP may have caused some patterns to no longer compile" +.IX Subsection "A bug fix for (?[...]) may have caused some patterns to no longer compile" +See \*(L"Selected Bug Fixes\*(R". The heuristics previously used may have let +some constructs compile (perhaps not with the programmer's intended +effect) that should have been errors. None are known, but it is +possible that some erroneous constructs no longer compile. +.ie n .SS """\ep{\f(CIuser\-defined\fP}"" properties now always override official Unicode ones" +.el .SS "\f(CW\ep{\fP\f(CIuser\-defined\fP\f(CW}\fP properties now always override official Unicode ones" +.IX Subsection "p{user-defined} properties now always override official Unicode ones" +Previously, if and only if a user-defined property was declared prior to +the compilation of the regular expression pattern that contains it, its +definition was used instead of any official Unicode property with the +same name. Now, it always overrides the official property. This +change could break existing code that relied (likely unwittingly) on the +previous behavior. Without this fix, if Unicode released a new version +with a new property that happens to have the same name as the one you +had long been using, your program would break when you upgraded to a +perl that used that new Unicode version. See \*(L"User-Defined +Character Properties\*(R" in perlunicode. [\s-1GH\s0 #17205 ] +.SS "Modifiable variables are no longer permitted in constants" +.IX Subsection "Modifiable variables are no longer permitted in constants" +Code like: +.PP +.Vb 2 +\& my $var; +\& $sub = sub () { $var }; +.Ve +.PP +where \f(CW$var\fR is referenced elsewhere in some sort of modifiable context now +produces an exception when the sub is defined. +.PP +This error can be avoided by adding a return to the sub definition: +.PP +.Vb 1 +\& $sub = sub () { return $var }; +.Ve +.PP +This has been deprecated since Perl 5.22. +[perl #134138 ] +.ie n .SS "Use of ""vec"" on strings with code points above 0xFF is forbidden" +.el .SS "Use of \f(CWvec\fP on strings with code points above 0xFF is forbidden" +.IX Subsection "Use of vec on strings with code points above 0xFF is forbidden" +Such strings are represented internally in \s-1UTF\-8,\s0 and \f(CW\*(C`vec\*(C'\fR is a +bit-oriented operation that will likely give unexpected results on those +strings. This was deprecated in perl 5.28.0. +.SS "Use of code points over 0xFF in string bitwise operators" +.IX Subsection "Use of code points over 0xFF in string bitwise operators" +Some uses of these were already illegal after a previous deprecation +cycle. The remaining uses are now prohibited, having been deprecated in perl +5.28.0. See perldeprecation. +.ie n .SS """Sys::Hostname::hostname()"" does not accept arguments" +.el .SS "\f(CWSys::Hostname::hostname()\fP does not accept arguments" +.IX Subsection "Sys::Hostname::hostname() does not accept arguments" +This usage was deprecated in perl 5.28.0 and is now fatal. +.ie n .SS "Plain ""0"" string now treated as a number for range operator" +.el .SS "Plain ``0'' string now treated as a number for range operator" +.IX Subsection "Plain 0 string now treated as a number for range operator" +Previously a range \f(CW"0" .. "\-1"\fR would produce a range of numeric +strings from \*(L"0\*(R" through \*(L"99\*(R"; this now produces an empty list, just +as \f(CW\*(C`0 .. \-1\*(C'\fR does. This also means that \f(CW"0" .. "9"\fR now produces a +list of integers, where previously it would produce a list of strings. +.PP +This was due to a special case that treated strings starting with \*(L"0\*(R" +as strings so ranges like \f(CW"00" .. "03"\fR produced \f(CW"00", "01", "02", "03"\fR, +but didn't specially handle the string \f(CW"0"\fR. +[perl #133695 ] +.ie n .SS """\eK"" now disallowed in look-ahead and look-behind assertions" +.el .SS "\f(CW\eK\fP now disallowed in look-ahead and look-behind assertions" +.IX Subsection "K now disallowed in look-ahead and look-behind assertions" +This was disallowed because it causes unexpected behaviour, and no-one +could define what the desired behaviour should be. +[perl #124256 ] +.SH "Performance Enhancements" +.IX Header "Performance Enhancements" +.IP "\(bu" 4 +\&\f(CW\*(C`my_strnlen\*(C'\fR has been sped up for systems that don't have their own +\&\f(CW\*(C`strnlen\*(C'\fR implementation. +.IP "\(bu" 4 +\&\f(CW\*(C`grok_bin_oct_hex\*(C'\fR (and so, \f(CW\*(C`grok_bin\*(C'\fR, \f(CW\*(C`grok_oct\*(C'\fR, and \f(CW\*(C`grok_hex\*(C'\fR) +have been sped up. +.IP "\(bu" 4 +\&\f(CW\*(C`grok_number_flags\*(C'\fR has been sped up. +.IP "\(bu" 4 +\&\f(CW\*(C`sort\*(C'\fR is now noticeably faster in cases such as \f(CW\*(C`sort {$a <=> $b}\*(C'\fR or +\&\f(CW\*(C`sort {$b <=> $a}\*(C'\fR. [\s-1GH\s0 #17608 ] +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules and Pragmata" +.IX Subsection "Updated Modules and Pragmata" +.IP "\(bu" 4 +Archive::Tar has been upgraded from version 2.32 to 2.36. +.IP "\(bu" 4 +autodie has been upgraded from version 2.29 to 2.32. +.IP "\(bu" 4 +B has been upgraded from version 1.76 to 1.80. +.IP "\(bu" 4 +B::Deparse has been upgraded from version 1.49 to 1.54. +.IP "\(bu" 4 +Benchmark has been upgraded from version 1.22 to 1.23. +.IP "\(bu" 4 +charnames has been upgraded from version 1.45 to 1.48. +.IP "\(bu" 4 +Class::Struct has been upgraded from version 0.65 to 0.66. +.IP "\(bu" 4 +Compress::Raw::Bzip2 has been upgraded from version 2.084 to 2.093. +.IP "\(bu" 4 +Compress::Raw::Zlib has been upgraded from version 2.084 to 2.093. +.IP "\(bu" 4 +\&\s-1CPAN\s0 has been upgraded from version 2.22 to 2.27. +.IP "\(bu" 4 +DB_File has been upgraded from version 1.843 to 1.853. +.IP "\(bu" 4 +Devel::PPPort has been upgraded from version 3.52 to 3.57. +.Sp +The test files generated on Win32 are now identical to when they are +generated on POSIX-like systems. +.IP "\(bu" 4 +diagnostics has been upgraded from version 1.36 to 1.37. +.IP "\(bu" 4 +Digest::MD5 has been upgraded from version 2.55 to 2.55_01. +.IP "\(bu" 4 +Dumpvalue has been upgraded from version 1.18 to 1.21. +.Sp +Previously, when dumping elements of an array and encountering an undefined +value, the string printed would have been \f(CW\*(C`empty array\*(C'\fR. This has been +changed to what was apparently originally intended: \f(CW\*(C`empty slot\*(C'\fR. +.IP "\(bu" 4 +DynaLoader has been upgraded from version 1.45 to 1.47. +.IP "\(bu" 4 +Encode has been upgraded from version 3.01 to 3.06. +.IP "\(bu" 4 +encoding has been upgraded from version 2.22 to 3.00. +.IP "\(bu" 4 +English has been upgraded from version 1.10 to 1.11. +.IP "\(bu" 4 +Exporter has been upgraded from version 5.73 to 5.74. +.IP "\(bu" 4 +ExtUtils::CBuilder has been upgraded from version 0.280231 to 0.280234. +.IP "\(bu" 4 +ExtUtils::MakeMaker has been upgraded from version 7.34 to 7.44. +.IP "\(bu" 4 +feature has been upgraded from version 1.54 to 1.58. +.Sp +A new \f(CW\*(C`indirect\*(C'\fR feature has been added, which is enabled by default +but allows turning off indirect object syntax. +.IP "\(bu" 4 +File::Find has been upgraded from version 1.36 to 1.37. +.Sp +On Win32, the tests no longer require either a file in the drive root +directory, or a writable root directory. +.IP "\(bu" 4 +File::Glob has been upgraded from version 1.32 to 1.33. +.IP "\(bu" 4 +File::stat has been upgraded from version 1.08 to 1.09. +.IP "\(bu" 4 +Filter::Simple has been upgraded from version 0.95 to 0.96. +.IP "\(bu" 4 +Getopt::Long has been upgraded from version 2.5 to 2.51. +.IP "\(bu" 4 +Hash::Util has been upgraded from version 0.22 to 0.23. +.Sp +The Synopsis has been updated as the example code stopped working with +newer perls. +[\s-1GH\s0 #17399 ] +.IP "\(bu" 4 +I18N::Langinfo has been upgraded from version 0.18 to 0.19. +.IP "\(bu" 4 +I18N::LangTags has been upgraded from version 0.43 to 0.44. +.Sp +Document the \f(CW\*(C`IGNORE_WIN32_LOCALE\*(C'\fR environment variable. +.IP "\(bu" 4 +\&\s-1IO\s0 has been upgraded from version 1.40 to 1.43. +.Sp +IO::Socket no longer caches a zero protocol value, since this +indicates that the implementation will select a protocol. This means +that on platforms that don't implement \f(CW\*(C`SO_PROTOCOL\*(C'\fR for a given +socket type the protocol method may return \f(CW\*(C`undef\*(C'\fR. +.Sp +The supplied \fI\s-1TO\s0\fR is now always honoured on calls to the \f(CW\*(C`send()\*(C'\fR +method. [perl #133936 ] +.IP "\(bu" 4 +IO-Compress has been upgraded from version 2.084 to 2.093. +.IP "\(bu" 4 +IPC::Cmd has been upgraded from version 1.02 to 1.04. +.IP "\(bu" 4 +IPC::Open3 has been upgraded from version 1.20 to 1.21. +.IP "\(bu" 4 +\&\s-1JSON::PP\s0 has been upgraded from version 4.02 to 4.04. +.IP "\(bu" 4 +Math::BigInt has been upgraded from version 1.999816 to 1.999818. +.IP "\(bu" 4 +Math::BigInt::FastCalc has been upgraded from version 0.5008 to 0.5009. +.IP "\(bu" 4 +Module::CoreList has been upgraded from version 5.20190522 to 5.20200620. +.IP "\(bu" 4 +Module::Load::Conditional has been upgraded from version 0.68 to 0.70. +.IP "\(bu" 4 +Module::Metadata has been upgraded from version 1.000036 to 1.000037. +.IP "\(bu" 4 +mro has been upgraded from version 1.22 to 1.23. +.IP "\(bu" 4 +Net::Ping has been upgraded from version 2.71 to 2.72. +.IP "\(bu" 4 +Opcode has been upgraded from version 1.43 to 1.47. +.IP "\(bu" 4 +open has been upgraded from version 1.11 to 1.12. +.IP "\(bu" 4 +overload has been upgraded from version 1.30 to 1.31. +.IP "\(bu" 4 +parent has been upgraded from version 0.237 to 0.238. +.IP "\(bu" 4 +perlfaq has been upgraded from version 5.20190126 to 5.20200523. +.IP "\(bu" 4 +PerlIO has been upgraded from version 1.10 to 1.11. +.IP "\(bu" 4 +PerlIO::encoding has been upgraded from version 0.27 to 0.28. +.IP "\(bu" 4 +PerlIO::via has been upgraded from version 0.17 to 0.18. +.IP "\(bu" 4 +Pod::Html has been upgraded from version 1.24 to 1.25. +.IP "\(bu" 4 +Pod::Simple has been upgraded from version 3.35 to 3.40. +.IP "\(bu" 4 +podlators has been upgraded from version 4.11 to 4.14. +.IP "\(bu" 4 +\&\s-1POSIX\s0 has been upgraded from version 1.88 to 1.94. +.IP "\(bu" 4 +re has been upgraded from version 0.37 to 0.40. +.IP "\(bu" 4 +Safe has been upgraded from version 2.40 to 2.41. +.IP "\(bu" 4 +Scalar::Util has been upgraded from version 1.50 to 1.55. +.IP "\(bu" 4 +SelfLoader has been upgraded from version 1.25 to 1.26. +.IP "\(bu" 4 +Socket has been upgraded from version 2.027 to 2.029. +.IP "\(bu" 4 +Storable has been upgraded from version 3.15 to 3.21. +.Sp +Use of \f(CW\*(C`note()\*(C'\fR from Test::More is now optional in tests. This works +around a circular dependency with Test::More when installing on very +old perls from \s-1CPAN.\s0 +.Sp +Vstring magic strings over 2GB are now disallowed. +.Sp +Regular expressions objects weren't properly counted for object id +purposes on retrieve. This would corrupt the resulting structure, or +cause a runtime error in some cases. [perl #134179 ] +.IP "\(bu" 4 +Sys::Hostname has been upgraded from version 1.22 to 1.23. +.IP "\(bu" 4 +Sys::Syslog has been upgraded from version 0.35 to 0.36. +.IP "\(bu" 4 +Term::ANSIColor has been upgraded from version 4.06 to 5.01. +.IP "\(bu" 4 +Test::Simple has been upgraded from version 1.302162 to 1.302175. +.IP "\(bu" 4 +Thread has been upgraded from version 3.04 to 3.05. +.IP "\(bu" 4 +Thread::Queue has been upgraded from version 3.13 to 3.14. +.IP "\(bu" 4 +threads has been upgraded from version 2.22 to 2.25. +.IP "\(bu" 4 +threads::shared has been upgraded from version 1.60 to 1.61. +.IP "\(bu" 4 +Tie::File has been upgraded from version 1.02 to 1.06. +.IP "\(bu" 4 +Tie::Hash::NamedCapture has been upgraded from version 0.10 to 0.13. +.IP "\(bu" 4 +Tie::Scalar has been upgraded from version 1.04 to 1.05. +.IP "\(bu" 4 +Tie::StdHandle has been upgraded from version 4.5 to 4.6. +.IP "\(bu" 4 +Time::HiRes has been upgraded from version 1.9760 to 1.9764. +.Sp +Removed obsolete code such as support for pre\-5.6 perl and classic +MacOS. [perl #134288 ] +.IP "\(bu" 4 +Time::Piece has been upgraded from version 1.33 to 1.3401. +.IP "\(bu" 4 +Unicode::Normalize has been upgraded from version 1.26 to 1.27. +.IP "\(bu" 4 +Unicode::UCD has been upgraded from version 0.72 to 0.75. +.IP "\(bu" 4 +VMS::Stdio has been upgraded from version 2.44 to 2.45. +.IP "\(bu" 4 +warnings has been upgraded from version 1.44 to 1.47. +.IP "\(bu" 4 +Win32 has been upgraded from version 0.52 to 0.53. +.IP "\(bu" 4 +Win32API::File has been upgraded from version 0.1203 to 0.1203_01. +.IP "\(bu" 4 +XS::APItest has been upgraded from version 1.00 to 1.09. +.SS "Removed Modules and Pragmata" +.IX Subsection "Removed Modules and Pragmata" +.IP "\(bu" 4 +Pod::Parser has been removed from the core distribution. +It still is available for download from \s-1CPAN.\s0 This resolves [perl +#119439 ]. +.SH "Documentation" +.IX Header "Documentation" +.SS "Changes to Existing Documentation" +.IX Subsection "Changes to Existing Documentation" +We have attempted to update the documentation to reflect the changes +listed in this document. If you find any we have missed, open an issue +at . +.PP +Additionally, the following selected changes have been made: +.PP +\fIperldebguts\fR +.IX Subsection "perldebguts" +.IP "\(bu" 4 +Simplify a few regnode definitions +.Sp +Update \f(CW\*(C`BOUND\*(C'\fR and \f(CW\*(C`NBOUND\*(C'\fR definitions. +.IP "\(bu" 4 +Add ANYOFHs regnode +.Sp +This node is like \f(CW\*(C`ANYOFHb\*(C'\fR, but is used when more than one leading byte +is the same in all the matched code points. +.Sp +\&\f(CW\*(C`ANYOFHb\*(C'\fR is used to avoid having to convert from \s-1UTF\-8\s0 to code point for +something that won't match. It checks that the first byte in the \s-1UTF\-8\s0 +encoded target is the desired one, thus ruling out most of the possible +code points. +.PP +\fIperlapi\fR +.IX Subsection "perlapi" +.IP "\(bu" 4 +\&\f(CW\*(C`sv_2pvbyte\*(C'\fR updated to mention it will croak if the \s-1SV\s0 cannot be +downgraded. +.IP "\(bu" 4 +\&\f(CW\*(C`sv_setpvn\*(C'\fR updated to mention that the \s-1UTF\-8\s0 flag will not be changed by +this function, and a terminating \s-1NUL\s0 byte is guaranteed. +.IP "\(bu" 4 +Documentation for \f(CW\*(C`PL_phase\*(C'\fR has been added. +.IP "\(bu" 4 +The documentation for \f(CW\*(C`grok_bin\*(C'\fR, \f(CW\*(C`grok_oct\*(C'\fR, and \f(CW\*(C`grok_hex\*(C'\fR has been +updated and clarified. +.PP +\fIperldiag\fR +.IX Subsection "perldiag" +.IP "\(bu" 4 +Add documentation for experimental 'isa' operator +.Sp +(S experimental::isa) This warning is emitted if you use the (\f(CW\*(C`isa\*(C'\fR) +operator. This operator is currently experimental and its behaviour may +change in future releases of Perl. +.PP +\fIperlfunc\fR +.IX Subsection "perlfunc" +.ie n .IP """caller""" 4 +.el .IP "\f(CWcaller\fR" 4 +.IX Item "caller" +Like \f(CW\*(C`_\|_FILE_\|_\*(C'\fR and \f(CW\*(C`_\|_LINE_\|_\*(C'\fR, the filename and +line number returned here may be altered by the mechanism described at +\&\*(L"Plain Old Comments (Not!)\*(R" in perlsyn. +.ie n .IP """_\|_FILE_\|_""" 4 +.el .IP "\f(CW_\|_FILE_\|_\fR" 4 +.IX Item "__FILE__" +It can be altered by the mechanism described at +\&\*(L"Plain Old Comments (Not!)\*(R" in perlsyn. +.ie n .IP """_\|_LINE_\|_""" 4 +.el .IP "\f(CW_\|_LINE_\|_\fR" 4 +.IX Item "__LINE__" +It can be altered by the mechanism described at +\&\*(L"Plain Old Comments (Not!)\*(R" in perlsyn. +.ie n .IP """return""" 4 +.el .IP "\f(CWreturn\fR" 4 +.IX Item "return" +Now mentions that you cannot return from \f(CW\*(C`do BLOCK\*(C'\fR. +.ie n .IP """open""" 4 +.el .IP "\f(CWopen\fR" 4 +.IX Item "open" +The \f(CW\*(C`open()\*(C'\fR section had been renovated significantly. +.PP +\fIperlguts\fR +.IX Subsection "perlguts" +.IP "\(bu" 4 +No longer suggesting using perl's \f(CW\*(C`malloc\*(C'\fR. Modern system \f(CW\*(C`malloc\*(C'\fR is +assumed to be much better than perl's implementation now. +.IP "\(bu" 4 +Documentation about \fIembed.fnc\fR flags has been removed. \fIembed.fnc\fR now has +sufficient comments within it. Anyone changing that file will see those +comments first, so entries here are now redundant. +.IP "\(bu" 4 +Updated documentation for \f(CW\*(C`UTF8f\*(C'\fR +.IP "\(bu" 4 +Added missing \f(CW\*(C`=for apidoc\*(C'\fR lines +.PP +\fIperlhacktips\fR +.IX Subsection "perlhacktips" +.IP "\(bu" 4 +The differences between Perl strings and C strings are now detailed. +.PP +\fIperlintro\fR +.IX Subsection "perlintro" +.IP "\(bu" 4 +The documentation for the repetition operator \f(CW\*(C`x\*(C'\fR have been clarified. +[\s-1GH\s0 #17335 ] +.PP +\fIperlipc\fR +.IX Subsection "perlipc" +.IP "\(bu" 4 +The documentation surrounding \f(CW\*(C`open\*(C'\fR and handle usage has been modernized +to prefer 3\-arg open and lexical variables instead of barewords. +.IP "\(bu" 4 +Various updates and fixes including making all examples strict-safe and +replacing \f(CW\*(C`\-w\*(C'\fR with \f(CW\*(C`use warnings\*(C'\fR. +.PP +\fIperlop\fR +.IX Subsection "perlop" +.IP "\(bu" 4 +\&'isa' operator is experimental +.Sp +This is an experimental feature and is available when enabled +by \f(CW\*(C`use feature \*(Aqisa\*(Aq\*(C'\fR. It emits a warning in the \f(CW\*(C`experimental::isa\*(C'\fR +category. +.PP +\fIperlpod\fR +.IX Subsection "perlpod" +.IP "\(bu" 4 +Details of the various stacks within the perl interpreter are now explained +here. +.IP "\(bu" 4 +Advice has been added regarding the usage of \f(CW\*(C`Z<>\*(C'\fR. +.PP +\fIperlport\fR +.IX Subsection "perlport" +.IP "\(bu" 4 +Update \f(CW\*(C`timegm\*(C'\fR example to use the correct year format \fI1970\fR instead of \fI70\fR. +[\s-1GH\s0 #16431 ] +.PP +\fIperlreref\fR +.IX Subsection "perlreref" +.IP "\(bu" 4 +Fix some typos. +.PP +\fIperlvar\fR +.IX Subsection "perlvar" +.IP "\(bu" 4 +Now recommends stringifying \f(CW$]\fR and comparing it numerically. +.PP +\fIperlapi, perlintern\fR +.IX Subsection "perlapi, perlintern" +.IP "\(bu" 4 +Documentation has been added for several functions that were +lacking it before. +.PP +\fIperlxs\fR +.IX Subsection "perlxs" +.IP "\(bu" 4 +Suggest using \f(CW\*(C`libffi\*(C'\fR for simple library bindings via \s-1CPAN\s0 modules +like FFI::Platypus or FFI::Raw. +.PP +\fI\s-1POSIX\s0\fR +.IX Subsection "POSIX" +.IP "\(bu" 4 +\&\f(CW\*(C`setlocale\*(C'\fR warning about threaded builds updated to note it does not +apply on Perl 5.28.X and later. +.IP "\(bu" 4 +\&\f(CW\*(C`Posix::SigSet\->new(...)\*(C'\fR updated to state it throws an error if any of +the supplied signals cannot be added to the set. +.PP +Additionally, the following selected changes have been made: +.PP +\fIUpdating of links\fR +.IX Subsection "Updating of links" +.IP "\(bu" 4 +Links to the now defunct site now point at +the equivalent \s-1URL.\s0 [\s-1GH\s0 #17393 ] +.IP "\(bu" 4 +The man page for ExtUtils::XSSymSet is now only installed on \s-1VMS,\s0 +which is the only platform the module is installed on. [\s-1GH\s0 #17424 ] +.IP "\(bu" 4 +URLs have been changed to \f(CW\*(C`https://\*(C'\fR and stale links have been updated. +.Sp +Where applicable, the URLs in the documentation have been moved from using the +\&\f(CW\*(C`http://\*(C'\fR protocol to \f(CW\*(C`https://\*(C'\fR. This also affects the location of the bug +tracker at . +.IP "\(bu" 4 +Some links to \s-1OS/2\s0 libraries, Address Sanitizer and other system tools had gone +stale. These have been updated with working links. +.IP "\(bu" 4 +Some links to old email addresses on perl5\-porters had gone stale. These have been +updated with working links. +.SH "Diagnostics" +.IX Header "Diagnostics" +The following additions or changes have been made to diagnostic output, +including warnings and fatal error messages. For the complete list of +diagnostic messages, see perldiag. +.SS "New Diagnostics" +.IX Subsection "New Diagnostics" +\fINew Errors\fR +.IX Subsection "New Errors" +.IP "\(bu" 4 +Expecting interpolated extended charclass in regex; marked by <\-\- \s-1HERE\s0 in m/%s/ +.Sp +This is a replacement for several error messages listed under +\&\*(L"Changes to Existing Diagnostics\*(R". +.IP "\(bu" 4 +\&\f(CW\*(C`No digits found for %s literal\*(C'\fR +.Sp +(F) No hexadecimal digits were found following \f(CW\*(C`0x\*(C'\fR or no binary digits were +found following \f(CW\*(C`0b\*(C'\fR. +.PP +\fINew Warnings\fR +.IX Subsection "New Warnings" +.IP "\(bu" 4 +Code point 0x%X is not Unicode, and not portable +.Sp +This is actually not a new message, but it is now output when the +warnings category \f(CW\*(C`portable\*(C'\fR is enabled. +.Sp +When raised during regular expression pattern compilation, the warning +has extra text added at the end marking where precisely in the pattern +it occurred. +.IP "\(bu" 4 +Non-hex character '%c' terminates \ex early. Resolved as \*(L"%s\*(R" +.Sp +This replaces a warning that was much less specific, and which gave +false information. This new warning parallels the similar +already-existing one raised for \f(CW\*(C`\eo{}\*(C'\fR. +.SS "Changes to Existing Diagnostics" +.IX Subsection "Changes to Existing Diagnostics" +.IP "\(bu" 4 +Character following \*(L"\ec\*(R" must be printable \s-1ASCII\s0 +.Sp +\&...now has extra text added at the end, when raised during regular +expression pattern compilation, marking where precisely in the pattern +it occurred. +.IP "\(bu" 4 +Use \*(L"%s\*(R" instead of \*(L"%s\*(R" +.Sp +\&...now has extra text added at the end, when raised during regular +expression pattern compilation, marking where precisely in the pattern +it occurred. +.IP "\(bu" 4 +Sequence \*(L"\ec{\*(R" invalid +.Sp +\&...now has extra text added at the end, when raised during regular +expression pattern compilation, marking where precisely in the pattern +it occurred. +.IP "\(bu" 4 +\&\*(L"\ec%c\*(R" is more clearly written simply as \*(L"%s\*(R" +.Sp +\&...now has extra text added at the end, when raised during regular +expression pattern compilation, marking where precisely in the pattern +it occurred. +.IP "\(bu" 4 +Non-octal character '%c' terminates \eo early. Resolved as \*(L"%s\*(R" +.Sp +\&...now includes the phrase \*(L"terminates \eo early\*(R", and has extra text added +at the end, when raised during regular expression pattern compilation, +marking where precisely in the pattern it occurred. In some instances +the text of the resolution has been clarified. +.IP "\(bu" 4 +\&'%s' resolved to '\eo{%s}%d' +.Sp +As of Perl 5.32, this message is no longer generated. Instead, +\&\*(L"Non-octal character '%c' terminates \eo early. Resolved as \*(R"%s"" in perldiag +is used instead. +.IP "\(bu" 4 +Use of code point 0x%s is not allowed; the permissible max is 0x%X +.Sp +Some instances of this message previously output the hex digits \f(CW\*(C`A\*(C'\fR, +\&\f(CW\*(C`B\*(C'\fR, \f(CW\*(C`C\*(C'\fR, \f(CW\*(C`D\*(C'\fR, \f(CW\*(C`E\*(C'\fR, and \f(CW\*(C`F\*(C'\fR in lower case. Now they are all +consistently upper case. +.IP "\(bu" 4 +The following three diagnostics have been removed, and replaced by +\&\f(CW\*(C`Expecting interpolated extended charclass in regex; marked by <\-\- HERE in m/%s/\*(C'\fR +: +\&\f(CW\*(C`Expecting close paren for nested extended charclass in regex; marked +by <\-\- HERE in m/%s/\*(C'\fR, +\&\f(CW\*(C`Expecting close paren for wrapper for nested extended charclass in +regex; marked by <\-\- HERE in m/%s/\*(C'\fR, +and +\&\f(CW\*(C`Expecting \*(Aq(?flags:(?[...\*(Aq in regex; marked by <\-\-\ HERE in m/%s/\*(C'\fR. +.IP "\(bu" 4 +The \f(CW\*(C`Code point 0x%X is not Unicode, and not portable\*(C'\fR warning removed +the line \f(CW\*(C`Code points above 0xFFFF_FFFF require larger than a 32 bit word.\*(C'\fR +as code points that large are no longer legal on 32\-bit platforms. +.IP "\(bu" 4 +Can't use global \f(CW%s\fR in \f(CW%s\fR +.Sp +This error message has been slightly reformatted from the original \f(CW\*(C`Can\*(Aqt use +global %s in "%s"\*(C'\fR, and in particular misleading error messages like \f(CW\*(C`Can\*(Aqt +use global $_ in "my"\*(C'\fR are now rendered as \f(CW\*(C`Can\*(Aqt use global $_ in subroutine +signature\*(C'\fR. +.IP "\(bu" 4 +Constants from lexical variables potentially modified elsewhere are no longer permitted +.Sp +This error message replaces the former \f(CW\*(C`Constants from lexical variables +potentially modified elsewhere are deprecated. This will not be allowed in Perl +5.32\*(C'\fR to reflect the fact that this previously deprecated usage has now been +transformed into an exception. The message's classification has also been +updated from D (deprecated) to F (fatal). +.Sp +See also \*(L"Incompatible Changes\*(R". +.IP "\(bu" 4 +\&\f(CW\*(C`\eN{} here is restricted to one character\*(C'\fR is now emitted in the same +circumstances where previously \f(CW\*(C`\eN{} in inverted character class or as a range +end\-point is restricted to one character\*(C'\fR was. +.Sp +This is due to new circumstances having been added in Perl 5.30 that weren't +covered by the earlier wording. +.SH "Utility Changes" +.IX Header "Utility Changes" +.SS "perlbug" +.IX Subsection "perlbug" +.IP "\(bu" 4 +The bug tracker homepage \s-1URL\s0 now points to GitHub. +.SS "streamzip" +.IX Subsection "streamzip" +.IP "\(bu" 4 +This is a new utility, included as part of an +IO::Compress::Base upgrade. +.Sp +streamzip creates a zip file from stdin. The program will read data +from stdin, compress it into a zip container and, by default, write a +streamed zip file to stdout. +.SH "Configuration and Compilation" +.IX Header "Configuration and Compilation" +.SS "\fIConfigure\fP" +.IX Subsection "Configure" +.IP "\(bu" 4 +For clang++, add \f(CW\*(C`#include \*(C'\fR to Configure's probes for +\&\f(CW\*(C`futimes\*(C'\fR, \f(CW\*(C`strtoll\*(C'\fR, \f(CW\*(C`strtoul\*(C'\fR, \f(CW\*(C`strtoull\*(C'\fR, \f(CW\*(C`strtouq\*(C'\fR, otherwise the +probes would fail to compile. +.IP "\(bu" 4 +Use a compile and run test for \f(CW\*(C`lchown\*(C'\fR to satisfy clang++ which should +more reliably detect it. +.IP "\(bu" 4 +For \*(C+ compilers, add \f(CW\*(C`#include \*(C'\fR to Configure's probes for +\&\f(CW\*(C`getpgrp\*(C'\fR and \f(CW\*(C`setpgrp\*(C'\fR as they use printf and \*(C+ compilers may fail +compilation instead of just warning. +.IP "\(bu" 4 +Check if the compiler can handle inline attribute. +.IP "\(bu" 4 +Check for character data alignment. +.IP "\(bu" 4 +\&\fIConfigure\fR now correctly handles gcc\-10. Previously it was interpreting it +as gcc\-1 and turned on \f(CW\*(C`\-fpcc\-struct\-return\*(C'\fR. +.IP "\(bu" 4 +Perl now no longer probes for \f(CW\*(C`d_u32align\*(C'\fR, defaulting to \f(CW\*(C`define\*(C'\fR on all +platforms. This check was error-prone when it was done, which was on 32\-bit +platforms only. +[perl #133495 ] +.IP "\(bu" 4 +Documentation and hints for building perl on Z/OS (native \s-1EBCDIC\s0) have been +updated. This is still a work in progress. +.IP "\(bu" 4 +A new probe for \f(CW\*(C`malloc_usable_size\*(C'\fR has been added. +.IP "\(bu" 4 +Improvements in \fIConfigure\fR to detection in \*(C+ and clang++. Work ongoing by +Andy Dougherty. [perl #134171 ] +.IP "\(bu" 4 +\&\fIautodoc.pl\fR +.Sp +This tool that regenerates perlintern and perlapi has been overhauled +significantly, restoring consistency in flags used in \fIembed.fnc\fR and +Devel::PPPort and allowing removal of many redundant \f(CW\*(C`=for apidoc\*(C'\fR +entries in code. +.IP "\(bu" 4 +The \f(CW\*(C`ECHO\*(C'\fR macro is now defined. This is used in a \f(CW\*(C`dtrace\*(C'\fR rule that was +originally changed for FreeBSD, and the FreeBSD make apparently predefines it. +The Solaris make does not predefine \f(CW\*(C`ECHO\*(C'\fR which broke this rule on Solaris. +[perl #134218 ] +.IP "\(bu" 4 +Bison versions 3.1 through 3.4 are now supported. +.SH "Testing" +.IX Header "Testing" +Tests were added and changed to reflect the other additions and +changes in this release. Furthermore, these significant changes were +made: +.IP "\(bu" 4 +\&\fIt/run/switches.t\fR no longer uses (and re-uses) the \fItmpinplace/\fR +directory under \fIt/\fR. This may prevent spurious failures. [\s-1GH\s0 #17424 ] +.IP "\(bu" 4 +Various bugs in \f(CW\*(C`POSIX::mbtowc\*(C'\fR were fixed. Potential races with +other threads are now avoided, and previously the returned wide +character could well be garbage. +.IP "\(bu" 4 +Various bugs in \f(CW\*(C`POSIX::wctomb\*(C'\fR were fixed. Potential races with other +threads are now avoided, and previously it would segfault if the string +parameter was shared or hadn't been pre-allocated with a string of +sufficient length to hold the result. +.IP "\(bu" 4 +Certain test output of scalars containing control characters and Unicode +has been fixed on \s-1EBCDIC.\s0 +.IP "\(bu" 4 +\&\fIt/charset_tools.pl\fR: Avoid some work on \s-1ASCII\s0 platforms. +.IP "\(bu" 4 +\&\fIt/re/regexp.t\fR: Speed up many regex tests on \s-1ASCII\s0 platform +.IP "\(bu" 4 +\&\fIt/re/pat.t\fR: Skip tests that don't work on \s-1EBCDIC.\s0 +.SH "Platform Support" +.IX Header "Platform Support" +.SS "Discontinued Platforms" +.IX Subsection "Discontinued Platforms" +.IP "Windows \s-1CE\s0" 4 +.IX Item "Windows CE" +Support for building perl on Windows \s-1CE\s0 has now been removed. +.SS "Platform-Specific Notes" +.IX Subsection "Platform-Specific Notes" +.IP "Linux" 4 +.IX Item "Linux" +\&\f(CW\*(C`cc\*(C'\fR will be used to populate \f(CW\*(C`plibpth\*(C'\fR if \f(CW\*(C`cc\*(C'\fR is \f(CW\*(C`clang\*(C'\fR. +[perl #134189 ] +.IP "NetBSD 8.0" 4 +.IX Item "NetBSD 8.0" +Fix compilation of Perl on NetBSD 8.0 with g++. +[\s-1GH\s0 #17381 ] +.IP "Windows" 4 +.IX Item "Windows" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +The configuration for \f(CW\*(C`ccflags\*(C'\fR and \f(CW\*(C`optimize\*(C'\fR are now separate, as +with \s-1POSIX\s0 platforms. [\s-1GH\s0 #17156 ] +.IP "\(bu" 4 +Support for building perl with Visual \*(C+ 6.0 has now been removed. +.IP "\(bu" 4 +The locale tests could crash on Win32 due to a Windows bug, and +separately due to the \s-1CRT\s0 throwing an exception if the locale name +wasn't validly encoded in the current code page. +.Sp +For the second we now decode the locale name ourselves, and always +decode it as \s-1UTF\-8.\s0 [perl #133981 ] +.IP "\(bu" 4 +\&\fIt/op/magic.t\fR could fail if environment variables starting with +\&\f(CW\*(C`FOO\*(C'\fR already existed. +.IP "\(bu" 4 +\&\s-1MYMALLOC\s0 (\s-1PERL_MALLOC\s0) build has been fixed. +.RE +.RS 4 +.RE +.IP "Solaris" 4 +.IX Item "Solaris" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +\&\f(CW\*(C`Configure\*(C'\fR will now find recent versions of the Oracle Developer Studio +compiler, which are found under \f(CW\*(C`/opt/developerstudio*\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`Configure\*(C'\fR now uses the detected types for \f(CW\*(C`gethostby*\*(C'\fR functions, allowing +Perl to once again compile on certain configurations of Solaris. +.RE +.RS 4 +.RE +.IP "\s-1VMS\s0" 4 +.IX Item "VMS" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +With the release of the patch kit C99 V2.0, \s-1VSI\s0 has provided support for a +number of previously-missing C99 features. On systems with that patch kit +installed, Perl's configuration process will now detect the presence of the +header \f(CW\*(C`stdint.h\*(C'\fR and the following functions: \f(CW\*(C`fpclassify\*(C'\fR, \f(CW\*(C`isblank\*(C'\fR, \f(CW\*(C`isless\*(C'\fR, +\&\f(CW\*(C`llrint\*(C'\fR, \f(CW\*(C`llrintl\*(C'\fR, \f(CW\*(C`llround\*(C'\fR, \f(CW\*(C`llroundl\*(C'\fR, \f(CW\*(C`nearbyint\*(C'\fR, \f(CW\*(C`round\*(C'\fR, \f(CW\*(C`scalbn\*(C'\fR, +and \f(CW\*(C`scalbnl\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`\-Duse64bitint\*(C'\fR is now the default on \s-1VMS.\s0 +.RE +.RS 4 +.RE +.IP "z/OS" 4 +.IX Item "z/OS" +Perl 5.32 has been tested on z/OS 2.4, with the following caveats: +.RS 4 +.IP "\(bu" 4 +Only static builds (the default) build reliably +.IP "\(bu" 4 +When using locales, z/OS does not handle the \f(CW\*(C`LC_MESSAGES\*(C'\fR category +properly, so when compiling perl, you should add the following to your +\&\fIConfigure\fR options +.Sp +.Vb 1 +\& ./Configure \-Accflags=\-DNO_LOCALE_MESSAGES +.Ve +.IP "\(bu" 4 +z/OS does not support locales with threads, so when compiling a threaded +perl, you should add the following to your \fIConfigure\fR options +.Sp +.Vb 1 +\& ./Configure \-Accflags=\-DNO_LOCALE +.Ve +.IP "\(bu" 4 +Some \s-1CPAN\s0 modules that are shipped with perl fail at least one of their +self-tests. These are: +Archive::Tar, +Config::Perl::V, +CPAN::Meta, +CPAN::Meta::YAML, +Digest::MD5, +Digest::SHA, +Encode, +ExtUtils::MakeMaker, +ExtUtils::Manifest, +HTTP::Tiny, +IO::Compress, +IPC::Cmd, +\&\s-1JSON::PP,\s0 +libnet, +MIME::Base64, +Module::Metadata, +PerlIO::via\-QuotedPrint, +Pod::Checker, +podlators, +Pod::Simple, +Socket, +and Test::Harness. +.Sp +The causes of the failures range from the self-test itself is flawed, +and the module actually works fine, up to the module doesn't work at all +on \s-1EBCDIC\s0 platforms. +.RE +.RS 4 +.RE +.SH "Internal Changes" +.IX Header "Internal Changes" +.IP "\(bu" 4 +\&\f(CW\*(C`savepvn\*(C'\fR's len parameter is now a \f(CW\*(C`Size_t\*(C'\fR instead of an \f(CW\*(C`I32\*(C'\fR since we +can handle longer strings than 31 bits. +.IP "\(bu" 4 +The lexer (\f(CW\*(C`Perl_yylex()\*(C'\fR in \fItoke.c\fR) was previously a single 4100\-line +function, relying heavily on \f(CW\*(C`goto\*(C'\fR and a lot of widely-scoped local variables +to do its work. It has now been pulled apart into a few dozen smaller static +functions; the largest remaining chunk (\f(CW\*(C`yyl_word_or_keyword()\*(C'\fR) is a little +over 900 lines, and consists of a single \f(CW\*(C`switch\*(C'\fR statement, all of whose +\&\f(CW\*(C`case\*(C'\fR groups are independent. This should be much easier to understand and +maintain. +.IP "\(bu" 4 +The OS-level signal handlers and type (Sighandler_t) used by the perl core +were declared as having three parameters, but the \s-1OS\s0 was always told to +call them with one argument. This has been fixed by declaring them to have +one parameter. See the merge commit \f(CW\*(C`v5.31.5\-346\-g116e19abbf\*(C'\fR for full +details. +.IP "\(bu" 4 +The code that handles \f(CW\*(C`tr///\*(C'\fR has been extensively revised, fixing +various bugs, especially when the source and/or replacement strings +contain characters whose code points are above 255. Some of the bugs +were undocumented, one being that under some circumstances (but not all) +with \f(CW\*(C`/s\*(C'\fR, the squeezing was done based on the source, rather than the +replacement. A documented bug that got fixed was +[perl #125493 ]. +.IP "\(bu" 4 +A new macro for \s-1XS\s0 writers dealing with UTF\-8\-encoded Unicode strings +has been created "\f(CW\*(C`UTF8_CHK_SKIP\*(C'\fR" in perlapi that is safer in the face +of malformed \s-1UTF\-8\s0 input than "\f(CW\*(C`UTF8_SKIP\*(C'\fR" in perlapi (but not as safe +as "\f(CW\*(C`UTF8_SAFE_SKIP\*(C'\fR" in perlapi). It won't read past a \s-1NUL\s0 character. +It has been backported in Devel::PPPort 3.55 and later. +.IP "\(bu" 4 +Added the \f(CW\*(C`PL_curstackinfo\->si_cxsubix\*(C'\fR field. This records the stack index +of the most recently pushed sub/format/eval context. It is set and restored +automatically by \f(CW\*(C`cx_pushsub()\*(C'\fR, \f(CW\*(C`cx_popsub()\*(C'\fR etc., but would need to be +manually managed if you do any unusual manipulation of the context stack. +.IP "\(bu" 4 +Various macros dealing with character type classification and changing case +where the input is encoded in \s-1UTF\-8\s0 now require an extra parameter to prevent +potential reads beyond the end of the buffer. Use of these has generated a +deprecation warning since Perl 5.26. Details are in +\&\*(L"In \s-1XS\s0 code, use of various macros dealing with \s-1UTF\-8.\*(R"\s0 in perldeprecation +.IP "\(bu" 4 +A new parser function \fBparse_subsignature()\fR +allows a keyword plugin to parse a subroutine signature while \f(CW\*(C`use feature +\&\*(Aqsignatures\*(Aq\*(C'\fR is in effect. This allows custom keywords to implement +semantics similar to regular \f(CW\*(C`sub\*(C'\fR declarations that include signatures. +[perl #132474 ] +.IP "\(bu" 4 +Since on some platforms we need to hold a mutex when temporarily +switching locales, new macros (\f(CW\*(C`STORE_LC_NUMERIC_SET_TO_NEEDED_IN\*(C'\fR, +\&\f(CW\*(C`WITH_LC_NUMERIC_SET_TO_NEEDED\*(C'\fR and \f(CW\*(C`WITH_LC_NUMERIC_SET_TO_NEEDED_IN\*(C'\fR) +have been added to make it easier to do this safely and efficiently +as part of [perl #134172 ]. +.IP "\(bu" 4 +The memory bookkeeping overhead for allocating an \s-1OP\s0 structure has been +reduced by 8 bytes per \s-1OP\s0 on 64\-bit systems. +.IP "\(bu" 4 +\&\fBeval_pv()\fR no longer stringifies the exception when +\&\f(CW\*(C`croak_on_error\*(C'\fR is true. [perl #134175 ] +.IP "\(bu" 4 +The \s-1PERL_DESTRUCT_LEVEL\s0 environment variable was formerly only honoured on perl +binaries built with \s-1DEBUGGING\s0 support. It is now checked on all perl builds. +Its normal use is to force perl to individually free every block of memory +which it has allocated before exiting, which is useful when using automated +leak detection tools such as valgrind. +.IP "\(bu" 4 +The \s-1API\s0 \fBeval_sv()\fR now accepts a \f(CW\*(C`G_RETHROW\*(C'\fR flag. If this flag is set and an +exception is thrown while compiling or executing the supplied code, it will be +rethrown, and \fBeval_sv()\fR will not return. +[perl #134177 ] +.IP "\(bu" 4 +As part of the fix for +[perl #2754 ] \fBperl_parse()\fR +now returns non-zero if \fBexit\fR\|(0) is called in a \f(CW\*(C`BEGIN\*(C'\fR, \f(CW\*(C`UNITCHECK\*(C'\fR or +\&\f(CW\*(C`CHECK\*(C'\fR block. +.IP "\(bu" 4 +Most functions which recursively walked an op tree during compilation have been +made non-recursive. This avoids SEGVs from stack overflow when the op tree is +deeply nested, such as \f(CW\*(C`$n == 1 ? "one" : $n == 2 ? "two" : ....\*(C'\fR (especially +in code which is auto-generated). +.Sp +This is particularly noticeable where the code is compiled within a separate +thread, as threads tend to have small stacks by default. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.IP "\(bu" 4 +Previously \*(L"require\*(R" in perlfunc would only treat the special built-in +\&\s-1SV\s0 \f(CW&PL_sv_undef\fR as a value in \f(CW%INC\fR as if a previous \f(CW\*(C`require\*(C'\fR +has failed, treating other undefined SVs as if the previous \f(CW\*(C`require\*(C'\fR +has succeeded. This could cause unexpected success from \f(CW\*(C`require\*(C'\fR +e.g., on \f(CW\*(C`local %INC = %INC;\*(C'\fR. This has been fixed. [\s-1GH\s0 #17428 ] +.IP "\(bu" 4 +\&\f(CW\*(C`(?{...})\*(C'\fR eval groups in regular expressions no longer unintentionally +trigger \*(L"\s-1EVAL\s0 without pos change exceeded limit in regex\*(R" [\s-1GH\s0 #17490 ]. +.IP "\(bu" 4 +\&\f(CW\*(C`(?[...])\*(C'\fR extended bracketed character classes do not wrongly raise an +error on some cases where a previously-compiled such class is +interpolated into another. The heuristics previously used have been +replaced by a reliable method, and hence the diagnostics generated have +changed. See \*(L"Diagnostics\*(R". +.IP "\(bu" 4 +The debug display (say by specifying \f(CW\*(C`\-Dr\*(C'\fR or \f(CW\*(C`use\ re\*(C'\fR (with +appropriate options) of compiled Unicode property wildcard subpatterns no +longer has extraneous output. +.IP "\(bu" 4 +Fix an assertion failure in the regular expression engine. +[\s-1GH\s0 #17372 ] +.IP "\(bu" 4 +Fix coredump in pp_hot.c after \f(CW\*(C`B::UNOP_AUX::aux_list()\*(C'\fR. +[\s-1GH\s0 #17301 ] +.IP "\(bu" 4 +Loading \s-1IO\s0 is now threadsafe. +[\s-1GH\s0 #14816 ] +.IP "\(bu" 4 +\&\f(CW\*(C`\ep{user\-defined}\*(C'\fR overrides official Unicode [\s-1GH\s0 #17025 ] +.Sp +Prior to this patch, the override was only sometimes in effect. +.IP "\(bu" 4 +Properly handle filled \f(CW\*(C`/il\*(C'\fR regnodes and multi-char folds +.IP "\(bu" 4 +Compilation error during make minitest [\s-1GH\s0 #17293 ] +.IP "\(bu" 4 +Move the implementation of \f(CW\*(C`%\-\*(C'\fR, \f(CW\*(C`%+\*(C'\fR into core. +.IP "\(bu" 4 +Read beyond buffer in \f(CW\*(C`grok_inf_nan\*(C'\fR [\s-1GH\s0 #17370 ] +.IP "\(bu" 4 +Workaround glibc bug with \f(CW\*(C`LC_MESSAGES\*(C'\fR [\s-1GH\s0 #17081 ] +.IP "\(bu" 4 +\&\f(CW\*(C`printf()\*(C'\fR or \f(CW\*(C`sprintf()\*(C'\fR with the \f(CW%n\fR format could cause a panic on +debugging builds, or report an incorrectly cached length value when +producing \f(CW\*(C`SVfUTF8\*(C'\fR flagged strings. [\s-1GH\s0 #17221 ] +.IP "\(bu" 4 +The tokenizer has been extensively refactored. +[\s-1GH\s0 #17241 ] +[\s-1GH\s0 #17189 ] +.IP "\(bu" 4 +\&\f(CW\*(C`use strict "subs"\*(C'\fR is now enforced for bareword constants optimized +into a \f(CW\*(C`multiconcat\*(C'\fR operator. [\s-1GH\s0 #17254 ] +.IP "\(bu" 4 +A memory leak in regular expression patterns has been fixed. [\s-1GH\s0 #17218 ] +.IP "\(bu" 4 +Perl no longer treats strings starting with \*(L"0x\*(R" or \*(L"0b\*(R" as hex or +binary numbers respectively when converting a string to a number. +This reverts a change in behaviour inadvertently introduced in perl +5.30.0 intended to improve precision when converting a string to a +floating point number. [perl #134230 ] +.IP "\(bu" 4 +Matching a non\-\f(CW\*(C`SVf_UTF8\*(C'\fR string against a regular expression +containing unicode literals could leak a \s-1SV\s0 on each match attempt. +[perl #134390 ] +.IP "\(bu" 4 +Overloads for octal and binary floating point literals were always +passed a string with a \f(CW\*(C`0x\*(C'\fR prefix instead of the appropriate \f(CW0\fR or +\&\f(CW\*(C`0b\*(C'\fR prefix. [perl #125557 ] +.IP "\(bu" 4 +\&\f(CW\*(C`$@ = 100; die;\*(C'\fR now correctly propagates the 100 as an exception +instead of ignoring it. [perl #134291 ] +.IP "\(bu" 4 +\&\f(CW\*(C`0 0x@\*(C'\fR no longer asserts in \fBS_no_op()\fR. [perl #134310 ] +.IP "\(bu" 4 +Exceptions thrown while \f(CW$@\fR is read-only could result in infinite +recursion as perl tried to update \f(CW$@\fR, which throws another +exception, resulting in a stack overflow. Perl now replaces \f(CW$@\fR +with a copy if it's not a simple writable \s-1SV.\s0 [perl #134266 ] +.IP "\(bu" 4 +Setting \f(CW$)\fR now properly sets supplementary group ids if you have +the necessary privileges. [perl #134169 ] +.IP "\(bu" 4 +\&\fBclose()\fR on a pipe now preemptively clears the PerlIO object from the +\&\s-1IO SV.\s0 This prevents a second attempt to close the already closed +PerlIO object if a signal handler calls \fBdie()\fR or \fBexit()\fR while \fBclose()\fR +is waiting for the child process to complete. [perl #122112 ] +.IP "\(bu" 4 +\&\f(CW\*(C`sprintf("%.*a", \-10000, $x)\*(C'\fR would cause a buffer overflow due +to mishandling of the negative precision value. [perl #134008 ] +.IP "\(bu" 4 +\&\fBscalar()\fR on a reference could cause an erroneous assertion failure +during compilation. [perl #134045 ] +.IP "\(bu" 4 +\&\f(CW\*(C`%{^CAPTURE_ALL}\*(C'\fR is now an alias to \f(CW\*(C`%\-\*(C'\fR as documented, rather than +incorrectly an alias for \f(CW\*(C`%+\*(C'\fR. [perl #131867 ] +.IP "\(bu" 4 +\&\f(CW\*(C`%{^CAPTURE}\*(C'\fR didn't work if \f(CW\*(C`@{^CAPTURE}\*(C'\fR was mentioned first. +Similarly for \f(CW\*(C`%{^CAPTURE_ALL}\*(C'\fR and \f(CW\*(C`@{^CAPTURE_ALL}\*(C'\fR, though +\&\f(CW\*(C`@{^CAPTURE_ALL}\*(C'\fR currently isn't used. [perl #134193 ] +.IP "\(bu" 4 +Extraordinarily large (over 2GB) floating point format widths could +cause an integer overflow in the underlying call to \fBsnprintf()\fR, +resulting in an assertion. Formatted floating point widths are now +limited to the range of int, the return value of \fBsnprintf()\fR. [perl +#133913 ] +.IP "\(bu" 4 +Parsing the following constructs within a sub-parse (such as with +\&\f(CW"${code here}"\fR or \f(CW\*(C`s/.../code here/e\*(C'\fR) has changed to match how +they're parsed normally: +.RS 4 +.IP "\(bu" 4 +\&\f(CW\*(C`print $fh ...\*(C'\fR no longer produces a syntax error. +.IP "\(bu" 4 +Code like \f(CW\*(C`s/.../ ${time} /e\*(C'\fR now properly produces an \*(L"Ambiguous use +of ${time} resolved to \f(CW$time\fR at ...\*(R" warning when warnings are enabled. +.IP "\(bu" 4 +\&\f(CW\*(C`@x {"a"}\*(C'\fR (with the space) in a sub-parse now properly produces a +\&\*(L"better written as\*(R" warning when warnings are enabled. +.IP "\(bu" 4 +Attributes can now be used in a sub-parse. +[perl #133850 ] +.RE +.RS 4 +.RE +.IP "\(bu" 4 +Incomplete hex and binary literals like \f(CW\*(C`0x\*(C'\fR and \f(CW\*(C`0b\*(C'\fR are now +treated as if the \f(CW\*(C`x\*(C'\fR or \f(CW\*(C`b\*(C'\fR is part of the next token. [perl +#134125 ] +.IP "\(bu" 4 +A spurious \f(CW\*(C`)\*(C'\fR in a subparse, such as in \f(CW\*(C`s/.../code here/e\*(C'\fR or +\&\f(CW"...${code here}"\fR, no longer confuses the parser. +.Sp +Previously a subparse was bracketed with generated \f(CW\*(C`(\*(C'\fR and \f(CW\*(C`)\*(C'\fR +tokens, so a spurious \f(CW\*(C`)\*(C'\fR would close the construct without doing the +normal subparse clean up, confusing the parser and possible causing an +assertion failure. +.Sp +Such constructs are now surrounded by artificial tokens that can't be +included in the source. [perl #130585 ] +.IP "\(bu" 4 +Reference assignment of a sub, such as \f(CW\*(C`\e&foo = \e&bar;\*(C'\fR, silently did +nothing in the \f(CW\*(C`main::\*(C'\fR package. [perl #134072 ] +.IP "\(bu" 4 +\&\fBsv_gets()\fR now recovers better if the target \s-1SV\s0 is modified by a signal +handler. [perl #134035 ] +.IP "\(bu" 4 +\&\f(CW\*(C`readline @foo\*(C'\fR now evaluates \f(CW@foo\fR in scalar context. Previously +it would be evaluated in list context, and since \fBreadline()\fR pops only +one argument from the stack, the stack could underflow, or be left +with unexpected values on the stack. [perl #133989 ] +.IP "\(bu" 4 +Parsing incomplete hex or binary literals was changed in 5.31.1 to treat such a +literal as just the 0, leaving the following \f(CW\*(C`x\*(C'\fR or \f(CW\*(C`b\*(C'\fR to be parsed as part +of the next token. This could lead to some silent changes in behaviour, so now +incomplete hex or binary literals produce a fatal error. +[perl #134125 ] +.IP "\(bu" 4 +\&\fBeval_pv()\fR's \fIcroak_on_error\fR flag will now throw even if the exception is a +false overloaded value. +[perl #134177 ] +.IP "\(bu" 4 +\&\f(CW\*(C`INIT\*(C'\fR blocks and the program itself are no longer run if \fBexit\fR\|(0) is called +within a \f(CW\*(C`BEGIN\*(C'\fR, \f(CW\*(C`UNITCHECK\*(C'\fR or \f(CW\*(C`CHECK\*(C'\fR block. +[perl #2754 ] +.IP "\(bu" 4 +\&\f(CW\*(C`open my $fh, ">>+", undef\*(C'\fR now opens the temporary file in append mode: +writes will seek to the end of file before writing. +[perl #134221 ] +.IP "\(bu" 4 +Fixed a \s-1SEGV\s0 when searching for the source of an uninitialized value warning on +an op whose subtree includes an \s-1OP_MULTIDEREF.\s0 +[perl #134275 ] +.SH "Obituary" +.IX Header "Obituary" +Jeff Goff (\s-1JGOFF\s0 or DrForr), an integral part of the Perl and Raku +communities and a dear friend to all of us, has passed away on March +13th, 2020. DrForr was a prominent member of the communities, attending +and speaking at countless events, contributing to numerous projects, +and assisting and helping in any way he could. +.PP +His passing leaves a hole in our hearts and in our communities and he +will be sorely missed. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Perl 5.32.0 represents approximately 13 months of development since Perl +5.30.0 and contains approximately 220,000 lines of changes across 1,800 +files from 89 authors. +.PP +Excluding auto-generated files, documentation and release tools, there were +approximately 140,000 lines of changes to 880 .pm, .t, .c and .h files. +.PP +Perl continues to flourish into its fourth decade thanks to a vibrant +community of users and developers. The following people are known to have +contributed the improvements that became Perl 5.32.0: +.PP +Aaron Crane, Alberto Simo\*~es, Alexandr Savca, Andreas Ko\*:nig, Andrew Fresh, +Andy Dougherty, Ask Bjo\*/rn Hansen, Atsushi Sugawara, Bernhard M. Wiedemann, +brian d foy, Bryan Stenson, Chad Granum, Chase Whitener, Chris 'BinGOs' +Williams, Craig A. Berry, Dagfinn Ilmari Mannsa\*oker, Dan Book, Daniel +Dragan, Dan Kogai, Dave Cross, Dave Rolsky, David Cantrell, David Mitchell, +Dominic Hargreaves, E. Choroba, Felipe Gasper, Florian Weimer, Graham Knop, +Ha\*okon H\*(aegland, Hauke D, H.Merijn Brand, Hugo van der Sanden, Ichinose +Shogo, James E Keenan, Jason McIntosh, Jerome Duval, Johan Vromans, John +Lightsey, John Paul Adrian Glaubitz, Kang-min Liu, Karen Etheridge, Karl +Williamson, Leon Timmermans, Manuel Mausz, Marc Green, Matthew Horsfall, +Matt Turner, Max Maischein, Michael Haardt, Nicholas Clark, Nicolas R., Niko +Tyni, Pali, Paul Evans, Paul Johnson, Paul Marquess, Peter Eisentraut, Peter +John Acklam, Peter Oliver, Petr Pi\*'saX, Renee Baecker, Ricardo Signes, +Richard Leach, Russ Allbery, Samuel Smith, Santtu Ojanpera\*:, Sawyer X, +Sergey Aleynikov, Sergiy Borodych, Shirakata Kentaro, Shlomi Fish, Sisyphus, +Slaven Rezic, Smylers, Stefan Seifert, Steve Hay, Steve Peters, Svyatoslav, +Thibault Duponchelle, Todd Rinaldo, Tomasz Konojacki, Tom Hukins, Tony Cook, +Unicode Consortium, VanL, Vickenty Fesunov, Vitali Peil, Yves Orton, Zefram. +.PP +The list above is almost certainly incomplete as it is automatically +generated from version control history. In particular, it does not include +the names of the (very much appreciated) contributors who reported issues to +the Perl bug tracker. +.PP +Many of the changes included in this version originated in the \s-1CPAN\s0 modules +included in Perl's core. We're grateful to the entire \s-1CPAN\s0 community for +helping Perl to flourish. +.PP +For a more complete list of all of Perl's historical contributors, please +see the \fI\s-1AUTHORS\s0\fR file in the Perl source distribution. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the perl bug database +at . There may also be information at +, the Perl Home Page. +.PP +If you believe you have an unreported bug, please open an issue at +. Be sure to trim your bug down to a +tiny but sufficient test case. +.PP +If the bug you are reporting has security implications which make it +inappropriate to send to a public issue tracker, then see +\&\*(L"\s-1SECURITY VULNERABILITY CONTACT INFORMATION\*(R"\s0 in perlsec +for details of how to report the issue. +.SH "Give Thanks" +.IX Header "Give Thanks" +If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, +you can do so by running the \f(CW\*(C`perlthanks\*(C'\fR program: +.PP +.Vb 1 +\& perlthanks +.Ve +.PP +This will send an email to the Perl 5 Porters list with your show of thanks. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for an explanation of how to view exhaustive details on +what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl561delta.1 b/data/miniconda3/man/man1/perl561delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..61b7e34015042165e3006b28b8e430ae9b5ac734 --- /dev/null +++ b/data/miniconda3/man/man1/perl561delta.1 @@ -0,0 +1,3480 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL561DELTA 1" +.TH PERL561DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl561delta \- what's new for perl v5.6.1 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.005 release and the 5.6.1 +release. +.SH "Summary of changes between 5.6.0 and 5.6.1" +.IX Header "Summary of changes between 5.6.0 and 5.6.1" +This section contains a summary of the changes between the 5.6.0 release +and the 5.6.1 release. More details about the changes mentioned here +may be found in the \fIChanges\fR files that accompany the Perl source +distribution. See perlhack for pointers to online resources where you +can inspect the individual patches described by these changes. +.SS "Security Issues" +.IX Subsection "Security Issues" +suidperl will not run /bin/mail anymore, because some platforms have +a /bin/mail that is vulnerable to buffer overflow attacks. +.PP +Note that suidperl is neither built nor installed by default in +any recent version of perl. Use of suidperl is highly discouraged. +If you think you need it, try alternatives such as sudo first. +See http://www.courtesan.com/sudo/ . +.SS "Core bug fixes" +.IX Subsection "Core bug fixes" +This is not an exhaustive list. It is intended to cover only the +significant user-visible changes. +.ie n .IP """UNIVERSAL::isa()""" 4 +.el .IP "\f(CWUNIVERSAL::isa()\fR" 4 +.IX Item "UNIVERSAL::isa()" +A bug in the caching mechanism used by \f(CW\*(C`UNIVERSAL::isa()\*(C'\fR that affected +base.pm has been fixed. The bug has existed since the 5.005 releases, +but wasn't tickled by base.pm in those releases. +.IP "Memory leaks" 4 +.IX Item "Memory leaks" +Various cases of memory leaks and attempts to access uninitialized memory +have been cured. See \*(L"Known Problems\*(R" below for further issues. +.IP "Numeric conversions" 4 +.IX Item "Numeric conversions" +Numeric conversions did not recognize changes in the string value +properly in certain circumstances. +.Sp +In other situations, large unsigned numbers (those above 2**31) could +sometimes lose their unsignedness, causing bogus results in arithmetic +operations. +.Sp +Integer modulus on large unsigned integers sometimes returned +incorrect values. +.Sp +Perl 5.6.0 generated \*(L"not a number\*(R" warnings on certain conversions where +previous versions didn't. +.Sp +These problems have all been rectified. +.Sp +Infinity is now recognized as a number. +.IP "qw(a\e\eb)" 4 +.IX Item "qw(ab)" +In Perl 5.6.0, qw(a\e\eb) produced a string with two backslashes instead +of one, in a departure from the behavior in previous versions. The +older behavior has been reinstated. +.IP "\fBcaller()\fR" 4 +.IX Item "caller()" +\&\fBcaller()\fR could cause core dumps in certain situations. Carp was sometimes +affected by this problem. +.IP "Bugs in regular expressions" 4 +.IX Item "Bugs in regular expressions" +Pattern matches on overloaded values are now handled correctly. +.Sp +Perl 5.6.0 parsed m/\ex{ab}/ incorrectly, leading to spurious warnings. +This has been corrected. +.Sp +The \s-1RE\s0 engine found in Perl 5.6.0 accidentally pessimised certain kinds +of simple pattern matches. These are now handled better. +.Sp +Regular expression debug output (whether through \f(CW\*(C`use re \*(Aqdebug\*(Aq\*(C'\fR +or via \f(CW\*(C`\-Dr\*(C'\fR) now looks better. +.Sp +Multi-line matches like \f(CW\*(C`"a\enxb\en" =~ /(?!\eA)x/m\*(C'\fR were flawed. The +bug has been fixed. +.Sp +Use of $& could trigger a core dump under some situations. This +is now avoided. +.Sp +Match variables \f(CW$1\fR et al., weren't being unset when a pattern match +was backtracking, and the anomaly showed up inside \f(CW\*(C`/...(?{ ... }).../\*(C'\fR +etc. These variables are now tracked correctly. +.Sp +\&\fBpos()\fR did not return the correct value within s///ge in earlier +versions. This is now handled correctly. +.ie n .IP """slurp"" mode" 4 +.el .IP "``slurp'' mode" 4 +.IX Item "slurp mode" +\&\fBreadline()\fR on files opened in \*(L"slurp\*(R" mode could return an extra "" at +the end in certain situations. This has been corrected. +.IP "Autovivification of symbolic references to special variables" 4 +.IX Item "Autovivification of symbolic references to special variables" +Autovivification of symbolic references of special variables described +in perlvar (as in \f(CW\*(C`${$num}\*(C'\fR) was accidentally disabled. This works +again now. +.IP "Lexical warnings" 4 +.IX Item "Lexical warnings" +Lexical warnings now propagate correctly into \f(CW\*(C`eval "..."\*(C'\fR. +.Sp +\&\f(CW\*(C`use warnings qw(FATAL all)\*(C'\fR did not work as intended. This has been +corrected. +.Sp +Lexical warnings could leak into other scopes in some situations. +This is now fixed. +.Sp +\&\fBwarnings::enabled()\fR now reports the state of $^W correctly if the caller +isn't using lexical warnings. +.IP "Spurious warnings and errors" 4 +.IX Item "Spurious warnings and errors" +Perl 5.6.0 could emit spurious warnings about redefinition of \fBdl_error()\fR +when statically building extensions into perl. This has been corrected. +.Sp +\&\*(L"our\*(R" variables could result in bogus \*(L"Variable will not stay shared\*(R" +warnings. This is now fixed. +.Sp +\&\*(L"our\*(R" variables of the same name declared in two sibling blocks +resulted in bogus warnings about \*(L"redeclaration\*(R" of the variables. +The problem has been corrected. +.IP "\fBglob()\fR" 4 +.IX Item "glob()" +Compatibility of the builtin \fBglob()\fR with old csh-based glob has been +improved with the addition of \s-1GLOB_ALPHASORT\s0 option. See \f(CW\*(C`File::Glob\*(C'\fR. +.Sp +\&\fBFile::Glob::glob()\fR has been renamed to \fBFile::Glob::bsd_glob()\fR +because the name clashes with the builtin \fBglob()\fR. The older +name is still available for compatibility, but is deprecated. +.Sp +Spurious syntax errors generated in certain situations, when \fBglob()\fR +caused File::Glob to be loaded for the first time, have been fixed. +.IP "Tainting" 4 +.IX Item "Tainting" +Some cases of inconsistent taint propagation (such as within hash +values) have been fixed. +.Sp +The tainting behavior of \fBsprintf()\fR has been rationalized. It does +not taint the result of floating point formats anymore, making the +behavior consistent with that of string interpolation. +.IP "\fBsort()\fR" 4 +.IX Item "sort()" +Arguments to \fBsort()\fR weren't being provided the right \fBwantarray()\fR context. +The comparison block is now run in scalar context, and the arguments to +be sorted are always provided list context. +.Sp +\&\fBsort()\fR is also fully reentrant, in the sense that the sort function +can itself call \fBsort()\fR. This did not work reliably in previous releases. +.IP "#line directives" 4 +.IX Item "#line directives" +#line directives now work correctly when they appear at the very +beginning of \f(CW\*(C`eval "..."\*(C'\fR. +.IP "Subroutine prototypes" 4 +.IX Item "Subroutine prototypes" +The (\e&) prototype now works properly. +.IP "\fBmap()\fR" 4 +.IX Item "map()" +\&\fBmap()\fR could get pathologically slow when the result list it generates +is larger than the source list. The performance has been improved for +common scenarios. +.IP "Debugger" 4 +.IX Item "Debugger" +Debugger exit code now reflects the script exit code. +.Sp +Condition \f(CW"0"\fR in breakpoints is now treated correctly. +.Sp +The \f(CW\*(C`d\*(C'\fR command now checks the line number. +.Sp +\&\f(CW$.\fR is no longer corrupted by the debugger. +.Sp +All debugger output now correctly goes to the socket if RemotePort +is set. +.IP "\s-1PERL5OPT\s0" 4 +.IX Item "PERL5OPT" +\&\s-1PERL5OPT\s0 can be set to more than one switch group. Previously, +it used to be limited to one group of options only. +.IP "\fBchop()\fR" 4 +.IX Item "chop()" +chop(@list) in list context returned the characters chopped in reverse +order. This has been reversed to be in the right order. +.IP "Unicode support" 4 +.IX Item "Unicode support" +Unicode support has seen a large number of incremental improvements, +but continues to be highly experimental. It is not expected to be +fully supported in the 5.6.x maintenance releases. +.Sp +\&\fBsubstr()\fR, \fBjoin()\fR, \fBrepeat()\fR, \fBreverse()\fR, \fBquotemeta()\fR and string +concatenation were all handling Unicode strings incorrectly in +Perl 5.6.0. This has been corrected. +.Sp +Support for \f(CW\*(C`tr///CU\*(C'\fR and \f(CW\*(C`tr///UC\*(C'\fR etc., have been removed since +we realized the interface is broken. For similar functionality, +see \*(L"pack\*(R" in perlfunc. +.Sp +The Unicode Character Database has been updated to version 3.0.1 +with additions made available to the public as of August 30, 2000. +.Sp +The Unicode character classes \ep{Blank} and \ep{SpacePerl} have been +added. \*(L"Blank\*(R" is like C \fBisblank()\fR, that is, it contains only +\&\*(L"horizontal whitespace\*(R" (the space character is, the newline isn't), +and the \*(L"SpacePerl\*(R" is the Unicode equivalent of \f(CW\*(C`\es\*(C'\fR (\ep{Space} +isn't, since that includes the vertical tabulator character, whereas +\&\f(CW\*(C`\es\*(C'\fR doesn't.) +.Sp +If you are experimenting with Unicode support in perl, the development +versions of Perl may have more to offer. In particular, I/O layers +are now available in the development track, but not in the maintenance +track, primarily to do backward compatibility issues. Unicode support +is also evolving rapidly on a daily basis in the development track\*(--the +maintenance track only reflects the most conservative of these changes. +.IP "64\-bit support" 4 +.IX Item "64-bit support" +Support for 64\-bit platforms has been improved, but continues to be +experimental. The level of support varies greatly among platforms. +.IP "Compiler" 4 +.IX Item "Compiler" +The B Compiler and its various backends have had many incremental +improvements, but they continue to remain highly experimental. Use in +production environments is discouraged. +.Sp +The perlcc tool has been rewritten so that the user interface is much +more like that of a C compiler. +.Sp +The perlbc tools has been removed. Use \f(CW\*(C`perlcc \-B\*(C'\fR instead. +.IP "Lvalue subroutines" 4 +.IX Item "Lvalue subroutines" +There have been various bugfixes to support lvalue subroutines better. +However, the feature still remains experimental. +.IP "IO::Socket" 4 +.IX Item "IO::Socket" +IO::Socket::INET failed to open the specified port if the service +name was not known. It now correctly uses the supplied port number +as is. +.IP "File::Find" 4 +.IX Item "File::Find" +File::Find now \fBchdir()\fRs correctly when chasing symbolic links. +.IP "xsubpp" 4 +.IX Item "xsubpp" +xsubpp now tolerates embedded \s-1POD\s0 sections. +.ie n .IP """no Module;""" 4 +.el .IP "\f(CWno Module;\fR" 4 +.IX Item "no Module;" +\&\f(CW\*(C`no Module;\*(C'\fR does not produce an error even if Module does not have an +\&\fBunimport()\fR method. This parallels the behavior of \f(CW\*(C`use\*(C'\fR vis-a-vis +\&\f(CW\*(C`import\*(C'\fR. +.IP "Tests" 4 +.IX Item "Tests" +A large number of tests have been added. +.SS "Core features" +.IX Subsection "Core features" +\&\fBuntie()\fR will now call an \s-1\fBUNTIE\s0()\fR hook if it exists. See perltie +for details. +.PP +The \f(CW\*(C`\-DT\*(C'\fR command line switch outputs copious tokenizing information. +See perlrun. +.PP +Arrays are now always interpolated in double-quotish strings. Previously, +\&\f(CW"foo@bar.com"\fR used to be a fatal error at compile time, if an array +\&\f(CW@bar\fR was not used or declared. This transitional behavior was +intended to help migrate perl4 code, and is deemed to be no longer useful. +See \*(L"Arrays now always interpolate into double-quoted strings\*(R". +.PP +\&\fBkeys()\fR, \fBeach()\fR, \fBpop()\fR, \fBpush()\fR, \fBshift()\fR, \fBsplice()\fR and \fBunshift()\fR +can all be overridden now. +.PP +\&\f(CW\*(C`my _\|_PACKAGE_\|_ $obj\*(C'\fR now does the expected thing. +.SS "Configuration issues" +.IX Subsection "Configuration issues" +On some systems (\s-1IRIX\s0 and Solaris among them) the system malloc is demonstrably +better. While the defaults haven't been changed in order to retain binary +compatibility with earlier releases, you may be better off building perl +with \f(CW\*(C`Configure \-Uusemymalloc ...\*(C'\fR as discussed in the \fI\s-1INSTALL\s0\fR file. +.PP +\&\f(CW\*(C`Configure\*(C'\fR has been enhanced in various ways: +.IP "\(bu" 4 +Minimizes use of temporary files. +.IP "\(bu" 4 +By default, does not link perl with libraries not used by it, such as +the various dbm libraries. SunOS 4.x hints preserve behavior on that +platform. +.IP "\(bu" 4 +Support for pdp11\-style memory models has been removed due to obsolescence. +.IP "\(bu" 4 +Building outside the source tree is supported on systems that have +symbolic links. This is done by running +.Sp +.Vb 2 +\& sh /path/to/source/Configure \-Dmksymlinks ... +\& make all test install +.Ve +.Sp +in a directory other than the perl source directory. See \fI\s-1INSTALL\s0\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`Configure \-S\*(C'\fR can be run non-interactively. +.SS "Documentation" +.IX Subsection "Documentation" +\&\s-1README\s0.aix, \s-1README\s0.solaris and \s-1README\s0.macos have been added. +\&\s-1README\s0.posix\-bc has been renamed to \s-1README\s0.bs2000. These are +installed as perlaix, perlsolaris, perlmacos, and +perlbs2000 respectively. +.PP +The following pod documents are brand new: +.PP +.Vb 7 +\& perlclib Internal replacements for standard C library functions +\& perldebtut Perl debugging tutorial +\& perlebcdic Considerations for running Perl on EBCDIC platforms +\& perlnewmod Perl modules: preparing a new module for distribution +\& perlrequick Perl regular expressions quick start +\& perlretut Perl regular expressions tutorial +\& perlutil utilities packaged with the Perl distribution +.Ve +.PP +The \fI\s-1INSTALL\s0\fR file has been expanded to cover various issues, such as +64\-bit support. +.PP +A longer list of contributors has been added to the source distribution. +See the file \f(CW\*(C`AUTHORS\*(C'\fR. +.PP +Numerous other changes have been made to the included documentation and FAQs. +.SS "Bundled modules" +.IX Subsection "Bundled modules" +The following modules have been added. +.IP "B::Concise" 4 +.IX Item "B::Concise" +Walks Perl syntax tree, printing concise info about ops. See B::Concise. +.IP "File::Temp" 4 +.IX Item "File::Temp" +Returns name and handle of a temporary file safely. See File::Temp. +.IP "Pod::LaTeX" 4 +.IX Item "Pod::LaTeX" +Converts Pod data to formatted LaTeX. See Pod::LaTeX. +.IP "Pod::Text::Overstrike" 4 +.IX Item "Pod::Text::Overstrike" +Converts \s-1POD\s0 data to formatted overstrike text. See Pod::Text::Overstrike. +.PP +The following modules have been upgraded. +.IP "\s-1CGI\s0" 4 +.IX Item "CGI" +\&\s-1CGI\s0 v2.752 is now included. +.IP "\s-1CPAN\s0" 4 +.IX Item "CPAN" +\&\s-1CPAN\s0 v1.59_54 is now included. +.IP "Class::Struct" 4 +.IX Item "Class::Struct" +Various bugfixes have been added. +.IP "DB_File" 4 +.IX Item "DB_File" +DB_File v1.75 supports newer Berkeley \s-1DB\s0 versions, among other +improvements. +.IP "Devel::Peek" 4 +.IX Item "Devel::Peek" +Devel::Peek has been enhanced to support dumping of memory statistics, +when perl is built with the included \fBmalloc()\fR. +.IP "File::Find" 4 +.IX Item "File::Find" +File::Find now supports pre and post-processing of the files in order +to \fBsort()\fR them, etc. +.IP "Getopt::Long" 4 +.IX Item "Getopt::Long" +Getopt::Long v2.25 is included. +.IP "IO::Poll" 4 +.IX Item "IO::Poll" +Various bug fixes have been included. +.IP "IPC::Open3" 4 +.IX Item "IPC::Open3" +IPC::Open3 allows use of numeric file descriptors. +.IP "Math::BigFloat" 4 +.IX Item "Math::BigFloat" +The \fBfmod()\fR function supports modulus operations. Various bug fixes +have also been included. +.IP "Math::Complex" 4 +.IX Item "Math::Complex" +Math::Complex handles inf, NaN etc., better. +.IP "Net::Ping" 4 +.IX Item "Net::Ping" +\&\fBping()\fR could fail on odd number of data bytes, and when the echo service +isn't running. This has been corrected. +.IP "Opcode" 4 +.IX Item "Opcode" +A memory leak has been fixed. +.IP "Pod::Parser" 4 +.IX Item "Pod::Parser" +Version 1.13 of the Pod::Parser suite is included. +.IP "Pod::Text" 4 +.IX Item "Pod::Text" +Pod::Text and related modules have been upgraded to the versions +in podlators suite v2.08. +.IP "SDBM_File" 4 +.IX Item "SDBM_File" +On dosish platforms, some keys went missing because of lack of support for +files with \*(L"holes\*(R". A workaround for the problem has been added. +.IP "Sys::Syslog" 4 +.IX Item "Sys::Syslog" +Various bug fixes have been included. +.IP "Tie::RefHash" 4 +.IX Item "Tie::RefHash" +Now supports Tie::RefHash::Nestable to automagically tie hashref values. +.IP "Tie::SubstrHash" 4 +.IX Item "Tie::SubstrHash" +Various bug fixes have been included. +.SS "Platform-specific improvements" +.IX Subsection "Platform-specific improvements" +The following new ports are now available. +.IP "\s-1NCR\s0 MP-RAS" 4 +.IX Item "NCR MP-RAS" +.PD 0 +.IP "NonStop-UX" 4 +.IX Item "NonStop-UX" +.PD +.PP +Perl now builds under Amdahl \s-1UTS.\s0 +.PP +Perl has also been verified to build under Amiga \s-1OS.\s0 +.PP +Support for \s-1EPOC\s0 has been much improved. See \s-1README\s0.epoc. +.PP +Building perl with \-Duseithreads or \-Duse5005threads now works +under HP-UX 10.20 (previously it only worked under 10.30 or later). +You will need a thread library package installed. See \s-1README\s0.hpux. +.PP +Long doubles should now work under Linux. +.PP +Mac \s-1OS\s0 Classic is now supported in the mainstream source package. +See \s-1README\s0.macos. +.PP +Support for MPE/iX has been updated. See \s-1README\s0.mpeix. +.PP +Support for \s-1OS/2\s0 has been improved. See \f(CW\*(C`os2/Changes\*(C'\fR and \s-1README\s0.os2. +.PP +Dynamic loading on z/OS (formerly \s-1OS/390\s0) has been improved. See +\&\s-1README\s0.os390. +.PP +Support for \s-1VMS\s0 has seen many incremental improvements, including +better support for operators like backticks and \fBsystem()\fR, and better +\&\f(CW%ENV\fR handling. See \f(CW\*(C`README.vms\*(C'\fR and perlvms. +.PP +Support for Stratus \s-1VOS\s0 has been improved. See \f(CW\*(C`vos/Changes\*(C'\fR and \s-1README\s0.vos. +.PP +Support for Windows has been improved. +.IP "\(bu" 4 +\&\fBfork()\fR emulation has been improved in various ways, but still continues +to be experimental. See perlfork for known bugs and caveats. +.IP "\(bu" 4 +\&\f(CW%SIG\fR has been enabled under \s-1USE_ITHREADS,\s0 but its use is completely +unsupported under all configurations. +.IP "\(bu" 4 +Borland \*(C+ v5.5 is now a supported compiler that can build Perl. +However, the generated binaries continue to be incompatible with those +generated by the other supported compilers (\s-1GCC\s0 and Visual \*(C+). +.IP "\(bu" 4 +Non-blocking waits for child processes (or pseudo-processes) are +supported via \f(CW\*(C`waitpid($pid, &POSIX::WNOHANG)\*(C'\fR. +.IP "\(bu" 4 +A memory leak in \fBaccept()\fR has been fixed. +.IP "\(bu" 4 +\&\fBwait()\fR, \fBwaitpid()\fR and backticks now return the correct exit status under +Windows 9x. +.IP "\(bu" 4 +Trailing new \f(CW%ENV\fR entries weren't propagated to child processes. This +is now fixed. +.IP "\(bu" 4 +Current directory entries in \f(CW%ENV\fR are now correctly propagated to child +processes. +.IP "\(bu" 4 +Duping socket handles with open(F, \*(L">&MYSOCK\*(R") now works under Windows 9x. +.IP "\(bu" 4 +The makefiles now provide a single switch to bulk-enable all the features +enabled in ActiveState ActivePerl (a popular binary distribution). +.IP "\(bu" 4 +\&\fBWin32::GetCwd()\fR correctly returns C:\e instead of C: when at the drive root. +Other bugs in \fBchdir()\fR and \fBCwd::cwd()\fR have also been fixed. +.IP "\(bu" 4 +\&\fBfork()\fR correctly returns undef and sets \s-1EAGAIN\s0 when it runs out of +pseudo-process handles. +.IP "\(bu" 4 +ExtUtils::MakeMaker now uses \f(CW$ENV\fR{\s-1LIB\s0} to search for libraries. +.IP "\(bu" 4 +\&\s-1UNC\s0 path handling is better when perl is built to support \fBfork()\fR. +.IP "\(bu" 4 +A handle leak in socket handling has been fixed. +.IP "\(bu" 4 +\&\fBsend()\fR works from within a pseudo-process. +.PP +Unless specifically qualified otherwise, the remainder of this document +covers changes between the 5.005 and 5.6.0 releases. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.SS "Interpreter cloning, threads, and concurrency" +.IX Subsection "Interpreter cloning, threads, and concurrency" +Perl 5.6.0 introduces the beginnings of support for running multiple +interpreters concurrently in different threads. In conjunction with +the \fBperl_clone()\fR \s-1API\s0 call, which can be used to selectively duplicate +the state of any given interpreter, it is possible to compile a +piece of code once in an interpreter, clone that interpreter +one or more times, and run all the resulting interpreters in distinct +threads. +.PP +On the Windows platform, this feature is used to emulate \fBfork()\fR at the +interpreter level. See perlfork for details about that. +.PP +This feature is still in evolution. It is eventually meant to be used +to selectively clone a subroutine and data reachable from that +subroutine in a separate interpreter and run the cloned subroutine +in a separate thread. Since there is no shared data between the +interpreters, little or no locking will be needed (unless parts of +the symbol table are explicitly shared). This is obviously intended +to be an easy-to-use replacement for the existing threads support. +.PP +Support for cloning interpreters and interpreter concurrency can be +enabled using the \-Dusethreads Configure option (see win32/Makefile for +how to enable it on Windows.) The resulting perl executable will be +functionally identical to one that was built with \-Dmultiplicity, but +the \fBperl_clone()\fR \s-1API\s0 call will only be available in the former. +.PP +\&\-Dusethreads enables the cpp macro \s-1USE_ITHREADS\s0 by default, which in turn +enables Perl source code changes that provide a clear separation between +the op tree and the data it operates with. The former is immutable, and +can therefore be shared between an interpreter and all of its clones, +while the latter is considered local to each interpreter, and is therefore +copied for each clone. +.PP +Note that building Perl with the \-Dusemultiplicity Configure option +is adequate if you wish to run multiple \fBindependent\fR interpreters +concurrently in different threads. \-Dusethreads only provides the +additional functionality of the \fBperl_clone()\fR \s-1API\s0 call and other +support for running \fBcloned\fR interpreters concurrently. +.PP +.Vb 2 +\& NOTE: This is an experimental feature. Implementation details are +\& subject to change. +.Ve +.SS "Lexically scoped warning categories" +.IX Subsection "Lexically scoped warning categories" +You can now control the granularity of warnings emitted by perl at a finer +level using the \f(CW\*(C`use warnings\*(C'\fR pragma. warnings and perllexwarn +have copious documentation on this feature. +.SS "Unicode and \s-1UTF\-8\s0 support" +.IX Subsection "Unicode and UTF-8 support" +Perl now uses \s-1UTF\-8\s0 as its internal representation for character +strings. The \f(CW\*(C`utf8\*(C'\fR and \f(CW\*(C`bytes\*(C'\fR pragmas are used to control this support +in the current lexical scope. See perlunicode, utf8 and bytes for +more information. +.PP +This feature is expected to evolve quickly to support some form of I/O +disciplines that can be used to specify the kind of input and output data +(bytes or characters). Until that happens, additional modules from \s-1CPAN\s0 +will be needed to complete the toolkit for dealing with Unicode. +.PP +.Vb 2 +\& NOTE: This should be considered an experimental feature. Implementation +\& details are subject to change. +.Ve +.SS "Support for interpolating named characters" +.IX Subsection "Support for interpolating named characters" +The new \f(CW\*(C`\eN\*(C'\fR escape interpolates named characters within strings. +For example, \f(CW"Hi! \eN{WHITE SMILING FACE}"\fR evaluates to a string +with a Unicode smiley face at the end. +.ie n .SS """our"" declarations" +.el .SS "``our'' declarations" +.IX Subsection "our declarations" +An \*(L"our\*(R" declaration introduces a value that can be best understood +as a lexically scoped symbolic alias to a global variable in the +package that was current where the variable was declared. This is +mostly useful as an alternative to the \f(CW\*(C`vars\*(C'\fR pragma, but also provides +the opportunity to introduce typing and other attributes for such +variables. See \*(L"our\*(R" in perlfunc. +.SS "Support for strings represented as a vector of ordinals" +.IX Subsection "Support for strings represented as a vector of ordinals" +Literals of the form \f(CW\*(C`v1.2.3.4\*(C'\fR are now parsed as a string composed +of characters with the specified ordinals. This is an alternative, more +readable way to construct (possibly Unicode) strings instead of +interpolating characters, as in \f(CW"\ex{1}\ex{2}\ex{3}\ex{4}"\fR. The leading +\&\f(CW\*(C`v\*(C'\fR may be omitted if there are more than two ordinals, so \f(CW1.2.3\fR is +parsed the same as \f(CW\*(C`v1.2.3\*(C'\fR. +.PP +Strings written in this form are also useful to represent version \*(L"numbers\*(R". +It is easy to compare such version \*(L"numbers\*(R" (which are really just plain +strings) using any of the usual string comparison operators \f(CW\*(C`eq\*(C'\fR, \f(CW\*(C`ne\*(C'\fR, +\&\f(CW\*(C`lt\*(C'\fR, \f(CW\*(C`gt\*(C'\fR, etc., or perform bitwise string operations on them using \f(CW\*(C`|\*(C'\fR, +\&\f(CW\*(C`&\*(C'\fR, etc. +.PP +In conjunction with the new \f(CW$^V\fR magic variable (which contains +the perl version as a string), such literals can be used as a readable way +to check if you're running a particular version of Perl: +.PP +.Vb 4 +\& # this will parse in older versions of Perl also +\& if ($^V and $^V gt v5.6.0) { +\& # new features supported +\& } +.Ve +.PP +\&\f(CW\*(C`require\*(C'\fR and \f(CW\*(C`use\*(C'\fR also have some special magic to support such literals. +They will be interpreted as a version rather than as a module name: +.PP +.Vb 2 +\& require v5.6.0; # croak if $^V lt v5.6.0 +\& use v5.6.0; # same, but croaks at compile\-time +.Ve +.PP +Alternatively, the \f(CW\*(C`v\*(C'\fR may be omitted if there is more than one dot: +.PP +.Vb 2 +\& require 5.6.0; +\& use 5.6.0; +.Ve +.PP +Also, \f(CW\*(C`sprintf\*(C'\fR and \f(CW\*(C`printf\*(C'\fR support the Perl-specific format flag \f(CW%v\fR +to print ordinals of characters in arbitrary strings: +.PP +.Vb 3 +\& printf "v%vd", $^V; # prints current version, such as "v5.5.650" +\& printf "%*vX", ":", $addr; # formats IPv6 address +\& printf "%*vb", " ", $bits; # displays bitstring +.Ve +.PP +See \*(L"Scalar value constructors\*(R" in perldata for additional information. +.SS "Improved Perl version numbering system" +.IX Subsection "Improved Perl version numbering system" +Beginning with Perl version 5.6.0, the version number convention has been +changed to a \*(L"dotted integer\*(R" scheme that is more commonly found in open +source projects. +.PP +Maintenance versions of v5.6.0 will be released as v5.6.1, v5.6.2 etc. +The next development series following v5.6.0 will be numbered v5.7.x, +beginning with v5.7.0, and the next major production release following +v5.6.0 will be v5.8.0. +.PP +The English module now sets \f(CW$PERL_VERSION\fR to $^V (a string value) rather +than \f(CW$]\fR (a numeric value). (This is a potential incompatibility. +Send us a report via perlbug if you are affected by this.) +.PP +The v1.2.3 syntax is also now legal in Perl. +See \*(L"Support for strings represented as a vector of ordinals\*(R" for more on that. +.PP +To cope with the new versioning system's use of at least three significant +digits for each version component, the method used for incrementing the +subversion number has also changed slightly. We assume that versions older +than v5.6.0 have been incrementing the subversion component in multiples of +10. Versions after v5.6.0 will increment them by 1. Thus, using the new +notation, 5.005_03 is the \*(L"same\*(R" as v5.5.30, and the first maintenance +version following v5.6.0 will be v5.6.1 (which should be read as being +equivalent to a floating point value of 5.006_001 in the older format, +stored in \f(CW$]\fR). +.SS "New syntax for declaring subroutine attributes" +.IX Subsection "New syntax for declaring subroutine attributes" +Formerly, if you wanted to mark a subroutine as being a method call or +as requiring an automatic \fBlock()\fR when it is entered, you had to declare +that with a \f(CW\*(C`use attrs\*(C'\fR pragma in the body of the subroutine. +That can now be accomplished with declaration syntax, like this: +.PP +.Vb 5 +\& sub mymethod : locked method; +\& ... +\& sub mymethod : locked method { +\& ... +\& } +\& +\& sub othermethod :locked :method; +\& ... +\& sub othermethod :locked :method { +\& ... +\& } +.Ve +.PP +(Note how only the first \f(CW\*(C`:\*(C'\fR is mandatory, and whitespace surrounding +the \f(CW\*(C`:\*(C'\fR is optional.) +.PP +\&\fIAutoSplit.pm\fR and \fISelfLoader.pm\fR have been updated to keep the attributes +with the stubs they provide. See attributes. +.SS "File and directory handles can be autovivified" +.IX Subsection "File and directory handles can be autovivified" +Similar to how constructs such as \f(CW\*(C`$x\->[0]\*(C'\fR autovivify a reference, +handle constructors (\fBopen()\fR, \fBopendir()\fR, \fBpipe()\fR, \fBsocketpair()\fR, \fBsysopen()\fR, +\&\fBsocket()\fR, and \fBaccept()\fR) now autovivify a file or directory handle +if the handle passed to them is an uninitialized scalar variable. This +allows the constructs such as \f(CW\*(C`open(my $fh, ...)\*(C'\fR and \f(CW\*(C`open(local $fh,...)\*(C'\fR +to be used to create filehandles that will conveniently be closed +automatically when the scope ends, provided there are no other references +to them. This largely eliminates the need for typeglobs when opening +filehandles that must be passed around, as in the following example: +.PP +.Vb 5 +\& sub myopen { +\& open my $fh, "@_" +\& or die "Can\*(Aqt open \*(Aq@_\*(Aq: $!"; +\& return $fh; +\& } +\& +\& { +\& my $f = myopen("; +\& # $f implicitly closed here +\& } +.Ve +.SS "\fBopen()\fP with more than two arguments" +.IX Subsection "open() with more than two arguments" +If \fBopen()\fR is passed three arguments instead of two, the second argument +is used as the mode and the third argument is taken to be the file name. +This is primarily useful for protecting against unintended magic behavior +of the traditional two-argument form. See \*(L"open\*(R" in perlfunc. +.SS "64\-bit support" +.IX Subsection "64-bit support" +Any platform that has 64\-bit integers either +.PP +.Vb 3 +\& (1) natively as longs or ints +\& (2) via special compiler flags +\& (3) using long long or int64_t +.Ve +.PP +is able to use \*(L"quads\*(R" (64\-bit integers) as follows: +.IP "\(bu" 4 +constants (decimal, hexadecimal, octal, binary) in the code +.IP "\(bu" 4 +arguments to \fBoct()\fR and \fBhex()\fR +.IP "\(bu" 4 +arguments to \fBprint()\fR, \fBprintf()\fR and \fBsprintf()\fR (flag prefixes ll, L, q) +.IP "\(bu" 4 +printed as such +.IP "\(bu" 4 +\&\fBpack()\fR and \fBunpack()\fR \*(L"q\*(R" and \*(L"Q\*(R" formats +.IP "\(bu" 4 +in basic arithmetics: + \- * / % (\s-1NOTE:\s0 operating close to the limits +of the integer values may produce surprising results) +.IP "\(bu" 4 +in bit arithmetics: & | ^ ~ << >> (\s-1NOTE:\s0 these used to be forced +to be 32 bits wide but now operate on the full native width.) +.IP "\(bu" 4 +\&\fBvec()\fR +.PP +Note that unless you have the case (a) you will have to configure +and compile Perl using the \-Duse64bitint Configure flag. +.PP +.Vb 2 +\& NOTE: The Configure flags \-Duselonglong and \-Duse64bits have been +\& deprecated. Use \-Duse64bitint instead. +.Ve +.PP +There are actually two modes of 64\-bitness: the first one is achieved +using Configure \-Duse64bitint and the second one using Configure +\&\-Duse64bitall. The difference is that the first one is minimal and +the second one maximal. The first works in more places than the second. +.PP +The \f(CW\*(C`use64bitint\*(C'\fR does only as much as is required to get 64\-bit +integers into Perl (this may mean, for example, using \*(L"long longs\*(R") +while your memory may still be limited to 2 gigabytes (because your +pointers could still be 32\-bit). Note that the name \f(CW\*(C`64bitint\*(C'\fR does +not imply that your C compiler will be using 64\-bit \f(CW\*(C`int\*(C'\fRs (it might, +but it doesn't have to): the \f(CW\*(C`use64bitint\*(C'\fR means that you will be +able to have 64 bits wide scalar values. +.PP +The \f(CW\*(C`use64bitall\*(C'\fR goes all the way by attempting to switch also +integers (if it can), longs (and pointers) to being 64\-bit. This may +create an even more binary incompatible Perl than \-Duse64bitint: the +resulting executable may not run at all in a 32\-bit box, or you may +have to reboot/reconfigure/rebuild your operating system to be 64\-bit +aware. +.PP +Natively 64\-bit systems like Alpha and Cray need neither \-Duse64bitint +nor \-Duse64bitall. +.PP +Last but not least: note that due to Perl's habit of always using +floating point numbers, the quads are still not true integers. +When quads overflow their limits (0...18_446_744_073_709_551_615 unsigned, +\&\-9_223_372_036_854_775_808...9_223_372_036_854_775_807 signed), they +are silently promoted to floating point numbers, after which they will +start losing precision (in their lower digits). +.PP +.Vb 4 +\& NOTE: 64\-bit support is still experimental on most platforms. +\& Existing support only covers the LP64 data model. In particular, the +\& LLP64 data model is not yet supported. 64\-bit libraries and system +\& APIs on many platforms have not stabilized\-\-your mileage may vary. +.Ve +.SS "Large file support" +.IX Subsection "Large file support" +If you have filesystems that support \*(L"large files\*(R" (files larger than +2 gigabytes), you may now also be able to create and access them from +Perl. +.PP +.Vb 2 +\& NOTE: The default action is to enable large file support, if +\& available on the platform. +.Ve +.PP +If the large file support is on, and you have a Fcntl constant +O_LARGEFILE, the O_LARGEFILE is automatically added to the flags +of \fBsysopen()\fR. +.PP +Beware that unless your filesystem also supports \*(L"sparse files\*(R" seeking +to umpteen petabytes may be inadvisable. +.PP +Note that in addition to requiring a proper file system to do large +files you may also need to adjust your per-process (or your +per-system, or per-process-group, or per-user-group) maximum filesize +limits before running Perl scripts that try to handle large files, +especially if you intend to write such files. +.PP +Finally, in addition to your process/process group maximum filesize +limits, you may have quota limits on your filesystems that stop you +(your user id or your user group id) from using large files. +.PP +Adjusting your process/user/group/file system/operating system limits +is outside the scope of Perl core language. For process limits, you +may try increasing the limits using your shell's limits/limit/ulimit +command before running Perl. The BSD::Resource extension (not +included with the standard Perl distribution) may also be of use, it +offers the getrlimit/setrlimit interface that can be used to adjust +process resource usage limits, including the maximum filesize limit. +.SS "Long doubles" +.IX Subsection "Long doubles" +In some systems you may be able to use long doubles to enhance the +range and precision of your double precision floating point numbers +(that is, Perl's numbers). Use Configure \-Duselongdouble to enable +this support (if it is available). +.ie n .SS """more bits""" +.el .SS "``more bits''" +.IX Subsection "more bits" +You can \*(L"Configure \-Dusemorebits\*(R" to turn on both the 64\-bit support +and the long double support. +.SS "Enhanced support for \fBsort()\fP subroutines" +.IX Subsection "Enhanced support for sort() subroutines" +Perl subroutines with a prototype of \f(CW\*(C`($$)\*(C'\fR, and XSUBs in general, can +now be used as sort subroutines. In either case, the two elements to +be compared are passed as normal parameters in \f(CW@_\fR. See \*(L"sort\*(R" in perlfunc. +.PP +For unprototyped sort subroutines, the historical behavior of passing +the elements to be compared as the global variables \f(CW$a\fR and \f(CW$b\fR remains +unchanged. +.ie n .SS """sort $coderef @foo"" allowed" +.el .SS "\f(CWsort $coderef @foo\fP allowed" +.IX Subsection "sort $coderef @foo allowed" +\&\fBsort()\fR did not accept a subroutine reference as the comparison +function in earlier versions. This is now permitted. +.SS "File globbing implemented internally" +.IX Subsection "File globbing implemented internally" +Perl now uses the File::Glob implementation of the \fBglob()\fR operator +automatically. This avoids using an external csh process and the +problems associated with it. +.PP +.Vb 2 +\& NOTE: This is currently an experimental feature. Interfaces and +\& implementation are subject to change. +.Ve +.SS "Support for \s-1CHECK\s0 blocks" +.IX Subsection "Support for CHECK blocks" +In addition to \f(CW\*(C`BEGIN\*(C'\fR, \f(CW\*(C`INIT\*(C'\fR, \f(CW\*(C`END\*(C'\fR, \f(CW\*(C`DESTROY\*(C'\fR and \f(CW\*(C`AUTOLOAD\*(C'\fR, +subroutines named \f(CW\*(C`CHECK\*(C'\fR are now special. These are queued up during +compilation and behave similar to \s-1END\s0 blocks, except they are called at +the end of compilation rather than at the end of execution. They cannot +be called directly. +.SS "\s-1POSIX\s0 character class syntax [: :] supported" +.IX Subsection "POSIX character class syntax [: :] supported" +For example to match alphabetic characters use /[[:alpha:]]/. +See perlre for details. +.SS "Better pseudo-random number generator" +.IX Subsection "Better pseudo-random number generator" +In 5.005_0x and earlier, perl's \fBrand()\fR function used the C library +\&\fBrand\fR\|(3) function. As of 5.005_52, Configure tests for \fBdrand48()\fR, +\&\fBrandom()\fR, and \fBrand()\fR (in that order) and picks the first one it finds. +.PP +These changes should result in better random numbers from \fBrand()\fR. +.ie n .SS "Improved ""qw//"" operator" +.el .SS "Improved \f(CWqw//\fP operator" +.IX Subsection "Improved qw// operator" +The \f(CW\*(C`qw//\*(C'\fR operator is now evaluated at compile time into a true list +instead of being replaced with a run time call to \f(CW\*(C`split()\*(C'\fR. This +removes the confusing misbehaviour of \f(CW\*(C`qw//\*(C'\fR in scalar context, which +had inherited that behaviour from \fBsplit()\fR. +.PP +Thus: +.PP +.Vb 1 +\& $foo = ($bar) = qw(a b c); print "$foo|$bar\en"; +.Ve +.PP +now correctly prints \*(L"3|a\*(R", instead of \*(L"2|a\*(R". +.SS "Better worst-case behavior of hashes" +.IX Subsection "Better worst-case behavior of hashes" +Small changes in the hashing algorithm have been implemented in +order to improve the distribution of lower order bits in the +hashed value. This is expected to yield better performance on +keys that are repeated sequences. +.SS "\fBpack()\fP format 'Z' supported" +.IX Subsection "pack() format 'Z' supported" +The new format type 'Z' is useful for packing and unpacking null-terminated +strings. See \*(L"pack\*(R" in perlfunc. +.SS "\fBpack()\fP format modifier '!' supported" +.IX Subsection "pack() format modifier '!' supported" +The new format type modifier '!' is useful for packing and unpacking +native shorts, ints, and longs. See \*(L"pack\*(R" in perlfunc. +.SS "\fBpack()\fP and \fBunpack()\fP support counted strings" +.IX Subsection "pack() and unpack() support counted strings" +The template character '/' can be used to specify a counted string +type to be packed or unpacked. See \*(L"pack\*(R" in perlfunc. +.SS "Comments in \fBpack()\fP templates" +.IX Subsection "Comments in pack() templates" +The '#' character in a template introduces a comment up to +end of the line. This facilitates documentation of \fBpack()\fR +templates. +.SS "Weak references" +.IX Subsection "Weak references" +In previous versions of Perl, you couldn't cache objects so as +to allow them to be deleted if the last reference from outside +the cache is deleted. The reference in the cache would hold a +reference count on the object and the objects would never be +destroyed. +.PP +Another familiar problem is with circular references. When an +object references itself, its reference count would never go +down to zero, and it would not get destroyed until the program +is about to exit. +.PP +Weak references solve this by allowing you to \*(L"weaken\*(R" any +reference, that is, make it not count towards the reference count. +When the last non-weak reference to an object is deleted, the object +is destroyed and all the weak references to the object are +automatically undef-ed. +.PP +To use this feature, you need the Devel::WeakRef package from \s-1CPAN,\s0 which +contains additional documentation. +.PP +.Vb 1 +\& NOTE: This is an experimental feature. Details are subject to change. +.Ve +.SS "Binary numbers supported" +.IX Subsection "Binary numbers supported" +Binary numbers are now supported as literals, in s?printf formats, and +\&\f(CW\*(C`oct()\*(C'\fR: +.PP +.Vb 2 +\& $answer = 0b101010; +\& printf "The answer is: %b\en", oct("0b101010"); +.Ve +.SS "Lvalue subroutines" +.IX Subsection "Lvalue subroutines" +Subroutines can now return modifiable lvalues. +See \*(L"Lvalue subroutines\*(R" in perlsub. +.PP +.Vb 1 +\& NOTE: This is an experimental feature. Details are subject to change. +.Ve +.SS "Some arrows may be omitted in calls through references" +.IX Subsection "Some arrows may be omitted in calls through references" +Perl now allows the arrow to be omitted in many constructs +involving subroutine calls through references. For example, +\&\f(CW\*(C`$foo[10]\->(\*(Aqfoo\*(Aq)\*(C'\fR may now be written \f(CW\*(C`$foo[10](\*(Aqfoo\*(Aq)\*(C'\fR. +This is rather similar to how the arrow may be omitted from +\&\f(CW\*(C`$foo[10]\->{\*(Aqfoo\*(Aq}\*(C'\fR. Note however, that the arrow is still +required for \f(CW\*(C`foo(10)\->(\*(Aqbar\*(Aq)\*(C'\fR. +.SS "Boolean assignment operators are legal lvalues" +.IX Subsection "Boolean assignment operators are legal lvalues" +Constructs such as \f(CW\*(C`($a ||= 2) += 1\*(C'\fR are now allowed. +.SS "\fBexists()\fP is supported on subroutine names" +.IX Subsection "exists() is supported on subroutine names" +The \fBexists()\fR builtin now works on subroutine names. A subroutine +is considered to exist if it has been declared (even if implicitly). +See \*(L"exists\*(R" in perlfunc for examples. +.SS "\fBexists()\fP and \fBdelete()\fP are supported on array elements" +.IX Subsection "exists() and delete() are supported on array elements" +The \fBexists()\fR and \fBdelete()\fR builtins now work on simple arrays as well. +The behavior is similar to that on hash elements. +.PP +\&\fBexists()\fR can be used to check whether an array element has been +initialized. This avoids autovivifying array elements that don't exist. +If the array is tied, the \s-1\fBEXISTS\s0()\fR method in the corresponding tied +package will be invoked. +.PP +\&\fBdelete()\fR may be used to remove an element from the array and return +it. The array element at that position returns to its uninitialized +state, so that testing for the same element with \fBexists()\fR will return +false. If the element happens to be the one at the end, the size of +the array also shrinks up to the highest element that tests true for +\&\fBexists()\fR, or 0 if none such is found. If the array is tied, the \s-1\fBDELETE\s0()\fR +method in the corresponding tied package will be invoked. +.PP +See \*(L"exists\*(R" in perlfunc and \*(L"delete\*(R" in perlfunc for examples. +.SS "Pseudo-hashes work better" +.IX Subsection "Pseudo-hashes work better" +Dereferencing some types of reference values in a pseudo-hash, +such as \f(CW\*(C`$ph\->{foo}[1]\*(C'\fR, was accidentally disallowed. This has +been corrected. +.PP +When applied to a pseudo-hash element, \fBexists()\fR now reports whether +the specified value exists, not merely if the key is valid. +.PP +\&\fBdelete()\fR now works on pseudo-hashes. When given a pseudo-hash element +or slice it deletes the values corresponding to the keys (but not the keys +themselves). See \*(L"Pseudo-hashes: Using an array as a hash\*(R" in perlref. +.PP +Pseudo-hash slices with constant keys are now optimized to array lookups +at compile-time. +.PP +List assignments to pseudo-hash slices are now supported. +.PP +The \f(CW\*(C`fields\*(C'\fR pragma now provides ways to create pseudo-hashes, via +\&\fBfields::new()\fR and \fBfields::phash()\fR. See fields. +.PP +.Vb 3 +\& NOTE: The pseudo\-hash data type continues to be experimental. +\& Limiting oneself to the interface elements provided by the +\& fields pragma will provide protection from any future changes. +.Ve +.SS "Automatic flushing of output buffers" +.IX Subsection "Automatic flushing of output buffers" +\&\fBfork()\fR, \fBexec()\fR, \fBsystem()\fR, qx//, and pipe \fBopen()\fRs now flush buffers +of all files opened for output when the operation was attempted. This +mostly eliminates confusing buffering mishaps suffered by users unaware +of how Perl internally handles I/O. +.PP +This is not supported on some platforms like Solaris where a suitably +correct implementation of fflush(\s-1NULL\s0) isn't available. +.SS "Better diagnostics on meaningless filehandle operations" +.IX Subsection "Better diagnostics on meaningless filehandle operations" +Constructs such as \f(CW\*(C`open()\*(C'\fR and \f(CW\*(C`close()\*(C'\fR +are compile time errors. Attempting to read from filehandles that +were opened only for writing will now produce warnings (just as +writing to read-only filehandles does). +.SS "Where possible, buffered data discarded from duped input filehandle" +.IX Subsection "Where possible, buffered data discarded from duped input filehandle" +\&\f(CW\*(C`open(NEW, "<&OLD")\*(C'\fR now attempts to discard any data that +was previously read and buffered in \f(CW\*(C`OLD\*(C'\fR before duping the handle. +On platforms where doing this is allowed, the next read operation +on \f(CW\*(C`NEW\*(C'\fR will return the same data as the corresponding operation +on \f(CW\*(C`OLD\*(C'\fR. Formerly, it would have returned the data from the start +of the following disk block instead. +.SS "\fBeof()\fP has the same old magic as <>" +.IX Subsection "eof() has the same old magic as <>" +\&\f(CW\*(C`eof()\*(C'\fR would return true if no attempt to read from \f(CW\*(C`<>\*(C'\fR had +yet been made. \f(CW\*(C`eof()\*(C'\fR has been changed to have a little magic of its +own, it now opens the \f(CW\*(C`<>\*(C'\fR files. +.SS "\fBbinmode()\fP can be used to set :crlf and :raw modes" +.IX Subsection "binmode() can be used to set :crlf and :raw modes" +\&\fBbinmode()\fR now accepts a second argument that specifies a discipline +for the handle in question. The two pseudo-disciplines \*(L":raw\*(R" and +\&\*(L":crlf\*(R" are currently supported on DOS-derivative platforms. +See \*(L"binmode\*(R" in perlfunc and open. +.ie n .SS """\-T"" filetest recognizes \s-1UTF\-8\s0 encoded files as ""text""" +.el .SS "\f(CW\-T\fP filetest recognizes \s-1UTF\-8\s0 encoded files as ``text''" +.IX Subsection "-T filetest recognizes UTF-8 encoded files as text" +The algorithm used for the \f(CW\*(C`\-T\*(C'\fR filetest has been enhanced to +correctly identify \s-1UTF\-8\s0 content as \*(L"text\*(R". +.SS "\fBsystem()\fP, backticks and pipe open now reflect \fBexec()\fP failure" +.IX Subsection "system(), backticks and pipe open now reflect exec() failure" +On Unix and similar platforms, \fBsystem()\fR, \fBqx()\fR and open(\s-1FOO,\s0 \*(L"cmd |\*(R") +etc., are implemented via \fBfork()\fR and \fBexec()\fR. When the underlying +\&\fBexec()\fR fails, earlier versions did not report the error properly, +since the \fBexec()\fR happened to be in a different process. +.PP +The child process now communicates with the parent about the +error in launching the external command, which allows these +constructs to return with their usual error value and set $!. +.SS "Improved diagnostics" +.IX Subsection "Improved diagnostics" +Line numbers are no longer suppressed (under most likely circumstances) +during the global destruction phase. +.PP +Diagnostics emitted from code running in threads other than the main +thread are now accompanied by the thread \s-1ID.\s0 +.PP +Embedded null characters in diagnostics now actually show up. They +used to truncate the message in prior versions. +.PP +\&\f(CW$foo::a\fR and \f(CW$foo::b\fR are now exempt from \*(L"possible typo\*(R" warnings only +if \fBsort()\fR is encountered in package \f(CW\*(C`foo\*(C'\fR. +.PP +Unrecognized alphabetic escapes encountered when parsing quote +constructs now generate a warning, since they may take on new +semantics in later versions of Perl. +.PP +Many diagnostics now report the internal operation in which the warning +was provoked, like so: +.PP +.Vb 2 +\& Use of uninitialized value in concatenation (.) at (eval 1) line 1. +\& Use of uninitialized value in print at (eval 1) line 1. +.Ve +.PP +Diagnostics that occur within eval may also report the file and line +number where the eval is located, in addition to the eval sequence +number and the line number within the evaluated text itself. For +example: +.PP +.Vb 1 +\& Not enough arguments for scalar at (eval 4)[newlib/perl5db.pl:1411] line 2, at EOF +.Ve +.SS "Diagnostics follow \s-1STDERR\s0" +.IX Subsection "Diagnostics follow STDERR" +Diagnostic output now goes to whichever file the \f(CW\*(C`STDERR\*(C'\fR handle +is pointing at, instead of always going to the underlying C runtime +library's \f(CW\*(C`stderr\*(C'\fR. +.SS "More consistent close-on-exec behavior" +.IX Subsection "More consistent close-on-exec behavior" +On systems that support a close-on-exec flag on filehandles, the +flag is now set for any handles created by \fBpipe()\fR, \fBsocketpair()\fR, +\&\fBsocket()\fR, and \fBaccept()\fR, if that is warranted by the value of $^F +that may be in effect. Earlier versions neglected to set the flag +for handles created with these operators. See \*(L"pipe\*(R" in perlfunc, +\&\*(L"socketpair\*(R" in perlfunc, \*(L"socket\*(R" in perlfunc, \*(L"accept\*(R" in perlfunc, +and \*(L"$^F\*(R" in perlvar. +.SS "\fBsyswrite()\fP ease-of-use" +.IX Subsection "syswrite() ease-of-use" +The length argument of \f(CW\*(C`syswrite()\*(C'\fR has become optional. +.SS "Better syntax checks on parenthesized unary operators" +.IX Subsection "Better syntax checks on parenthesized unary operators" +Expressions such as: +.PP +.Vb 3 +\& print defined(&foo,&bar,&baz); +\& print uc("foo","bar","baz"); +\& undef($foo,&bar); +.Ve +.PP +used to be accidentally allowed in earlier versions, and produced +unpredictable behaviour. Some produced ancillary warnings +when used in this way; others silently did the wrong thing. +.PP +The parenthesized forms of most unary operators that expect a single +argument now ensure that they are not called with more than one +argument, making the cases shown above syntax errors. The usual +behaviour of: +.PP +.Vb 3 +\& print defined &foo, &bar, &baz; +\& print uc "foo", "bar", "baz"; +\& undef $foo, &bar; +.Ve +.PP +remains unchanged. See perlop. +.SS "Bit operators support full native integer width" +.IX Subsection "Bit operators support full native integer width" +The bit operators (& | ^ ~ << >>) now operate on the full native +integral width (the exact size of which is available in \f(CW$Config\fR{ivsize}). +For example, if your platform is either natively 64\-bit or if Perl +has been configured to use 64\-bit integers, these operations apply +to 8 bytes (as opposed to 4 bytes on 32\-bit platforms). +For portability, be sure to mask off the excess bits in the result of +unary \f(CW\*(C`~\*(C'\fR, e.g., \f(CW\*(C`~$x & 0xffffffff\*(C'\fR. +.SS "Improved security features" +.IX Subsection "Improved security features" +More potentially unsafe operations taint their results for improved +security. +.PP +The \f(CW\*(C`passwd\*(C'\fR and \f(CW\*(C`shell\*(C'\fR fields returned by the \fBgetpwent()\fR, \fBgetpwnam()\fR, +and \fBgetpwuid()\fR are now tainted, because the user can affect their own +encrypted password and login shell. +.PP +The variable modified by \fBshmread()\fR, and messages returned by \fBmsgrcv()\fR +(and its object-oriented interface IPC::SysV::Msg::rcv) are also tainted, +because other untrusted processes can modify messages and shared memory +segments for their own nefarious purposes. +.SS "More functional bareword prototype (*)" +.IX Subsection "More functional bareword prototype (*)" +Bareword prototypes have been rationalized to enable them to be used +to override builtins that accept barewords and interpret them in +a special way, such as \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`do\*(C'\fR. +.PP +Arguments prototyped as \f(CW\*(C`*\*(C'\fR will now be visible within the subroutine +as either a simple scalar or as a reference to a typeglob. +See \*(L"Prototypes\*(R" in perlsub. +.ie n .SS """require"" and ""do"" may be overridden" +.el .SS "\f(CWrequire\fP and \f(CWdo\fP may be overridden" +.IX Subsection "require and do may be overridden" +\&\f(CW\*(C`require\*(C'\fR and \f(CW\*(C`do \*(Aqfile\*(Aq\*(C'\fR operations may be overridden locally +by importing subroutines of the same name into the current package +(or globally by importing them into the \s-1CORE::GLOBAL::\s0 namespace). +Overriding \f(CW\*(C`require\*(C'\fR will also affect \f(CW\*(C`use\*(C'\fR, provided the override +is visible at compile-time. +See \*(L"Overriding Built-in Functions\*(R" in perlsub. +.SS "$^X variables may now have names longer than one character" +.IX Subsection "$^X variables may now have names longer than one character" +Formerly, $^X was synonymous with ${\*(L"\ecX\*(R"}, but $^XY was a syntax +error. Now variable names that begin with a control character may be +arbitrarily long. However, for compatibility reasons, these variables +\&\fImust\fR be written with explicit braces, as \f(CW\*(C`${^XY}\*(C'\fR for example. +\&\f(CW\*(C`${^XYZ}\*(C'\fR is synonymous with ${\*(L"\ecXYZ\*(R"}. Variable names with more +than one control character, such as \f(CW\*(C`${^XY^Z}\*(C'\fR, are illegal. +.PP +The old syntax has not changed. As before, `^X' may be either a +literal control-X character or the two-character sequence `caret' plus +`X'. When braces are omitted, the variable name stops after the +control character. Thus \f(CW"$^XYZ"\fR continues to be synonymous with +\&\f(CW\*(C`$^X . "YZ"\*(C'\fR as before. +.PP +As before, lexical variables may not have names beginning with control +characters. As before, variables whose names begin with a control +character are always forced to be in package `main'. All such variables +are reserved for future extensions, except those that begin with +\&\f(CW\*(C`^_\*(C'\fR, which may be used by user programs and are guaranteed not to +acquire special meaning in any future version of Perl. +.ie n .SS "New variable $^C reflects ""\-c"" switch" +.el .SS "New variable $^C reflects \f(CW\-c\fP switch" +.IX Subsection "New variable $^C reflects -c switch" +\&\f(CW$^C\fR has a boolean value that reflects whether perl is being run +in compile-only mode (i.e. via the \f(CW\*(C`\-c\*(C'\fR switch). Since +\&\s-1BEGIN\s0 blocks are executed under such conditions, this variable +enables perl code to determine whether actions that make sense +only during normal running are warranted. See perlvar. +.SS "New variable $^V contains Perl version as a string" +.IX Subsection "New variable $^V contains Perl version as a string" +\&\f(CW$^V\fR contains the Perl version number as a string composed of +characters whose ordinals match the version numbers, i.e. v5.6.0. +This may be used in string comparisons. +.PP +See \f(CW\*(C`Support for strings represented as a vector of ordinals\*(C'\fR for an +example. +.SS "Optional Y2K warnings" +.IX Subsection "Optional Y2K warnings" +If Perl is built with the cpp macro \f(CW\*(C`PERL_Y2KWARN\*(C'\fR defined, +it emits optional warnings when concatenating the number 19 +with another number. +.PP +This behavior must be specifically enabled when running Configure. +See \fI\s-1INSTALL\s0\fR and \fI\s-1README.Y2K\s0\fR. +.SS "Arrays now always interpolate into double-quoted strings" +.IX Subsection "Arrays now always interpolate into double-quoted strings" +In double-quoted strings, arrays now interpolate, no matter what. The +behavior in earlier versions of perl 5 was that arrays would interpolate +into strings if the array had been mentioned before the string was +compiled, and otherwise Perl would raise a fatal compile-time error. +In versions 5.000 through 5.003, the error was +.PP +.Vb 1 +\& Literal @example now requires backslash +.Ve +.PP +In versions 5.004_01 through 5.6.0, the error was +.PP +.Vb 1 +\& In string, @example now must be written as \e@example +.Ve +.PP +The idea here was to get people into the habit of writing +\&\f(CW"fred\e@example.com"\fR when they wanted a literal \f(CW\*(C`@\*(C'\fR sign, just as +they have always written \f(CW"Give me back my \e$5"\fR when they wanted a +literal \f(CW\*(C`$\*(C'\fR sign. +.PP +Starting with 5.6.1, when Perl now sees an \f(CW\*(C`@\*(C'\fR sign in a +double-quoted string, it \fIalways\fR attempts to interpolate an array, +regardless of whether or not the array has been used or declared +already. The fatal error has been downgraded to an optional warning: +.PP +.Vb 1 +\& Possible unintended interpolation of @example in string +.Ve +.PP +This warns you that \f(CW"fred@example.com"\fR is going to turn into +\&\f(CW\*(C`fred.com\*(C'\fR if you don't backslash the \f(CW\*(C`@\*(C'\fR. +See http://perl.plover.com/at\-error.html for more details +about the history here. +.SS "@\- and @+ provide starting/ending offsets of regex submatches" +.IX Subsection "@- and @+ provide starting/ending offsets of regex submatches" +The new magic variables @\- and @+ provide the starting and ending +offsets, respectively, of $&, \f(CW$1\fR, \f(CW$2\fR, etc. See perlvar for +details. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Modules" +.IX Subsection "Modules" +.IP "attributes" 4 +.IX Item "attributes" +While used internally by Perl as a pragma, this module also +provides a way to fetch subroutine and variable attributes. +See attributes. +.IP "B" 4 +.IX Item "B" +The Perl Compiler suite has been extensively reworked for this +release. More of the standard Perl test suite passes when run +under the Compiler, but there is still a significant way to +go to achieve production quality compiled executables. +.Sp +.Vb 3 +\& NOTE: The Compiler suite remains highly experimental. The +\& generated code may not be correct, even when it manages to execute +\& without errors. +.Ve +.IP "Benchmark" 4 +.IX Item "Benchmark" +Overall, Benchmark results exhibit lower average error and better timing +accuracy. +.Sp +You can now run tests for \fIn\fR seconds instead of guessing the right +number of tests to run: e.g., timethese(\-5, ...) will run each +code for at least 5 \s-1CPU\s0 seconds. Zero as the \*(L"number of repetitions\*(R" +means \*(L"for at least 3 \s-1CPU\s0 seconds\*(R". The output format has also +changed. For example: +.Sp +.Vb 1 +\& use Benchmark;$x=3;timethese(\-5,{a=>sub{$x*$x},b=>sub{$x**2}}) +.Ve +.Sp +will now output something like this: +.Sp +.Vb 3 +\& Benchmark: running a, b, each for at least 5 CPU seconds... +\& a: 5 wallclock secs ( 5.77 usr + 0.00 sys = 5.77 CPU) @ 200551.91/s (n=1156516) +\& b: 4 wallclock secs ( 5.00 usr + 0.02 sys = 5.02 CPU) @ 159605.18/s (n=800686) +.Ve +.Sp +New features: \*(L"each for at least N \s-1CPU\s0 seconds...\*(R", \*(L"wallclock secs\*(R", +and the \*(L"@ operations/CPU second (n=operations)\*(R". +.Sp +\&\fBtimethese()\fR now returns a reference to a hash of Benchmark objects containing +the test results, keyed on the names of the tests. +.Sp +\&\fBtimethis()\fR now returns the iterations field in the Benchmark result object +instead of 0. +.Sp +\&\fBtimethese()\fR, \fBtimethis()\fR, and the new \fBcmpthese()\fR (see below) can also take +a format specifier of 'none' to suppress output. +.Sp +A new function \fBcountit()\fR is just like \fBtimeit()\fR except that it takes a +\&\s-1TIME\s0 instead of a \s-1COUNT.\s0 +.Sp +A new function \fBcmpthese()\fR prints a chart comparing the results of each test +returned from a \fBtimethese()\fR call. For each possible pair of tests, the +percentage speed difference (iters/sec or seconds/iter) is shown. +.Sp +For other details, see Benchmark. +.IP "ByteLoader" 4 +.IX Item "ByteLoader" +The ByteLoader is a dedicated extension to generate and run +Perl bytecode. See ByteLoader. +.IP "constant" 4 +.IX Item "constant" +References can now be used. +.Sp +The new version also allows a leading underscore in constant names, but +disallows a double leading underscore (as in \*(L"_\|_LINE_\|_\*(R"). Some other names +are disallowed or warned against, including \s-1BEGIN, END,\s0 etc. Some names +which were forced into main:: used to fail silently in some cases; now they're +fatal (outside of main::) and an optional warning (inside of main::). +The ability to detect whether a constant had been set with a given name has +been added. +.Sp +See constant. +.IP "charnames" 4 +.IX Item "charnames" +This pragma implements the \f(CW\*(C`\eN\*(C'\fR string escape. See charnames. +.IP "Data::Dumper" 4 +.IX Item "Data::Dumper" +A \f(CW\*(C`Maxdepth\*(C'\fR setting can be specified to avoid venturing +too deeply into deep data structures. See Data::Dumper. +.Sp +The \s-1XSUB\s0 implementation of \fBDump()\fR is now automatically called if the +\&\f(CW\*(C`Useqq\*(C'\fR setting is not in use. +.Sp +Dumping \f(CW\*(C`qr//\*(C'\fR objects works correctly. +.IP "\s-1DB\s0" 4 +.IX Item "DB" +\&\f(CW\*(C`DB\*(C'\fR is an experimental module that exposes a clean abstraction +to Perl's debugging \s-1API.\s0 +.IP "DB_File" 4 +.IX Item "DB_File" +DB_File can now be built with Berkeley \s-1DB\s0 versions 1, 2 or 3. +See \f(CW\*(C`ext/DB_File/Changes\*(C'\fR. +.IP "Devel::DProf" 4 +.IX Item "Devel::DProf" +Devel::DProf, a Perl source code profiler has been added. See +Devel::DProf and dprofpp. +.IP "Devel::Peek" 4 +.IX Item "Devel::Peek" +The Devel::Peek module provides access to the internal representation +of Perl variables and data. It is a data debugging tool for the \s-1XS\s0 programmer. +.IP "Dumpvalue" 4 +.IX Item "Dumpvalue" +The Dumpvalue module provides screen dumps of Perl data. +.IP "DynaLoader" 4 +.IX Item "DynaLoader" +DynaLoader now supports a \fBdl_unload_file()\fR function on platforms that +support unloading shared objects using \fBdlclose()\fR. +.Sp +Perl can also optionally arrange to unload all extension shared objects +loaded by Perl. To enable this, build Perl with the Configure option +\&\f(CW\*(C`\-Accflags=\-DDL_UNLOAD_ALL_AT_EXIT\*(C'\fR. (This maybe useful if you are +using Apache with mod_perl.) +.IP "English" 4 +.IX Item "English" +\&\f(CW$PERL_VERSION\fR now stands for \f(CW$^V\fR (a string value) rather than for \f(CW$]\fR +(a numeric value). +.IP "Env" 4 +.IX Item "Env" +Env now supports accessing environment variables like \s-1PATH\s0 as array +variables. +.IP "Fcntl" 4 +.IX Item "Fcntl" +More Fcntl constants added: F_SETLK64, F_SETLKW64, O_LARGEFILE for +large file (more than 4GB) access (\s-1NOTE:\s0 the O_LARGEFILE is +automatically added to \fBsysopen()\fR flags if large file support has been +configured, as is the default), Free/Net/OpenBSD locking behaviour +flags F_FLOCK, F_POSIX, Linux F_SHLCK, and O_ACCMODE: the combined +mask of O_RDONLY, O_WRONLY, and O_RDWR. The \fBseek()\fR/\fBsysseek()\fR +constants \s-1SEEK_SET, SEEK_CUR,\s0 and \s-1SEEK_END\s0 are available via the +\&\f(CW\*(C`:seek\*(C'\fR tag. The \fBchmod()\fR/\fBstat()\fR S_IF* constants and S_IS* functions +are available via the \f(CW\*(C`:mode\*(C'\fR tag. +.IP "File::Compare" 4 +.IX Item "File::Compare" +A \fBcompare_text()\fR function has been added, which allows custom +comparison functions. See File::Compare. +.IP "File::Find" 4 +.IX Item "File::Find" +File::Find now works correctly when the \fBwanted()\fR function is either +autoloaded or is a symbolic reference. +.Sp +A bug that caused File::Find to lose track of the working directory +when pruning top-level directories has been fixed. +.Sp +File::Find now also supports several other options to control its +behavior. It can follow symbolic links if the \f(CW\*(C`follow\*(C'\fR option is +specified. Enabling the \f(CW\*(C`no_chdir\*(C'\fR option will make File::Find skip +changing the current directory when walking directories. The \f(CW\*(C`untaint\*(C'\fR +flag can be useful when running with taint checks enabled. +.Sp +See File::Find. +.IP "File::Glob" 4 +.IX Item "File::Glob" +This extension implements BSD-style file globbing. By default, +it will also be used for the internal implementation of the \fBglob()\fR +operator. See File::Glob. +.IP "File::Spec" 4 +.IX Item "File::Spec" +New methods have been added to the File::Spec module: \fBdevnull()\fR returns +the name of the null device (/dev/null on Unix) and \fBtmpdir()\fR the name of +the temp directory (normally /tmp on Unix). There are now also methods +to convert between absolute and relative filenames: \fBabs2rel()\fR and +\&\fBrel2abs()\fR. For compatibility with operating systems that specify volume +names in file paths, the \fBsplitpath()\fR, \fBsplitdir()\fR, and \fBcatdir()\fR methods +have been added. +.IP "File::Spec::Functions" 4 +.IX Item "File::Spec::Functions" +The new File::Spec::Functions modules provides a function interface +to the File::Spec module. Allows shorthand +.Sp +.Vb 1 +\& $fullname = catfile($dir1, $dir2, $file); +.Ve +.Sp +instead of +.Sp +.Vb 1 +\& $fullname = File::Spec\->catfile($dir1, $dir2, $file); +.Ve +.IP "Getopt::Long" 4 +.IX Item "Getopt::Long" +Getopt::Long licensing has changed to allow the Perl Artistic License +as well as the \s-1GPL.\s0 It used to be \s-1GPL\s0 only, which got in the way of +non-GPL applications that wanted to use Getopt::Long. +.Sp +Getopt::Long encourages the use of Pod::Usage to produce help +messages. For example: +.Sp +.Vb 7 +\& use Getopt::Long; +\& use Pod::Usage; +\& my $man = 0; +\& my $help = 0; +\& GetOptions(\*(Aqhelp|?\*(Aq => \e$help, man => \e$man) or pod2usage(2); +\& pod2usage(1) if $help; +\& pod2usage(\-exitstatus => 0, \-verbose => 2) if $man; +\& +\& _\|_END_\|_ +\& +\& =head1 NAME +\& +\& sample \- Using Getopt::Long and Pod::Usage +\& +\& =head1 SYNOPSIS +\& +\& sample [options] [file ...] +\& +\& Options: +\& \-help brief help message +\& \-man full documentation +\& +\& =head1 OPTIONS +\& +\& =over 8 +\& +\& =item B<\-help> +\& +\& Print a brief help message and exits. +\& +\& =item B<\-man> +\& +\& Prints the manual page and exits. +\& +\& =back +\& +\& =head1 DESCRIPTION +\& +\& B will read the given input file(s) and do something +\& useful with the contents thereof. +\& +\& =cut +.Ve +.Sp +See Pod::Usage for details. +.Sp +A bug that prevented the non-option call-back <> from being +specified as the first argument has been fixed. +.Sp +To specify the characters < and > as option starters, use ><. Note, +however, that changing option starters is strongly deprecated. +.IP "\s-1IO\s0" 4 +.IX Item "IO" +\&\fBwrite()\fR and \fBsyswrite()\fR will now accept a single-argument +form of the call, for consistency with Perl's \fBsyswrite()\fR. +.Sp +You can now create a TCP-based IO::Socket::INET without forcing +a connect attempt. This allows you to configure its options +(like making it non-blocking) and then call \fBconnect()\fR manually. +.Sp +A bug that prevented the \fBIO::Socket::protocol()\fR accessor +from ever returning the correct value has been corrected. +.Sp +IO::Socket::connect now uses non-blocking \s-1IO\s0 instead of \fBalarm()\fR +to do connect timeouts. +.Sp +IO::Socket::accept now uses \fBselect()\fR instead of \fBalarm()\fR for doing +timeouts. +.Sp +IO::Socket::INET\->new now sets $! correctly on failure. $@ is +still set for backwards compatibility. +.IP "\s-1JPL\s0" 4 +.IX Item "JPL" +Java Perl Lingo is now distributed with Perl. See jpl/README +for more information. +.IP "lib" 4 +.IX Item "lib" +\&\f(CW\*(C`use lib\*(C'\fR now weeds out any trailing duplicate entries. +\&\f(CW\*(C`no lib\*(C'\fR removes all named entries. +.IP "Math::BigInt" 4 +.IX Item "Math::BigInt" +The bitwise operations \f(CW\*(C`<<\*(C'\fR, \f(CW\*(C`>>\*(C'\fR, \f(CW\*(C`&\*(C'\fR, \f(CW\*(C`|\*(C'\fR, +and \f(CW\*(C`~\*(C'\fR are now supported on bigints. +.IP "Math::Complex" 4 +.IX Item "Math::Complex" +The accessor methods Re, Im, arg, abs, rho, and theta can now also +act as mutators (accessor \f(CW$z\fR\->\fBRe()\fR, mutator \f(CW$z\fR\->\fBRe\fR\|(3)). +.Sp +The class method \f(CW\*(C`display_format\*(C'\fR and the corresponding object method +\&\f(CW\*(C`display_format\*(C'\fR, in addition to accepting just one argument, now can +also accept a parameter hash. Recognized keys of a parameter hash are +\&\f(CW"style"\fR, which corresponds to the old one parameter case, and two +new parameters: \f(CW"format"\fR, which is a \fBprintf()\fR\-style format string +(defaults usually to \f(CW"%.15g"\fR, you can revert to the default by +setting the format string to \f(CW\*(C`undef\*(C'\fR) used for both parts of a +complex number, and \f(CW"polar_pretty_print"\fR (defaults to true), +which controls whether an attempt is made to try to recognize small +multiples and rationals of pi (2pi, pi/2) at the argument (angle) of a +polar complex number. +.Sp +The potentially disruptive change is that in list context both methods +now \fIreturn the parameter hash\fR, instead of only the value of the +\&\f(CW"style"\fR parameter. +.IP "Math::Trig" 4 +.IX Item "Math::Trig" +A little bit of radial trigonometry (cylindrical and spherical), +radial coordinate conversions, and the great circle distance were added. +.IP "Pod::Parser, Pod::InputObjects" 4 +.IX Item "Pod::Parser, Pod::InputObjects" +Pod::Parser is a base class for parsing and selecting sections of +pod documentation from an input stream. This module takes care of +identifying pod paragraphs and commands in the input and hands off the +parsed paragraphs and commands to user-defined methods which are free +to interpret or translate them as they see fit. +.Sp +Pod::InputObjects defines some input objects needed by Pod::Parser, and +for advanced users of Pod::Parser that need more about a command besides +its name and text. +.Sp +As of release 5.6.0 of Perl, Pod::Parser is now the officially sanctioned +\&\*(L"base parser code\*(R" recommended for use by all pod2xxx translators. +Pod::Text (pod2text) and Pod::Man (pod2man) have already been converted +to use Pod::Parser and efforts to convert Pod::HTML (pod2html) are already +underway. For any questions or comments about pod parsing and translating +issues and utilities, please use the pod\-people@perl.org mailing list. +.Sp +For further information, please see Pod::Parser and Pod::InputObjects. +.IP "Pod::Checker, podchecker" 4 +.IX Item "Pod::Checker, podchecker" +This utility checks pod files for correct syntax, according to +perlpod. Obvious errors are flagged as such, while warnings are +printed for mistakes that can be handled gracefully. The checklist is +not complete yet. See Pod::Checker. +.IP "Pod::ParseUtils, Pod::Find" 4 +.IX Item "Pod::ParseUtils, Pod::Find" +These modules provide a set of gizmos that are useful mainly for pod +translators. Pod::Find traverses directory structures and +returns found pod files, along with their canonical names (like +\&\f(CW\*(C`File::Spec::Unix\*(C'\fR). Pod::ParseUtils contains +\&\fBPod::List\fR (useful for storing pod list information), \fBPod::Hyperlink\fR +(for parsing the contents of \f(CW\*(C`L<>\*(C'\fR sequences) and \fBPod::Cache\fR +(for caching information about pod files, e.g., link nodes). +.IP "Pod::Select, podselect" 4 +.IX Item "Pod::Select, podselect" +Pod::Select is a subclass of Pod::Parser which provides a function +named \*(L"\fBpodselect()\fR\*(R" to filter out user-specified sections of raw pod +documentation from an input stream. podselect is a script that provides +access to Pod::Select from other scripts to be used as a filter. +See Pod::Select. +.IP "Pod::Usage, pod2usage" 4 +.IX Item "Pod::Usage, pod2usage" +Pod::Usage provides the function \*(L"\fBpod2usage()\fR\*(R" to print usage messages for +a Perl script based on its embedded pod documentation. The \fBpod2usage()\fR +function is generally useful to all script authors since it lets them +write and maintain a single source (the pods) for documentation, thus +removing the need to create and maintain redundant usage message text +consisting of information already in the pods. +.Sp +There is also a pod2usage script which can be used from other kinds of +scripts to print usage messages from pods (even for non-Perl scripts +with pods embedded in comments). +.Sp +For details and examples, please see Pod::Usage. +.IP "Pod::Text and Pod::Man" 4 +.IX Item "Pod::Text and Pod::Man" +Pod::Text has been rewritten to use Pod::Parser. While \fBpod2text()\fR is +still available for backwards compatibility, the module now has a new +preferred interface. See Pod::Text for the details. The new Pod::Text +module is easily subclassed for tweaks to the output, and two such +subclasses (Pod::Text::Termcap for man-page-style bold and underlining +using termcap information, and Pod::Text::Color for markup with \s-1ANSI\s0 color +sequences) are now standard. +.Sp +pod2man has been turned into a module, Pod::Man, which also uses +Pod::Parser. In the process, several outstanding bugs related to quotes +in section headers, quoting of code escapes, and nested lists have been +fixed. pod2man is now a wrapper script around this module. +.IP "SDBM_File" 4 +.IX Item "SDBM_File" +An \s-1EXISTS\s0 method has been added to this module (and \fBsdbm_exists()\fR has +been added to the underlying sdbm library), so one can now call exists +on an SDBM_File tied hash and get the correct result, rather than a +runtime error. +.Sp +A bug that may have caused data loss when more than one disk block +happens to be read from the database in a single \s-1\fBFETCH\s0()\fR has been +fixed. +.IP "Sys::Syslog" 4 +.IX Item "Sys::Syslog" +Sys::Syslog now uses XSUBs to access facilities from syslog.h so it +no longer requires syslog.ph to exist. +.IP "Sys::Hostname" 4 +.IX Item "Sys::Hostname" +Sys::Hostname now uses XSUBs to call the C library's \fBgethostname()\fR or +\&\fBuname()\fR if they exist. +.IP "Term::ANSIColor" 4 +.IX Item "Term::ANSIColor" +Term::ANSIColor is a very simple module to provide easy and readable +access to the \s-1ANSI\s0 color and highlighting escape sequences, supported by +most \s-1ANSI\s0 terminal emulators. It is now included standard. +.IP "Time::Local" 4 +.IX Item "Time::Local" +The \fBtimelocal()\fR and \fBtimegm()\fR functions used to silently return bogus +results when the date fell outside the machine's integer range. They +now consistently \fBcroak()\fR if the date falls in an unsupported range. +.IP "Win32" 4 +.IX Item "Win32" +The error return value in list context has been changed for all functions +that return a list of values. Previously these functions returned a list +with a single element \f(CW\*(C`undef\*(C'\fR if an error occurred. Now these functions +return the empty list in these situations. This applies to the following +functions: +.Sp +.Vb 2 +\& Win32::FsType +\& Win32::GetOSVersion +.Ve +.Sp +The remaining functions are unchanged and continue to return \f(CW\*(C`undef\*(C'\fR on +error even in list context. +.Sp +The Win32::SetLastError(\s-1ERROR\s0) function has been added as a complement +to the \fBWin32::GetLastError()\fR function. +.Sp +The new Win32::GetFullPathName(\s-1FILENAME\s0) returns the full absolute +pathname for \s-1FILENAME\s0 in scalar context. In list context it returns +a two-element list containing the fully qualified directory name and +the filename. See Win32. +.IP "XSLoader" 4 +.IX Item "XSLoader" +The XSLoader extension is a simpler alternative to DynaLoader. +See XSLoader. +.IP "\s-1DBM\s0 Filters" 4 +.IX Item "DBM Filters" +A new feature called \*(L"\s-1DBM\s0 Filters\*(R" has been added to all the +\&\s-1DBM\s0 modules\-\-DB_File, GDBM_File, NDBM_File, ODBM_File, and SDBM_File. +\&\s-1DBM\s0 Filters add four new methods to each \s-1DBM\s0 module: +.Sp +.Vb 4 +\& filter_store_key +\& filter_store_value +\& filter_fetch_key +\& filter_fetch_value +.Ve +.Sp +These can be used to filter key-value pairs before the pairs are +written to the database or just after they are read from the database. +See perldbmfilter for further information. +.SS "Pragmata" +.IX Subsection "Pragmata" +\&\f(CW\*(C`use attrs\*(C'\fR is now obsolete, and is only provided for +backward-compatibility. It's been replaced by the \f(CW\*(C`sub : attributes\*(C'\fR +syntax. See \*(L"Subroutine Attributes\*(R" in perlsub and attributes. +.PP +Lexical warnings pragma, \f(CW\*(C`use warnings;\*(C'\fR, to control optional warnings. +See perllexwarn. +.PP +\&\f(CW\*(C`use filetest\*(C'\fR to control the behaviour of filetests (\f(CW\*(C`\-r\*(C'\fR \f(CW\*(C`\-w\*(C'\fR +\&...). Currently only one subpragma implemented, \*(L"use filetest +\&'access';\*(R", that uses \fBaccess\fR\|(2) or equivalent to check permissions +instead of using \fBstat\fR\|(2) as usual. This matters in filesystems +where there are ACLs (access control lists): the \fBstat\fR\|(2) might lie, +but \fBaccess\fR\|(2) knows better. +.PP +The \f(CW\*(C`open\*(C'\fR pragma can be used to specify default disciplines for +handle constructors (e.g. \fBopen()\fR) and for qx//. The two +pseudo-disciplines \f(CW\*(C`:raw\*(C'\fR and \f(CW\*(C`:crlf\*(C'\fR are currently supported on +DOS-derivative platforms (i.e. where binmode is not a no-op). +See also \*(L"\fBbinmode()\fR can be used to set :crlf and :raw modes\*(R". +.SH "Utility Changes" +.IX Header "Utility Changes" +.SS "dprofpp" +.IX Subsection "dprofpp" +\&\f(CW\*(C`dprofpp\*(C'\fR is used to display profile data generated using \f(CW\*(C`Devel::DProf\*(C'\fR. +See dprofpp. +.SS "find2perl" +.IX Subsection "find2perl" +The \f(CW\*(C`find2perl\*(C'\fR utility now uses the enhanced features of the File::Find +module. The \-depth and \-follow options are supported. Pod documentation +is also included in the script. +.SS "h2xs" +.IX Subsection "h2xs" +The \f(CW\*(C`h2xs\*(C'\fR tool can now work in conjunction with \f(CW\*(C`C::Scan\*(C'\fR (available +from \s-1CPAN\s0) to automatically parse real-life header files. The \f(CW\*(C`\-M\*(C'\fR, +\&\f(CW\*(C`\-a\*(C'\fR, \f(CW\*(C`\-k\*(C'\fR, and \f(CW\*(C`\-o\*(C'\fR options are new. +.SS "perlcc" +.IX Subsection "perlcc" +\&\f(CW\*(C`perlcc\*(C'\fR now supports the C and Bytecode backends. By default, +it generates output from the simple C backend rather than the +optimized C backend. +.PP +Support for non-Unix platforms has been improved. +.SS "perldoc" +.IX Subsection "perldoc" +\&\f(CW\*(C`perldoc\*(C'\fR has been reworked to avoid possible security holes. +It will not by default let itself be run as the superuser, but you +may still use the \fB\-U\fR switch to try to make it drop privileges +first. +.SS "The Perl Debugger" +.IX Subsection "The Perl Debugger" +Many bug fixes and enhancements were added to \fIperl5db.pl\fR, the +Perl debugger. The help documentation was rearranged. New commands +include \f(CW\*(C`< ?\*(C'\fR, \f(CW\*(C`> ?\*(C'\fR, and \f(CW\*(C`{ ?\*(C'\fR to list out current +actions, \f(CW\*(C`man \f(CIdocpage\f(CW\*(C'\fR to run your doc viewer on some perl +docset, and support for quoted options. The help information was +rearranged, and should be viewable once again if you're using \fBless\fR +as your pager. A serious security hole was plugged\*(--you should +immediately remove all older versions of the Perl debugger as +installed in previous releases, all the way back to perl3, from +your system to avoid being bitten by this. +.SH "Improved Documentation" +.IX Header "Improved Documentation" +Many of the platform-specific \s-1README\s0 files are now part of the perl +installation. See perl for the complete list. +.IP "perlapi.pod" 4 +.IX Item "perlapi.pod" +The official list of public Perl \s-1API\s0 functions. +.IP "perlboot.pod" 4 +.IX Item "perlboot.pod" +A tutorial for beginners on object-oriented Perl. +.IP "perlcompile.pod" 4 +.IX Item "perlcompile.pod" +An introduction to using the Perl Compiler suite. +.IP "perldbmfilter.pod" 4 +.IX Item "perldbmfilter.pod" +A howto document on using the \s-1DBM\s0 filter facility. +.IP "perldebug.pod" 4 +.IX Item "perldebug.pod" +All material unrelated to running the Perl debugger, plus all +low-level guts-like details that risked crushing the casual user +of the debugger, have been relocated from the old manpage to the +next entry below. +.IP "perldebguts.pod" 4 +.IX Item "perldebguts.pod" +This new manpage contains excessively low-level material not related +to the Perl debugger, but slightly related to debugging Perl itself. +It also contains some arcane internal details of how the debugging +process works that may only be of interest to developers of Perl +debuggers. +.IP "perlfork.pod" 4 +.IX Item "perlfork.pod" +Notes on the \fBfork()\fR emulation currently available for the Windows platform. +.IP "perlfilter.pod" 4 +.IX Item "perlfilter.pod" +An introduction to writing Perl source filters. +.IP "perlhack.pod" 4 +.IX Item "perlhack.pod" +Some guidelines for hacking the Perl source code. +.IP "perlintern.pod" 4 +.IX Item "perlintern.pod" +A list of internal functions in the Perl source code. +(List is currently empty.) +.IP "perllexwarn.pod" 4 +.IX Item "perllexwarn.pod" +Introduction and reference information about lexically scoped +warning categories. +.IP "perlnumber.pod" 4 +.IX Item "perlnumber.pod" +Detailed information about numbers as they are represented in Perl. +.IP "perlopentut.pod" 4 +.IX Item "perlopentut.pod" +A tutorial on using \fBopen()\fR effectively. +.IP "perlreftut.pod" 4 +.IX Item "perlreftut.pod" +A tutorial that introduces the essentials of references. +.IP "perltootc.pod" 4 +.IX Item "perltootc.pod" +A tutorial on managing class data for object modules. +.IP "perltodo.pod" 4 +.IX Item "perltodo.pod" +Discussion of the most often wanted features that may someday be +supported in Perl. +.IP "perlunicode.pod" 4 +.IX Item "perlunicode.pod" +An introduction to Unicode support features in Perl. +.SH "Performance enhancements" +.IX Header "Performance enhancements" +.ie n .SS "Simple \fBsort()\fP using { $a <=> $b } and the like are optimized" +.el .SS "Simple \fBsort()\fP using { \f(CW$a\fP <=> \f(CW$b\fP } and the like are optimized" +.IX Subsection "Simple sort() using { $a <=> $b } and the like are optimized" +Many common \fBsort()\fR operations using a simple inlined block are now +optimized for faster performance. +.SS "Optimized assignments to lexical variables" +.IX Subsection "Optimized assignments to lexical variables" +Certain operations in the \s-1RHS\s0 of assignment statements have been +optimized to directly set the lexical variable on the \s-1LHS,\s0 +eliminating redundant copying overheads. +.SS "Faster subroutine calls" +.IX Subsection "Faster subroutine calls" +Minor changes in how subroutine calls are handled internally +provide marginal improvements in performance. +.SS "\fBdelete()\fP, \fBeach()\fP, \fBvalues()\fP and hash iteration are faster" +.IX Subsection "delete(), each(), values() and hash iteration are faster" +The hash values returned by \fBdelete()\fR, \fBeach()\fR, \fBvalues()\fR and hashes in a +list context are the actual values in the hash, instead of copies. +This results in significantly better performance, because it eliminates +needless copying in most situations. +.SH "Installation and Configuration Improvements" +.IX Header "Installation and Configuration Improvements" +.SS "\-Dusethreads means something different" +.IX Subsection "-Dusethreads means something different" +The \-Dusethreads flag now enables the experimental interpreter-based thread +support by default. To get the flavor of experimental threads that was in +5.005 instead, you need to run Configure with \*(L"\-Dusethreads \-Duse5005threads\*(R". +.PP +As of v5.6.0, interpreter-threads support is still lacking a way to +create new threads from Perl (i.e., \f(CW\*(C`use Thread;\*(C'\fR will not work with +interpreter threads). \f(CW\*(C`use Thread;\*(C'\fR continues to be available when you +specify the \-Duse5005threads option to Configure, bugs and all. +.PP +.Vb 2 +\& NOTE: Support for threads continues to be an experimental feature. +\& Interfaces and implementation are subject to sudden and drastic changes. +.Ve +.SS "New Configure flags" +.IX Subsection "New Configure flags" +The following new flags may be enabled on the Configure command line +by running Configure with \f(CW\*(C`\-Dflag\*(C'\fR. +.PP +.Vb 3 +\& usemultiplicity +\& usethreads useithreads (new interpreter threads: no Perl API yet) +\& usethreads use5005threads (threads as they were in 5.005) +\& +\& use64bitint (equal to now deprecated \*(Aquse64bits\*(Aq) +\& use64bitall +\& +\& uselongdouble +\& usemorebits +\& uselargefiles +\& usesocks (only SOCKS v5 supported) +.Ve +.SS "Threadedness and 64\-bitness now more daring" +.IX Subsection "Threadedness and 64-bitness now more daring" +The Configure options enabling the use of threads and the use of +64\-bitness are now more daring in the sense that they no more have an +explicit list of operating systems of known threads/64\-bit +capabilities. In other words: if your operating system has the +necessary APIs and datatypes, you should be able just to go ahead and +use them, for threads by Configure \-Dusethreads, and for 64 bits +either explicitly by Configure \-Duse64bitint or implicitly if your +system has 64\-bit wide datatypes. See also \*(L"64\-bit support\*(R". +.SS "Long Doubles" +.IX Subsection "Long Doubles" +Some platforms have \*(L"long doubles\*(R", floating point numbers of even +larger range than ordinary \*(L"doubles\*(R". To enable using long doubles for +Perl's scalars, use \-Duselongdouble. +.SS "\-Dusemorebits" +.IX Subsection "-Dusemorebits" +You can enable both \-Duse64bitint and \-Duselongdouble with \-Dusemorebits. +See also \*(L"64\-bit support\*(R". +.SS "\-Duselargefiles" +.IX Subsection "-Duselargefiles" +Some platforms support system APIs that are capable of handling large files +(typically, files larger than two gigabytes). Perl will try to use these +APIs if you ask for \-Duselargefiles. +.PP +See \*(L"Large file support\*(R" for more information. +.SS "installusrbinperl" +.IX Subsection "installusrbinperl" +You can use \*(L"Configure \-Uinstallusrbinperl\*(R" which causes installperl +to skip installing perl also as /usr/bin/perl. This is useful if you +prefer not to modify /usr/bin for some reason or another but harmful +because many scripts assume to find Perl in /usr/bin/perl. +.SS "\s-1SOCKS\s0 support" +.IX Subsection "SOCKS support" +You can use \*(L"Configure \-Dusesocks\*(R" which causes Perl to probe +for the \s-1SOCKS\s0 proxy protocol library (v5, not v4). For more information +on \s-1SOCKS,\s0 see: +.PP +.Vb 1 +\& http://www.socks.nec.com/ +.Ve +.ie n .SS """\-A"" flag" +.el .SS "\f(CW\-A\fP flag" +.IX Subsection "-A flag" +You can \*(L"post-edit\*(R" the Configure variables using the Configure \f(CW\*(C`\-A\*(C'\fR +switch. The editing happens immediately after the platform specific +hints files have been processed but before the actual configuration +process starts. Run \f(CW\*(C`Configure \-h\*(C'\fR to find out the full \f(CW\*(C`\-A\*(C'\fR syntax. +.SS "Enhanced Installation Directories" +.IX Subsection "Enhanced Installation Directories" +The installation structure has been enriched to improve the support +for maintaining multiple versions of perl, to provide locations for +vendor-supplied modules, scripts, and manpages, and to ease maintenance +of locally-added modules, scripts, and manpages. See the section on +Installation Directories in the \s-1INSTALL\s0 file for complete details. +For most users building and installing from source, the defaults should +be fine. +.PP +If you previously used \f(CW\*(C`Configure \-Dsitelib\*(C'\fR or \f(CW\*(C`\-Dsitearch\*(C'\fR to set +special values for library directories, you might wish to consider using +the new \f(CW\*(C`\-Dsiteprefix\*(C'\fR setting instead. Also, if you wish to re-use a +config.sh file from an earlier version of perl, you should be sure to +check that Configure makes sensible choices for the new directories. +See \s-1INSTALL\s0 for complete details. +.SS "gcc automatically tried if 'cc' does not seem to be working" +.IX Subsection "gcc automatically tried if 'cc' does not seem to be working" +In many platforms the vendor-supplied 'cc' is too stripped-down to +build Perl (basically, the 'cc' doesn't do \s-1ANSI C\s0). If this seems +to be the case and the 'cc' does not seem to be the \s-1GNU C\s0 compiler +\&'gcc', an automatic attempt is made to find and use 'gcc' instead. +.SH "Platform specific changes" +.IX Header "Platform specific changes" +.SS "Supported platforms" +.IX Subsection "Supported platforms" +.IP "\(bu" 4 +The Mach CThreads (\s-1NEXTSTEP, OPENSTEP\s0) are now supported by the Thread +extension. +.IP "\(bu" 4 +GNU/Hurd is now supported. +.IP "\(bu" 4 +Rhapsody/Darwin is now supported. +.IP "\(bu" 4 +\&\s-1EPOC\s0 is now supported (on Psion 5). +.IP "\(bu" 4 +The cygwin port (formerly cygwin32) has been greatly improved. +.SS "\s-1DOS\s0" +.IX Subsection "DOS" +.IP "\(bu" 4 +Perl now works with djgpp 2.02 (and 2.03 alpha). +.IP "\(bu" 4 +Environment variable names are not converted to uppercase any more. +.IP "\(bu" 4 +Incorrect exit codes from backticks have been fixed. +.IP "\(bu" 4 +This port continues to use its own builtin globbing (not File::Glob). +.SS "\s-1OS390\s0 (OpenEdition \s-1MVS\s0)" +.IX Subsection "OS390 (OpenEdition MVS)" +Support for this \s-1EBCDIC\s0 platform has not been renewed in this release. +There are difficulties in reconciling Perl's standardization on \s-1UTF\-8\s0 +as its internal representation for characters with the \s-1EBCDIC\s0 character +set, because the two are incompatible. +.PP +It is unclear whether future versions will renew support for this +platform, but the possibility exists. +.SS "\s-1VMS\s0" +.IX Subsection "VMS" +Numerous revisions and extensions to configuration, build, testing, and +installation process to accommodate core changes and VMS-specific options. +.PP +Expand \f(CW%ENV\fR\-handling code to allow runtime mapping to logical names, +\&\s-1CLI\s0 symbols, and \s-1CRTL\s0 environ array. +.PP +Extension of subprocess invocation code to accept filespecs as command +\&\*(L"verbs\*(R". +.PP +Add to Perl command line processing the ability to use default file types and +to recognize Unix-style \f(CW\*(C`2>&1\*(C'\fR. +.PP +Expansion of File::Spec::VMS routines, and integration into ExtUtils::MM_VMS. +.PP +Extension of ExtUtils::MM_VMS to handle complex extensions more flexibly. +.PP +Barewords at start of Unix-syntax paths may be treated as text rather than +only as logical names. +.PP +Optional secure translation of several logical names used internally by Perl. +.PP +Miscellaneous bugfixing and porting of new core code to \s-1VMS.\s0 +.PP +Thanks are gladly extended to the many people who have contributed \s-1VMS\s0 +patches, testing, and ideas. +.SS "Win32" +.IX Subsection "Win32" +Perl can now emulate \fBfork()\fR internally, using multiple interpreters running +in different concurrent threads. This support must be enabled at build +time. See perlfork for detailed information. +.PP +When given a pathname that consists only of a drivename, such as \f(CW\*(C`A:\*(C'\fR, +\&\fBopendir()\fR and \fBstat()\fR now use the current working directory for the drive +rather than the drive root. +.PP +The builtin \s-1XSUB\s0 functions in the Win32:: namespace are documented. See +Win32. +.PP +$^X now contains the full path name of the running executable. +.PP +A \fBWin32::GetLongPathName()\fR function is provided to complement +\&\fBWin32::GetFullPathName()\fR and \fBWin32::GetShortPathName()\fR. See Win32. +.PP +\&\fBPOSIX::uname()\fR is supported. +.PP +system(1,...) now returns true process IDs rather than process +handles. \fBkill()\fR accepts any real process id, rather than strictly +return values from system(1,...). +.PP +For better compatibility with Unix, \f(CW\*(C`kill(0, $pid)\*(C'\fR can now be used to +test whether a process exists. +.PP +The \f(CW\*(C`Shell\*(C'\fR module is supported. +.PP +Better support for building Perl under command.com in Windows 95 +has been added. +.PP +Scripts are read in binary mode by default to allow ByteLoader (and +the filter mechanism in general) to work properly. For compatibility, +the \s-1DATA\s0 filehandle will be set to text mode if a carriage return is +detected at the end of the line containing the _\|_END_\|_ or _\|_DATA_\|_ +token; if not, the \s-1DATA\s0 filehandle will be left open in binary mode. +Earlier versions always opened the \s-1DATA\s0 filehandle in text mode. +.PP +The \fBglob()\fR operator is implemented via the \f(CW\*(C`File::Glob\*(C'\fR extension, +which supports glob syntax of the C shell. This increases the flexibility +of the \fBglob()\fR operator, but there may be compatibility issues for +programs that relied on the older globbing syntax. If you want to +preserve compatibility with the older syntax, you might want to run +perl with \f(CW\*(C`\-MFile::DosGlob\*(C'\fR. For details and compatibility information, +see File::Glob. +.SH "Significant bug fixes" +.IX Header "Significant bug fixes" +.SS "<\s-1HANDLE\s0> on empty files" +.IX Subsection " on empty files" +With \f(CW$/\fR set to \f(CW\*(C`undef\*(C'\fR, \*(L"slurping\*(R" an empty file returns a string of +zero length (instead of \f(CW\*(C`undef\*(C'\fR, as it used to) the first time the +\&\s-1HANDLE\s0 is read after \f(CW$/\fR is set to \f(CW\*(C`undef\*(C'\fR. Further reads yield +\&\f(CW\*(C`undef\*(C'\fR. +.PP +This means that the following will append \*(L"foo\*(R" to an empty file (it used +to do nothing): +.PP +.Vb 1 +\& perl \-0777 \-pi \-e \*(Aqs/^/foo/\*(Aq empty_file +.Ve +.PP +The behaviour of: +.PP +.Vb 1 +\& perl \-pi \-e \*(Aqs/^/foo/\*(Aq empty_file +.Ve +.PP +is unchanged (it continues to leave the file empty). +.ie n .SS """eval \*(Aq...\*(Aq"" improvements" +.el .SS "\f(CWeval \*(Aq...\*(Aq\fP improvements" +.IX Subsection "eval ... improvements" +Line numbers (as reflected by \fBcaller()\fR and most diagnostics) within +\&\f(CW\*(C`eval \*(Aq...\*(Aq\*(C'\fR were often incorrect where here documents were involved. +This has been corrected. +.PP +Lexical lookups for variables appearing in \f(CW\*(C`eval \*(Aq...\*(Aq\*(C'\fR within +functions that were themselves called within an \f(CW\*(C`eval \*(Aq...\*(Aq\*(C'\fR were +searching the wrong place for lexicals. The lexical search now +correctly ends at the subroutine's block boundary. +.PP +The use of \f(CW\*(C`return\*(C'\fR within \f(CW\*(C`eval {...}\*(C'\fR caused $@ not to be reset +correctly when no exception occurred within the eval. This has +been fixed. +.PP +Parsing of here documents used to be flawed when they appeared as +the replacement expression in \f(CW\*(C`eval \*(Aqs/.../.../e\*(Aq\*(C'\fR. This has +been fixed. +.SS "All compilation errors are true errors" +.IX Subsection "All compilation errors are true errors" +Some \*(L"errors\*(R" encountered at compile time were by necessity +generated as warnings followed by eventual termination of the +program. This enabled more such errors to be reported in a +single run, rather than causing a hard stop at the first error +that was encountered. +.PP +The mechanism for reporting such errors has been reimplemented +to queue compile-time errors and report them at the end of the +compilation as true errors rather than as warnings. This fixes +cases where error messages leaked through in the form of warnings +when code was compiled at run time using \f(CW\*(C`eval STRING\*(C'\fR, and +also allows such errors to be reliably trapped using \f(CW\*(C`eval "..."\*(C'\fR. +.SS "Implicitly closed filehandles are safer" +.IX Subsection "Implicitly closed filehandles are safer" +Sometimes implicitly closed filehandles (as when they are localized, +and Perl automatically closes them on exiting the scope) could +inadvertently set $? or $!. This has been corrected. +.SS "Behavior of list slices is more consistent" +.IX Subsection "Behavior of list slices is more consistent" +When taking a slice of a literal list (as opposed to a slice of +an array or hash), Perl used to return an empty list if the +result happened to be composed of all undef values. +.PP +The new behavior is to produce an empty list if (and only if) +the original list was empty. Consider the following example: +.PP +.Vb 1 +\& @a = (1,undef,undef,2)[2,1,2]; +.Ve +.PP +The old behavior would have resulted in \f(CW@a\fR having no elements. +The new behavior ensures it has three undefined elements. +.PP +Note in particular that the behavior of slices of the following +cases remains unchanged: +.PP +.Vb 5 +\& @a = ()[1,2]; +\& @a = (getpwent)[7,0]; +\& @a = (anything_returning_empty_list())[2,1,2]; +\& @a = @b[2,1,2]; +\& @a = @c{\*(Aqa\*(Aq,\*(Aqb\*(Aq,\*(Aqc\*(Aq}; +.Ve +.PP +See perldata. +.ie n .SS """(\e$)"" prototype and $foo{a}" +.el .SS "\f(CW(\e$)\fP prototype and \f(CW$foo{a}\fP" +.IX Subsection "($) prototype and $foo{a}" +A scalar reference prototype now correctly allows a hash or +array element in that slot. +.ie n .SS """goto &sub"" and \s-1AUTOLOAD\s0" +.el .SS "\f(CWgoto &sub\fP and \s-1AUTOLOAD\s0" +.IX Subsection "goto &sub and AUTOLOAD" +The \f(CW\*(C`goto &sub\*(C'\fR construct works correctly when \f(CW&sub\fR happens +to be autoloaded. +.ie n .SS """\-bareword"" allowed under ""use integer""" +.el .SS "\f(CW\-bareword\fP allowed under \f(CWuse integer\fP" +.IX Subsection "-bareword allowed under use integer" +The autoquoting of barewords preceded by \f(CW\*(C`\-\*(C'\fR did not work +in prior versions when the \f(CW\*(C`integer\*(C'\fR pragma was enabled. +This has been fixed. +.SS "Failures in \s-1\fBDESTROY\s0()\fP" +.IX Subsection "Failures in DESTROY()" +When code in a destructor threw an exception, it went unnoticed +in earlier versions of Perl, unless someone happened to be +looking in $@ just after the point the destructor happened to +run. Such failures are now visible as warnings when warnings are +enabled. +.SS "Locale bugs fixed" +.IX Subsection "Locale bugs fixed" +\&\fBprintf()\fR and \fBsprintf()\fR previously reset the numeric locale +back to the default \*(L"C\*(R" locale. This has been fixed. +.PP +Numbers formatted according to the local numeric locale +(such as using a decimal comma instead of a decimal dot) caused +\&\*(L"isn't numeric\*(R" warnings, even while the operations accessing +those numbers produced correct results. These warnings have been +discontinued. +.SS "Memory leaks" +.IX Subsection "Memory leaks" +The \f(CW\*(C`eval \*(Aqreturn sub {...}\*(Aq\*(C'\fR construct could sometimes leak +memory. This has been fixed. +.PP +Operations that aren't filehandle constructors used to leak memory +when used on invalid filehandles. This has been fixed. +.PP +Constructs that modified \f(CW@_\fR could fail to deallocate values +in \f(CW@_\fR and thus leak memory. This has been corrected. +.SS "Spurious subroutine stubs after failed subroutine calls" +.IX Subsection "Spurious subroutine stubs after failed subroutine calls" +Perl could sometimes create empty subroutine stubs when a +subroutine was not found in the package. Such cases stopped +later method lookups from progressing into base packages. +This has been corrected. +.ie n .SS "Taint failures under ""\-U""" +.el .SS "Taint failures under \f(CW\-U\fP" +.IX Subsection "Taint failures under -U" +When running in unsafe mode, taint violations could sometimes +cause silent failures. This has been fixed. +.ie n .SS "\s-1END\s0 blocks and the ""\-c"" switch" +.el .SS "\s-1END\s0 blocks and the \f(CW\-c\fP switch" +.IX Subsection "END blocks and the -c switch" +Prior versions used to run \s-1BEGIN\s0 \fBand\fR \s-1END\s0 blocks when Perl was +run in compile-only mode. Since this is typically not the expected +behavior, \s-1END\s0 blocks are not executed anymore when the \f(CW\*(C`\-c\*(C'\fR switch +is used, or if compilation fails. +.PP +See \*(L"Support for \s-1CHECK\s0 blocks\*(R" for how to run things when the compile +phase ends. +.SS "Potential to leak \s-1DATA\s0 filehandles" +.IX Subsection "Potential to leak DATA filehandles" +Using the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token creates an implicit filehandle to +the file that contains the token. It is the program's +responsibility to close it when it is done reading from it. +.PP +This caveat is now better explained in the documentation. +See perldata. +.SH "New or Changed Diagnostics" +.IX Header "New or Changed Diagnostics" +.ie n .IP """%s"" variable %s masks earlier declaration in same %s" 4 +.el .IP "``%s'' variable \f(CW%s\fR masks earlier declaration in same \f(CW%s\fR" 4 +.IX Item "%s variable %s masks earlier declaration in same %s" +(W misc) A \*(L"my\*(R" or \*(L"our\*(R" variable has been redeclared in the current scope or statement, +effectively eliminating all access to the previous instance. This is almost +always a typographical error. Note that the earlier variable will still exist +until the end of the scope or until all closure referents to it are +destroyed. +.ie n .IP """my sub"" not yet implemented" 4 +.el .IP "``my sub'' not yet implemented" 4 +.IX Item "my sub not yet implemented" +(F) Lexically scoped subroutines are not yet implemented. Don't try that +yet. +.ie n .IP """our"" variable %s redeclared" 4 +.el .IP "``our'' variable \f(CW%s\fR redeclared" 4 +.IX Item "our variable %s redeclared" +(W misc) You seem to have already declared the same global once before in the +current lexical scope. +.ie n .IP "'!' allowed only after types %s" 4 +.el .IP "'!' allowed only after types \f(CW%s\fR" 4 +.IX Item "'!' allowed only after types %s" +(F) The '!' is allowed in \fBpack()\fR and \fBunpack()\fR only after certain types. +See \*(L"pack\*(R" in perlfunc. +.IP "/ cannot take a count" 4 +.IX Item "/ cannot take a count" +(F) You had an unpack template indicating a counted-length string, +but you have also specified an explicit size for the string. +See \*(L"pack\*(R" in perlfunc. +.IP "/ must be followed by a, A or Z" 4 +.IX Item "/ must be followed by a, A or Z" +(F) You had an unpack template indicating a counted-length string, +which must be followed by one of the letters a, A or Z +to indicate what sort of string is to be unpacked. +See \*(L"pack\*(R" in perlfunc. +.IP "/ must be followed by a*, A* or Z*" 4 +.IX Item "/ must be followed by a*, A* or Z*" +(F) You had a pack template indicating a counted-length string, +Currently the only things that can have their length counted are a*, A* or Z*. +See \*(L"pack\*(R" in perlfunc. +.IP "/ must follow a numeric type" 4 +.IX Item "/ must follow a numeric type" +(F) You had an unpack template that contained a '#', +but this did not follow some numeric unpack specification. +See \*(L"pack\*(R" in perlfunc. +.IP "/%s/: Unrecognized escape \e\e%c passed through" 4 +.IX Item "/%s/: Unrecognized escape %c passed through" +(W regexp) You used a backslash-character combination which is not recognized +by Perl. This combination appears in an interpolated variable or a +\&\f(CW\*(C`\*(Aq\*(C'\fR\-delimited regular expression. The character was understood literally. +.IP "/%s/: Unrecognized escape \e\e%c in character class passed through" 4 +.IX Item "/%s/: Unrecognized escape %c in character class passed through" +(W regexp) You used a backslash-character combination which is not recognized +by Perl inside character classes. The character was understood literally. +.ie n .IP "/%s/ should probably be written as ""%s""" 4 +.el .IP "/%s/ should probably be written as ``%s''" 4 +.IX Item "/%s/ should probably be written as %s" +(W syntax) You have used a pattern where Perl expected to find a string, +as in the first argument to \f(CW\*(C`join\*(C'\fR. Perl will treat the true +or false result of matching the pattern against \f(CW$_\fR as the string, +which is probably not what you had in mind. +.IP "%s() called too early to check prototype" 4 +.IX Item "%s() called too early to check prototype" +(W prototype) You've called a function that has a prototype before the parser saw a +definition or declaration for it, and Perl could not check that the call +conforms to the prototype. You need to either add an early prototype +declaration for the subroutine in question, or move the subroutine +definition ahead of the call to get proper prototype checking. Alternatively, +if you are certain that you're calling the function correctly, you may put +an ampersand before the name to avoid the warning. See perlsub. +.ie n .IP "%s argument is not a \s-1HASH\s0 or \s-1ARRAY\s0 element" 4 +.el .IP "\f(CW%s\fR argument is not a \s-1HASH\s0 or \s-1ARRAY\s0 element" 4 +.IX Item "%s argument is not a HASH or ARRAY element" +(F) The argument to \fBexists()\fR must be a hash or array element, such as: +.Sp +.Vb 2 +\& $foo{$bar} +\& $ref\->{"susie"}[12] +.Ve +.ie n .IP "%s argument is not a \s-1HASH\s0 or \s-1ARRAY\s0 element or slice" 4 +.el .IP "\f(CW%s\fR argument is not a \s-1HASH\s0 or \s-1ARRAY\s0 element or slice" 4 +.IX Item "%s argument is not a HASH or ARRAY element or slice" +(F) The argument to \fBdelete()\fR must be either a hash or array element, such as: +.Sp +.Vb 2 +\& $foo{$bar} +\& $ref\->{"susie"}[12] +.Ve +.Sp +or a hash or array slice, such as: +.Sp +.Vb 2 +\& @foo[$bar, $baz, $xyzzy] +\& @{$ref\->[12]}{"susie", "queue"} +.Ve +.ie n .IP "%s argument is not a subroutine name" 4 +.el .IP "\f(CW%s\fR argument is not a subroutine name" 4 +.IX Item "%s argument is not a subroutine name" +(F) The argument to \fBexists()\fR for \f(CW\*(C`exists &sub\*(C'\fR must be a subroutine +name, and not a subroutine call. \f(CW\*(C`exists &sub()\*(C'\fR will generate this error. +.ie n .IP "%s package attribute may clash with future reserved word: %s" 4 +.el .IP "\f(CW%s\fR package attribute may clash with future reserved word: \f(CW%s\fR" 4 +.IX Item "%s package attribute may clash with future reserved word: %s" +(W reserved) A lowercase attribute name was used that had a package-specific handler. +That name might have a meaning to Perl itself some day, even though it +doesn't yet. Perhaps you should use a mixed-case attribute name, instead. +See attributes. +.ie n .IP "(in cleanup) %s" 4 +.el .IP "(in cleanup) \f(CW%s\fR" 4 +.IX Item "(in cleanup) %s" +(W misc) This prefix usually indicates that a \s-1\fBDESTROY\s0()\fR method raised +the indicated exception. Since destructors are usually called by +the system at arbitrary points during execution, and often a vast +number of times, the warning is issued only once for any number +of failures that would otherwise result in the same message being +repeated. +.Sp +Failure of user callbacks dispatched using the \f(CW\*(C`G_KEEPERR\*(C'\fR flag +could also result in this warning. See \*(L"G_KEEPERR\*(R" in perlcall. +.IP "<> should be quotes" 4 +.IX Item "<> should be quotes" +(F) You wrote \f(CW\*(C`require \*(C'\fR when you should have written +\&\f(CW\*(C`require \*(Aqfile\*(Aq\*(C'\fR. +.IP "Attempt to join self" 4 +.IX Item "Attempt to join self" +(F) You tried to join a thread from within itself, which is an +impossible task. You may be joining the wrong thread, or you may +need to move the \fBjoin()\fR to some other thread. +.IP "Bad evalled substitution pattern" 4 +.IX Item "Bad evalled substitution pattern" +(F) You've used the /e switch to evaluate the replacement for a +substitution, but perl found a syntax error in the code to evaluate, +most likely an unexpected right brace '}'. +.IP "Bad \fBrealloc()\fR ignored" 4 +.IX Item "Bad realloc() ignored" +(S) An internal routine called \fBrealloc()\fR on something that had never been +\&\fBmalloc()\fRed in the first place. Mandatory, but can be disabled by +setting environment variable \f(CW\*(C`PERL_BADFREE\*(C'\fR to 1. +.IP "Bareword found in conditional" 4 +.IX Item "Bareword found in conditional" +(W bareword) The compiler found a bareword where it expected a conditional, +which often indicates that an || or && was parsed as part of the +last argument of the previous construct, for example: +.Sp +.Vb 1 +\& open FOO || die; +.Ve +.Sp +It may also indicate a misspelled constant that has been interpreted +as a bareword: +.Sp +.Vb 2 +\& use constant TYPO => 1; +\& if (TYOP) { print "foo" } +.Ve +.Sp +The \f(CW\*(C`strict\*(C'\fR pragma is useful in avoiding such errors. +.IP "Binary number > 0b11111111111111111111111111111111 non-portable" 4 +.IX Item "Binary number > 0b11111111111111111111111111111111 non-portable" +(W portable) The binary number you specified is larger than 2**32\-1 +(4294967295) and therefore non-portable between systems. See +perlport for more on portability concerns. +.IP "Bit vector size > 32 non-portable" 4 +.IX Item "Bit vector size > 32 non-portable" +(W portable) Using bit vector sizes larger than 32 is non-portable. +.ie n .IP "Buffer overflow in prime_env_iter: %s" 4 +.el .IP "Buffer overflow in prime_env_iter: \f(CW%s\fR" 4 +.IX Item "Buffer overflow in prime_env_iter: %s" +(W internal) A warning peculiar to \s-1VMS.\s0 While Perl was preparing to iterate over +\&\f(CW%ENV\fR, it encountered a logical name or symbol definition which was too long, +so it was truncated to the string shown. +.ie n .IP "Can't check filesystem of script ""%s""" 4 +.el .IP "Can't check filesystem of script ``%s''" 4 +.IX Item "Can't check filesystem of script %s" +(P) For some reason you can't check the filesystem of the script for nosuid. +.ie n .IP "Can't declare class for non-scalar %s in ""%s""" 4 +.el .IP "Can't declare class for non-scalar \f(CW%s\fR in ``%s''" 4 +.IX Item "Can't declare class for non-scalar %s in %s" +(S) Currently, only scalar variables can declared with a specific class +qualifier in a \*(L"my\*(R" or \*(L"our\*(R" declaration. The semantics may be extended +for other types of variables in future. +.ie n .IP "Can't declare %s in ""%s""" 4 +.el .IP "Can't declare \f(CW%s\fR in ``%s''" 4 +.IX Item "Can't declare %s in %s" +(F) Only scalar, array, and hash variables may be declared as \*(L"my\*(R" or +\&\*(L"our\*(R" variables. They must have ordinary identifiers as names. +.IP "Can't ignore signal \s-1CHLD,\s0 forcing to default" 4 +.IX Item "Can't ignore signal CHLD, forcing to default" +(W signal) Perl has detected that it is being run with the \s-1SIGCHLD\s0 signal +(sometimes known as \s-1SIGCLD\s0) disabled. Since disabling this signal +will interfere with proper determination of exit status of child +processes, Perl has reset the signal to its default value. +This situation typically indicates that the parent program under +which Perl may be running (e.g., cron) is being very careless. +.IP "Can't modify non-lvalue subroutine call" 4 +.IX Item "Can't modify non-lvalue subroutine call" +(F) Subroutines meant to be used in lvalue context should be declared as +such, see \*(L"Lvalue subroutines\*(R" in perlsub. +.IP "Can't read \s-1CRTL\s0 environ" 4 +.IX Item "Can't read CRTL environ" +(S) A warning peculiar to \s-1VMS.\s0 Perl tried to read an element of \f(CW%ENV\fR +from the \s-1CRTL\s0's internal environment array and discovered the array was +missing. You need to figure out where your \s-1CRTL\s0 misplaced its environ +or define \fI\s-1PERL_ENV_TABLES\s0\fR (see perlvms) so that environ is not searched. +.ie n .IP "Can't remove %s: %s, skipping file" 4 +.el .IP "Can't remove \f(CW%s:\fR \f(CW%s\fR, skipping file" 4 +.IX Item "Can't remove %s: %s, skipping file" +(S) You requested an inplace edit without creating a backup file. Perl +was unable to remove the original file to replace it with the modified +file. The file was left unmodified. +.ie n .IP "Can't return %s from lvalue subroutine" 4 +.el .IP "Can't return \f(CW%s\fR from lvalue subroutine" 4 +.IX Item "Can't return %s from lvalue subroutine" +(F) Perl detected an attempt to return illegal lvalues (such +as temporary or readonly values) from a subroutine used as an lvalue. +This is not allowed. +.IP "Can't weaken a nonreference" 4 +.IX Item "Can't weaken a nonreference" +(F) You attempted to weaken something that was not a reference. Only +references can be weakened. +.IP "Character class [:%s:] unknown" 4 +.IX Item "Character class [:%s:] unknown" +(F) The class in the character class [: :] syntax is unknown. +See perlre. +.IP "Character class syntax [%s] belongs inside character classes" 4 +.IX Item "Character class syntax [%s] belongs inside character classes" +(W unsafe) The character class constructs [: :], [= =], and [. .] go +\&\fIinside\fR character classes, the [] are part of the construct, +for example: /[012[:alpha:]345]/. Note that [= =] and [. .] +are not currently implemented; they are simply placeholders for +future extensions. +.ie n .IP "Constant is not %s reference" 4 +.el .IP "Constant is not \f(CW%s\fR reference" 4 +.IX Item "Constant is not %s reference" +(F) A constant value (perhaps declared using the \f(CW\*(C`use constant\*(C'\fR pragma) +is being dereferenced, but it amounts to the wrong type of reference. The +message indicates the type of reference that was expected. This usually +indicates a syntax error in dereferencing the constant value. +See \*(L"Constant Functions\*(R" in perlsub and constant. +.ie n .IP "constant(%s): %s" 4 +.el .IP "constant(%s): \f(CW%s\fR" 4 +.IX Item "constant(%s): %s" +(F) The parser found inconsistencies either while attempting to define an +overloaded constant, or when trying to find the character name specified +in the \f(CW\*(C`\eN{...}\*(C'\fR escape. Perhaps you forgot to load the corresponding +\&\f(CW\*(C`overload\*(C'\fR or \f(CW\*(C`charnames\*(C'\fR pragma? See charnames and overload. +.IP "CORE::%s is not a keyword" 4 +.IX Item "CORE::%s is not a keyword" +(F) The \s-1CORE::\s0 namespace is reserved for Perl keywords. +.IP "defined(@array) is deprecated" 4 +.IX Item "defined(@array) is deprecated" +(D) \fBdefined()\fR is not usually useful on arrays because it checks for an +undefined \fIscalar\fR value. If you want to see if the array is empty, +just use \f(CW\*(C`if (@array) { # not empty }\*(C'\fR for example. +.IP "defined(%hash) is deprecated" 4 +.IX Item "defined(%hash) is deprecated" +(D) \fBdefined()\fR is not usually useful on hashes because it checks for an +undefined \fIscalar\fR value. If you want to see if the hash is empty, +just use \f(CW\*(C`if (%hash) { # not empty }\*(C'\fR for example. +.IP "Did not produce a valid header" 4 +.IX Item "Did not produce a valid header" +See Server error. +.ie n .IP "(Did you mean ""local"" instead of ""our""?)" 4 +.el .IP "(Did you mean ``local'' instead of ``our''?)" 4 +.IX Item "(Did you mean local instead of our?)" +(W misc) Remember that \*(L"our\*(R" does not localize the declared global variable. +You have declared it again in the same lexical scope, which seems superfluous. +.IP "Document contains no data" 4 +.IX Item "Document contains no data" +See Server error. +.ie n .IP "entering effective %s failed" 4 +.el .IP "entering effective \f(CW%s\fR failed" 4 +.IX Item "entering effective %s failed" +(F) While under the \f(CW\*(C`use filetest\*(C'\fR pragma, switching the real and +effective uids or gids failed. +.ie n .IP "false [] range ""%s"" in regexp" 4 +.el .IP "false [] range ``%s'' in regexp" 4 +.IX Item "false [] range %s in regexp" +(W regexp) A character class range must start and end at a literal character, not +another character class like \f(CW\*(C`\ed\*(C'\fR or \f(CW\*(C`[:alpha:]\*(C'\fR. The \*(L"\-\*(R" in your false +range is interpreted as a literal \*(L"\-\*(R". Consider quoting the \*(L"\-\*(R", \*(L"\e\-\*(R". +See perlre. +.ie n .IP "Filehandle %s opened only for output" 4 +.el .IP "Filehandle \f(CW%s\fR opened only for output" 4 +.IX Item "Filehandle %s opened only for output" +(W io) You tried to read from a filehandle opened only for writing. If you +intended it to be a read/write filehandle, you needed to open it with +\&\*(L"+<\*(R" or \*(L"+>\*(R" or \*(L"+>>\*(R" instead of with \*(L"<\*(R" or nothing. If +you intended only to read from the file, use \*(L"<\*(R". See +\&\*(L"open\*(R" in perlfunc. +.ie n .IP "\fBflock()\fR on closed filehandle %s" 4 +.el .IP "\fBflock()\fR on closed filehandle \f(CW%s\fR" 4 +.IX Item "flock() on closed filehandle %s" +(W closed) The filehandle you're attempting to \fBflock()\fR got itself closed some +time before now. Check your logic flow. \fBflock()\fR operates on filehandles. +Are you attempting to call \fBflock()\fR on a dirhandle by the same name? +.ie n .IP "Global symbol ""%s"" requires explicit package name" 4 +.el .IP "Global symbol ``%s'' requires explicit package name" 4 +.IX Item "Global symbol %s requires explicit package name" +(F) You've said \*(L"use strict vars\*(R", which indicates that all variables +must either be lexically scoped (using \*(L"my\*(R"), declared beforehand using +\&\*(L"our\*(R", or explicitly qualified to say which package the global variable +is in (using \*(L"::\*(R"). +.IP "Hexadecimal number > 0xffffffff non-portable" 4 +.IX Item "Hexadecimal number > 0xffffffff non-portable" +(W portable) The hexadecimal number you specified is larger than 2**32\-1 +(4294967295) and therefore non-portable between systems. See +perlport for more on portability concerns. +.ie n .IP "Ill-formed \s-1CRTL\s0 environ value ""%s""" 4 +.el .IP "Ill-formed \s-1CRTL\s0 environ value ``%s''" 4 +.IX Item "Ill-formed CRTL environ value %s" +(W internal) A warning peculiar to \s-1VMS.\s0 Perl tried to read the \s-1CRTL\s0's internal +environ array, and encountered an element without the \f(CW\*(C`=\*(C'\fR delimiter +used to separate keys from values. The element is ignored. +.IP "Ill-formed message in prime_env_iter: |%s|" 4 +.IX Item "Ill-formed message in prime_env_iter: |%s|" +(W internal) A warning peculiar to \s-1VMS.\s0 Perl tried to read a logical name +or \s-1CLI\s0 symbol definition when preparing to iterate over \f(CW%ENV\fR, and +didn't see the expected delimiter between key and value, so the +line was ignored. +.ie n .IP "Illegal binary digit %s" 4 +.el .IP "Illegal binary digit \f(CW%s\fR" 4 +.IX Item "Illegal binary digit %s" +(F) You used a digit other than 0 or 1 in a binary number. +.ie n .IP "Illegal binary digit %s ignored" 4 +.el .IP "Illegal binary digit \f(CW%s\fR ignored" 4 +.IX Item "Illegal binary digit %s ignored" +(W digit) You may have tried to use a digit other than 0 or 1 in a binary number. +Interpretation of the binary number stopped before the offending digit. +.IP "Illegal number of bits in vec" 4 +.IX Item "Illegal number of bits in vec" +(F) The number of bits in \fBvec()\fR (the third argument) must be a power of +two from 1 to 32 (or 64, if your platform supports that). +.ie n .IP "Integer overflow in %s number" 4 +.el .IP "Integer overflow in \f(CW%s\fR number" 4 +.IX Item "Integer overflow in %s number" +(W overflow) The hexadecimal, octal or binary number you have specified either +as a literal or as an argument to \fBhex()\fR or \fBoct()\fR is too big for your +architecture, and has been converted to a floating point number. On a +32\-bit architecture the largest hexadecimal, octal or binary number +representable without overflow is 0xFFFFFFFF, 037777777777, or +0b11111111111111111111111111111111 respectively. Note that Perl +transparently promotes all numbers to a floating point representation +internally\*(--subject to loss of precision errors in subsequent +operations. +.ie n .IP "Invalid %s attribute: %s" 4 +.el .IP "Invalid \f(CW%s\fR attribute: \f(CW%s\fR" 4 +.IX Item "Invalid %s attribute: %s" +The indicated attribute for a subroutine or variable was not recognized +by Perl or by a user-supplied handler. See attributes. +.ie n .IP "Invalid %s attributes: %s" 4 +.el .IP "Invalid \f(CW%s\fR attributes: \f(CW%s\fR" 4 +.IX Item "Invalid %s attributes: %s" +The indicated attributes for a subroutine or variable were not recognized +by Perl or by a user-supplied handler. See attributes. +.ie n .IP "invalid [] range ""%s"" in regexp" 4 +.el .IP "invalid [] range ``%s'' in regexp" 4 +.IX Item "invalid [] range %s in regexp" +The offending range is now explicitly displayed. +.ie n .IP "Invalid separator character %s in attribute list" 4 +.el .IP "Invalid separator character \f(CW%s\fR in attribute list" 4 +.IX Item "Invalid separator character %s in attribute list" +(F) Something other than a colon or whitespace was seen between the +elements of an attribute list. If the previous attribute +had a parenthesised parameter list, perhaps that list was terminated +too soon. See attributes. +.ie n .IP "Invalid separator character %s in subroutine attribute list" 4 +.el .IP "Invalid separator character \f(CW%s\fR in subroutine attribute list" 4 +.IX Item "Invalid separator character %s in subroutine attribute list" +(F) Something other than a colon or whitespace was seen between the +elements of a subroutine attribute list. If the previous attribute +had a parenthesised parameter list, perhaps that list was terminated +too soon. +.ie n .IP "leaving effective %s failed" 4 +.el .IP "leaving effective \f(CW%s\fR failed" 4 +.IX Item "leaving effective %s failed" +(F) While under the \f(CW\*(C`use filetest\*(C'\fR pragma, switching the real and +effective uids or gids failed. +.ie n .IP "Lvalue subs returning %s not implemented yet" 4 +.el .IP "Lvalue subs returning \f(CW%s\fR not implemented yet" 4 +.IX Item "Lvalue subs returning %s not implemented yet" +(F) Due to limitations in the current implementation, array and hash +values cannot be returned in subroutines used in lvalue context. +See \*(L"Lvalue subroutines\*(R" in perlsub. +.ie n .IP "Method %s not permitted" 4 +.el .IP "Method \f(CW%s\fR not permitted" 4 +.IX Item "Method %s not permitted" +See Server error. +.ie n .IP "Missing %sbrace%s on \eN{}" 4 +.el .IP "Missing \f(CW%sbrace\fR%s on \eN{}" 4 +.IX Item "Missing %sbrace%s on N{}" +(F) Wrong syntax of character name literal \f(CW\*(C`\eN{charname}\*(C'\fR within +double-quotish context. +.IP "Missing command in piped open" 4 +.IX Item "Missing command in piped open" +(W pipe) You used the \f(CW\*(C`open(FH, "| command")\*(C'\fR or \f(CW\*(C`open(FH, "command |")\*(C'\fR +construction, but the command was missing or blank. +.ie n .IP "Missing name in ""my sub""" 4 +.el .IP "Missing name in ``my sub''" 4 +.IX Item "Missing name in my sub" +(F) The reserved syntax for lexically scoped subroutines requires that they +have a name with which they can be found. +.ie n .IP "No %s specified for \-%c" 4 +.el .IP "No \f(CW%s\fR specified for \-%c" 4 +.IX Item "No %s specified for -%c" +(F) The indicated command line switch needs a mandatory argument, but +you haven't specified one. +.ie n .IP "No package name allowed for variable %s in ""our""" 4 +.el .IP "No package name allowed for variable \f(CW%s\fR in ``our''" 4 +.IX Item "No package name allowed for variable %s in our" +(F) Fully qualified variable names are not allowed in \*(L"our\*(R" declarations, +because that doesn't make much sense under existing semantics. Such +syntax is reserved for future extensions. +.IP "No space allowed after \-%c" 4 +.IX Item "No space allowed after -%c" +(F) The argument to the indicated command line switch must follow immediately +after the switch, without intervening spaces. +.IP "no \s-1UTC\s0 offset information; assuming local time is \s-1UTC\s0" 4 +.IX Item "no UTC offset information; assuming local time is UTC" +(S) A warning peculiar to \s-1VMS.\s0 Perl was unable to find the local +timezone offset, so it's assuming that local system time is equivalent +to \s-1UTC.\s0 If it's not, define the logical name \fI\s-1SYS$TIMEZONE_DIFFERENTIAL\s0\fR +to translate to the number of seconds which need to be added to \s-1UTC\s0 to +get local time. +.IP "Octal number > 037777777777 non-portable" 4 +.IX Item "Octal number > 037777777777 non-portable" +(W portable) The octal number you specified is larger than 2**32\-1 (4294967295) +and therefore non-portable between systems. See perlport for more +on portability concerns. +.Sp +See also perlport for writing portable code. +.IP "panic: del_backref" 4 +.IX Item "panic: del_backref" +(P) Failed an internal consistency check while trying to reset a weak +reference. +.IP "panic: kid popen errno read" 4 +.IX Item "panic: kid popen errno read" +(F) forked child returned an incomprehensible message about its errno. +.IP "panic: magic_killbackrefs" 4 +.IX Item "panic: magic_killbackrefs" +(P) Failed an internal consistency check while trying to reset all weak +references to an object. +.ie n .IP "Parentheses missing around ""%s"" list" 4 +.el .IP "Parentheses missing around ``%s'' list" 4 +.IX Item "Parentheses missing around %s list" +(W parenthesis) You said something like +.Sp +.Vb 1 +\& my $foo, $bar = @_; +.Ve +.Sp +when you meant +.Sp +.Vb 1 +\& my ($foo, $bar) = @_; +.Ve +.Sp +Remember that \*(L"my\*(R", \*(L"our\*(R", and \*(L"local\*(R" bind tighter than comma. +.ie n .IP "Possible unintended interpolation of %s in string" 4 +.el .IP "Possible unintended interpolation of \f(CW%s\fR in string" 4 +.IX Item "Possible unintended interpolation of %s in string" +(W ambiguous) It used to be that Perl would try to guess whether you +wanted an array interpolated or a literal @. It no longer does this; +arrays are now \fIalways\fR interpolated into strings. This means that +if you try something like: +.Sp +.Vb 1 +\& print "fred@example.com"; +.Ve +.Sp +and the array \f(CW@example\fR doesn't exist, Perl is going to print +\&\f(CW\*(C`fred.com\*(C'\fR, which is probably not what you wanted. To get a literal +\&\f(CW\*(C`@\*(C'\fR sign in a string, put a backslash before it, just as you would +to get a literal \f(CW\*(C`$\*(C'\fR sign. +.ie n .IP "Possible Y2K bug: %s" 4 +.el .IP "Possible Y2K bug: \f(CW%s\fR" 4 +.IX Item "Possible Y2K bug: %s" +(W y2k) You are concatenating the number 19 with another number, which +could be a potential Year 2000 problem. +.ie n .IP "pragma ""attrs"" is deprecated, use ""sub \s-1NAME : ATTRS""\s0 instead" 4 +.el .IP "pragma ``attrs'' is deprecated, use ``sub \s-1NAME : ATTRS''\s0 instead" 4 +.IX Item "pragma attrs is deprecated, use sub NAME : ATTRS instead" +(W deprecated) You have written something like this: +.Sp +.Vb 4 +\& sub doit +\& { +\& use attrs qw(locked); +\& } +.Ve +.Sp +You should use the new declaration syntax instead. +.Sp +.Vb 3 +\& sub doit : locked +\& { +\& ... +.Ve +.Sp +The \f(CW\*(C`use attrs\*(C'\fR pragma is now obsolete, and is only provided for +backward-compatibility. See \*(L"Subroutine Attributes\*(R" in perlsub. +.IP "Premature end of script headers" 4 +.IX Item "Premature end of script headers" +See Server error. +.IP "Repeat count in pack overflows" 4 +.IX Item "Repeat count in pack overflows" +(F) You can't specify a repeat count so large that it overflows +your signed integers. See \*(L"pack\*(R" in perlfunc. +.IP "Repeat count in unpack overflows" 4 +.IX Item "Repeat count in unpack overflows" +(F) You can't specify a repeat count so large that it overflows +your signed integers. See \*(L"unpack\*(R" in perlfunc. +.IP "\fBrealloc()\fR of freed memory ignored" 4 +.IX Item "realloc() of freed memory ignored" +(S) An internal routine called \fBrealloc()\fR on something that had already +been freed. +.IP "Reference is already weak" 4 +.IX Item "Reference is already weak" +(W misc) You have attempted to weaken a reference that is already weak. +Doing so has no effect. +.IP "setpgrp can't take arguments" 4 +.IX Item "setpgrp can't take arguments" +(F) Your system has the \fBsetpgrp()\fR from \s-1BSD 4.2,\s0 which takes no arguments, +unlike \s-1POSIX\s0 \fBsetpgid()\fR, which takes a process \s-1ID\s0 and process group \s-1ID.\s0 +.IP "Strange *+?{} on zero-length expression" 4 +.IX Item "Strange *+?{} on zero-length expression" +(W regexp) You applied a regular expression quantifier in a place where it +makes no sense, such as on a zero-width assertion. +Try putting the quantifier inside the assertion instead. For example, +the way to match \*(L"abc\*(R" provided that it is followed by three +repetitions of \*(L"xyz\*(R" is \f(CW\*(C`/abc(?=(?:xyz){3})/\*(C'\fR, not \f(CW\*(C`/abc(?=xyz){3}/\*(C'\fR. +.ie n .IP "switching effective %s is not implemented" 4 +.el .IP "switching effective \f(CW%s\fR is not implemented" 4 +.IX Item "switching effective %s is not implemented" +(F) While under the \f(CW\*(C`use filetest\*(C'\fR pragma, we cannot switch the +real and effective uids or gids. +.IP "This Perl can't reset \s-1CRTL\s0 environ elements (%s)" 4 +.IX Item "This Perl can't reset CRTL environ elements (%s)" +.PD 0 +.IP "This Perl can't set \s-1CRTL\s0 environ elements (%s=%s)" 4 +.IX Item "This Perl can't set CRTL environ elements (%s=%s)" +.PD +(W internal) Warnings peculiar to \s-1VMS.\s0 You tried to change or delete an element +of the \s-1CRTL\s0's internal environ array, but your copy of Perl wasn't +built with a \s-1CRTL\s0 that contained the \fBsetenv()\fR function. You'll need to +rebuild Perl with a \s-1CRTL\s0 that does, or redefine \fI\s-1PERL_ENV_TABLES\s0\fR (see +perlvms) so that the environ array isn't the target of the change to +\&\f(CW%ENV\fR which produced the warning. +.ie n .IP "Too late to run %s block" 4 +.el .IP "Too late to run \f(CW%s\fR block" 4 +.IX Item "Too late to run %s block" +(W void) A \s-1CHECK\s0 or \s-1INIT\s0 block is being defined during run time proper, +when the opportunity to run them has already passed. Perhaps you are +loading a file with \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`do\*(C'\fR when you should be using +\&\f(CW\*(C`use\*(C'\fR instead. Or perhaps you should put the \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`do\*(C'\fR +inside a \s-1BEGIN\s0 block. +.IP "Unknown \fBopen()\fR mode '%s'" 4 +.IX Item "Unknown open() mode '%s'" +(F) The second argument of 3\-argument \fBopen()\fR is not among the list +of valid modes: \f(CW\*(C`<\*(C'\fR, \f(CW\*(C`>\*(C'\fR, \f(CW\*(C`>>\*(C'\fR, \f(CW\*(C`+<\*(C'\fR, +\&\f(CW\*(C`+>\*(C'\fR, \f(CW\*(C`+>>\*(C'\fR, \f(CW\*(C`\-|\*(C'\fR, \f(CW\*(C`|\-\*(C'\fR. +.ie n .IP "Unknown process %x sent message to prime_env_iter: %s" 4 +.el .IP "Unknown process \f(CW%x\fR sent message to prime_env_iter: \f(CW%s\fR" 4 +.IX Item "Unknown process %x sent message to prime_env_iter: %s" +(P) An error peculiar to \s-1VMS.\s0 Perl was reading values for \f(CW%ENV\fR before +iterating over it, and someone else stuck a message in the stream of +data Perl expected. Someone's very confused, or perhaps trying to +subvert Perl's population of \f(CW%ENV\fR for nefarious purposes. +.IP "Unrecognized escape \e\e%c passed through" 4 +.IX Item "Unrecognized escape %c passed through" +(W misc) You used a backslash-character combination which is not recognized +by Perl. The character was understood literally. +.IP "Unterminated attribute parameter in attribute list" 4 +.IX Item "Unterminated attribute parameter in attribute list" +(F) The lexer saw an opening (left) parenthesis character while parsing an +attribute list, but the matching closing (right) parenthesis +character was not found. You may need to add (or remove) a backslash +character to get your parentheses to balance. See attributes. +.IP "Unterminated attribute list" 4 +.IX Item "Unterminated attribute list" +(F) The lexer found something other than a simple identifier at the start +of an attribute, and it wasn't a semicolon or the start of a +block. Perhaps you terminated the parameter list of the previous attribute +too soon. See attributes. +.IP "Unterminated attribute parameter in subroutine attribute list" 4 +.IX Item "Unterminated attribute parameter in subroutine attribute list" +(F) The lexer saw an opening (left) parenthesis character while parsing a +subroutine attribute list, but the matching closing (right) parenthesis +character was not found. You may need to add (or remove) a backslash +character to get your parentheses to balance. +.IP "Unterminated subroutine attribute list" 4 +.IX Item "Unterminated subroutine attribute list" +(F) The lexer found something other than a simple identifier at the start +of a subroutine attribute, and it wasn't a semicolon or the start of a +block. Perhaps you terminated the parameter list of the previous attribute +too soon. +.ie n .IP "Value of \s-1CLI\s0 symbol ""%s"" too long" 4 +.el .IP "Value of \s-1CLI\s0 symbol ``%s'' too long" 4 +.IX Item "Value of CLI symbol %s too long" +(W misc) A warning peculiar to \s-1VMS.\s0 Perl tried to read the value of an \f(CW%ENV\fR +element from a \s-1CLI\s0 symbol table, and found a resultant string longer +than 1024 characters. The return value has been truncated to 1024 +characters. +.IP "Version number must be a constant number" 4 +.IX Item "Version number must be a constant number" +(P) The attempt to translate a \f(CW\*(C`use Module n.n LIST\*(C'\fR statement into +its equivalent \f(CW\*(C`BEGIN\*(C'\fR block found an internal inconsistency with +the version number. +.SH "New tests" +.IX Header "New tests" +.IP "lib/attrs" 4 +.IX Item "lib/attrs" +Compatibility tests for \f(CW\*(C`sub : attrs\*(C'\fR vs the older \f(CW\*(C`use attrs\*(C'\fR. +.IP "lib/env" 4 +.IX Item "lib/env" +Tests for new environment scalar capability (e.g., \f(CW\*(C`use Env qw($BAR);\*(C'\fR). +.IP "lib/env\-array" 4 +.IX Item "lib/env-array" +Tests for new environment array capability (e.g., \f(CW\*(C`use Env qw(@PATH);\*(C'\fR). +.IP "lib/io_const" 4 +.IX Item "lib/io_const" +\&\s-1IO\s0 constants (SEEK_*, _IO*). +.IP "lib/io_dir" 4 +.IX Item "lib/io_dir" +Directory-related \s-1IO\s0 methods (new, read, close, rewind, tied delete). +.IP "lib/io_multihomed" 4 +.IX Item "lib/io_multihomed" +\&\s-1INET\s0 sockets with multi-homed hosts. +.IP "lib/io_poll" 4 +.IX Item "lib/io_poll" +\&\s-1IO\s0 \fBpoll()\fR. +.IP "lib/io_unix" 4 +.IX Item "lib/io_unix" +\&\s-1UNIX\s0 sockets. +.IP "op/attrs" 4 +.IX Item "op/attrs" +Regression tests for \f(CW\*(C`my ($x,@y,%z) : attrs\*(C'\fR and . +.IP "op/filetest" 4 +.IX Item "op/filetest" +File test operators. +.IP "op/lex_assign" 4 +.IX Item "op/lex_assign" +Verify operations that access pad objects (lexicals and temporaries). +.IP "op/exists_sub" 4 +.IX Item "op/exists_sub" +Verify \f(CW\*(C`exists &sub\*(C'\fR operations. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +.SS "Perl Source Incompatibilities" +.IX Subsection "Perl Source Incompatibilities" +Beware that any new warnings that have been added or old ones +that have been enhanced are \fBnot\fR considered incompatible changes. +.PP +Since all new warnings must be explicitly requested via the \f(CW\*(C`\-w\*(C'\fR +switch or the \f(CW\*(C`warnings\*(C'\fR pragma, it is ultimately the programmer's +responsibility to ensure that warnings are enabled judiciously. +.IP "\s-1CHECK\s0 is a new keyword" 4 +.IX Item "CHECK is a new keyword" +All subroutine definitions named \s-1CHECK\s0 are now special. See +\&\f(CW\*(C`/"Support for CHECK blocks"\*(C'\fR for more information. +.IP "Treatment of list slices of undef has changed" 4 +.IX Item "Treatment of list slices of undef has changed" +There is a potential incompatibility in the behavior of list slices +that are comprised entirely of undefined values. +See \*(L"Behavior of list slices is more consistent\*(R". +.ie n .IP "Format of $English::PERL_VERSION is different" 4 +.el .IP "Format of \f(CW$English::PERL_VERSION\fR is different" 4 +.IX Item "Format of $English::PERL_VERSION is different" +The English module now sets \f(CW$PERL_VERSION\fR to $^V (a string value) rather +than \f(CW$]\fR (a numeric value). This is a potential incompatibility. +Send us a report via perlbug if you are affected by this. +.Sp +See \*(L"Improved Perl version numbering system\*(R" for the reasons for +this change. +.ie n .IP "Literals of the form 1.2.3 parse differently" 4 +.el .IP "Literals of the form \f(CW1.2.3\fR parse differently" 4 +.IX Item "Literals of the form 1.2.3 parse differently" +Previously, numeric literals with more than one dot in them were +interpreted as a floating point number concatenated with one or more +numbers. Such \*(L"numbers\*(R" are now parsed as strings composed of the +specified ordinals. +.Sp +For example, \f(CW\*(C`print 97.98.99\*(C'\fR used to output \f(CW97.9899\fR in earlier +versions, but now prints \f(CW\*(C`abc\*(C'\fR. +.Sp +See \*(L"Support for strings represented as a vector of ordinals\*(R". +.IP "Possibly changed pseudo-random number generator" 4 +.IX Item "Possibly changed pseudo-random number generator" +Perl programs that depend on reproducing a specific set of pseudo-random +numbers may now produce different output due to improvements made to the +\&\fBrand()\fR builtin. You can use \f(CW\*(C`sh Configure \-Drandfunc=rand\*(C'\fR to obtain +the old behavior. +.Sp +See \*(L"Better pseudo-random number generator\*(R". +.IP "Hashing function for hash keys has changed" 4 +.IX Item "Hashing function for hash keys has changed" +Even though Perl hashes are not order preserving, the apparently +random order encountered when iterating on the contents of a hash +is actually determined by the hashing algorithm used. Improvements +in the algorithm may yield a random order that is \fBdifferent\fR from +that of previous versions, especially when iterating on hashes. +.Sp +See \*(L"Better worst-case behavior of hashes\*(R" for additional +information. +.ie n .IP """undef"" fails on read only values" 4 +.el .IP "\f(CWundef\fR fails on read only values" 4 +.IX Item "undef fails on read only values" +Using the \f(CW\*(C`undef\*(C'\fR operator on a readonly value (such as \f(CW$1\fR) has +the same effect as assigning \f(CW\*(C`undef\*(C'\fR to the readonly value\*(--it +throws an exception. +.IP "Close-on-exec bit may be set on pipe and socket handles" 4 +.IX Item "Close-on-exec bit may be set on pipe and socket handles" +Pipe and socket handles are also now subject to the close-on-exec +behavior determined by the special variable $^F. +.Sp +See \*(L"More consistent close-on-exec behavior\*(R". +.ie n .IP "Writing ""$$1"" to mean ""${$}1"" is unsupported" 4 +.el .IP "Writing \f(CW``$$1''\fR to mean \f(CW``${$}1''\fR is unsupported" 4 +.IX Item "Writing ""$$1"" to mean ""${$}1"" is unsupported" +Perl 5.004 deprecated the interpretation of \f(CW$$1\fR and +similar within interpolated strings to mean \f(CW\*(C`$$ . "1"\*(C'\fR, +but still allowed it. +.Sp +In Perl 5.6.0 and later, \f(CW"$$1"\fR always means \f(CW"${$1}"\fR. +.ie n .IP "\fBdelete()\fR, \fBeach()\fR, \fBvalues()\fR and ""\e(%h)""" 4 +.el .IP "\fBdelete()\fR, \fBeach()\fR, \fBvalues()\fR and \f(CW\e(%h)\fR" 4 +.IX Item "delete(), each(), values() and )" +operate on aliases to values, not copies +.Sp +\&\fBdelete()\fR, \fBeach()\fR, \fBvalues()\fR and hashes (e.g. \f(CW\*(C`\e(%h)\*(C'\fR) +in a list context return the actual +values in the hash, instead of copies (as they used to in earlier +versions). Typical idioms for using these constructs copy the +returned values, but this can make a significant difference when +creating references to the returned values. Keys in the hash are still +returned as copies when iterating on a hash. +.Sp +See also \*(L"\fBdelete()\fR, \fBeach()\fR, \fBvalues()\fR and hash iteration are faster\*(R". +.IP "vec(\s-1EXPR,OFFSET,BITS\s0) enforces powers-of-two \s-1BITS\s0" 4 +.IX Item "vec(EXPR,OFFSET,BITS) enforces powers-of-two BITS" +\&\fBvec()\fR generates a run-time error if the \s-1BITS\s0 argument is not +a valid power-of-two integer. +.IP "Text of some diagnostic output has changed" 4 +.IX Item "Text of some diagnostic output has changed" +Most references to internal Perl operations in diagnostics +have been changed to be more descriptive. This may be an +issue for programs that may incorrectly rely on the exact +text of diagnostics for proper functioning. +.ie n .IP """%@"" has been removed" 4 +.el .IP "\f(CW%@\fR has been removed" 4 +.IX Item "%@ has been removed" +The undocumented special variable \f(CW\*(C`%@\*(C'\fR that used to accumulate +\&\*(L"background\*(R" errors (such as those that happen in \s-1\fBDESTROY\s0()\fR) +has been removed, because it could potentially result in memory +leaks. +.IP "Parenthesized \fBnot()\fR behaves like a list operator" 4 +.IX Item "Parenthesized not() behaves like a list operator" +The \f(CW\*(C`not\*(C'\fR operator now falls under the \*(L"if it looks like a function, +it behaves like a function\*(R" rule. +.Sp +As a result, the parenthesized form can be used with \f(CW\*(C`grep\*(C'\fR and \f(CW\*(C`map\*(C'\fR. +The following construct used to be a syntax error before, but it works +as expected now: +.Sp +.Vb 1 +\& grep not($_), @things; +.Ve +.Sp +On the other hand, using \f(CW\*(C`not\*(C'\fR with a literal list slice may not +work. The following previously allowed construct: +.Sp +.Vb 1 +\& print not (1,2,3)[0]; +.Ve +.Sp +needs to be written with additional parentheses now: +.Sp +.Vb 1 +\& print not((1,2,3)[0]); +.Ve +.Sp +The behavior remains unaffected when \f(CW\*(C`not\*(C'\fR is not followed by parentheses. +.ie n .IP "Semantics of bareword prototype ""(*)"" have changed" 4 +.el .IP "Semantics of bareword prototype \f(CW(*)\fR have changed" 4 +.IX Item "Semantics of bareword prototype (*) have changed" +The semantics of the bareword prototype \f(CW\*(C`*\*(C'\fR have changed. Perl 5.005 +always coerced simple scalar arguments to a typeglob, which wasn't useful +in situations where the subroutine must distinguish between a simple +scalar and a typeglob. The new behavior is to not coerce bareword +arguments to a typeglob. The value will always be visible as either +a simple scalar or as a reference to a typeglob. +.Sp +See \*(L"More functional bareword prototype (*)\*(R". +.IP "Semantics of bit operators may have changed on 64\-bit platforms" 4 +.IX Item "Semantics of bit operators may have changed on 64-bit platforms" +If your platform is either natively 64\-bit or if Perl has been +configured to used 64\-bit integers, i.e., \f(CW$Config\fR{ivsize} is 8, +there may be a potential incompatibility in the behavior of bitwise +numeric operators (& | ^ ~ << >>). These operators used to strictly +operate on the lower 32 bits of integers in previous versions, but now +operate over the entire native integral width. In particular, note +that unary \f(CW\*(C`~\*(C'\fR will produce different results on platforms that have +different \f(CW$Config\fR{ivsize}. For portability, be sure to mask off +the excess bits in the result of unary \f(CW\*(C`~\*(C'\fR, e.g., \f(CW\*(C`~$x & 0xffffffff\*(C'\fR. +.Sp +See \*(L"Bit operators support full native integer width\*(R". +.IP "More builtins taint their results" 4 +.IX Item "More builtins taint their results" +As described in \*(L"Improved security features\*(R", there may be more +sources of taint in a Perl program. +.Sp +To avoid these new tainting behaviors, you can build Perl with the +Configure option \f(CW\*(C`\-Accflags=\-DINCOMPLETE_TAINTS\*(C'\fR. Beware that the +ensuing perl binary may be insecure. +.SS "C Source Incompatibilities" +.IX Subsection "C Source Incompatibilities" +.ie n .IP """PERL_POLLUTE""" 4 +.el .IP "\f(CWPERL_POLLUTE\fR" 4 +.IX Item "PERL_POLLUTE" +Release 5.005 grandfathered old global symbol names by providing preprocessor +macros for extension source compatibility. As of release 5.6.0, these +preprocessor definitions are not available by default. You need to explicitly +compile perl with \f(CW\*(C`\-DPERL_POLLUTE\*(C'\fR to get these definitions. For +extensions still using the old symbols, this option can be +specified via MakeMaker: +.Sp +.Vb 1 +\& perl Makefile.PL POLLUTE=1 +.Ve +.ie n .IP """PERL_IMPLICIT_CONTEXT""" 4 +.el .IP "\f(CWPERL_IMPLICIT_CONTEXT\fR" 4 +.IX Item "PERL_IMPLICIT_CONTEXT" +This new build option provides a set of macros for all \s-1API\s0 functions +such that an implicit interpreter/thread context argument is passed to +every \s-1API\s0 function. As a result of this, something like \f(CW\*(C`sv_setsv(foo,bar)\*(C'\fR +amounts to a macro invocation that actually translates to something like +\&\f(CW\*(C`Perl_sv_setsv(my_perl,foo,bar)\*(C'\fR. While this is generally expected +to not have any significant source compatibility issues, the difference +between a macro and a real function call will need to be considered. +.Sp +This means that there \fBis\fR a source compatibility issue as a result of +this if your extensions attempt to use pointers to any of the Perl \s-1API\s0 +functions. +.Sp +Note that the above issue is not relevant to the default build of +Perl, whose interfaces continue to match those of prior versions +(but subject to the other options described here). +.Sp +See \*(L"Background and \s-1PERL_IMPLICIT_CONTEXT\*(R"\s0 in perlguts for detailed information +on the ramifications of building Perl with this option. +.Sp +.Vb 3 +\& NOTE: PERL_IMPLICIT_CONTEXT is automatically enabled whenever Perl is built +\& with one of \-Dusethreads, \-Dusemultiplicity, or both. It is not +\& intended to be enabled by users at this time. +.Ve +.ie n .IP """PERL_POLLUTE_MALLOC""" 4 +.el .IP "\f(CWPERL_POLLUTE_MALLOC\fR" 4 +.IX Item "PERL_POLLUTE_MALLOC" +Enabling Perl's malloc in release 5.005 and earlier caused the namespace of +the system's malloc family of functions to be usurped by the Perl versions, +since by default they used the same names. Besides causing problems on +platforms that do not allow these functions to be cleanly replaced, this +also meant that the system versions could not be called in programs that +used Perl's malloc. Previous versions of Perl have allowed this behaviour +to be suppressed with the \s-1HIDEMYMALLOC\s0 and \s-1EMBEDMYMALLOC\s0 preprocessor +definitions. +.Sp +As of release 5.6.0, Perl's malloc family of functions have default names +distinct from the system versions. You need to explicitly compile perl with +\&\f(CW\*(C`\-DPERL_POLLUTE_MALLOC\*(C'\fR to get the older behaviour. \s-1HIDEMYMALLOC\s0 +and \s-1EMBEDMYMALLOC\s0 have no effect, since the behaviour they enabled is now +the default. +.Sp +Note that these functions do \fBnot\fR constitute Perl's memory allocation \s-1API.\s0 +See \*(L"Memory Allocation\*(R" in perlguts for further information about that. +.SS "Compatible C Source \s-1API\s0 Changes" +.IX Subsection "Compatible C Source API Changes" +.ie n .IP """PATCHLEVEL"" is now ""PERL_VERSION""" 4 +.el .IP "\f(CWPATCHLEVEL\fR is now \f(CWPERL_VERSION\fR" 4 +.IX Item "PATCHLEVEL is now PERL_VERSION" +The cpp macros \f(CW\*(C`PERL_REVISION\*(C'\fR, \f(CW\*(C`PERL_VERSION\*(C'\fR, and \f(CW\*(C`PERL_SUBVERSION\*(C'\fR +are now available by default from perl.h, and reflect the base revision, +patchlevel, and subversion respectively. \f(CW\*(C`PERL_REVISION\*(C'\fR had no +prior equivalent, while \f(CW\*(C`PERL_VERSION\*(C'\fR and \f(CW\*(C`PERL_SUBVERSION\*(C'\fR were +previously available as \f(CW\*(C`PATCHLEVEL\*(C'\fR and \f(CW\*(C`SUBVERSION\*(C'\fR. +.Sp +The new names cause less pollution of the \fBcpp\fR namespace and reflect what +the numbers have come to stand for in common practice. For compatibility, +the old names are still supported when \fIpatchlevel.h\fR is explicitly +included (as required before), so there is no source incompatibility +from the change. +.SS "Binary Incompatibilities" +.IX Subsection "Binary Incompatibilities" +In general, the default build of this release is expected to be binary +compatible for extensions built with the 5.005 release or its maintenance +versions. However, specific platforms may have broken binary compatibility +due to changes in the defaults used in hints files. Therefore, please be +sure to always check the platform-specific \s-1README\s0 files for any notes to +the contrary. +.PP +The usethreads or usemultiplicity builds are \fBnot\fR binary compatible +with the corresponding builds in 5.005. +.PP +On platforms that require an explicit list of exports (\s-1AIX, OS/2\s0 and Windows, +among others), purely internal symbols such as parser functions and the +run time opcodes are not exported by default. Perl 5.005 used to export +all functions irrespective of whether they were considered part of the +public \s-1API\s0 or not. +.PP +For the full list of public \s-1API\s0 functions, see perlapi. +.SH "Known Problems" +.IX Header "Known Problems" +.SS "Localizing a tied hash element may leak memory" +.IX Subsection "Localizing a tied hash element may leak memory" +As of the 5.6.1 release, there is a known leak when code such as this +is executed: +.PP +.Vb 2 +\& use Tie::Hash; +\& tie my %tie_hash => \*(AqTie::StdHash\*(Aq; +\& +\& ... +\& +\& local($tie_hash{Foo}) = 1; # leaks +.Ve +.SS "Known test failures" +.IX Subsection "Known test failures" +.IP "\(bu" 4 +64\-bit builds +.Sp +Subtest #15 of lib/b.t may fail under 64\-bit builds on platforms such +as HP-UX \s-1PA64\s0 and Linux \s-1IA64.\s0 The issue is still being investigated. +.Sp +The lib/io_multihomed test may hang in HP-UX if Perl has been +configured to be 64\-bit. Because other 64\-bit platforms do not +hang in this test, HP-UX is suspect. All other tests pass +in 64\-bit HP-UX. The test attempts to create and connect to +\&\*(L"multihomed\*(R" sockets (sockets which have multiple \s-1IP\s0 addresses). +.Sp +Note that 64\-bit support is still experimental. +.IP "\(bu" 4 +Failure of Thread tests +.Sp +The subtests 19 and 20 of lib/thr5005.t test are known to fail due to +fundamental problems in the 5.005 threading implementation. These are +not new failures\*(--Perl 5.005_0x has the same bugs, but didn't have these +tests. (Note that support for 5.005\-style threading remains experimental.) +.IP "\(bu" 4 +\&\s-1NEXTSTEP 3.3 POSIX\s0 test failure +.Sp +In \s-1NEXTSTEP 3\s0.3p2 the implementation of the \fBstrftime\fR\|(3) in the +operating system libraries is buggy: the \f(CW%j\fR format numbers the days of +a month starting from zero, which, while being logical to programmers, +will cause the subtests 19 to 27 of the lib/posix test may fail. +.IP "\(bu" 4 +Tru64 (aka Digital \s-1UNIX,\s0 aka \s-1DEC OSF/1\s0) lib/sdbm test failure with gcc +.Sp +If compiled with gcc 2.95 the lib/sdbm test will fail (dump core). +The cure is to use the vendor cc, it comes with the operating system +and produces good code. +.SS "\s-1EBCDIC\s0 platforms not fully supported" +.IX Subsection "EBCDIC platforms not fully supported" +In earlier releases of Perl, \s-1EBCDIC\s0 environments like \s-1OS390\s0 (also +known as Open Edition \s-1MVS\s0) and VM-ESA were supported. Due to changes +required by the \s-1UTF\-8\s0 (Unicode) support, the \s-1EBCDIC\s0 platforms are not +supported in Perl 5.6.0. +.PP +The 5.6.1 release improves support for \s-1EBCDIC\s0 platforms, but they +are not fully supported yet. +.SS "UNICOS/mk \s-1CC\s0 failures during Configure run" +.IX Subsection "UNICOS/mk CC failures during Configure run" +In UNICOS/mk the following errors may appear during the Configure run: +.PP +.Vb 6 +\& Guessing which symbols your C compiler and preprocessor define... +\& CC\-20 cc: ERROR File = try.c, Line = 3 +\& ... +\& bad switch yylook 79bad switch yylook 79bad switch yylook 79bad switch yylook 79#ifdef A29K +\& ... +\& 4 errors detected in the compilation of "try.c". +.Ve +.PP +The culprit is the broken awk of UNICOS/mk. The effect is fortunately +rather mild: Perl itself is not adversely affected by the error, only +the h2ph utility coming with Perl, and that is rather rarely needed +these days. +.SS "Arrow operator and arrays" +.IX Subsection "Arrow operator and arrays" +When the left argument to the arrow operator \f(CW\*(C`\->\*(C'\fR is an array, or +the \f(CW\*(C`scalar\*(C'\fR operator operating on an array, the result of the +operation must be considered erroneous. For example: +.PP +.Vb 2 +\& @x\->[2] +\& scalar(@x)\->[2] +.Ve +.PP +These expressions will get run-time errors in some future release of +Perl. +.SS "Experimental features" +.IX Subsection "Experimental features" +As discussed above, many features are still experimental. Interfaces and +implementation of these features are subject to change, and in extreme cases, +even subject to removal in some future release of Perl. These features +include the following: +.IP "Threads" 4 +.IX Item "Threads" +.PD 0 +.IP "Unicode" 4 +.IX Item "Unicode" +.IP "64\-bit support" 4 +.IX Item "64-bit support" +.IP "Lvalue subroutines" 4 +.IX Item "Lvalue subroutines" +.IP "Weak references" 4 +.IX Item "Weak references" +.IP "The pseudo-hash data type" 4 +.IX Item "The pseudo-hash data type" +.IP "The Compiler suite" 4 +.IX Item "The Compiler suite" +.IP "Internal implementation of file globbing" 4 +.IX Item "Internal implementation of file globbing" +.IP "The \s-1DB\s0 module" 4 +.IX Item "The DB module" +.IP "The regular expression code constructs:" 4 +.IX Item "The regular expression code constructs:" +.PD +\&\f(CW\*(C`(?{ code })\*(C'\fR and \f(CW\*(C`(??{ code })\*(C'\fR +.SH "Obsolete Diagnostics" +.IX Header "Obsolete Diagnostics" +.IP "Character class syntax [: :] is reserved for future extensions" 4 +.IX Item "Character class syntax [: :] is reserved for future extensions" +(W) Within regular expression character classes ([]) the syntax beginning +with \*(L"[:\*(R" and ending with \*(L":]\*(R" is reserved for future extensions. +If you need to represent those character sequences inside a regular +expression character class, just quote the square brackets with the +backslash: \*(L"\e[:\*(R" and \*(L":\e]\*(R". +.IP "Ill-formed logical name |%s| in prime_env_iter" 4 +.IX Item "Ill-formed logical name |%s| in prime_env_iter" +(W) A warning peculiar to \s-1VMS.\s0 A logical name was encountered when preparing +to iterate over \f(CW%ENV\fR which violates the syntactic rules governing logical +names. Because it cannot be translated normally, it is skipped, and will not +appear in \f(CW%ENV\fR. This may be a benign occurrence, as some software packages +might directly modify logical name tables and introduce nonstandard names, +or it may indicate that a logical name table has been corrupted. +.IP "In string, @%s now must be written as \e@%s" 4 +.IX Item "In string, @%s now must be written as @%s" +The description of this error used to say: +.Sp +.Vb 2 +\& (Someday it will simply assume that an unbackslashed @ +\& interpolates an array.) +.Ve +.Sp +That day has come, and this fatal error has been removed. It has been +replaced by a non-fatal warning instead. +See \*(L"Arrays now always interpolate into double-quoted strings\*(R" for +details. +.ie n .IP "Probable precedence problem on %s" 4 +.el .IP "Probable precedence problem on \f(CW%s\fR" 4 +.IX Item "Probable precedence problem on %s" +(W) The compiler found a bareword where it expected a conditional, +which often indicates that an || or && was parsed as part of the +last argument of the previous construct, for example: +.Sp +.Vb 1 +\& open FOO || die; +.Ve +.IP "regexp too big" 4 +.IX Item "regexp too big" +(F) The current implementation of regular expressions uses shorts as +address offsets within a string. Unfortunately this means that if +the regular expression compiles to longer than 32767, it'll blow up. +Usually when you want a regular expression this big, there is a better +way to do it with multiple statements. See perlre. +.ie n .IP "Use of ""$$"" to mean ""${$}"" is deprecated" 4 +.el .IP "Use of ``$$'' to mean ``${$}'' is deprecated" 4 +.IX Item "Use of $$ to mean ${$} is deprecated" +(D) Perl versions before 5.004 misinterpreted any type marker followed +by \*(L"$\*(R" and a digit. For example, \*(L"$$0\*(R" was incorrectly taken to mean +\&\*(L"${$}0\*(R" instead of \*(L"${$0}\*(R". This bug is (mostly) fixed in Perl 5.004. +.Sp +However, the developers of Perl 5.004 could not fix this bug completely, +because at least two widely-used modules depend on the old meaning of +\&\*(L"$$0\*(R" in a string. So Perl 5.004 still interprets \*(L"$$\*(R" in the +old (broken) way inside strings; but it generates this message as a +warning. And in Perl 5.005, this special treatment will cease. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the +articles recently posted to the comp.lang.perl.misc newsgroup. +There may also be information at http://www.perl.com/ , the Perl +Home Page. +.PP +If you believe you have an unreported bug, please run the \fBperlbug\fR +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for exhaustive details on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. +.SH "HISTORY" +.IX Header "HISTORY" +Written by Gurusamy Sarathy <\fIgsar@ActiveState.com\fR>, with many +contributions from The Perl Porters. +.PP +Send omissions or corrections to <\fIperlbug@perl.org\fR>. diff --git a/data/miniconda3/man/man1/perl582delta.1 b/data/miniconda3/man/man1/perl582delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..7d27edccc43dbc99dd726ea3d853661522a23cae --- /dev/null +++ b/data/miniconda3/man/man1/perl582delta.1 @@ -0,0 +1,275 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL582DELTA 1" +.TH PERL582DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl582delta \- what is new for perl v5.8.2 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.8.1 release and +the 5.8.2 release. +.PP +If you are upgrading from an earlier release such as 5.6.1, first read +the perl58delta, which describes differences between 5.6.0 and +5.8.0, and the perl581delta, which describes differences between +5.8.0 and 5.8.1. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +For threaded builds for modules calling certain re-entrant system calls, +binary compatibility was accidentally lost between 5.8.0 and 5.8.1. +Binary compatibility with 5.8.0 has been restored in 5.8.2, which +necessitates breaking compatibility with 5.8.1. We see this as the +lesser of two evils. +.PP +This will only affect people who have a threaded perl 5.8.1, and compiled +modules which use these calls, and now attempt to run the compiled modules +with 5.8.2. The fix is to re-compile and re-install the modules using 5.8.2. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.SS "Hash Randomisation" +.IX Subsection "Hash Randomisation" +The hash randomisation introduced with 5.8.1 has been amended. It +transpired that although the implementation introduced in 5.8.1 was source +compatible with 5.8.0, it was not binary compatible in certain cases. 5.8.2 +contains an improved implementation which is both source and binary +compatible with both 5.8.0 and 5.8.1, and remains robust against the form of +attack which prompted the change for 5.8.1. +.PP +We are grateful to the Debian project for their input in this area. +See \*(L"Algorithmic Complexity Attacks\*(R" in perlsec for the original +rationale behind this change. +.SS "Threading" +.IX Subsection "Threading" +Several memory leaks associated with variables shared between threads +have been fixed. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "Updated Modules And Pragmata" +.IX Subsection "Updated Modules And Pragmata" +The following modules and pragmata have been updated since Perl 5.8.1: +.IP "Devel::PPPort" 4 +.IX Item "Devel::PPPort" +.PD 0 +.IP "Digest::MD5" 4 +.IX Item "Digest::MD5" +.IP "I18N::LangTags" 4 +.IX Item "I18N::LangTags" +.IP "libnet" 4 +.IX Item "libnet" +.IP "MIME::Base64" 4 +.IX Item "MIME::Base64" +.IP "Pod::Perldoc" 4 +.IX Item "Pod::Perldoc" +.IP "strict" 4 +.IX Item "strict" +.PD +Documentation improved +.IP "Tie::Hash" 4 +.IX Item "Tie::Hash" +Documentation improved +.IP "Time::HiRes" 4 +.IX Item "Time::HiRes" +.PD 0 +.IP "Unicode::Collate" 4 +.IX Item "Unicode::Collate" +.IP "Unicode::Normalize" 4 +.IX Item "Unicode::Normalize" +.IP "\s-1UNIVERSAL\s0" 4 +.IX Item "UNIVERSAL" +.PD +Documentation improved +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +Some syntax errors involving unrecognized filetest operators are now handled +correctly by the parser. +.SH "Changed Internals" +.IX Header "Changed Internals" +Interpreter initialization is more complete when \-DMULTIPLICITY is off. +This should resolve problems with initializing and destroying the Perl +interpreter more than once in a single process. +.SH "Platform Specific Problems" +.IX Header "Platform Specific Problems" +Dynamic linker flags have been tweaked for Solaris and \s-1OS X,\s0 which should +solve problems seen while building some \s-1XS\s0 modules. +.PP +Bugs in \s-1OS/2\s0 sockets and tmpfile have been fixed. +.PP +In \s-1OS X\s0 \f(CW\*(C`setreuid\*(C'\fR and friends are troublesome \- perl will now work +around their problems as best possible. +.SH "Future Directions" +.IX Header "Future Directions" +Starting with 5.8.3 we intend to make more frequent maintenance releases, +with a smaller number of changes in each. The intent is to propagate +bug fixes out to stable releases more rapidly and make upgrading stable +releases less of an upheaval. This should give end users more +flexibility in their choice of upgrade timing, and allow them easier +assessment of the impact of upgrades. The current plan is for code freezes +as follows +.IP "\(bu" 4 +5.8.3 23:59:59 \s-1GMT,\s0 Wednesday December 31st 2003 +.IP "\(bu" 4 +5.8.4 23:59:59 \s-1GMT,\s0 Wednesday March 31st 2004 +.IP "\(bu" 4 +5.8.5 23:59:59 \s-1GMT,\s0 Wednesday June 30th 2004 +.PP +with the release following soon after, when testing is complete. +.PP +See \*(L"Future Directions\*(R" in perl581delta for more soothsaying. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://bugs.perl.org/. There may also be +information at http://www.perl.com/, the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the \fBperlbug\fR +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. You can browse and search +the Perl 5 bugs at http://bugs.perl.org/ +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for exhaustive details on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl584delta.1 b/data/miniconda3/man/man1/perl584delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..984ef5132574f786f01dfe430e482f8c06665843 --- /dev/null +++ b/data/miniconda3/man/man1/perl584delta.1 @@ -0,0 +1,377 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL584DELTA 1" +.TH PERL584DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl584delta \- what is new for perl v5.8.4 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.8.3 release and +the 5.8.4 release. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +Many minor bugs have been fixed. Scripts which happen to rely on previously +erroneous behaviour will consider these fixes as incompatible changes :\-) +You are advised to perform sufficient acceptance testing on this release +to satisfy yourself that this does not affect you, before putting this +release into production. +.PP +The diagnostic output of Carp has been changed slightly, to add a space after +the comma between arguments. This makes it much easier for tools such as +web browsers to wrap it, but might confuse any automatic tools which perform +detailed parsing of Carp output. +.PP +The internal dump output has been improved, so that non-printable characters +such as newline and backspace are output in \f(CW\*(C`\ex\*(C'\fR notation, rather than +octal. This might just confuse non-robust tools which parse the output of +modules such as Devel::Peek. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.SS "Malloc wrapping" +.IX Subsection "Malloc wrapping" +Perl can now be built to detect attempts to assign pathologically large chunks +of memory. Previously such assignments would suffer from integer wrap-around +during size calculations causing a misallocation, which would crash perl, and +could theoretically be used for \*(L"stack smashing\*(R" attacks. The wrapping +defaults to enabled on platforms where we know it works (most \s-1AIX\s0 +configurations, BSDi, Darwin, \s-1DEC OSF/1,\s0 FreeBSD, \s-1HP/UX, GNU\s0 Linux, OpenBSD, +Solaris, \s-1VMS\s0 and most Win32 compilers) and defaults to disabled on other +platforms. +.SS "Unicode Character Database 4.0.1" +.IX Subsection "Unicode Character Database 4.0.1" +The copy of the Unicode Character Database included in Perl 5.8 has +been updated to 4.0.1 from 4.0.0. +.SS "suidperl less insecure" +.IX Subsection "suidperl less insecure" +Paul Szabo has analysed and patched \f(CW\*(C`suidperl\*(C'\fR to remove existing known +insecurities. Currently there are no known holes in \f(CW\*(C`suidperl\*(C'\fR, but previous +experience shows that we cannot be confident that these were the last. You may +no longer invoke the set uid perl directly, so to preserve backwards +compatibility with scripts that invoke #!/usr/bin/suidperl the only set uid +binary is now \f(CW\*(C`sperl5.8.\*(C'\fR\fIn\fR (\f(CW\*(C`sperl5.8.4\*(C'\fR for this release). \f(CW\*(C`suidperl\*(C'\fR +is installed as a hard link to \f(CW\*(C`perl\*(C'\fR; both \f(CW\*(C`suidperl\*(C'\fR and \f(CW\*(C`perl\*(C'\fR will +invoke \f(CW\*(C`sperl5.8.4\*(C'\fR automatically the set uid binary, so this change should +be completely transparent. +.PP +For new projects the core perl team would strongly recommend that you use +dedicated, single purpose security tools such as \f(CW\*(C`sudo\*(C'\fR in preference to +\&\f(CW\*(C`suidperl\*(C'\fR. +.SS "format" +.IX Subsection "format" +In addition to bug fixes, \f(CW\*(C`format\*(C'\fR's features have been enhanced. See +perlform +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +The (mis)use of \f(CW\*(C`/tmp\*(C'\fR in core modules and documentation has been tidied up. +Some modules available both within the perl core and independently from \s-1CPAN\s0 +(\*(L"dual-life modules\*(R") have not yet had these changes applied; the changes +will be integrated into future stable perl releases as the modules are +updated on \s-1CPAN.\s0 +.SS "Updated modules" +.IX Subsection "Updated modules" +.IP "Attribute::Handlers" 4 +.IX Item "Attribute::Handlers" +.PD 0 +.IP "B" 4 +.IX Item "B" +.IP "Benchmark" 4 +.IX Item "Benchmark" +.IP "\s-1CGI\s0" 4 +.IX Item "CGI" +.IP "Carp" 4 +.IX Item "Carp" +.IP "Cwd" 4 +.IX Item "Cwd" +.IP "Exporter" 4 +.IX Item "Exporter" +.IP "File::Find" 4 +.IX Item "File::Find" +.IP "\s-1IO\s0" 4 +.IX Item "IO" +.IP "IPC::Open3" 4 +.IX Item "IPC::Open3" +.IP "Local::Maketext" 4 +.IX Item "Local::Maketext" +.IP "Math::BigFloat" 4 +.IX Item "Math::BigFloat" +.IP "Math::BigInt" 4 +.IX Item "Math::BigInt" +.IP "Math::BigRat" 4 +.IX Item "Math::BigRat" +.IP "MIME::Base64" 4 +.IX Item "MIME::Base64" +.IP "ODBM_File" 4 +.IX Item "ODBM_File" +.IP "\s-1POSIX\s0" 4 +.IX Item "POSIX" +.IP "Shell" 4 +.IX Item "Shell" +.IP "Socket" 4 +.IX Item "Socket" +.PD +There is experimental support for Linux abstract Unix domain sockets. +.IP "Storable" 4 +.IX Item "Storable" +.PD 0 +.IP "Switch" 4 +.IX Item "Switch" +.PD +Synced with its \s-1CPAN\s0 version 2.10 +.IP "Sys::Syslog" 4 +.IX Item "Sys::Syslog" +\&\f(CW\*(C`syslog()\*(C'\fR can now use numeric constants for facility names and priorities, +in addition to strings. +.IP "Term::ANSIColor" 4 +.IX Item "Term::ANSIColor" +.PD 0 +.IP "Time::HiRes" 4 +.IX Item "Time::HiRes" +.IP "Unicode::UCD" 4 +.IX Item "Unicode::UCD" +.IP "Win32" 4 +.IX Item "Win32" +.PD +Win32.pm/Win32.xs has moved from the libwin32 module to core Perl +.IP "base" 4 +.IX Item "base" +.PD 0 +.IP "open" 4 +.IX Item "open" +.IP "threads" 4 +.IX Item "threads" +.PD +Detached threads are now also supported on Windows. +.IP "utf8" 4 +.IX Item "utf8" +.SH "Performance Enhancements" +.IX Header "Performance Enhancements" +.PD 0 +.IP "\(bu" 4 +.PD +Accelerated Unicode case mappings (\f(CW\*(C`/i\*(C'\fR, \f(CW\*(C`lc\*(C'\fR, \f(CW\*(C`uc\*(C'\fR, etc). +.IP "\(bu" 4 +In place sort optimised (eg \f(CW\*(C`@a = sort @a\*(C'\fR) +.IP "\(bu" 4 +Unnecessary assignment optimised away in +.Sp +.Vb 3 +\& my $s = undef; +\& my @a = (); +\& my %h = (); +.Ve +.IP "\(bu" 4 +Optimised \f(CW\*(C`map\*(C'\fR in scalar context +.SH "Utility Changes" +.IX Header "Utility Changes" +The Perl debugger (\fIlib/perl5db.pl\fR) can now save all debugger commands for +sourcing later, and can display the parent inheritance tree of a given class. +.SH "Installation and Configuration Improvements" +.IX Header "Installation and Configuration Improvements" +The build process on both \s-1VMS\s0 and Windows has had several minor improvements +made. On Windows Borland's C compiler can now compile perl with PerlIO and/or +\&\s-1USE_LARGE_FILES\s0 enabled. +.PP +\&\f(CW\*(C`perl.exe\*(C'\fR on Windows now has a \*(L"Camel\*(R" logo icon. The use of a camel with +the topic of Perl is a trademark of O'Reilly and Associates Inc., and is used +with their permission (ie distribution of the source, compiling a Windows +executable from it, and using that executable locally). Use of the supplied +camel for anything other than a perl executable's icon is specifically not +covered, and anyone wishing to redistribute perl binaries \fIwith\fR the icon +should check directly with O'Reilly beforehand. +.PP +Perl should build cleanly on Stratus \s-1VOS\s0 once more. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +More utf8 bugs fixed, notably in how \f(CW\*(C`chomp\*(C'\fR, \f(CW\*(C`chop\*(C'\fR, \f(CW\*(C`send\*(C'\fR, and +\&\f(CW\*(C`syswrite\*(C'\fR and interact with utf8 data. Concatenation now works correctly +when \f(CW\*(C`use bytes;\*(C'\fR is in scope. +.PP +Pragmata are now correctly propagated into (?{...}) constructions in regexps. +Code such as +.PP +.Vb 1 +\& my $x = qr{ ... (??{ $x }) ... }; +.Ve +.PP +will now (correctly) fail under use strict. (As the inner \f(CW$x\fR is and +has always referred to \f(CW$::x\fR) +.PP +The \*(L"const in void context\*(R" warning has been suppressed for a constant in an +optimised-away boolean expression such as \f(CW\*(C`5 || print;\*(C'\fR +.PP +\&\f(CW\*(C`perl \-i\*(C'\fR could \f(CW\*(C`fchmod(stdin)\*(C'\fR by mistake. This is serious if stdin is +attached to a terminal, and perl is running as root. Now fixed. +.SH "New or Changed Diagnostics" +.IX Header "New or Changed Diagnostics" +\&\f(CW\*(C`Carp\*(C'\fR and the internal diagnostic routines used by \f(CW\*(C`Devel::Peek\*(C'\fR have been +made clearer, as described in \*(L"Incompatible Changes\*(R" +.SH "Changed Internals" +.IX Header "Changed Internals" +Some bugs have been fixed in the hash internals. Restricted hashes and +their place holders are now allocated and deleted at slightly different times, +but this should not be visible to user code. +.SH "Future Directions" +.IX Header "Future Directions" +Code freeze for the next maintenance release (5.8.5) will be on 30th June +2004, with release by mid July. +.SH "Platform Specific Problems" +.IX Header "Platform Specific Problems" +This release is known not to build on Windows 95. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://bugs.perl.org. There may also be +information at http://www.perl.org, the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the \fBperlbug\fR +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. You can browse and search +the Perl 5 bugs at http://bugs.perl.org/ +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for exhaustive details on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl586delta.1 b/data/miniconda3/man/man1/perl586delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..e91bfeb5ad3a5207a11872c1e13c5aabeaefd6d5 --- /dev/null +++ b/data/miniconda3/man/man1/perl586delta.1 @@ -0,0 +1,268 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL586DELTA 1" +.TH PERL586DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl586delta \- what is new for perl v5.8.6 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.8.5 release and +the 5.8.6 release. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +There are no changes incompatible with 5.8.5. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +The perl interpreter is now more tolerant of UTF\-16\-encoded scripts. +.PP +On Win32, Perl can now use non-IFS compatible LSPs, which allows Perl to +work in conjunction with firewalls such as McAfee Guardian. For full details +see the file \fI\s-1README\s0.win32\fR, particularly if you're running Win95. +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.IP "\(bu" 4 +With the \f(CW\*(C`base\*(C'\fR pragma, an intermediate class with no fields used to messes +up private fields in the base class. This has been fixed. +.IP "\(bu" 4 +Cwd upgraded to version 3.01 (as part of the new PathTools distribution) +.IP "\(bu" 4 +Devel::PPPort upgraded to version 3.03 +.IP "\(bu" 4 +File::Spec upgraded to version 3.01 (as part of the new PathTools distribution) +.IP "\(bu" 4 +Encode upgraded to version 2.08 +.IP "\(bu" 4 +ExtUtils::MakeMaker remains at version 6.17, as later stable releases currently +available on \s-1CPAN\s0 have some issues with core modules on some core platforms. +.IP "\(bu" 4 +I18N::LangTags upgraded to version 0.35 +.IP "\(bu" 4 +Math::BigInt upgraded to version 1.73 +.IP "\(bu" 4 +Math::BigRat upgraded to version 0.13 +.IP "\(bu" 4 +MIME::Base64 upgraded to version 3.05 +.IP "\(bu" 4 +POSIX::sigprocmask function can now retrieve the current signal mask without +also setting it. +.IP "\(bu" 4 +Time::HiRes upgraded to version 1.65 +.SH "Utility Changes" +.IX Header "Utility Changes" +Perl has a new \-dt command-line flag, which enables threads support in the +debugger. +.SH "Performance Enhancements" +.IX Header "Performance Enhancements" +\&\f(CW\*(C`reverse sort ...\*(C'\fR is now optimized to sort in reverse, avoiding the +generation of a temporary intermediate list. +.PP +\&\f(CW\*(C`for (reverse @foo)\*(C'\fR now iterates in reverse, avoiding the generation of a +temporary reversed list. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +The regexp engine is now more robust when given invalid utf8 input, as is +sometimes generated by buggy \s-1XS\s0 modules. +.PP +\&\f(CW\*(C`foreach\*(C'\fR on threads::shared array used to be able to crash Perl. This bug +has now been fixed. +.PP +A regexp in \f(CW\*(C`STDOUT\*(C'\fR's destructor used to coredump, because the regexp pad +was already freed. This has been fixed. +.PP +\&\f(CW\*(C`goto &\*(C'\fR is now more robust \- bugs in deep recursion and chained \f(CW\*(C`goto &\*(C'\fR +have been fixed. +.PP +Using \f(CW\*(C`delete\*(C'\fR on an array no longer leaks memory. A \f(CW\*(C`pop\*(C'\fR of an item from a +shared array reference no longer causes a leak. +.PP +\&\f(CW\*(C`eval_sv()\*(C'\fR failing a taint test could corrupt the stack \- this has been +fixed. +.PP +On platforms with 64 bit pointers numeric comparison operators used to +erroneously compare the addresses of references that are overloaded, rather +than using the overloaded values. This has been fixed. +.PP +\&\f(CW\*(C`read\*(C'\fR into a UTF8\-encoded buffer with an offset off the end of the buffer +no longer mis-calculates buffer lengths. +.PP +Although Perl has promised since version 5.8 that \f(CW\*(C`sort()\*(C'\fR would be +stable, the two cases \f(CW\*(C`sort {$b cmp $a}\*(C'\fR and \f(CW\*(C`sort {$b <=> $a}\*(C'\fR could +produce non-stable sorts. This is corrected in perl5.8.6. +.PP +Localising \f(CW$^D\fR no longer generates a diagnostic message about valid \-D +flags. +.SH "New or Changed Diagnostics" +.IX Header "New or Changed Diagnostics" +For \-t and \-T, + Too late for \*(L"\-T\*(R" option +has been changed to the more informative + \*(L"\-T\*(R" is on the #! line, it must also be used on the command line +.SH "Changed Internals" +.IX Header "Changed Internals" +From now on all applications embedding perl will behave as if perl +were compiled with \-DPERL_USE_SAFE_PUTENV. See \*(L"Environment access\*(R" in +the \fI\s-1INSTALL\s0\fR file for details. +.PP +Most \f(CW\*(C`C\*(C'\fR source files now have comments at the top explaining their purpose, +which should help anyone wishing to get an overview of the implementation. +.SH "New Tests" +.IX Header "New Tests" +There are significantly more tests for the \f(CW\*(C`B\*(C'\fR suite of modules. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://bugs.perl.org. There may also be +information at http://www.perl.org, the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the \fBperlbug\fR +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. You can browse and search +the Perl 5 bugs at http://bugs.perl.org/ +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for exhaustive details on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perl589delta.1 b/data/miniconda3/man/man1/perl589delta.1 new file mode 100644 index 0000000000000000000000000000000000000000..371841b16ac3962cb74ae37e00b5f04db59a3e73 --- /dev/null +++ b/data/miniconda3/man/man1/perl589delta.1 @@ -0,0 +1,1734 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERL589DELTA 1" +.TH PERL589DELTA 1 "2020-12-18" "perl v5.32.1" "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" +perl589delta \- what is new for perl v5.8.9 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes differences between the 5.8.8 release and +the 5.8.9 release. +.SH "Notice" +.IX Header "Notice" +The 5.8.9 release will be the last significant release of the 5.8.x +series. Any future releases of 5.8.x will likely only be to deal with +security issues, and platform build failures. Hence you should look to +migrating to 5.10.x, if you have not started already. +See \*(L"Known Problems\*(R" for more information. +.SH "Incompatible Changes" +.IX Header "Incompatible Changes" +A particular construction in the source code of extensions written in \*(C+ +may need changing. See \*(L"Changed Internals\*(R" for more details. All +extensions written in C, most written in \*(C+, and all existing compiled +extensions are unaffected. This was necessary to improve \*(C+ support. +.PP +Other than this, there are no changes intentionally incompatible with 5.8.8. +If any exist, they are bugs and reports are welcome. +.SH "Core Enhancements" +.IX Header "Core Enhancements" +.SS "Unicode Character Database 5.1.0." +.IX Subsection "Unicode Character Database 5.1.0." +The copy of the Unicode Character Database included in Perl 5.8 has +been updated to 5.1.0 from 4.1.0. See + for the +notable changes. +.SS "stat and \-X on directory handles" +.IX Subsection "stat and -X on directory handles" +It is now possible to call \f(CW\*(C`stat\*(C'\fR and the \f(CW\*(C`\-X\*(C'\fR filestat operators on +directory handles. As both directory and file handles are barewords, there +can be ambiguities over which was intended. In these situations the file +handle semantics are preferred. Both also treat \f(CW*FILE{IO}\fR filehandles +like \f(CW*FILE\fR filehandles. +.ie n .SS "Source filters in @INC" +.el .SS "Source filters in \f(CW@INC\fP" +.IX Subsection "Source filters in @INC" +It's possible to enhance the mechanism of subroutine hooks in \f(CW@INC\fR by +adding a source filter on top of the filehandle opened and returned by the +hook. This feature was planned a long time ago, but wasn't quite working +until now. See \*(L"require\*(R" in perlfunc for details. (Nicholas Clark) +.SS "Exceptions in constant folding" +.IX Subsection "Exceptions in constant folding" +The constant folding routine is now wrapped in an exception handler, and +if folding throws an exception (such as attempting to evaluate 0/0), perl +now retains the current optree, rather than aborting the whole program. +Without this change, programs would not compile if they had expressions that +happened to generate exceptions, even though those expressions were in code +that could never be reached at runtime. (Nicholas Clark, Dave Mitchell) +.ie n .SS """no VERSION""" +.el .SS "\f(CWno VERSION\fP" +.IX Subsection "no VERSION" +You can now use \f(CW\*(C`no\*(C'\fR followed by a version number to specify that you +want to use a version of perl older than the specified one. +.SS "Improved internal \s-1UTF\-8\s0 caching code" +.IX Subsection "Improved internal UTF-8 caching code" +The code that caches calculated \s-1UTF\-8\s0 byte offsets for character offsets for +a string has been re-written. Several bugs have been located and eliminated, +and the code now makes better use of the information it has, so should be +faster. In particular, it doesn't scan to the end of a string before +calculating an offset within the string, which should speed up some operations +on long strings. It is now possible to disable the caching code at run time, +to verify that it is not the cause of suspected problems. +.SS "Runtime relocatable installations" +.IX Subsection "Runtime relocatable installations" +There is now \fIConfigure\fR support for creating a perl tree that is relocatable +at run time. see \*(L"Relocatable installations\*(R". +.SS "New internal variables" +.IX Subsection "New internal variables" +.ie n .IP """${^CHILD_ERROR_NATIVE}""" 4 +.el .IP "\f(CW${^CHILD_ERROR_NATIVE}\fR" 4 +.IX Item "${^CHILD_ERROR_NATIVE}" +This variable gives the native status returned by the last pipe close, +backtick command, successful call to \f(CW\*(C`wait\*(C'\fR or \f(CW\*(C`waitpid\*(C'\fR, or from the +\&\f(CW\*(C`system\*(C'\fR operator. See perlvar for details. (Contributed by Gisle Aas.) +.ie n .IP """${^UTF8CACHE}""" 4 +.el .IP "\f(CW${^UTF8CACHE}\fR" 4 +.IX Item "${^UTF8CACHE}" +This variable controls the state of the internal \s-1UTF\-8\s0 offset caching code. +1 for on (the default), 0 for off, \-1 to debug the caching code by checking +all its results against linear scans, and panicking on any discrepancy. +.ie n .SS """readpipe"" is now overridable" +.el .SS "\f(CWreadpipe\fP is now overridable" +.IX Subsection "readpipe is now overridable" +The built-in function \f(CW\*(C`readpipe\*(C'\fR is now overridable. Overriding it permits +also to override its operator counterpart, \f(CW\*(C`qx//\*(C'\fR (also known as \f(CW\*(C`\`\`\*(C'\fR). +.SS "simple exception handling macros" +.IX Subsection "simple exception handling macros" +Perl 5.8.9 (and 5.10.0 onwards) now provides a couple of macros to do very +basic exception handling in \s-1XS\s0 modules. You can use these macros if you call +code that may \f(CW\*(C`croak\*(C'\fR, but you need to do some cleanup before giving control +back to Perl. See \*(L"Exception Handling\*(R" in perlguts for more details. +.SS "\-D option enhancements" +.IX Subsection "-D option enhancements" +.IP "\(bu" 4 +\&\f(CW\*(C`\-Dq\*(C'\fR suppresses the \fI\s-1EXECUTING...\s0\fR message when running under \f(CW\*(C`\-D\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`\-Dl\*(C'\fR logs runops loop entry and exit, and jump level popping. +.IP "\(bu" 4 +\&\f(CW\*(C`\-Dv\*(C'\fR displays the process id as part of the trace output. +.SS "XS-assisted \s-1SWASHGET\s0" +.IX Subsection "XS-assisted SWASHGET" +Some pure-perl code that the regexp engine was using to retrieve Unicode +properties and transliteration mappings has been reimplemented in \s-1XS\s0 +for faster execution. +(\s-1SADAHIRO\s0 Tomoyuki) +.SS "Constant subroutines" +.IX Subsection "Constant subroutines" +The interpreter internals now support a far more memory efficient form of +inlineable constants. Storing a reference to a constant value in a symbol +table is equivalent to a full typeglob referencing a constant subroutine, +but using about 400 bytes less memory. This proxy constant subroutine is +automatically upgraded to a real typeglob with subroutine if necessary. +The approach taken is analogous to the existing space optimisation for +subroutine stub declarations, which are stored as plain scalars in place +of the full typeglob. +.PP +However, to aid backwards compatibility of existing code, which (wrongly) +does not expect anything other than typeglobs in symbol tables, nothing in +core uses this feature, other than the regression tests. +.PP +Stubs for prototyped subroutines have been stored in symbol tables as plain +strings, and stubs for unprototyped subroutines as the number \-1, since 5.005, +so code which assumes that the core only places typeglobs in symbol tables +has been making incorrect assumptions for over 10 years. +.SH "New Platforms" +.IX Header "New Platforms" +Compile support added for: +.IP "\(bu" 4 +DragonFlyBSD +.IP "\(bu" 4 +MidnightBSD +.IP "\(bu" 4 +MirOS \s-1BSD\s0 +.IP "\(bu" 4 +\&\s-1RISC OS\s0 +.IP "\(bu" 4 +Cray XT4/Catamount +.SH "Modules and Pragmata" +.IX Header "Modules and Pragmata" +.SS "New Modules" +.IX Subsection "New Modules" +.IP "\(bu" 4 +\&\f(CW\*(C`Module::Pluggable\*(C'\fR is a simple framework to create modules that accept +pluggable sub-modules. The bundled version is 3.8 +.IP "\(bu" 4 +\&\f(CW\*(C`Module::CoreList\*(C'\fR is a hash of hashes that is keyed on perl version as +indicated in \f(CW$]\fR. The bundled version is 2.17 +.IP "\(bu" 4 +\&\f(CW\*(C`Win32API::File\*(C'\fR now available in core on Microsoft Windows. The bundled +version is 0.1001_01 +.IP "\(bu" 4 +\&\f(CW\*(C`Devel::InnerPackage\*(C'\fR finds all the packages defined by a single file. It is +part of the \f(CW\*(C`Module::Pluggable\*(C'\fR distribution. The bundled version is 0.3 +.SS "Updated Modules" +.IX Subsection "Updated Modules" +.IP "\(bu" 4 +\&\f(CW\*(C`attributes\*(C'\fR upgraded to version 0.09 +.IP "\(bu" 4 +\&\f(CW\*(C`AutoLoader\*(C'\fR upgraded to version 5.67 +.IP "\(bu" 4 +\&\f(CW\*(C`AutoSplit\*(C'\fR upgraded to 1.06 +.IP "\(bu" 4 +\&\f(CW\*(C`autouse\*(C'\fR upgraded to version 1.06 +.IP "\(bu" 4 +\&\f(CW\*(C`B\*(C'\fR upgraded from 1.09_01 to 1.19 +.RS 4 +.IP "\(bu" 4 +provides new pad related abstraction macros \f(CW\*(C`B::NV::COP_SEQ_RANGE_LOW\*(C'\fR, +\&\f(CW\*(C`B::NV::COP_SEQ_RANGE_HIGH\*(C'\fR, \f(CW\*(C`B::NV::PARENT_PAD_INDEX\*(C'\fR, +\&\f(CW\*(C`B::NV::PARENT_FAKELEX_FLAGS\*(C'\fR, which hides the difference in storage in +5.10.0 and later. +.IP "\(bu" 4 +provides \f(CW\*(C`B::sub_generation\*(C'\fR, which exposes \f(CW\*(C`PL_sub_generation\*(C'\fR +.IP "\(bu" 4 +provides \f(CW\*(C`B::GV::isGV_with_GP\*(C'\fR, which on pre\-5.10 perls always returns true. +.IP "\(bu" 4 +New type \f(CW\*(C`B::HE\*(C'\fR added with methods \f(CW\*(C`VAL\*(C'\fR, \f(CW\*(C`HASH\*(C'\fR and \f(CW\*(C`SVKEY_force\*(C'\fR +.IP "\(bu" 4 +The \f(CW\*(C`B::GVf_IMPORTED_CV\*(C'\fR flag is now set correctly when a proxy +constant subroutine is imported. +.IP "\(bu" 4 +bugs fixed in the handling of \f(CW\*(C`PMOP\*(C'\fRs. +.IP "\(bu" 4 +\&\f(CW\*(C`B::BM::PREVIOUS\*(C'\fR returns now \f(CW\*(C`U32\*(C'\fR, not \f(CW\*(C`U16\*(C'\fR. +\&\f(CW\*(C`B::CV::START\*(C'\fR and \f(CW\*(C`B:CV::ROOT\*(C'\fR return now \f(CW\*(C`NULL\*(C'\fR on an \s-1XSUB,\s0 +\&\f(CW\*(C`B::CV::XSUB\*(C'\fR and \f(CW\*(C`B::CV::XSUBANY\*(C'\fR return 0 on a non-XSUB. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`B::C\*(C'\fR upgraded to 1.05 +.IP "\(bu" 4 +\&\f(CW\*(C`B::Concise\*(C'\fR upgraded to 0.76 +.RS 4 +.IP "\(bu" 4 +new option \f(CW\*(C`\-src\*(C'\fR causes the rendering of each statement (starting with +the nextstate \s-1OP\s0) to be preceded by the first line of source code that +generates it. +.IP "\(bu" 4 +new option \f(CW\*(C`\-stash="somepackage"\*(C'\fR, \f(CW\*(C`require\*(C'\fRs \*(L"somepackage\*(R", and then renders +each function defined in its namespace. +.IP "\(bu" 4 +now has documentation of detailed hint symbols. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`B::Debug\*(C'\fR upgraded to version 1.05 +.IP "\(bu" 4 +\&\f(CW\*(C`B::Deparse\*(C'\fR upgraded to version 0.87 +.RS 4 +.IP "\(bu" 4 +properly deparse \f(CW\*(C`print readpipe $x, $y\*(C'\fR. +.IP "\(bu" 4 +now handles \f(CW\*(C`\*(Aq\*(Aq\->()\*(C'\fR, \f(CW\*(C`::()\*(C'\fR, \f(CW\*(C`sub :: {}\*(C'\fR, \fIetc.\fR correctly [\s-1RT\s0 #43010]. +All bugs in parsing these kinds of syntax are now fixed: +.Sp +.Vb 5 +\& perl \-MO=Deparse \-e \*(Aq"my %h = "\->()\*(Aq +\& perl \-MO=Deparse \-e \*(Aq::\->()\*(Aq +\& perl \-MO=Deparse \-e \*(Aqsub :: {}\*(Aq +\& perl \-MO=Deparse \-e \*(Aqpackage a; sub a::b::c {}\*(Aq +\& perl \-MO=Deparse \-e \*(Aqsub the::main::road {}\*(Aq +.Ve +.IP "\(bu" 4 +does \fBnot\fR deparse \f(CW$^H{v_string}\fR, which is automatically set by the +internals. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`B::Lint\*(C'\fR upgraded to version 1.11 +.IP "\(bu" 4 +\&\f(CW\*(C`B::Terse\*(C'\fR upgraded to version 1.05 +.IP "\(bu" 4 +\&\f(CW\*(C`base\*(C'\fR upgraded to version 2.13 +.RS 4 +.IP "\(bu" 4 +loading a module via base.pm would mask a global \f(CW$SIG{_\|_DIE_\|_}\fR in that +module. +.IP "\(bu" 4 +push all classes at once in \f(CW@ISA\fR +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`Benchmark\*(C'\fR upgraded to version 1.10 +.IP "\(bu" 4 +\&\f(CW\*(C`bigint\*(C'\fR upgraded to 0.23 +.IP "\(bu" 4 +\&\f(CW\*(C`bignum\*(C'\fR upgraded to 0.23 +.IP "\(bu" 4 +\&\f(CW\*(C`bigrat\*(C'\fR upgraded to 0.23 +.IP "\(bu" 4 +\&\f(CW\*(C`blib\*(C'\fR upgraded to 0.04 +.IP "\(bu" 4 +\&\f(CW\*(C`Carp\*(C'\fR upgraded to version 1.10 +.Sp +The argument backtrace code now shows \f(CW\*(C`undef\*(C'\fR as \f(CW\*(C`undef\*(C'\fR, +instead of a string \fI\*(L"undef\*(R"\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`CGI\*(C'\fR upgraded to version 3.42 +.IP "\(bu" 4 +\&\f(CW\*(C`charnames\*(C'\fR upgraded to 1.06 +.IP "\(bu" 4 +\&\f(CW\*(C`constant\*(C'\fR upgraded to version 1.17 +.IP "\(bu" 4 +\&\f(CW\*(C`CPAN\*(C'\fR upgraded to version 1.9301 +.IP "\(bu" 4 +\&\f(CW\*(C`Cwd\*(C'\fR upgraded to version 3.29 with some platform specific +improvements (including for \s-1VMS\s0). +.IP "\(bu" 4 +\&\f(CW\*(C`Data::Dumper\*(C'\fR upgraded to version 2.121_17 +.RS 4 +.IP "\(bu" 4 +Fixes hash iterator current position with the pure Perl version [\s-1RT\s0 #40668] +.IP "\(bu" 4 +Performance enhancements, which will be most evident on platforms where +repeated calls to C's \f(CW\*(C`realloc()\*(C'\fR are slow, such as Win32. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`DB_File\*(C'\fR upgraded to version 1.817 +.IP "\(bu" 4 +\&\f(CW\*(C`DB_Filter\*(C'\fR upgraded to version 0.02 +.IP "\(bu" 4 +\&\f(CW\*(C`Devel::DProf\*(C'\fR upgraded to version 20080331.00 +.IP "\(bu" 4 +\&\f(CW\*(C`Devel::Peek\*(C'\fR upgraded to version 1.04 +.IP "\(bu" 4 +\&\f(CW\*(C`Devel::PPPort\*(C'\fR upgraded to version 3.14 +.IP "\(bu" 4 +\&\f(CW\*(C`diagnostics\*(C'\fR upgraded to version 1.16 +.IP "\(bu" 4 +\&\f(CW\*(C`Digest\*(C'\fR upgraded to version 1.15 +.IP "\(bu" 4 +\&\f(CW\*(C`Digest::MD5\*(C'\fR upgraded to version 2.37 +.IP "\(bu" 4 +\&\f(CW\*(C`DirHandle\*(C'\fR upgraded to version 1.02 +.RS 4 +.IP "\(bu" 4 +now localises \f(CW$.\fR, \f(CW$@\fR, \f(CW$!\fR, \f(CW$^E\fR, and \f(CW$?\fR before closing the +directory handle to suppress leaking any side effects of warnings about it +already being closed. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`DynaLoader\*(C'\fR upgraded to version 1.09 +.Sp +\&\f(CW\*(C`DynaLoader\*(C'\fR can now dynamically load a loadable object from a file with a +non-default file extension. +.IP "\(bu" 4 +\&\f(CW\*(C`Encode\*(C'\fR upgraded to version 2.26 +.Sp +\&\f(CW\*(C`Encode::Alias\*(C'\fR includes a fix for encoding \*(L"646\*(R" on Solaris (better known as +\&\s-1ASCII\s0). +.IP "\(bu" 4 +\&\f(CW\*(C`English\*(C'\fR upgraded to version 1.03 +.IP "\(bu" 4 +\&\f(CW\*(C`Errno\*(C'\fR upgraded to version 1.10 +.IP "\(bu" 4 +\&\f(CW\*(C`Exporter\*(C'\fR upgraded to version 5.63 +.IP "\(bu" 4 +\&\f(CW\*(C`ExtUtils::Command\*(C'\fR upgraded to version 1.15 +.IP "\(bu" 4 +\&\f(CW\*(C`ExtUtils::Constant\*(C'\fR upgraded to version 0.21 +.IP "\(bu" 4 +\&\f(CW\*(C`ExtUtils::Embed\*(C'\fR upgraded to version 1.28 +.IP "\(bu" 4 +\&\f(CW\*(C`ExtUtils::Install\*(C'\fR upgraded to version 1.50_01 +.IP "\(bu" 4 +\&\f(CW\*(C`ExtUtils::Installed\*(C'\fR upgraded to version 1.43 +.IP "\(bu" 4 +\&\f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR upgraded to version 6.48 +.RS 4 +.IP "\(bu" 4 +support for \f(CW\*(C`INSTALLSITESCRIPT\*(C'\fR and \f(CW\*(C`INSTALLVENDORSCRIPT\*(C'\fR +configuration. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`ExtUtils::Manifest\*(C'\fR upgraded to version 1.55 +.IP "\(bu" 4 +\&\f(CW\*(C`ExtUtils::ParseXS\*(C'\fR upgraded to version 2.19 +.IP "\(bu" 4 +\&\f(CW\*(C`Fatal\*(C'\fR upgraded to version 1.06 +.RS 4 +.IP "\(bu" 4 +allows built-ins in \f(CW\*(C`CORE::GLOBAL\*(C'\fR to be made fatal. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`Fcntl\*(C'\fR upgraded to version 1.06 +.IP "\(bu" 4 +\&\f(CW\*(C`fields\*(C'\fR upgraded to version 2.12 +.IP "\(bu" 4 +\&\f(CW\*(C`File::Basename\*(C'\fR upgraded to version 2.77 +.IP "\(bu" 4 +\&\f(CW\*(C`FileCache\*(C'\fR upgraded to version 1.07 +.IP "\(bu" 4 +\&\f(CW\*(C`File::Compare\*(C'\fR upgraded to 1.1005 +.IP "\(bu" 4 +\&\f(CW\*(C`File::Copy\*(C'\fR upgraded to 2.13 +.RS 4 +.IP "\(bu" 4 +now uses 3\-arg open. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`File::DosGlob\*(C'\fR upgraded to 1.01 +.IP "\(bu" 4 +\&\f(CW\*(C`File::Find\*(C'\fR upgraded to version 1.13 +.IP "\(bu" 4 +\&\f(CW\*(C`File::Glob\*(C'\fR upgraded to version 1.06 +.RS 4 +.IP "\(bu" 4 +fixes spurious results with brackets inside braces. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`File::Path\*(C'\fR upgraded to version 2.07_02 +.IP "\(bu" 4 +\&\f(CW\*(C`File::Spec\*(C'\fR upgraded to version 3.29 +.RS 4 +.IP "\(bu" 4 +improved handling of bad arguments. +.IP "\(bu" 4 +some platform specific improvements (including for \s-1VMS\s0 and Cygwin), with +an optimisation on \f(CW\*(C`abs2rel\*(C'\fR when handling both relative arguments. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`File::stat\*(C'\fR upgraded to version 1.01 +.IP "\(bu" 4 +\&\f(CW\*(C`File::Temp\*(C'\fR upgraded to version 0.20 +.IP "\(bu" 4 +\&\f(CW\*(C`filetest\*(C'\fR upgraded to version 1.02 +.IP "\(bu" 4 +\&\f(CW\*(C`Filter::Util::Call\*(C'\fR upgraded to version 1.07 +.IP "\(bu" 4 +\&\f(CW\*(C`Filter::Simple\*(C'\fR upgraded to version 0.83 +.IP "\(bu" 4 +\&\f(CW\*(C`FindBin\*(C'\fR upgraded to version 1.49 +.IP "\(bu" 4 +\&\f(CW\*(C`GDBM_File\*(C'\fR upgraded to version 1.09 +.IP "\(bu" 4 +\&\f(CW\*(C`Getopt::Long\*(C'\fR upgraded to version 2.37 +.IP "\(bu" 4 +\&\f(CW\*(C`Getopt::Std\*(C'\fR upgraded to version 1.06 +.IP "\(bu" 4 +\&\f(CW\*(C`Hash::Util\*(C'\fR upgraded to version 0.06 +.IP "\(bu" 4 +\&\f(CW\*(C`if\*(C'\fR upgraded to version 0.05 +.IP "\(bu" 4 +\&\f(CW\*(C`IO\*(C'\fR upgraded to version 1.23 +.Sp +Reduced number of calls to \f(CW\*(C`getpeername\*(C'\fR in \f(CW\*(C`IO::Socket\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`IPC::Open\*(C'\fR upgraded to version 1.03 +.IP "\(bu" 4 +\&\f(CW\*(C`IPC::Open3\*(C'\fR upgraded to version 1.03 +.IP "\(bu" 4 +\&\f(CW\*(C`IPC::SysV\*(C'\fR upgraded to version 2.00 +.IP "\(bu" 4 +\&\f(CW\*(C`lib\*(C'\fR upgraded to version 0.61 +.RS 4 +.IP "\(bu" 4 +avoid warning about loading \fI.par\fR files. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`libnet\*(C'\fR upgraded to version 1.22 +.IP "\(bu" 4 +\&\f(CW\*(C`List::Util\*(C'\fR upgraded to 1.19 +.IP "\(bu" 4 +\&\f(CW\*(C`Locale::Maketext\*(C'\fR upgraded to 1.13 +.IP "\(bu" 4 +\&\f(CW\*(C`Math::BigFloat\*(C'\fR upgraded to version 1.60 +.IP "\(bu" 4 +\&\f(CW\*(C`Math::BigInt\*(C'\fR upgraded to version 1.89 +.IP "\(bu" 4 +\&\f(CW\*(C`Math::BigRat\*(C'\fR upgraded to version 0.22 +.RS 4 +.IP "\(bu" 4 +implements new \f(CW\*(C`as_float\*(C'\fR method. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`Math::Complex\*(C'\fR upgraded to version 1.54. +.IP "\(bu" 4 +\&\f(CW\*(C`Math::Trig\*(C'\fR upgraded to version 1.18. +.IP "\(bu" 4 +\&\f(CW\*(C`NDBM_File\*(C'\fR upgraded to version 1.07 +.RS 4 +.IP "\(bu" 4 +improve \fIg++\fR handling for systems using \s-1GDBM\s0 compatibility headers. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`Net::Ping\*(C'\fR upgraded to version 2.35 +.IP "\(bu" 4 +\&\f(CW\*(C`NEXT\*(C'\fR upgraded to version 0.61 +.RS 4 +.IP "\(bu" 4 +fix several bugs with \f(CW\*(C`NEXT\*(C'\fR when working with \f(CW\*(C`AUTOLOAD\*(C'\fR, \f(CW\*(C`eval\*(C'\fR block, and +within overloaded stringification. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`ODBM_File\*(C'\fR upgraded to 1.07 +.IP "\(bu" 4 +\&\f(CW\*(C`open\*(C'\fR upgraded to 1.06 +.IP "\(bu" 4 +\&\f(CW\*(C`ops\*(C'\fR upgraded to 1.02 +.IP "\(bu" 4 +\&\f(CW\*(C`PerlIO::encoding\*(C'\fR upgraded to version 0.11 +.IP "\(bu" 4 +\&\f(CW\*(C`PerlIO::scalar\*(C'\fR upgraded to version 0.06 +.RS 4 +.IP "\(bu" 4 +[\s-1RT\s0 #40267] \f(CW\*(C`PerlIO::scalar\*(C'\fR doesn't respect readonly-ness. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`PerlIO::via\*(C'\fR upgraded to version 0.05 +.IP "\(bu" 4 +\&\f(CW\*(C`Pod::Html\*(C'\fR upgraded to version 1.09 +.IP "\(bu" 4 +\&\f(CW\*(C`Pod::Parser\*(C'\fR upgraded to version 1.35 +.IP "\(bu" 4 +\&\f(CW\*(C`Pod::Usage\*(C'\fR upgraded to version 1.35 +.IP "\(bu" 4 +\&\f(CW\*(C`POSIX\*(C'\fR upgraded to version 1.15 +.RS 4 +.IP "\(bu" 4 +\&\f(CW\*(C`POSIX\*(C'\fR constants that duplicate those in \f(CW\*(C`Fcntl\*(C'\fR are now imported from +\&\f(CW\*(C`Fcntl\*(C'\fR and re-exported, rather than being duplicated by \f(CW\*(C`POSIX\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`POSIX::remove\*(C'\fR can remove empty directories. +.IP "\(bu" 4 +\&\f(CW\*(C`POSIX::setlocale\*(C'\fR safer to call multiple times. +.IP "\(bu" 4 +\&\f(CW\*(C`POSIX::SigRt\*(C'\fR added, which provides access to \s-1POSIX\s0 realtime signal +functionality on systems that support it. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`re\*(C'\fR upgraded to version 0.06_01 +.IP "\(bu" 4 +\&\f(CW\*(C`Safe\*(C'\fR upgraded to version 2.16 +.IP "\(bu" 4 +\&\f(CW\*(C`Scalar::Util\*(C'\fR upgraded to 1.19 +.IP "\(bu" 4 +\&\f(CW\*(C`SDBM_File\*(C'\fR upgraded to version 1.06 +.IP "\(bu" 4 +\&\f(CW\*(C`SelfLoader\*(C'\fR upgraded to version 1.17 +.IP "\(bu" 4 +\&\f(CW\*(C`Shell\*(C'\fR upgraded to version 0.72 +.IP "\(bu" 4 +\&\f(CW\*(C`sigtrap\*(C'\fR upgraded to version 1.04 +.IP "\(bu" 4 +\&\f(CW\*(C`Socket\*(C'\fR upgraded to version 1.81 +.RS 4 +.IP "\(bu" 4 +this fixes an optimistic use of \f(CW\*(C`gethostbyname\*(C'\fR +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`Storable\*(C'\fR upgraded to 2.19 +.IP "\(bu" 4 +\&\f(CW\*(C`Switch\*(C'\fR upgraded to version 2.13 +.IP "\(bu" 4 +\&\f(CW\*(C`Sys::Syslog\*(C'\fR upgraded to version 0.27 +.IP "\(bu" 4 +\&\f(CW\*(C`Term::ANSIColor\*(C'\fR upgraded to version 1.12 +.IP "\(bu" 4 +\&\f(CW\*(C`Term::Cap\*(C'\fR upgraded to version 1.12 +.IP "\(bu" 4 +\&\f(CW\*(C`Term::ReadLine\*(C'\fR upgraded to version 1.03 +.IP "\(bu" 4 +\&\f(CW\*(C`Test::Builder\*(C'\fR upgraded to version 0.80 +.IP "\(bu" 4 +\&\f(CW\*(C`Test::Harness\*(C'\fR upgraded version to 2.64 +.RS 4 +.IP "\(bu" 4 +this makes it able to handle newlines. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`Test::More\*(C'\fR upgraded to version 0.80 +.IP "\(bu" 4 +\&\f(CW\*(C`Test::Simple\*(C'\fR upgraded to version 0.80 +.IP "\(bu" 4 +\&\f(CW\*(C`Text::Balanced\*(C'\fR upgraded to version 1.98 +.IP "\(bu" 4 +\&\f(CW\*(C`Text::ParseWords\*(C'\fR upgraded to version 3.27 +.IP "\(bu" 4 +\&\f(CW\*(C`Text::Soundex\*(C'\fR upgraded to version 3.03 +.IP "\(bu" 4 +\&\f(CW\*(C`Text::Tabs\*(C'\fR upgraded to version 2007.1117 +.IP "\(bu" 4 +\&\f(CW\*(C`Text::Wrap\*(C'\fR upgraded to version 2006.1117 +.IP "\(bu" 4 +\&\f(CW\*(C`Thread\*(C'\fR upgraded to version 2.01 +.IP "\(bu" 4 +\&\f(CW\*(C`Thread::Semaphore\*(C'\fR upgraded to version 2.09 +.IP "\(bu" 4 +\&\f(CW\*(C`Thread::Queue\*(C'\fR upgraded to version 2.11 +.RS 4 +.IP "\(bu" 4 +added capability to add complex structures (e.g., hash of hashes) to queues. +.IP "\(bu" 4 +added capability to dequeue multiple items at once. +.IP "\(bu" 4 +added new methods to inspect and manipulate queues: \f(CW\*(C`peek\*(C'\fR, \f(CW\*(C`insert\*(C'\fR and +\&\f(CW\*(C`extract\*(C'\fR +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`Tie::Handle\*(C'\fR upgraded to version 4.2 +.IP "\(bu" 4 +\&\f(CW\*(C`Tie::Hash\*(C'\fR upgraded to version 1.03 +.IP "\(bu" 4 +\&\f(CW\*(C`Tie::Memoize\*(C'\fR upgraded to version 1.1 +.RS 4 +.IP "\(bu" 4 +\&\f(CW\*(C`Tie::Memoize::EXISTS\*(C'\fR now correctly caches its results. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`Tie::RefHash\*(C'\fR upgraded to version 1.38 +.IP "\(bu" 4 +\&\f(CW\*(C`Tie::Scalar\*(C'\fR upgraded to version 1.01 +.IP "\(bu" 4 +\&\f(CW\*(C`Tie::StdHandle\*(C'\fR upgraded to version 4.2 +.IP "\(bu" 4 +\&\f(CW\*(C`Time::gmtime\*(C'\fR upgraded to version 1.03 +.IP "\(bu" 4 +\&\f(CW\*(C`Time::Local\*(C'\fR upgraded to version 1.1901 +.IP "\(bu" 4 +\&\f(CW\*(C`Time::HiRes\*(C'\fR upgraded to version 1.9715 with various build improvements +(including \s-1VMS\s0) and minor platform-specific bug fixes (including +for HP-UX 11 ia64). +.IP "\(bu" 4 +\&\f(CW\*(C`threads\*(C'\fR upgraded to 1.71 +.RS 4 +.IP "\(bu" 4 +new thread state information methods: \f(CW\*(C`is_running\*(C'\fR, \f(CW\*(C`is_detached\*(C'\fR +and \f(CW\*(C`is_joinable\*(C'\fR. \f(CW\*(C`list\*(C'\fR method enhanced to return running or joinable +threads. +.IP "\(bu" 4 +new thread signal method: \f(CW\*(C`kill\*(C'\fR +.IP "\(bu" 4 +added capability to specify thread stack size. +.IP "\(bu" 4 +added capability to control thread exiting behavior. Added a new \f(CW\*(C`exit\*(C'\fR +method. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`threads::shared\*(C'\fR upgraded to version 1.27 +.RS 4 +.IP "\(bu" 4 +smaller and faster implementation that eliminates one internal structure and +the consequent level of indirection. +.IP "\(bu" 4 +user locks are now stored in a safer manner. +.IP "\(bu" 4 +new function \f(CW\*(C`shared_clone\*(C'\fR creates a copy of an object leaving +shared elements as-is and deep-cloning non-shared elements. +.IP "\(bu" 4 +added new \f(CW\*(C`is_shared\*(C'\fR method. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`Unicode::Normalize\*(C'\fR upgraded to version 1.02 +.IP "\(bu" 4 +\&\f(CW\*(C`Unicode::UCD\*(C'\fR upgraded to version 0.25 +.IP "\(bu" 4 +\&\f(CW\*(C`warnings\*(C'\fR upgraded to version 1.05_01 +.IP "\(bu" 4 +\&\f(CW\*(C`Win32\*(C'\fR upgraded to version 0.38 +.RS 4 +.IP "\(bu" 4 +added new function \f(CW\*(C`GetCurrentProcessId\*(C'\fR which returns the regular Windows +process identifier of the current process, even when called from within a fork. +.RE +.RS 4 +.RE +.IP "\(bu" 4 +\&\f(CW\*(C`XSLoader\*(C'\fR upgraded to version 0.10 +.IP "\(bu" 4 +\&\f(CW\*(C`XS::APItest\*(C'\fR and \f(CW\*(C`XS::Typemap\*(C'\fR are for internal use only and hence +no longer installed. Many more tests have been added to \f(CW\*(C`XS::APItest\*(C'\fR. +.SH "Utility Changes" +.IX Header "Utility Changes" +.SS "debugger upgraded to version 1.31" +.IX Subsection "debugger upgraded to version 1.31" +.IP "\(bu" 4 +Andreas Ko\*:nig contributed two functions to save and load the debugger +history. +.IP "\(bu" 4 +\&\f(CW\*(C`NEXT::AUTOLOAD\*(C'\fR no longer emits warnings under the debugger. +.IP "\(bu" 4 +The debugger should now correctly find tty the device on \s-1OS X 10.5\s0 and \s-1VMS\s0 +when the program \f(CW\*(C`fork\*(C'\fRs. +.IP "\(bu" 4 +\&\s-1LVALUE\s0 subs now work inside the debugger. +.SS "\fIperlthanks\fP" +.IX Subsection "perlthanks" +Perl 5.8.9 adds a new utility \fIperlthanks\fR, which is a variant of \fIperlbug\fR, +but for sending non-bug-reports to the authors and maintainers of Perl. +Getting nothing but bug reports can become a bit demoralising \- we'll see if +this changes things. +.SS "\fIperlbug\fP" +.IX Subsection "perlbug" +\&\fIperlbug\fR now checks if you're reporting about a non-core module and suggests +you report it to the \s-1CPAN\s0 author instead. +.SS "\fIh2xs\fP" +.IX Subsection "h2xs" +.IP "\(bu" 4 +won't define an empty string as a constant [\s-1RT\s0 #25366] +.IP "\(bu" 4 +has examples for \f(CW\*(C`h2xs \-X\*(C'\fR +.SS "\fIh2ph\fP" +.IX Subsection "h2ph" +.IP "\(bu" 4 +now attempts to deal sensibly with the difference in path implications +between \f(CW""\fR and \f(CW\*(C`<>\*(C'\fR quoting in \f(CW\*(C`#include\*(C'\fR statements. +.IP "\(bu" 4 +now generates correct code for \f(CW\*(C`#if defined A || defined B\*(C'\fR +[\s-1RT\s0 #39130] +.SH "New Documentation" +.IX Header "New Documentation" +As usual, the documentation received its share of corrections, clarifications +and other nitfixes. More \f(CW\*(C`\*(C'\fR tags were added for indexing. +.IX Xref "..." +.PP +perlunitut is a tutorial written by Juerd Waalboer on Unicode-related +terminology and how to correctly handle Unicode in Perl scripts. +.PP +perlunicode is updated in section user defined properties. +.PP +perluniintro has been updated in the example of detecting data that is not +valid in particular encoding. +.PP +perlcommunity provides an overview of the Perl Community along with further +resources. +.PP +\&\s-1CORE\s0 documents the pseudo-namespace for Perl's core routines. +.SH "Changes to Existing Documentation" +.IX Header "Changes to Existing Documentation" +perlglossary adds \fIdeprecated modules and features\fR and \fIto be dropped modules\fR. +.PP +perlhack has been updated and added resources on smoke testing. +.PP +The Perl FAQs (\fIperlfaq1\fR..\fIperlfaq9\fR) have been updated. +.PP +perlcheat is updated with better details on \f(CW\*(C`\ew\*(C'\fR, \f(CW\*(C`\ed\*(C'\fR, and \f(CW\*(C`\es\*(C'\fR. +.PP +perldebug is updated with information on how to call the debugger. +.PP +perldiag documentation updated with \fIsubroutine with an ampersand\fR on the +argument to \f(CW\*(C`exists\*(C'\fR and \f(CW\*(C`delete\*(C'\fR and also several terminology updates on +warnings. +.PP +perlfork documents the limitation of \f(CW\*(C`exec\*(C'\fR inside pseudo-processes. +.PP +perlfunc: +.IP "\(bu" 4 +Documentation is fixed in section \f(CW\*(C`caller\*(C'\fR and \f(CW\*(C`pop\*(C'\fR. +.IP "\(bu" 4 +Function \f(CW\*(C`alarm\*(C'\fR now mentions \f(CW\*(C`Time::HiRes::ualarm\*(C'\fR in preference +to \f(CW\*(C`select\*(C'\fR. +.IP "\(bu" 4 +Regarding precedence in \f(CW\*(C`\-X\*(C'\fR, filetest operators are the same as unary +operators, but not regarding parsing and parentheses (spotted by Eirik Berg +Hanssen). +.IP "\(bu" 4 +\&\f(CW\*(C`reverse\*(C'\fR function documentation received scalar context examples. +.PP +perllocale documentation is adjusted for number localization and +\&\f(CW\*(C`POSIX::setlocale\*(C'\fR to fix Debian bug #379463. +.PP +perlmodlib is updated with \f(CW\*(C`CPAN::API::HOWTO\*(C'\fR and +\&\f(CW\*(C`Sys::Syslog::win32::Win32\*(C'\fR +.PP +perlre documentation updated to reflect the differences between +\&\f(CW\*(C`[[:xxxxx:]]\*(C'\fR and \f(CW\*(C`\ep{IsXxxxx}\*(C'\fR matches. Also added section on \f(CW\*(C`/g\*(C'\fR and +\&\f(CW\*(C`/c\*(C'\fR modifiers. +.PP +perlreguts describe the internals of the regular expressions engine. It has +been contributed by Yves Orton. +.PP +perlrebackslash describes all perl regular expression backslash and escape +sequences. +.PP +perlrecharclass describes the syntax and use of character classes in +Perl Regular Expressions. +.PP +perlrun is updated to clarify on the hash seed \fI\s-1PERL_HASH_SEED\s0\fR. Also more +information in options \f(CW\*(C`\-x\*(C'\fR and \f(CW\*(C`\-u\*(C'\fR. +.PP +perlsub example is updated to use a lexical variable for \f(CW\*(C`opendir\*(C'\fR syntax. +.PP +perlvar fixes confusion about real \s-1GID\s0 \f(CW$(\fR and effective \s-1GID\s0 \f(CW$)\fR. +.PP +Perl thread tutorial example is fixed in section +\&\*(L"Queues: Passing Data Around\*(R" in perlthrtut and perlthrtut. +.PP +perlhack documentation extensively improved by Jarkko Hietaniemi and others. +.PP +perltoot provides information on modifying \f(CW@UNIVERSAL::ISA\fR. +.PP +perlport documentation extended to include different \f(CW\*(C`kill(\-9, ...)\*(C'\fR +semantics on Windows. It also clearly states \f(CW\*(C`dump\*(C'\fR is not supported on Win32 +and cygwin. +.PP +\&\fI\s-1INSTALL\s0\fR has been updated and modernised. +.SH "Performance Enhancements" +.IX Header "Performance Enhancements" +.IP "\(bu" 4 +The default since perl 5.000 has been for perl to create an empty scalar +with every new typeglob. The increased use of lexical variables means that +most are now unused. Thanks to Nicholas Clark's efforts, Perl can now be +compiled with \f(CW\*(C`\-DPERL_DONT_CREATE_GVSV\*(C'\fR to avoid creating these empty scalars. +This will significantly decrease the number of scalars allocated for all +configurations, and the number of scalars that need to be copied for ithread +creation. Whilst this option is binary compatible with existing perl +installations, it does change a long-standing assumption about the +internals, hence it is not enabled by default, as some third party code may +rely on the old behaviour. +.Sp +We would recommend testing with this configuration on new deployments of +perl, particularly for multi-threaded servers, to see whether all third party +code is compatible with it, as this configuration may give useful performance +improvements. For existing installations we would not recommend changing to +this configuration unless thorough testing is performed before deployment. +.IP "\(bu" 4 +\&\f(CW\*(C`diagnostics\*(C'\fR no longer uses \f(CW$&\fR, which results in large speedups +for regexp matching in all code using it. +.IP "\(bu" 4 +Regular expressions classes of a single character are now treated the same as +if the character had been used as a literal, meaning that code that uses +char-classes as an escaping mechanism will see a speedup. (Yves Orton) +.IP "\(bu" 4 +Creating anonymous array and hash references (ie. \f(CW\*(C`[]\*(C'\fR and \f(CW\*(C`{}\*(C'\fR) now incurs +no more overhead than creating an anonymous list or hash. Nicholas Clark +provided changes with a saving of two ops and one stack push, which was measured +as a slightly better than 5% improvement for these operations. +.IP "\(bu" 4 +Many calls to \f(CW\*(C`strlen()\*(C'\fR have been eliminated, either because the length was +already known, or by adopting or enhancing APIs that pass lengths. This has +been aided by the adoption of a \f(CW\*(C`my_sprintf()\*(C'\fR wrapper, which returns the +correct C89 value \- the length of the formatted string. Previously we could +not rely on the return value of \f(CW\*(C`sprintf()\*(C'\fR, because on some ancient but +extant platforms it still returns \f(CW\*(C`char *\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`index\*(C'\fR is now faster if the search string is stored in \s-1UTF\-8\s0 but only contains +characters in the Latin\-1 range. +.IP "\(bu" 4 +The Unicode swatch cache inside the regexp engine is now used. (the lookup had +a key mismatch, present since the initial implementation). [\s-1RT\s0 #42839] +.SH "Installation and Configuration Improvements" +.IX Header "Installation and Configuration Improvements" +.SS "Relocatable installations" +.IX Subsection "Relocatable installations" +There is now \fIConfigure\fR support for creating a relocatable perl tree. If +you \fIConfigure\fR with \f(CW\*(C`\-Duserelocatableinc\*(C'\fR, then the paths in \f(CW@INC\fR (and +everything else in \f(CW%Config\fR) can be optionally located via the path of the +\&\fIperl\fR executable. +.PP +At start time, if any paths in \f(CW@INC\fR or \f(CW\*(C`Config\*(C'\fR that \fIConfigure\fR marked +as relocatable (by starting them with \f(CW".../"\fR), then they are prefixed the +directory of \f(CW$^X\fR. This allows the relocation can be configured on a +per-directory basis, although the default with \f(CW\*(C`\-Duserelocatableinc\*(C'\fR is that +everything is relocated. The initial install is done to the original configured +prefix. +.SS "Configuration improvements" +.IX Subsection "Configuration improvements" +\&\fIConfigure\fR is now better at removing temporary files. Tom Callaway +(from RedHat) also contributed patches that complete the set of flags +passed to the compiler and the linker, in particular that \f(CW\*(C`\-fPIC\*(C'\fR is now +enabled on Linux. It will also croak when your \fI/dev/null\fR isn't a device. +.PP +A new configuration variable \f(CW\*(C`d_pseudofork\*(C'\fR has been to \fIConfigure\fR, and is +available as \f(CW$Config{d_pseudofork}\fR in the \f(CW\*(C`Config\*(C'\fR module. This +distinguishes real \f(CW\*(C`fork\*(C'\fR support from the pseudofork emulation used on +Windows platforms. +.PP +\&\fIConfig.pod\fR and \fIconfig.sh\fR are now placed correctly for cross-compilation. +.PP +\&\f(CW$Config{useshrplib}\fR is now 'true' rather than 'yes' when using a shared perl +library. +.SS "Compilation improvements" +.IX Subsection "Compilation improvements" +Parallel makes should work properly now, although there may still be problems +if \f(CW\*(C`make test\*(C'\fR is instructed to run in parallel. +.PP +Many compilation warnings have been cleaned up. A very stubborn compiler +warning in \f(CW\*(C`S_emulate_eaccess()\*(C'\fR was killed after six attempts. +\&\fIg++\fR support has been tuned, especially for FreeBSD. +.PP +\&\fImkppport\fR has been integrated, and all \fIppport.h\fR files in the core will now +be autogenerated at build time (and removed during cleanup). +.SS "Installation improvements." +.IX Subsection "Installation improvements." +\&\fIinstallman\fR now works with \f(CW\*(C`\-Duserelocatableinc\*(C'\fR and \f(CW\*(C`DESTDIR\*(C'\fR. +.PP +\&\fIinstallperl\fR no longer installs: +.IP "\(bu" 4 +static library files of statically linked extensions when a shared perl library +is being used. (They are not needed. See \*(L"Windows\*(R" below). +.IP "\(bu" 4 +\&\fI\s-1SIGNATURE\s0\fR and \fIPAUSE*.pub\fR (\s-1CPAN\s0 files) +.IP "\(bu" 4 +\&\fI\s-1NOTES\s0\fR and \fI\s-1PATCHING\s0\fR (ExtUtils files) +.IP "\(bu" 4 +\&\fIperlld\fR and \fIld2\fR (Cygwin files) +.SS "Platform Specific Changes" +.IX Subsection "Platform Specific Changes" +There are improved hints for \s-1AIX,\s0 Cygwin, \s-1DEC/OSF,\s0 FreeBSD, \s-1HP/UX,\s0 Irix 6 +Linux, MachTen, NetBSD, \s-1OS/390, QNX, SCO,\s0 Solaris, SunOS, System V Release 5.x +(UnixWare 7, OpenUNIX 8), Ultrix, \s-1UMIPS,\s0 uts and \s-1VOS.\s0 +.PP +\fIFreeBSD\fR +.IX Subsection "FreeBSD" +.IP "\(bu" 4 +Drop \f(CW\*(C`\-std=c89\*(C'\fR and \f(CW\*(C`\-ansi\*(C'\fR if using \f(CW\*(C`long long\*(C'\fR as the main integral type, +else in FreeBSD 6.2 (and perhaps other releases), system headers do not +declare some functions required by perl. +.PP +\fISolaris\fR +.IX Subsection "Solaris" +.IP "\(bu" 4 +Starting with Solaris 10, we do not want versioned shared libraries, because +those often indicate a private use only library. These problems could often +be triggered when SUNWbdb (Berkeley \s-1DB\s0) was installed. Hence if Solaris 10 +is detected set \f(CW\*(C`ignore_versioned_solibs=y\*(C'\fR. +.PP +\fI\s-1VMS\s0\fR +.IX Subsection "VMS" +.IP "\(bu" 4 +Allow \s-1IEEE\s0 math to be deselected on OpenVMS I64 (but it remains the default). +.IP "\(bu" 4 +Record \s-1IEEE\s0 usage in \f(CW\*(C`config.h\*(C'\fR +.IP "\(bu" 4 +Help older \s-1VMS\s0 compilers by using \f(CW\*(C`ccflags\*(C'\fR when building \f(CW\*(C`munchconfig.exe\*(C'\fR. +.IP "\(bu" 4 +Don't try to build old \f(CW\*(C`Thread\*(C'\fR extension on \s-1VMS\s0 when \f(CW\*(C`\-Duseithreads\*(C'\fR has +been chosen. +.IP "\(bu" 4 +Passing a raw string of \*(L"NaN\*(R" to \fInawk\fR causes a core dump \- so the string +has been changed to \*(L"*NaN*\*(R" +.IP "\(bu" 4 +\&\fIt/op/stat.t\fR tests will now test hard links on \s-1VMS\s0 if they are supported. +.PP +\fIWindows\fR +.IX Subsection "Windows" +.IP "\(bu" 4 +When using a shared perl library \fIinstallperl\fR no longer installs static +library files, import library files and export library files (of statically +linked extensions) and empty bootstrap files (of dynamically linked +extensions). This fixes a problem building PAR-Packer on Win32 with a debug +build of perl. +.IP "\(bu" 4 +Various improvements to the win32 build process, including support for Visual +\&\*(C+ 2005 Express Edition (aka Visual \*(C+ 8.x). +.IP "\(bu" 4 +\&\fIperl.exe\fR will now have an icon if built with MinGW or Borland. +.IP "\(bu" 4 +Improvements to the perl\-static.exe build process. +.IP "\(bu" 4 +Add Win32 makefile option to link all extensions statically. +.IP "\(bu" 4 +The \fIWinCE\fR directory has been merged into the \fIWin32\fR directory. +.IP "\(bu" 4 +\&\f(CW\*(C`setlocale\*(C'\fR tests have been re-enabled for Windows \s-1XP\s0 onwards. +.SH "Selected Bug Fixes" +.IX Header "Selected Bug Fixes" +.SS "Unicode" +.IX Subsection "Unicode" +Many many bugs related to the internal Unicode implementation (\s-1UTF\-8\s0) have +been fixed. In particular, long standing bugs related to returning Unicode +via \f(CW\*(C`tie\*(C'\fR, overloading or \f(CW$@\fR are now gone, some of which were never +reported. +.PP +\&\f(CW\*(C`unpack\*(C'\fR will internally convert the string back from \s-1UTF\-8\s0 on numeric types. +This is a compromise between the full consistency now in 5.10, and the current +behaviour, which is often used as a \*(L"feature\*(R" on string types. +.PP +Using \f(CW\*(C`:crlf\*(C'\fR and \f(CW\*(C`UTF\-16\*(C'\fR \s-1IO\s0 layers together will now work. +.PP +Fixed problems with \f(CW\*(C`split\*(C'\fR, Unicode \f(CW\*(C`/\es+/\*(C'\fR and \f(CW\*(C`/ \e0/\*(C'\fR. +.PP +Fixed bug \s-1RT\s0 #40641 \- encoding of Unicode characters in regular expressions. +.PP +Fixed a bug where using certain patterns in a regexp led to a panic. +[\s-1RT\s0 #45337] +.PP +Perl no longer segfaults (due to infinite internal recursion) if the locale's +character is not \s-1UTF\-8\s0 [\s-1RT\s0 #41442]: +.PP +.Vb 2 +\& use open \*(Aq:locale\*(Aq; +\& print STDERR "\ex{201e}"; # „ +.Ve +.SS "PerlIO" +.IX Subsection "PerlIO" +Inconsistencies have been fixed in the reference counting PerlIO uses to keep +track of Unix file descriptors, and the \s-1API\s0 used by \s-1XS\s0 code to manage getting +and releasing \f(CW\*(C`FILE *\*(C'\fRs +.SS "Magic" +.IX Subsection "Magic" +Several bugs have been fixed in Magic, the internal system used to implement +features such as \f(CW\*(C`tie\*(C'\fR, tainting and threads sharing. +.PP +\&\f(CW\*(C`undef @array\*(C'\fR on a tied array now correctly calls the \f(CW\*(C`CLEAR\*(C'\fR method. +.PP +Some of the bitwise ops were not checking whether their arguments were magical +before using them. [\s-1RT\s0 #24816] +.PP +Magic is no longer invoked twice by the expression \f(CW\*(C`\e&$x\*(C'\fR +.PP +A bug with assigning large numbers and tainting has been resolved. +[\s-1RT\s0 #40708] +.PP +A new entry has been added to the \s-1MAGIC\s0 vtable \- \f(CW\*(C`svt_local\*(C'\fR. This is used +when copying magic to the new value during \f(CW\*(C`local\*(C'\fR, allowing certain problems +with localising shared variables to be resolved. +.PP +For the implementation details, see \*(L"Magic Virtual Tables\*(R" in perlguts. +.SS "Reblessing overloaded objects now works" +.IX Subsection "Reblessing overloaded objects now works" +Internally, perl object-ness is on the referent, not the reference, even +though methods can only be called via a reference. However, the original +implementation of overloading stored flags related to overloading on the +reference, relying on the flags being copied when the reference was copied, +or set at the creation of a new reference. This manifests in a bug \- if you +rebless an object from a class that has overloading, into one that does not, +then any other existing references think that they (still) point to an +overloaded object, choose these C code paths, and then throw errors. +Analogously, blessing into an overloaded class when other references exist will +result in them not using overloading. +.PP +The implementation has been fixed for 5.10, but this fix changes the semantics +of flag bits, so is not binary compatible, so can't be applied to 5.8.9. +However, 5.8.9 has a work-around that implements the same bug fix. If the +referent has multiple references, then all the other references are located and +corrected. A full search is avoided whenever possible by scanning lexicals +outwards from the current subroutine, and the argument stack. +.PP +A certain well known Linux vendor applied incomplete versions of this bug fix +to their \fI/usr/bin/perl\fR and then prematurely closed bug reports about +performance issues without consulting back upstream. This not being enough, +they then proceeded to ignore the necessary fixes to these unreleased changes +for 11 months, until massive pressure was applied by their long-suffering +paying customers, catalysed by the failings being featured on a prominent blog +and Slashdot. +.ie n .SS """strict"" now propagates correctly into string evals" +.el .SS "\f(CWstrict\fP now propagates correctly into string evals" +.IX Subsection "strict now propagates correctly into string evals" +Under 5.8.8 and earlier: +.PP +.Vb 3 +\& $ perl5.8.8 \-e \*(Aquse strict; eval "use foo bar" or die $@\*(Aq +\& Can\*(Aqt locate foo.pm in @INC (@INC contains: ... .) at (eval 1) line 2. +\& BEGIN failed\-\-compilation aborted at (eval 1) line 2. +.Ve +.PP +Under 5.8.9 and later: +.PP +.Vb 2 +\& $ perl5.8.9 \-e \*(Aquse strict; eval "use foo bar" or die $@\*(Aq +\& Bareword "bar" not allowed while "strict subs" in use at (eval 1) line 1. +.Ve +.PP +This may cause problems with programs that parse the error message and rely +on the buggy behaviour. +.SS "Other fixes" +.IX Subsection "Other fixes" +.IP "\(bu" 4 +The tokenizer no longer treats \f(CW\*(C`=cute\*(C'\fR (and other words beginning +with \f(CW\*(C`=cut\*(C'\fR) as a synonym for \f(CW\*(C`=cut\*(C'\fR. +.IP "\(bu" 4 +Calling \f(CW\*(C`CORE::require\*(C'\fR +.Sp +\&\f(CW\*(C`CORE::require\*(C'\fR and \f(CW\*(C`CORE::do\*(C'\fR were always parsed as \f(CW\*(C`require\*(C'\fR and \f(CW\*(C`do\*(C'\fR +when they were overridden. This is now fixed. +.IP "\(bu" 4 +Stopped memory leak on long \fI/etc/groups\fR entries. +.IP "\(bu" 4 +\&\f(CW\*(C`while (my $x ...) { ...; redo }\*(C'\fR shouldn't \f(CW\*(C`undef $x\*(C'\fR. +.Sp +In the presence of \f(CW\*(C`my\*(C'\fR in the conditional of a \f(CW\*(C`while()\*(C'\fR, \f(CW\*(C`until()\*(C'\fR, +or \f(CW\*(C`for(;;)\*(C'\fR loop, we now add an extra scope to the body so that \f(CW\*(C`redo\*(C'\fR +doesn't \f(CW\*(C`undef\*(C'\fR the lexical. +.IP "\(bu" 4 +The \f(CW\*(C`encoding\*(C'\fR pragma now correctly ignores anything following an \f(CW\*(C`@\*(C'\fR +character in the \f(CW\*(C`LC_ALL\*(C'\fR and \f(CW\*(C`LANG\*(C'\fR environment variables. [\s-1RT\s0 # 49646] +.IP "\(bu" 4 +A segfault observed with some \fIgcc\fR 3.3 optimisations is resolved. +.IP "\(bu" 4 +A possible segfault when \f(CW\*(C`unpack\*(C'\fR used in scalar context with \f(CW\*(C`()\*(C'\fR groups +is resolved. [\s-1RT\s0 #50256] +.IP "\(bu" 4 +Resolved issue where \f(CW$!\fR could be changed by a signal handler interrupting +a \f(CW\*(C`system\*(C'\fR call. +.IP "\(bu" 4 +Fixed bug \s-1RT\s0 #37886, symbolic dereferencing was allowed in the argument of +\&\f(CW\*(C`defined\*(C'\fR even under the influence of \f(CW\*(C`use strict \*(Aqrefs\*(Aq\*(C'\fR. +.IP "\(bu" 4 +Fixed bug \s-1RT\s0 #43207, where \f(CW\*(C`lc\*(C'\fR/\f(CW\*(C`uc\*(C'\fR inside \f(CW\*(C`sort\*(C'\fR affected the return +value. +.IP "\(bu" 4 +Fixed bug \s-1RT\s0 #45607, where \f(CW\*(C`*{"BONK"} = \e&{"BONK"}\*(C'\fR didn't work correctly. +.IP "\(bu" 4 +Fixed bug \s-1RT\s0 #35878, croaking from a \s-1XSUB\s0 called via \f(CW\*(C`goto &xsub\*(C'\fR corrupts perl +internals. +.IP "\(bu" 4 +Fixed bug \s-1RT\s0 #32539, \fIDynaLoader.o\fR is moved into \fIlibperl.so\fR to avoid the +need to statically link DynaLoader into the stub perl executable. With this +\&\fIlibperl.so\fR provides everything needed to get a functional embedded perl +interpreter to run. +.IP "\(bu" 4 +Fix bug \s-1RT\s0 #36267 so that assigning to a tied hash doesn't change the +underlying hash. +.IP "\(bu" 4 +Fix bug \s-1RT\s0 #6006, regexp replaces using large replacement variables +fail some of the time, \fIi.e.\fR when substitution contains something +like \f(CW\*(C`${10}\*(C'\fR (note the bracket) instead of just \f(CW$10\fR. +.IP "\(bu" 4 +Fix bug \s-1RT\s0 #45053, \f(CW\*(C`Perl_newCONSTSUB()\*(C'\fR is now thread safe. +.SS "Platform Specific Fixes" +.IX Subsection "Platform Specific Fixes" +\fIDarwin / MacOS X\fR +.IX Subsection "Darwin / MacOS X" +.IP "\(bu" 4 +Various improvements to 64 bit builds. +.IP "\(bu" 4 +Mutex protection added in \f(CW\*(C`PerlIOStdio_close()\*(C'\fR to avoid race conditions. +Hopefully this fixes failures in the threads tests \fIfree.t\fR and \fIblocks.t\fR. +.IP "\(bu" 4 +Added forked terminal support to the debugger, with the ability to update the +window title. +.PP +\fI\s-1OS/2\s0\fR +.IX Subsection "OS/2" +.IP "\(bu" 4 +A build problem with specifying \f(CW\*(C`USE_MULTI\*(C'\fR and \f(CW\*(C`USE_ITHREADS\*(C'\fR but without +\&\f(CW\*(C`USE_IMP_SYS\*(C'\fR has been fixed. +.IP "\(bu" 4 +\&\f(CW\*(C`OS2::REXX\*(C'\fR upgraded to version 1.04 +.PP +\fITru64\fR +.IX Subsection "Tru64" +.IP "\(bu" 4 +Aligned floating point build policies for \fIcc\fR and \fIgcc\fR. +.PP +\fIRedHat Linux\fR +.IX Subsection "RedHat Linux" +.IP "\(bu" 4 +Revisited a patch from 5.6.1 for \s-1RH7.2\s0 for Intel's \fIicc\fR [\s-1RT\s0 #7916], added an +additional check for \f(CW$Config{gccversion}\fR. +.PP +\fISolaris/i386\fR +.IX Subsection "Solaris/i386" +.IP "\(bu" 4 +Use \f(CW\*(C`\-DPTR_IS_LONG\*(C'\fR when using 64 bit integers +.PP +\fI\s-1VMS\s0\fR +.IX Subsection "VMS" +.IP "\(bu" 4 +Fixed \f(CW\*(C`PerlIO::Scalar\*(C'\fR in-memory file record-style reads. +.IP "\(bu" 4 +pipe shutdown at process exit should now be more robust. +.IP "\(bu" 4 +Bugs in \s-1VMS\s0 exit handling tickled by \f(CW\*(C`Test::Harness\*(C'\fR 2.64 have been fixed. +.IP "\(bu" 4 +Fix \f(CW\*(C`fcntl()\*(C'\fR locking capability test in \fIconfigure.com\fR. +.IP "\(bu" 4 +Replaced \f(CW\*(C`shrplib=\*(Aqdefine\*(Aq\*(C'\fR with \f(CW\*(C`useshrplib=\*(Aqtrue\*(Aq\*(C'\fR on \s-1VMS.\s0 +.PP +\fIWindows\fR +.IX Subsection "Windows" +.IP "\(bu" 4 +\&\f(CW\*(C`File::Find\*(C'\fR used to fail when the target directory is a bare drive letter and +\&\f(CW\*(C`no_chdir\*(C'\fR is 1 (the default is 0). [\s-1RT\s0 #41555] +.IP "\(bu" 4 +A build problem with specifying \f(CW\*(C`USE_MULTI\*(C'\fR and \f(CW\*(C`USE_ITHREADS\*(C'\fR but without +\&\f(CW\*(C`USE_IMP_SYS\*(C'\fR has been fixed. +.IP "\(bu" 4 +The process id is no longer truncated to 16 bits on some Windows platforms +( http://bugs.activestate.com/show_bug.cgi?id=72443 ) +.IP "\(bu" 4 +Fixed bug \s-1RT\s0 #54828 in \fIperlio.c\fR where calling \f(CW\*(C`binmode\*(C'\fR on Win32 and Cygwin +may cause a segmentation fault. +.SS "Smaller fixes" +.IX Subsection "Smaller fixes" +.IP "\(bu" 4 +It is now possible to overload \f(CW\*(C`eq\*(C'\fR when using \f(CW\*(C`nomethod\*(C'\fR. +.IP "\(bu" 4 +Various problems using \f(CW\*(C`overload\*(C'\fR with 64 bit integers corrected. +.IP "\(bu" 4 +The reference count of \f(CW\*(C`PerlIO\*(C'\fR file descriptors is now correctly handled. +.IP "\(bu" 4 +On \s-1VMS,\s0 escaped dots will be preserved when converted to Unix syntax. +.IP "\(bu" 4 +\&\f(CW\*(C`keys %+\*(C'\fR no longer throws an \f(CW\*(Aqambiguous\*(Aq\fR warning. +.IP "\(bu" 4 +Using \f(CW\*(C`#!perl \-d\*(C'\fR could trigger an assertion, which has been fixed. +.IP "\(bu" 4 +Don't stringify tied code references in \f(CW@INC\fR when calling \f(CW\*(C`require\*(C'\fR. +.IP "\(bu" 4 +Code references in \f(CW@INC\fR report the correct file name when \f(CW\*(C`_\|_FILE_\|_\*(C'\fR is +used. +.IP "\(bu" 4 +Width and precision in sprintf didn't handle characters above 255 correctly. +[\s-1RT\s0 #40473] +.IP "\(bu" 4 +List slices with indices out of range now work more consistently. +[\s-1RT\s0 #39882] +.IP "\(bu" 4 +A change introduced with perl 5.8.1 broke the parsing of arguments of the form +\&\f(CW\*(C`\-foo=bar\*(C'\fR with the \f(CW\*(C`\-s\*(C'\fR on the <#!> line. This has been fixed. See +http://bugs.activestate.com/show_bug.cgi?id=43483 +.IP "\(bu" 4 +\&\f(CW\*(C`tr///\*(C'\fR is now threadsafe. Previously it was storing a swash inside its \s-1OP,\s0 +rather than in a pad. +.IP "\(bu" 4 +\&\fIpod2html\fR labels anchors more consistently and handles nested definition +lists better. +.IP "\(bu" 4 +\&\f(CW\*(C`threads\*(C'\fR cleanup veto has been extended to include \f(CW\*(C`perl_free()\*(C'\fR and +\&\f(CW\*(C`perl_destruct()\*(C'\fR +.IP "\(bu" 4 +On some systems, changes to \f(CW$ENV{TZ}\fR would not always be +respected by the underlying calls to \f(CW\*(C`localtime_r()\*(C'\fR. Perl now +forces the inspection of the environment on these systems. +.IP "\(bu" 4 +The special variable \f(CW$^R\fR is now more consistently set when executing +regexps using the \f(CW\*(C`(?{...})\*(C'\fR construct. In particular, it will still +be set even if backreferences or optional sub-patterns \f(CW\*(C`(?:...)?\*(C'\fR are +used. +.SH "New or Changed Diagnostics" +.IX Header "New or Changed Diagnostics" +.ie n .SS "panic: sv_chop %s" +.el .SS "panic: sv_chop \f(CW%s\fP" +.IX Subsection "panic: sv_chop %s" +This new fatal error occurs when the C routine \f(CW\*(C`Perl_sv_chop()\*(C'\fR was passed a +position that is not within the scalar's string buffer. This is caused by +buggy \s-1XS\s0 code, and at this point recovery is not possible. +.SS "Maximal count of pending signals (%s) exceeded" +.IX Subsection "Maximal count of pending signals (%s) exceeded" +This new fatal error occurs when the perl process has to abort due to +too many pending signals, which is bound to prevent perl from being +able to handle further incoming signals safely. +.ie n .SS "panic: attempt to call %s in %s" +.el .SS "panic: attempt to call \f(CW%s\fP in \f(CW%s\fP" +.IX Subsection "panic: attempt to call %s in %s" +This new fatal error occurs when the \s-1ACL\s0 version file test operator is used +where it is not available on the current platform. Earlier checks mean that +it should never be possible to get this. +.SS "\s-1FETCHSIZE\s0 returned a negative value" +.IX Subsection "FETCHSIZE returned a negative value" +New error indicating that a tied array has claimed to have a negative +number of elements. +.ie n .SS "Can't upgrade %s (%d) to %d" +.el .SS "Can't upgrade \f(CW%s\fP (%d) to \f(CW%d\fP" +.IX Subsection "Can't upgrade %s (%d) to %d" +Previously the internal error from the \s-1SV\s0 upgrade code was the less informative +\&\fICan't upgrade that kind of scalar\fR. It now reports the current internal type, +and the new type requested. +.ie n .SS "%s argument is not a \s-1HASH\s0 or \s-1ARRAY\s0 element or a subroutine" +.el .SS "\f(CW%s\fP argument is not a \s-1HASH\s0 or \s-1ARRAY\s0 element or a subroutine" +.IX Subsection "%s argument is not a HASH or ARRAY element or a subroutine" +This error, thrown if an invalid argument is provided to \f(CW\*(C`exists\*(C'\fR now +correctly includes \*(L"or a subroutine\*(R". [\s-1RT\s0 #38955] +.ie n .SS "Cannot make the non-overridable builtin %s fatal" +.el .SS "Cannot make the non-overridable builtin \f(CW%s\fP fatal" +.IX Subsection "Cannot make the non-overridable builtin %s fatal" +This error in \f(CW\*(C`Fatal\*(C'\fR previously did not show the name of the builtin in +question (now represented by \f(CW%s\fR above). +.ie n .SS "Unrecognized character '%s' in column %d" +.el .SS "Unrecognized character '%s' in column \f(CW%d\fP" +.IX Subsection "Unrecognized character '%s' in column %d" +This error previously did not state the column. +.SS "Offset outside string" +.IX Subsection "Offset outside string" +This can now also be generated by a \f(CW\*(C`seek\*(C'\fR on a file handle using +\&\f(CW\*(C`PerlIO::scalar\*(C'\fR. +.SS "Invalid escape in the specified encoding in regexp; marked by <\-\- \s-1HERE\s0 in m/%s/" +.IX Subsection "Invalid escape in the specified encoding in regexp; marked by <-- HERE in m/%s/" +New error, introduced as part of the fix to \s-1RT\s0 #40641 to handle encoding +of Unicode characters in regular expression comments. +.SS "Your machine doesn't support dump/undump." +.IX Subsection "Your machine doesn't support dump/undump." +A more informative fatal error issued when calling \f(CW\*(C`dump\*(C'\fR on Win32 and +Cygwin. (Given that the purpose of \f(CW\*(C`dump\*(C'\fR is to abort with a core dump, +and core dumps can't be produced on these platforms, this is more useful than +silently exiting.) +.SH "Changed Internals" +.IX Header "Changed Internals" +The perl sources can now be compiled with a \*(C+ compiler instead of a C +compiler. A necessary implementation details is that under \*(C+, the macro +\&\f(CW\*(C`XS\*(C'\fR used to define XSUBs now includes an \f(CW\*(C`extern "C"\*(C'\fR definition. A side +effect of this is that \fB\*(C+\fR code that used the construction +.PP +.Vb 1 +\& typedef XS(SwigPerlWrapper); +.Ve +.PP +now needs to be written +.PP +.Vb 1 +\& typedef XSPROTO(SwigPerlWrapper); +.Ve +.PP +using the new \f(CW\*(C`XSPROTO\*(C'\fR macro, in order to compile. C extensions are +unaffected, although C extensions are encouraged to use \f(CW\*(C`XSPROTO\*(C'\fR too. +This change was present in the 5.10.0 release of perl, so any actively +maintained code that happened to use this construction should already have +been adapted. Code that needs changing will fail with a compilation error. +.PP +\&\f(CW\*(C`set\*(C'\fR magic on localizing/assigning to a magic variable will now only +trigger for \fIcontainer magics\fR, i.e. it will for \f(CW%ENV\fR or \f(CW%SIG\fR +but not for \f(CW$#array\fR. +.PP +The new \s-1API\s0 macro \f(CW\*(C`newSVpvs()\*(C'\fR can be used in place of constructions such as +\&\f(CW\*(C`newSVpvn("ISA", 3)\*(C'\fR. It takes a single string constant, and at C compile +time determines its length. +.PP +The new \s-1API\s0 function \f(CW\*(C`Perl_newSV_type()\*(C'\fR can be used as a more efficient +replacement of the common idiom +.PP +.Vb 2 +\& sv = newSV(0); +\& sv_upgrade(sv, type); +.Ve +.PP +Similarly \f(CW\*(C`Perl_newSVpvn_flags()\*(C'\fR can be used to combine +\&\f(CW\*(C`Perl_newSVpv()\*(C'\fR with \f(CW\*(C`Perl_sv_2mortal()\*(C'\fR or the equivalent +\&\f(CW\*(C`Perl_sv_newmortal()\*(C'\fR with \f(CW\*(C`Perl_sv_setpvn()\*(C'\fR +.PP +Two new macros \f(CW\*(C`mPUSHs()\*(C'\fR and \f(CW\*(C`mXPUSHs()\*(C'\fR are added, to make it easier to +push mortal SVs onto the stack. They were then used to fix several bugs where +values on the stack had not been mortalised. +.PP +A \f(CW\*(C`Perl_signbit()\*(C'\fR function was added to test the sign of an \f(CW\*(C`NV\*(C'\fR. It +maps to the system one when available. +.PP +\&\f(CW\*(C`Perl_av_reify()\*(C'\fR, \f(CW\*(C`Perl_lex_end()\*(C'\fR, \f(CW\*(C`Perl_mod()\*(C'\fR, \f(CW\*(C`Perl_op_clear()\*(C'\fR, +\&\f(CW\*(C`Perl_pop_return()\*(C'\fR, \f(CW\*(C`Perl_qerror()\*(C'\fR, \f(CW\*(C`Perl_setdefout()\*(C'\fR, +\&\f(CW\*(C`Perl_vivify_defelem()\*(C'\fR and \f(CW\*(C`Perl_yylex()\*(C'\fR are now visible to extensions. +This was required to allow \f(CW\*(C`Data::Alias\*(C'\fR to work on Windows. +.PP +\&\f(CW\*(C`Perl_find_runcv()\*(C'\fR is now visible to perl core extensions. This was required +to allow \f(CW\*(C`Sub::Current\*(C'\fR to work on Windows. +.PP +\&\f(CW\*(C`ptr_table*\*(C'\fR functions are now available in unthreaded perl. \f(CW\*(C`Storable\*(C'\fR +takes advantage of this. +.PP +There have been many small cleanups made to the internals. In particular, +\&\f(CW\*(C`Perl_sv_upgrade()\*(C'\fR has been simplified considerably, with a straight-through +code path that uses \f(CW\*(C`memset()\*(C'\fR and \f(CW\*(C`memcpy()\*(C'\fR to initialise the new body, +rather than assignment via multiple temporary variables. It has also +benefited from simplification and de-duplication of the arena management +code. +.PP +A lot of small improvements in the code base were made due to reports from +the Coverity static code analyzer. +.PP +Corrected use and documentation of \f(CW\*(C`Perl_gv_stashpv()\*(C'\fR, \f(CW\*(C`Perl_gv_stashpvn()\*(C'\fR, +\&\f(CW\*(C`Perl_gv_stashsv()\*(C'\fR functions (last parameter is a bitmask, not boolean). +.PP +\&\f(CW\*(C`PERL_SYS_INIT\*(C'\fR, \f(CW\*(C`PERL_SYS_INIT3\*(C'\fR and \f(CW\*(C`PERL_SYS_TERM\*(C'\fR macros have been +changed into functions. +.PP +\&\f(CW\*(C`PERLSYS_TERM\*(C'\fR no longer requires a context. \f(CW\*(C`PerlIO_teardown()\*(C'\fR +is now called without a context, and debugging output in this function has +been disabled because that required that an interpreter was present, an invalid +assumption at termination time. +.PP +All compile time options which affect binary compatibility have been grouped +together into a global variable (\f(CW\*(C`PL_bincompat_options\*(C'\fR). +.PP +The values of \f(CW\*(C`PERL_REVISION\*(C'\fR, \f(CW\*(C`PERL_VERSION\*(C'\fR and \f(CW\*(C`PERL_SUBVERSION\*(C'\fR are +now baked into global variables (and hence into any shared perl library). +Additionally under \f(CW\*(C`MULTIPLICITY\*(C'\fR, the perl executable now records the size of +the interpreter structure (total, and for this version). Coupled with +\&\f(CW\*(C`PL_bincompat_options\*(C'\fR this will allow 5.8.10 (and later), when compiled with a +shared perl library, to perform sanity checks in \f(CW\*(C`main()\*(C'\fR to verify that the +shared library is indeed binary compatible. +.PP +Symbolic references can now have embedded NULs. The new public function +\&\f(CW\*(C`Perl_get_cvn_flags()\*(C'\fR can be used in extensions if you have to handle them. +.SS "Macro cleanups" +.IX Subsection "Macro cleanups" +The core code, and \s-1XS\s0 code in \fIext\fR that is not dual-lived on \s-1CPAN,\s0 no longer +uses the macros \f(CW\*(C`PL_na\*(C'\fR, \f(CW\*(C`NEWSV()\*(C'\fR, \f(CW\*(C`Null()\*(C'\fR, \f(CW\*(C`Nullav\*(C'\fR, \f(CW\*(C`Nullcv\*(C'\fR, +\&\f(CW\*(C`Nullhv\*(C'\fR, \f(CW\*(C`Nullhv\*(C'\fR \fIetc\fR. Their use is discouraged in new code, +particularly \f(CW\*(C`PL_na\*(C'\fR, which is a small performance hit. +.SH "New Tests" +.IX Header "New Tests" +Many modules updated from \s-1CPAN\s0 incorporate new tests. Some core specific +tests have been added: +.IP "ext/DynaLoader/t/DynaLoader.t" 4 +.IX Item "ext/DynaLoader/t/DynaLoader.t" +Tests for the \f(CW\*(C`DynaLoader\*(C'\fR module. +.IP "t/comp/fold.t" 4 +.IX Item "t/comp/fold.t" +Tests for compile-time constant folding. +.IP "t/io/pvbm.t" 4 +.IX Item "t/io/pvbm.t" +Tests incorporated from 5.10.0 which check that there is no unexpected +interaction between the internal types \f(CW\*(C`PVBM\*(C'\fR and \f(CW\*(C`PVGV\*(C'\fR. +.IP "t/lib/proxy_constant_subs.t" 4 +.IX Item "t/lib/proxy_constant_subs.t" +Tests for the new form of constant subroutines. +.IP "t/op/attrhand.t" 4 +.IX Item "t/op/attrhand.t" +Tests for \f(CW\*(C`Attribute::Handlers\*(C'\fR. +.IP "t/op/dbm.t" 4 +.IX Item "t/op/dbm.t" +Tests for \f(CW\*(C`dbmopen\*(C'\fR. +.IP "t/op/inccode\-tie.t" 4 +.IX Item "t/op/inccode-tie.t" +Calls all tests in \fIt/op/inccode.t\fR after first tying \f(CW@INC\fR. +.IP "t/op/incfilter.t" 4 +.IX Item "t/op/incfilter.t" +Tests for source filters returned from code references in \f(CW@INC\fR. +.IP "t/op/kill0.t" 4 +.IX Item "t/op/kill0.t" +Tests for \s-1RT\s0 #30970. +.IP "t/op/qrstack.t" 4 +.IX Item "t/op/qrstack.t" +Tests for \s-1RT\s0 #41484. +.IP "t/op/qr.t" 4 +.IX Item "t/op/qr.t" +Tests for the \f(CW\*(C`qr//\*(C'\fR construct. +.IP "t/op/regexp_qr_embed.t" 4 +.IX Item "t/op/regexp_qr_embed.t" +Tests for the \f(CW\*(C`qr//\*(C'\fR construct within another regexp. +.IP "t/op/regexp_qr.t" 4 +.IX Item "t/op/regexp_qr.t" +Tests for the \f(CW\*(C`qr//\*(C'\fR construct. +.IP "t/op/rxcode.t" 4 +.IX Item "t/op/rxcode.t" +Tests for \s-1RT\s0 #32840. +.IP "t/op/studytied.t" 4 +.IX Item "t/op/studytied.t" +Tests for \f(CW\*(C`study\*(C'\fR on tied scalars. +.IP "t/op/substT.t" 4 +.IX Item "t/op/substT.t" +Tests for \f(CW\*(C`subst\*(C'\fR run under \f(CW\*(C`\-T\*(C'\fR mode. +.IP "t/op/symbolcache.t" 4 +.IX Item "t/op/symbolcache.t" +Tests for \f(CW\*(C`undef\*(C'\fR and \f(CW\*(C`delete\*(C'\fR on stash entries that are bound to +subroutines or methods. +.IP "t/op/upgrade.t" 4 +.IX Item "t/op/upgrade.t" +Tests for \f(CW\*(C`Perl_sv_upgrade()\*(C'\fR. +.IP "t/mro/package_aliases.t" 4 +.IX Item "t/mro/package_aliases.t" +\&\s-1MRO\s0 tests for \f(CW\*(C`isa\*(C'\fR and package aliases. +.IP "t/pod/twice.t" 4 +.IX Item "t/pod/twice.t" +Tests for calling \f(CW\*(C`Pod::Parser\*(C'\fR twice. +.IP "t/run/cloexec.t" 4 +.IX Item "t/run/cloexec.t" +Tests for inheriting file descriptors across \f(CW\*(C`exec\*(C'\fR (close-on-exec). +.IP "t/uni/cache.t" 4 +.IX Item "t/uni/cache.t" +Tests for the \s-1UTF\-8\s0 caching code. +.IP "t/uni/chr.t" 4 +.IX Item "t/uni/chr.t" +Test that strange encodings do not upset \f(CW\*(C`Perl_pp_chr()\*(C'\fR. +.IP "t/uni/greek.t" 4 +.IX Item "t/uni/greek.t" +Tests for \s-1RT\s0 #40641. +.IP "t/uni/latin2.t" 4 +.IX Item "t/uni/latin2.t" +Tests for \s-1RT\s0 #40641. +.IP "t/uni/overload.t" 4 +.IX Item "t/uni/overload.t" +Tests for returning Unicode from overloaded values. +.IP "t/uni/tie.t" 4 +.IX Item "t/uni/tie.t" +Tests for returning Unicode from tied variables. +.SH "Known Problems" +.IX Header "Known Problems" +There are no known new bugs. +.PP +However, programs that rely on bugs that have been fixed will have problems. +Also, many bug fixes present in 5.10.0 can't be back-ported to the 5.8.x +branch, because they require changes that are binary incompatible, or because +the code changes are too large and hence too risky to incorporate. +.PP +We have only limited volunteer labour, and the maintenance burden is +getting increasingly complex. Hence this will be the last significant +release of the 5.8.x series. Any future releases of 5.8.x will likely +only be to deal with security issues, and platform build +failures. Hence you should look to migrating to 5.10.x, if you have +not started already. Alternatively, if business requirements constrain +you to continue to use 5.8.x, you may wish to consider commercial +support from firms such as ActiveState. +.SH "Platform Specific Notes" +.IX Header "Platform Specific Notes" +.SS "Win32" +.IX Subsection "Win32" +\&\f(CW\*(C`readdir()\*(C'\fR, \f(CW\*(C`cwd()\*(C'\fR, \f(CW$^X\fR and \f(CW@INC\fR now use the alternate (short) +filename if the long name is outside the current codepage (Jan Dubois). +.PP +\fIUpdated Modules\fR +.IX Subsection "Updated Modules" +.IP "\(bu" 4 +\&\f(CW\*(C`Win32\*(C'\fR upgraded to version 0.38. Now has a documented 'WinVista' response +from \f(CW\*(C`GetOSName\*(C'\fR and support for Vista's privilege elevation in \f(CW\*(C`IsAdminUser\*(C'\fR. +Support for Unicode characters in path names. Improved cygwin and Win64 +compatibility. +.IP "\(bu" 4 +\&\f(CW\*(C`Win32API\*(C'\fR updated to 0.1001_01 +.IP "\(bu" 4 +\&\f(CW\*(C`killpg()\*(C'\fR support added to \f(CW\*(C`MSWin32\*(C'\fR (Jan Dubois). +.IP "\(bu" 4 +\&\f(CW\*(C`File::Spec::Win32\*(C'\fR upgraded to version 3.2701 +.SS "\s-1OS/2\s0" +.IX Subsection "OS/2" +\fIUpdated Modules\fR +.IX Subsection "Updated Modules" +.IP "\(bu" 4 +\&\f(CW\*(C`OS2::Process\*(C'\fR upgraded to 1.03 +.Sp +Ilya Zakharevich has added and documented several \f(CW\*(C`Window*\*(C'\fR and \f(CW\*(C`Clipbrd*\*(C'\fR +functions. +.IP "\(bu" 4 +\&\f(CW\*(C`OS2::REXX::DLL\*(C'\fR, \f(CW\*(C`OS2::REXX\*(C'\fR updated to version 1.03 +.SS "\s-1VMS\s0" +.IX Subsection "VMS" +\fIUpdated Modules\fR +.IX Subsection "Updated Modules" +.IP "\(bu" 4 +\&\f(CW\*(C`DCLsym\*(C'\fR upgraded to version 1.03 +.IP "\(bu" 4 +\&\f(CW\*(C`Stdio\*(C'\fR upgraded to version 2.4 +.IP "\(bu" 4 +\&\f(CW\*(C`VMS::XSSymSet\*(C'\fR upgraded to 1.1. +.SH "Obituary" +.IX Header "Obituary" +Nick Ing-Simmons, long time Perl hacker, author of the \f(CW\*(C`Tk\*(C'\fR and \f(CW\*(C`Encode\*(C'\fR +modules, \fIperlio.c\fR in the core, and 5.003_02 pumpking, died of a heart +attack on 25th September 2006. He will be missed. +.SH "Acknowledgements" +.IX Header "Acknowledgements" +Some of the work in this release was funded by a \s-1TPF\s0 grant. +.PP +Steve Hay worked behind the scenes working out the causes of the differences +between core modules, their \s-1CPAN\s0 releases, and previous core releases, and +the best way to rectify them. He doesn't want to do it again. I know this +feeling, and I'm very glad he did it this time, instead of me. +.PP +Paul Fenwick assembled a team of 18 volunteers, who broke the back of writing +this document. In particular, Bradley Dean, Eddy Tan, and Vincent Pit +provided half the team's contribution. +.PP +Schwern verified the list of updated module versions, correcting quite a few +errors that I (and everyone else) had missed, both wrongly stated module +versions, and changed modules that had not been listed. +.PP +The crack Berlin-based \s-1QA\s0 team of Andreas Ko\*:nig and Slaven Rezic +tirelessly re-built snapshots, tested most everything \s-1CPAN\s0 against +them, and then identified the changes responsible for any module regressions, +ensuring that several show-stopper bugs were stomped before the first release +candidate was cut. +.PP +The other core committers contributed most of the changes, and applied most +of the patches sent in by the hundreds of contributors listed in \fI\s-1AUTHORS\s0\fR. +.PP +And obviously, Larry Wall, without whom we wouldn't have Perl. +.SH "Reporting Bugs" +.IX Header "Reporting Bugs" +If you find what you think is a bug, you might check the articles +recently posted to the comp.lang.perl.misc newsgroup and the perl +bug database at http://bugs.perl.org. There may also be +information at http://www.perl.org, the Perl Home Page. +.PP +If you believe you have an unreported bug, please run the \fBperlbug\fR +program included with your release. Be sure to trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of \f(CW\*(C`perl \-V\*(C'\fR, will be sent off to perlbug@perl.org to be +analysed by the Perl porting team. You can browse and search +the Perl 5 bugs at http://bugs.perl.org/ +.PP +If the bug you are reporting has security implications, which make it +inappropriate to send to a publicly archived mailing list, then please send +it to perl5\-security\-report@perl.org. This points to a closed subscription +unarchived mailing list, which includes +all the core committers, who will be able +to help assess the impact of issues, figure out a resolution, and help +co-ordinate the release of patches to mitigate or fix the problem across all +platforms on which Perl is supported. Please only use this address for security +issues in the Perl core, not for modules independently distributed on \s-1CPAN.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +The \fIChanges\fR file for exhaustive details on what changed. +.PP +The \fI\s-1INSTALL\s0\fR file for how to build Perl. +.PP +The \fI\s-1README\s0\fR file for general stuff. +.PP +The \fIArtistic\fR and \fICopying\fR files for copyright information. diff --git a/data/miniconda3/man/man1/perlaix.1 b/data/miniconda3/man/man1/perlaix.1 new file mode 100644 index 0000000000000000000000000000000000000000..177a86300c214389d4cb32f480f8839218acee1a --- /dev/null +++ b/data/miniconda3/man/man1/perlaix.1 @@ -0,0 +1,665 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLAIX 1" +.TH PERLAIX 1 "2020-12-18" "perl v5.32.1" "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" +perlaix \- Perl version 5 on IBM AIX (UNIX) systems +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes various features of \s-1IBM\s0's \s-1UNIX\s0 operating +system \s-1AIX\s0 that will affect how Perl version 5 (hereafter just Perl) +is compiled and/or runs. +.SS "Compiling Perl 5 on \s-1AIX\s0" +.IX Subsection "Compiling Perl 5 on AIX" +For information on compilers on older versions of \s-1AIX,\s0 see \*(L"Compiling +Perl 5 on older \s-1AIX\s0 versions up to 4.3.3\*(R". +.PP +When compiling Perl, you must use an \s-1ANSI C\s0 compiler. \s-1AIX\s0 does not ship +an \s-1ANSI\s0 compliant C compiler with \s-1AIX\s0 by default, but binary builds of +gcc for \s-1AIX\s0 are widely available. A version of gcc is also included in +the \s-1AIX\s0 Toolbox which is shipped with \s-1AIX.\s0 +.SS "Supported Compilers" +.IX Subsection "Supported Compilers" +Currently all versions of \s-1IBM\s0's \*(L"xlc\*(R", \*(L"xlc_r\*(R", \*(L"cc\*(R", \*(L"cc_r\*(R" or +\&\*(L"vac\*(R" \s-1ANSI/C\s0 compiler will work for building Perl if that compiler +works on your system. +.PP +If you plan to link Perl to any module that requires thread-support, +like DBD::Oracle, it is better to use the _r version of the compiler. +This will not build a threaded Perl, but a thread-enabled Perl. See +also \*(L"Threaded Perl\*(R" later on. +.PP +As of writing (2010\-09) only the \fI\s-1IBM XL C\s0 for \s-1AIX\s0\fR or \fI\s-1IBM XL C/\*(C+\s0 +for \s-1AIX\s0\fR compiler is supported by \s-1IBM\s0 on \s-1AIX 5L/6.1/7.1.\s0 +.PP +The following compiler versions are currently supported by \s-1IBM:\s0 +.PP +.Vb 1 +\& IBM XL C and IBM XL C/C++ V8, V9, V10, V11 +.Ve +.PP +The \s-1XL C\s0 for \s-1AIX\s0 is integrated in the \s-1XL C/\*(C+\s0 for \s-1AIX\s0 compiler and +therefore also supported. +.PP +If you choose \s-1XL C/\*(C+ V9\s0 you need \s-1APAR IZ35785\s0 installed +otherwise the integrated SDBM_File do not compile correctly due +to an optimization bug. You can circumvent this problem by +adding \-qipa to the optimization flags (\-Doptimize='\-O \-qipa'). +The \s-1PTF\s0 for \s-1APAR IZ35785\s0 which solves this problem is available +from \s-1IBM\s0 (April 2009 \s-1PTF\s0 for \s-1XL C/\*(C+\s0 Enterprise Edition for \s-1AIX, V9.0\s0). +.PP +If you choose \s-1XL C/\*(C+ V11\s0 you need the April 2010 \s-1PTF\s0 (or newer) +installed otherwise you will not get a working Perl version. +.PP +Perl can be compiled with either \s-1IBM\s0's \s-1ANSI C\s0 compiler or with gcc. +The former is recommended, as not only it can compile Perl with no +difficulty, but also can take advantage of features listed later +that require the use of \s-1IBM\s0 compiler-specific command-line flags. +.PP +If you decide to use gcc, make sure your installation is recent and +complete, and be sure to read the Perl \s-1INSTALL\s0 file for more gcc-specific +details. Please report any hoops you had to jump through to the +development team. +.SS "Incompatibility with \s-1AIX\s0 Toolbox lib gdbm" +.IX Subsection "Incompatibility with AIX Toolbox lib gdbm" +If the \s-1AIX\s0 Toolbox version of lib gdbm < 1.8.3\-5 is installed on your +system then Perl will not work. This library contains the header files +/opt/freeware/include/gdbm/dbm.h|ndbm.h which conflict with the \s-1AIX\s0 +system versions. The lib gdbm will be automatically removed from the +wanted libraries if the presence of one of these two header files is +detected. If you want to build Perl with \s-1GDBM\s0 support then please install +at least gdbm\-devel\-1.8.3\-5 (or higher). +.SS "Perl 5 was successfully compiled and tested on:" +.IX Subsection "Perl 5 was successfully compiled and tested on:" +.Vb 10 +\& Perl | AIX Level | Compiler Level | w th | w/o th +\& \-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-\- +\& 5.12.2 |5.1 TL9 32 bit | XL C/C++ V7 | OK | OK +\& 5.12.2 |5.1 TL9 64 bit | XL C/C++ V7 | OK | OK +\& 5.12.2 |5.2 TL10 SP8 32 bit | XL C/C++ V8 | OK | OK +\& 5.12.2 |5.2 TL10 SP8 32 bit | gcc 3.2.2 | OK | OK +\& 5.12.2 |5.2 TL10 SP8 64 bit | XL C/C++ V8 | OK | OK +\& 5.12.2 |5.3 TL8 SP8 32 bit | XL C/C++ V9 + IZ35785 | OK | OK +\& 5.12.2 |5.3 TL8 SP8 32 bit | gcc 4.2.4 | OK | OK +\& 5.12.2 |5.3 TL8 SP8 64 bit | XL C/C++ V9 + IZ35785 | OK | OK +\& 5.12.2 |5.3 TL10 SP3 32 bit | XL C/C++ V11 + Apr 2010 | OK | OK +\& 5.12.2 |5.3 TL10 SP3 64 bit | XL C/C++ V11 + Apr 2010 | OK | OK +\& 5.12.2 |6.1 TL1 SP7 32 bit | XL C/C++ V10 | OK | OK +\& 5.12.2 |6.1 TL1 SP7 64 bit | XL C/C++ V10 | OK | OK +\& 5.13 |7.1 TL0 SP1 32 bit | XL C/C++ V11 + Jul 2010 | OK | OK +\& 5.13 |7.1 TL0 SP1 64 bit | XL C/C++ V11 + Jul 2010 | OK | OK +\& +\& w th = with thread support +\& w/o th = without thread support +\& OK = tested +.Ve +.PP +Successfully tested means that all \*(L"make test\*(R" runs finish with a +result of 100% \s-1OK.\s0 All tests were conducted with \-Duseshrplib set. +.PP +All tests were conducted on the oldest supported \s-1AIX\s0 technology level +with the latest support package applied. If the tested \s-1AIX\s0 version is +out of support (\s-1AIX 4.3.3, 5.1, 5.2\s0) then the last available support +level was used. +.SS "Building Dynamic Extensions on \s-1AIX\s0" +.IX Subsection "Building Dynamic Extensions on AIX" +Starting from Perl 5.7.2 (and consequently 5.8.x / 5.10.x / 5.12.x) +and \s-1AIX 4.3\s0 or newer Perl uses the \s-1AIX\s0 native dynamic loading interface +in the so called runtime linking mode instead of the emulated interface +that was used in Perl releases 5.6.1 and earlier or, for \s-1AIX\s0 releases +4.2 and earlier. This change does break backward compatibility with +compiled modules from earlier Perl releases. The change was made to make +Perl more compliant with other applications like Apache/mod_perl which are +using the \s-1AIX\s0 native interface. This change also enables the use of +\&\*(C+ code with static constructors and destructors in Perl extensions, +which was not possible using the emulated interface. +.PP +It is highly recommended to use the new interface. +.SS "Using Large Files with Perl" +.IX Subsection "Using Large Files with Perl" +Should yield no problems. +.SS "Threaded Perl" +.IX Subsection "Threaded Perl" +Should yield no problems with \s-1AIX 5.1 / 5.2 / 5.3 / 6.1 / 7.1.\s0 +.PP +\&\s-1IBM\s0 uses the \s-1AIX\s0 system Perl (V5.6.0 on \s-1AIX 5.1\s0 and V5.8.2 on +\&\s-1AIX 5.2 / 5.3\s0 and 6.1; V5.8.8 on \s-1AIX 5.3 TL11\s0 and \s-1AIX 6.1 TL4\s0; V5.10.1 +on \s-1AIX 7.1\s0) for some \s-1AIX\s0 system scripts. If you switch the links in +/usr/bin from the \s-1AIX\s0 system Perl (/usr/opt/perl5) to the newly build +Perl then you get the same features as with the \s-1IBM AIX\s0 system Perl if +the threaded options are used. +.PP +The threaded Perl build works also on \s-1AIX 5.1\s0 but the \s-1IBM\s0 Perl +build (Perl v5.6.0) is not threaded on \s-1AIX 5.1.\s0 +.PP +Perl 5.12 an newer is not compatible with the \s-1IBM\s0 fileset perl.libext. +.SS "64\-bit Perl" +.IX Subsection "64-bit Perl" +If your \s-1AIX\s0 system is installed with 64\-bit support, you can expect 64\-bit +configurations to work. If you want to use 64\-bit Perl on \s-1AIX 6.1\s0 +you need an \s-1APAR\s0 for a libc.a bug which affects (n)dbm_XXX functions. +The \s-1APAR\s0 number for this problem is \s-1IZ39077.\s0 +.PP +If you need more memory (larger data segment) for your Perl programs you +can set: +.PP +.Vb 3 +\& /etc/security/limits +\& default: (or your user) +\& data = \-1 (default is 262144 * 512 byte) +.Ve +.PP +With the default setting the size is limited to 128MB. +The \-1 removes this limit. If the \*(L"make test\*(R" fails please change +your /etc/security/limits as stated above. +.SS "Long doubles" +.IX Subsection "Long doubles" +\&\s-1IBM\s0 calls its implementation of long doubles 128\-bit, but it is not +the \s-1IEEE\s0 128\-bit (\*(L"quadruple precision\*(R") which would give 116 bit of +mantissa (nor it is implemented in hardware), instead it's a special +software implementation called \*(L"double-double\*(R", which gives 106 bits +of mantissa. +.PP +There seem to be various problems in this long double implementation. +If Configure detects this brokenness, it will disable the long double support. +This can be overridden with explicit \f(CW\*(C`\-Duselongdouble\*(C'\fR (or \f(CW\*(C`\-Dusemorebits\*(C'\fR, +which enables both long doubles and 64 bit integers). If you decide to +enable long doubles, for most of the broken things Perl has implemented +workarounds, but the handling of the special values infinity and NaN +remains badly broken: for example infinity plus zero results in NaN. +.SS "Recommended Options \s-1AIX 5.1/5.2/5.3/6.1\s0 and 7.1 (threaded/32\-bit)" +.IX Subsection "Recommended Options AIX 5.1/5.2/5.3/6.1 and 7.1 (threaded/32-bit)" +With the following options you get a threaded Perl version which +passes all make tests in threaded 32\-bit mode, which is the default +configuration for the Perl builds that \s-1AIX\s0 ships with. +.PP +.Vb 7 +\& rm config.sh +\& ./Configure \e +\& \-d \e +\& \-Dcc=cc_r \e +\& \-Duseshrplib \e +\& \-Dusethreads \e +\& \-Dprefix=/usr/opt/perl5_32 +.Ve +.PP +The \-Dprefix option will install Perl in a directory parallel to the +\&\s-1IBM AIX\s0 system Perl installation. +.SS "Recommended Options \s-1AIX 5.1/5.2/5.3/6.1\s0 and 7.1 (32\-bit)" +.IX Subsection "Recommended Options AIX 5.1/5.2/5.3/6.1 and 7.1 (32-bit)" +With the following options you get a Perl version which passes +all make tests in 32\-bit mode. +.PP +.Vb 6 +\& rm config.sh +\& ./Configure \e +\& \-d \e +\& \-Dcc=cc_r \e +\& \-Duseshrplib \e +\& \-Dprefix=/usr/opt/perl5_32 +.Ve +.PP +The \-Dprefix option will install Perl in a directory parallel to the +\&\s-1IBM AIX\s0 system Perl installation. +.SS "Recommended Options \s-1AIX 5.1/5.2/5.3/6.1\s0 and 7.1 (threaded/64\-bit)" +.IX Subsection "Recommended Options AIX 5.1/5.2/5.3/6.1 and 7.1 (threaded/64-bit)" +With the following options you get a threaded Perl version which +passes all make tests in 64\-bit mode. +.PP +.Vb 1 +\& export OBJECT_MODE=64 / setenv OBJECT_MODE 64 (depending on your shell) +\& +\& rm config.sh +\& ./Configure \e +\& \-d \e +\& \-Dcc=cc_r \e +\& \-Duseshrplib \e +\& \-Dusethreads \e +\& \-Duse64bitall \e +\& \-Dprefix=/usr/opt/perl5_64 +.Ve +.SS "Recommended Options \s-1AIX 5.1/5.2/5.3/6.1\s0 and 7.1 (64\-bit)" +.IX Subsection "Recommended Options AIX 5.1/5.2/5.3/6.1 and 7.1 (64-bit)" +With the following options you get a Perl version which passes all +make tests in 64\-bit mode. +.PP +.Vb 1 +\& export OBJECT_MODE=64 / setenv OBJECT_MODE 64 (depending on your shell) +\& +\& rm config.sh +\& ./Configure \e +\& \-d \e +\& \-Dcc=cc_r \e +\& \-Duseshrplib \e +\& \-Duse64bitall \e +\& \-Dprefix=/usr/opt/perl5_64 +.Ve +.PP +The \-Dprefix option will install Perl in a directory parallel to the +\&\s-1IBM AIX\s0 system Perl installation. +.PP +If you choose gcc to compile 64\-bit Perl then you need to add the +following option: +.PP +.Vb 1 +\& \-Dcc=\*(Aqgcc \-maix64\*(Aq +.Ve +.SS "Compiling Perl 5 on \s-1AIX 7.1.0\s0" +.IX Subsection "Compiling Perl 5 on AIX 7.1.0" +A regression in \s-1AIX 7\s0 causes a failure in make test in Time::Piece during +daylight savings time. \s-1APAR IV16514\s0 provides the fix for this. A quick +test to see if it's required, assuming it is currently daylight savings +in Eastern Time, would be to run \f(CW\*(C` TZ=EST5 date +%Z \*(C'\fR. This will come +back with \f(CW\*(C`EST\*(C'\fR normally, but nothing if you have the problem. +.SS "Compiling Perl 5 on older \s-1AIX\s0 versions up to 4.3.3" +.IX Subsection "Compiling Perl 5 on older AIX versions up to 4.3.3" +Due to the fact that \s-1AIX 4.3.3\s0 reached end-of-service in December 31, +2003 this information is provided as is. The Perl versions prior to +Perl 5.8.9 could be compiled on \s-1AIX\s0 up to 4.3.3 with the following +settings (your mileage may vary): +.PP +When compiling Perl, you must use an \s-1ANSI C\s0 compiler. \s-1AIX\s0 does not ship +an \s-1ANSI\s0 compliant C\-compiler with \s-1AIX\s0 by default, but binary builds of +gcc for \s-1AIX\s0 are widely available. +.PP +At the moment of writing, \s-1AIX\s0 supports two different native C compilers, +for which you have to pay: \fBxlC\fR and \fBvac\fR. If you decide to use either +of these two (which is quite a lot easier than using gcc), be sure to +upgrade to the latest available patch level. Currently: +.PP +.Vb 2 +\& xlC.C 3.1.4.10 or 3.6.6.0 or 4.0.2.2 or 5.0.2.9 or 6.0.0.3 +\& vac.C 4.4.0.3 or 5.0.2.6 or 6.0.0.1 +.Ve +.PP +note that xlC has the \s-1OS\s0 version in the name as of version 4.0.2.0, so +you will find xlC.C for \s-1AIX\-5.0\s0 as package +.PP +.Vb 1 +\& xlC.aix50.rte 5.0.2.0 or 6.0.0.3 +.Ve +.PP +subversions are not the same \*(L"latest\*(R" on all \s-1OS\s0 versions. For example, +the latest xlC\-5 on aix41 is 5.0.2.9, while on aix43, it is 5.0.2.7. +.PP +Perl can be compiled with either \s-1IBM\s0's \s-1ANSI C\s0 compiler or with gcc. +The former is recommended, as not only can it compile Perl with no +difficulty, but also can take advantage of features listed later that +require the use of \s-1IBM\s0 compiler-specific command-line flags. +.PP +The \s-1IBM\s0's compiler patch levels 5.0.0.0 and 5.0.1.0 have compiler +optimization bugs that affect compiling perl.c and regcomp.c, +respectively. If Perl's configuration detects those compiler patch +levels, optimization is turned off for the said source code files. +Upgrading to at least 5.0.2.0 is recommended. +.PP +If you decide to use gcc, make sure your installation is recent and +complete, and be sure to read the Perl \s-1INSTALL\s0 file for more gcc-specific +details. Please report any hoops you had to jump through to the development +team. +.SS "\s-1OS\s0 level" +.IX Subsection "OS level" +Before installing the patches to the \s-1IBM\s0 C\-compiler you need to know the +level of patching for the Operating System. \s-1IBM\s0's command 'oslevel' will +show the base, but is not always complete (in this example oslevel shows +4.3.NULL, whereas the system might run most of 4.3.THREE): +.PP +.Vb 6 +\& # oslevel +\& 4.3.0.0 +\& # lslpp \-l | grep \*(Aqbos.rte \*(Aq +\& bos.rte 4.3.3.75 COMMITTED Base Operating System Runtime +\& bos.rte 4.3.2.0 COMMITTED Base Operating System Runtime +\& # +.Ve +.PP +The same might happen to \s-1AIX 5.1\s0 or other \s-1OS\s0 levels. As a side note, Perl +cannot be built without bos.adt.syscalls and bos.adt.libm installed +.PP +.Vb 4 +\& # lslpp \-l | egrep "syscalls|libm" +\& bos.adt.libm 5.1.0.25 COMMITTED Base Application Development +\& bos.adt.syscalls 5.1.0.36 COMMITTED System Calls Application +\& # +.Ve +.SS "Building Dynamic Extensions on \s-1AIX\s0 < 5L" +.IX Subsection "Building Dynamic Extensions on AIX < 5L" +\&\s-1AIX\s0 supports dynamically loadable objects as well as shared libraries. +Shared libraries by convention end with the suffix .a, which is a bit +misleading, as an archive can contain static as well as dynamic members. +For Perl dynamically loaded objects we use the .so suffix also used on +many other platforms. +.PP +Note that starting from Perl 5.7.2 (and consequently 5.8.0) and \s-1AIX 4.3\s0 +or newer Perl uses the \s-1AIX\s0 native dynamic loading interface in the so +called runtime linking mode instead of the emulated interface that was +used in Perl releases 5.6.1 and earlier or, for \s-1AIX\s0 releases 4.2 and +earlier. This change does break backward compatibility with compiled +modules from earlier Perl releases. The change was made to make Perl +more compliant with other applications like Apache/mod_perl which are +using the \s-1AIX\s0 native interface. This change also enables the use of \*(C+ +code with static constructors and destructors in Perl extensions, which +was not possible using the emulated interface. +.SS "The \s-1IBM ANSI C\s0 Compiler" +.IX Subsection "The IBM ANSI C Compiler" +All defaults for Configure can be used. +.PP +If you've chosen to use vac 4, be sure to run 4.4.0.3. Older versions +will turn up nasty later on. For vac 5 be sure to run at least 5.0.1.0, +but vac 5.0.2.6 or up is highly recommended. Note that since \s-1IBM\s0 has +removed vac 5.0.2.1 through 5.0.2.5 from the software depot, these +versions should be considered obsolete. +.PP +Here's a brief lead of how to upgrade the compiler to the latest +level. Of course this is subject to changes. You can only upgrade +versions from ftp-available updates if the first three digit groups +are the same (in where you can skip intermediate unlike the patches +in the developer snapshots of Perl), or to one version up where the +\&\*(L"base\*(R" is available. In other words, the \s-1AIX\s0 compiler patches are +cumulative. +.PP +.Vb 3 +\& vac.C.4.4.0.1 => vac.C.4.4.0.3 is OK (vac.C.4.4.0.2 not needed) +\& xlC.C.3.1.3.3 => xlC.C.3.1.4.10 is NOT OK (xlC.C.3.1.4.0 is not +\& available) +\& +\& # ftp ftp.software.ibm.com +\& Connected to service.boulder.ibm.com. +\& : welcome message ... +\& Name (ftp.software.ibm.com:merijn): anonymous +\& 331 Guest login ok, send your complete e\-mail address as password. +\& Password: +\& ... accepted login stuff +\& ftp> cd /aix/fixes/v4/ +\& ftp> dir other other.ll +\& output to local\-file: other.ll? y +\& 200 PORT command successful. +\& 150 Opening ASCII mode data connection for /bin/ls. +\& 226 Transfer complete. +\& ftp> dir xlc xlc.ll +\& output to local\-file: xlc.ll? y +\& 200 PORT command successful. +\& 150 Opening ASCII mode data connection for /bin/ls. +\& 226 Transfer complete. +\& ftp> bye +\& ... goodbye messages +\& # ls \-l *.ll +\& \-rw\-rw\-rw\- 1 merijn system 1169432 Nov 2 17:29 other.ll +\& \-rw\-rw\-rw\- 1 merijn system 29170 Nov 2 17:29 xlc.ll +.Ve +.PP +On \s-1AIX 4.2\s0 using xlC, we continue: +.PP +.Vb 10 +\& # lslpp \-l | fgrep \*(AqxlC.C \*(Aq +\& xlC.C 3.1.4.9 COMMITTED C for AIX Compiler +\& xlC.C 3.1.4.0 COMMITTED C for AIX Compiler +\& # grep \*(AqxlC.C.3.1.4.*.bff\*(Aq xlc.ll +\& \-rw\-r\-\-r\-\- 1 45776101 1 6286336 Jul 22 1996 xlC.C.3.1.4.1.bff +\& \-rw\-rw\-r\-\- 1 45776101 1 6173696 Aug 24 1998 xlC.C.3.1.4.10.bff +\& \-rw\-r\-\-r\-\- 1 45776101 1 6319104 Aug 14 1996 xlC.C.3.1.4.2.bff +\& \-rw\-r\-\-r\-\- 1 45776101 1 6316032 Oct 21 1996 xlC.C.3.1.4.3.bff +\& \-rw\-r\-\-r\-\- 1 45776101 1 6315008 Dec 20 1996 xlC.C.3.1.4.4.bff +\& \-rw\-rw\-r\-\- 1 45776101 1 6178816 Mar 28 1997 xlC.C.3.1.4.5.bff +\& \-rw\-rw\-r\-\- 1 45776101 1 6188032 May 22 1997 xlC.C.3.1.4.6.bff +\& \-rw\-rw\-r\-\- 1 45776101 1 6191104 Sep 5 1997 xlC.C.3.1.4.7.bff +\& \-rw\-rw\-r\-\- 1 45776101 1 6185984 Jan 13 1998 xlC.C.3.1.4.8.bff +\& \-rw\-rw\-r\-\- 1 45776101 1 6169600 May 27 1998 xlC.C.3.1.4.9.bff +\& # wget ftp://ftp.software.ibm.com/aix/fixes/v4/xlc/xlC.C.3.1.4.10.bff +\& # +.Ve +.PP +On \s-1AIX 4.3\s0 using vac, we continue: +.PP +.Vb 10 +\& # lslpp \-l | grep \*(Aqvac.C \*(Aq +\& vac.C 5.0.2.2 COMMITTED C for AIX Compiler +\& vac.C 5.0.2.0 COMMITTED C for AIX Compiler +\& # grep \*(Aqvac.C.5.0.2.*.bff\*(Aq other.ll +\& \-rw\-rw\-r\-\- 1 45776101 1 13592576 Apr 16 2001 vac.C.5.0.2.0.bff +\& \-rw\-rw\-r\-\- 1 45776101 1 14133248 Apr 9 2002 vac.C.5.0.2.3.bff +\& \-rw\-rw\-r\-\- 1 45776101 1 14173184 May 20 2002 vac.C.5.0.2.4.bff +\& \-rw\-rw\-r\-\- 1 45776101 1 14192640 Nov 22 2002 vac.C.5.0.2.6.bff +\& # wget ftp://ftp.software.ibm.com/aix/fixes/v4/other/vac.C.5.0.2.6.bff +\& # +.Ve +.PP +Likewise on all other \s-1OS\s0 levels. Then execute the following command, and +fill in its choices +.PP +.Vb 5 +\& # smit install_update +\& \-> Install and Update from LATEST Available Software +\& * INPUT device / directory for software [ vac.C.5.0.2.6.bff ] +\& [ OK ] +\& [ OK ] +.Ve +.PP +Follow the messages ... and you're done. +.PP +If you like a more web-like approach, a good start point can be + and click +\&\*(L"C for \s-1AIX\*(R",\s0 and follow the instructions. +.SS "The usenm option" +.IX Subsection "The usenm option" +If linking miniperl +.PP +.Vb 1 +\& cc \-o miniperl ... miniperlmain.o opmini.o perl.o ... \-lm \-lc ... +.Ve +.PP +causes error like this +.PP +.Vb 9 +\& ld: 0711\-317 ERROR: Undefined symbol: .aintl +\& ld: 0711\-317 ERROR: Undefined symbol: .copysignl +\& ld: 0711\-317 ERROR: Undefined symbol: .syscall +\& ld: 0711\-317 ERROR: Undefined symbol: .eaccess +\& ld: 0711\-317 ERROR: Undefined symbol: .setresuid +\& ld: 0711\-317 ERROR: Undefined symbol: .setresgid +\& ld: 0711\-317 ERROR: Undefined symbol: .setproctitle +\& ld: 0711\-345 Use the \-bloadmap or \-bnoquiet option to obtain more +\& information. +.Ve +.PP +you could retry with +.PP +.Vb 3 +\& make realclean +\& rm config.sh +\& ./Configure \-Dusenm ... +.Ve +.PP +which makes Configure to use the \f(CW\*(C`nm\*(C'\fR tool when scanning for library +symbols, which usually is not done in \s-1AIX.\s0 +.PP +Related to this, you probably should not use the \f(CW\*(C`\-r\*(C'\fR option of +Configure in \s-1AIX,\s0 because that affects of how the \f(CW\*(C`nm\*(C'\fR tool is used. +.SS "Using \s-1GNU\s0's gcc for building Perl" +.IX Subsection "Using GNU's gcc for building Perl" +Using gcc\-3.x (tested with 3.0.4, 3.1, and 3.2) now works out of the box, +as do recent gcc\-2.9 builds available directly from \s-1IBM\s0 as part of their +Linux compatibility packages, available here: +.PP +.Vb 1 +\& http://www.ibm.com/servers/aix/products/aixos/linux/ +.Ve +.SS "Using Large Files with Perl < 5L" +.IX Subsection "Using Large Files with Perl < 5L" +Should yield no problems. +.SS "Threaded Perl < 5L" +.IX Subsection "Threaded Perl < 5L" +Threads seem to work \s-1OK,\s0 though at the moment not all tests pass when +threads are used in combination with 64\-bit configurations. +.PP +You may get a warning when doing a threaded build: +.PP +.Vb 2 +\& "pp_sys.c", line 4640.39: 1506\-280 (W) Function argument assignment +\& between types "unsigned char*" and "const void*" is not allowed. +.Ve +.PP +The exact line number may vary, but if the warning (W) comes from a line +line this +.PP +.Vb 1 +\& hent = PerlSock_gethostbyaddr(addr, (Netdb_hlen_t) addrlen, addrtype); +.Ve +.PP +in the \*(L"pp_ghostent\*(R" function, you may ignore it safely. The warning +is caused by the reentrant variant of \fBgethostbyaddr()\fR having a slightly +different prototype than its non-reentrant variant, but the difference +is not really significant here. +.SS "64\-bit Perl < 5L" +.IX Subsection "64-bit Perl < 5L" +If your \s-1AIX\s0 is installed with 64\-bit support, you can expect 64\-bit +configurations to work. In combination with threads some tests might +still fail. +.SS "\s-1AIX 4.2\s0 and extensions using \*(C+ with statics" +.IX Subsection "AIX 4.2 and extensions using with statics" +In \s-1AIX 4.2\s0 Perl extensions that use \*(C+ functions that use statics +may have problems in that the statics are not getting initialized. +In newer \s-1AIX\s0 releases this has been solved by linking Perl with +the libC_r library, but unfortunately in \s-1AIX 4.2\s0 the said library +has an obscure bug where the various functions related to time +(such as \fBtime()\fR and \fBgettimeofday()\fR) return broken values, and +therefore in \s-1AIX 4.2\s0 Perl is not linked against the libC_r. +.SH "AUTHORS" +.IX Header "AUTHORS" +Rainer Tammer diff --git a/data/miniconda3/man/man1/perlandroid.1 b/data/miniconda3/man/man1/perlandroid.1 new file mode 100644 index 0000000000000000000000000000000000000000..316196a83f5db7958fbc5153487b7ef4486dd245 --- /dev/null +++ b/data/miniconda3/man/man1/perlandroid.1 @@ -0,0 +1,352 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLANDROID 1" +.TH PERLANDROID 1 "2020-12-18" "perl v5.32.1" "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" +perlandroid \- Perl under Android +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +The first portions of this document contains instructions +to cross-compile Perl for Android 2.0 and later, using the +binaries provided by Google. The latter portions describe how to build +perl native using one of the toolchains available on the Play Store. +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes how to set up your host environment when +attempting to build Perl for Android. +.SH "Cross-compilation" +.IX Header "Cross-compilation" +These instructions assume an Unixish build environment on your host system; +they've been tested on Linux and \s-1OS X,\s0 and may work on Cygwin and \s-1MSYS.\s0 +While Google also provides an \s-1NDK\s0 for Windows, these steps won't work +native there, although it may be possible to cross-compile through different +means. +.PP +If your host system's architecture is 32 bits, remember to change the +\&\f(CW\*(C`x86_64\*(C'\fR's below to \f(CW\*(C`x86\*(C'\fR's. On a similar vein, the examples below +use the 4.8 toolchain; if you want to use something older or newer (for +example, the 4.4.3 toolchain included in the 8th revision of the \s-1NDK\s0), just +change those to the relevant version. +.SS "Get the Android Native Development Kit (\s-1NDK\s0)" +.IX Subsection "Get the Android Native Development Kit (NDK)" +You can download the \s-1NDK\s0 from . +You'll want the normal, non-legacy version. +.SS "Determine the architecture you'll be cross-compiling for" +.IX Subsection "Determine the architecture you'll be cross-compiling for" +There's three possible options: arm-linux-androideabi for \s-1ARM,\s0 +mipsel-linux-android for \s-1MIPS,\s0 and simply x86 for x86. +As of 2014, most Android devices run on \s-1ARM,\s0 so that is generally a safe bet. +.PP +With those two in hand, you should add +.PP +.Vb 1 +\& $ANDROID_NDK/toolchains/$TARGETARCH\-4.8/prebuilt/\`uname | tr \*(Aq[A\-Z]\*(Aq \*(Aq[a\-z]\*(Aq\`\-x86_64/bin +.Ve +.PP +to your \f(CW\*(C`PATH\*(C'\fR, where \f(CW$ANDROID_NDK\fR is the location where you unpacked the +\&\s-1NDK,\s0 and \f(CW$TARGETARCH\fR is your target's architecture. +.SS "Set up a standalone toolchain" +.IX Subsection "Set up a standalone toolchain" +This creates a working sysroot that we can feed to Configure later. +.PP +.Vb 7 +\& $ export ANDROID_TOOLCHAIN=/tmp/my\-toolchain\-$TARGETARCH +\& $ export SYSROOT=$ANDROID_TOOLCHAIN/sysroot +\& $ $ANDROID_NDK/build/tools/make\-standalone\-toolchain.sh \e +\& \-\-platform=android\-9 \e +\& \-\-install\-dir=$ANDROID_TOOLCHAIN \e +\& \-\-system=\`uname | tr \*(Aq[A\-Z]\*(Aq \*(Aq[a\-z]\*(Aq\`\-x86_64 \e +\& \-\-toolchain=$TARGETARCH\-4.8 +.Ve +.SS "adb or ssh?" +.IX Subsection "adb or ssh?" +adb is the Android Debug Bridge. For our purposes, it's basically a way +of establishing an ssh connection to an Android device without having to +install anything on the device itself, as long as the device is either on +the same local network as the host, or it is connected to the host through +\&\s-1USB.\s0 +.PP +Perl can be cross-compiled using either adb or a normal ssh connection; +in general, if you can connect your device to the host using a \s-1USB\s0 port, +or if you don't feel like installing an sshd app on your device, +you may want to use adb, although you may be forced to switch to ssh if +your device is not rooted and you're unlucky \*(-- more on that later. +Alternatively, if you're cross-compiling to an emulator, you'll have to +use adb. +.PP +\fIadb\fR +.IX Subsection "adb" +.PP +To use adb, download the Android \s-1SDK\s0 from . +The \*(L"\s-1SDK\s0 Tools Only\*(R" version should suffice \*(-- if you downloaded the \s-1ADT\s0 +Bundle, you can find the sdk under \fI\f(CI$ADT_BUNDLE\fI/sdk/\fR. +.PP +Add \fI\f(CI$ANDROID_SDK\fI/platform\-tools\fR to your \f(CW\*(C`PATH\*(C'\fR, which should give you access +to adb. You'll now have to find your device's name using \f(CW\*(C`adb devices\*(C'\fR, +and later pass that to Configure through \f(CW\*(C`\-Dtargethost=$DEVICE\*(C'\fR. +.PP +However, before calling Configure, you need to check if using adb is a +viable choice in the first place. Because Android doesn't have a \fI/tmp\fR, +nor does it allow executables in the sdcard, we need to find somewhere in +the device for Configure to put some files in, as well as for the tests +to run in. If your device is rooted, then you're good. Try running these: +.PP +.Vb 2 +\& $ export TARGETDIR=/mnt/asec/perl +\& $ adb \-s $DEVICE shell "echo sh \-c \*(Aq\e"mkdir $TARGETDIR\e"\*(Aq | su \-\-" +.Ve +.PP +Which will create the directory we need, and you can move on to the next +step. \fI/mnt/asec\fR is mounted as a tmpfs in Android, but it's only +accessible to root. +.PP +If your device is not rooted, you may still be in luck. Try running this: +.PP +.Vb 2 +\& $ export TARGETDIR=/data/local/tmp/perl +\& $ adb \-s $DEVICE shell "mkdir $TARGETDIR" +.Ve +.PP +If the command works, you can move to the next step, but beware: +\&\fBYou'll have to remove the directory from the device once you are done! +Unlike \f(BI/mnt/asec\fB, \f(BI/data/local/tmp\fB may not get automatically garbage +collected once you shut off the phone\fR. +.PP +If neither of those work, then you can't use adb to cross-compile to your +device. Either try rooting it, or go for the ssh route. +.PP +\fIssh\fR +.IX Subsection "ssh" +.PP +To use ssh, you'll need to install and run a sshd app and set it up +properly. There are several paid and free apps that do this rather +easily, so you should be able to spot one on the store. +Remember that Perl requires a passwordless connection, so set up a +public key. +.PP +Note that several apps spew crap to stderr every time you +connect, which can throw off Configure. You may need to monkeypatch +the part of Configure that creates \f(CW\*(C`run\-ssh\*(C'\fR to have it discard stderr. +.PP +Since you're using ssh, you'll have to pass some extra arguments to +Configure: +.PP +.Vb 1 +\& \-Dtargetrun=ssh \-Dtargethost=$TARGETHOST \-Dtargetuser=$TARGETUSER \-Dtargetport=$TARGETPORT +.Ve +.SS "Configure and beyond" +.IX Subsection "Configure and beyond" +With all of the previous done, you're now ready to call Configure. +.PP +If using adb, a \*(L"basic\*(R" Configure line will look like this: +.PP +.Vb 5 +\& $ ./Configure \-des \-Dusedevel \-Dusecrosscompile \-Dtargetrun=adb \e +\& \-Dcc=$TARGETARCH\-gcc \e +\& \-Dsysroot=$SYSROOT \e +\& \-Dtargetdir=$TARGETDIR \e +\& \-Dtargethost=$DEVICE +.Ve +.PP +If using ssh, it's not too different \*(-- we just change targetrun to ssh, +and pass in targetuser and targetport. It ends up looking like this: +.PP +.Vb 7 +\& $ ./Configure \-des \-Dusedevel \-Dusecrosscompile \-Dtargetrun=ssh \e +\& \-Dcc=$TARGETARCH\-gcc \e +\& \-Dsysroot=$SYSROOT \e +\& \-Dtargetdir=$TARGETDIR \e +\& \-Dtargethost="$TARGETHOST" \e +\& \-Dtargetuser=$TARGETUSER \e +\& \-Dtargetport=$TARGETPORT +.Ve +.PP +Now you're ready to run \f(CW\*(C`make\*(C'\fR and \f(CW\*(C`make test\*(C'\fR! +.PP +As a final word of warning, if you're using adb, \f(CW\*(C`make test\*(C'\fR may appear to +hang; this is because it doesn't output anything until it finishes +running all tests. You can check its progress by logging into the +device, moving to \fI\f(CI$TARGETDIR\fI\fR, and looking at the file \fIoutput.stdout\fR. +.PP +\fINotes\fR +.IX Subsection "Notes" +.IP "\(bu" 4 +If you are targetting x86 Android, you will have to change \f(CW\*(C`$TARGETARCH\-gcc\*(C'\fR +to \f(CW\*(C`i686\-linux\-android\-gcc\*(C'\fR. +.IP "\(bu" 4 +On some older low-end devices \*(-- think early 2.2 era \*(-- some tests, +particularly \fIt/re/uniprops.t\fR, may crash the phone, causing it to turn +itself off once, and then back on again. +.SH "Native Builds" +.IX Header "Native Builds" +While Google doesn't provide a native toolchain for Android, +you can still get one from the Play Store. +.SS "CCTools" +.IX Subsection "CCTools" +You may be able to get the CCTools app, which is free. +Keep in mind that you want a full toolchain; +some apps tend to default to installing only a barebones +version without some important utilities, like ar or nm. +.PP +Once you have the toolchain set up properly, the only +remaining hurdle is actually locating where in the device it was installed +in. For example, CCTools installs its toolchain in +\&\fI/data/data/com.pdaxrom.cctools/root/cctools\fR. With the path in hand, +compiling perl is little more than: +.PP +.Vb 3 +\& export SYSROOT= +\& export LD_LIBRARY_PATH="$SYSROOT/lib:\`pwd\`:\`pwd\`/lib:\`pwd\`/lib/auto:$LD_LIBRARY_PATH" +\& sh Configure \-des \-Dsysroot=$SYSROOT \-Alibpth="/system/lib /vendor/lib" +.Ve +.SS "Termux" +.IX Subsection "Termux" +Termux provides an Android terminal emulator and Linux environment. +It comes with a cross-compiled perl already installed. +.PP +Natively compiling perl 5.30 or later should be as straightforward as: +.PP +.Vb 1 +\& sh Configure \-des \-Alibpth="/system/lib /vendor/lib" +.Ve +.PP +This certainly works on Android 8.1 (Oreo) at least... +.SH "AUTHOR" +.IX Header "AUTHOR" +Brian Fraser diff --git a/data/miniconda3/man/man1/perlapi.1 b/data/miniconda3/man/man1/perlapi.1 new file mode 100644 index 0000000000000000000000000000000000000000..b6aa82fbfd190dcd8e8389a66fe34ca98c58daef --- /dev/null +++ b/data/miniconda3/man/man1/perlapi.1 @@ -0,0 +1,15508 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLAPI 1" +.TH PERLAPI 1 "2023-12-23" "perl v5.32.1" "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" +perlapi \- autogenerated documentation for the perl public API +.SH "DESCRIPTION" +.IX Xref "Perl API API api" +.IX Header "DESCRIPTION" +This file contains most of the documentation of the perl public \s-1API,\s0 as +generated by \fIembed.pl\fR. Specifically, it is a listing of functions, +macros, flags, and variables that may be used by extension writers. Some +specialized items are instead documented in \fIconfig.h\fR, perlapio, perlcall, perlclib, perlfilter, perlguts, perlmroapi, perlxs, perlxstut, and warnings. +.PP +At the end is a list of functions which have yet +to be documented. Patches welcome! The interfaces of these are subject to +change without notice. +.PP +Anything not listed here is not part of the public \s-1API,\s0 and should not be +used by extension writers at all. For these reasons, blindly using functions +listed in proto.h is to be avoided when writing extensions. +.PP +In Perl, unlike C, a string of characters may generally contain embedded +\&\f(CW\*(C`NUL\*(C'\fR characters. Sometimes in the documentation a Perl string is referred +to as a \*(L"buffer\*(R" to distinguish it from a C string, but sometimes they are +both just referred to as strings. +.PP +Note that all Perl \s-1API\s0 global variables must be referenced with the \f(CW\*(C`PL_\*(C'\fR +prefix. Again, those not listed here are not to be used by extension writers, +and can be changed or removed without notice; same with macros. +Some macros are provided for compatibility with the older, +unadorned names, but this support may be disabled in a future release. +.PP +Perl was originally written to handle US-ASCII only (that is characters +whose ordinal numbers are in the range 0 \- 127). +And documentation and comments may still use the term \s-1ASCII,\s0 when +sometimes in fact the entire range from 0 \- 255 is meant. +.PP +The non-ASCII characters below 256 can have various meanings, depending on +various things. (See, most notably, perllocale.) But usually the whole +range can be referred to as \s-1ISO\-8859\-1.\s0 Often, the term \*(L"Latin\-1\*(R" (or +\&\*(L"Latin1\*(R") is used as an equivalent for \s-1ISO\-8859\-1.\s0 But some people treat +\&\*(L"Latin1\*(R" as referring just to the characters in the range 128 through 255, or +somethimes from 160 through 255. +This documentation uses \*(L"Latin1\*(R" and \*(L"Latin\-1\*(R" to refer to all 256 characters. +.PP +Note that Perl can be compiled and run under either \s-1ASCII\s0 or \s-1EBCDIC\s0 (See +perlebcdic). Most of the documentation (and even comments in the code) +ignore the \s-1EBCDIC\s0 possibility. +For almost all purposes the differences are transparent. +As an example, under \s-1EBCDIC,\s0 +instead of \s-1UTF\-8,\s0 UTF-EBCDIC is used to encode Unicode strings, and so +whenever this documentation refers to \f(CW\*(C`utf8\*(C'\fR +(and variants of that name, including in function names), +it also (essentially transparently) means \f(CW\*(C`UTF\-EBCDIC\*(C'\fR. +But the ordinals of characters differ between \s-1ASCII, EBCDIC,\s0 and +the \s-1UTF\-\s0 encodings, and a string encoded in UTF-EBCDIC may occupy a different +number of bytes than in \s-1UTF\-8.\s0 +.PP +The listing below is alphabetical, case insensitive. +.SH "Array Manipulation Functions" +.IX Header "Array Manipulation Functions" +.IP "av_clear" 8 +.IX Xref "av_clear" +.IX Item "av_clear" +Frees the all the elements of an array, leaving it empty. +The \s-1XS\s0 equivalent of \f(CW\*(C`@array = ()\*(C'\fR. See also \*(L"av_undef\*(R". +.Sp +Note that it is possible that the actions of a destructor called directly +or indirectly by freeing an element of the array could cause the reference +count of the array itself to be reduced (e.g. by deleting an entry in the +symbol table). So it is a possibility that the \s-1AV\s0 could have been freed +(or even reallocated) on return from the call unless you hold a reference +to it. +.Sp +.Vb 1 +\& void av_clear(AV *av) +.Ve +.IP "av_create_and_push" 8 +.IX Xref "av_create_and_push" +.IX Item "av_create_and_push" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Push an \s-1SV\s0 onto the end of the array, creating the array if necessary. +A small internal helper function to remove a commonly duplicated idiom. +.Sp +\&\s-1NOTE:\s0 this function must be explicitly called as Perl_av_create_and_push with an aTHX_ parameter. +.Sp +.Vb 2 +\& void Perl_av_create_and_push(pTHX_ AV **const avp, +\& SV *const val) +.Ve +.IP "av_create_and_unshift_one" 8 +.IX Xref "av_create_and_unshift_one" +.IX Item "av_create_and_unshift_one" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Unshifts an \s-1SV\s0 onto the beginning of the array, creating the array if +necessary. +A small internal helper function to remove a commonly duplicated idiom. +.Sp +\&\s-1NOTE:\s0 this function must be explicitly called as Perl_av_create_and_unshift_one with an aTHX_ parameter. +.Sp +.Vb 3 +\& SV** Perl_av_create_and_unshift_one(pTHX_ +\& AV **const avp, +\& SV *const val) +.Ve +.IP "av_delete" 8 +.IX Xref "av_delete" +.IX Item "av_delete" +Deletes the element indexed by \f(CW\*(C`key\*(C'\fR from the array, makes the element +mortal, and returns it. If \f(CW\*(C`flags\*(C'\fR equals \f(CW\*(C`G_DISCARD\*(C'\fR, the element is +freed and \s-1NULL\s0 is returned. \s-1NULL\s0 is also returned if \f(CW\*(C`key\*(C'\fR is out of +range. +.Sp +Perl equivalent: \f(CW\*(C`splice(@myarray,\ $key,\ 1,\ undef)\*(C'\fR (with the +\&\f(CW\*(C`splice\*(C'\fR in void context if \f(CW\*(C`G_DISCARD\*(C'\fR is present). +.Sp +.Vb 1 +\& SV* av_delete(AV *av, SSize_t key, I32 flags) +.Ve +.IP "av_exists" 8 +.IX Xref "av_exists" +.IX Item "av_exists" +Returns true if the element indexed by \f(CW\*(C`key\*(C'\fR has been initialized. +.Sp +This relies on the fact that uninitialized array elements are set to +\&\f(CW\*(C`NULL\*(C'\fR. +.Sp +Perl equivalent: \f(CW\*(C`exists($myarray[$key])\*(C'\fR. +.Sp +.Vb 1 +\& bool av_exists(AV *av, SSize_t key) +.Ve +.IP "av_extend" 8 +.IX Xref "av_extend" +.IX Item "av_extend" +Pre-extend an array so that it is capable of storing values at indexes +\&\f(CW\*(C`0..key\*(C'\fR. Thus \f(CW\*(C`av_extend(av,99)\*(C'\fR guarantees that the array can store 100 +elements, i.e. that \f(CW\*(C`av_store(av, 0, sv)\*(C'\fR through \f(CW\*(C`av_store(av, 99, sv)\*(C'\fR +on a plain array will work without any further memory allocation. +.Sp +If the av argument is a tied array then will call the \f(CW\*(C`EXTEND\*(C'\fR tied +array method with an argument of \f(CW\*(C`(key+1)\*(C'\fR. +.Sp +.Vb 1 +\& void av_extend(AV *av, SSize_t key) +.Ve +.IP "av_fetch" 8 +.IX Xref "av_fetch" +.IX Item "av_fetch" +Returns the \s-1SV\s0 at the specified index in the array. The \f(CW\*(C`key\*(C'\fR is the +index. If lval is true, you are guaranteed to get a real \s-1SV\s0 back (in case +it wasn't real before), which you can then modify. Check that the return +value is non-null before dereferencing it to a \f(CW\*(C`SV*\*(C'\fR. +.Sp +See \*(L"Understanding the Magic of Tied Hashes and Arrays\*(R" in perlguts for +more information on how to use this function on tied arrays. +.Sp +The rough perl equivalent is \f(CW$myarray[$key]\fR. +.Sp +.Vb 1 +\& SV** av_fetch(AV *av, SSize_t key, I32 lval) +.Ve +.IP "AvFILL" 8 +.IX Xref "AvFILL" +.IX Item "AvFILL" +Same as \f(CW\*(C`av_top_index()\*(C'\fR or \f(CW\*(C`av_tindex()\*(C'\fR. +.Sp +.Vb 1 +\& int AvFILL(AV* av) +.Ve +.IP "av_fill" 8 +.IX Xref "av_fill" +.IX Item "av_fill" +Set the highest index in the array to the given number, equivalent to +Perl's \f(CW\*(C`$#array\ =\ $fill;\*(C'\fR. +.Sp +The number of elements in the array will be \f(CW\*(C`fill\ +\ 1\*(C'\fR after +\&\f(CW\*(C`av_fill()\*(C'\fR returns. If the array was previously shorter, then the +additional elements appended are set to \s-1NULL.\s0 If the array +was longer, then the excess elements are freed. \f(CW\*(C`av_fill(av,\ \-1)\*(C'\fR is +the same as \f(CW\*(C`av_clear(av)\*(C'\fR. +.Sp +.Vb 1 +\& void av_fill(AV *av, SSize_t fill) +.Ve +.IP "av_len" 8 +.IX Xref "av_len" +.IX Item "av_len" +Same as \*(L"av_top_index\*(R". Note that, unlike what the name implies, it returns +the highest index in the array, so to get the size of the array you need to use +\&\f(CW\*(C`av_len(av)\ +\ 1\*(C'\fR. This is unlike \*(L"sv_len\*(R", which returns what you would +expect. +.Sp +.Vb 1 +\& SSize_t av_len(AV *av) +.Ve +.IP "av_make" 8 +.IX Xref "av_make" +.IX Item "av_make" +Creates a new \s-1AV\s0 and populates it with a list of SVs. The SVs are copied +into the array, so they may be freed after the call to \f(CW\*(C`av_make\*(C'\fR. The new \s-1AV\s0 +will have a reference count of 1. +.Sp +Perl equivalent: \f(CW\*(C`my @new_array = ($scalar1, $scalar2, $scalar3...);\*(C'\fR +.Sp +.Vb 1 +\& AV* av_make(SSize_t size, SV **strp) +.Ve +.IP "av_pop" 8 +.IX Xref "av_pop" +.IX Item "av_pop" +Removes one \s-1SV\s0 from the end of the array, reducing its size by one and +returning the \s-1SV\s0 (transferring control of one reference count) to the +caller. Returns \f(CW&PL_sv_undef\fR if the array is empty. +.Sp +Perl equivalent: \f(CW\*(C`pop(@myarray);\*(C'\fR +.Sp +.Vb 1 +\& SV* av_pop(AV *av) +.Ve +.IP "av_push" 8 +.IX Xref "av_push" +.IX Item "av_push" +Pushes an \s-1SV\s0 (transferring control of one reference count) onto the end of the +array. The array will grow automatically to accommodate the addition. +.Sp +Perl equivalent: \f(CW\*(C`push @myarray, $val;\*(C'\fR. +.Sp +.Vb 1 +\& void av_push(AV *av, SV *val) +.Ve +.IP "av_shift" 8 +.IX Xref "av_shift" +.IX Item "av_shift" +Removes one \s-1SV\s0 from the start of the array, reducing its size by one and +returning the \s-1SV\s0 (transferring control of one reference count) to the +caller. Returns \f(CW&PL_sv_undef\fR if the array is empty. +.Sp +Perl equivalent: \f(CW\*(C`shift(@myarray);\*(C'\fR +.Sp +.Vb 1 +\& SV* av_shift(AV *av) +.Ve +.IP "av_store" 8 +.IX Xref "av_store" +.IX Item "av_store" +Stores an \s-1SV\s0 in an array. The array index is specified as \f(CW\*(C`key\*(C'\fR. The +return value will be \f(CW\*(C`NULL\*(C'\fR if the operation failed or if the value did not +need to be actually stored within the array (as in the case of tied +arrays). Otherwise, it can be dereferenced +to get the \f(CW\*(C`SV*\*(C'\fR that was stored +there (= \f(CW\*(C`val\*(C'\fR)). +.Sp +Note that the caller is responsible for suitably incrementing the reference +count of \f(CW\*(C`val\*(C'\fR before the call, and decrementing it if the function +returned \f(CW\*(C`NULL\*(C'\fR. +.Sp +Approximate Perl equivalent: \f(CW\*(C`splice(@myarray, $key, 1, $val)\*(C'\fR. +.Sp +See \*(L"Understanding the Magic of Tied Hashes and Arrays\*(R" in perlguts for +more information on how to use this function on tied arrays. +.Sp +.Vb 1 +\& SV** av_store(AV *av, SSize_t key, SV *val) +.Ve +.IP "av_tindex" 8 +.IX Xref "av_tindex" +.IX Item "av_tindex" +Same as \f(CW\*(C`av_top_index()\*(C'\fR. +.Sp +.Vb 1 +\& SSize_t av_tindex(AV *av) +.Ve +.IP "av_top_index" 8 +.IX Xref "av_top_index" +.IX Item "av_top_index" +Returns the highest index in the array. The number of elements in the +array is \f(CW\*(C`av_top_index(av)\ +\ 1\*(C'\fR. Returns \-1 if the array is empty. +.Sp +The Perl equivalent for this is \f(CW$#myarray\fR. +.Sp +(A slightly shorter form is \f(CW\*(C`av_tindex\*(C'\fR.) +.Sp +.Vb 1 +\& SSize_t av_top_index(AV *av) +.Ve +.IP "av_undef" 8 +.IX Xref "av_undef" +.IX Item "av_undef" +Undefines the array. The \s-1XS\s0 equivalent of \f(CW\*(C`undef(@array)\*(C'\fR. +.Sp +As well as freeing all the elements of the array (like \f(CW\*(C`av_clear()\*(C'\fR), this +also frees the memory used by the av to store its list of scalars. +.Sp +See \*(L"av_clear\*(R" for a note about the array possibly being invalid on +return. +.Sp +.Vb 1 +\& void av_undef(AV *av) +.Ve +.IP "av_unshift" 8 +.IX Xref "av_unshift" +.IX Item "av_unshift" +Unshift the given number of \f(CW\*(C`undef\*(C'\fR values onto the beginning of the +array. The array will grow automatically to accommodate the addition. +.Sp +Perl equivalent: \f(CW\*(C`unshift\ @myarray,\ ((undef)\ x\ $num);\*(C'\fR +.Sp +.Vb 1 +\& void av_unshift(AV *av, SSize_t num) +.Ve +.IP "get_av" 8 +.IX Xref "get_av" +.IX Item "get_av" +Returns the \s-1AV\s0 of the specified Perl global or package array with the given +name (so it won't work on lexical variables). \f(CW\*(C`flags\*(C'\fR are passed +to \f(CW\*(C`gv_fetchpv\*(C'\fR. If \f(CW\*(C`GV_ADD\*(C'\fR is set and the +Perl variable does not exist then it will be created. If \f(CW\*(C`flags\*(C'\fR is zero +and the variable does not exist then \s-1NULL\s0 is returned. +.Sp +Perl equivalent: \f(CW\*(C`@{"$name"}\*(C'\fR. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& AV* get_av(const char *name, I32 flags) +.Ve +.IP "newAV" 8 +.IX Xref "newAV" +.IX Item "newAV" +Creates a new \s-1AV.\s0 The reference count is set to 1. +.Sp +Perl equivalent: \f(CW\*(C`my @array;\*(C'\fR. +.Sp +.Vb 1 +\& AV* newAV() +.Ve +.IP "sortsv" 8 +.IX Xref "sortsv" +.IX Item "sortsv" +In-place sort an array of \s-1SV\s0 pointers with the given comparison routine. +.Sp +Currently this always uses mergesort. See \f(CW"sortsv_flags"\fR for a more +flexible routine. +.Sp +.Vb 2 +\& void sortsv(SV** array, size_t num_elts, +\& SVCOMPARE_t cmp) +.Ve +.SH "Callback Functions" +.IX Header "Callback Functions" +.IP "call_argv" 8 +.IX Xref "call_argv" +.IX Item "call_argv" +Performs a callback to the specified named and package-scoped Perl subroutine +with \f(CW\*(C`argv\*(C'\fR (a \f(CW\*(C`NULL\*(C'\fR\-terminated array of strings) as arguments. See +perlcall. +.Sp +Approximate Perl equivalent: \f(CW\*(C`&{"$sub_name"}(@$argv)\*(C'\fR. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 2 +\& I32 call_argv(const char* sub_name, I32 flags, +\& char** argv) +.Ve +.IP "call_method" 8 +.IX Xref "call_method" +.IX Item "call_method" +Performs a callback to the specified Perl method. The blessed object must +be on the stack. See perlcall. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& I32 call_method(const char* methname, I32 flags) +.Ve +.IP "call_pv" 8 +.IX Xref "call_pv" +.IX Item "call_pv" +Performs a callback to the specified Perl sub. See perlcall. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& I32 call_pv(const char* sub_name, I32 flags) +.Ve +.IP "call_sv" 8 +.IX Xref "call_sv" +.IX Item "call_sv" +Performs a callback to the Perl sub specified by the \s-1SV.\s0 +.Sp +If neither the \f(CW\*(C`G_METHOD\*(C'\fR nor \f(CW\*(C`G_METHOD_NAMED\*(C'\fR flag is supplied, the +\&\s-1SV\s0 may be any of a \s-1CV,\s0 a \s-1GV,\s0 a reference to a \s-1CV,\s0 a reference to a \s-1GV\s0 +or \f(CW\*(C`SvPV(sv)\*(C'\fR will be used as the name of the sub to call. +.Sp +If the \f(CW\*(C`G_METHOD\*(C'\fR flag is supplied, the \s-1SV\s0 may be a reference to a \s-1CV\s0 or +\&\f(CW\*(C`SvPV(sv)\*(C'\fR will be used as the name of the method to call. +.Sp +If the \f(CW\*(C`G_METHOD_NAMED\*(C'\fR flag is supplied, \f(CW\*(C`SvPV(sv)\*(C'\fR will be used as +the name of the method to call. +.Sp +Some other values are treated specially for internal use and should +not be depended on. +.Sp +See perlcall. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& I32 call_sv(SV* sv, volatile I32 flags) +.Ve +.IP "\s-1ENTER\s0" 8 +.IX Xref "ENTER" +.IX Item "ENTER" +Opening bracket on a callback. See \f(CW"LEAVE"\fR and perlcall. +.Sp +.Vb 1 +\& ENTER; +.Ve +.IP "ENTER_with_name" 8 +.IX Xref "ENTER_with_name" +.IX Item "ENTER_with_name" +Same as \f(CW"ENTER"\fR, but when debugging is enabled it also associates the +given literal string with the new scope. +.Sp +.Vb 1 +\& ENTER_with_name("name"); +.Ve +.IP "eval_pv" 8 +.IX Xref "eval_pv" +.IX Item "eval_pv" +Tells Perl to \f(CW\*(C`eval\*(C'\fR the given string in scalar context and return an SV* result. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& SV* eval_pv(const char* p, I32 croak_on_error) +.Ve +.IP "eval_sv" 8 +.IX Xref "eval_sv" +.IX Item "eval_sv" +Tells Perl to \f(CW\*(C`eval\*(C'\fR the string in the \s-1SV.\s0 It supports the same flags +as \f(CW\*(C`call_sv\*(C'\fR, with the obvious exception of \f(CW\*(C`G_EVAL\*(C'\fR. See perlcall. +.Sp +The \f(CW\*(C`G_RETHROW\*(C'\fR flag can be used if you only need \fBeval_sv()\fR to +execute code specified by a string, but not catch any errors. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& I32 eval_sv(SV* sv, I32 flags) +.Ve +.IP "\s-1FREETMPS\s0" 8 +.IX Xref "FREETMPS" +.IX Item "FREETMPS" +Closing bracket for temporaries on a callback. See \f(CW"SAVETMPS"\fR and +perlcall. +.Sp +.Vb 1 +\& FREETMPS; +.Ve +.IP "\s-1LEAVE\s0" 8 +.IX Xref "LEAVE" +.IX Item "LEAVE" +Closing bracket on a callback. See \f(CW"ENTER"\fR and perlcall. +.Sp +.Vb 1 +\& LEAVE; +.Ve +.IP "LEAVE_with_name" 8 +.IX Xref "LEAVE_with_name" +.IX Item "LEAVE_with_name" +Same as \f(CW"LEAVE"\fR, but when debugging is enabled it first checks that the +scope has the given name. \f(CW\*(C`name\*(C'\fR must be a literal string. +.Sp +.Vb 1 +\& LEAVE_with_name("name"); +.Ve +.IP "\s-1SAVETMPS\s0" 8 +.IX Xref "SAVETMPS" +.IX Item "SAVETMPS" +Opening bracket for temporaries on a callback. See \f(CW"FREETMPS"\fR and +perlcall. +.Sp +.Vb 1 +\& SAVETMPS; +.Ve +.SH "Character case changing" +.IX Header "Character case changing" +Perl uses \*(L"full\*(R" Unicode case mappings. This means that converting a single +character to another case may result in a sequence of more than one character. +For example, the uppercase of \f(CW\*(C`\*8\*(C'\fR (\s-1LATIN SMALL LETTER SHARP S\s0) is the two +character sequence \f(CW\*(C`SS\*(C'\fR. This presents some complications The lowercase of +all characters in the range 0..255 is a single character, and thus +\&\f(CW"toLOWER_L1"\fR is furnished. But, \f(CW\*(C`toUPPER_L1\*(C'\fR can't exist, as it couldn't +return a valid result for all legal inputs. Instead \f(CW"toUPPER_uvchr"\fR has +an \s-1API\s0 that does allow every possible legal result to be returned.) Likewise +no other function that is crippled by not being able to give the correct +results for the full range of possible inputs has been implemented here. +.IP "toFOLD" 8 +.IX Xref "toFOLD" +.IX Item "toFOLD" +Converts the specified character to foldcase. If the input is anything but an +\&\s-1ASCII\s0 uppercase character, that input character itself is returned. Variant +\&\f(CW\*(C`toFOLD_A\*(C'\fR is equivalent. (There is no equivalent \f(CW\*(C`to_FOLD_L1\*(C'\fR for the full +Latin1 range, as the full generality of \*(L"toFOLD_uvchr\*(R" is needed there.) +.Sp +.Vb 1 +\& U8 toFOLD(U8 ch) +.Ve +.IP "toFOLD_utf8" 8 +.IX Xref "toFOLD_utf8" +.IX Item "toFOLD_utf8" +Converts the first \s-1UTF\-8\s0 encoded character in the sequence starting at \f(CW\*(C`p\*(C'\fR and +extending no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR to its foldcase version, and +stores that in \s-1UTF\-8\s0 in \f(CW\*(C`s\*(C'\fR, and its length in bytes in \f(CW\*(C`lenp\*(C'\fR. Note +that the buffer pointed to by \f(CW\*(C`s\*(C'\fR needs to be at least \f(CW\*(C`UTF8_MAXBYTES_CASE+1\*(C'\fR +bytes since the foldcase version may be longer than the original character. +.Sp +The first code point of the foldcased version is returned +(but note, as explained at the top of this section, that there may be more). +.Sp +It will not attempt +to read beyond \f(CW\*(C`e\ \-\ 1\*(C'\fR, provided that the constraint \f(CW\*(C`s\ <\ e\*(C'\fR is +true (this is asserted for in \f(CW\*(C`\-DDEBUGGING\*(C'\fR builds). If the \s-1UTF\-8\s0 for the +input character is malformed in some way, the program may croak, or the +function may return the \s-1REPLACEMENT CHARACTER,\s0 at the discretion of the +implementation, and subject to change in future releases. +.Sp +.Vb 1 +\& UV toFOLD_utf8(U8* p, U8* e, U8* s, STRLEN* lenp) +.Ve +.IP "toFOLD_utf8_safe" 8 +.IX Xref "toFOLD_utf8_safe" +.IX Item "toFOLD_utf8_safe" +Same as \*(L"toFOLD_utf8\*(R". +.Sp +.Vb 2 +\& UV toFOLD_utf8_safe(U8* p, U8* e, U8* s, +\& STRLEN* lenp) +.Ve +.IP "toFOLD_uvchr" 8 +.IX Xref "toFOLD_uvchr" +.IX Item "toFOLD_uvchr" +Converts the code point \f(CW\*(C`cp\*(C'\fR to its foldcase version, and +stores that in \s-1UTF\-8\s0 in \f(CW\*(C`s\*(C'\fR, and its length in bytes in \f(CW\*(C`lenp\*(C'\fR. The code +point is interpreted as native if less than 256; otherwise as Unicode. Note +that the buffer pointed to by \f(CW\*(C`s\*(C'\fR needs to be at least \f(CW\*(C`UTF8_MAXBYTES_CASE+1\*(C'\fR +bytes since the foldcase version may be longer than the original character. +.Sp +The first code point of the foldcased version is returned +(but note, as explained at the top of this section, that there may be more). +.Sp +.Vb 1 +\& UV toFOLD_uvchr(UV cp, U8* s, STRLEN* lenp) +.Ve +.IP "toLOWER" 8 +.IX Xref "toLOWER" +.IX Item "toLOWER" +Converts the specified character to lowercase. If the input is anything but an +\&\s-1ASCII\s0 uppercase character, that input character itself is returned. Variant +\&\f(CW\*(C`toLOWER_A\*(C'\fR is equivalent. +.Sp +.Vb 1 +\& U8 toLOWER(U8 ch) +.Ve +.IP "toLOWER_L1" 8 +.IX Xref "toLOWER_L1" +.IX Item "toLOWER_L1" +Converts the specified Latin1 character to lowercase. The results are +undefined if the input doesn't fit in a byte. +.Sp +.Vb 1 +\& U8 toLOWER_L1(U8 ch) +.Ve +.IP "toLOWER_LC" 8 +.IX Xref "toLOWER_LC" +.IX Item "toLOWER_LC" +Converts the specified character to lowercase using the current locale's rules, +if possible; otherwise returns the input character itself. +.Sp +.Vb 1 +\& U8 toLOWER_LC(U8 ch) +.Ve +.IP "toLOWER_utf8" 8 +.IX Xref "toLOWER_utf8" +.IX Item "toLOWER_utf8" +Converts the first \s-1UTF\-8\s0 encoded character in the sequence starting at \f(CW\*(C`p\*(C'\fR and +extending no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR to its lowercase version, and +stores that in \s-1UTF\-8\s0 in \f(CW\*(C`s\*(C'\fR, and its length in bytes in \f(CW\*(C`lenp\*(C'\fR. Note +that the buffer pointed to by \f(CW\*(C`s\*(C'\fR needs to be at least \f(CW\*(C`UTF8_MAXBYTES_CASE+1\*(C'\fR +bytes since the lowercase version may be longer than the original character. +.Sp +The first code point of the lowercased version is returned +(but note, as explained at the top of this section, that there may be more). +It will not attempt to read beyond \f(CW\*(C`e\ \-\ 1\*(C'\fR, provided that the constraint +\&\f(CW\*(C`s\ <\ e\*(C'\fR is true (this is asserted for in \f(CW\*(C`\-DDEBUGGING\*(C'\fR builds). If +the \s-1UTF\-8\s0 for the input character is malformed in some way, the program may +croak, or the function may return the \s-1REPLACEMENT CHARACTER,\s0 at the discretion +of the implementation, and subject to change in future releases. +.Sp +.Vb 1 +\& UV toLOWER_utf8(U8* p, U8* e, U8* s, STRLEN* lenp) +.Ve +.IP "toLOWER_utf8_safe" 8 +.IX Xref "toLOWER_utf8_safe" +.IX Item "toLOWER_utf8_safe" +Same as \*(L"toLOWER_utf8\*(R". +.Sp +.Vb 2 +\& UV toLOWER_utf8_safe(U8* p, U8* e, U8* s, +\& STRLEN* lenp) +.Ve +.IP "toLOWER_uvchr" 8 +.IX Xref "toLOWER_uvchr" +.IX Item "toLOWER_uvchr" +Converts the code point \f(CW\*(C`cp\*(C'\fR to its lowercase version, and +stores that in \s-1UTF\-8\s0 in \f(CW\*(C`s\*(C'\fR, and its length in bytes in \f(CW\*(C`lenp\*(C'\fR. The code +point is interpreted as native if less than 256; otherwise as Unicode. Note +that the buffer pointed to by \f(CW\*(C`s\*(C'\fR needs to be at least \f(CW\*(C`UTF8_MAXBYTES_CASE+1\*(C'\fR +bytes since the lowercase version may be longer than the original character. +.Sp +The first code point of the lowercased version is returned +(but note, as explained at the top of this section, that there may be more). +.Sp +.Vb 1 +\& UV toLOWER_uvchr(UV cp, U8* s, STRLEN* lenp) +.Ve +.IP "toTITLE" 8 +.IX Xref "toTITLE" +.IX Item "toTITLE" +Converts the specified character to titlecase. If the input is anything but an +\&\s-1ASCII\s0 lowercase character, that input character itself is returned. Variant +\&\f(CW\*(C`toTITLE_A\*(C'\fR is equivalent. (There is no \f(CW\*(C`toTITLE_L1\*(C'\fR for the full Latin1 +range, as the full generality of \*(L"toTITLE_uvchr\*(R" is needed there. Titlecase is +not a concept used in locale handling, so there is no functionality for that.) +.Sp +.Vb 1 +\& U8 toTITLE(U8 ch) +.Ve +.IP "toTITLE_utf8" 8 +.IX Xref "toTITLE_utf8" +.IX Item "toTITLE_utf8" +Converts the first \s-1UTF\-8\s0 encoded character in the sequence starting at \f(CW\*(C`p\*(C'\fR and +extending no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR to its titlecase version, and +stores that in \s-1UTF\-8\s0 in \f(CW\*(C`s\*(C'\fR, and its length in bytes in \f(CW\*(C`lenp\*(C'\fR. Note +that the buffer pointed to by \f(CW\*(C`s\*(C'\fR needs to be at least \f(CW\*(C`UTF8_MAXBYTES_CASE+1\*(C'\fR +bytes since the titlecase version may be longer than the original character. +.Sp +The first code point of the titlecased version is returned +(but note, as explained at the top of this section, that there may be more). +.Sp +It will not attempt +to read beyond \f(CW\*(C`e\ \-\ 1\*(C'\fR, provided that the constraint \f(CW\*(C`s\ <\ e\*(C'\fR is +true (this is asserted for in \f(CW\*(C`\-DDEBUGGING\*(C'\fR builds). If the \s-1UTF\-8\s0 for the +input character is malformed in some way, the program may croak, or the +function may return the \s-1REPLACEMENT CHARACTER,\s0 at the discretion of the +implementation, and subject to change in future releases. +.Sp +.Vb 1 +\& UV toTITLE_utf8(U8* p, U8* e, U8* s, STRLEN* lenp) +.Ve +.IP "toTITLE_utf8_safe" 8 +.IX Xref "toTITLE_utf8_safe" +.IX Item "toTITLE_utf8_safe" +Same as \*(L"toTITLE_utf8\*(R". +.Sp +.Vb 2 +\& UV toTITLE_utf8_safe(U8* p, U8* e, U8* s, +\& STRLEN* lenp) +.Ve +.IP "toTITLE_uvchr" 8 +.IX Xref "toTITLE_uvchr" +.IX Item "toTITLE_uvchr" +Converts the code point \f(CW\*(C`cp\*(C'\fR to its titlecase version, and +stores that in \s-1UTF\-8\s0 in \f(CW\*(C`s\*(C'\fR, and its length in bytes in \f(CW\*(C`lenp\*(C'\fR. The code +point is interpreted as native if less than 256; otherwise as Unicode. Note +that the buffer pointed to by \f(CW\*(C`s\*(C'\fR needs to be at least \f(CW\*(C`UTF8_MAXBYTES_CASE+1\*(C'\fR +bytes since the titlecase version may be longer than the original character. +.Sp +The first code point of the titlecased version is returned +(but note, as explained at the top of this section, that there may be more). +.Sp +.Vb 1 +\& UV toTITLE_uvchr(UV cp, U8* s, STRLEN* lenp) +.Ve +.IP "toUPPER" 8 +.IX Xref "toUPPER" +.IX Item "toUPPER" +Converts the specified character to uppercase. If the input is anything but an +\&\s-1ASCII\s0 lowercase character, that input character itself is returned. Variant +\&\f(CW\*(C`toUPPER_A\*(C'\fR is equivalent. +.Sp +.Vb 1 +\& U8 toUPPER(int ch) +.Ve +.IP "toUPPER_utf8" 8 +.IX Xref "toUPPER_utf8" +.IX Item "toUPPER_utf8" +Converts the first \s-1UTF\-8\s0 encoded character in the sequence starting at \f(CW\*(C`p\*(C'\fR and +extending no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR to its uppercase version, and +stores that in \s-1UTF\-8\s0 in \f(CW\*(C`s\*(C'\fR, and its length in bytes in \f(CW\*(C`lenp\*(C'\fR. Note +that the buffer pointed to by \f(CW\*(C`s\*(C'\fR needs to be at least \f(CW\*(C`UTF8_MAXBYTES_CASE+1\*(C'\fR +bytes since the uppercase version may be longer than the original character. +.Sp +The first code point of the uppercased version is returned +(but note, as explained at the top of this section, that there may be more). +.Sp +It will not attempt to read beyond \f(CW\*(C`e\ \-\ 1\*(C'\fR, provided that the constraint +\&\f(CW\*(C`s\ <\ e\*(C'\fR is true (this is asserted for in \f(CW\*(C`\-DDEBUGGING\*(C'\fR builds). If +the \s-1UTF\-8\s0 for the input character is malformed in some way, the program may +croak, or the function may return the \s-1REPLACEMENT CHARACTER,\s0 at the discretion +of the implementation, and subject to change in future releases. +.Sp +.Vb 1 +\& UV toUPPER_utf8(U8* p, U8* e, U8* s, STRLEN* lenp) +.Ve +.IP "toUPPER_utf8_safe" 8 +.IX Xref "toUPPER_utf8_safe" +.IX Item "toUPPER_utf8_safe" +Same as \*(L"toUPPER_utf8\*(R". +.Sp +.Vb 2 +\& UV toUPPER_utf8_safe(U8* p, U8* e, U8* s, +\& STRLEN* lenp) +.Ve +.IP "toUPPER_uvchr" 8 +.IX Xref "toUPPER_uvchr" +.IX Item "toUPPER_uvchr" +Converts the code point \f(CW\*(C`cp\*(C'\fR to its uppercase version, and +stores that in \s-1UTF\-8\s0 in \f(CW\*(C`s\*(C'\fR, and its length in bytes in \f(CW\*(C`lenp\*(C'\fR. The code +point is interpreted as native if less than 256; otherwise as Unicode. Note +that the buffer pointed to by \f(CW\*(C`s\*(C'\fR needs to be at least \f(CW\*(C`UTF8_MAXBYTES_CASE+1\*(C'\fR +bytes since the uppercase version may be longer than the original character. +.Sp +The first code point of the uppercased version is returned +(but note, as explained at the top of this section, that there may be more.) +.Sp +.Vb 1 +\& UV toUPPER_uvchr(UV cp, U8* s, STRLEN* lenp) +.Ve +.IP "\s-1WIDEST_UTYPE\s0" 8 +.IX Xref "WIDEST_UTYPE" +.IX Item "WIDEST_UTYPE" +Yields the widest unsigned integer type on the platform, currently either +\&\f(CW\*(C`U32\*(C'\fR or \f(CW64\fR. This can be used in declarations such as +.Sp +.Vb 1 +\& WIDEST_UTYPE my_uv; +.Ve +.Sp +or casts +.Sp +.Vb 1 +\& my_uv = (WIDEST_UTYPE) val; +.Ve +.SH "Character classification" +.IX Header "Character classification" +This section is about functions (really macros) that classify characters +into types, such as punctuation versus alphabetic, etc. Most of these are +analogous to regular expression character classes. (See +\&\*(L"\s-1POSIX\s0 Character Classes\*(R" in perlrecharclass.) There are several variants for +each class. (Not all macros have all variants; each item below lists the +ones valid for it.) None are affected by \f(CW\*(C`use bytes\*(C'\fR, and only the ones +with \f(CW\*(C`LC\*(C'\fR in the name are affected by the current locale. +.PP +The base function, e.g., \f(CW\*(C`isALPHA()\*(C'\fR, takes any signed or unsigned value, +treating it as a code point, and returns a boolean as to whether or not the +character represented by it is (or on non-ASCII platforms, corresponds to) an +\&\s-1ASCII\s0 character in the named class based on platform, Unicode, and Perl rules. +If the input is a number that doesn't fit in an octet, \s-1FALSE\s0 is returned. +.PP +Variant \f(CW\*(C`is\f(CIFOO\f(CW_A\*(C'\fR (e.g., \f(CW\*(C`isALPHA_A()\*(C'\fR) is identical to the base function +with no suffix \f(CW"_A"\fR. This variant is used to emphasize by its name that +only ASCII-range characters can return \s-1TRUE.\s0 +.PP +Variant \f(CW\*(C`is\f(CIFOO\f(CW_L1\*(C'\fR imposes the Latin\-1 (or \s-1EBCDIC\s0 equivalent) character set +onto the platform. That is, the code points that are \s-1ASCII\s0 are unaffected, +since \s-1ASCII\s0 is a subset of Latin\-1. But the non-ASCII code points are treated +as if they are Latin\-1 characters. For example, \f(CW\*(C`isWORDCHAR_L1()\*(C'\fR will return +true when called with the code point 0xDF, which is a word character in both +\&\s-1ASCII\s0 and \s-1EBCDIC\s0 (though it represents different characters in each). +If the input is a number that doesn't fit in an octet, \s-1FALSE\s0 is returned. +(Perl's documentation uses a colloquial definition of Latin\-1, to include all +code points below 256.) +.PP +Variant \f(CW\*(C`is\f(CIFOO\f(CW_uvchr\*(C'\fR is exactly like the \f(CW\*(C`is\f(CIFOO\f(CW_L1\*(C'\fR variant, for +inputs below 256, but if the code point is larger than 255, Unicode rules are +used to determine if it is in the character class. For example, +\&\f(CW\*(C`isWORDCHAR_uvchr(0x100)\*(C'\fR returns \s-1TRUE,\s0 since 0x100 is \s-1LATIN CAPITAL LETTER A +WITH MACRON\s0 in Unicode, and is a word character. +.PP +Variants \f(CW\*(C`is\f(CIFOO\f(CW_utf8\*(C'\fR and \f(CW\*(C`is\f(CIFOO\f(CW_utf8_safe\*(C'\fR are like \f(CW\*(C`is\f(CIFOO\f(CW_uvchr\*(C'\fR, +but are used for \s-1UTF\-8\s0 encoded strings. The two forms are different names for +the same thing. Each call to one of these classifies the first character of +the string starting at \f(CW\*(C`p\*(C'\fR. The second parameter, \f(CW\*(C`e\*(C'\fR, points to anywhere in +the string beyond the first character, up to one byte past the end of the +entire string. Although both variants are identical, the suffix \f(CW\*(C`_safe\*(C'\fR in +one name emphasizes that it will not attempt to read beyond \f(CW\*(C`e\ \-\ 1\*(C'\fR, +provided that the constraint \f(CW\*(C`s\ <\ e\*(C'\fR is true (this is asserted for in +\&\f(CW\*(C`\-DDEBUGGING\*(C'\fR builds). If the \s-1UTF\-8\s0 for the input character is malformed in +some way, the program may croak, or the function may return \s-1FALSE,\s0 at the +discretion of the implementation, and subject to change in future releases. +.PP +Variant \f(CW\*(C`is\f(CIFOO\f(CW_LC\*(C'\fR is like the \f(CW\*(C`is\f(CIFOO\f(CW_A\*(C'\fR and \f(CW\*(C`is\f(CIFOO\f(CW_L1\*(C'\fR variants, +but the result is based on the current locale, which is what \f(CW\*(C`LC\*(C'\fR in the name +stands for. If Perl can determine that the current locale is a \s-1UTF\-8\s0 locale, +it uses the published Unicode rules; otherwise, it uses the C library function +that gives the named classification. For example, \f(CW\*(C`isDIGIT_LC()\*(C'\fR when not in +a \s-1UTF\-8\s0 locale returns the result of calling \f(CW\*(C`isdigit()\*(C'\fR. \s-1FALSE\s0 is always +returned if the input won't fit into an octet. On some platforms where the C +library function is known to be defective, Perl changes its result to follow +the \s-1POSIX\s0 standard's rules. +.PP +Variant \f(CW\*(C`is\f(CIFOO\f(CW_LC_uvchr\*(C'\fR acts exactly like \f(CW\*(C`is\f(CIFOO\f(CW_LC\*(C'\fR for inputs less +than 256, but for larger ones it returns the Unicode classification of the code +point. +.PP +Variants \f(CW\*(C`is\f(CIFOO\f(CW_LC_utf8\*(C'\fR and \f(CW\*(C`is\f(CIFOO\f(CW_LC_utf8_safe\*(C'\fR are like +\&\f(CW\*(C`is\f(CIFOO\f(CW_LC_uvchr\*(C'\fR, but are used for \s-1UTF\-8\s0 encoded strings. The two forms +are different names for the same thing. Each call to one of these classifies +the first character of the string starting at \f(CW\*(C`p\*(C'\fR. The second parameter, +\&\f(CW\*(C`e\*(C'\fR, points to anywhere in the string beyond the first character, up to one +byte past the end of the entire string. Although both variants are identical, +the suffix \f(CW\*(C`_safe\*(C'\fR in one name emphasizes that it will not attempt to read +beyond \f(CW\*(C`e\ \-\ 1\*(C'\fR, provided that the constraint \f(CW\*(C`s\ <\ e\*(C'\fR is true (this +is asserted for in \f(CW\*(C`\-DDEBUGGING\*(C'\fR builds). If the \s-1UTF\-8\s0 for the input +character is malformed in some way, the program may croak, or the function may +return \s-1FALSE,\s0 at the discretion of the implementation, and subject to change in +future releases. +.IP "isALPHA" 8 +.IX Xref "isALPHA" +.IX Item "isALPHA" +Returns a boolean indicating whether the specified input is one of \f(CW\*(C`[A\-Za\-z]\*(C'\fR, +analogous to \f(CW\*(C`m/[[:alpha:]]/\*(C'\fR. +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isALPHA_A\*(C'\fR, \f(CW\*(C`isALPHA_L1\*(C'\fR, \f(CW\*(C`isALPHA_uvchr\*(C'\fR, \f(CW\*(C`isALPHA_utf8\*(C'\fR, +\&\f(CW\*(C`isALPHA_utf8_safe\*(C'\fR, \f(CW\*(C`isALPHA_LC\*(C'\fR, \f(CW\*(C`isALPHA_LC_uvchr\*(C'\fR, \f(CW\*(C`isALPHA_LC_utf8\*(C'\fR, +and \f(CW\*(C`isALPHA_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isALPHA(int ch) +.Ve +.IP "isALPHANUMERIC" 8 +.IX Xref "isALPHANUMERIC" +.IX Item "isALPHANUMERIC" +Returns a boolean indicating whether the specified character is one of +\&\f(CW\*(C`[A\-Za\-z0\-9]\*(C'\fR, analogous to \f(CW\*(C`m/[[:alnum:]]/\*(C'\fR. +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isALPHANUMERIC_A\*(C'\fR, \f(CW\*(C`isALPHANUMERIC_L1\*(C'\fR, \f(CW\*(C`isALPHANUMERIC_uvchr\*(C'\fR, +\&\f(CW\*(C`isALPHANUMERIC_utf8\*(C'\fR, \f(CW\*(C`isALPHANUMERIC_utf8_safe\*(C'\fR, \f(CW\*(C`isALPHANUMERIC_LC\*(C'\fR, +\&\f(CW\*(C`isALPHANUMERIC_LC_uvchr\*(C'\fR, \f(CW\*(C`isALPHANUMERIC_LC_utf8\*(C'\fR, and +\&\f(CW\*(C`isALPHANUMERIC_LC_utf8_safe\*(C'\fR. +.Sp +A (discouraged from use) synonym is \f(CW\*(C`isALNUMC\*(C'\fR (where the \f(CW\*(C`C\*(C'\fR suffix means +this corresponds to the C language alphanumeric definition). Also +there are the variants +\&\f(CW\*(C`isALNUMC_A\*(C'\fR, \f(CW\*(C`isALNUMC_L1\*(C'\fR +\&\f(CW\*(C`isALNUMC_LC\*(C'\fR, and \f(CW\*(C`isALNUMC_LC_uvchr\*(C'\fR. +.Sp +.Vb 1 +\& bool isALPHANUMERIC(int ch) +.Ve +.IP "isASCII" 8 +.IX Xref "isASCII" +.IX Item "isASCII" +Returns a boolean indicating whether the specified character is one of the 128 +characters in the \s-1ASCII\s0 character set, analogous to \f(CW\*(C`m/[[:ascii:]]/\*(C'\fR. +On non-ASCII platforms, it returns \s-1TRUE\s0 iff this +character corresponds to an \s-1ASCII\s0 character. Variants \f(CW\*(C`isASCII_A()\*(C'\fR and +\&\f(CW\*(C`isASCII_L1()\*(C'\fR are identical to \f(CW\*(C`isASCII()\*(C'\fR. +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isASCII_uvchr\*(C'\fR, \f(CW\*(C`isASCII_utf8\*(C'\fR, \f(CW\*(C`isASCII_utf8_safe\*(C'\fR, \f(CW\*(C`isASCII_LC\*(C'\fR, +\&\f(CW\*(C`isASCII_LC_uvchr\*(C'\fR, \f(CW\*(C`isASCII_LC_utf8\*(C'\fR, and \f(CW\*(C`isASCII_LC_utf8_safe\*(C'\fR. +Note, however, that some platforms do not have the C library routine +\&\f(CW\*(C`isascii()\*(C'\fR. In these cases, the variants whose names contain \f(CW\*(C`LC\*(C'\fR are the +same as the corresponding ones without. +.Sp +.Vb 1 +\& bool isASCII(int ch) +.Ve +.IP "isBLANK" 8 +.IX Xref "isBLANK" +.IX Item "isBLANK" +Returns a boolean indicating whether the specified character is a +character considered to be a blank, analogous to \f(CW\*(C`m/[[:blank:]]/\*(C'\fR. +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isBLANK_A\*(C'\fR, \f(CW\*(C`isBLANK_L1\*(C'\fR, \f(CW\*(C`isBLANK_uvchr\*(C'\fR, \f(CW\*(C`isBLANK_utf8\*(C'\fR, +\&\f(CW\*(C`isBLANK_utf8_safe\*(C'\fR, \f(CW\*(C`isBLANK_LC\*(C'\fR, \f(CW\*(C`isBLANK_LC_uvchr\*(C'\fR, \f(CW\*(C`isBLANK_LC_utf8\*(C'\fR, +and \f(CW\*(C`isBLANK_LC_utf8_safe\*(C'\fR. Note, +however, that some platforms do not have the C library routine +\&\f(CW\*(C`isblank()\*(C'\fR. In these cases, the variants whose names contain \f(CW\*(C`LC\*(C'\fR are +the same as the corresponding ones without. +.Sp +.Vb 1 +\& bool isBLANK(char ch) +.Ve +.IP "isCNTRL" 8 +.IX Xref "isCNTRL" +.IX Item "isCNTRL" +Returns a boolean indicating whether the specified character is a +control character, analogous to \f(CW\*(C`m/[[:cntrl:]]/\*(C'\fR. +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isCNTRL_A\*(C'\fR, \f(CW\*(C`isCNTRL_L1\*(C'\fR, \f(CW\*(C`isCNTRL_uvchr\*(C'\fR, \f(CW\*(C`isCNTRL_utf8\*(C'\fR, +\&\f(CW\*(C`isCNTRL_utf8_safe\*(C'\fR, \f(CW\*(C`isCNTRL_LC\*(C'\fR, \f(CW\*(C`isCNTRL_LC_uvchr\*(C'\fR, \f(CW\*(C`isCNTRL_LC_utf8\*(C'\fR +and \f(CW\*(C`isCNTRL_LC_utf8_safe\*(C'\fR. On \s-1EBCDIC\s0 +platforms, you almost always want to use the \f(CW\*(C`isCNTRL_L1\*(C'\fR variant. +.Sp +.Vb 1 +\& bool isCNTRL(char ch) +.Ve +.IP "isDIGIT" 8 +.IX Xref "isDIGIT" +.IX Item "isDIGIT" +Returns a boolean indicating whether the specified character is a +digit, analogous to \f(CW\*(C`m/[[:digit:]]/\*(C'\fR. +Variants \f(CW\*(C`isDIGIT_A\*(C'\fR and \f(CW\*(C`isDIGIT_L1\*(C'\fR are identical to \f(CW\*(C`isDIGIT\*(C'\fR. +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isDIGIT_uvchr\*(C'\fR, \f(CW\*(C`isDIGIT_utf8\*(C'\fR, \f(CW\*(C`isDIGIT_utf8_safe\*(C'\fR, \f(CW\*(C`isDIGIT_LC\*(C'\fR, +\&\f(CW\*(C`isDIGIT_LC_uvchr\*(C'\fR, \f(CW\*(C`isDIGIT_LC_utf8\*(C'\fR, and \f(CW\*(C`isDIGIT_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isDIGIT(char ch) +.Ve +.IP "isGRAPH" 8 +.IX Xref "isGRAPH" +.IX Item "isGRAPH" +Returns a boolean indicating whether the specified character is a +graphic character, analogous to \f(CW\*(C`m/[[:graph:]]/\*(C'\fR. +See the top of this section for an explanation of +variants \f(CW\*(C`isGRAPH_A\*(C'\fR, \f(CW\*(C`isGRAPH_L1\*(C'\fR, \f(CW\*(C`isGRAPH_uvchr\*(C'\fR, \f(CW\*(C`isGRAPH_utf8\*(C'\fR, +\&\f(CW\*(C`isGRAPH_utf8_safe\*(C'\fR, \f(CW\*(C`isGRAPH_LC\*(C'\fR, \f(CW\*(C`isGRAPH_LC_uvchr\*(C'\fR, +\&\f(CW\*(C`isGRAPH_LC_utf8_safe\*(C'\fR, and \f(CW\*(C`isGRAPH_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isGRAPH(char ch) +.Ve +.IP "isIDCONT" 8 +.IX Xref "isIDCONT" +.IX Item "isIDCONT" +Returns a boolean indicating whether the specified character can be the +second or succeeding character of an identifier. This is very close to, but +not quite the same as the official Unicode property \f(CW\*(C`XID_Continue\*(C'\fR. The +difference is that this returns true only if the input character also matches +\&\*(L"isWORDCHAR\*(R". See the top of this section for +an explanation of variants \f(CW\*(C`isIDCONT_A\*(C'\fR, \f(CW\*(C`isIDCONT_L1\*(C'\fR, \f(CW\*(C`isIDCONT_uvchr\*(C'\fR, +\&\f(CW\*(C`isIDCONT_utf8\*(C'\fR, \f(CW\*(C`isIDCONT_utf8_safe\*(C'\fR, \f(CW\*(C`isIDCONT_LC\*(C'\fR, \f(CW\*(C`isIDCONT_LC_uvchr\*(C'\fR, +\&\f(CW\*(C`isIDCONT_LC_utf8\*(C'\fR, and \f(CW\*(C`isIDCONT_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isIDCONT(char ch) +.Ve +.IP "isIDFIRST" 8 +.IX Xref "isIDFIRST" +.IX Item "isIDFIRST" +Returns a boolean indicating whether the specified character can be the first +character of an identifier. This is very close to, but not quite the same as +the official Unicode property \f(CW\*(C`XID_Start\*(C'\fR. The difference is that this +returns true only if the input character also matches \*(L"isWORDCHAR\*(R". +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isIDFIRST_A\*(C'\fR, \f(CW\*(C`isIDFIRST_L1\*(C'\fR, \f(CW\*(C`isIDFIRST_uvchr\*(C'\fR, \f(CW\*(C`isIDFIRST_utf8\*(C'\fR, +\&\f(CW\*(C`isIDFIRST_utf8_safe\*(C'\fR, \f(CW\*(C`isIDFIRST_LC\*(C'\fR, \f(CW\*(C`isIDFIRST_LC_uvchr\*(C'\fR, +\&\f(CW\*(C`isIDFIRST_LC_utf8\*(C'\fR, and \f(CW\*(C`isIDFIRST_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isIDFIRST(char ch) +.Ve +.IP "isLOWER" 8 +.IX Xref "isLOWER" +.IX Item "isLOWER" +Returns a boolean indicating whether the specified character is a +lowercase character, analogous to \f(CW\*(C`m/[[:lower:]]/\*(C'\fR. +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isLOWER_A\*(C'\fR, \f(CW\*(C`isLOWER_L1\*(C'\fR, \f(CW\*(C`isLOWER_uvchr\*(C'\fR, \f(CW\*(C`isLOWER_utf8\*(C'\fR, +\&\f(CW\*(C`isLOWER_utf8_safe\*(C'\fR, \f(CW\*(C`isLOWER_LC\*(C'\fR, \f(CW\*(C`isLOWER_LC_uvchr\*(C'\fR, \f(CW\*(C`isLOWER_LC_utf8\*(C'\fR, +and \f(CW\*(C`isLOWER_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isLOWER(char ch) +.Ve +.IP "isOCTAL" 8 +.IX Xref "isOCTAL" +.IX Item "isOCTAL" +Returns a boolean indicating whether the specified character is an +octal digit, [0\-7]. +The only two variants are \f(CW\*(C`isOCTAL_A\*(C'\fR and \f(CW\*(C`isOCTAL_L1\*(C'\fR; each is identical to +\&\f(CW\*(C`isOCTAL\*(C'\fR. +.Sp +.Vb 1 +\& bool isOCTAL(char ch) +.Ve +.IP "isPRINT" 8 +.IX Xref "isPRINT" +.IX Item "isPRINT" +Returns a boolean indicating whether the specified character is a +printable character, analogous to \f(CW\*(C`m/[[:print:]]/\*(C'\fR. +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isPRINT_A\*(C'\fR, \f(CW\*(C`isPRINT_L1\*(C'\fR, \f(CW\*(C`isPRINT_uvchr\*(C'\fR, \f(CW\*(C`isPRINT_utf8\*(C'\fR, +\&\f(CW\*(C`isPRINT_utf8_safe\*(C'\fR, \f(CW\*(C`isPRINT_LC\*(C'\fR, \f(CW\*(C`isPRINT_LC_uvchr\*(C'\fR, \f(CW\*(C`isPRINT_LC_utf8\*(C'\fR, +and \f(CW\*(C`isPRINT_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isPRINT(char ch) +.Ve +.IP "isPSXSPC" 8 +.IX Xref "isPSXSPC" +.IX Item "isPSXSPC" +(short for Posix Space) +Starting in 5.18, this is identical in all its forms to the +corresponding \f(CW\*(C`isSPACE()\*(C'\fR macros. +The locale forms of this macro are identical to their corresponding +\&\f(CW\*(C`isSPACE()\*(C'\fR forms in all Perl releases. In releases prior to 5.18, the +non-locale forms differ from their \f(CW\*(C`isSPACE()\*(C'\fR forms only in that the +\&\f(CW\*(C`isSPACE()\*(C'\fR forms don't match a Vertical Tab, and the \f(CW\*(C`isPSXSPC()\*(C'\fR forms do. +Otherwise they are identical. Thus this macro is analogous to what +\&\f(CW\*(C`m/[[:space:]]/\*(C'\fR matches in a regular expression. +See the top of this section for an explanation of +variants \f(CW\*(C`isPSXSPC_A\*(C'\fR, \f(CW\*(C`isPSXSPC_L1\*(C'\fR, \f(CW\*(C`isPSXSPC_uvchr\*(C'\fR, \f(CW\*(C`isPSXSPC_utf8\*(C'\fR, +\&\f(CW\*(C`isPSXSPC_utf8_safe\*(C'\fR, \f(CW\*(C`isPSXSPC_LC\*(C'\fR, \f(CW\*(C`isPSXSPC_LC_uvchr\*(C'\fR, +\&\f(CW\*(C`isPSXSPC_LC_utf8\*(C'\fR, and \f(CW\*(C`isPSXSPC_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isPSXSPC(char ch) +.Ve +.IP "isPUNCT" 8 +.IX Xref "isPUNCT" +.IX Item "isPUNCT" +Returns a boolean indicating whether the specified character is a +punctuation character, analogous to \f(CW\*(C`m/[[:punct:]]/\*(C'\fR. +Note that the definition of what is punctuation isn't as +straightforward as one might desire. See \*(L"\s-1POSIX\s0 Character +Classes\*(R" in perlrecharclass for details. +See the top of this section for an explanation of +variants \f(CW\*(C`isPUNCT_A\*(C'\fR, \f(CW\*(C`isPUNCT_L1\*(C'\fR, \f(CW\*(C`isPUNCT_uvchr\*(C'\fR, \f(CW\*(C`isPUNCT_utf8\*(C'\fR, +\&\f(CW\*(C`isPUNCT_utf8_safe\*(C'\fR, \f(CW\*(C`isPUNCT_LC\*(C'\fR, \f(CW\*(C`isPUNCT_LC_uvchr\*(C'\fR, \f(CW\*(C`isPUNCT_LC_utf8\*(C'\fR, +and \f(CW\*(C`isPUNCT_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isPUNCT(char ch) +.Ve +.IP "isSPACE" 8 +.IX Xref "isSPACE" +.IX Item "isSPACE" +Returns a boolean indicating whether the specified character is a +whitespace character. This is analogous +to what \f(CW\*(C`m/\es/\*(C'\fR matches in a regular expression. Starting in Perl 5.18 +this also matches what \f(CW\*(C`m/[[:space:]]/\*(C'\fR does. Prior to 5.18, only the +locale forms of this macro (the ones with \f(CW\*(C`LC\*(C'\fR in their names) matched +precisely what \f(CW\*(C`m/[[:space:]]/\*(C'\fR does. In those releases, the only difference, +in the non-locale variants, was that \f(CW\*(C`isSPACE()\*(C'\fR did not match a vertical tab. +(See \*(L"isPSXSPC\*(R" for a macro that matches a vertical tab in all releases.) +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isSPACE_A\*(C'\fR, \f(CW\*(C`isSPACE_L1\*(C'\fR, \f(CW\*(C`isSPACE_uvchr\*(C'\fR, \f(CW\*(C`isSPACE_utf8\*(C'\fR, +\&\f(CW\*(C`isSPACE_utf8_safe\*(C'\fR, \f(CW\*(C`isSPACE_LC\*(C'\fR, \f(CW\*(C`isSPACE_LC_uvchr\*(C'\fR, \f(CW\*(C`isSPACE_LC_utf8\*(C'\fR, +and \f(CW\*(C`isSPACE_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isSPACE(char ch) +.Ve +.IP "isUPPER" 8 +.IX Xref "isUPPER" +.IX Item "isUPPER" +Returns a boolean indicating whether the specified character is an +uppercase character, analogous to \f(CW\*(C`m/[[:upper:]]/\*(C'\fR. +See the top of this section for an explanation of +variants \f(CW\*(C`isUPPER_A\*(C'\fR, \f(CW\*(C`isUPPER_L1\*(C'\fR, \f(CW\*(C`isUPPER_uvchr\*(C'\fR, \f(CW\*(C`isUPPER_utf8\*(C'\fR, +\&\f(CW\*(C`isUPPER_utf8_safe\*(C'\fR, \f(CW\*(C`isUPPER_LC\*(C'\fR, \f(CW\*(C`isUPPER_LC_uvchr\*(C'\fR, \f(CW\*(C`isUPPER_LC_utf8\*(C'\fR, +and \f(CW\*(C`isUPPER_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isUPPER(char ch) +.Ve +.IP "isWORDCHAR" 8 +.IX Xref "isWORDCHAR" +.IX Item "isWORDCHAR" +Returns a boolean indicating whether the specified character is a character +that is a word character, analogous to what \f(CW\*(C`m/\ew/\*(C'\fR and \f(CW\*(C`m/[[:word:]]/\*(C'\fR match +in a regular expression. A word character is an alphabetic character, a +decimal digit, a connecting punctuation character (such as an underscore), or +a \*(L"mark\*(R" character that attaches to one of those (like some sort of accent). +\&\f(CW\*(C`isALNUM()\*(C'\fR is a synonym provided for backward compatibility, even though a +word character includes more than the standard C language meaning of +alphanumeric. +See the top of this section for an explanation of +variants \f(CW\*(C`isWORDCHAR_A\*(C'\fR, \f(CW\*(C`isWORDCHAR_L1\*(C'\fR, \f(CW\*(C`isWORDCHAR_uvchr\*(C'\fR, +\&\f(CW\*(C`isWORDCHAR_utf8\*(C'\fR, and \f(CW\*(C`isWORDCHAR_utf8_safe\*(C'\fR. \f(CW\*(C`isWORDCHAR_LC\*(C'\fR, +\&\f(CW\*(C`isWORDCHAR_LC_uvchr\*(C'\fR, \f(CW\*(C`isWORDCHAR_LC_utf8\*(C'\fR, and \f(CW\*(C`isWORDCHAR_LC_utf8_safe\*(C'\fR +are also as described there, but additionally include the platform's native +underscore. +.Sp +.Vb 1 +\& bool isWORDCHAR(char ch) +.Ve +.IP "isXDIGIT" 8 +.IX Xref "isXDIGIT" +.IX Item "isXDIGIT" +Returns a boolean indicating whether the specified character is a hexadecimal +digit. In the \s-1ASCII\s0 range these are \f(CW\*(C`[0\-9A\-Fa\-f]\*(C'\fR. Variants \f(CW\*(C`isXDIGIT_A()\*(C'\fR +and \f(CW\*(C`isXDIGIT_L1()\*(C'\fR are identical to \f(CW\*(C`isXDIGIT()\*(C'\fR. +See the top of this section for an explanation of +variants +\&\f(CW\*(C`isXDIGIT_uvchr\*(C'\fR, \f(CW\*(C`isXDIGIT_utf8\*(C'\fR, \f(CW\*(C`isXDIGIT_utf8_safe\*(C'\fR, \f(CW\*(C`isXDIGIT_LC\*(C'\fR, +\&\f(CW\*(C`isXDIGIT_LC_uvchr\*(C'\fR, \f(CW\*(C`isXDIGIT_LC_utf8\*(C'\fR, and \f(CW\*(C`isXDIGIT_LC_utf8_safe\*(C'\fR. +.Sp +.Vb 1 +\& bool isXDIGIT(char ch) +.Ve +.SH "Cloning an interpreter" +.IX Header "Cloning an interpreter" +.IP "perl_clone" 8 +.IX Xref "perl_clone" +.IX Item "perl_clone" +Create and return a new interpreter by cloning the current one. +.Sp +\&\f(CW\*(C`perl_clone\*(C'\fR takes these flags as parameters: +.Sp +\&\f(CW\*(C`CLONEf_COPY_STACKS\*(C'\fR \- is used to, well, copy the stacks also, +without it we only clone the data and zero the stacks, +with it we copy the stacks and the new perl interpreter is +ready to run at the exact same point as the previous one. +The pseudo-fork code uses \f(CW\*(C`COPY_STACKS\*(C'\fR while the +threads\->create doesn't. +.Sp +\&\f(CW\*(C`CLONEf_KEEP_PTR_TABLE\*(C'\fR \- +\&\f(CW\*(C`perl_clone\*(C'\fR keeps a ptr_table with the pointer of the old +variable as a key and the new variable as a value, +this allows it to check if something has been cloned and not +clone it again, but rather just use the value and increase the +refcount. +If \f(CW\*(C`KEEP_PTR_TABLE\*(C'\fR is not set then \f(CW\*(C`perl_clone\*(C'\fR will kill the ptr_table +using the function \f(CW\*(C`ptr_table_free(PL_ptr_table);\ PL_ptr_table\ =\ NULL;\*(C'\fR. +A reason to keep it around is if you want to dup some of your own +variables which are outside the graph that perl scans. +.Sp +\&\f(CW\*(C`CLONEf_CLONE_HOST\*(C'\fR \- +This is a win32 thing, it is ignored on unix, it tells perl's +win32host code (which is c++) to clone itself, this is needed on +win32 if you want to run two threads at the same time, +if you just want to do some stuff in a separate perl interpreter +and then throw it away and return to the original one, +you don't need to do anything. +.Sp +.Vb 4 +\& PerlInterpreter* perl_clone( +\& PerlInterpreter *proto_perl, +\& UV flags +\& ) +.Ve +.SH "Compile-time scope hooks" +.IX Header "Compile-time scope hooks" +.IP "BhkDISABLE" 8 +.IX Xref "BhkDISABLE" +.IX Item "BhkDISABLE" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Temporarily disable an entry in this \s-1BHK\s0 structure, by clearing the +appropriate flag. \f(CW\*(C`which\*(C'\fR is a preprocessor token indicating which +entry to disable. +.Sp +.Vb 1 +\& void BhkDISABLE(BHK *hk, which) +.Ve +.IP "BhkENABLE" 8 +.IX Xref "BhkENABLE" +.IX Item "BhkENABLE" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Re-enable an entry in this \s-1BHK\s0 structure, by setting the appropriate +flag. \f(CW\*(C`which\*(C'\fR is a preprocessor token indicating which entry to enable. +This will assert (under \-DDEBUGGING) if the entry doesn't contain a valid +pointer. +.Sp +.Vb 1 +\& void BhkENABLE(BHK *hk, which) +.Ve +.IP "BhkENTRY_set" 8 +.IX Xref "BhkENTRY_set" +.IX Item "BhkENTRY_set" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Set an entry in the \s-1BHK\s0 structure, and set the flags to indicate it is +valid. \f(CW\*(C`which\*(C'\fR is a preprocessing token indicating which entry to set. +The type of \f(CW\*(C`ptr\*(C'\fR depends on the entry. +.Sp +.Vb 1 +\& void BhkENTRY_set(BHK *hk, which, void *ptr) +.Ve +.IP "blockhook_register" 8 +.IX Xref "blockhook_register" +.IX Item "blockhook_register" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Register a set of hooks to be called when the Perl lexical scope changes +at compile time. See \*(L"Compile-time scope hooks\*(R" in perlguts. +.Sp +\&\s-1NOTE:\s0 this function must be explicitly called as Perl_blockhook_register with an aTHX_ parameter. +.Sp +.Vb 1 +\& void Perl_blockhook_register(pTHX_ BHK *hk) +.Ve +.SH "COP Hint Hashes" +.IX Header "COP Hint Hashes" +.IP "cophh_2hv" 8 +.IX Xref "cophh_2hv" +.IX Item "cophh_2hv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Generates and returns a standard Perl hash representing the full set of +key/value pairs in the cop hints hash \f(CW\*(C`cophh\*(C'\fR. \f(CW\*(C`flags\*(C'\fR is currently +unused and must be zero. +.Sp +.Vb 1 +\& HV * cophh_2hv(const COPHH *cophh, U32 flags) +.Ve +.IP "cophh_copy" 8 +.IX Xref "cophh_copy" +.IX Item "cophh_copy" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Make and return a complete copy of the cop hints hash \f(CW\*(C`cophh\*(C'\fR. +.Sp +.Vb 1 +\& COPHH * cophh_copy(COPHH *cophh) +.Ve +.IP "cophh_delete_pv" 8 +.IX Xref "cophh_delete_pv" +.IX Item "cophh_delete_pv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"cophh_delete_pvn\*(R", but takes a nul-terminated string instead of +a string/length pair. +.Sp +.Vb 3 +\& COPHH * cophh_delete_pv(const COPHH *cophh, +\& const char *key, U32 hash, +\& U32 flags) +.Ve +.IP "cophh_delete_pvn" 8 +.IX Xref "cophh_delete_pvn" +.IX Item "cophh_delete_pvn" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Delete a key and its associated value from the cop hints hash \f(CW\*(C`cophh\*(C'\fR, +and returns the modified hash. The returned hash pointer is in general +not the same as the hash pointer that was passed in. The input hash is +consumed by the function, and the pointer to it must not be subsequently +used. Use \*(L"cophh_copy\*(R" if you need both hashes. +.Sp +The key is specified by \f(CW\*(C`keypv\*(C'\fR and \f(CW\*(C`keylen\*(C'\fR. If \f(CW\*(C`flags\*(C'\fR has the +\&\f(CW\*(C`COPHH_KEY_UTF8\*(C'\fR bit set, the key octets are interpreted as \s-1UTF\-8,\s0 +otherwise they are interpreted as Latin\-1. \f(CW\*(C`hash\*(C'\fR is a precomputed +hash of the key string, or zero if it has not been precomputed. +.Sp +.Vb 4 +\& COPHH * cophh_delete_pvn(COPHH *cophh, +\& const char *keypv, +\& STRLEN keylen, U32 hash, +\& U32 flags) +.Ve +.IP "cophh_delete_pvs" 8 +.IX Xref "cophh_delete_pvs" +.IX Item "cophh_delete_pvs" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"cophh_delete_pvn\*(R", but takes a literal string instead +of a string/length pair, and no precomputed hash. +.Sp +.Vb 2 +\& COPHH * cophh_delete_pvs(const COPHH *cophh, "key", +\& U32 flags) +.Ve +.IP "cophh_delete_sv" 8 +.IX Xref "cophh_delete_sv" +.IX Item "cophh_delete_sv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"cophh_delete_pvn\*(R", but takes a Perl scalar instead of a +string/length pair. +.Sp +.Vb 2 +\& COPHH * cophh_delete_sv(const COPHH *cophh, SV *key, +\& U32 hash, U32 flags) +.Ve +.IP "cophh_fetch_pv" 8 +.IX Xref "cophh_fetch_pv" +.IX Item "cophh_fetch_pv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"cophh_fetch_pvn\*(R", but takes a nul-terminated string instead of +a string/length pair. +.Sp +.Vb 3 +\& SV * cophh_fetch_pv(const COPHH *cophh, +\& const char *key, U32 hash, +\& U32 flags) +.Ve +.IP "cophh_fetch_pvn" 8 +.IX Xref "cophh_fetch_pvn" +.IX Item "cophh_fetch_pvn" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Look up the entry in the cop hints hash \f(CW\*(C`cophh\*(C'\fR with the key specified by +\&\f(CW\*(C`keypv\*(C'\fR and \f(CW\*(C`keylen\*(C'\fR. If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`COPHH_KEY_UTF8\*(C'\fR bit set, +the key octets are interpreted as \s-1UTF\-8,\s0 otherwise they are interpreted +as Latin\-1. \f(CW\*(C`hash\*(C'\fR is a precomputed hash of the key string, or zero if +it has not been precomputed. Returns a mortal scalar copy of the value +associated with the key, or \f(CW&PL_sv_placeholder\fR if there is no value +associated with the key. +.Sp +.Vb 4 +\& SV * cophh_fetch_pvn(const COPHH *cophh, +\& const char *keypv, +\& STRLEN keylen, U32 hash, +\& U32 flags) +.Ve +.IP "cophh_fetch_pvs" 8 +.IX Xref "cophh_fetch_pvs" +.IX Item "cophh_fetch_pvs" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"cophh_fetch_pvn\*(R", but takes a literal string instead +of a string/length pair, and no precomputed hash. +.Sp +.Vb 2 +\& SV * cophh_fetch_pvs(const COPHH *cophh, "key", +\& U32 flags) +.Ve +.IP "cophh_fetch_sv" 8 +.IX Xref "cophh_fetch_sv" +.IX Item "cophh_fetch_sv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"cophh_fetch_pvn\*(R", but takes a Perl scalar instead of a +string/length pair. +.Sp +.Vb 2 +\& SV * cophh_fetch_sv(const COPHH *cophh, SV *key, +\& U32 hash, U32 flags) +.Ve +.IP "cophh_free" 8 +.IX Xref "cophh_free" +.IX Item "cophh_free" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Discard the cop hints hash \f(CW\*(C`cophh\*(C'\fR, freeing all resources associated +with it. +.Sp +.Vb 1 +\& void cophh_free(COPHH *cophh) +.Ve +.IP "cophh_new_empty" 8 +.IX Xref "cophh_new_empty" +.IX Item "cophh_new_empty" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Generate and return a fresh cop hints hash containing no entries. +.Sp +.Vb 1 +\& COPHH * cophh_new_empty() +.Ve +.IP "cophh_store_pv" 8 +.IX Xref "cophh_store_pv" +.IX Item "cophh_store_pv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"cophh_store_pvn\*(R", but takes a nul-terminated string instead of +a string/length pair. +.Sp +.Vb 3 +\& COPHH * cophh_store_pv(const COPHH *cophh, +\& const char *key, U32 hash, +\& SV *value, U32 flags) +.Ve +.IP "cophh_store_pvn" 8 +.IX Xref "cophh_store_pvn" +.IX Item "cophh_store_pvn" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Stores a value, associated with a key, in the cop hints hash \f(CW\*(C`cophh\*(C'\fR, +and returns the modified hash. The returned hash pointer is in general +not the same as the hash pointer that was passed in. The input hash is +consumed by the function, and the pointer to it must not be subsequently +used. Use \*(L"cophh_copy\*(R" if you need both hashes. +.Sp +The key is specified by \f(CW\*(C`keypv\*(C'\fR and \f(CW\*(C`keylen\*(C'\fR. If \f(CW\*(C`flags\*(C'\fR has the +\&\f(CW\*(C`COPHH_KEY_UTF8\*(C'\fR bit set, the key octets are interpreted as \s-1UTF\-8,\s0 +otherwise they are interpreted as Latin\-1. \f(CW\*(C`hash\*(C'\fR is a precomputed +hash of the key string, or zero if it has not been precomputed. +.Sp +\&\f(CW\*(C`value\*(C'\fR is the scalar value to store for this key. \f(CW\*(C`value\*(C'\fR is copied +by this function, which thus does not take ownership of any reference +to it, and later changes to the scalar will not be reflected in the +value visible in the cop hints hash. Complex types of scalar will not +be stored with referential integrity, but will be coerced to strings. +.Sp +.Vb 3 +\& COPHH * cophh_store_pvn(COPHH *cophh, const char *keypv, +\& STRLEN keylen, U32 hash, +\& SV *value, U32 flags) +.Ve +.IP "cophh_store_pvs" 8 +.IX Xref "cophh_store_pvs" +.IX Item "cophh_store_pvs" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"cophh_store_pvn\*(R", but takes a literal string instead +of a string/length pair, and no precomputed hash. +.Sp +.Vb 2 +\& COPHH * cophh_store_pvs(const COPHH *cophh, "key", +\& SV *value, U32 flags) +.Ve +.IP "cophh_store_sv" 8 +.IX Xref "cophh_store_sv" +.IX Item "cophh_store_sv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"cophh_store_pvn\*(R", but takes a Perl scalar instead of a +string/length pair. +.Sp +.Vb 2 +\& COPHH * cophh_store_sv(const COPHH *cophh, SV *key, +\& U32 hash, SV *value, U32 flags) +.Ve +.SH "COP Hint Reading" +.IX Header "COP Hint Reading" +.IP "cop_hints_2hv" 8 +.IX Xref "cop_hints_2hv" +.IX Item "cop_hints_2hv" +Generates and returns a standard Perl hash representing the full set of +hint entries in the cop \f(CW\*(C`cop\*(C'\fR. \f(CW\*(C`flags\*(C'\fR is currently unused and must +be zero. +.Sp +.Vb 1 +\& HV * cop_hints_2hv(const COP *cop, U32 flags) +.Ve +.IP "cop_hints_fetch_pv" 8 +.IX Xref "cop_hints_fetch_pv" +.IX Item "cop_hints_fetch_pv" +Like \*(L"cop_hints_fetch_pvn\*(R", but takes a nul-terminated string instead +of a string/length pair. +.Sp +.Vb 3 +\& SV * cop_hints_fetch_pv(const COP *cop, +\& const char *key, U32 hash, +\& U32 flags) +.Ve +.IP "cop_hints_fetch_pvn" 8 +.IX Xref "cop_hints_fetch_pvn" +.IX Item "cop_hints_fetch_pvn" +Look up the hint entry in the cop \f(CW\*(C`cop\*(C'\fR with the key specified by +\&\f(CW\*(C`keypv\*(C'\fR and \f(CW\*(C`keylen\*(C'\fR. If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`COPHH_KEY_UTF8\*(C'\fR bit set, +the key octets are interpreted as \s-1UTF\-8,\s0 otherwise they are interpreted +as Latin\-1. \f(CW\*(C`hash\*(C'\fR is a precomputed hash of the key string, or zero if +it has not been precomputed. Returns a mortal scalar copy of the value +associated with the key, or \f(CW&PL_sv_placeholder\fR if there is no value +associated with the key. +.Sp +.Vb 4 +\& SV * cop_hints_fetch_pvn(const COP *cop, +\& const char *keypv, +\& STRLEN keylen, U32 hash, +\& U32 flags) +.Ve +.IP "cop_hints_fetch_pvs" 8 +.IX Xref "cop_hints_fetch_pvs" +.IX Item "cop_hints_fetch_pvs" +Like \*(L"cop_hints_fetch_pvn\*(R", but takes a literal string +instead of a string/length pair, and no precomputed hash. +.Sp +.Vb 2 +\& SV * cop_hints_fetch_pvs(const COP *cop, "key", +\& U32 flags) +.Ve +.IP "cop_hints_fetch_sv" 8 +.IX Xref "cop_hints_fetch_sv" +.IX Item "cop_hints_fetch_sv" +Like \*(L"cop_hints_fetch_pvn\*(R", but takes a Perl scalar instead of a +string/length pair. +.Sp +.Vb 2 +\& SV * cop_hints_fetch_sv(const COP *cop, SV *key, +\& U32 hash, U32 flags) +.Ve +.IP "CopLABEL" 8 +.IX Xref "CopLABEL" +.IX Item "CopLABEL" +Returns the label attached to a cop. +.Sp +.Vb 1 +\& const char * CopLABEL(COP *const cop) +.Ve +.IP "CopLABEL_len" 8 +.IX Xref "CopLABEL_len" +.IX Item "CopLABEL_len" +Returns the label attached to a cop, and stores its length in bytes into +\&\f(CW*len\fR. +.Sp +.Vb 1 +\& const char * CopLABEL_len(COP *const cop, STRLEN *len) +.Ve +.IP "CopLABEL_len_flags" 8 +.IX Xref "CopLABEL_len_flags" +.IX Item "CopLABEL_len_flags" +Returns the label attached to a cop, and stores its length in bytes into +\&\f(CW*len\fR. Upon return, \f(CW*flags\fR will be set to either \f(CW\*(C`SVf_UTF8\*(C'\fR or 0. +.Sp +.Vb 2 +\& const char * CopLABEL_len_flags(COP *const cop, +\& STRLEN *len, U32 *flags) +.Ve +.SH "Custom Operators" +.IX Header "Custom Operators" +.IP "custom_op_register" 8 +.IX Xref "custom_op_register" +.IX Item "custom_op_register" +Register a custom op. See \*(L"Custom Operators\*(R" in perlguts. +.Sp +\&\s-1NOTE:\s0 this function must be explicitly called as Perl_custom_op_register with an aTHX_ parameter. +.Sp +.Vb 3 +\& void Perl_custom_op_register(pTHX_ +\& Perl_ppaddr_t ppaddr, +\& const XOP *xop) +.Ve +.IP "Perl_custom_op_xop" 8 +.IX Xref "Perl_custom_op_xop" +.IX Item "Perl_custom_op_xop" +Return the \s-1XOP\s0 structure for a given custom op. This macro should be +considered internal to \f(CW\*(C`OP_NAME\*(C'\fR and the other access macros: use them instead. +This macro does call a function. Prior +to 5.19.6, this was implemented as a +function. +.Sp +.Vb 1 +\& const XOP * Perl_custom_op_xop(pTHX_ const OP *o) +.Ve +.IP "XopDISABLE" 8 +.IX Xref "XopDISABLE" +.IX Item "XopDISABLE" +Temporarily disable a member of the \s-1XOP,\s0 by clearing the appropriate flag. +.Sp +.Vb 1 +\& void XopDISABLE(XOP *xop, which) +.Ve +.IP "XopENABLE" 8 +.IX Xref "XopENABLE" +.IX Item "XopENABLE" +Reenable a member of the \s-1XOP\s0 which has been disabled. +.Sp +.Vb 1 +\& void XopENABLE(XOP *xop, which) +.Ve +.IP "XopENTRY" 8 +.IX Xref "XopENTRY" +.IX Item "XopENTRY" +Return a member of the \s-1XOP\s0 structure. \f(CW\*(C`which\*(C'\fR is a cpp token +indicating which entry to return. If the member is not set +this will return a default value. The return type depends +on \f(CW\*(C`which\*(C'\fR. This macro evaluates its arguments more than +once. If you are using \f(CW\*(C`Perl_custom_op_xop\*(C'\fR to retreive a +\&\f(CW\*(C`XOP *\*(C'\fR from a \f(CW\*(C`OP *\*(C'\fR, use the more efficient \*(L"XopENTRYCUSTOM\*(R" instead. +.Sp +.Vb 1 +\& XopENTRY(XOP *xop, which) +.Ve +.IP "XopENTRYCUSTOM" 8 +.IX Xref "XopENTRYCUSTOM" +.IX Item "XopENTRYCUSTOM" +Exactly like \f(CW\*(C`XopENTRY(XopENTRY(Perl_custom_op_xop(aTHX_ o), which)\*(C'\fR but more +efficient. The \f(CW\*(C`which\*(C'\fR parameter is identical to \*(L"XopENTRY\*(R". +.Sp +.Vb 1 +\& XopENTRYCUSTOM(const OP *o, which) +.Ve +.IP "XopENTRY_set" 8 +.IX Xref "XopENTRY_set" +.IX Item "XopENTRY_set" +Set a member of the \s-1XOP\s0 structure. \f(CW\*(C`which\*(C'\fR is a cpp token +indicating which entry to set. See \*(L"Custom Operators\*(R" in perlguts +for details about the available members and how +they are used. This macro evaluates its argument +more than once. +.Sp +.Vb 1 +\& void XopENTRY_set(XOP *xop, which, value) +.Ve +.IP "XopFLAGS" 8 +.IX Xref "XopFLAGS" +.IX Item "XopFLAGS" +Return the \s-1XOP\s0's flags. +.Sp +.Vb 1 +\& U32 XopFLAGS(XOP *xop) +.Ve +.SH "CV Manipulation Functions" +.IX Header "CV Manipulation Functions" +This section documents functions to manipulate CVs which are code-values, +or subroutines. For more information, see perlguts. +.IP "caller_cx" 8 +.IX Xref "caller_cx" +.IX Item "caller_cx" +The XSUB-writer's equivalent of \fBcaller()\fR. The +returned \f(CW\*(C`PERL_CONTEXT\*(C'\fR structure can be interrogated to find all the +information returned to Perl by \f(CW\*(C`caller\*(C'\fR. Note that XSUBs don't get a +stack frame, so \f(CW\*(C`caller_cx(0, NULL)\*(C'\fR will return information for the +immediately-surrounding Perl code. +.Sp +This function skips over the automatic calls to \f(CW&DB::sub\fR made on the +behalf of the debugger. If the stack frame requested was a sub called by +\&\f(CW\*(C`DB::sub\*(C'\fR, the return value will be the frame for the call to +\&\f(CW\*(C`DB::sub\*(C'\fR, since that has the correct line number/etc. for the call +site. If \fIdbcxp\fR is non\-\f(CW\*(C`NULL\*(C'\fR, it will be set to a pointer to the +frame for the sub call itself. +.Sp +.Vb 4 +\& const PERL_CONTEXT * caller_cx( +\& I32 level, +\& const PERL_CONTEXT **dbcxp +\& ) +.Ve +.IP "CvSTASH" 8 +.IX Xref "CvSTASH" +.IX Item "CvSTASH" +Returns the stash of the \s-1CV.\s0 A stash is the symbol table hash, containing +the package-scoped variables in the package where the subroutine was defined. +For more information, see perlguts. +.Sp +This also has a special use with \s-1XS AUTOLOAD\s0 subs. +See \*(L"Autoloading with XSUBs\*(R" in perlguts. +.Sp +.Vb 1 +\& HV* CvSTASH(CV* cv) +.Ve +.IP "find_runcv" 8 +.IX Xref "find_runcv" +.IX Item "find_runcv" +Locate the \s-1CV\s0 corresponding to the currently executing sub or eval. +If \f(CW\*(C`db_seqp\*(C'\fR is non_null, skip CVs that are in the \s-1DB\s0 package and populate +\&\f(CW*db_seqp\fR with the cop sequence number at the point that the \s-1DB::\s0 code was +entered. (This allows debuggers to eval in the scope of the breakpoint +rather than in the scope of the debugger itself.) +.Sp +.Vb 1 +\& CV* find_runcv(U32 *db_seqp) +.Ve +.IP "get_cv" 8 +.IX Xref "get_cv" +.IX Item "get_cv" +Uses \f(CW\*(C`strlen\*(C'\fR to get the length of \f(CW\*(C`name\*(C'\fR, then calls \f(CW\*(C`get_cvn_flags\*(C'\fR. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& CV* get_cv(const char* name, I32 flags) +.Ve +.IP "get_cvn_flags" 8 +.IX Xref "get_cvn_flags" +.IX Item "get_cvn_flags" +Returns the \s-1CV\s0 of the specified Perl subroutine. \f(CW\*(C`flags\*(C'\fR are passed to +\&\f(CW\*(C`gv_fetchpvn_flags\*(C'\fR. If \f(CW\*(C`GV_ADD\*(C'\fR is set and the Perl subroutine does not +exist then it will be declared (which has the same effect as saying +\&\f(CW\*(C`sub name;\*(C'\fR). If \f(CW\*(C`GV_ADD\*(C'\fR is not set and the subroutine does not exist +then \s-1NULL\s0 is returned. +.Sp +.Vb 2 +\& CV* get_cvn_flags(const char* name, STRLEN len, +\& I32 flags) +.Ve +.ie n .SH """xsubpp"" variables and internal functions" +.el .SH "\f(CWxsubpp\fP variables and internal functions" +.IX Header "xsubpp variables and internal functions" +.IP "ax" 8 +.IX Xref "ax" +.IX Item "ax" +Variable which is setup by \f(CW\*(C`xsubpp\*(C'\fR to indicate the stack base offset, +used by the \f(CW\*(C`ST\*(C'\fR, \f(CW\*(C`XSprePUSH\*(C'\fR and \f(CW\*(C`XSRETURN\*(C'\fR macros. The \f(CW\*(C`dMARK\*(C'\fR macro +must be called prior to setup the \f(CW\*(C`MARK\*(C'\fR variable. +.Sp +.Vb 1 +\& I32 ax +.Ve +.IP "\s-1CLASS\s0" 8 +.IX Xref "CLASS" +.IX Item "CLASS" +Variable which is setup by \f(CW\*(C`xsubpp\*(C'\fR to indicate the +class name for a \*(C+ \s-1XS\s0 constructor. This is always a \f(CW\*(C`char*\*(C'\fR. See +\&\f(CW"THIS"\fR. +.Sp +.Vb 1 +\& char* CLASS +.Ve +.IP "dAX" 8 +.IX Xref "dAX" +.IX Item "dAX" +Sets up the \f(CW\*(C`ax\*(C'\fR variable. +This is usually handled automatically by \f(CW\*(C`xsubpp\*(C'\fR by calling \f(CW\*(C`dXSARGS\*(C'\fR. +.Sp +.Vb 1 +\& dAX; +.Ve +.IP "dAXMARK" 8 +.IX Xref "dAXMARK" +.IX Item "dAXMARK" +Sets up the \f(CW\*(C`ax\*(C'\fR variable and stack marker variable \f(CW\*(C`mark\*(C'\fR. +This is usually handled automatically by \f(CW\*(C`xsubpp\*(C'\fR by calling \f(CW\*(C`dXSARGS\*(C'\fR. +.Sp +.Vb 1 +\& dAXMARK; +.Ve +.IP "dITEMS" 8 +.IX Xref "dITEMS" +.IX Item "dITEMS" +Sets up the \f(CW\*(C`items\*(C'\fR variable. +This is usually handled automatically by \f(CW\*(C`xsubpp\*(C'\fR by calling \f(CW\*(C`dXSARGS\*(C'\fR. +.Sp +.Vb 1 +\& dITEMS; +.Ve +.IP "dUNDERBAR" 8 +.IX Xref "dUNDERBAR" +.IX Item "dUNDERBAR" +Sets up any variable needed by the \f(CW\*(C`UNDERBAR\*(C'\fR macro. It used to define +\&\f(CW\*(C`padoff_du\*(C'\fR, but it is currently a noop. However, it is strongly advised +to still use it for ensuring past and future compatibility. +.Sp +.Vb 1 +\& dUNDERBAR; +.Ve +.IP "dXSARGS" 8 +.IX Xref "dXSARGS" +.IX Item "dXSARGS" +Sets up stack and mark pointers for an \s-1XSUB,\s0 calling \f(CW\*(C`dSP\*(C'\fR and \f(CW\*(C`dMARK\*(C'\fR. +Sets up the \f(CW\*(C`ax\*(C'\fR and \f(CW\*(C`items\*(C'\fR variables by calling \f(CW\*(C`dAX\*(C'\fR and \f(CW\*(C`dITEMS\*(C'\fR. +This is usually handled automatically by \f(CW\*(C`xsubpp\*(C'\fR. +.Sp +.Vb 1 +\& dXSARGS; +.Ve +.IP "dXSI32" 8 +.IX Xref "dXSI32" +.IX Item "dXSI32" +Sets up the \f(CW\*(C`ix\*(C'\fR variable for an \s-1XSUB\s0 which has aliases. This is usually +handled automatically by \f(CW\*(C`xsubpp\*(C'\fR. +.Sp +.Vb 1 +\& dXSI32; +.Ve +.IP "items" 8 +.IX Xref "items" +.IX Item "items" +Variable which is setup by \f(CW\*(C`xsubpp\*(C'\fR to indicate the number of +items on the stack. See \*(L"Variable-length Parameter Lists\*(R" in perlxs. +.Sp +.Vb 1 +\& I32 items +.Ve +.IP "ix" 8 +.IX Xref "ix" +.IX Item "ix" +Variable which is setup by \f(CW\*(C`xsubpp\*(C'\fR to indicate which of an +\&\s-1XSUB\s0's aliases was used to invoke it. See \*(L"The \s-1ALIAS:\s0 Keyword\*(R" in perlxs. +.Sp +.Vb 1 +\& I32 ix +.Ve +.IP "\s-1RETVAL\s0" 8 +.IX Xref "RETVAL" +.IX Item "RETVAL" +Variable which is setup by \f(CW\*(C`xsubpp\*(C'\fR to hold the return value for an +\&\s-1XSUB.\s0 This is always the proper type for the \s-1XSUB.\s0 See +\&\*(L"The \s-1RETVAL\s0 Variable\*(R" in perlxs. +.Sp +.Vb 1 +\& (whatever) RETVAL +.Ve +.IP "\s-1ST\s0" 8 +.IX Xref "ST" +.IX Item "ST" +Used to access elements on the \s-1XSUB\s0's stack. +.Sp +.Vb 1 +\& SV* ST(int ix) +.Ve +.IP "\s-1THIS\s0" 8 +.IX Xref "THIS" +.IX Item "THIS" +Variable which is setup by \f(CW\*(C`xsubpp\*(C'\fR to designate the object in a \*(C+ +\&\s-1XSUB.\s0 This is always the proper type for the \*(C+ object. See \f(CW"CLASS"\fR and +\&\*(L"Using \s-1XS\s0 With \*(C+\*(R" in perlxs. +.Sp +.Vb 1 +\& (whatever) THIS +.Ve +.IP "\s-1UNDERBAR\s0" 8 +.IX Xref "UNDERBAR" +.IX Item "UNDERBAR" +The SV* corresponding to the \f(CW$_\fR variable. Works even if there +is a lexical \f(CW$_\fR in scope. +.IP "\s-1XS\s0" 8 +.IX Xref "XS" +.IX Item "XS" +Macro to declare an \s-1XSUB\s0 and its C parameter list. This is handled by +\&\f(CW\*(C`xsubpp\*(C'\fR. It is the same as using the more explicit \f(CW\*(C`XS_EXTERNAL\*(C'\fR macro. +.IP "\s-1XS_EXTERNAL\s0" 8 +.IX Xref "XS_EXTERNAL" +.IX Item "XS_EXTERNAL" +Macro to declare an \s-1XSUB\s0 and its C parameter list explicitly exporting the symbols. +.IP "\s-1XS_INTERNAL\s0" 8 +.IX Xref "XS_INTERNAL" +.IX Item "XS_INTERNAL" +Macro to declare an \s-1XSUB\s0 and its C parameter list without exporting the symbols. +This is handled by \f(CW\*(C`xsubpp\*(C'\fR and generally preferable over exporting the \s-1XSUB\s0 +symbols unnecessarily. +.SH "Debugging Utilities" +.IX Header "Debugging Utilities" +.IP "dump_all" 8 +.IX Xref "dump_all" +.IX Item "dump_all" +Dumps the entire optree of the current program starting at \f(CW\*(C`PL_main_root\*(C'\fR to +\&\f(CW\*(C`STDERR\*(C'\fR. Also dumps the optrees for all visible subroutines in +\&\f(CW\*(C`PL_defstash\*(C'\fR. +.Sp +.Vb 1 +\& void dump_all() +.Ve +.IP "dump_packsubs" 8 +.IX Xref "dump_packsubs" +.IX Item "dump_packsubs" +Dumps the optrees for all visible subroutines in \f(CW\*(C`stash\*(C'\fR. +.Sp +.Vb 1 +\& void dump_packsubs(const HV* stash) +.Ve +.IP "op_class" 8 +.IX Xref "op_class" +.IX Item "op_class" +Given an op, determine what type of struct it has been allocated as. +Returns one of the OPclass enums, such as OPclass_LISTOP. +.Sp +.Vb 1 +\& OPclass op_class(const OP *o) +.Ve +.IP "op_dump" 8 +.IX Xref "op_dump" +.IX Item "op_dump" +Dumps the optree starting at \s-1OP\s0 \f(CW\*(C`o\*(C'\fR to \f(CW\*(C`STDERR\*(C'\fR. +.Sp +.Vb 1 +\& void op_dump(const OP *o) +.Ve +.IP "sv_dump" 8 +.IX Xref "sv_dump" +.IX Item "sv_dump" +Dumps the contents of an \s-1SV\s0 to the \f(CW\*(C`STDERR\*(C'\fR filehandle. +.Sp +For an example of its output, see Devel::Peek. +.Sp +.Vb 1 +\& void sv_dump(SV* sv) +.Ve +.SH "Display and Dump functions" +.IX Header "Display and Dump functions" +.IP "pv_display" 8 +.IX Xref "pv_display" +.IX Item "pv_display" +Similar to +.Sp +.Vb 1 +\& pv_escape(dsv,pv,cur,pvlim,PERL_PV_ESCAPE_QUOTE); +.Ve +.Sp +except that an additional \*(L"\e0\*(R" will be appended to the string when +len > cur and pv[cur] is \*(L"\e0\*(R". +.Sp +Note that the final string may be up to 7 chars longer than pvlim. +.Sp +.Vb 2 +\& char* pv_display(SV *dsv, const char *pv, STRLEN cur, +\& STRLEN len, STRLEN pvlim) +.Ve +.IP "pv_escape" 8 +.IX Xref "pv_escape" +.IX Item "pv_escape" +Escapes at most the first \f(CW\*(C`count\*(C'\fR chars of \f(CW\*(C`pv\*(C'\fR and puts the results into +\&\f(CW\*(C`dsv\*(C'\fR such that the size of the escaped string will not exceed \f(CW\*(C`max\*(C'\fR chars +and will not contain any incomplete escape sequences. The number of bytes +escaped will be returned in the \f(CW\*(C`STRLEN *escaped\*(C'\fR parameter if it is not null. +When the \f(CW\*(C`dsv\*(C'\fR parameter is null no escaping actually occurs, but the number +of bytes that would be escaped were it not null will be calculated. +.Sp +If flags contains \f(CW\*(C`PERL_PV_ESCAPE_QUOTE\*(C'\fR then any double quotes in the string +will also be escaped. +.Sp +Normally the \s-1SV\s0 will be cleared before the escaped string is prepared, +but when \f(CW\*(C`PERL_PV_ESCAPE_NOCLEAR\*(C'\fR is set this will not occur. +.Sp +If \f(CW\*(C`PERL_PV_ESCAPE_UNI\*(C'\fR is set then the input string is treated as \s-1UTF\-8\s0 +if \f(CW\*(C`PERL_PV_ESCAPE_UNI_DETECT\*(C'\fR is set then the input string is scanned +using \f(CW\*(C`is_utf8_string()\*(C'\fR to determine if it is \s-1UTF\-8.\s0 +.Sp +If \f(CW\*(C`PERL_PV_ESCAPE_ALL\*(C'\fR is set then all input chars will be output +using \f(CW\*(C`\ex01F1\*(C'\fR style escapes, otherwise if \f(CW\*(C`PERL_PV_ESCAPE_NONASCII\*(C'\fR is set, only +non-ASCII chars will be escaped using this style; otherwise, only chars above +255 will be so escaped; other non printable chars will use octal or +common escaped patterns like \f(CW\*(C`\en\*(C'\fR. +Otherwise, if \f(CW\*(C`PERL_PV_ESCAPE_NOBACKSLASH\*(C'\fR +then all chars below 255 will be treated as printable and +will be output as literals. +.Sp +If \f(CW\*(C`PERL_PV_ESCAPE_FIRSTCHAR\*(C'\fR is set then only the first char of the +string will be escaped, regardless of max. If the output is to be in hex, +then it will be returned as a plain hex +sequence. Thus the output will either be a single char, +an octal escape sequence, a special escape like \f(CW\*(C`\en\*(C'\fR or a hex value. +.Sp +If \f(CW\*(C`PERL_PV_ESCAPE_RE\*(C'\fR is set then the escape char used will be a \f(CW"%"\fR and +not a \f(CW"\e\e"\fR. This is because regexes very often contain backslashed +sequences, whereas \f(CW"%"\fR is not a particularly common character in patterns. +.Sp +Returns a pointer to the escaped text as held by \f(CW\*(C`dsv\*(C'\fR. +.Sp +.Vb 4 +\& char* pv_escape(SV *dsv, char const * const str, +\& const STRLEN count, const STRLEN max, +\& STRLEN * const escaped, +\& const U32 flags) +.Ve +.IP "pv_pretty" 8 +.IX Xref "pv_pretty" +.IX Item "pv_pretty" +Converts a string into something presentable, handling escaping via +\&\f(CW\*(C`pv_escape()\*(C'\fR and supporting quoting and ellipses. +.Sp +If the \f(CW\*(C`PERL_PV_PRETTY_QUOTE\*(C'\fR flag is set then the result will be +double quoted with any double quotes in the string escaped. Otherwise +if the \f(CW\*(C`PERL_PV_PRETTY_LTGT\*(C'\fR flag is set then the result be wrapped in +angle brackets. +.Sp +If the \f(CW\*(C`PERL_PV_PRETTY_ELLIPSES\*(C'\fR flag is set and not all characters in +string were output then an ellipsis \f(CW\*(C`...\*(C'\fR will be appended to the +string. Note that this happens \s-1AFTER\s0 it has been quoted. +.Sp +If \f(CW\*(C`start_color\*(C'\fR is non-null then it will be inserted after the opening +quote (if there is one) but before the escaped text. If \f(CW\*(C`end_color\*(C'\fR +is non-null then it will be inserted after the escaped text but before +any quotes or ellipses. +.Sp +Returns a pointer to the prettified text as held by \f(CW\*(C`dsv\*(C'\fR. +.Sp +.Vb 5 +\& char* pv_pretty(SV *dsv, char const * const str, +\& const STRLEN count, const STRLEN max, +\& char const * const start_color, +\& char const * const end_color, +\& const U32 flags) +.Ve +.SH "Embedding Functions" +.IX Header "Embedding Functions" +.IP "cv_clone" 8 +.IX Xref "cv_clone" +.IX Item "cv_clone" +Clone a \s-1CV,\s0 making a lexical closure. \f(CW\*(C`proto\*(C'\fR supplies the prototype +of the function: its code, pad structure, and other attributes. +The prototype is combined with a capture of outer lexicals to which the +code refers, which are taken from the currently-executing instance of +the immediately surrounding code. +.Sp +.Vb 1 +\& CV* cv_clone(CV* proto) +.Ve +.IP "cv_name" 8 +.IX Xref "cv_name" +.IX Item "cv_name" +Returns an \s-1SV\s0 containing the name of the \s-1CV,\s0 mainly for use in error +reporting. The \s-1CV\s0 may actually be a \s-1GV\s0 instead, in which case the returned +\&\s-1SV\s0 holds the \s-1GV\s0's name. Anything other than a \s-1GV\s0 or \s-1CV\s0 is treated as a +string already holding the sub name, but this could change in the future. +.Sp +An \s-1SV\s0 may be passed as a second argument. If so, the name will be assigned +to it and it will be returned. Otherwise the returned \s-1SV\s0 will be a new +mortal. +.Sp +If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`CV_NAME_NOTQUAL\*(C'\fR bit set, then the package name will not be +included. If the first argument is neither a \s-1CV\s0 nor a \s-1GV,\s0 this flag is +ignored (subject to change). +.Sp +.Vb 1 +\& SV * cv_name(CV *cv, SV *sv, U32 flags) +.Ve +.IP "cv_undef" 8 +.IX Xref "cv_undef" +.IX Item "cv_undef" +Clear out all the active components of a \s-1CV.\s0 This can happen either +by an explicit \f(CW\*(C`undef &foo\*(C'\fR, or by the reference count going to zero. +In the former case, we keep the \f(CW\*(C`CvOUTSIDE\*(C'\fR pointer, so that any anonymous +children can still follow the full lexical scope chain. +.Sp +.Vb 1 +\& void cv_undef(CV* cv) +.Ve +.IP "find_rundefsv" 8 +.IX Xref "find_rundefsv" +.IX Item "find_rundefsv" +Returns the global variable \f(CW$_\fR. +.Sp +.Vb 1 +\& SV* find_rundefsv() +.Ve +.IP "find_rundefsvoffset" 8 +.IX Xref "find_rundefsvoffset" +.IX Item "find_rundefsvoffset" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Until the lexical \f(CW$_\fR feature was removed, this function would +find the position of the lexical \f(CW$_\fR in the pad of the +currently-executing function and return the offset in the current pad, +or \f(CW\*(C`NOT_IN_PAD\*(C'\fR. +.Sp +Now it always returns \f(CW\*(C`NOT_IN_PAD\*(C'\fR. +.Sp +.Vb 1 +\& PADOFFSET find_rundefsvoffset() +.Ve +.IP "intro_my" 8 +.IX Xref "intro_my" +.IX Item "intro_my" +\&\*(L"Introduce\*(R" \f(CW\*(C`my\*(C'\fR variables to visible status. This is called during parsing +at the end of each statement to make lexical variables visible to subsequent +statements. +.Sp +.Vb 1 +\& U32 intro_my() +.Ve +.IP "load_module" 8 +.IX Xref "load_module" +.IX Item "load_module" +Loads the module whose name is pointed to by the string part of \f(CW\*(C`name\*(C'\fR. +Note that the actual module name, not its filename, should be given. +Eg, \*(L"Foo::Bar\*(R" instead of \*(L"Foo/Bar.pm\*(R". ver, if specified and not \s-1NULL,\s0 +provides version semantics similar to \f(CW\*(C`use Foo::Bar VERSION\*(C'\fR. The optional +trailing arguments can be used to specify arguments to the module's \f(CW\*(C`import()\*(C'\fR +method, similar to \f(CW\*(C`use Foo::Bar VERSION LIST\*(C'\fR; their precise handling depends +on the flags. The flags argument is a bitwise-ORed collection of any of +\&\f(CW\*(C`PERL_LOADMOD_DENY\*(C'\fR, \f(CW\*(C`PERL_LOADMOD_NOIMPORT\*(C'\fR, or \f(CW\*(C`PERL_LOADMOD_IMPORT_OPS\*(C'\fR +(or 0 for no flags). +.Sp +If \f(CW\*(C`PERL_LOADMOD_NOIMPORT\*(C'\fR is set, the module is loaded as if with an empty +import list, as in \f(CW\*(C`use Foo::Bar ()\*(C'\fR; this is the only circumstance in which +the trailing optional arguments may be omitted entirely. Otherwise, if +\&\f(CW\*(C`PERL_LOADMOD_IMPORT_OPS\*(C'\fR is set, the trailing arguments must consist of +exactly one \f(CW\*(C`OP*\*(C'\fR, containing the op tree that produces the relevant import +arguments. Otherwise, the trailing arguments must all be \f(CW\*(C`SV*\*(C'\fR values that +will be used as import arguments; and the list must be terminated with \f(CW\*(C`(SV*) +NULL\*(C'\fR. If neither \f(CW\*(C`PERL_LOADMOD_NOIMPORT\*(C'\fR nor \f(CW\*(C`PERL_LOADMOD_IMPORT_OPS\*(C'\fR is +set, the trailing \f(CW\*(C`NULL\*(C'\fR pointer is needed even if no import arguments are +desired. The reference count for each specified \f(CW\*(C`SV*\*(C'\fR argument is +decremented. In addition, the \f(CW\*(C`name\*(C'\fR argument is modified. +.Sp +If \f(CW\*(C`PERL_LOADMOD_DENY\*(C'\fR is set, the module is loaded as if with \f(CW\*(C`no\*(C'\fR rather +than \f(CW\*(C`use\*(C'\fR. +.Sp +.Vb 1 +\& void load_module(U32 flags, SV* name, SV* ver, ...) +.Ve +.IP "my_exit" 8 +.IX Xref "my_exit" +.IX Item "my_exit" +A wrapper for the C library \fBexit\fR\|(3), honoring what \*(L"PL_exit_flags\*(R" in perlapi +say to do. +.Sp +.Vb 1 +\& void my_exit(U32 status) +.Ve +.IP "newPADNAMELIST" 8 +.IX Xref "newPADNAMELIST" +.IX Item "newPADNAMELIST" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Creates a new pad name list. \f(CW\*(C`max\*(C'\fR is the highest index for which space +is allocated. +.Sp +.Vb 1 +\& PADNAMELIST * newPADNAMELIST(size_t max) +.Ve +.IP "newPADNAMEouter" 8 +.IX Xref "newPADNAMEouter" +.IX Item "newPADNAMEouter" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Constructs and returns a new pad name. Only use this function for names +that refer to outer lexicals. (See also \*(L"newPADNAMEpvn\*(R".) \f(CW\*(C`outer\*(C'\fR is +the outer pad name that this one mirrors. The returned pad name has the +\&\f(CW\*(C`PADNAMEt_OUTER\*(C'\fR flag already set. +.Sp +.Vb 1 +\& PADNAME * newPADNAMEouter(PADNAME *outer) +.Ve +.IP "newPADNAMEpvn" 8 +.IX Xref "newPADNAMEpvn" +.IX Item "newPADNAMEpvn" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Constructs and returns a new pad name. \f(CW\*(C`s\*(C'\fR must be a \s-1UTF\-8\s0 string. Do not +use this for pad names that point to outer lexicals. See +\&\f(CW"newPADNAMEouter"\fR. +.Sp +.Vb 1 +\& PADNAME * newPADNAMEpvn(const char *s, STRLEN len) +.Ve +.IP "nothreadhook" 8 +.IX Xref "nothreadhook" +.IX Item "nothreadhook" +Stub that provides thread hook for perl_destruct when there are +no threads. +.Sp +.Vb 1 +\& int nothreadhook() +.Ve +.IP "pad_add_anon" 8 +.IX Xref "pad_add_anon" +.IX Item "pad_add_anon" +Allocates a place in the currently-compiling pad (via \*(L"pad_alloc\*(R") +for an anonymous function that is lexically scoped inside the +currently-compiling function. +The function \f(CW\*(C`func\*(C'\fR is linked into the pad, and its \f(CW\*(C`CvOUTSIDE\*(C'\fR link +to the outer scope is weakened to avoid a reference loop. +.Sp +One reference count is stolen, so you may need to do \f(CW\*(C`SvREFCNT_inc(func)\*(C'\fR. +.Sp +\&\f(CW\*(C`optype\*(C'\fR should be an opcode indicating the type of operation that the +pad entry is to support. This doesn't affect operational semantics, +but is used for debugging. +.Sp +.Vb 1 +\& PADOFFSET pad_add_anon(CV* func, I32 optype) +.Ve +.IP "pad_add_name_pv" 8 +.IX Xref "pad_add_name_pv" +.IX Item "pad_add_name_pv" +Exactly like \*(L"pad_add_name_pvn\*(R", but takes a nul-terminated string +instead of a string/length pair. +.Sp +.Vb 3 +\& PADOFFSET pad_add_name_pv(const char *name, +\& const U32 flags, +\& HV *typestash, HV *ourstash) +.Ve +.IP "pad_add_name_pvn" 8 +.IX Xref "pad_add_name_pvn" +.IX Item "pad_add_name_pvn" +Allocates a place in the currently-compiling pad for a named lexical +variable. Stores the name and other metadata in the name part of the +pad, and makes preparations to manage the variable's lexical scoping. +Returns the offset of the allocated pad slot. +.Sp +\&\f(CW\*(C`namepv\*(C'\fR/\f(CW\*(C`namelen\*(C'\fR specify the variable's name, including leading sigil. +If \f(CW\*(C`typestash\*(C'\fR is non-null, the name is for a typed lexical, and this +identifies the type. If \f(CW\*(C`ourstash\*(C'\fR is non-null, it's a lexical reference +to a package variable, and this identifies the package. The following +flags can be \s-1OR\s0'ed together: +.Sp +.Vb 3 +\& padadd_OUR redundantly specifies if it\*(Aqs a package var +\& padadd_STATE variable will retain value persistently +\& padadd_NO_DUP_CHECK skip check for lexical shadowing +\& +\& PADOFFSET pad_add_name_pvn(const char *namepv, +\& STRLEN namelen, U32 flags, +\& HV *typestash, HV *ourstash) +.Ve +.IP "pad_add_name_sv" 8 +.IX Xref "pad_add_name_sv" +.IX Item "pad_add_name_sv" +Exactly like \*(L"pad_add_name_pvn\*(R", but takes the name string in the form +of an \s-1SV\s0 instead of a string/length pair. +.Sp +.Vb 2 +\& PADOFFSET pad_add_name_sv(SV *name, U32 flags, +\& HV *typestash, HV *ourstash) +.Ve +.IP "pad_alloc" 8 +.IX Xref "pad_alloc" +.IX Item "pad_alloc" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Allocates a place in the currently-compiling pad, +returning the offset of the allocated pad slot. +No name is initially attached to the pad slot. +\&\f(CW\*(C`tmptype\*(C'\fR is a set of flags indicating the kind of pad entry required, +which will be set in the value \s-1SV\s0 for the allocated pad entry: +.Sp +.Vb 3 +\& SVs_PADMY named lexical variable ("my", "our", "state") +\& SVs_PADTMP unnamed temporary store +\& SVf_READONLY constant shared between recursion levels +.Ve +.Sp +\&\f(CW\*(C`SVf_READONLY\*(C'\fR has been supported here only since perl 5.20. To work with +earlier versions as well, use \f(CW\*(C`SVf_READONLY|SVs_PADTMP\*(C'\fR. \f(CW\*(C`SVf_READONLY\*(C'\fR +does not cause the \s-1SV\s0 in the pad slot to be marked read-only, but simply +tells \f(CW\*(C`pad_alloc\*(C'\fR that it \fIwill\fR be made read-only (by the caller), or at +least should be treated as such. +.Sp +\&\f(CW\*(C`optype\*(C'\fR should be an opcode indicating the type of operation that the +pad entry is to support. This doesn't affect operational semantics, +but is used for debugging. +.Sp +.Vb 1 +\& PADOFFSET pad_alloc(I32 optype, U32 tmptype) +.Ve +.IP "pad_findmy_pv" 8 +.IX Xref "pad_findmy_pv" +.IX Item "pad_findmy_pv" +Exactly like \*(L"pad_findmy_pvn\*(R", but takes a nul-terminated string +instead of a string/length pair. +.Sp +.Vb 1 +\& PADOFFSET pad_findmy_pv(const char* name, U32 flags) +.Ve +.IP "pad_findmy_pvn" 8 +.IX Xref "pad_findmy_pvn" +.IX Item "pad_findmy_pvn" +Given the name of a lexical variable, find its position in the +currently-compiling pad. +\&\f(CW\*(C`namepv\*(C'\fR/\f(CW\*(C`namelen\*(C'\fR specify the variable's name, including leading sigil. +\&\f(CW\*(C`flags\*(C'\fR is reserved and must be zero. +If it is not in the current pad but appears in the pad of any lexically +enclosing scope, then a pseudo-entry for it is added in the current pad. +Returns the offset in the current pad, +or \f(CW\*(C`NOT_IN_PAD\*(C'\fR if no such lexical is in scope. +.Sp +.Vb 2 +\& PADOFFSET pad_findmy_pvn(const char* namepv, +\& STRLEN namelen, U32 flags) +.Ve +.IP "pad_findmy_sv" 8 +.IX Xref "pad_findmy_sv" +.IX Item "pad_findmy_sv" +Exactly like \*(L"pad_findmy_pvn\*(R", but takes the name string in the form +of an \s-1SV\s0 instead of a string/length pair. +.Sp +.Vb 1 +\& PADOFFSET pad_findmy_sv(SV* name, U32 flags) +.Ve +.IP "padnamelist_fetch" 8 +.IX Xref "padnamelist_fetch" +.IX Item "padnamelist_fetch" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Fetches the pad name from the given index. +.Sp +.Vb 2 +\& PADNAME * padnamelist_fetch(PADNAMELIST *pnl, +\& SSize_t key) +.Ve +.IP "padnamelist_store" 8 +.IX Xref "padnamelist_store" +.IX Item "padnamelist_store" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Stores the pad name (which may be null) at the given index, freeing any +existing pad name in that slot. +.Sp +.Vb 2 +\& PADNAME ** padnamelist_store(PADNAMELIST *pnl, +\& SSize_t key, PADNAME *val) +.Ve +.IP "pad_setsv" 8 +.IX Xref "pad_setsv" +.IX Item "pad_setsv" +Set the value at offset \f(CW\*(C`po\*(C'\fR in the current (compiling or executing) pad. +Use the macro \f(CW\*(C`PAD_SETSV()\*(C'\fR rather than calling this function directly. +.Sp +.Vb 1 +\& void pad_setsv(PADOFFSET po, SV* sv) +.Ve +.IP "pad_sv" 8 +.IX Xref "pad_sv" +.IX Item "pad_sv" +Get the value at offset \f(CW\*(C`po\*(C'\fR in the current (compiling or executing) pad. +Use macro \f(CW\*(C`PAD_SV\*(C'\fR instead of calling this function directly. +.Sp +.Vb 1 +\& SV* pad_sv(PADOFFSET po) +.Ve +.IP "pad_tidy" 8 +.IX Xref "pad_tidy" +.IX Item "pad_tidy" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Tidy up a pad at the end of compilation of the code to which it belongs. +Jobs performed here are: remove most stuff from the pads of anonsub +prototypes; give it a \f(CW@_\fR; mark temporaries as such. \f(CW\*(C`type\*(C'\fR indicates +the kind of subroutine: +.Sp +.Vb 3 +\& padtidy_SUB ordinary subroutine +\& padtidy_SUBCLONE prototype for lexical closure +\& padtidy_FORMAT format +\& +\& void pad_tidy(padtidy_type type) +.Ve +.IP "perl_alloc" 8 +.IX Xref "perl_alloc" +.IX Item "perl_alloc" +Allocates a new Perl interpreter. See perlembed. +.Sp +.Vb 1 +\& PerlInterpreter* perl_alloc() +.Ve +.IP "perl_construct" 8 +.IX Xref "perl_construct" +.IX Item "perl_construct" +Initializes a new Perl interpreter. See perlembed. +.Sp +.Vb 1 +\& void perl_construct(PerlInterpreter *my_perl) +.Ve +.IP "perl_destruct" 8 +.IX Xref "perl_destruct" +.IX Item "perl_destruct" +Shuts down a Perl interpreter. See perlembed for a tutorial. +.Sp +\&\f(CW\*(C`my_perl\*(C'\fR points to the Perl interpreter. It must have been previously +created through the use of \*(L"perl_alloc\*(R" and \*(L"perl_construct\*(R". It may +have been initialised through \*(L"perl_parse\*(R", and may have been used +through \*(L"perl_run\*(R" and other means. This function should be called for +any Perl interpreter that has been constructed with \*(L"perl_construct\*(R", +even if subsequent operations on it failed, for example if \*(L"perl_parse\*(R" +returned a non-zero value. +.Sp +If the interpreter's \f(CW\*(C`PL_exit_flags\*(C'\fR word has the +\&\f(CW\*(C`PERL_EXIT_DESTRUCT_END\*(C'\fR flag set, then this function will execute code +in \f(CW\*(C`END\*(C'\fR blocks before performing the rest of destruction. If it is +desired to make any use of the interpreter between \*(L"perl_parse\*(R" and +\&\*(L"perl_destruct\*(R" other than just calling \*(L"perl_run\*(R", then this flag +should be set early on. This matters if \*(L"perl_run\*(R" will not be called, +or if anything else will be done in addition to calling \*(L"perl_run\*(R". +.Sp +Returns a value be a suitable value to pass to the C library function +\&\f(CW\*(C`exit\*(C'\fR (or to return from \f(CW\*(C`main\*(C'\fR), to serve as an exit code indicating +the nature of the way the interpreter terminated. This takes into account +any failure of \*(L"perl_parse\*(R" and any early exit from \*(L"perl_run\*(R". +The exit code is of the type required by the host operating system, +so because of differing exit code conventions it is not portable to +interpret specific numeric values as having specific meanings. +.Sp +.Vb 1 +\& int perl_destruct(PerlInterpreter *my_perl) +.Ve +.IP "perl_free" 8 +.IX Xref "perl_free" +.IX Item "perl_free" +Releases a Perl interpreter. See perlembed. +.Sp +.Vb 1 +\& void perl_free(PerlInterpreter *my_perl) +.Ve +.IP "perl_parse" 8 +.IX Xref "perl_parse" +.IX Item "perl_parse" +Tells a Perl interpreter to parse a Perl script. This performs most +of the initialisation of a Perl interpreter. See perlembed for +a tutorial. +.Sp +\&\f(CW\*(C`my_perl\*(C'\fR points to the Perl interpreter that is to parse the script. +It must have been previously created through the use of \*(L"perl_alloc\*(R" +and \*(L"perl_construct\*(R". \f(CW\*(C`xsinit\*(C'\fR points to a callback function that +will be called to set up the ability for this Perl interpreter to load +\&\s-1XS\s0 extensions, or may be null to perform no such setup. +.Sp +\&\f(CW\*(C`argc\*(C'\fR and \f(CW\*(C`argv\*(C'\fR supply a set of command-line arguments to the Perl +interpreter, as would normally be passed to the \f(CW\*(C`main\*(C'\fR function of +a C program. \f(CW\*(C`argv[argc]\*(C'\fR must be null. These arguments are where +the script to parse is specified, either by naming a script file or by +providing a script in a \f(CW\*(C`\-e\*(C'\fR option. +If \f(CW$0\fR will be written to in the Perl interpreter, then +the argument strings must be in writable memory, and so mustn't just be +string constants. +.Sp +\&\f(CW\*(C`env\*(C'\fR specifies a set of environment variables that will be used by +this Perl interpreter. If non-null, it must point to a null-terminated +array of environment strings. If null, the Perl interpreter will use +the environment supplied by the \f(CW\*(C`environ\*(C'\fR global variable. +.Sp +This function initialises the interpreter, and parses and compiles the +script specified by the command-line arguments. This includes executing +code in \f(CW\*(C`BEGIN\*(C'\fR, \f(CW\*(C`UNITCHECK\*(C'\fR, and \f(CW\*(C`CHECK\*(C'\fR blocks. It does not execute +\&\f(CW\*(C`INIT\*(C'\fR blocks or the main program. +.Sp +Returns an integer of slightly tricky interpretation. The correct +use of the return value is as a truth value indicating whether there +was a failure in initialisation. If zero is returned, this indicates +that initialisation was successful, and it is safe to proceed to call +\&\*(L"perl_run\*(R" and make other use of it. If a non-zero value is returned, +this indicates some problem that means the interpreter wants to terminate. +The interpreter should not be just abandoned upon such failure; the caller +should proceed to shut the interpreter down cleanly with \*(L"perl_destruct\*(R" +and free it with \*(L"perl_free\*(R". +.Sp +For historical reasons, the non-zero return value also attempts to +be a suitable value to pass to the C library function \f(CW\*(C`exit\*(C'\fR (or to +return from \f(CW\*(C`main\*(C'\fR), to serve as an exit code indicating the nature +of the way initialisation terminated. However, this isn't portable, +due to differing exit code conventions. A historical bug is preserved +for the time being: if the Perl built-in \f(CW\*(C`exit\*(C'\fR is called during this +function's execution, with a type of exit entailing a zero exit code +under the host operating system's conventions, then this function +returns zero rather than a non-zero value. This bug, [perl #2754], +leads to \f(CW\*(C`perl_run\*(C'\fR being called (and therefore \f(CW\*(C`INIT\*(C'\fR blocks and the +main program running) despite a call to \f(CW\*(C`exit\*(C'\fR. It has been preserved +because a popular module-installing module has come to rely on it and +needs time to be fixed. This issue is [perl #132577], and the original +bug is due to be fixed in Perl 5.30. +.Sp +.Vb 3 +\& int perl_parse(PerlInterpreter *my_perl, +\& XSINIT_t xsinit, int argc, +\& char** argv, char** env) +.Ve +.IP "perl_run" 8 +.IX Xref "perl_run" +.IX Item "perl_run" +Tells a Perl interpreter to run its main program. See perlembed +for a tutorial. +.Sp +\&\f(CW\*(C`my_perl\*(C'\fR points to the Perl interpreter. It must have been previously +created through the use of \*(L"perl_alloc\*(R" and \*(L"perl_construct\*(R", and +initialised through \*(L"perl_parse\*(R". This function should not be called +if \*(L"perl_parse\*(R" returned a non-zero value, indicating a failure in +initialisation or compilation. +.Sp +This function executes code in \f(CW\*(C`INIT\*(C'\fR blocks, and then executes the +main program. The code to be executed is that established by the prior +call to \*(L"perl_parse\*(R". If the interpreter's \f(CW\*(C`PL_exit_flags\*(C'\fR word +does not have the \f(CW\*(C`PERL_EXIT_DESTRUCT_END\*(C'\fR flag set, then this function +will also execute code in \f(CW\*(C`END\*(C'\fR blocks. If it is desired to make any +further use of the interpreter after calling this function, then \f(CW\*(C`END\*(C'\fR +blocks should be postponed to \*(L"perl_destruct\*(R" time by setting that flag. +.Sp +Returns an integer of slightly tricky interpretation. The correct use +of the return value is as a truth value indicating whether the program +terminated non-locally. If zero is returned, this indicates that +the program ran to completion, and it is safe to make other use of the +interpreter (provided that the \f(CW\*(C`PERL_EXIT_DESTRUCT_END\*(C'\fR flag was set as +described above). If a non-zero value is returned, this indicates that +the interpreter wants to terminate early. The interpreter should not be +just abandoned because of this desire to terminate; the caller should +proceed to shut the interpreter down cleanly with \*(L"perl_destruct\*(R" +and free it with \*(L"perl_free\*(R". +.Sp +For historical reasons, the non-zero return value also attempts to +be a suitable value to pass to the C library function \f(CW\*(C`exit\*(C'\fR (or to +return from \f(CW\*(C`main\*(C'\fR), to serve as an exit code indicating the nature of +the way the program terminated. However, this isn't portable, due to +differing exit code conventions. An attempt is made to return an exit +code of the type required by the host operating system, but because +it is constrained to be non-zero, it is not necessarily possible to +indicate every type of exit. It is only reliable on Unix, where a zero +exit code can be augmented with a set bit that will be ignored. In any +case, this function is not the correct place to acquire an exit code: +one should get that from \*(L"perl_destruct\*(R". +.Sp +.Vb 1 +\& int perl_run(PerlInterpreter *my_perl) +.Ve +.IP "require_pv" 8 +.IX Xref "require_pv" +.IX Item "require_pv" +Tells Perl to \f(CW\*(C`require\*(C'\fR the file named by the string argument. It is +analogous to the Perl code \f(CW\*(C`eval "require \*(Aq$file\*(Aq"\*(C'\fR. It's even +implemented that way; consider using load_module instead. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& void require_pv(const char* pv) +.Ve +.SH "Exception Handling (simple) Macros" +.IX Header "Exception Handling (simple) Macros" +.IP "dXCPT" 8 +.IX Xref "dXCPT" +.IX Item "dXCPT" +Set up necessary local variables for exception handling. +See \*(L"Exception Handling\*(R" in perlguts. +.Sp +.Vb 1 +\& dXCPT; +.Ve +.IP "\s-1XCPT_CATCH\s0" 8 +.IX Xref "XCPT_CATCH" +.IX Item "XCPT_CATCH" +Introduces a catch block. See \*(L"Exception Handling\*(R" in perlguts. +.IP "\s-1XCPT_RETHROW\s0" 8 +.IX Xref "XCPT_RETHROW" +.IX Item "XCPT_RETHROW" +Rethrows a previously caught exception. See \*(L"Exception Handling\*(R" in perlguts. +.Sp +.Vb 1 +\& XCPT_RETHROW; +.Ve +.IP "\s-1XCPT_TRY_END\s0" 8 +.IX Xref "XCPT_TRY_END" +.IX Item "XCPT_TRY_END" +Ends a try block. See \*(L"Exception Handling\*(R" in perlguts. +.IP "\s-1XCPT_TRY_START\s0" 8 +.IX Xref "XCPT_TRY_START" +.IX Item "XCPT_TRY_START" +Starts a try block. See \*(L"Exception Handling\*(R" in perlguts. +.SH "Functions in file vutil.c" +.IX Header "Functions in file vutil.c" +.IP "new_version" 8 +.IX Xref "new_version" +.IX Item "new_version" +Returns a new version object based on the passed in \s-1SV:\s0 +.Sp +.Vb 1 +\& SV *sv = new_version(SV *ver); +.Ve +.Sp +Does not alter the passed in ver \s-1SV.\s0 See \*(L"upg_version\*(R" if you +want to upgrade the \s-1SV.\s0 +.Sp +.Vb 1 +\& SV* new_version(SV *ver) +.Ve +.IP "prescan_version" 8 +.IX Xref "prescan_version" +.IX Item "prescan_version" +Validate that a given string can be parsed as a version object, but doesn't +actually perform the parsing. Can use either strict or lax validation rules. +Can optionally set a number of hint variables to save the parsing code +some time when tokenizing. +.Sp +.Vb 5 +\& const char* prescan_version(const char *s, bool strict, +\& const char** errstr, +\& bool *sqv, +\& int *ssaw_decimal, +\& int *swidth, bool *salpha) +.Ve +.IP "scan_version" 8 +.IX Xref "scan_version" +.IX Item "scan_version" +Returns a pointer to the next character after the parsed +version string, as well as upgrading the passed in \s-1SV\s0 to +an \s-1RV.\s0 +.Sp +Function must be called with an already existing \s-1SV\s0 like +.Sp +.Vb 2 +\& sv = newSV(0); +\& s = scan_version(s, SV *sv, bool qv); +.Ve +.Sp +Performs some preprocessing to the string to ensure that +it has the correct characteristics of a version. Flags the +object if it contains an underscore (which denotes this +is an alpha version). The boolean qv denotes that the version +should be interpreted as if it had multiple decimals, even if +it doesn't. +.Sp +.Vb 1 +\& const char* scan_version(const char *s, SV *rv, bool qv) +.Ve +.IP "upg_version" 8 +.IX Xref "upg_version" +.IX Item "upg_version" +In-place upgrade of the supplied \s-1SV\s0 to a version object. +.Sp +.Vb 1 +\& SV *sv = upg_version(SV *sv, bool qv); +.Ve +.Sp +Returns a pointer to the upgraded \s-1SV.\s0 Set the boolean qv if you want +to force this \s-1SV\s0 to be interpreted as an \*(L"extended\*(R" version. +.Sp +.Vb 1 +\& SV* upg_version(SV *ver, bool qv) +.Ve +.IP "vcmp" 8 +.IX Xref "vcmp" +.IX Item "vcmp" +Version object aware cmp. Both operands must already have been +converted into version objects. +.Sp +.Vb 1 +\& int vcmp(SV *lhv, SV *rhv) +.Ve +.IP "vnormal" 8 +.IX Xref "vnormal" +.IX Item "vnormal" +Accepts a version object and returns the normalized string +representation. Call like: +.Sp +.Vb 1 +\& sv = vnormal(rv); +.Ve +.Sp +\&\s-1NOTE:\s0 you can pass either the object directly or the \s-1SV\s0 +contained within the \s-1RV.\s0 +.Sp +The \s-1SV\s0 returned has a refcount of 1. +.Sp +.Vb 1 +\& SV* vnormal(SV *vs) +.Ve +.IP "vnumify" 8 +.IX Xref "vnumify" +.IX Item "vnumify" +Accepts a version object and returns the normalized floating +point representation. Call like: +.Sp +.Vb 1 +\& sv = vnumify(rv); +.Ve +.Sp +\&\s-1NOTE:\s0 you can pass either the object directly or the \s-1SV\s0 +contained within the \s-1RV.\s0 +.Sp +The \s-1SV\s0 returned has a refcount of 1. +.Sp +.Vb 1 +\& SV* vnumify(SV *vs) +.Ve +.IP "vstringify" 8 +.IX Xref "vstringify" +.IX Item "vstringify" +In order to maintain maximum compatibility with earlier versions +of Perl, this function will return either the floating point +notation or the multiple dotted notation, depending on whether +the original version contained 1 or more dots, respectively. +.Sp +The \s-1SV\s0 returned has a refcount of 1. +.Sp +.Vb 1 +\& SV* vstringify(SV *vs) +.Ve +.IP "vverify" 8 +.IX Xref "vverify" +.IX Item "vverify" +Validates that the \s-1SV\s0 contains valid internal structure for a version object. +It may be passed either the version object (\s-1RV\s0) or the hash itself (\s-1HV\s0). If +the structure is valid, it returns the \s-1HV.\s0 If the structure is invalid, +it returns \s-1NULL.\s0 +.Sp +.Vb 1 +\& SV *hv = vverify(sv); +.Ve +.Sp +Note that it only confirms the bare minimum structure (so as not to get +confused by derived classes which may contain additional hash entries): +.RS 8 +.IP "\(bu" 4 +The \s-1SV\s0 is an \s-1HV\s0 or a reference to an \s-1HV\s0 +.IP "\(bu" 4 +The hash contains a \*(L"version\*(R" key +.IP "\(bu" 4 +The \*(L"version\*(R" key has a reference to an \s-1AV\s0 as its value +.RE +.RS 8 +.Sp +.Vb 1 +\& SV* vverify(SV *vs) +.Ve +.RE +.ie n .SH """Gimme"" Values" +.el .SH "``Gimme'' Values" +.IX Header "Gimme Values" +.IP "G_ARRAY" 8 +.IX Xref "G_ARRAY" +.IX Item "G_ARRAY" +Used to indicate list context. See \f(CW"GIMME_V"\fR, \f(CW"GIMME"\fR and +perlcall. +.IP "G_DISCARD" 8 +.IX Xref "G_DISCARD" +.IX Item "G_DISCARD" +Indicates that arguments returned from a callback should be discarded. See +perlcall. +.IP "G_EVAL" 8 +.IX Xref "G_EVAL" +.IX Item "G_EVAL" +Used to force a Perl \f(CW\*(C`eval\*(C'\fR wrapper around a callback. See +perlcall. +.IP "\s-1GIMME\s0" 8 +.IX Xref "GIMME" +.IX Item "GIMME" +A backward-compatible version of \f(CW\*(C`GIMME_V\*(C'\fR which can only return +\&\f(CW\*(C`G_SCALAR\*(C'\fR or \f(CW\*(C`G_ARRAY\*(C'\fR; in a void context, it returns \f(CW\*(C`G_SCALAR\*(C'\fR. +Deprecated. Use \f(CW\*(C`GIMME_V\*(C'\fR instead. +.Sp +.Vb 1 +\& U32 GIMME +.Ve +.IP "\s-1GIMME_V\s0" 8 +.IX Xref "GIMME_V" +.IX Item "GIMME_V" +The XSUB-writer's equivalent to Perl's \f(CW\*(C`wantarray\*(C'\fR. Returns \f(CW\*(C`G_VOID\*(C'\fR, +\&\f(CW\*(C`G_SCALAR\*(C'\fR or \f(CW\*(C`G_ARRAY\*(C'\fR for void, scalar or list context, +respectively. See perlcall for a usage example. +.Sp +.Vb 1 +\& U32 GIMME_V +.Ve +.IP "G_NOARGS" 8 +.IX Xref "G_NOARGS" +.IX Item "G_NOARGS" +Indicates that no arguments are being sent to a callback. See +perlcall. +.IP "G_SCALAR" 8 +.IX Xref "G_SCALAR" +.IX Item "G_SCALAR" +Used to indicate scalar context. See \f(CW"GIMME_V"\fR, \f(CW"GIMME"\fR, and +perlcall. +.IP "G_VOID" 8 +.IX Xref "G_VOID" +.IX Item "G_VOID" +Used to indicate void context. See \f(CW"GIMME_V"\fR and perlcall. +.SH "Global Variables" +.IX Header "Global Variables" +These variables are global to an entire process. They are shared between +all interpreters and all threads in a process. Any variables not documented +here may be changed or removed without notice, so don't use them! +If you feel you really do need to use an unlisted variable, first send email to +perl5\-porters@perl.org . It may be that +someone there will point out a way to accomplish what you need without using an +internal variable. But if not, you should get a go-ahead to document and then +use the variable. +.IP "PL_check" 8 +.IX Xref "PL_check" +.IX Item "PL_check" +Array, indexed by opcode, of functions that will be called for the \*(L"check\*(R" +phase of optree building during compilation of Perl code. For most (but +not all) types of op, once the op has been initially built and populated +with child ops it will be filtered through the check function referenced +by the appropriate element of this array. The new op is passed in as the +sole argument to the check function, and the check function returns the +completed op. The check function may (as the name suggests) check the op +for validity and signal errors. It may also initialise or modify parts of +the ops, or perform more radical surgery such as adding or removing child +ops, or even throw the op away and return a different op in its place. +.Sp +This array of function pointers is a convenient place to hook into the +compilation process. An \s-1XS\s0 module can put its own custom check function +in place of any of the standard ones, to influence the compilation of a +particular type of op. However, a custom check function must never fully +replace a standard check function (or even a custom check function from +another module). A module modifying checking must instead \fBwrap\fR the +preexisting check function. A custom check function must be selective +about when to apply its custom behaviour. In the usual case where +it decides not to do anything special with an op, it must chain the +preexisting op function. Check functions are thus linked in a chain, +with the core's base checker at the end. +.Sp +For thread safety, modules should not write directly to this array. +Instead, use the function \*(L"wrap_op_checker\*(R". +.IP "PL_keyword_plugin" 8 +.IX Xref "PL_keyword_plugin" +.IX Item "PL_keyword_plugin" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Function pointer, pointing at a function used to handle extended keywords. +The function should be declared as +.Sp +.Vb 3 +\& int keyword_plugin_function(pTHX_ +\& char *keyword_ptr, STRLEN keyword_len, +\& OP **op_ptr) +.Ve +.Sp +The function is called from the tokeniser, whenever a possible keyword +is seen. \f(CW\*(C`keyword_ptr\*(C'\fR points at the word in the parser's input +buffer, and \f(CW\*(C`keyword_len\*(C'\fR gives its length; it is not null-terminated. +The function is expected to examine the word, and possibly other state +such as %^H, to decide whether it wants to handle it +as an extended keyword. If it does not, the function should return +\&\f(CW\*(C`KEYWORD_PLUGIN_DECLINE\*(C'\fR, and the normal parser process will continue. +.Sp +If the function wants to handle the keyword, it first must +parse anything following the keyword that is part of the syntax +introduced by the keyword. See \*(L"Lexer interface\*(R" for details. +.Sp +When a keyword is being handled, the plugin function must build +a tree of \f(CW\*(C`OP\*(C'\fR structures, representing the code that was parsed. +The root of the tree must be stored in \f(CW*op_ptr\fR. The function then +returns a constant indicating the syntactic role of the construct that +it has parsed: \f(CW\*(C`KEYWORD_PLUGIN_STMT\*(C'\fR if it is a complete statement, or +\&\f(CW\*(C`KEYWORD_PLUGIN_EXPR\*(C'\fR if it is an expression. Note that a statement +construct cannot be used inside an expression (except via \f(CW\*(C`do BLOCK\*(C'\fR +and similar), and an expression is not a complete statement (it requires +at least a terminating semicolon). +.Sp +When a keyword is handled, the plugin function may also have +(compile-time) side effects. It may modify \f(CW\*(C`%^H\*(C'\fR, define functions, and +so on. Typically, if side effects are the main purpose of a handler, +it does not wish to generate any ops to be included in the normal +compilation. In this case it is still required to supply an op tree, +but it suffices to generate a single null op. +.Sp +That's how the \f(CW*PL_keyword_plugin\fR function needs to behave overall. +Conventionally, however, one does not completely replace the existing +handler function. Instead, take a copy of \f(CW\*(C`PL_keyword_plugin\*(C'\fR before +assigning your own function pointer to it. Your handler function should +look for keywords that it is interested in and handle those. Where it +is not interested, it should call the saved plugin function, passing on +the arguments it received. Thus \f(CW\*(C`PL_keyword_plugin\*(C'\fR actually points +at a chain of handler functions, all of which have an opportunity to +handle keywords, and only the last function in the chain (built into +the Perl core) will normally return \f(CW\*(C`KEYWORD_PLUGIN_DECLINE\*(C'\fR. +.Sp +For thread safety, modules should not set this variable directly. +Instead, use the function \*(L"wrap_keyword_plugin\*(R". +.IP "PL_phase" 8 +.IX Xref "PL_phase" +.IX Item "PL_phase" +A value that indicates the current Perl interpreter's phase. Possible values +include \f(CW\*(C`PERL_PHASE_CONSTRUCT\*(C'\fR, \f(CW\*(C`PERL_PHASE_START\*(C'\fR, \f(CW\*(C`PERL_PHASE_CHECK\*(C'\fR, +\&\f(CW\*(C`PERL_PHASE_INIT\*(C'\fR, \f(CW\*(C`PERL_PHASE_RUN\*(C'\fR, \f(CW\*(C`PERL_PHASE_END\*(C'\fR, and +\&\f(CW\*(C`PERL_PHASE_DESTRUCT\*(C'\fR. +.Sp +For example, the following determines whether the interpreter is in +global destruction: +.Sp +.Vb 3 +\& if (PL_phase == PERL_PHASE_DESTRUCT) { +\& // we are in global destruction +\& } +.Ve +.Sp +\&\f(CW\*(C`PL_phase\*(C'\fR was introduced in Perl 5.14; in prior perls you can use +\&\f(CW\*(C`PL_dirty\*(C'\fR (boolean) to determine whether the interpreter is in global +destruction. (Use of \f(CW\*(C`PL_dirty\*(C'\fR is discouraged since 5.14.) +.Sp +.Vb 1 +\& enum perl_phase PL_phase +.Ve +.SH "GV Functions" +.IX Header "GV Functions" +A \s-1GV\s0 is a structure which corresponds to to a Perl typeglob, ie *foo. +It is a structure that holds a pointer to a scalar, an array, a hash etc, +corresponding to \f(CW$foo\fR, \f(CW@foo\fR, \f(CW%foo\fR. +.PP +GVs are usually found as values in stashes (symbol table hashes) where +Perl stores its global variables. +.IP "GvAV" 8 +.IX Xref "GvAV" +.IX Item "GvAV" +Return the \s-1AV\s0 from the \s-1GV.\s0 +.Sp +.Vb 1 +\& AV* GvAV(GV* gv) +.Ve +.IP "gv_const_sv" 8 +.IX Xref "gv_const_sv" +.IX Item "gv_const_sv" +If \f(CW\*(C`gv\*(C'\fR is a typeglob whose subroutine entry is a constant sub eligible for +inlining, or \f(CW\*(C`gv\*(C'\fR is a placeholder reference that would be promoted to such +a typeglob, then returns the value returned by the sub. Otherwise, returns +\&\f(CW\*(C`NULL\*(C'\fR. +.Sp +.Vb 1 +\& SV* gv_const_sv(GV* gv) +.Ve +.IP "GvCV" 8 +.IX Xref "GvCV" +.IX Item "GvCV" +Return the \s-1CV\s0 from the \s-1GV.\s0 +.Sp +.Vb 1 +\& CV* GvCV(GV* gv) +.Ve +.IP "gv_fetchmeth" 8 +.IX Xref "gv_fetchmeth" +.IX Item "gv_fetchmeth" +Like \*(L"gv_fetchmeth_pvn\*(R", but lacks a flags parameter. +.Sp +.Vb 2 +\& GV* gv_fetchmeth(HV* stash, const char* name, +\& STRLEN len, I32 level) +.Ve +.IP "gv_fetchmethod_autoload" 8 +.IX Xref "gv_fetchmethod_autoload" +.IX Item "gv_fetchmethod_autoload" +Returns the glob which contains the subroutine to call to invoke the method +on the \f(CW\*(C`stash\*(C'\fR. In fact in the presence of autoloading this may be the +glob for \*(L"\s-1AUTOLOAD\*(R".\s0 In this case the corresponding variable \f(CW$AUTOLOAD\fR is +already setup. +.Sp +The third parameter of \f(CW\*(C`gv_fetchmethod_autoload\*(C'\fR determines whether +\&\s-1AUTOLOAD\s0 lookup is performed if the given method is not present: non-zero +means yes, look for \s-1AUTOLOAD\s0; zero means no, don't look for \s-1AUTOLOAD.\s0 +Calling \f(CW\*(C`gv_fetchmethod\*(C'\fR is equivalent to calling \f(CW\*(C`gv_fetchmethod_autoload\*(C'\fR +with a non-zero \f(CW\*(C`autoload\*(C'\fR parameter. +.Sp +These functions grant \f(CW"SUPER"\fR token +as a prefix of the method name. Note +that if you want to keep the returned glob for a long time, you need to +check for it being \*(L"\s-1AUTOLOAD\*(R",\s0 since at the later time the call may load a +different subroutine due to \f(CW$AUTOLOAD\fR changing its value. Use the glob +created as a side effect to do this. +.Sp +These functions have the same side-effects as \f(CW\*(C`gv_fetchmeth\*(C'\fR with +\&\f(CW\*(C`level==0\*(C'\fR. The warning against passing the \s-1GV\s0 returned by +\&\f(CW\*(C`gv_fetchmeth\*(C'\fR to \f(CW\*(C`call_sv\*(C'\fR applies equally to these functions. +.Sp +.Vb 3 +\& GV* gv_fetchmethod_autoload(HV* stash, +\& const char* name, +\& I32 autoload) +.Ve +.IP "gv_fetchmeth_autoload" 8 +.IX Xref "gv_fetchmeth_autoload" +.IX Item "gv_fetchmeth_autoload" +This is the old form of \*(L"gv_fetchmeth_pvn_autoload\*(R", which has no flags +parameter. +.Sp +.Vb 3 +\& GV* gv_fetchmeth_autoload(HV* stash, +\& const char* name, +\& STRLEN len, I32 level) +.Ve +.IP "gv_fetchmeth_pv" 8 +.IX Xref "gv_fetchmeth_pv" +.IX Item "gv_fetchmeth_pv" +Exactly like \*(L"gv_fetchmeth_pvn\*(R", but takes a nul-terminated string +instead of a string/length pair. +.Sp +.Vb 2 +\& GV* gv_fetchmeth_pv(HV* stash, const char* name, +\& I32 level, U32 flags) +.Ve +.IP "gv_fetchmeth_pvn" 8 +.IX Xref "gv_fetchmeth_pvn" +.IX Item "gv_fetchmeth_pvn" +Returns the glob with the given \f(CW\*(C`name\*(C'\fR and a defined subroutine or +\&\f(CW\*(C`NULL\*(C'\fR. The glob lives in the given \f(CW\*(C`stash\*(C'\fR, or in the stashes +accessible via \f(CW@ISA\fR and \f(CW\*(C`UNIVERSAL::\*(C'\fR. +.Sp +The argument \f(CW\*(C`level\*(C'\fR should be either 0 or \-1. If \f(CW\*(C`level==0\*(C'\fR, as a +side-effect creates a glob with the given \f(CW\*(C`name\*(C'\fR in the given \f(CW\*(C`stash\*(C'\fR +which in the case of success contains an alias for the subroutine, and sets +up caching info for this glob. +.Sp +The only significant values for \f(CW\*(C`flags\*(C'\fR are \f(CW\*(C`GV_SUPER\*(C'\fR and \f(CW\*(C`SVf_UTF8\*(C'\fR. +.Sp +\&\f(CW\*(C`GV_SUPER\*(C'\fR indicates that we want to look up the method in the superclasses +of the \f(CW\*(C`stash\*(C'\fR. +.Sp +The +\&\s-1GV\s0 returned from \f(CW\*(C`gv_fetchmeth\*(C'\fR may be a method cache entry, which is not +visible to Perl code. So when calling \f(CW\*(C`call_sv\*(C'\fR, you should not use +the \s-1GV\s0 directly; instead, you should use the method's \s-1CV,\s0 which can be +obtained from the \s-1GV\s0 with the \f(CW\*(C`GvCV\*(C'\fR macro. +.Sp +.Vb 3 +\& GV* gv_fetchmeth_pvn(HV* stash, const char* name, +\& STRLEN len, I32 level, +\& U32 flags) +.Ve +.IP "gv_fetchmeth_pvn_autoload" 8 +.IX Xref "gv_fetchmeth_pvn_autoload" +.IX Item "gv_fetchmeth_pvn_autoload" +Same as \f(CW\*(C`gv_fetchmeth_pvn()\*(C'\fR, but looks for autoloaded subroutines too. +Returns a glob for the subroutine. +.Sp +For an autoloaded subroutine without a \s-1GV,\s0 will create a \s-1GV\s0 even +if \f(CW\*(C`level < 0\*(C'\fR. For an autoloaded subroutine without a stub, \f(CW\*(C`GvCV()\*(C'\fR +of the result may be zero. +.Sp +Currently, the only significant value for \f(CW\*(C`flags\*(C'\fR is \f(CW\*(C`SVf_UTF8\*(C'\fR. +.Sp +.Vb 4 +\& GV* gv_fetchmeth_pvn_autoload(HV* stash, +\& const char* name, +\& STRLEN len, I32 level, +\& U32 flags) +.Ve +.IP "gv_fetchmeth_pv_autoload" 8 +.IX Xref "gv_fetchmeth_pv_autoload" +.IX Item "gv_fetchmeth_pv_autoload" +Exactly like \*(L"gv_fetchmeth_pvn_autoload\*(R", but takes a nul-terminated string +instead of a string/length pair. +.Sp +.Vb 3 +\& GV* gv_fetchmeth_pv_autoload(HV* stash, +\& const char* name, +\& I32 level, U32 flags) +.Ve +.IP "gv_fetchmeth_sv" 8 +.IX Xref "gv_fetchmeth_sv" +.IX Item "gv_fetchmeth_sv" +Exactly like \*(L"gv_fetchmeth_pvn\*(R", but takes the name string in the form +of an \s-1SV\s0 instead of a string/length pair. +.Sp +.Vb 2 +\& GV* gv_fetchmeth_sv(HV* stash, SV* namesv, +\& I32 level, U32 flags) +.Ve +.IP "gv_fetchmeth_sv_autoload" 8 +.IX Xref "gv_fetchmeth_sv_autoload" +.IX Item "gv_fetchmeth_sv_autoload" +Exactly like \*(L"gv_fetchmeth_pvn_autoload\*(R", but takes the name string in the form +of an \s-1SV\s0 instead of a string/length pair. +.Sp +.Vb 2 +\& GV* gv_fetchmeth_sv_autoload(HV* stash, SV* namesv, +\& I32 level, U32 flags) +.Ve +.IP "GvHV" 8 +.IX Xref "GvHV" +.IX Item "GvHV" +Return the \s-1HV\s0 from the \s-1GV.\s0 +.Sp +.Vb 1 +\& HV* GvHV(GV* gv) +.Ve +.IP "gv_init" 8 +.IX Xref "gv_init" +.IX Item "gv_init" +The old form of \f(CW\*(C`gv_init_pvn()\*(C'\fR. It does not work with \s-1UTF\-8\s0 strings, as it +has no flags parameter. If the \f(CW\*(C`multi\*(C'\fR parameter is set, the +\&\f(CW\*(C`GV_ADDMULTI\*(C'\fR flag will be passed to \f(CW\*(C`gv_init_pvn()\*(C'\fR. +.Sp +.Vb 2 +\& void gv_init(GV* gv, HV* stash, const char* name, +\& STRLEN len, int multi) +.Ve +.IP "gv_init_pv" 8 +.IX Xref "gv_init_pv" +.IX Item "gv_init_pv" +Same as \f(CW\*(C`gv_init_pvn()\*(C'\fR, but takes a nul-terminated string for the name +instead of separate char * and length parameters. +.Sp +.Vb 2 +\& void gv_init_pv(GV* gv, HV* stash, const char* name, +\& U32 flags) +.Ve +.IP "gv_init_pvn" 8 +.IX Xref "gv_init_pvn" +.IX Item "gv_init_pvn" +Converts a scalar into a typeglob. This is an incoercible typeglob; +assigning a reference to it will assign to one of its slots, instead of +overwriting it as happens with typeglobs created by \f(CW\*(C`SvSetSV\*(C'\fR. Converting +any scalar that is \f(CW\*(C`SvOK()\*(C'\fR may produce unpredictable results and is reserved +for perl's internal use. +.Sp +\&\f(CW\*(C`gv\*(C'\fR is the scalar to be converted. +.Sp +\&\f(CW\*(C`stash\*(C'\fR is the parent stash/package, if any. +.Sp +\&\f(CW\*(C`name\*(C'\fR and \f(CW\*(C`len\*(C'\fR give the name. The name must be unqualified; +that is, it must not include the package name. If \f(CW\*(C`gv\*(C'\fR is a +stash element, it is the caller's responsibility to ensure that the name +passed to this function matches the name of the element. If it does not +match, perl's internal bookkeeping will get out of sync. +.Sp +\&\f(CW\*(C`flags\*(C'\fR can be set to \f(CW\*(C`SVf_UTF8\*(C'\fR if \f(CW\*(C`name\*(C'\fR is a \s-1UTF\-8\s0 string, or +the return value of SvUTF8(sv). It can also take the +\&\f(CW\*(C`GV_ADDMULTI\*(C'\fR flag, which means to pretend that the \s-1GV\s0 has been +seen before (i.e., suppress \*(L"Used once\*(R" warnings). +.Sp +.Vb 2 +\& void gv_init_pvn(GV* gv, HV* stash, const char* name, +\& STRLEN len, U32 flags) +.Ve +.IP "gv_init_sv" 8 +.IX Xref "gv_init_sv" +.IX Item "gv_init_sv" +Same as \f(CW\*(C`gv_init_pvn()\*(C'\fR, but takes an \s-1SV\s0 * for the name instead of separate +char * and length parameters. \f(CW\*(C`flags\*(C'\fR is currently unused. +.Sp +.Vb 2 +\& void gv_init_sv(GV* gv, HV* stash, SV* namesv, +\& U32 flags) +.Ve +.IP "gv_stashpv" 8 +.IX Xref "gv_stashpv" +.IX Item "gv_stashpv" +Returns a pointer to the stash for a specified package. Uses \f(CW\*(C`strlen\*(C'\fR to +determine the length of \f(CW\*(C`name\*(C'\fR, then calls \f(CW\*(C`gv_stashpvn()\*(C'\fR. +.Sp +.Vb 1 +\& HV* gv_stashpv(const char* name, I32 flags) +.Ve +.IP "gv_stashpvn" 8 +.IX Xref "gv_stashpvn" +.IX Item "gv_stashpvn" +Returns a pointer to the stash for a specified package. The \f(CW\*(C`namelen\*(C'\fR +parameter indicates the length of the \f(CW\*(C`name\*(C'\fR, in bytes. \f(CW\*(C`flags\*(C'\fR is passed +to \f(CW\*(C`gv_fetchpvn_flags()\*(C'\fR, so if set to \f(CW\*(C`GV_ADD\*(C'\fR then the package will be +created if it does not already exist. If the package does not exist and +\&\f(CW\*(C`flags\*(C'\fR is 0 (or any other setting that does not create packages) then \f(CW\*(C`NULL\*(C'\fR +is returned. +.Sp +Flags may be one of: +.Sp +.Vb 6 +\& GV_ADD +\& SVf_UTF8 +\& GV_NOADD_NOINIT +\& GV_NOINIT +\& GV_NOEXPAND +\& GV_ADDMG +.Ve +.Sp +The most important of which are probably \f(CW\*(C`GV_ADD\*(C'\fR and \f(CW\*(C`SVf_UTF8\*(C'\fR. +.Sp +Note, use of \f(CW\*(C`gv_stashsv\*(C'\fR instead of \f(CW\*(C`gv_stashpvn\*(C'\fR where possible is strongly +recommended for performance reasons. +.Sp +.Vb 2 +\& HV* gv_stashpvn(const char* name, U32 namelen, +\& I32 flags) +.Ve +.IP "gv_stashpvs" 8 +.IX Xref "gv_stashpvs" +.IX Item "gv_stashpvs" +Like \f(CW\*(C`gv_stashpvn\*(C'\fR, but takes a literal string instead of a +string/length pair. +.Sp +.Vb 1 +\& HV* gv_stashpvs("name", I32 create) +.Ve +.IP "gv_stashsv" 8 +.IX Xref "gv_stashsv" +.IX Item "gv_stashsv" +Returns a pointer to the stash for a specified package. See +\&\f(CW"gv_stashpvn"\fR. +.Sp +Note this interface is strongly preferred over \f(CW\*(C`gv_stashpvn\*(C'\fR for performance +reasons. +.Sp +.Vb 1 +\& HV* gv_stashsv(SV* sv, I32 flags) +.Ve +.IP "GvSV" 8 +.IX Xref "GvSV" +.IX Item "GvSV" +Return the \s-1SV\s0 from the \s-1GV.\s0 +.Sp +.Vb 1 +\& SV* GvSV(GV* gv) +.Ve +.IP "save_gp" 8 +.IX Xref "save_gp" +.IX Item "save_gp" +Saves the current \s-1GP\s0 of gv on the save stack to be restored on scope exit. +.Sp +If empty is true, replace the \s-1GP\s0 with a new \s-1GP.\s0 +.Sp +If empty is false, mark gv with GVf_INTRO so the next reference +assigned is localized, which is how \f(CW\*(C` local *foo = $someref; \*(C'\fR works. +.Sp +.Vb 1 +\& void save_gp(GV* gv, I32 empty) +.Ve +.IP "setdefout" 8 +.IX Xref "setdefout" +.IX Item "setdefout" +Sets \f(CW\*(C`PL_defoutgv\*(C'\fR, the default file handle for output, to the passed in +typeglob. As \f(CW\*(C`PL_defoutgv\*(C'\fR \*(L"owns\*(R" a reference on its typeglob, the reference +count of the passed in typeglob is increased by one, and the reference count +of the typeglob that \f(CW\*(C`PL_defoutgv\*(C'\fR points to is decreased by one. +.Sp +.Vb 1 +\& void setdefout(GV* gv) +.Ve +.SH "Handy Values" +.IX Header "Handy Values" +.IP "C_ARRAY_END" 8 +.IX Xref "C_ARRAY_END" +.IX Item "C_ARRAY_END" +Returns a pointer to one element past the final element of the input C array. +.Sp +.Vb 1 +\& void * C_ARRAY_END(void *a) +.Ve +.IP "C_ARRAY_LENGTH" 8 +.IX Xref "C_ARRAY_LENGTH" +.IX Item "C_ARRAY_LENGTH" +Returns the number of elements in the input C array (so you want your +zero-based indices to be less than but not equal to). +.Sp +.Vb 1 +\& STRLEN C_ARRAY_LENGTH(void *a) +.Ve +.IP "cBOOL" 8 +.IX Xref "cBOOL" +.IX Item "cBOOL" +Cast-to-bool. A simple \f(CW\*(C`(bool)\ \f(CIexpr\f(CW\*(C'\fR cast may not do the right thing: +if \f(CW\*(C`bool\*(C'\fR is defined as \f(CW\*(C`char\*(C'\fR, for example, then the cast from \f(CW\*(C`int\*(C'\fR is +implementation-defined. +.Sp +\&\f(CW\*(C`(bool)!!(cbool)\*(C'\fR in a ternary triggers a bug in xlc on \s-1AIX\s0 +.Sp +.Vb 1 +\& bool cBOOL(bool expr) +.Ve +.IP "Nullav" 8 +.IX Xref "Nullav" +.IX Item "Nullav" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Null \s-1AV\s0 pointer. +.Sp +(deprecated \- use \f(CW\*(C`(AV *)NULL\*(C'\fR instead) +.IP "Nullch" 8 +.IX Xref "Nullch" +.IX Item "Nullch" +Null character pointer. (No longer available when \f(CW\*(C`PERL_CORE\*(C'\fR is +defined.) +.IP "Nullcv" 8 +.IX Xref "Nullcv" +.IX Item "Nullcv" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Null \s-1CV\s0 pointer. +.Sp +(deprecated \- use \f(CW\*(C`(CV *)NULL\*(C'\fR instead) +.IP "Nullhv" 8 +.IX Xref "Nullhv" +.IX Item "Nullhv" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Null \s-1HV\s0 pointer. +.Sp +(deprecated \- use \f(CW\*(C`(HV *)NULL\*(C'\fR instead) +.IP "Nullsv" 8 +.IX Xref "Nullsv" +.IX Item "Nullsv" +Null \s-1SV\s0 pointer. (No longer available when \f(CW\*(C`PERL_CORE\*(C'\fR is defined.) +.IP "\s-1STR_WITH_LEN\s0" 8 +.IX Xref "STR_WITH_LEN" +.IX Item "STR_WITH_LEN" +Returns two comma separated tokens of the input literal string, and its length. +This is convenience macro which helps out in some \s-1API\s0 calls. +Note that it can't be used as an argument to macros or functions that under +some configurations might be macros, which means that it requires the full +Perl_xxx(aTHX_ ...) form for any \s-1API\s0 calls where it's used. +.Sp +.Vb 1 +\& pair STR_WITH_LEN("literal string") +.Ve +.IP "_\|_ASSERT_" 8 +.IX Xref "__ASSERT_" +.IX Item "__ASSERT_" +This is a helper macro to avoid preprocessor issues, replaced by nothing +unless under \s-1DEBUGGING,\s0 where it expands to an assert of its argument, +followed by a comma (hence the comma operator). If we just used a straight +\&\fBassert()\fR, we would get a comma with nothing before it when not \s-1DEBUGGING.\s0 +.Sp +.Vb 1 +\& void _\|_ASSERT_(bool expr) +.Ve +.SH "Hash Manipulation Functions" +.IX Header "Hash Manipulation Functions" +A \s-1HV\s0 structure represents a Perl hash. It consists mainly of an array +of pointers, each of which points to a linked list of \s-1HE\s0 structures. The +array is indexed by the hash function of the key, so each linked list +represents all the hash entries with the same hash value. Each \s-1HE\s0 contains +a pointer to the actual value, plus a pointer to a \s-1HEK\s0 structure which +holds the key and hash value. +.IP "cop_fetch_label" 8 +.IX Xref "cop_fetch_label" +.IX Item "cop_fetch_label" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Returns the label attached to a cop, and stores its length in bytes into +\&\f(CW*len\fR. +Upon return, \f(CW*flags\fR will be set to either \f(CW\*(C`SVf_UTF8\*(C'\fR or 0. +.Sp +Alternatively, use the macro "\f(CW\*(C`CopLABEL_len_flags\*(C'\fR"; +or if you don't need to know if the label is \s-1UTF\-8\s0 or not, the macro +"\f(CW\*(C`CopLABEL_len\*(C'\fR"; +or if you additionally dont need to know the length, "\f(CW\*(C`CopLABEL\*(C'\fR". +.Sp +.Vb 2 +\& const char * cop_fetch_label(COP *const cop, +\& STRLEN *len, U32 *flags) +.Ve +.IP "cop_store_label" 8 +.IX Xref "cop_store_label" +.IX Item "cop_store_label" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Save a label into a \f(CW\*(C`cop_hints_hash\*(C'\fR. +You need to set flags to \f(CW\*(C`SVf_UTF8\*(C'\fR +for a \s-1UTF\-8\s0 label. Any other flag is ignored. +.Sp +.Vb 3 +\& void cop_store_label(COP *const cop, +\& const char *label, STRLEN len, +\& U32 flags) +.Ve +.IP "get_hv" 8 +.IX Xref "get_hv" +.IX Item "get_hv" +Returns the \s-1HV\s0 of the specified Perl hash. \f(CW\*(C`flags\*(C'\fR are passed to +\&\f(CW\*(C`gv_fetchpv\*(C'\fR. If \f(CW\*(C`GV_ADD\*(C'\fR is set and the +Perl variable does not exist then it will be created. If \f(CW\*(C`flags\*(C'\fR is zero +and the variable does not exist then \f(CW\*(C`NULL\*(C'\fR is returned. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& HV* get_hv(const char *name, I32 flags) +.Ve +.IP "HEf_SVKEY" 8 +.IX Xref "HEf_SVKEY" +.IX Item "HEf_SVKEY" +This flag, used in the length slot of hash entries and magic structures, +specifies the structure contains an \f(CW\*(C`SV*\*(C'\fR pointer where a \f(CW\*(C`char*\*(C'\fR pointer +is to be expected. (For information only\*(--not to be used). +.IP "HeHASH" 8 +.IX Xref "HeHASH" +.IX Item "HeHASH" +Returns the computed hash stored in the hash entry. +.Sp +.Vb 1 +\& U32 HeHASH(HE* he) +.Ve +.IP "HeKEY" 8 +.IX Xref "HeKEY" +.IX Item "HeKEY" +Returns the actual pointer stored in the key slot of the hash entry. The +pointer may be either \f(CW\*(C`char*\*(C'\fR or \f(CW\*(C`SV*\*(C'\fR, depending on the value of +\&\f(CW\*(C`HeKLEN()\*(C'\fR. Can be assigned to. The \f(CW\*(C`HePV()\*(C'\fR or \f(CW\*(C`HeSVKEY()\*(C'\fR macros are +usually preferable for finding the value of a key. +.Sp +.Vb 1 +\& void* HeKEY(HE* he) +.Ve +.IP "HeKLEN" 8 +.IX Xref "HeKLEN" +.IX Item "HeKLEN" +If this is negative, and amounts to \f(CW\*(C`HEf_SVKEY\*(C'\fR, it indicates the entry +holds an \f(CW\*(C`SV*\*(C'\fR key. Otherwise, holds the actual length of the key. Can +be assigned to. The \f(CW\*(C`HePV()\*(C'\fR macro is usually preferable for finding key +lengths. +.Sp +.Vb 1 +\& STRLEN HeKLEN(HE* he) +.Ve +.IP "HePV" 8 +.IX Xref "HePV" +.IX Item "HePV" +Returns the key slot of the hash entry as a \f(CW\*(C`char*\*(C'\fR value, doing any +necessary dereferencing of possibly \f(CW\*(C`SV*\*(C'\fR keys. The length of the string +is placed in \f(CW\*(C`len\*(C'\fR (this is a macro, so do \fInot\fR use \f(CW&len\fR). If you do +not care about what the length of the key is, you may use the global +variable \f(CW\*(C`PL_na\*(C'\fR, though this is rather less efficient than using a local +variable. Remember though, that hash keys in perl are free to contain +embedded nulls, so using \f(CW\*(C`strlen()\*(C'\fR or similar is not a good way to find +the length of hash keys. This is very similar to the \f(CW\*(C`SvPV()\*(C'\fR macro +described elsewhere in this document. See also \f(CW"HeUTF8"\fR. +.Sp +If you are using \f(CW\*(C`HePV\*(C'\fR to get values to pass to \f(CW\*(C`newSVpvn()\*(C'\fR to create a +new \s-1SV,\s0 you should consider using \f(CW\*(C`newSVhek(HeKEY_hek(he))\*(C'\fR as it is more +efficient. +.Sp +.Vb 1 +\& char* HePV(HE* he, STRLEN len) +.Ve +.IP "HeSVKEY" 8 +.IX Xref "HeSVKEY" +.IX Item "HeSVKEY" +Returns the key as an \f(CW\*(C`SV*\*(C'\fR, or \f(CW\*(C`NULL\*(C'\fR if the hash entry does not +contain an \f(CW\*(C`SV*\*(C'\fR key. +.Sp +.Vb 1 +\& SV* HeSVKEY(HE* he) +.Ve +.IP "HeSVKEY_force" 8 +.IX Xref "HeSVKEY_force" +.IX Item "HeSVKEY_force" +Returns the key as an \f(CW\*(C`SV*\*(C'\fR. Will create and return a temporary mortal +\&\f(CW\*(C`SV*\*(C'\fR if the hash entry contains only a \f(CW\*(C`char*\*(C'\fR key. +.Sp +.Vb 1 +\& SV* HeSVKEY_force(HE* he) +.Ve +.IP "HeSVKEY_set" 8 +.IX Xref "HeSVKEY_set" +.IX Item "HeSVKEY_set" +Sets the key to a given \f(CW\*(C`SV*\*(C'\fR, taking care to set the appropriate flags to +indicate the presence of an \f(CW\*(C`SV*\*(C'\fR key, and returns the same +\&\f(CW\*(C`SV*\*(C'\fR. +.Sp +.Vb 1 +\& SV* HeSVKEY_set(HE* he, SV* sv) +.Ve +.IP "HeUTF8" 8 +.IX Xref "HeUTF8" +.IX Item "HeUTF8" +Returns whether the \f(CW\*(C`char *\*(C'\fR value returned by \f(CW\*(C`HePV\*(C'\fR is encoded in \s-1UTF\-8,\s0 +doing any necessary dereferencing of possibly \f(CW\*(C`SV*\*(C'\fR keys. The value returned +will be 0 or non\-0, not necessarily 1 (or even a value with any low bits set), +so \fBdo not\fR blindly assign this to a \f(CW\*(C`bool\*(C'\fR variable, as \f(CW\*(C`bool\*(C'\fR may be a +typedef for \f(CW\*(C`char\*(C'\fR. +.Sp +.Vb 1 +\& U32 HeUTF8(HE* he) +.Ve +.IP "HeVAL" 8 +.IX Xref "HeVAL" +.IX Item "HeVAL" +Returns the value slot (type \f(CW\*(C`SV*\*(C'\fR) +stored in the hash entry. Can be assigned +to. +.Sp +.Vb 2 +\& SV *foo= HeVAL(hv); +\& HeVAL(hv)= sv; +\& +\& +\& SV* HeVAL(HE* he) +.Ve +.IP "hv_assert" 8 +.IX Xref "hv_assert" +.IX Item "hv_assert" +Check that a hash is in an internally consistent state. +.Sp +\&\s-1NOTE:\s0 this function must be explicitly called as Perl_hv_assert with an aTHX_ parameter. +.Sp +.Vb 1 +\& void Perl_hv_assert(pTHX_ HV *hv) +.Ve +.IP "hv_bucket_ratio" 8 +.IX Xref "hv_bucket_ratio" +.IX Item "hv_bucket_ratio" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +If the hash is tied dispatches through to the \s-1SCALAR\s0 tied method, +otherwise if the hash contains no keys returns 0, otherwise returns +a mortal sv containing a string specifying the number of used buckets, +followed by a slash, followed by the number of available buckets. +.Sp +This function is expensive, it must scan all of the buckets +to determine which are used, and the count is \s-1NOT\s0 cached. +In a large hash this could be a lot of buckets. +.Sp +.Vb 1 +\& SV* hv_bucket_ratio(HV *hv) +.Ve +.IP "hv_clear" 8 +.IX Xref "hv_clear" +.IX Item "hv_clear" +Frees the all the elements of a hash, leaving it empty. +The \s-1XS\s0 equivalent of \f(CW\*(C`%hash = ()\*(C'\fR. See also \*(L"hv_undef\*(R". +.Sp +See \*(L"av_clear\*(R" for a note about the hash possibly being invalid on +return. +.Sp +.Vb 1 +\& void hv_clear(HV *hv) +.Ve +.IP "hv_clear_placeholders" 8 +.IX Xref "hv_clear_placeholders" +.IX Item "hv_clear_placeholders" +Clears any placeholders from a hash. If a restricted hash has any of its keys +marked as readonly and the key is subsequently deleted, the key is not actually +deleted but is marked by assigning it a value of \f(CW&PL_sv_placeholder\fR. This tags +it so it will be ignored by future operations such as iterating over the hash, +but will still allow the hash to have a value reassigned to the key at some +future point. This function clears any such placeholder keys from the hash. +See \f(CW\*(C`Hash::Util::lock_keys()\*(C'\fR for an example of its +use. +.Sp +.Vb 1 +\& void hv_clear_placeholders(HV *hv) +.Ve +.IP "hv_copy_hints_hv" 8 +.IX Xref "hv_copy_hints_hv" +.IX Item "hv_copy_hints_hv" +A specialised version of \*(L"newHVhv\*(R" for copying \f(CW\*(C`%^H\*(C'\fR. \f(CW\*(C`ohv\*(C'\fR must be +a pointer to a hash (which may have \f(CW\*(C`%^H\*(C'\fR magic, but should be generally +non-magical), or \f(CW\*(C`NULL\*(C'\fR (interpreted as an empty hash). The content +of \f(CW\*(C`ohv\*(C'\fR is copied to a new hash, which has the \f(CW\*(C`%^H\*(C'\fR\-specific magic +added to it. A pointer to the new hash is returned. +.Sp +.Vb 1 +\& HV * hv_copy_hints_hv(HV *const ohv) +.Ve +.IP "hv_delete" 8 +.IX Xref "hv_delete" +.IX Item "hv_delete" +Deletes a key/value pair in the hash. The value's \s-1SV\s0 is removed from +the hash, made mortal, and returned to the caller. The absolute +value of \f(CW\*(C`klen\*(C'\fR is the length of the key. If \f(CW\*(C`klen\*(C'\fR is negative the +key is assumed to be in UTF\-8\-encoded Unicode. The \f(CW\*(C`flags\*(C'\fR value +will normally be zero; if set to \f(CW\*(C`G_DISCARD\*(C'\fR then \f(CW\*(C`NULL\*(C'\fR will be returned. +\&\f(CW\*(C`NULL\*(C'\fR will also be returned if the key is not found. +.Sp +.Vb 2 +\& SV* hv_delete(HV *hv, const char *key, I32 klen, +\& I32 flags) +.Ve +.IP "hv_delete_ent" 8 +.IX Xref "hv_delete_ent" +.IX Item "hv_delete_ent" +Deletes a key/value pair in the hash. The value \s-1SV\s0 is removed from the hash, +made mortal, and returned to the caller. The \f(CW\*(C`flags\*(C'\fR value will normally be +zero; if set to \f(CW\*(C`G_DISCARD\*(C'\fR then \f(CW\*(C`NULL\*(C'\fR will be returned. \f(CW\*(C`NULL\*(C'\fR will also +be returned if the key is not found. \f(CW\*(C`hash\*(C'\fR can be a valid precomputed hash +value, or 0 to ask for it to be computed. +.Sp +.Vb 2 +\& SV* hv_delete_ent(HV *hv, SV *keysv, I32 flags, +\& U32 hash) +.Ve +.IP "HvENAME" 8 +.IX Xref "HvENAME" +.IX Item "HvENAME" +Returns the effective name of a stash, or \s-1NULL\s0 if there is none. The +effective name represents a location in the symbol table where this stash +resides. It is updated automatically when packages are aliased or deleted. +A stash that is no longer in the symbol table has no effective name. This +name is preferable to \f(CW\*(C`HvNAME\*(C'\fR for use in \s-1MRO\s0 linearisations and isa +caches. +.Sp +.Vb 1 +\& char* HvENAME(HV* stash) +.Ve +.IP "HvENAMELEN" 8 +.IX Xref "HvENAMELEN" +.IX Item "HvENAMELEN" +Returns the length of the stash's effective name. +.Sp +.Vb 1 +\& STRLEN HvENAMELEN(HV *stash) +.Ve +.IP "HvENAMEUTF8" 8 +.IX Xref "HvENAMEUTF8" +.IX Item "HvENAMEUTF8" +Returns true if the effective name is in \s-1UTF\-8\s0 encoding. +.Sp +.Vb 1 +\& unsigned char HvENAMEUTF8(HV *stash) +.Ve +.IP "hv_exists" 8 +.IX Xref "hv_exists" +.IX Item "hv_exists" +Returns a boolean indicating whether the specified hash key exists. The +absolute value of \f(CW\*(C`klen\*(C'\fR is the length of the key. If \f(CW\*(C`klen\*(C'\fR is +negative the key is assumed to be in UTF\-8\-encoded Unicode. +.Sp +.Vb 1 +\& bool hv_exists(HV *hv, const char *key, I32 klen) +.Ve +.IP "hv_exists_ent" 8 +.IX Xref "hv_exists_ent" +.IX Item "hv_exists_ent" +Returns a boolean indicating whether +the specified hash key exists. \f(CW\*(C`hash\*(C'\fR +can be a valid precomputed hash value, or 0 to ask for it to be +computed. +.Sp +.Vb 1 +\& bool hv_exists_ent(HV *hv, SV *keysv, U32 hash) +.Ve +.IP "hv_fetch" 8 +.IX Xref "hv_fetch" +.IX Item "hv_fetch" +Returns the \s-1SV\s0 which corresponds to the specified key in the hash. +The absolute value of \f(CW\*(C`klen\*(C'\fR is the length of the key. If \f(CW\*(C`klen\*(C'\fR is +negative the key is assumed to be in UTF\-8\-encoded Unicode. If +\&\f(CW\*(C`lval\*(C'\fR is set then the fetch will be part of a store. This means that if +there is no value in the hash associated with the given key, then one is +created and a pointer to it is returned. The \f(CW\*(C`SV*\*(C'\fR it points to can be +assigned to. But always check that the +return value is non-null before dereferencing it to an \f(CW\*(C`SV*\*(C'\fR. +.Sp +See \*(L"Understanding the Magic of Tied Hashes and Arrays\*(R" in perlguts for more +information on how to use this function on tied hashes. +.Sp +.Vb 2 +\& SV** hv_fetch(HV *hv, const char *key, I32 klen, +\& I32 lval) +.Ve +.IP "hv_fetchs" 8 +.IX Xref "hv_fetchs" +.IX Item "hv_fetchs" +Like \f(CW\*(C`hv_fetch\*(C'\fR, but takes a literal string instead of a +string/length pair. +.Sp +.Vb 1 +\& SV** hv_fetchs(HV* tb, "key", I32 lval) +.Ve +.IP "hv_fetch_ent" 8 +.IX Xref "hv_fetch_ent" +.IX Item "hv_fetch_ent" +Returns the hash entry which corresponds to the specified key in the hash. +\&\f(CW\*(C`hash\*(C'\fR must be a valid precomputed hash number for the given \f(CW\*(C`key\*(C'\fR, or 0 +if you want the function to compute it. \s-1IF\s0 \f(CW\*(C`lval\*(C'\fR is set then the fetch +will be part of a store. Make sure the return value is non-null before +accessing it. The return value when \f(CW\*(C`hv\*(C'\fR is a tied hash is a pointer to a +static location, so be sure to make a copy of the structure if you need to +store it somewhere. +.Sp +See \*(L"Understanding the Magic of Tied Hashes and Arrays\*(R" in perlguts for more +information on how to use this function on tied hashes. +.Sp +.Vb 2 +\& HE* hv_fetch_ent(HV *hv, SV *keysv, I32 lval, +\& U32 hash) +.Ve +.IP "HvFILL" 8 +.IX Xref "HvFILL" +.IX Item "HvFILL" +See \*(L"hv_fill\*(R". +.Sp +.Vb 1 +\& STRLEN HvFILL(HV *const hv) +.Ve +.IP "hv_fill" 8 +.IX Xref "hv_fill" +.IX Item "hv_fill" +Returns the number of hash buckets that happen to be in use. +.Sp +This function is wrapped by the macro \f(CW\*(C`HvFILL\*(C'\fR. +.Sp +As of perl 5.25 this function is used only for debugging +purposes, and the number of used hash buckets is not +in any way cached, thus this function can be costly +to execute as it must iterate over all the buckets in the +hash. +.Sp +\&\s-1NOTE:\s0 this function must be explicitly called as Perl_hv_fill with an aTHX_ parameter. +.Sp +.Vb 1 +\& STRLEN Perl_hv_fill(pTHX_ HV *const hv) +.Ve +.IP "hv_iterinit" 8 +.IX Xref "hv_iterinit" +.IX Item "hv_iterinit" +Prepares a starting point to traverse a hash table. Returns the number of +keys in the hash, including placeholders (i.e. the same as \f(CW\*(C`HvTOTALKEYS(hv)\*(C'\fR). +The return value is currently only meaningful for hashes without tie magic. +.Sp +\&\s-1NOTE:\s0 Before version 5.004_65, \f(CW\*(C`hv_iterinit\*(C'\fR used to return the number of +hash buckets that happen to be in use. If you still need that esoteric +value, you can get it through the macro \f(CW\*(C`HvFILL(hv)\*(C'\fR. +.Sp +.Vb 1 +\& I32 hv_iterinit(HV *hv) +.Ve +.IP "hv_iterkey" 8 +.IX Xref "hv_iterkey" +.IX Item "hv_iterkey" +Returns the key from the current position of the hash iterator. See +\&\f(CW"hv_iterinit"\fR. +.Sp +.Vb 1 +\& char* hv_iterkey(HE* entry, I32* retlen) +.Ve +.IP "hv_iterkeysv" 8 +.IX Xref "hv_iterkeysv" +.IX Item "hv_iterkeysv" +Returns the key as an \f(CW\*(C`SV*\*(C'\fR from the current position of the hash +iterator. The return value will always be a mortal copy of the key. Also +see \f(CW"hv_iterinit"\fR. +.Sp +.Vb 1 +\& SV* hv_iterkeysv(HE* entry) +.Ve +.IP "hv_iternext" 8 +.IX Xref "hv_iternext" +.IX Item "hv_iternext" +Returns entries from a hash iterator. See \f(CW"hv_iterinit"\fR. +.Sp +You may call \f(CW\*(C`hv_delete\*(C'\fR or \f(CW\*(C`hv_delete_ent\*(C'\fR on the hash entry that the +iterator currently points to, without losing your place or invalidating your +iterator. Note that in this case the current entry is deleted from the hash +with your iterator holding the last reference to it. Your iterator is flagged +to free the entry on the next call to \f(CW\*(C`hv_iternext\*(C'\fR, so you must not discard +your iterator immediately else the entry will leak \- call \f(CW\*(C`hv_iternext\*(C'\fR to +trigger the resource deallocation. +.Sp +.Vb 1 +\& HE* hv_iternext(HV *hv) +.Ve +.IP "hv_iternextsv" 8 +.IX Xref "hv_iternextsv" +.IX Item "hv_iternextsv" +Performs an \f(CW\*(C`hv_iternext\*(C'\fR, \f(CW\*(C`hv_iterkey\*(C'\fR, and \f(CW\*(C`hv_iterval\*(C'\fR in one +operation. +.Sp +.Vb 1 +\& SV* hv_iternextsv(HV *hv, char **key, I32 *retlen) +.Ve +.IP "hv_iternext_flags" 8 +.IX Xref "hv_iternext_flags" +.IX Item "hv_iternext_flags" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Returns entries from a hash iterator. See \f(CW"hv_iterinit"\fR and +\&\f(CW"hv_iternext"\fR. +The \f(CW\*(C`flags\*(C'\fR value will normally be zero; if \f(CW\*(C`HV_ITERNEXT_WANTPLACEHOLDERS\*(C'\fR is +set the placeholders keys (for restricted hashes) will be returned in addition +to normal keys. By default placeholders are automatically skipped over. +Currently a placeholder is implemented with a value that is +\&\f(CW&PL_sv_placeholder\fR. Note that the implementation of placeholders and +restricted hashes may change, and the implementation currently is +insufficiently abstracted for any change to be tidy. +.Sp +.Vb 1 +\& HE* hv_iternext_flags(HV *hv, I32 flags) +.Ve +.IP "hv_iterval" 8 +.IX Xref "hv_iterval" +.IX Item "hv_iterval" +Returns the value from the current position of the hash iterator. See +\&\f(CW"hv_iterkey"\fR. +.Sp +.Vb 1 +\& SV* hv_iterval(HV *hv, HE *entry) +.Ve +.IP "hv_magic" 8 +.IX Xref "hv_magic" +.IX Item "hv_magic" +Adds magic to a hash. See \f(CW"sv_magic"\fR. +.Sp +.Vb 1 +\& void hv_magic(HV *hv, GV *gv, int how) +.Ve +.IP "HvNAME" 8 +.IX Xref "HvNAME" +.IX Item "HvNAME" +Returns the package name of a stash, or \f(CW\*(C`NULL\*(C'\fR if \f(CW\*(C`stash\*(C'\fR isn't a stash. +See \f(CW"SvSTASH"\fR, \f(CW"CvSTASH"\fR. +.Sp +.Vb 1 +\& char* HvNAME(HV* stash) +.Ve +.IP "HvNAMELEN" 8 +.IX Xref "HvNAMELEN" +.IX Item "HvNAMELEN" +Returns the length of the stash's name. +.Sp +.Vb 1 +\& STRLEN HvNAMELEN(HV *stash) +.Ve +.IP "HvNAMEUTF8" 8 +.IX Xref "HvNAMEUTF8" +.IX Item "HvNAMEUTF8" +Returns true if the name is in \s-1UTF\-8\s0 encoding. +.Sp +.Vb 1 +\& unsigned char HvNAMEUTF8(HV *stash) +.Ve +.IP "hv_scalar" 8 +.IX Xref "hv_scalar" +.IX Item "hv_scalar" +Evaluates the hash in scalar context and returns the result. +.Sp +When the hash is tied dispatches through to the \s-1SCALAR\s0 method, +otherwise returns a mortal \s-1SV\s0 containing the number of keys +in the hash. +.Sp +Note, prior to 5.25 this function returned what is now +returned by the \fBhv_bucket_ratio()\fR function. +.Sp +.Vb 1 +\& SV* hv_scalar(HV *hv) +.Ve +.IP "hv_store" 8 +.IX Xref "hv_store" +.IX Item "hv_store" +Stores an \s-1SV\s0 in a hash. The hash key is specified as \f(CW\*(C`key\*(C'\fR and the +absolute value of \f(CW\*(C`klen\*(C'\fR is the length of the key. If \f(CW\*(C`klen\*(C'\fR is +negative the key is assumed to be in UTF\-8\-encoded Unicode. The +\&\f(CW\*(C`hash\*(C'\fR parameter is the precomputed hash value; if it is zero then +Perl will compute it. +.Sp +The return value will be +\&\f(CW\*(C`NULL\*(C'\fR if the operation failed or if the value did not need to be actually +stored within the hash (as in the case of tied hashes). Otherwise it can +be dereferenced to get the original \f(CW\*(C`SV*\*(C'\fR. Note that the caller is +responsible for suitably incrementing the reference count of \f(CW\*(C`val\*(C'\fR before +the call, and decrementing it if the function returned \f(CW\*(C`NULL\*(C'\fR. Effectively +a successful \f(CW\*(C`hv_store\*(C'\fR takes ownership of one reference to \f(CW\*(C`val\*(C'\fR. This is +usually what you want; a newly created \s-1SV\s0 has a reference count of one, so +if all your code does is create SVs then store them in a hash, \f(CW\*(C`hv_store\*(C'\fR +will own the only reference to the new \s-1SV,\s0 and your code doesn't need to do +anything further to tidy up. \f(CW\*(C`hv_store\*(C'\fR is not implemented as a call to +\&\f(CW\*(C`hv_store_ent\*(C'\fR, and does not create a temporary \s-1SV\s0 for the key, so if your +key data is not already in \s-1SV\s0 form then use \f(CW\*(C`hv_store\*(C'\fR in preference to +\&\f(CW\*(C`hv_store_ent\*(C'\fR. +.Sp +See \*(L"Understanding the Magic of Tied Hashes and Arrays\*(R" in perlguts for more +information on how to use this function on tied hashes. +.Sp +.Vb 2 +\& SV** hv_store(HV *hv, const char *key, I32 klen, +\& SV *val, U32 hash) +.Ve +.IP "hv_stores" 8 +.IX Xref "hv_stores" +.IX Item "hv_stores" +Like \f(CW\*(C`hv_store\*(C'\fR, but takes a literal string instead of a +string/length pair +and omits the hash parameter. +.Sp +.Vb 1 +\& SV** hv_stores(HV* tb, "key", SV* val) +.Ve +.IP "hv_store_ent" 8 +.IX Xref "hv_store_ent" +.IX Item "hv_store_ent" +Stores \f(CW\*(C`val\*(C'\fR in a hash. The hash key is specified as \f(CW\*(C`key\*(C'\fR. The \f(CW\*(C`hash\*(C'\fR +parameter is the precomputed hash value; if it is zero then Perl will +compute it. The return value is the new hash entry so created. It will be +\&\f(CW\*(C`NULL\*(C'\fR if the operation failed or if the value did not need to be actually +stored within the hash (as in the case of tied hashes). Otherwise the +contents of the return value can be accessed using the \f(CW\*(C`He?\*(C'\fR macros +described here. Note that the caller is responsible for suitably +incrementing the reference count of \f(CW\*(C`val\*(C'\fR before the call, and +decrementing it if the function returned \s-1NULL.\s0 Effectively a successful +\&\f(CW\*(C`hv_store_ent\*(C'\fR takes ownership of one reference to \f(CW\*(C`val\*(C'\fR. This is +usually what you want; a newly created \s-1SV\s0 has a reference count of one, so +if all your code does is create SVs then store them in a hash, \f(CW\*(C`hv_store\*(C'\fR +will own the only reference to the new \s-1SV,\s0 and your code doesn't need to do +anything further to tidy up. Note that \f(CW\*(C`hv_store_ent\*(C'\fR only reads the \f(CW\*(C`key\*(C'\fR; +unlike \f(CW\*(C`val\*(C'\fR it does not take ownership of it, so maintaining the correct +reference count on \f(CW\*(C`key\*(C'\fR is entirely the caller's responsibility. The reason +it does not take ownership, is that \f(CW\*(C`key\*(C'\fR is not used after this function +returns, and so can be freed immediately. \f(CW\*(C`hv_store\*(C'\fR +is not implemented as a call to \f(CW\*(C`hv_store_ent\*(C'\fR, and does not create a temporary +\&\s-1SV\s0 for the key, so if your key data is not already in \s-1SV\s0 form then use +\&\f(CW\*(C`hv_store\*(C'\fR in preference to \f(CW\*(C`hv_store_ent\*(C'\fR. +.Sp +See \*(L"Understanding the Magic of Tied Hashes and Arrays\*(R" in perlguts for more +information on how to use this function on tied hashes. +.Sp +.Vb 1 +\& HE* hv_store_ent(HV *hv, SV *key, SV *val, U32 hash) +.Ve +.IP "hv_undef" 8 +.IX Xref "hv_undef" +.IX Item "hv_undef" +Undefines the hash. The \s-1XS\s0 equivalent of \f(CW\*(C`undef(%hash)\*(C'\fR. +.Sp +As well as freeing all the elements of the hash (like \f(CW\*(C`hv_clear()\*(C'\fR), this +also frees any auxiliary data and storage associated with the hash. +.Sp +See \*(L"av_clear\*(R" for a note about the hash possibly being invalid on +return. +.Sp +.Vb 1 +\& void hv_undef(HV *hv) +.Ve +.IP "newHV" 8 +.IX Xref "newHV" +.IX Item "newHV" +Creates a new \s-1HV.\s0 The reference count is set to 1. +.Sp +.Vb 1 +\& HV* newHV() +.Ve +.SH "Hook manipulation" +.IX Header "Hook manipulation" +These functions provide convenient and thread-safe means of manipulating +hook variables. +.IP "wrap_op_checker" 8 +.IX Xref "wrap_op_checker" +.IX Item "wrap_op_checker" +Puts a C function into the chain of check functions for a specified op +type. This is the preferred way to manipulate the \*(L"PL_check\*(R" array. +\&\f(CW\*(C`opcode\*(C'\fR specifies which type of op is to be affected. \f(CW\*(C`new_checker\*(C'\fR +is a pointer to the C function that is to be added to that opcode's +check chain, and \f(CW\*(C`old_checker_p\*(C'\fR points to the storage location where a +pointer to the next function in the chain will be stored. The value of +\&\f(CW\*(C`new_checker\*(C'\fR is written into the \*(L"PL_check\*(R" array, while the value +previously stored there is written to \f(CW*old_checker_p\fR. +.Sp +\&\*(L"PL_check\*(R" is global to an entire process, and a module wishing to +hook op checking may find itself invoked more than once per process, +typically in different threads. To handle that situation, this function +is idempotent. The location \f(CW*old_checker_p\fR must initially (once +per process) contain a null pointer. A C variable of static duration +(declared at file scope, typically also marked \f(CW\*(C`static\*(C'\fR to give +it internal linkage) will be implicitly initialised appropriately, +if it does not have an explicit initialiser. This function will only +actually modify the check chain if it finds \f(CW*old_checker_p\fR to be null. +This function is also thread safe on the small scale. It uses appropriate +locking to avoid race conditions in accessing \*(L"PL_check\*(R". +.Sp +When this function is called, the function referenced by \f(CW\*(C`new_checker\*(C'\fR +must be ready to be called, except for \f(CW*old_checker_p\fR being unfilled. +In a threading situation, \f(CW\*(C`new_checker\*(C'\fR may be called immediately, +even before this function has returned. \f(CW*old_checker_p\fR will always +be appropriately set before \f(CW\*(C`new_checker\*(C'\fR is called. If \f(CW\*(C`new_checker\*(C'\fR +decides not to do anything special with an op that it is given (which +is the usual case for most uses of op check hooking), it must chain the +check function referenced by \f(CW*old_checker_p\fR. +.Sp +Taken all together, \s-1XS\s0 code to hook an op checker should typically look +something like this: +.Sp +.Vb 9 +\& static Perl_check_t nxck_frob; +\& static OP *myck_frob(pTHX_ OP *op) { +\& ... +\& op = nxck_frob(aTHX_ op); +\& ... +\& return op; +\& } +\& BOOT: +\& wrap_op_checker(OP_FROB, myck_frob, &nxck_frob); +.Ve +.Sp +If you want to influence compilation of calls to a specific subroutine, +then use \*(L"cv_set_call_checker_flags\*(R" rather than hooking checking of +all \f(CW\*(C`entersub\*(C'\fR ops. +.Sp +.Vb 3 +\& void wrap_op_checker(Optype opcode, +\& Perl_check_t new_checker, +\& Perl_check_t *old_checker_p) +.Ve +.SH "Lexer interface" +.IX Header "Lexer interface" +This is the lower layer of the Perl parser, managing characters and tokens. +.IP "lex_bufutf8" 8 +.IX Xref "lex_bufutf8" +.IX Item "lex_bufutf8" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Indicates whether the octets in the lexer buffer +(\*(L"PL_parser\->linestr\*(R") should be interpreted as the \s-1UTF\-8\s0 encoding +of Unicode characters. If not, they should be interpreted as Latin\-1 +characters. This is analogous to the \f(CW\*(C`SvUTF8\*(C'\fR flag for scalars. +.Sp +In \s-1UTF\-8\s0 mode, it is not guaranteed that the lexer buffer actually +contains valid \s-1UTF\-8.\s0 Lexing code must be robust in the face of invalid +encoding. +.Sp +The actual \f(CW\*(C`SvUTF8\*(C'\fR flag of the \*(L"PL_parser\->linestr\*(R" scalar +is significant, but not the whole story regarding the input character +encoding. Normally, when a file is being read, the scalar contains octets +and its \f(CW\*(C`SvUTF8\*(C'\fR flag is off, but the octets should be interpreted as +\&\s-1UTF\-8\s0 if the \f(CW\*(C`use utf8\*(C'\fR pragma is in effect. During a string eval, +however, the scalar may have the \f(CW\*(C`SvUTF8\*(C'\fR flag on, and in this case its +octets should be interpreted as \s-1UTF\-8\s0 unless the \f(CW\*(C`use bytes\*(C'\fR pragma +is in effect. This logic may change in the future; use this function +instead of implementing the logic yourself. +.Sp +.Vb 1 +\& bool lex_bufutf8() +.Ve +.IP "lex_discard_to" 8 +.IX Xref "lex_discard_to" +.IX Item "lex_discard_to" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Discards the first part of the \*(L"PL_parser\->linestr\*(R" buffer, +up to \f(CW\*(C`ptr\*(C'\fR. The remaining content of the buffer will be moved, and +all pointers into the buffer updated appropriately. \f(CW\*(C`ptr\*(C'\fR must not +be later in the buffer than the position of \*(L"PL_parser\->bufptr\*(R": +it is not permitted to discard text that has yet to be lexed. +.Sp +Normally it is not necessarily to do this directly, because it suffices to +use the implicit discarding behaviour of \*(L"lex_next_chunk\*(R" and things +based on it. However, if a token stretches across multiple lines, +and the lexing code has kept multiple lines of text in the buffer for +that purpose, then after completion of the token it would be wise to +explicitly discard the now-unneeded earlier lines, to avoid future +multi-line tokens growing the buffer without bound. +.Sp +.Vb 1 +\& void lex_discard_to(char* ptr) +.Ve +.IP "lex_grow_linestr" 8 +.IX Xref "lex_grow_linestr" +.IX Item "lex_grow_linestr" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Reallocates the lexer buffer (\*(L"PL_parser\->linestr\*(R") to accommodate +at least \f(CW\*(C`len\*(C'\fR octets (including terminating \f(CW\*(C`NUL\*(C'\fR). Returns a +pointer to the reallocated buffer. This is necessary before making +any direct modification of the buffer that would increase its length. +\&\*(L"lex_stuff_pvn\*(R" provides a more convenient way to insert text into +the buffer. +.Sp +Do not use \f(CW\*(C`SvGROW\*(C'\fR or \f(CW\*(C`sv_grow\*(C'\fR directly on \f(CW\*(C`PL_parser\->linestr\*(C'\fR; +this function updates all of the lexer's variables that point directly +into the buffer. +.Sp +.Vb 1 +\& char* lex_grow_linestr(STRLEN len) +.Ve +.IP "lex_next_chunk" 8 +.IX Xref "lex_next_chunk" +.IX Item "lex_next_chunk" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Reads in the next chunk of text to be lexed, appending it to +\&\*(L"PL_parser\->linestr\*(R". This should be called when lexing code has +looked to the end of the current chunk and wants to know more. It is +usual, but not necessary, for lexing to have consumed the entirety of +the current chunk at this time. +.Sp +If \*(L"PL_parser\->bufptr\*(R" is pointing to the very end of the current +chunk (i.e., the current chunk has been entirely consumed), normally the +current chunk will be discarded at the same time that the new chunk is +read in. If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`LEX_KEEP_PREVIOUS\*(C'\fR bit set, the current chunk +will not be discarded. If the current chunk has not been entirely +consumed, then it will not be discarded regardless of the flag. +.Sp +Returns true if some new text was added to the buffer, or false if the +buffer has reached the end of the input text. +.Sp +.Vb 1 +\& bool lex_next_chunk(U32 flags) +.Ve +.IP "lex_peek_unichar" 8 +.IX Xref "lex_peek_unichar" +.IX Item "lex_peek_unichar" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Looks ahead one (Unicode) character in the text currently being lexed. +Returns the codepoint (unsigned integer value) of the next character, +or \-1 if lexing has reached the end of the input text. To consume the +peeked character, use \*(L"lex_read_unichar\*(R". +.Sp +If the next character is in (or extends into) the next chunk of input +text, the next chunk will be read in. Normally the current chunk will be +discarded at the same time, but if \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`LEX_KEEP_PREVIOUS\*(C'\fR +bit set, then the current chunk will not be discarded. +.Sp +If the input is being interpreted as \s-1UTF\-8\s0 and a \s-1UTF\-8\s0 encoding error +is encountered, an exception is generated. +.Sp +.Vb 1 +\& I32 lex_peek_unichar(U32 flags) +.Ve +.IP "lex_read_space" 8 +.IX Xref "lex_read_space" +.IX Item "lex_read_space" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Reads optional spaces, in Perl style, in the text currently being +lexed. The spaces may include ordinary whitespace characters and +Perl-style comments. \f(CW\*(C`#line\*(C'\fR directives are processed if encountered. +\&\*(L"PL_parser\->bufptr\*(R" is moved past the spaces, so that it points +at a non-space character (or the end of the input text). +.Sp +If spaces extend into the next chunk of input text, the next chunk will +be read in. Normally the current chunk will be discarded at the same +time, but if \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`LEX_KEEP_PREVIOUS\*(C'\fR bit set, then the current +chunk will not be discarded. +.Sp +.Vb 1 +\& void lex_read_space(U32 flags) +.Ve +.IP "lex_read_to" 8 +.IX Xref "lex_read_to" +.IX Item "lex_read_to" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Consume text in the lexer buffer, from \*(L"PL_parser\->bufptr\*(R" up +to \f(CW\*(C`ptr\*(C'\fR. This advances \*(L"PL_parser\->bufptr\*(R" to match \f(CW\*(C`ptr\*(C'\fR, +performing the correct bookkeeping whenever a newline character is passed. +This is the normal way to consume lexed text. +.Sp +Interpretation of the buffer's octets can be abstracted out by +using the slightly higher-level functions \*(L"lex_peek_unichar\*(R" and +\&\*(L"lex_read_unichar\*(R". +.Sp +.Vb 1 +\& void lex_read_to(char* ptr) +.Ve +.IP "lex_read_unichar" 8 +.IX Xref "lex_read_unichar" +.IX Item "lex_read_unichar" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Reads the next (Unicode) character in the text currently being lexed. +Returns the codepoint (unsigned integer value) of the character read, +and moves \*(L"PL_parser\->bufptr\*(R" past the character, or returns \-1 +if lexing has reached the end of the input text. To non-destructively +examine the next character, use \*(L"lex_peek_unichar\*(R" instead. +.Sp +If the next character is in (or extends into) the next chunk of input +text, the next chunk will be read in. Normally the current chunk will be +discarded at the same time, but if \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`LEX_KEEP_PREVIOUS\*(C'\fR +bit set, then the current chunk will not be discarded. +.Sp +If the input is being interpreted as \s-1UTF\-8\s0 and a \s-1UTF\-8\s0 encoding error +is encountered, an exception is generated. +.Sp +.Vb 1 +\& I32 lex_read_unichar(U32 flags) +.Ve +.IP "lex_start" 8 +.IX Xref "lex_start" +.IX Item "lex_start" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Creates and initialises a new lexer/parser state object, supplying +a context in which to lex and parse from a new source of Perl code. +A pointer to the new state object is placed in \*(L"PL_parser\*(R". An entry +is made on the save stack so that upon unwinding, the new state object +will be destroyed and the former value of \*(L"PL_parser\*(R" will be restored. +Nothing else need be done to clean up the parsing context. +.Sp +The code to be parsed comes from \f(CW\*(C`line\*(C'\fR and \f(CW\*(C`rsfp\*(C'\fR. \f(CW\*(C`line\*(C'\fR, if +non-null, provides a string (in \s-1SV\s0 form) containing code to be parsed. +A copy of the string is made, so subsequent modification of \f(CW\*(C`line\*(C'\fR +does not affect parsing. \f(CW\*(C`rsfp\*(C'\fR, if non-null, provides an input stream +from which code will be read to be parsed. If both are non-null, the +code in \f(CW\*(C`line\*(C'\fR comes first and must consist of complete lines of input, +and \f(CW\*(C`rsfp\*(C'\fR supplies the remainder of the source. +.Sp +The \f(CW\*(C`flags\*(C'\fR parameter is reserved for future use. Currently it is only +used by perl internally, so extensions should always pass zero. +.Sp +.Vb 1 +\& void lex_start(SV* line, PerlIO *rsfp, U32 flags) +.Ve +.IP "lex_stuff_pv" 8 +.IX Xref "lex_stuff_pv" +.IX Item "lex_stuff_pv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Insert characters into the lexer buffer (\*(L"PL_parser\->linestr\*(R"), +immediately after the current lexing point (\*(L"PL_parser\->bufptr\*(R"), +reallocating the buffer if necessary. This means that lexing code that +runs later will see the characters as if they had appeared in the input. +It is not recommended to do this as part of normal parsing, and most +uses of this facility run the risk of the inserted characters being +interpreted in an unintended manner. +.Sp +The string to be inserted is represented by octets starting at \f(CW\*(C`pv\*(C'\fR +and continuing to the first nul. These octets are interpreted as either +\&\s-1UTF\-8\s0 or Latin\-1, according to whether the \f(CW\*(C`LEX_STUFF_UTF8\*(C'\fR flag is set +in \f(CW\*(C`flags\*(C'\fR. The characters are recoded for the lexer buffer, according +to how the buffer is currently being interpreted (\*(L"lex_bufutf8\*(R"). +If it is not convenient to nul-terminate a string to be inserted, the +\&\*(L"lex_stuff_pvn\*(R" function is more appropriate. +.Sp +.Vb 1 +\& void lex_stuff_pv(const char* pv, U32 flags) +.Ve +.IP "lex_stuff_pvn" 8 +.IX Xref "lex_stuff_pvn" +.IX Item "lex_stuff_pvn" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Insert characters into the lexer buffer (\*(L"PL_parser\->linestr\*(R"), +immediately after the current lexing point (\*(L"PL_parser\->bufptr\*(R"), +reallocating the buffer if necessary. This means that lexing code that +runs later will see the characters as if they had appeared in the input. +It is not recommended to do this as part of normal parsing, and most +uses of this facility run the risk of the inserted characters being +interpreted in an unintended manner. +.Sp +The string to be inserted is represented by \f(CW\*(C`len\*(C'\fR octets starting +at \f(CW\*(C`pv\*(C'\fR. These octets are interpreted as either \s-1UTF\-8\s0 or Latin\-1, +according to whether the \f(CW\*(C`LEX_STUFF_UTF8\*(C'\fR flag is set in \f(CW\*(C`flags\*(C'\fR. +The characters are recoded for the lexer buffer, according to how the +buffer is currently being interpreted (\*(L"lex_bufutf8\*(R"). If a string +to be inserted is available as a Perl scalar, the \*(L"lex_stuff_sv\*(R" +function is more convenient. +.Sp +.Vb 2 +\& void lex_stuff_pvn(const char* pv, STRLEN len, +\& U32 flags) +.Ve +.IP "lex_stuff_pvs" 8 +.IX Xref "lex_stuff_pvs" +.IX Item "lex_stuff_pvs" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Like \*(L"lex_stuff_pvn\*(R", but takes a literal string instead of +a string/length pair. +.Sp +.Vb 1 +\& void lex_stuff_pvs("pv", U32 flags) +.Ve +.IP "lex_stuff_sv" 8 +.IX Xref "lex_stuff_sv" +.IX Item "lex_stuff_sv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Insert characters into the lexer buffer (\*(L"PL_parser\->linestr\*(R"), +immediately after the current lexing point (\*(L"PL_parser\->bufptr\*(R"), +reallocating the buffer if necessary. This means that lexing code that +runs later will see the characters as if they had appeared in the input. +It is not recommended to do this as part of normal parsing, and most +uses of this facility run the risk of the inserted characters being +interpreted in an unintended manner. +.Sp +The string to be inserted is the string value of \f(CW\*(C`sv\*(C'\fR. The characters +are recoded for the lexer buffer, according to how the buffer is currently +being interpreted (\*(L"lex_bufutf8\*(R"). If a string to be inserted is +not already a Perl scalar, the \*(L"lex_stuff_pvn\*(R" function avoids the +need to construct a scalar. +.Sp +.Vb 1 +\& void lex_stuff_sv(SV* sv, U32 flags) +.Ve +.IP "lex_unstuff" 8 +.IX Xref "lex_unstuff" +.IX Item "lex_unstuff" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Discards text about to be lexed, from \*(L"PL_parser\->bufptr\*(R" up to +\&\f(CW\*(C`ptr\*(C'\fR. Text following \f(CW\*(C`ptr\*(C'\fR will be moved, and the buffer shortened. +This hides the discarded text from any lexing code that runs later, +as if the text had never appeared. +.Sp +This is not the normal way to consume lexed text. For that, use +\&\*(L"lex_read_to\*(R". +.Sp +.Vb 1 +\& void lex_unstuff(char* ptr) +.Ve +.IP "parse_arithexpr" 8 +.IX Xref "parse_arithexpr" +.IX Item "parse_arithexpr" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a Perl arithmetic expression. This may contain operators of precedence +down to the bit shift operators. The expression must be followed (and thus +terminated) either by a comparison or lower-precedence operator or by +something that would normally terminate an expression such as semicolon. +If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`PARSE_OPTIONAL\*(C'\fR bit set, then the expression is optional, +otherwise it is mandatory. It is up to the caller to ensure that the +dynamic parser state (\*(L"PL_parser\*(R" et al) is correctly set to reflect +the source of the code to be parsed and the lexical context for the +expression. +.Sp +The op tree representing the expression is returned. If an optional +expression is absent, a null pointer is returned, otherwise the pointer +will be non-null. +.Sp +If an error occurs in parsing or compilation, in most cases a valid op +tree is returned anyway. The error is reflected in the parser state, +normally resulting in a single exception at the top level of parsing +which covers all the compilation errors that occurred. Some compilation +errors, however, will throw an exception immediately. +.Sp +.Vb 1 +\& OP* parse_arithexpr(U32 flags) +.Ve +.IP "parse_barestmt" 8 +.IX Xref "parse_barestmt" +.IX Item "parse_barestmt" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a single unadorned Perl statement. This may be a normal imperative +statement or a declaration that has compile-time effect. It does not +include any label or other affixture. It is up to the caller to ensure +that the dynamic parser state (\*(L"PL_parser\*(R" et al) is correctly set to +reflect the source of the code to be parsed and the lexical context for +the statement. +.Sp +The op tree representing the statement is returned. This may be a +null pointer if the statement is null, for example if it was actually +a subroutine definition (which has compile-time side effects). If not +null, it will be ops directly implementing the statement, suitable to +pass to \*(L"newSTATEOP\*(R". It will not normally include a \f(CW\*(C`nextstate\*(C'\fR or +equivalent op (except for those embedded in a scope contained entirely +within the statement). +.Sp +If an error occurs in parsing or compilation, in most cases a valid op +tree (most likely null) is returned anyway. The error is reflected in +the parser state, normally resulting in a single exception at the top +level of parsing which covers all the compilation errors that occurred. +Some compilation errors, however, will throw an exception immediately. +.Sp +The \f(CW\*(C`flags\*(C'\fR parameter is reserved for future use, and must always +be zero. +.Sp +.Vb 1 +\& OP* parse_barestmt(U32 flags) +.Ve +.IP "parse_block" 8 +.IX Xref "parse_block" +.IX Item "parse_block" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a single complete Perl code block. This consists of an opening +brace, a sequence of statements, and a closing brace. The block +constitutes a lexical scope, so \f(CW\*(C`my\*(C'\fR variables and various compile-time +effects can be contained within it. It is up to the caller to ensure +that the dynamic parser state (\*(L"PL_parser\*(R" et al) is correctly set to +reflect the source of the code to be parsed and the lexical context for +the statement. +.Sp +The op tree representing the code block is returned. This is always a +real op, never a null pointer. It will normally be a \f(CW\*(C`lineseq\*(C'\fR list, +including \f(CW\*(C`nextstate\*(C'\fR or equivalent ops. No ops to construct any kind +of runtime scope are included by virtue of it being a block. +.Sp +If an error occurs in parsing or compilation, in most cases a valid op +tree (most likely null) is returned anyway. The error is reflected in +the parser state, normally resulting in a single exception at the top +level of parsing which covers all the compilation errors that occurred. +Some compilation errors, however, will throw an exception immediately. +.Sp +The \f(CW\*(C`flags\*(C'\fR parameter is reserved for future use, and must always +be zero. +.Sp +.Vb 1 +\& OP* parse_block(U32 flags) +.Ve +.IP "parse_fullexpr" 8 +.IX Xref "parse_fullexpr" +.IX Item "parse_fullexpr" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a single complete Perl expression. This allows the full +expression grammar, including the lowest-precedence operators such +as \f(CW\*(C`or\*(C'\fR. The expression must be followed (and thus terminated) by a +token that an expression would normally be terminated by: end-of-file, +closing bracketing punctuation, semicolon, or one of the keywords that +signals a postfix expression-statement modifier. If \f(CW\*(C`flags\*(C'\fR has the +\&\f(CW\*(C`PARSE_OPTIONAL\*(C'\fR bit set, then the expression is optional, otherwise it is +mandatory. It is up to the caller to ensure that the dynamic parser +state (\*(L"PL_parser\*(R" et al) is correctly set to reflect the source of +the code to be parsed and the lexical context for the expression. +.Sp +The op tree representing the expression is returned. If an optional +expression is absent, a null pointer is returned, otherwise the pointer +will be non-null. +.Sp +If an error occurs in parsing or compilation, in most cases a valid op +tree is returned anyway. The error is reflected in the parser state, +normally resulting in a single exception at the top level of parsing +which covers all the compilation errors that occurred. Some compilation +errors, however, will throw an exception immediately. +.Sp +.Vb 1 +\& OP* parse_fullexpr(U32 flags) +.Ve +.IP "parse_fullstmt" 8 +.IX Xref "parse_fullstmt" +.IX Item "parse_fullstmt" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a single complete Perl statement. This may be a normal imperative +statement or a declaration that has compile-time effect, and may include +optional labels. It is up to the caller to ensure that the dynamic +parser state (\*(L"PL_parser\*(R" et al) is correctly set to reflect the source +of the code to be parsed and the lexical context for the statement. +.Sp +The op tree representing the statement is returned. This may be a +null pointer if the statement is null, for example if it was actually +a subroutine definition (which has compile-time side effects). If not +null, it will be the result of a \*(L"newSTATEOP\*(R" call, normally including +a \f(CW\*(C`nextstate\*(C'\fR or equivalent op. +.Sp +If an error occurs in parsing or compilation, in most cases a valid op +tree (most likely null) is returned anyway. The error is reflected in +the parser state, normally resulting in a single exception at the top +level of parsing which covers all the compilation errors that occurred. +Some compilation errors, however, will throw an exception immediately. +.Sp +The \f(CW\*(C`flags\*(C'\fR parameter is reserved for future use, and must always +be zero. +.Sp +.Vb 1 +\& OP* parse_fullstmt(U32 flags) +.Ve +.IP "parse_label" 8 +.IX Xref "parse_label" +.IX Item "parse_label" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a single label, possibly optional, of the type that may prefix a +Perl statement. It is up to the caller to ensure that the dynamic parser +state (\*(L"PL_parser\*(R" et al) is correctly set to reflect the source of +the code to be parsed. If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`PARSE_OPTIONAL\*(C'\fR bit set, then the +label is optional, otherwise it is mandatory. +.Sp +The name of the label is returned in the form of a fresh scalar. If an +optional label is absent, a null pointer is returned. +.Sp +If an error occurs in parsing, which can only occur if the label is +mandatory, a valid label is returned anyway. The error is reflected in +the parser state, normally resulting in a single exception at the top +level of parsing which covers all the compilation errors that occurred. +.Sp +.Vb 1 +\& SV* parse_label(U32 flags) +.Ve +.IP "parse_listexpr" 8 +.IX Xref "parse_listexpr" +.IX Item "parse_listexpr" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a Perl list expression. This may contain operators of precedence +down to the comma operator. The expression must be followed (and thus +terminated) either by a low-precedence logic operator such as \f(CW\*(C`or\*(C'\fR or by +something that would normally terminate an expression such as semicolon. +If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`PARSE_OPTIONAL\*(C'\fR bit set, then the expression is optional, +otherwise it is mandatory. It is up to the caller to ensure that the +dynamic parser state (\*(L"PL_parser\*(R" et al) is correctly set to reflect +the source of the code to be parsed and the lexical context for the +expression. +.Sp +The op tree representing the expression is returned. If an optional +expression is absent, a null pointer is returned, otherwise the pointer +will be non-null. +.Sp +If an error occurs in parsing or compilation, in most cases a valid op +tree is returned anyway. The error is reflected in the parser state, +normally resulting in a single exception at the top level of parsing +which covers all the compilation errors that occurred. Some compilation +errors, however, will throw an exception immediately. +.Sp +.Vb 1 +\& OP* parse_listexpr(U32 flags) +.Ve +.IP "parse_stmtseq" 8 +.IX Xref "parse_stmtseq" +.IX Item "parse_stmtseq" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a sequence of zero or more Perl statements. These may be normal +imperative statements, including optional labels, or declarations +that have compile-time effect, or any mixture thereof. The statement +sequence ends when a closing brace or end-of-file is encountered in a +place where a new statement could have validly started. It is up to +the caller to ensure that the dynamic parser state (\*(L"PL_parser\*(R" et al) +is correctly set to reflect the source of the code to be parsed and the +lexical context for the statements. +.Sp +The op tree representing the statement sequence is returned. This may +be a null pointer if the statements were all null, for example if there +were no statements or if there were only subroutine definitions (which +have compile-time side effects). If not null, it will be a \f(CW\*(C`lineseq\*(C'\fR +list, normally including \f(CW\*(C`nextstate\*(C'\fR or equivalent ops. +.Sp +If an error occurs in parsing or compilation, in most cases a valid op +tree is returned anyway. The error is reflected in the parser state, +normally resulting in a single exception at the top level of parsing +which covers all the compilation errors that occurred. Some compilation +errors, however, will throw an exception immediately. +.Sp +The \f(CW\*(C`flags\*(C'\fR parameter is reserved for future use, and must always +be zero. +.Sp +.Vb 1 +\& OP* parse_stmtseq(U32 flags) +.Ve +.IP "parse_subsignature" 8 +.IX Xref "parse_subsignature" +.IX Item "parse_subsignature" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a subroutine signature declaration. This is the contents of the +parentheses following a named or anonymous subroutine declaration when the +\&\f(CW\*(C`signatures\*(C'\fR feature is enabled. Note that this function neither expects +nor consumes the opening and closing parentheses around the signature; it +is the caller's job to handle these. +.Sp +This function must only be called during parsing of a subroutine; after +\&\*(L"start_subparse\*(R" has been called. It might allocate lexical variables on +the pad for the current subroutine. +.Sp +The op tree to unpack the arguments from the stack at runtime is returned. +This op tree should appear at the beginning of the compiled function. The +caller may wish to use \*(L"op_append_list\*(R" to build their function body +after it, or splice it together with the body before calling \*(L"newATTRSUB\*(R". +.Sp +The \f(CW\*(C`flags\*(C'\fR parameter is reserved for future use, and must always +be zero. +.Sp +.Vb 1 +\& OP* parse_subsignature(U32 flags) +.Ve +.IP "parse_termexpr" 8 +.IX Xref "parse_termexpr" +.IX Item "parse_termexpr" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Parse a Perl term expression. This may contain operators of precedence +down to the assignment operators. The expression must be followed (and thus +terminated) either by a comma or lower-precedence operator or by +something that would normally terminate an expression such as semicolon. +If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`PARSE_OPTIONAL\*(C'\fR bit set, then the expression is optional, +otherwise it is mandatory. It is up to the caller to ensure that the +dynamic parser state (\*(L"PL_parser\*(R" et al) is correctly set to reflect +the source of the code to be parsed and the lexical context for the +expression. +.Sp +The op tree representing the expression is returned. If an optional +expression is absent, a null pointer is returned, otherwise the pointer +will be non-null. +.Sp +If an error occurs in parsing or compilation, in most cases a valid op +tree is returned anyway. The error is reflected in the parser state, +normally resulting in a single exception at the top level of parsing +which covers all the compilation errors that occurred. Some compilation +errors, however, will throw an exception immediately. +.Sp +.Vb 1 +\& OP* parse_termexpr(U32 flags) +.Ve +.IP "PL_parser" 8 +.IX Xref "PL_parser" +.IX Item "PL_parser" +Pointer to a structure encapsulating the state of the parsing operation +currently in progress. The pointer can be locally changed to perform +a nested parse without interfering with the state of an outer parse. +Individual members of \f(CW\*(C`PL_parser\*(C'\fR have their own documentation. +.IP "PL_parser\->bufend" 8 +.IX Xref "PL_parser->bufend" +.IX Item "PL_parser->bufend" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Direct pointer to the end of the chunk of text currently being lexed, the +end of the lexer buffer. This is equal to \f(CW\*(C`SvPVX(PL_parser\->linestr) ++ SvCUR(PL_parser\->linestr)\*(C'\fR. A \f(CW\*(C`NUL\*(C'\fR character (zero octet) is +always located at the end of the buffer, and does not count as part of +the buffer's contents. +.IP "PL_parser\->bufptr" 8 +.IX Xref "PL_parser->bufptr" +.IX Item "PL_parser->bufptr" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Points to the current position of lexing inside the lexer buffer. +Characters around this point may be freely examined, within +the range delimited by \f(CW\*(C`SvPVX("PL_parser\->linestr")\*(C'\fR and +\&\*(L"PL_parser\->bufend\*(R". The octets of the buffer may be intended to be +interpreted as either \s-1UTF\-8\s0 or Latin\-1, as indicated by \*(L"lex_bufutf8\*(R". +.Sp +Lexing code (whether in the Perl core or not) moves this pointer past +the characters that it consumes. It is also expected to perform some +bookkeeping whenever a newline character is consumed. This movement +can be more conveniently performed by the function \*(L"lex_read_to\*(R", +which handles newlines appropriately. +.Sp +Interpretation of the buffer's octets can be abstracted out by +using the slightly higher-level functions \*(L"lex_peek_unichar\*(R" and +\&\*(L"lex_read_unichar\*(R". +.IP "PL_parser\->linestart" 8 +.IX Xref "PL_parser->linestart" +.IX Item "PL_parser->linestart" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Points to the start of the current line inside the lexer buffer. +This is useful for indicating at which column an error occurred, and +not much else. This must be updated by any lexing code that consumes +a newline; the function \*(L"lex_read_to\*(R" handles this detail. +.IP "PL_parser\->linestr" 8 +.IX Xref "PL_parser->linestr" +.IX Item "PL_parser->linestr" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Buffer scalar containing the chunk currently under consideration of the +text currently being lexed. This is always a plain string scalar (for +which \f(CW\*(C`SvPOK\*(C'\fR is true). It is not intended to be used as a scalar by +normal scalar means; instead refer to the buffer directly by the pointer +variables described below. +.Sp +The lexer maintains various \f(CW\*(C`char*\*(C'\fR pointers to things in the +\&\f(CW\*(C`PL_parser\->linestr\*(C'\fR buffer. If \f(CW\*(C`PL_parser\->linestr\*(C'\fR is ever +reallocated, all of these pointers must be updated. Don't attempt to +do this manually, but rather use \*(L"lex_grow_linestr\*(R" if you need to +reallocate the buffer. +.Sp +The content of the text chunk in the buffer is commonly exactly one +complete line of input, up to and including a newline terminator, +but there are situations where it is otherwise. The octets of the +buffer may be intended to be interpreted as either \s-1UTF\-8\s0 or Latin\-1. +The function \*(L"lex_bufutf8\*(R" tells you which. Do not use the \f(CW\*(C`SvUTF8\*(C'\fR +flag on this scalar, which may disagree with it. +.Sp +For direct examination of the buffer, the variable +\&\*(L"PL_parser\->bufend\*(R" points to the end of the buffer. The current +lexing position is pointed to by \*(L"PL_parser\->bufptr\*(R". Direct use +of these pointers is usually preferable to examination of the scalar +through normal scalar means. +.IP "wrap_keyword_plugin" 8 +.IX Xref "wrap_keyword_plugin" +.IX Item "wrap_keyword_plugin" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Puts a C function into the chain of keyword plugins. This is the +preferred way to manipulate the \*(L"PL_keyword_plugin\*(R" variable. +\&\f(CW\*(C`new_plugin\*(C'\fR is a pointer to the C function that is to be added to the +keyword plugin chain, and \f(CW\*(C`old_plugin_p\*(C'\fR points to the storage location +where a pointer to the next function in the chain will be stored. The +value of \f(CW\*(C`new_plugin\*(C'\fR is written into the \*(L"PL_keyword_plugin\*(R" variable, +while the value previously stored there is written to \f(CW*old_plugin_p\fR. +.Sp +\&\*(L"PL_keyword_plugin\*(R" is global to an entire process, and a module wishing +to hook keyword parsing may find itself invoked more than once per +process, typically in different threads. To handle that situation, this +function is idempotent. The location \f(CW*old_plugin_p\fR must initially +(once per process) contain a null pointer. A C variable of static +duration (declared at file scope, typically also marked \f(CW\*(C`static\*(C'\fR to give +it internal linkage) will be implicitly initialised appropriately, if it +does not have an explicit initialiser. This function will only actually +modify the plugin chain if it finds \f(CW*old_plugin_p\fR to be null. This +function is also thread safe on the small scale. It uses appropriate +locking to avoid race conditions in accessing \*(L"PL_keyword_plugin\*(R". +.Sp +When this function is called, the function referenced by \f(CW\*(C`new_plugin\*(C'\fR +must be ready to be called, except for \f(CW*old_plugin_p\fR being unfilled. +In a threading situation, \f(CW\*(C`new_plugin\*(C'\fR may be called immediately, even +before this function has returned. \f(CW*old_plugin_p\fR will always be +appropriately set before \f(CW\*(C`new_plugin\*(C'\fR is called. If \f(CW\*(C`new_plugin\*(C'\fR +decides not to do anything special with the identifier that it is given +(which is the usual case for most calls to a keyword plugin), it must +chain the plugin function referenced by \f(CW*old_plugin_p\fR. +.Sp +Taken all together, \s-1XS\s0 code to install a keyword plugin should typically +look something like this: +.Sp +.Vb 10 +\& static Perl_keyword_plugin_t next_keyword_plugin; +\& static OP *my_keyword_plugin(pTHX_ +\& char *keyword_ptr, STRLEN keyword_len, OP **op_ptr) +\& { +\& if (memEQs(keyword_ptr, keyword_len, +\& "my_new_keyword")) { +\& ... +\& } else { +\& return next_keyword_plugin(aTHX_ +\& keyword_ptr, keyword_len, op_ptr); +\& } +\& } +\& BOOT: +\& wrap_keyword_plugin(my_keyword_plugin, +\& &next_keyword_plugin); +.Ve +.Sp +Direct access to \*(L"PL_keyword_plugin\*(R" should be avoided. +.Sp +.Vb 4 +\& void wrap_keyword_plugin( +\& Perl_keyword_plugin_t new_plugin, +\& Perl_keyword_plugin_t *old_plugin_p +\& ) +.Ve +.SH "Locale-related functions and macros" +.IX Header "Locale-related functions and macros" +.IP "\s-1DECLARATION_FOR_LC_NUMERIC_MANIPULATION\s0" 8 +.IX Xref "DECLARATION_FOR_LC_NUMERIC_MANIPULATION" +.IX Item "DECLARATION_FOR_LC_NUMERIC_MANIPULATION" +This macro should be used as a statement. It declares a private variable +(whose name begins with an underscore) that is needed by the other macros in +this section. Failing to include this correctly should lead to a syntax error. +For compatibility with C89 C compilers it should be placed in a block before +any executable statements. +.Sp +.Vb 1 +\& void DECLARATION_FOR_LC_NUMERIC_MANIPULATION +.Ve +.IP "\s-1IN_LOCALE\s0" 8 +.IX Xref "IN_LOCALE" +.IX Item "IN_LOCALE" +Evaluates to \s-1TRUE\s0 if the plain locale pragma without a parameter (\f(CW\*(C`use\ locale\*(C'\fR) is in effect. +.Sp +.Vb 1 +\& bool IN_LOCALE +.Ve +.IP "\s-1IN_LOCALE_COMPILETIME\s0" 8 +.IX Xref "IN_LOCALE_COMPILETIME" +.IX Item "IN_LOCALE_COMPILETIME" +Evaluates to \s-1TRUE\s0 if, when compiling a perl program (including an \f(CW\*(C`eval\*(C'\fR) if +the plain locale pragma without a parameter (\f(CW\*(C`use\ locale\*(C'\fR) is in effect. +.Sp +.Vb 1 +\& bool IN_LOCALE_COMPILETIME +.Ve +.IP "\s-1IN_LOCALE_RUNTIME\s0" 8 +.IX Xref "IN_LOCALE_RUNTIME" +.IX Item "IN_LOCALE_RUNTIME" +Evaluates to \s-1TRUE\s0 if, when executing a perl program (including an \f(CW\*(C`eval\*(C'\fR) if +the plain locale pragma without a parameter (\f(CW\*(C`use\ locale\*(C'\fR) is in effect. +.Sp +.Vb 1 +\& bool IN_LOCALE_RUNTIME +.Ve +.IP "Perl_langinfo" 8 +.IX Xref "Perl_langinfo" +.IX Item "Perl_langinfo" +This is an (almost) drop-in replacement for the system \f(CWnl_langinfo(3)\fR, +taking the same \f(CW\*(C`item\*(C'\fR parameter values, and returning the same information. +But it is more thread-safe than regular \f(CW\*(C`nl_langinfo()\*(C'\fR, and hides the quirks +of Perl's locale handling from your code, and can be used on systems that lack +a native \f(CW\*(C`nl_langinfo\*(C'\fR. +.Sp +Expanding on these: +.RS 8 +.IP "\(bu" 4 +The reason it isn't quite a drop-in replacement is actually an advantage. The +only difference is that it returns \f(CW\*(C`const\ char\ *\*(C'\fR, whereas plain +\&\f(CW\*(C`nl_langinfo()\*(C'\fR returns \f(CW\*(C`char\ *\*(C'\fR, but you are (only by documentation) +forbidden to write into the buffer. By declaring this \f(CW\*(C`const\*(C'\fR, the compiler +enforces this restriction, so if it is violated, you know at compilation time, +rather than getting segfaults at runtime. +.IP "\(bu" 4 +It delivers the correct results for the \f(CW\*(C`RADIXCHAR\*(C'\fR and \f(CW\*(C`THOUSEP\*(C'\fR items, +without you having to write extra code. The reason for the extra code would be +because these are from the \f(CW\*(C`LC_NUMERIC\*(C'\fR locale category, which is normally +kept set by Perl so that the radix is a dot, and the separator is the empty +string, no matter what the underlying locale is supposed to be, and so to get +the expected results, you have to temporarily toggle into the underlying +locale, and later toggle back. (You could use plain \f(CW\*(C`nl_langinfo\*(C'\fR and +\&\f(CW"STORE_LC_NUMERIC_FORCE_TO_UNDERLYING"\fR for this but then you wouldn't get +the other advantages of \f(CW\*(C`Perl_langinfo()\*(C'\fR; not keeping \f(CW\*(C`LC_NUMERIC\*(C'\fR in the C +(or equivalent) locale would break a lot of \s-1CPAN,\s0 which is expecting the radix +(decimal point) character to be a dot.) +.IP "\(bu" 4 +The system function it replaces can have its static return buffer trashed, +not only by a subesequent call to that function, but by a \f(CW\*(C`freelocale\*(C'\fR, +\&\f(CW\*(C`setlocale\*(C'\fR, or other locale change. The returned buffer of this function is +not changed until the next call to it, so the buffer is never in a trashed +state. +.IP "\(bu" 4 +Its return buffer is per-thread, so it also is never overwritten by a call to +this function from another thread; unlike the function it replaces. +.IP "\(bu" 4 +But most importantly, it works on systems that don't have \f(CW\*(C`nl_langinfo\*(C'\fR, such +as Windows, hence makes your code more portable. Of the fifty-some possible +items specified by the \s-1POSIX 2008\s0 standard, +, +only one is completely unimplemented, though on non-Windows platforms, another +significant one is also not implemented). It uses various techniques to +recover the other items, including calling \f(CWlocaleconv(3)\fR, and +\&\f(CWstrftime(3)\fR, both of which are specified in C89, so should be always be +available. Later \f(CW\*(C`strftime()\*(C'\fR versions have additional capabilities; \f(CW""\fR is +returned for those not available on your system. +.Sp +It is important to note that when called with an item that is recovered by +using \f(CW\*(C`localeconv\*(C'\fR, the buffer from any previous explicit call to +\&\f(CW\*(C`localeconv\*(C'\fR will be overwritten. This means you must save that buffer's +contents if you need to access them after a call to this function. (But note +that you might not want to be using \f(CW\*(C`localeconv()\*(C'\fR directly anyway, because of +issues like the ones listed in the second item of this list (above) for +\&\f(CW\*(C`RADIXCHAR\*(C'\fR and \f(CW\*(C`THOUSEP\*(C'\fR. You can use the methods given in perlcall to +call \*(L"localeconv\*(R" in \s-1POSIX\s0 and avoid all the issues, but then you have a hash to +unpack). +.Sp +The details for those items which may deviate from what this emulation returns +and what a native \f(CW\*(C`nl_langinfo()\*(C'\fR would return are specified in +I18N::Langinfo. +.RE +.RS 8 +.Sp +When using \f(CW\*(C`Perl_langinfo\*(C'\fR on systems that don't have a native +\&\f(CW\*(C`nl_langinfo()\*(C'\fR, you must +.Sp +.Vb 1 +\& #include "perl_langinfo.h" +.Ve +.Sp +before the \f(CW\*(C`perl.h\*(C'\fR \f(CW\*(C`#include\*(C'\fR. You can replace your \f(CW\*(C`langinfo.h\*(C'\fR +\&\f(CW\*(C`#include\*(C'\fR with this one. (Doing it this way keeps out the symbols that plain +\&\f(CW\*(C`langinfo.h\*(C'\fR would try to import into the namespace for code that doesn't need +it.) +.Sp +The original impetus for \f(CW\*(C`Perl_langinfo()\*(C'\fR was so that code that needs to +find out the current currency symbol, floating point radix character, or digit +grouping separator can use, on all systems, the simpler and more +thread-friendly \f(CW\*(C`nl_langinfo\*(C'\fR \s-1API\s0 instead of \f(CWlocaleconv(3)\fR which is a +pain to make thread-friendly. For other fields returned by \f(CW\*(C`localeconv\*(C'\fR, it +is better to use the methods given in perlcall to call +\&\f(CW\*(C`POSIX::localeconv()\*(C'\fR, which is thread-friendly. +.Sp +.Vb 1 +\& const char* Perl_langinfo(const nl_item item) +.Ve +.RE +.IP "Perl_setlocale" 8 +.IX Xref "Perl_setlocale" +.IX Item "Perl_setlocale" +This is an (almost) drop-in replacement for the system \f(CWsetlocale(3)\fR, +taking the same parameters, and returning the same information, except that it +returns the correct underlying \f(CW\*(C`LC_NUMERIC\*(C'\fR locale. Regular \f(CW\*(C`setlocale\*(C'\fR will +instead return \f(CW\*(C`C\*(C'\fR if the underlying locale has a non-dot decimal point +character, or a non-empty thousands separator for displaying floating point +numbers. This is because perl keeps that locale category such that it has a +dot and empty separator, changing the locale briefly during the operations +where the underlying one is required. \f(CW\*(C`Perl_setlocale\*(C'\fR knows about this, and +compensates; regular \f(CW\*(C`setlocale\*(C'\fR doesn't. +.Sp +Another reason it isn't completely a drop-in replacement is that it is +declared to return \f(CW\*(C`const\ char\ *\*(C'\fR, whereas the system setlocale omits the +\&\f(CW\*(C`const\*(C'\fR (presumably because its \s-1API\s0 was specified long ago, and can't be +updated; it is illegal to change the information \f(CW\*(C`setlocale\*(C'\fR returns; doing +so leads to segfaults.) +.Sp +Finally, \f(CW\*(C`Perl_setlocale\*(C'\fR works under all circumstances, whereas plain +\&\f(CW\*(C`setlocale\*(C'\fR can be completely ineffective on some platforms under some +configurations. +.Sp +\&\f(CW\*(C`Perl_setlocale\*(C'\fR should not be used to change the locale except on systems +where the predefined variable \f(CW\*(C`${^SAFE_LOCALES}\*(C'\fR is 1. On some such systems, +the system \f(CW\*(C`setlocale()\*(C'\fR is ineffective, returning the wrong information, and +failing to actually change the locale. \f(CW\*(C`Perl_setlocale\*(C'\fR, however works +properly in all circumstances. +.Sp +The return points to a per-thread static buffer, which is overwritten the next +time \f(CW\*(C`Perl_setlocale\*(C'\fR is called from the same thread. +.Sp +.Vb 2 +\& const char* Perl_setlocale(const int category, +\& const char* locale) +.Ve +.IP "\s-1RESTORE_LC_NUMERIC\s0" 8 +.IX Xref "RESTORE_LC_NUMERIC" +.IX Item "RESTORE_LC_NUMERIC" +This is used in conjunction with one of the macros +\&\*(L"\s-1STORE_LC_NUMERIC_SET_TO_NEEDED\*(R"\s0 +and \*(L"\s-1STORE_LC_NUMERIC_FORCE_TO_UNDERLYING\*(R"\s0 to properly restore the +\&\f(CW\*(C`LC_NUMERIC\*(C'\fR state. +.Sp +A call to \*(L"\s-1DECLARATION_FOR_LC_NUMERIC_MANIPULATION\*(R"\s0 must have been made to +declare at compile time a private variable used by this macro and the two +\&\f(CW\*(C`STORE\*(C'\fR ones. This macro should be called as a single statement, not an +expression, but with an empty argument list, like this: +.Sp +.Vb 6 +\& { +\& DECLARATION_FOR_LC_NUMERIC_MANIPULATION; +\& ... +\& RESTORE_LC_NUMERIC(); +\& ... +\& } +\& +\& void RESTORE_LC_NUMERIC() +.Ve +.IP "\s-1STORE_LC_NUMERIC_FORCE_TO_UNDERLYING\s0" 8 +.IX Xref "STORE_LC_NUMERIC_FORCE_TO_UNDERLYING" +.IX Item "STORE_LC_NUMERIC_FORCE_TO_UNDERLYING" +This is used by \s-1XS\s0 code that is \f(CW\*(C`LC_NUMERIC\*(C'\fR locale-aware to force the +locale for category \f(CW\*(C`LC_NUMERIC\*(C'\fR to be what perl thinks is the current +underlying locale. (The perl interpreter could be wrong about what the +underlying locale actually is if some C or \s-1XS\s0 code has called the C library +function \fBsetlocale\fR\|(3) behind its back; calling \*(L"sync_locale\*(R" before calling +this macro will update perl's records.) +.Sp +A call to \*(L"\s-1DECLARATION_FOR_LC_NUMERIC_MANIPULATION\*(R"\s0 must have been made to +declare at compile time a private variable used by this macro. This macro +should be called as a single statement, not an expression, but with an empty +argument list, like this: +.Sp +.Vb 8 +\& { +\& DECLARATION_FOR_LC_NUMERIC_MANIPULATION; +\& ... +\& STORE_LC_NUMERIC_FORCE_TO_UNDERLYING(); +\& ... +\& RESTORE_LC_NUMERIC(); +\& ... +\& } +.Ve +.Sp +The private variable is used to save the current locale state, so +that the requisite matching call to \*(L"\s-1RESTORE_LC_NUMERIC\*(R"\s0 can restore it. +.Sp +On threaded perls not operating with thread-safe functionality, this macro uses +a mutex to force a critical section. Therefore the matching \s-1RESTORE\s0 should be +close by, and guaranteed to be called. +.Sp +.Vb 1 +\& void STORE_LC_NUMERIC_FORCE_TO_UNDERLYING() +.Ve +.IP "\s-1STORE_LC_NUMERIC_SET_TO_NEEDED\s0" 8 +.IX Xref "STORE_LC_NUMERIC_SET_TO_NEEDED" +.IX Item "STORE_LC_NUMERIC_SET_TO_NEEDED" +This is used to help wrap \s-1XS\s0 or C code that is \f(CW\*(C`LC_NUMERIC\*(C'\fR locale-aware. +This locale category is generally kept set to a locale where the decimal radix +character is a dot, and the separator between groups of digits is empty. This +is because most \s-1XS\s0 code that reads floating point numbers is expecting them to +have this syntax. +.Sp +This macro makes sure the current \f(CW\*(C`LC_NUMERIC\*(C'\fR state is set properly, to be +aware of locale if the call to the \s-1XS\s0 or C code from the Perl program is +from within the scope of a \f(CW\*(C`use\ locale\*(C'\fR; or to ignore locale if the call is +instead from outside such scope. +.Sp +This macro is the start of wrapping the C or \s-1XS\s0 code; the wrap ending is done +by calling the \*(L"\s-1RESTORE_LC_NUMERIC\*(R"\s0 macro after the operation. Otherwise +the state can be changed that will adversely affect other \s-1XS\s0 code. +.Sp +A call to \*(L"\s-1DECLARATION_FOR_LC_NUMERIC_MANIPULATION\*(R"\s0 must have been made to +declare at compile time a private variable used by this macro. This macro +should be called as a single statement, not an expression, but with an empty +argument list, like this: +.Sp +.Vb 8 +\& { +\& DECLARATION_FOR_LC_NUMERIC_MANIPULATION; +\& ... +\& STORE_LC_NUMERIC_SET_TO_NEEDED(); +\& ... +\& RESTORE_LC_NUMERIC(); +\& ... +\& } +.Ve +.Sp +On threaded perls not operating with thread-safe functionality, this macro uses +a mutex to force a critical section. Therefore the matching \s-1RESTORE\s0 should be +close by, and guaranteed to be called; see \*(L"\s-1WITH_LC_NUMERIC_SET_TO_NEEDED\*(R"\s0 +for a more contained way to ensure that. +.Sp +.Vb 1 +\& void STORE_LC_NUMERIC_SET_TO_NEEDED() +.Ve +.IP "\s-1STORE_LC_NUMERIC_SET_TO_NEEDED_IN\s0" 8 +.IX Xref "STORE_LC_NUMERIC_SET_TO_NEEDED_IN" +.IX Item "STORE_LC_NUMERIC_SET_TO_NEEDED_IN" +Same as \*(L"\s-1STORE_LC_NUMERIC_SET_TO_NEEDED\*(R"\s0 with in_lc_numeric provided +as the precalculated value of \f(CW\*(C`IN_LC(LC_NUMERIC)\*(C'\fR. It is the caller's +responsibility to ensure that the status of \f(CW\*(C`PL_compiling\*(C'\fR and \f(CW\*(C`PL_hints\*(C'\fR +cannot have changed since the precalculation. +.Sp +.Vb 3 +\& void STORE_LC_NUMERIC_SET_TO_NEEDED_IN( +\& bool in_lc_numeric +\& ) +.Ve +.IP "switch_to_global_locale" 8 +.IX Xref "switch_to_global_locale" +.IX Item "switch_to_global_locale" +On systems without locale support, or on typical single-threaded builds, or on +platforms that do not support per-thread locale operations, this function does +nothing. On such systems that do have locale support, only a locale global to +the whole program is available. +.Sp +On multi-threaded builds on systems that do have per-thread locale operations, +this function converts the thread it is running in to use the global locale. +This is for code that has not yet or cannot be updated to handle multi-threaded +locale operation. As long as only a single thread is so-converted, everything +works fine, as all the other threads continue to ignore the global one, so only +this thread looks at it. +.Sp +However, on Windows systems this isn't quite true prior to Visual Studio 15, +at which point Microsoft fixed a bug. A race can occur if you use the +following operations on earlier Windows platforms: +.RS 8 +.IP "POSIX::localeconv" 4 +.IX Item "POSIX::localeconv" +.PD 0 +.ie n .IP "I18N::Langinfo, items ""CRNCYSTR"" and ""THOUSEP""" 4 +.el .IP "I18N::Langinfo, items \f(CWCRNCYSTR\fR and \f(CWTHOUSEP\fR" 4 +.IX Item "I18N::Langinfo, items CRNCYSTR and THOUSEP" +.ie n .IP """Perl_langinfo"" in perlapi, items ""CRNCYSTR"" and ""THOUSEP""" 4 +.el .IP "``Perl_langinfo'' in perlapi, items \f(CWCRNCYSTR\fR and \f(CWTHOUSEP\fR" 4 +.IX Item "Perl_langinfo in perlapi, items CRNCYSTR and THOUSEP" +.RE +.RS 8 +.PD +.Sp +The first item is not fixable (except by upgrading to a later Visual Studio +release), but it would be possible to work around the latter two items by using +the Windows \s-1API\s0 functions \f(CW\*(C`GetNumberFormat\*(C'\fR and \f(CW\*(C`GetCurrencyFormat\*(C'\fR; patches +welcome. +.Sp +Without this function call, threads that use the \f(CWsetlocale(3)\fR system +function will not work properly, as all the locale-sensitive functions will +look at the per-thread locale, and \f(CW\*(C`setlocale\*(C'\fR will have no effect on this +thread. +.Sp +Perl code should convert to either call +\&\f(CW\*(C`Perl_setlocale\*(C'\fR (which is a drop-in for the system +\&\f(CW\*(C`setlocale\*(C'\fR) or use the methods given in perlcall to call +\&\f(CW\*(C`POSIX::setlocale\*(C'\fR. Either one will transparently properly +handle all cases of single\- vs multi-thread, \s-1POSIX\s0 2008\-supported or not. +.Sp +Non-Perl libraries, such as \f(CW\*(C`gtk\*(C'\fR, that call the system \f(CW\*(C`setlocale\*(C'\fR can +continue to work if this function is called before transferring control to the +library. +.Sp +Upon return from the code that needs to use the global locale, +\&\f(CW\*(C`sync_locale()\*(C'\fR should be called to restore the safe +multi-thread operation. +.Sp +.Vb 1 +\& void switch_to_global_locale() +.Ve +.RE +.IP "sync_locale" 8 +.IX Xref "sync_locale" +.IX Item "sync_locale" +\&\f(CW\*(C`Perl_setlocale\*(C'\fR can be used at any time to query or +change the locale (though changing the locale is antisocial and dangerous on +multi-threaded systems that don't have multi-thread safe locale operations. +(See \*(L"Multi-threaded operation\*(R" in perllocale). Using the system +\&\f(CWsetlocale(3)\fR should be avoided. Nevertheless, certain non-Perl libraries +called from \s-1XS,\s0 such as \f(CW\*(C`Gtk\*(C'\fR do so, and this can't be changed. When the +locale is changed by \s-1XS\s0 code that didn't use +\&\f(CW\*(C`Perl_setlocale\*(C'\fR, Perl needs to be told that the +locale has changed. Use this function to do so, before returning to Perl. +.Sp +The return value is a boolean: \s-1TRUE\s0 if the global locale at the time of call +was in effect; and \s-1FALSE\s0 if a per-thread locale was in effect. This can be +used by the caller that needs to restore things as-they-were to decide whether +or not to call +\&\f(CW\*(C`Perl_switch_to_global_locale\*(C'\fR. +.Sp +.Vb 1 +\& bool sync_locale() +.Ve +.IP "\s-1WITH_LC_NUMERIC_SET_TO_NEEDED\s0" 8 +.IX Xref "WITH_LC_NUMERIC_SET_TO_NEEDED" +.IX Item "WITH_LC_NUMERIC_SET_TO_NEEDED" +This macro invokes the supplied statement or block within the context +of a \*(L"\s-1STORE_LC_NUMERIC_SET_TO_NEEDED\*(R"\s0 .. \*(L"\s-1RESTORE_LC_NUMERIC\*(R"\s0 pair +if required, so eg: +.Sp +.Vb 3 +\& WITH_LC_NUMERIC_SET_TO_NEEDED( +\& SNPRINTF_G(fv, ebuf, sizeof(ebuf), precis) +\& ); +.Ve +.Sp +is equivalent to: +.Sp +.Vb 10 +\& { +\&#ifdef USE_LOCALE_NUMERIC +\& DECLARATION_FOR_LC_NUMERIC_MANIPULATION; +\& STORE_LC_NUMERIC_SET_TO_NEEDED(); +\&#endif +\& SNPRINTF_G(fv, ebuf, sizeof(ebuf), precis); +\&#ifdef USE_LOCALE_NUMERIC +\& RESTORE_LC_NUMERIC(); +\&#endif +\& } +\& +\& void WITH_LC_NUMERIC_SET_TO_NEEDED(block) +.Ve +.IP "\s-1WITH_LC_NUMERIC_SET_TO_NEEDED_IN\s0" 8 +.IX Xref "WITH_LC_NUMERIC_SET_TO_NEEDED_IN" +.IX Item "WITH_LC_NUMERIC_SET_TO_NEEDED_IN" +Same as \*(L"\s-1WITH_LC_NUMERIC_SET_TO_NEEDED\*(R"\s0 with in_lc_numeric provided +as the precalculated value of \f(CW\*(C`IN_LC(LC_NUMERIC)\*(C'\fR. It is the caller's +responsibility to ensure that the status of \f(CW\*(C`PL_compiling\*(C'\fR and \f(CW\*(C`PL_hints\*(C'\fR +cannot have changed since the precalculation. +.Sp +.Vb 3 +\& void WITH_LC_NUMERIC_SET_TO_NEEDED_IN( +\& bool in_lc_numeric, block +\& ) +.Ve +.SH "Magical Functions" +.IX Header "Magical Functions" +.IP "mg_clear" 8 +.IX Xref "mg_clear" +.IX Item "mg_clear" +Clear something magical that the \s-1SV\s0 represents. See \f(CW"sv_magic"\fR. +.Sp +.Vb 1 +\& int mg_clear(SV* sv) +.Ve +.IP "mg_copy" 8 +.IX Xref "mg_copy" +.IX Item "mg_copy" +Copies the magic from one \s-1SV\s0 to another. See \f(CW"sv_magic"\fR. +.Sp +.Vb 2 +\& int mg_copy(SV *sv, SV *nsv, const char *key, +\& I32 klen) +.Ve +.IP "mg_find" 8 +.IX Xref "mg_find" +.IX Item "mg_find" +Finds the magic pointer for \f(CW\*(C`type\*(C'\fR matching the \s-1SV.\s0 See \f(CW"sv_magic"\fR. +.Sp +.Vb 1 +\& MAGIC* mg_find(const SV* sv, int type) +.Ve +.IP "mg_findext" 8 +.IX Xref "mg_findext" +.IX Item "mg_findext" +Finds the magic pointer of \f(CW\*(C`type\*(C'\fR with the given \f(CW\*(C`vtbl\*(C'\fR for the \f(CW\*(C`SV\*(C'\fR. See +\&\f(CW"sv_magicext"\fR. +.Sp +.Vb 2 +\& MAGIC* mg_findext(const SV* sv, int type, +\& const MGVTBL *vtbl) +.Ve +.IP "mg_free" 8 +.IX Xref "mg_free" +.IX Item "mg_free" +Free any magic storage used by the \s-1SV.\s0 See \f(CW"sv_magic"\fR. +.Sp +.Vb 1 +\& int mg_free(SV* sv) +.Ve +.IP "mg_freeext" 8 +.IX Xref "mg_freeext" +.IX Item "mg_freeext" +Remove any magic of type \f(CW\*(C`how\*(C'\fR using virtual table \f(CW\*(C`vtbl\*(C'\fR from the +\&\s-1SV\s0 \f(CW\*(C`sv\*(C'\fR. See \*(L"sv_magic\*(R". +.Sp +\&\f(CW\*(C`mg_freeext(sv, how, NULL)\*(C'\fR is equivalent to \f(CW\*(C`mg_free_type(sv, how)\*(C'\fR. +.Sp +.Vb 1 +\& void mg_freeext(SV* sv, int how, const MGVTBL *vtbl) +.Ve +.IP "mg_free_type" 8 +.IX Xref "mg_free_type" +.IX Item "mg_free_type" +Remove any magic of type \f(CW\*(C`how\*(C'\fR from the \s-1SV\s0 \f(CW\*(C`sv\*(C'\fR. See \*(L"sv_magic\*(R". +.Sp +.Vb 1 +\& void mg_free_type(SV* sv, int how) +.Ve +.IP "mg_get" 8 +.IX Xref "mg_get" +.IX Item "mg_get" +Do magic before a value is retrieved from the \s-1SV.\s0 The type of \s-1SV\s0 must +be >= \f(CW\*(C`SVt_PVMG\*(C'\fR. See \f(CW"sv_magic"\fR. +.Sp +.Vb 1 +\& int mg_get(SV* sv) +.Ve +.IP "mg_length" 8 +.IX Xref "mg_length" +.IX Item "mg_length" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Reports on the \s-1SV\s0's length in bytes, calling length magic if available, +but does not set the \s-1UTF8\s0 flag on \f(CW\*(C`sv\*(C'\fR. It will fall back to 'get' +magic if there is no 'length' magic, but with no indication as to +whether it called 'get' magic. It assumes \f(CW\*(C`sv\*(C'\fR is a \f(CW\*(C`PVMG\*(C'\fR or +higher. Use \f(CW\*(C`sv_len()\*(C'\fR instead. +.Sp +.Vb 1 +\& U32 mg_length(SV* sv) +.Ve +.IP "mg_magical" 8 +.IX Xref "mg_magical" +.IX Item "mg_magical" +Turns on the magical status of an \s-1SV.\s0 See \f(CW"sv_magic"\fR. +.Sp +.Vb 1 +\& void mg_magical(SV* sv) +.Ve +.IP "mg_set" 8 +.IX Xref "mg_set" +.IX Item "mg_set" +Do magic after a value is assigned to the \s-1SV.\s0 See \f(CW"sv_magic"\fR. +.Sp +.Vb 1 +\& int mg_set(SV* sv) +.Ve +.IP "SvGETMAGIC" 8 +.IX Xref "SvGETMAGIC" +.IX Item "SvGETMAGIC" +Invokes \f(CW\*(C`mg_get\*(C'\fR on an \s-1SV\s0 if it has 'get' magic. For example, this +will call \f(CW\*(C`FETCH\*(C'\fR on a tied variable. This macro evaluates its +argument more than once. +.Sp +.Vb 1 +\& void SvGETMAGIC(SV* sv) +.Ve +.IP "SvLOCK" 8 +.IX Xref "SvLOCK" +.IX Item "SvLOCK" +Arranges for a mutual exclusion lock to be obtained on \f(CW\*(C`sv\*(C'\fR if a suitable module +has been loaded. +.Sp +.Vb 1 +\& void SvLOCK(SV* sv) +.Ve +.IP "SvSETMAGIC" 8 +.IX Xref "SvSETMAGIC" +.IX Item "SvSETMAGIC" +Invokes \f(CW\*(C`mg_set\*(C'\fR on an \s-1SV\s0 if it has 'set' magic. This is necessary +after modifying a scalar, in case it is a magical variable like \f(CW$|\fR +or a tied variable (it calls \f(CW\*(C`STORE\*(C'\fR). This macro evaluates its +argument more than once. +.Sp +.Vb 1 +\& void SvSETMAGIC(SV* sv) +.Ve +.IP "SvSetMagicSV" 8 +.IX Xref "SvSetMagicSV" +.IX Item "SvSetMagicSV" +Like \f(CW\*(C`SvSetSV\*(C'\fR, but does any set magic required afterwards. +.Sp +.Vb 1 +\& void SvSetMagicSV(SV* dsv, SV* ssv) +.Ve +.IP "SvSetMagicSV_nosteal" 8 +.IX Xref "SvSetMagicSV_nosteal" +.IX Item "SvSetMagicSV_nosteal" +Like \f(CW\*(C`SvSetSV_nosteal\*(C'\fR, but does any set magic required afterwards. +.Sp +.Vb 1 +\& void SvSetMagicSV_nosteal(SV* dsv, SV* ssv) +.Ve +.IP "SvSetSV" 8 +.IX Xref "SvSetSV" +.IX Item "SvSetSV" +Calls \f(CW\*(C`sv_setsv\*(C'\fR if \f(CW\*(C`dsv\*(C'\fR is not the same as \f(CW\*(C`ssv\*(C'\fR. May evaluate arguments +more than once. Does not handle 'set' magic on the destination \s-1SV.\s0 +.Sp +.Vb 1 +\& void SvSetSV(SV* dsv, SV* ssv) +.Ve +.IP "SvSetSV_nosteal" 8 +.IX Xref "SvSetSV_nosteal" +.IX Item "SvSetSV_nosteal" +Calls a non-destructive version of \f(CW\*(C`sv_setsv\*(C'\fR if \f(CW\*(C`dsv\*(C'\fR is not the same as +\&\f(CW\*(C`ssv\*(C'\fR. May evaluate arguments more than once. +.Sp +.Vb 1 +\& void SvSetSV_nosteal(SV* dsv, SV* ssv) +.Ve +.IP "SvSHARE" 8 +.IX Xref "SvSHARE" +.IX Item "SvSHARE" +Arranges for \f(CW\*(C`sv\*(C'\fR to be shared between threads if a suitable module +has been loaded. +.Sp +.Vb 1 +\& void SvSHARE(SV* sv) +.Ve +.IP "sv_string_from_errnum" 8 +.IX Xref "sv_string_from_errnum" +.IX Item "sv_string_from_errnum" +Generates the message string describing an \s-1OS\s0 error and returns it as +an \s-1SV.\s0 \f(CW\*(C`errnum\*(C'\fR must be a value that \f(CW\*(C`errno\*(C'\fR could take, identifying +the type of error. +.Sp +If \f(CW\*(C`tgtsv\*(C'\fR is non-null then the string will be written into that \s-1SV\s0 +(overwriting existing content) and it will be returned. If \f(CW\*(C`tgtsv\*(C'\fR +is a null pointer then the string will be written into a new mortal \s-1SV\s0 +which will be returned. +.Sp +The message will be taken from whatever locale would be used by \f(CW$!\fR, +and will be encoded in the \s-1SV\s0 in whatever manner would be used by \f(CW$!\fR. +The details of this process are subject to future change. Currently, +the message is taken from the C locale by default (usually producing an +English message), and from the currently selected locale when in the scope +of the \f(CW\*(C`use locale\*(C'\fR pragma. A heuristic attempt is made to decode the +message from the locale's character encoding, but it will only be decoded +as either \s-1UTF\-8\s0 or \s-1ISO\-8859\-1.\s0 It is always correctly decoded in a \s-1UTF\-8\s0 +locale, usually in an \s-1ISO\-8859\-1\s0 locale, and never in any other locale. +.Sp +The \s-1SV\s0 is always returned containing an actual string, and with no other +\&\s-1OK\s0 bits set. Unlike \f(CW$!\fR, a message is even yielded for \f(CW\*(C`errnum\*(C'\fR zero +(meaning success), and if no useful message is available then a useless +string (currently empty) is returned. +.Sp +.Vb 1 +\& SV* sv_string_from_errnum(int errnum, SV* tgtsv) +.Ve +.IP "SvUNLOCK" 8 +.IX Xref "SvUNLOCK" +.IX Item "SvUNLOCK" +Releases a mutual exclusion lock on \f(CW\*(C`sv\*(C'\fR if a suitable module +has been loaded. +.Sp +.Vb 1 +\& void SvUNLOCK(SV* sv) +.Ve +.SH "Memory Management" +.IX Header "Memory Management" +.IP "Copy" 8 +.IX Xref "Copy" +.IX Item "Copy" +The XSUB-writer's interface to the C \f(CW\*(C`memcpy\*(C'\fR function. The \f(CW\*(C`src\*(C'\fR is the +source, \f(CW\*(C`dest\*(C'\fR is the destination, \f(CW\*(C`nitems\*(C'\fR is the number of items, and +\&\f(CW\*(C`type\*(C'\fR is the type. May fail on overlapping copies. See also \f(CW"Move"\fR. +.Sp +.Vb 1 +\& void Copy(void* src, void* dest, int nitems, type) +.Ve +.IP "CopyD" 8 +.IX Xref "CopyD" +.IX Item "CopyD" +Like \f(CW\*(C`Copy\*(C'\fR but returns \f(CW\*(C`dest\*(C'\fR. Useful +for encouraging compilers to tail-call +optimise. +.Sp +.Vb 1 +\& void * CopyD(void* src, void* dest, int nitems, type) +.Ve +.IP "Move" 8 +.IX Xref "Move" +.IX Item "Move" +The XSUB-writer's interface to the C \f(CW\*(C`memmove\*(C'\fR function. The \f(CW\*(C`src\*(C'\fR is the +source, \f(CW\*(C`dest\*(C'\fR is the destination, \f(CW\*(C`nitems\*(C'\fR is the number of items, and +\&\f(CW\*(C`type\*(C'\fR is the type. Can do overlapping moves. See also \f(CW"Copy"\fR. +.Sp +.Vb 1 +\& void Move(void* src, void* dest, int nitems, type) +.Ve +.IP "MoveD" 8 +.IX Xref "MoveD" +.IX Item "MoveD" +Like \f(CW\*(C`Move\*(C'\fR but returns \f(CW\*(C`dest\*(C'\fR. Useful +for encouraging compilers to tail-call +optimise. +.Sp +.Vb 1 +\& void * MoveD(void* src, void* dest, int nitems, type) +.Ve +.IP "Newx" 8 +.IX Xref "Newx" +.IX Item "Newx" +The XSUB-writer's interface to the C \f(CW\*(C`malloc\*(C'\fR function. +.Sp +Memory obtained by this should \fB\s-1ONLY\s0\fR be freed with \*(L"Safefree\*(R". +.Sp +In 5.9.3, \fBNewx()\fR and friends replace the older \fBNew()\fR \s-1API,\s0 and drops +the first parameter, \fIx\fR, a debug aid which allowed callers to identify +themselves. This aid has been superseded by a new build option, +\&\s-1PERL_MEM_LOG\s0 (see \*(L"\s-1PERL_MEM_LOG\*(R"\s0 in perlhacktips). The older \s-1API\s0 is still +there for use in \s-1XS\s0 modules supporting older perls. +.Sp +.Vb 1 +\& void Newx(void* ptr, int nitems, type) +.Ve +.IP "Newxc" 8 +.IX Xref "Newxc" +.IX Item "Newxc" +The XSUB-writer's interface to the C \f(CW\*(C`malloc\*(C'\fR function, with +cast. See also \f(CW"Newx"\fR. +.Sp +Memory obtained by this should \fB\s-1ONLY\s0\fR be freed with \*(L"Safefree\*(R". +.Sp +.Vb 1 +\& void Newxc(void* ptr, int nitems, type, cast) +.Ve +.IP "Newxz" 8 +.IX Xref "Newxz" +.IX Item "Newxz" +The XSUB-writer's interface to the C \f(CW\*(C`malloc\*(C'\fR function. The allocated +memory is zeroed with \f(CW\*(C`memzero\*(C'\fR. See also \f(CW"Newx"\fR. +.Sp +Memory obtained by this should \fB\s-1ONLY\s0\fR be freed with \*(L"Safefree\*(R". +.Sp +.Vb 1 +\& void Newxz(void* ptr, int nitems, type) +.Ve +.IP "Poison" 8 +.IX Xref "Poison" +.IX Item "Poison" +PoisonWith(0xEF) for catching access to freed memory. +.Sp +.Vb 1 +\& void Poison(void* dest, int nitems, type) +.Ve +.IP "PoisonFree" 8 +.IX Xref "PoisonFree" +.IX Item "PoisonFree" +PoisonWith(0xEF) for catching access to freed memory. +.Sp +.Vb 1 +\& void PoisonFree(void* dest, int nitems, type) +.Ve +.IP "PoisonNew" 8 +.IX Xref "PoisonNew" +.IX Item "PoisonNew" +PoisonWith(0xAB) for catching access to allocated but uninitialized memory. +.Sp +.Vb 1 +\& void PoisonNew(void* dest, int nitems, type) +.Ve +.IP "PoisonWith" 8 +.IX Xref "PoisonWith" +.IX Item "PoisonWith" +Fill up memory with a byte pattern (a byte repeated over and over +again) that hopefully catches attempts to access uninitialized memory. +.Sp +.Vb 2 +\& void PoisonWith(void* dest, int nitems, type, +\& U8 byte) +.Ve +.IP "Renew" 8 +.IX Xref "Renew" +.IX Item "Renew" +The XSUB-writer's interface to the C \f(CW\*(C`realloc\*(C'\fR function. +.Sp +Memory obtained by this should \fB\s-1ONLY\s0\fR be freed with \*(L"Safefree\*(R". +.Sp +.Vb 1 +\& void Renew(void* ptr, int nitems, type) +.Ve +.IP "Renewc" 8 +.IX Xref "Renewc" +.IX Item "Renewc" +The XSUB-writer's interface to the C \f(CW\*(C`realloc\*(C'\fR function, with +cast. +.Sp +Memory obtained by this should \fB\s-1ONLY\s0\fR be freed with \*(L"Safefree\*(R". +.Sp +.Vb 1 +\& void Renewc(void* ptr, int nitems, type, cast) +.Ve +.IP "Safefree" 8 +.IX Xref "Safefree" +.IX Item "Safefree" +The XSUB-writer's interface to the C \f(CW\*(C`free\*(C'\fR function. +.Sp +This should \fB\s-1ONLY\s0\fR be used on memory obtained using \*(L"Newx\*(R" and friends. +.Sp +.Vb 1 +\& void Safefree(void* ptr) +.Ve +.IP "savepv" 8 +.IX Xref "savepv" +.IX Item "savepv" +Perl's version of \f(CW\*(C`strdup()\*(C'\fR. Returns a pointer to a newly allocated +string which is a duplicate of \f(CW\*(C`pv\*(C'\fR. The size of the string is +determined by \f(CW\*(C`strlen()\*(C'\fR, which means it may not contain embedded \f(CW\*(C`NUL\*(C'\fR +characters and must have a trailing \f(CW\*(C`NUL\*(C'\fR. To prevent memory leaks, the +memory allocated for the new string needs to be freed when no longer needed. +This can be done with the "\f(CW\*(C`Safefree\*(C'\fR" function, or +\&\f(CW\*(C`SAVEFREEPV\*(C'\fR. +.Sp +On some platforms, Windows for example, all allocated memory owned by a thread +is deallocated when that thread ends. So if you need that not to happen, you +need to use the shared memory functions, such as \f(CW"savesharedpv"\fR. +.Sp +.Vb 1 +\& char* savepv(const char* pv) +.Ve +.IP "savepvn" 8 +.IX Xref "savepvn" +.IX Item "savepvn" +Perl's version of what \f(CW\*(C`strndup()\*(C'\fR would be if it existed. Returns a +pointer to a newly allocated string which is a duplicate of the first +\&\f(CW\*(C`len\*(C'\fR bytes from \f(CW\*(C`pv\*(C'\fR, plus a trailing +\&\f(CW\*(C`NUL\*(C'\fR byte. The memory allocated for +the new string can be freed with the \f(CW\*(C`Safefree()\*(C'\fR function. +.Sp +On some platforms, Windows for example, all allocated memory owned by a thread +is deallocated when that thread ends. So if you need that not to happen, you +need to use the shared memory functions, such as \f(CW"savesharedpvn"\fR. +.Sp +.Vb 1 +\& char* savepvn(const char* pv, Size_t len) +.Ve +.IP "savepvs" 8 +.IX Xref "savepvs" +.IX Item "savepvs" +Like \f(CW\*(C`savepvn\*(C'\fR, but takes a literal string instead of a +string/length pair. +.Sp +.Vb 1 +\& char* savepvs("literal string") +.Ve +.IP "savesharedpv" 8 +.IX Xref "savesharedpv" +.IX Item "savesharedpv" +A version of \f(CW\*(C`savepv()\*(C'\fR which allocates the duplicate string in memory +which is shared between threads. +.Sp +.Vb 1 +\& char* savesharedpv(const char* pv) +.Ve +.IP "savesharedpvn" 8 +.IX Xref "savesharedpvn" +.IX Item "savesharedpvn" +A version of \f(CW\*(C`savepvn()\*(C'\fR which allocates the duplicate string in memory +which is shared between threads. (With the specific difference that a \f(CW\*(C`NULL\*(C'\fR +pointer is not acceptable) +.Sp +.Vb 2 +\& char* savesharedpvn(const char *const pv, +\& const STRLEN len) +.Ve +.IP "savesharedpvs" 8 +.IX Xref "savesharedpvs" +.IX Item "savesharedpvs" +A version of \f(CW\*(C`savepvs()\*(C'\fR which allocates the duplicate string in memory +which is shared between threads. +.Sp +.Vb 1 +\& char* savesharedpvs("literal string") +.Ve +.IP "savesharedsvpv" 8 +.IX Xref "savesharedsvpv" +.IX Item "savesharedsvpv" +A version of \f(CW\*(C`savesharedpv()\*(C'\fR which allocates the duplicate string in +memory which is shared between threads. +.Sp +.Vb 1 +\& char* savesharedsvpv(SV *sv) +.Ve +.IP "savesvpv" 8 +.IX Xref "savesvpv" +.IX Item "savesvpv" +A version of \f(CW\*(C`savepv()\*(C'\fR/\f(CW\*(C`savepvn()\*(C'\fR which gets the string to duplicate from +the passed in \s-1SV\s0 using \f(CW\*(C`SvPV()\*(C'\fR +.Sp +On some platforms, Windows for example, all allocated memory owned by a thread +is deallocated when that thread ends. So if you need that not to happen, you +need to use the shared memory functions, such as \f(CW"savesharedsvpv"\fR. +.Sp +.Vb 1 +\& char* savesvpv(SV* sv) +.Ve +.IP "StructCopy" 8 +.IX Xref "StructCopy" +.IX Item "StructCopy" +This is an architecture-independent macro to copy one structure to another. +.Sp +.Vb 1 +\& void StructCopy(type *src, type *dest, type) +.Ve +.IP "Zero" 8 +.IX Xref "Zero" +.IX Item "Zero" +The XSUB-writer's interface to the C \f(CW\*(C`memzero\*(C'\fR function. The \f(CW\*(C`dest\*(C'\fR is the +destination, \f(CW\*(C`nitems\*(C'\fR is the number of items, and \f(CW\*(C`type\*(C'\fR is the type. +.Sp +.Vb 1 +\& void Zero(void* dest, int nitems, type) +.Ve +.IP "ZeroD" 8 +.IX Xref "ZeroD" +.IX Item "ZeroD" +Like \f(CW\*(C`Zero\*(C'\fR but returns dest. Useful +for encouraging compilers to tail-call +optimise. +.Sp +.Vb 1 +\& void * ZeroD(void* dest, int nitems, type) +.Ve +.SH "Miscellaneous Functions" +.IX Header "Miscellaneous Functions" +.IP "dump_c_backtrace" 8 +.IX Xref "dump_c_backtrace" +.IX Item "dump_c_backtrace" +Dumps the C backtrace to the given \f(CW\*(C`fp\*(C'\fR. +.Sp +Returns true if a backtrace could be retrieved, false if not. +.Sp +.Vb 2 +\& bool dump_c_backtrace(PerlIO* fp, int max_depth, +\& int skip) +.Ve +.IP "fbm_compile" 8 +.IX Xref "fbm_compile" +.IX Item "fbm_compile" +Analyzes the string in order to make fast searches on it using \f(CW\*(C`fbm_instr()\*(C'\fR +\&\*(-- the Boyer-Moore algorithm. +.Sp +.Vb 1 +\& void fbm_compile(SV* sv, U32 flags) +.Ve +.IP "fbm_instr" 8 +.IX Xref "fbm_instr" +.IX Item "fbm_instr" +Returns the location of the \s-1SV\s0 in the string delimited by \f(CW\*(C`big\*(C'\fR and +\&\f(CW\*(C`bigend\*(C'\fR (\f(CW\*(C`bigend\*(C'\fR) is the char following the last char). +It returns \f(CW\*(C`NULL\*(C'\fR if the string can't be found. The \f(CW\*(C`sv\*(C'\fR +does not have to be \f(CW\*(C`fbm_compiled\*(C'\fR, but the search will not be as fast +then. +.Sp +.Vb 3 +\& char* fbm_instr(unsigned char* big, +\& unsigned char* bigend, SV* littlestr, +\& U32 flags) +.Ve +.IP "foldEQ" 8 +.IX Xref "foldEQ" +.IX Item "foldEQ" +Returns true if the leading \f(CW\*(C`len\*(C'\fR bytes of the strings \f(CW\*(C`s1\*(C'\fR and \f(CW\*(C`s2\*(C'\fR are the +same +case-insensitively; false otherwise. Uppercase and lowercase \s-1ASCII\s0 range bytes +match themselves and their opposite case counterparts. Non-cased and non-ASCII +range bytes match only themselves. +.Sp +.Vb 1 +\& I32 foldEQ(const char* a, const char* b, I32 len) +.Ve +.IP "foldEQ_locale" 8 +.IX Xref "foldEQ_locale" +.IX Item "foldEQ_locale" +Returns true if the leading \f(CW\*(C`len\*(C'\fR bytes of the strings \f(CW\*(C`s1\*(C'\fR and \f(CW\*(C`s2\*(C'\fR are the +same case-insensitively in the current locale; false otherwise. +.Sp +.Vb 2 +\& I32 foldEQ_locale(const char* a, const char* b, +\& I32 len) +.Ve +.IP "form" 8 +.IX Xref "form" +.IX Item "form" +Takes a sprintf-style format pattern and conventional +(non-SV) arguments and returns the formatted string. +.Sp +.Vb 1 +\& (char *) Perl_form(pTHX_ const char* pat, ...) +.Ve +.Sp +can be used any place a string (char *) is required: +.Sp +.Vb 1 +\& char * s = Perl_form("%d.%d",major,minor); +.Ve +.Sp +Uses a single private buffer so if you want to format several strings you +must explicitly copy the earlier strings away (and free the copies when you +are done). +.Sp +.Vb 1 +\& char* form(const char* pat, ...) +.Ve +.IP "getcwd_sv" 8 +.IX Xref "getcwd_sv" +.IX Item "getcwd_sv" +Fill \f(CW\*(C`sv\*(C'\fR with current working directory +.Sp +.Vb 1 +\& int getcwd_sv(SV* sv) +.Ve +.IP "get_c_backtrace_dump" 8 +.IX Xref "get_c_backtrace_dump" +.IX Item "get_c_backtrace_dump" +Returns a \s-1SV\s0 containing a dump of \f(CW\*(C`depth\*(C'\fR frames of the call stack, skipping +the \f(CW\*(C`skip\*(C'\fR innermost ones. \f(CW\*(C`depth\*(C'\fR of 20 is usually enough. +.Sp +The appended output looks like: +.Sp +\&... +1 10e004812:0082 Perl_croak util.c:1716 /usr/bin/perl +2 10df8d6d2:1d72 perl_parse perl.c:3975 /usr/bin/perl +\&... +.Sp +The fields are tab-separated. The first column is the depth (zero +being the innermost non-skipped frame). In the hex:offset, the hex is +where the program counter was in \f(CW\*(C`S_parse_body\*(C'\fR, and the :offset (might +be missing) tells how much inside the \f(CW\*(C`S_parse_body\*(C'\fR the program counter was. +.Sp +The \f(CW\*(C`util.c:1716\*(C'\fR is the source code file and line number. +.Sp +The \fI/usr/bin/perl\fR is obvious (hopefully). +.Sp +Unknowns are \f(CW"\-"\fR. Unknowns can happen unfortunately quite easily: +if the platform doesn't support retrieving the information; +if the binary is missing the debug information; +if the optimizer has transformed the code by for example inlining. +.Sp +.Vb 1 +\& SV* get_c_backtrace_dump(int max_depth, int skip) +.Ve +.IP "ibcmp" 8 +.IX Xref "ibcmp" +.IX Item "ibcmp" +This is a synonym for \f(CW\*(C`(!\ foldEQ())\*(C'\fR +.Sp +.Vb 1 +\& I32 ibcmp(const char* a, const char* b, I32 len) +.Ve +.IP "ibcmp_locale" 8 +.IX Xref "ibcmp_locale" +.IX Item "ibcmp_locale" +This is a synonym for \f(CW\*(C`(!\ foldEQ_locale())\*(C'\fR +.Sp +.Vb 2 +\& I32 ibcmp_locale(const char* a, const char* b, +\& I32 len) +.Ve +.IP "instr" 8 +.IX Xref "instr" +.IX Item "instr" +Same as \fBstrstr\fR\|(3), which finds and returns a pointer to the first occurrence +of the NUL-terminated substring \f(CW\*(C`little\*(C'\fR in the NUL-terminated string \f(CW\*(C`big\*(C'\fR, +returning \s-1NULL\s0 if not found. The terminating \s-1NUL\s0 bytes are not compared. +.Sp +.Vb 1 +\& char* instr(const char* big, const char* little) +.Ve +.IP "\s-1IS_SAFE_SYSCALL\s0" 8 +.IX Xref "IS_SAFE_SYSCALL" +.IX Item "IS_SAFE_SYSCALL" +Same as \*(L"is_safe_syscall\*(R". +.Sp +.Vb 3 +\& bool IS_SAFE_SYSCALL(NN const char *pv, STRLEN len, +\& NN const char *what, +\& NN const char *op_name) +.Ve +.IP "is_safe_syscall" 8 +.IX Xref "is_safe_syscall" +.IX Item "is_safe_syscall" +Test that the given \f(CW\*(C`pv\*(C'\fR (with length \f(CW\*(C`len\*(C'\fR) doesn't contain any internal +\&\f(CW\*(C`NUL\*(C'\fR characters. +If it does, set \f(CW\*(C`errno\*(C'\fR to \f(CW\*(C`ENOENT\*(C'\fR, optionally warn using the \f(CW\*(C`syscalls\*(C'\fR +category, and return \s-1FALSE.\s0 +.Sp +Return \s-1TRUE\s0 if the name is safe. +.Sp +\&\f(CW\*(C`what\*(C'\fR and \f(CW\*(C`op_name\*(C'\fR are used in any warning. +.Sp +Used by the \f(CW\*(C`IS_SAFE_SYSCALL()\*(C'\fR macro. +.Sp +.Vb 3 +\& bool is_safe_syscall(const char *pv, STRLEN len, +\& const char *what, +\& const char *op_name) +.Ve +.IP "\s-1LIKELY\s0" 8 +.IX Xref "LIKELY" +.IX Item "LIKELY" +Returns the input unchanged, but at the same time it gives a branch prediction +hint to the compiler that this condition is likely to be true. +.IP "memCHRs" 8 +.IX Xref "memCHRs" +.IX Item "memCHRs" +Returns the position of the first occurence of the byte \f(CW\*(C`c\*(C'\fR in the literal +string \f(CW"list"\fR, or \s-1NULL\s0 if \f(CW\*(C`c\*(C'\fR doesn't appear in \f(CW"list"\fR. All bytes are +treated as unsigned char. Thus this macro can be used to determine if \f(CW\*(C`c\*(C'\fR is +in a set of particular characters. Unlike \fBstrchr\fR\|(3), it works even if \f(CW\*(C`c\*(C'\fR +is \f(CW\*(C`NUL\*(C'\fR (and the set doesn't include \f(CW\*(C`NUL\*(C'\fR). +.Sp +.Vb 1 +\& bool memCHRs("list", char c) +.Ve +.IP "memEQ" 8 +.IX Xref "memEQ" +.IX Item "memEQ" +Test two buffers (which may contain embedded \f(CW\*(C`NUL\*(C'\fR characters, to see if they +are equal. The \f(CW\*(C`len\*(C'\fR parameter indicates the number of bytes to compare. +Returns zero if equal, or non-zero if non-equal. +.Sp +.Vb 1 +\& bool memEQ(char* s1, char* s2, STRLEN len) +.Ve +.IP "memEQs" 8 +.IX Xref "memEQs" +.IX Item "memEQs" +Like \*(L"memEQ\*(R", but the second string is a literal enclosed in double quotes, +\&\f(CW\*(C`l1\*(C'\fR gives the number of bytes in \f(CW\*(C`s1\*(C'\fR. +Returns zero if equal, or non-zero if non-equal. +.Sp +.Vb 1 +\& bool memEQs(char* s1, STRLEN l1, "s2") +.Ve +.IP "memNE" 8 +.IX Xref "memNE" +.IX Item "memNE" +Test two buffers (which may contain embedded \f(CW\*(C`NUL\*(C'\fR characters, to see if they +are not equal. The \f(CW\*(C`len\*(C'\fR parameter indicates the number of bytes to compare. +Returns zero if non-equal, or non-zero if equal. +.Sp +.Vb 1 +\& bool memNE(char* s1, char* s2, STRLEN len) +.Ve +.IP "memNEs" 8 +.IX Xref "memNEs" +.IX Item "memNEs" +Like \*(L"memNE\*(R", but the second string is a literal enclosed in double quotes, +\&\f(CW\*(C`l1\*(C'\fR gives the number of bytes in \f(CW\*(C`s1\*(C'\fR. +Returns zero if non-equal, or zero if non-equal. +.Sp +.Vb 1 +\& bool memNEs(char* s1, STRLEN l1, "s2") +.Ve +.IP "mess" 8 +.IX Xref "mess" +.IX Item "mess" +Take a sprintf-style format pattern and argument list. These are used to +generate a string message. If the message does not end with a newline, +then it will be extended with some indication of the current location +in the code, as described for \*(L"mess_sv\*(R". +.Sp +Normally, the resulting message is returned in a new mortal \s-1SV.\s0 +During global destruction a single \s-1SV\s0 may be shared between uses of +this function. +.Sp +.Vb 1 +\& SV* mess(const char* pat, ...) +.Ve +.IP "mess_sv" 8 +.IX Xref "mess_sv" +.IX Item "mess_sv" +Expands a message, intended for the user, to include an indication of +the current location in the code, if the message does not already appear +to be complete. +.Sp +\&\f(CW\*(C`basemsg\*(C'\fR is the initial message or object. If it is a reference, it +will be used as-is and will be the result of this function. Otherwise it +is used as a string, and if it already ends with a newline, it is taken +to be complete, and the result of this function will be the same string. +If the message does not end with a newline, then a segment such as \f(CW\*(C`at +foo.pl line 37\*(C'\fR will be appended, and possibly other clauses indicating +the current state of execution. The resulting message will end with a +dot and a newline. +.Sp +Normally, the resulting message is returned in a new mortal \s-1SV.\s0 +During global destruction a single \s-1SV\s0 may be shared between uses of this +function. If \f(CW\*(C`consume\*(C'\fR is true, then the function is permitted (but not +required) to modify and return \f(CW\*(C`basemsg\*(C'\fR instead of allocating a new \s-1SV.\s0 +.Sp +.Vb 1 +\& SV* mess_sv(SV* basemsg, bool consume) +.Ve +.IP "my_snprintf" 8 +.IX Xref "my_snprintf" +.IX Item "my_snprintf" +The C library \f(CW\*(C`snprintf\*(C'\fR functionality, if available and +standards-compliant (uses \f(CW\*(C`vsnprintf\*(C'\fR, actually). However, if the +\&\f(CW\*(C`vsnprintf\*(C'\fR is not available, will unfortunately use the unsafe +\&\f(CW\*(C`vsprintf\*(C'\fR which can overrun the buffer (there is an overrun check, +but that may be too late). Consider using \f(CW\*(C`sv_vcatpvf\*(C'\fR instead, or +getting \f(CW\*(C`vsnprintf\*(C'\fR. +.Sp +.Vb 2 +\& int my_snprintf(char *buffer, const Size_t len, +\& const char *format, ...) +.Ve +.IP "my_sprintf" 8 +.IX Xref "my_sprintf" +.IX Item "my_sprintf" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Do \s-1NOT\s0 use this due to the possibility of overflowing \f(CW\*(C`buffer\*(C'\fR. Instead use +\&\fBmy_snprintf()\fR +.Sp +.Vb 2 +\& int my_sprintf(NN char *buffer, NN const char *pat, +\& ...) +.Ve +.IP "my_strlcat" 8 +.IX Xref "my_strlcat" +.IX Item "my_strlcat" +The C library \f(CW\*(C`strlcat\*(C'\fR if available, or a Perl implementation of it. +This operates on C \f(CW\*(C`NUL\*(C'\fR\-terminated strings. +.Sp +\&\f(CW\*(C`my_strlcat()\*(C'\fR appends string \f(CW\*(C`src\*(C'\fR to the end of \f(CW\*(C`dst\*(C'\fR. It will append at +most \f(CW\*(C`size\ \-\ strlen(dst)\ \-\ 1\*(C'\fR characters. It will then \f(CW\*(C`NUL\*(C'\fR\-terminate, +unless \f(CW\*(C`size\*(C'\fR is 0 or the original \f(CW\*(C`dst\*(C'\fR string was longer than \f(CW\*(C`size\*(C'\fR (in +practice this should not happen as it means that either \f(CW\*(C`size\*(C'\fR is incorrect or +that \f(CW\*(C`dst\*(C'\fR is not a proper \f(CW\*(C`NUL\*(C'\fR\-terminated string). +.Sp +Note that \f(CW\*(C`size\*(C'\fR is the full size of the destination buffer and +the result is guaranteed to be \f(CW\*(C`NUL\*(C'\fR\-terminated if there is room. Note that +room for the \f(CW\*(C`NUL\*(C'\fR should be included in \f(CW\*(C`size\*(C'\fR. +.Sp +The return value is the total length that \f(CW\*(C`dst\*(C'\fR would have if \f(CW\*(C`size\*(C'\fR is +sufficiently large. Thus it is the initial length of \f(CW\*(C`dst\*(C'\fR plus the length of +\&\f(CW\*(C`src\*(C'\fR. If \f(CW\*(C`size\*(C'\fR is smaller than the return, the excess was not appended. +.Sp +.Vb 2 +\& Size_t my_strlcat(char *dst, const char *src, +\& Size_t size) +.Ve +.IP "my_strlcpy" 8 +.IX Xref "my_strlcpy" +.IX Item "my_strlcpy" +The C library \f(CW\*(C`strlcpy\*(C'\fR if available, or a Perl implementation of it. +This operates on C \f(CW\*(C`NUL\*(C'\fR\-terminated strings. +.Sp +\&\f(CW\*(C`my_strlcpy()\*(C'\fR copies up to \f(CW\*(C`size\ \-\ 1\*(C'\fR characters from the string \f(CW\*(C`src\*(C'\fR +to \f(CW\*(C`dst\*(C'\fR, \f(CW\*(C`NUL\*(C'\fR\-terminating the result if \f(CW\*(C`size\*(C'\fR is not 0. +.Sp +The return value is the total length \f(CW\*(C`src\*(C'\fR would be if the copy completely +succeeded. If it is larger than \f(CW\*(C`size\*(C'\fR, the excess was not copied. +.Sp +.Vb 2 +\& Size_t my_strlcpy(char *dst, const char *src, +\& Size_t size) +.Ve +.IP "my_strnlen" 8 +.IX Xref "my_strnlen" +.IX Item "my_strnlen" +The C library \f(CW\*(C`strnlen\*(C'\fR if available, or a Perl implementation of it. +.Sp +\&\f(CW\*(C`my_strnlen()\*(C'\fR computes the length of the string, up to \f(CW\*(C`maxlen\*(C'\fR +characters. It will never attempt to address more than \f(CW\*(C`maxlen\*(C'\fR +characters, making it suitable for use with strings that are not +guaranteed to be NUL-terminated. +.Sp +.Vb 1 +\& Size_t my_strnlen(const char *str, Size_t maxlen) +.Ve +.IP "my_vsnprintf" 8 +.IX Xref "my_vsnprintf" +.IX Item "my_vsnprintf" +The C library \f(CW\*(C`vsnprintf\*(C'\fR if available and standards-compliant. +However, if the \f(CW\*(C`vsnprintf\*(C'\fR is not available, will unfortunately +use the unsafe \f(CW\*(C`vsprintf\*(C'\fR which can overrun the buffer (there is an +overrun check, but that may be too late). Consider using +\&\f(CW\*(C`sv_vcatpvf\*(C'\fR instead, or getting \f(CW\*(C`vsnprintf\*(C'\fR. +.Sp +.Vb 2 +\& int my_vsnprintf(char *buffer, const Size_t len, +\& const char *format, va_list ap) +.Ve +.IP "ninstr" 8 +.IX Xref "ninstr" +.IX Item "ninstr" +Find the first (leftmost) occurrence of a sequence of bytes within another +sequence. This is the Perl version of \f(CW\*(C`strstr()\*(C'\fR, extended to handle +arbitrary sequences, potentially containing embedded \f(CW\*(C`NUL\*(C'\fR characters (\f(CW\*(C`NUL\*(C'\fR +is what the initial \f(CW\*(C`n\*(C'\fR in the function name stands for; some systems have an +equivalent, \f(CW\*(C`memmem()\*(C'\fR, but with a somewhat different \s-1API\s0). +.Sp +Another way of thinking about this function is finding a needle in a haystack. +\&\f(CW\*(C`big\*(C'\fR points to the first byte in the haystack. \f(CW\*(C`big_end\*(C'\fR points to one byte +beyond the final byte in the haystack. \f(CW\*(C`little\*(C'\fR points to the first byte in +the needle. \f(CW\*(C`little_end\*(C'\fR points to one byte beyond the final byte in the +needle. All the parameters must be non\-\f(CW\*(C`NULL\*(C'\fR. +.Sp +The function returns \f(CW\*(C`NULL\*(C'\fR if there is no occurrence of \f(CW\*(C`little\*(C'\fR within +\&\f(CW\*(C`big\*(C'\fR. If \f(CW\*(C`little\*(C'\fR is the empty string, \f(CW\*(C`big\*(C'\fR is returned. +.Sp +Because this function operates at the byte level, and because of the inherent +characteristics of \s-1UTF\-8\s0 (or UTF-EBCDIC), it will work properly if both the +needle and the haystack are strings with the same UTF\-8ness, but not if the +UTF\-8ness differs. +.Sp +.Vb 2 +\& char* ninstr(const char* big, const char* bigend, +\& const char* little, const char* lend) +.Ve +.IP "\s-1PERL_SYS_INIT\s0" 8 +.IX Xref "PERL_SYS_INIT" +.IX Item "PERL_SYS_INIT" +Provides system-specific tune up of the C runtime environment necessary to +run Perl interpreters. This should be called only once, before creating +any Perl interpreters. +.Sp +.Vb 1 +\& void PERL_SYS_INIT(int *argc, char*** argv) +.Ve +.IP "\s-1PERL_SYS_INIT3\s0" 8 +.IX Xref "PERL_SYS_INIT3" +.IX Item "PERL_SYS_INIT3" +Provides system-specific tune up of the C runtime environment necessary to +run Perl interpreters. This should be called only once, before creating +any Perl interpreters. +.Sp +.Vb 2 +\& void PERL_SYS_INIT3(int *argc, char*** argv, +\& char*** env) +.Ve +.IP "\s-1PERL_SYS_TERM\s0" 8 +.IX Xref "PERL_SYS_TERM" +.IX Item "PERL_SYS_TERM" +Provides system-specific clean up of the C runtime environment after +running Perl interpreters. This should be called only once, after +freeing any remaining Perl interpreters. +.Sp +.Vb 1 +\& void PERL_SYS_TERM() +.Ve +.IP "\s-1READ_XDIGIT\s0" 8 +.IX Xref "READ_XDIGIT" +.IX Item "READ_XDIGIT" +Returns the value of an ASCII-range hex digit and advances the string pointer. +Behaviour is only well defined when isXDIGIT(*str) is true. +.Sp +.Vb 1 +\& U8 READ_XDIGIT(char str*) +.Ve +.IP "rninstr" 8 +.IX Xref "rninstr" +.IX Item "rninstr" +Like \f(CW"ninstr"\fR, but instead finds the final (rightmost) occurrence of a +sequence of bytes within another sequence, returning \f(CW\*(C`NULL\*(C'\fR if there is no +such occurrence. +.Sp +.Vb 2 +\& char* rninstr(const char* big, const char* bigend, +\& const char* little, const char* lend) +.Ve +.IP "\s-1STMT_START\s0" 8 +.IX Xref "STMT_START" +.IX Item "STMT_START" +.Vb 1 +\& STMT_START { statements; } STMT_END; +.Ve +.Sp +can be used as a single statement, as in +.Sp +.Vb 1 +\& if (x) STMT_START { ... } STMT_END; else ... +.Ve +.Sp +These are often used in macro definitions. Note that you can't return a value +out of them. +.IP "strEQ" 8 +.IX Xref "strEQ" +.IX Item "strEQ" +Test two \f(CW\*(C`NUL\*(C'\fR\-terminated strings to see if they are equal. Returns true or +false. +.Sp +.Vb 1 +\& bool strEQ(char* s1, char* s2) +.Ve +.IP "strGE" 8 +.IX Xref "strGE" +.IX Item "strGE" +Test two \f(CW\*(C`NUL\*(C'\fR\-terminated strings to see if the first, \f(CW\*(C`s1\*(C'\fR, is greater than +or equal to the second, \f(CW\*(C`s2\*(C'\fR. Returns true or false. +.Sp +.Vb 1 +\& bool strGE(char* s1, char* s2) +.Ve +.IP "strGT" 8 +.IX Xref "strGT" +.IX Item "strGT" +Test two \f(CW\*(C`NUL\*(C'\fR\-terminated strings to see if the first, \f(CW\*(C`s1\*(C'\fR, is greater than +the second, \f(CW\*(C`s2\*(C'\fR. Returns true or false. +.Sp +.Vb 1 +\& bool strGT(char* s1, char* s2) +.Ve +.IP "strLE" 8 +.IX Xref "strLE" +.IX Item "strLE" +Test two \f(CW\*(C`NUL\*(C'\fR\-terminated strings to see if the first, \f(CW\*(C`s1\*(C'\fR, is less than or +equal to the second, \f(CW\*(C`s2\*(C'\fR. Returns true or false. +.Sp +.Vb 1 +\& bool strLE(char* s1, char* s2) +.Ve +.IP "strLT" 8 +.IX Xref "strLT" +.IX Item "strLT" +Test two \f(CW\*(C`NUL\*(C'\fR\-terminated strings to see if the first, \f(CW\*(C`s1\*(C'\fR, is less than the +second, \f(CW\*(C`s2\*(C'\fR. Returns true or false. +.Sp +.Vb 1 +\& bool strLT(char* s1, char* s2) +.Ve +.IP "strNE" 8 +.IX Xref "strNE" +.IX Item "strNE" +Test two \f(CW\*(C`NUL\*(C'\fR\-terminated strings to see if they are different. Returns true +or false. +.Sp +.Vb 1 +\& bool strNE(char* s1, char* s2) +.Ve +.IP "strnEQ" 8 +.IX Xref "strnEQ" +.IX Item "strnEQ" +Test two \f(CW\*(C`NUL\*(C'\fR\-terminated strings to see if they are equal. The \f(CW\*(C`len\*(C'\fR +parameter indicates the number of bytes to compare. Returns true or false. (A +wrapper for \f(CW\*(C`strncmp\*(C'\fR). +.Sp +.Vb 1 +\& bool strnEQ(char* s1, char* s2, STRLEN len) +.Ve +.IP "strnNE" 8 +.IX Xref "strnNE" +.IX Item "strnNE" +Test two \f(CW\*(C`NUL\*(C'\fR\-terminated strings to see if they are different. The \f(CW\*(C`len\*(C'\fR +parameter indicates the number of bytes to compare. Returns true or false. (A +wrapper for \f(CW\*(C`strncmp\*(C'\fR). +.Sp +.Vb 1 +\& bool strnNE(char* s1, char* s2, STRLEN len) +.Ve +.IP "sv_destroyable" 8 +.IX Xref "sv_destroyable" +.IX Item "sv_destroyable" +Dummy routine which reports that object can be destroyed when there is no +sharing module present. It ignores its single \s-1SV\s0 argument, and returns +\&'true'. Exists to avoid test for a \f(CW\*(C`NULL\*(C'\fR function pointer and because it +could potentially warn under some level of strict-ness. +.Sp +.Vb 1 +\& bool sv_destroyable(SV *sv) +.Ve +.IP "sv_nosharing" 8 +.IX Xref "sv_nosharing" +.IX Item "sv_nosharing" +Dummy routine which \*(L"shares\*(R" an \s-1SV\s0 when there is no sharing module present. +Or \*(L"locks\*(R" it. Or \*(L"unlocks\*(R" it. In other +words, ignores its single \s-1SV\s0 argument. +Exists to avoid test for a \f(CW\*(C`NULL\*(C'\fR function pointer and because it could +potentially warn under some level of strict-ness. +.Sp +.Vb 1 +\& void sv_nosharing(SV *sv) +.Ve +.IP "\s-1UNLIKELY\s0" 8 +.IX Xref "UNLIKELY" +.IX Item "UNLIKELY" +Returns the input unchanged, but at the same time it gives a branch prediction +hint to the compiler that this condition is likely to be false. +.IP "vmess" 8 +.IX Xref "vmess" +.IX Item "vmess" +\&\f(CW\*(C`pat\*(C'\fR and \f(CW\*(C`args\*(C'\fR are a sprintf-style format pattern and encapsulated +argument list, respectively. These are used to generate a string message. If +the +message does not end with a newline, then it will be extended with +some indication of the current location in the code, as described for +\&\*(L"mess_sv\*(R". +.Sp +Normally, the resulting message is returned in a new mortal \s-1SV.\s0 +During global destruction a single \s-1SV\s0 may be shared between uses of +this function. +.Sp +.Vb 1 +\& SV* vmess(const char* pat, va_list* args) +.Ve +.SH "MRO Functions" +.IX Header "MRO Functions" +These functions are related to the method resolution order of perl classes +Also see perlmroapi. +.IP "mro_get_linear_isa" 8 +.IX Xref "mro_get_linear_isa" +.IX Item "mro_get_linear_isa" +Returns the mro linearisation for the given stash. By default, this +will be whatever \f(CW\*(C`mro_get_linear_isa_dfs\*(C'\fR returns unless some +other \s-1MRO\s0 is in effect for the stash. The return value is a +read-only AV*. +.Sp +You are responsible for \f(CW\*(C`SvREFCNT_inc()\*(C'\fR on the +return value if you plan to store it anywhere +semi-permanently (otherwise it might be deleted +out from under you the next time the cache is +invalidated). +.Sp +.Vb 1 +\& AV* mro_get_linear_isa(HV* stash) +.Ve +.IP "mro_method_changed_in" 8 +.IX Xref "mro_method_changed_in" +.IX Item "mro_method_changed_in" +Invalidates method caching on any child classes +of the given stash, so that they might notice +the changes in this one. +.Sp +Ideally, all instances of \f(CW\*(C`PL_sub_generation++\*(C'\fR in +perl source outside of \fImro.c\fR should be +replaced by calls to this. +.Sp +Perl automatically handles most of the common +ways a method might be redefined. However, there +are a few ways you could change a method in a stash +without the cache code noticing, in which case you +need to call this method afterwards: +.Sp +1) Directly manipulating the stash \s-1HV\s0 entries from +\&\s-1XS\s0 code. +.Sp +2) Assigning a reference to a readonly scalar +constant into a stash entry in order to create +a constant subroutine (like \fIconstant.pm\fR +does). +.Sp +This same method is available from pure perl +via, \f(CW\*(C`mro::method_changed_in(classname)\*(C'\fR. +.Sp +.Vb 1 +\& void mro_method_changed_in(HV* stash) +.Ve +.IP "mro_register" 8 +.IX Xref "mro_register" +.IX Item "mro_register" +Registers a custom mro plugin. See perlmroapi for details on this and other +mro functions. +.Sp +\&\s-1NOTE:\s0 this function must be explicitly called as Perl_mro_register with an aTHX_ parameter. +.Sp +.Vb 2 +\& void Perl_mro_register(pTHX_ +\& const struct mro_alg *mro) +.Ve +.SH "Multicall Functions" +.IX Header "Multicall Functions" +.IP "dMULTICALL" 8 +.IX Xref "dMULTICALL" +.IX Item "dMULTICALL" +Declare local variables for a multicall. See \*(L"\s-1LIGHTWEIGHT CALLBACKS\*(R"\s0 in perlcall. +.Sp +.Vb 1 +\& dMULTICALL; +.Ve +.IP "\s-1MULTICALL\s0" 8 +.IX Xref "MULTICALL" +.IX Item "MULTICALL" +Make a lightweight callback. See \*(L"\s-1LIGHTWEIGHT CALLBACKS\*(R"\s0 in perlcall. +.Sp +.Vb 1 +\& MULTICALL; +.Ve +.IP "\s-1POP_MULTICALL\s0" 8 +.IX Xref "POP_MULTICALL" +.IX Item "POP_MULTICALL" +Closing bracket for a lightweight callback. +See \*(L"\s-1LIGHTWEIGHT CALLBACKS\*(R"\s0 in perlcall. +.Sp +.Vb 1 +\& POP_MULTICALL; +.Ve +.IP "\s-1PUSH_MULTICALL\s0" 8 +.IX Xref "PUSH_MULTICALL" +.IX Item "PUSH_MULTICALL" +Opening bracket for a lightweight callback. +See \*(L"\s-1LIGHTWEIGHT CALLBACKS\*(R"\s0 in perlcall. +.Sp +.Vb 1 +\& PUSH_MULTICALL(CV* the_cv); +.Ve +.SH "Numeric functions" +.IX Header "Numeric functions" +.IP "grok_bin" 8 +.IX Xref "grok_bin" +.IX Item "grok_bin" +converts a string representing a binary number to numeric form. +.Sp +On entry \f(CW\*(C`start\*(C'\fR and \f(CW*len_p\fR give the string to scan, \f(CW*flags\fR gives +conversion flags, and \f(CW\*(C`result\*(C'\fR should be \f(CW\*(C`NULL\*(C'\fR or a pointer to an \s-1NV.\s0 The +scan stops at the end of the string, or at just before the first invalid +character. Unless \f(CW\*(C`PERL_SCAN_SILENT_ILLDIGIT\*(C'\fR is set in \f(CW*flags\fR, +encountering an invalid character (except \s-1NUL\s0) will also trigger a warning. On +return \f(CW*len_p\fR is set to the length of the scanned string, and \f(CW*flags\fR +gives output flags. +.Sp +If the value is <= \f(CW\*(C`UV_MAX\*(C'\fR it is returned as a \s-1UV,\s0 the output flags are clear, +and nothing is written to \f(CW*result\fR. If the value is > \f(CW\*(C`UV_MAX\*(C'\fR, \f(CW\*(C`grok_bin\*(C'\fR +returns \f(CW\*(C`UV_MAX\*(C'\fR, sets \f(CW\*(C`PERL_SCAN_GREATER_THAN_UV_MAX\*(C'\fR in the output flags, +and writes an approximation of the correct value into \f(CW*result\fR (which is an +\&\s-1NV\s0; or the approximation is discarded if \f(CW\*(C`result\*(C'\fR is \s-1NULL\s0). +.Sp +The binary number may optionally be prefixed with \f(CW"0b"\fR or \f(CW"b"\fR unless +\&\f(CW\*(C`PERL_SCAN_DISALLOW_PREFIX\*(C'\fR is set in \f(CW*flags\fR on entry. +.Sp +If \f(CW\*(C`PERL_SCAN_ALLOW_UNDERSCORES\*(C'\fR is set in \f(CW*flags\fR then any or all pairs of +digits may be separated from each other by a single underscore; also a single +leading underscore is accepted. +.Sp +.Vb 2 +\& UV grok_bin(const char* start, STRLEN* len_p, +\& I32* flags, NV *result) +.Ve +.IP "grok_hex" 8 +.IX Xref "grok_hex" +.IX Item "grok_hex" +converts a string representing a hex number to numeric form. +.Sp +On entry \f(CW\*(C`start\*(C'\fR and \f(CW*len_p\fR give the string to scan, \f(CW*flags\fR gives +conversion flags, and \f(CW\*(C`result\*(C'\fR should be \f(CW\*(C`NULL\*(C'\fR or a pointer to an \s-1NV.\s0 The +scan stops at the end of the string, or at just before the first invalid +character. Unless \f(CW\*(C`PERL_SCAN_SILENT_ILLDIGIT\*(C'\fR is set in \f(CW*flags\fR, +encountering an invalid character (except \s-1NUL\s0) will also trigger a warning. On +return \f(CW*len_p\fR is set to the length of the scanned string, and \f(CW*flags\fR +gives output flags. +.Sp +If the value is <= \f(CW\*(C`UV_MAX\*(C'\fR it is returned as a \s-1UV,\s0 the output flags are clear, +and nothing is written to \f(CW*result\fR. If the value is > \f(CW\*(C`UV_MAX\*(C'\fR, \f(CW\*(C`grok_hex\*(C'\fR +returns \f(CW\*(C`UV_MAX\*(C'\fR, sets \f(CW\*(C`PERL_SCAN_GREATER_THAN_UV_MAX\*(C'\fR in the output flags, +and writes an approximation of the correct value into \f(CW*result\fR (which is an +\&\s-1NV\s0; or the approximation is discarded if \f(CW\*(C`result\*(C'\fR is \s-1NULL\s0). +.Sp +The hex number may optionally be prefixed with \f(CW"0x"\fR or \f(CW"x"\fR unless +\&\f(CW\*(C`PERL_SCAN_DISALLOW_PREFIX\*(C'\fR is set in \f(CW*flags\fR on entry. +.Sp +If \f(CW\*(C`PERL_SCAN_ALLOW_UNDERSCORES\*(C'\fR is set in \f(CW*flags\fR then any or all pairs of +digits may be separated from each other by a single underscore; also a single +leading underscore is accepted. +.Sp +.Vb 2 +\& UV grok_hex(const char* start, STRLEN* len_p, +\& I32* flags, NV *result) +.Ve +.IP "grok_infnan" 8 +.IX Xref "grok_infnan" +.IX Item "grok_infnan" +Helper for \f(CW\*(C`grok_number()\*(C'\fR, accepts various ways of spelling \*(L"infinity\*(R" +or \*(L"not a number\*(R", and returns one of the following flag combinations: +.Sp +.Vb 5 +\& IS_NUMBER_INFINITY +\& IS_NUMBER_NAN +\& IS_NUMBER_INFINITY | IS_NUMBER_NEG +\& IS_NUMBER_NAN | IS_NUMBER_NEG +\& 0 +.Ve +.Sp +possibly |\-ed with \f(CW\*(C`IS_NUMBER_TRAILING\*(C'\fR. +.Sp +If an infinity or a not-a-number is recognized, \f(CW*sp\fR will point to +one byte past the end of the recognized string. If the recognition fails, +zero is returned, and \f(CW*sp\fR will not move. +.Sp +.Vb 1 +\& int grok_infnan(const char** sp, const char *send) +.Ve +.IP "grok_number" 8 +.IX Xref "grok_number" +.IX Item "grok_number" +Identical to \f(CW\*(C`grok_number_flags()\*(C'\fR with \f(CW\*(C`flags\*(C'\fR set to zero. +.Sp +.Vb 2 +\& int grok_number(const char *pv, STRLEN len, +\& UV *valuep) +.Ve +.IP "grok_number_flags" 8 +.IX Xref "grok_number_flags" +.IX Item "grok_number_flags" +Recognise (or not) a number. The type of the number is returned +(0 if unrecognised), otherwise it is a bit-ORed combination of +\&\f(CW\*(C`IS_NUMBER_IN_UV\*(C'\fR, \f(CW\*(C`IS_NUMBER_GREATER_THAN_UV_MAX\*(C'\fR, \f(CW\*(C`IS_NUMBER_NOT_INT\*(C'\fR, +\&\f(CW\*(C`IS_NUMBER_NEG\*(C'\fR, \f(CW\*(C`IS_NUMBER_INFINITY\*(C'\fR, \f(CW\*(C`IS_NUMBER_NAN\*(C'\fR (defined in perl.h). +.Sp +If the value of the number can fit in a \s-1UV,\s0 it is returned in \f(CW*valuep\fR. +\&\f(CW\*(C`IS_NUMBER_IN_UV\*(C'\fR will be set to indicate that \f(CW*valuep\fR is valid, \f(CW\*(C`IS_NUMBER_IN_UV\*(C'\fR +will never be set unless \f(CW*valuep\fR is valid, but \f(CW*valuep\fR may have been assigned +to during processing even though \f(CW\*(C`IS_NUMBER_IN_UV\*(C'\fR is not set on return. +If \f(CW\*(C`valuep\*(C'\fR is \f(CW\*(C`NULL\*(C'\fR, \f(CW\*(C`IS_NUMBER_IN_UV\*(C'\fR will be set for the same cases as when +\&\f(CW\*(C`valuep\*(C'\fR is non\-\f(CW\*(C`NULL\*(C'\fR, but no actual assignment (or \s-1SEGV\s0) will occur. +.Sp +\&\f(CW\*(C`IS_NUMBER_NOT_INT\*(C'\fR will be set with \f(CW\*(C`IS_NUMBER_IN_UV\*(C'\fR if trailing decimals were +seen (in which case \f(CW*valuep\fR gives the true value truncated to an integer), and +\&\f(CW\*(C`IS_NUMBER_NEG\*(C'\fR if the number is negative (in which case \f(CW*valuep\fR holds the +absolute value). \f(CW\*(C`IS_NUMBER_IN_UV\*(C'\fR is not set if e notation was used or the +number is larger than a \s-1UV.\s0 +.Sp +\&\f(CW\*(C`flags\*(C'\fR allows only \f(CW\*(C`PERL_SCAN_TRAILING\*(C'\fR, which allows for trailing +non-numeric text on an otherwise successful \fIgrok\fR, setting +\&\f(CW\*(C`IS_NUMBER_TRAILING\*(C'\fR on the result. +.Sp +.Vb 2 +\& int grok_number_flags(const char *pv, STRLEN len, +\& UV *valuep, U32 flags) +.Ve +.IP "\s-1GROK_NUMERIC_RADIX\s0" 8 +.IX Xref "GROK_NUMERIC_RADIX" +.IX Item "GROK_NUMERIC_RADIX" +A synonym for \*(L"grok_numeric_radix\*(R" +.Sp +.Vb 2 +\& bool GROK_NUMERIC_RADIX(NN const char **sp, +\& NN const char *send) +.Ve +.IP "grok_numeric_radix" 8 +.IX Xref "grok_numeric_radix" +.IX Item "grok_numeric_radix" +Scan and skip for a numeric decimal separator (radix). +.Sp +.Vb 2 +\& bool grok_numeric_radix(const char **sp, +\& const char *send) +.Ve +.IP "grok_oct" 8 +.IX Xref "grok_oct" +.IX Item "grok_oct" +converts a string representing an octal number to numeric form. +.Sp +On entry \f(CW\*(C`start\*(C'\fR and \f(CW*len_p\fR give the string to scan, \f(CW*flags\fR gives +conversion flags, and \f(CW\*(C`result\*(C'\fR should be \f(CW\*(C`NULL\*(C'\fR or a pointer to an \s-1NV.\s0 The +scan stops at the end of the string, or at just before the first invalid +character. Unless \f(CW\*(C`PERL_SCAN_SILENT_ILLDIGIT\*(C'\fR is set in \f(CW*flags\fR, +encountering an invalid character (except \s-1NUL\s0) will also trigger a warning. On +return \f(CW*len_p\fR is set to the length of the scanned string, and \f(CW*flags\fR +gives output flags. +.Sp +If the value is <= \f(CW\*(C`UV_MAX\*(C'\fR it is returned as a \s-1UV,\s0 the output flags are clear, +and nothing is written to \f(CW*result\fR. If the value is > \f(CW\*(C`UV_MAX\*(C'\fR, \f(CW\*(C`grok_oct\*(C'\fR +returns \f(CW\*(C`UV_MAX\*(C'\fR, sets \f(CW\*(C`PERL_SCAN_GREATER_THAN_UV_MAX\*(C'\fR in the output flags, +and writes an approximation of the correct value into \f(CW*result\fR (which is an +\&\s-1NV\s0; or the approximation is discarded if \f(CW\*(C`result\*(C'\fR is \s-1NULL\s0). +.Sp +If \f(CW\*(C`PERL_SCAN_ALLOW_UNDERSCORES\*(C'\fR is set in \f(CW*flags\fR then any or all pairs of +digits may be separated from each other by a single underscore; also a single +leading underscore is accepted. +.Sp +The \f(CW\*(C`PERL_SCAN_DISALLOW_PREFIX\*(C'\fR flag is always treated as being set for +this function. +.Sp +.Vb 2 +\& UV grok_oct(const char* start, STRLEN* len_p, +\& I32* flags, NV *result) +.Ve +.IP "isinfnan" 8 +.IX Xref "isinfnan" +.IX Item "isinfnan" +\&\f(CW\*(C`Perl_isinfnan()\*(C'\fR is a utility function that returns true if the \s-1NV\s0 +argument is either an infinity or a \f(CW\*(C`NaN\*(C'\fR, false otherwise. To test +in more detail, use \f(CW\*(C`Perl_isinf()\*(C'\fR and \f(CW\*(C`Perl_isnan()\*(C'\fR. +.Sp +This is also the logical inverse of \fBPerl_isfinite()\fR. +.Sp +.Vb 1 +\& bool isinfnan(NV nv) +.Ve +.IP "\s-1IS_NUMBER_GREATER_THAN_UV_MAX\s0 bool \s-1IS_NUMBER_GREATER_THAN_UV_MAX\s0" 8 +.IX Xref "IS_NUMBER_GREATER_THAN_UV_MAX" +.IX Item "IS_NUMBER_GREATER_THAN_UV_MAX bool IS_NUMBER_GREATER_THAN_UV_MAX" +.PD 0 +.IP "\s-1IS_NUMBER_INFINITY\s0 bool \s-1IS_NUMBER_INFINITY\s0" 8 +.IX Xref "IS_NUMBER_INFINITY" +.IX Item "IS_NUMBER_INFINITY bool IS_NUMBER_INFINITY" +.IP "\s-1IS_NUMBER_IN_UV\s0 bool \s-1IS_NUMBER_IN_UV\s0" 8 +.IX Xref "IS_NUMBER_IN_UV" +.IX Item "IS_NUMBER_IN_UV bool IS_NUMBER_IN_UV" +.IP "\s-1IS_NUMBER_NAN\s0 bool \s-1IS_NUMBER_NAN\s0" 8 +.IX Xref "IS_NUMBER_NAN" +.IX Item "IS_NUMBER_NAN bool IS_NUMBER_NAN" +.IP "\s-1IS_NUMBER_NEG\s0 bool \s-1IS_NUMBER_NEG\s0" 8 +.IX Xref "IS_NUMBER_NEG" +.IX Item "IS_NUMBER_NEG bool IS_NUMBER_NEG" +.IP "\s-1IS_NUMBER_NOT_INT\s0" 8 +.IX Xref "IS_NUMBER_NOT_INT" +.IX Item "IS_NUMBER_NOT_INT" +.PD +.Vb 1 +\& bool IS_NUMBER_NOT_INT +.Ve +.IP "my_strtod" 8 +.IX Xref "my_strtod" +.IX Item "my_strtod" +This function is equivalent to the libc \fBstrtod()\fR function, and is available +even on platforms that lack plain \fBstrtod()\fR. Its return value is the best +available precision depending on platform capabilities and \fIConfigure\fR +options. +.Sp +It properly handles the locale radix character, meaning it expects a dot except +when called from within the scope of \f(CW\*(C`use\ locale\*(C'\fR, in which case the radix +character should be that specified by the current locale. +.Sp +The synonym \fBStrtod()\fR may be used instead. +.Sp +.Vb 1 +\& NV my_strtod(const char * const s, char ** e) +.Ve +.IP "\s-1PERL_ABS\s0" 8 +.IX Xref "PERL_ABS" +.IX Item "PERL_ABS" +Typeless \f(CW\*(C`abs\*(C'\fR or \f(CW\*(C`fabs\*(C'\fR, \fIetc\fR. (The usage below indicates it is for +integers, but it works for any type.) Use instead of these, since the C +library ones force their argument to be what it is expecting, potentially +leading to disaster. But also beware that this evaluates its argument twice, +so no \f(CW\*(C`x++\*(C'\fR. +.Sp +.Vb 1 +\& int PERL_ABS(int) +.Ve +.IP "\s-1PERL_INT_MAX\s0" 8 +.IX Xref "PERL_INT_MAX" +.IX Item "PERL_INT_MAX" +This and +\&\f(CW\*(C`PERL_INT_MIN\*(C'\fR, +\&\f(CW\*(C`PERL_LONG_MAX\*(C'\fR, +\&\f(CW\*(C`PERL_LONG_MIN\*(C'\fR, +\&\f(CW\*(C`PERL_QUAD_MAX\*(C'\fR, +\&\f(CW\*(C`PERL_SHORT_MAX\*(C'\fR, +\&\f(CW\*(C`PERL_SHORT_MIN\*(C'\fR, +\&\f(CW\*(C`PERL_UCHAR_MAX\*(C'\fR, +\&\f(CW\*(C`PERL_UCHAR_MIN\*(C'\fR, +\&\f(CW\*(C`PERL_UINT_MAX\*(C'\fR, +\&\f(CW\*(C`PERL_ULONG_MAX\*(C'\fR, +\&\f(CW\*(C`PERL_ULONG_MIN\*(C'\fR, +\&\f(CW\*(C`PERL_UQUAD_MAX\*(C'\fR, +\&\f(CW\*(C`PERL_UQUAD_MIN\*(C'\fR, +\&\f(CW\*(C`PERL_USHORT_MAX\*(C'\fR, +\&\f(CW\*(C`PERL_USHORT_MIN\*(C'\fR, +\&\f(CW\*(C`PERL_QUAD_MIN\*(C'\fR +give the largest and smallest number representable in the current +platform in variables of the corresponding types. +.Sp +For signed types, the smallest representable number is the most negative +number, the one furthest away from zero. +.Sp +For C99 and later compilers, these correspond to things like \f(CW\*(C`INT_MAX\*(C'\fR, which +are available to the C code. But these constants, furnished by Perl, +allow code compiled on earlier compilers to portably have access to the same +constants. +.IP "Perl_signbit" 8 +.IX Xref "Perl_signbit" +.IX Item "Perl_signbit" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Return a non-zero integer if the sign bit on an \s-1NV\s0 is set, and 0 if +it is not. +.Sp +If \fIConfigure\fR detects this system has a \f(CW\*(C`signbit()\*(C'\fR that will work with +our NVs, then we just use it via the \f(CW\*(C`#define\*(C'\fR in \fIperl.h\fR. Otherwise, +fall back on this implementation. The main use of this function +is catching \f(CW\*(C`\-0.0\*(C'\fR. +.Sp +\&\f(CW\*(C`Configure\*(C'\fR notes: This function is called \f(CW\*(AqPerl_signbit\*(Aq\fR instead of a +plain \f(CW\*(Aqsignbit\*(Aq\fR because it is easy to imagine a system having a \f(CW\*(C`signbit()\*(C'\fR +function or macro that doesn't happen to work with our particular choice +of NVs. We shouldn't just re\-\f(CW\*(C`#define\*(C'\fR \f(CW\*(C`signbit\*(C'\fR as \f(CW\*(C`Perl_signbit\*(C'\fR and expect +the standard system headers to be happy. Also, this is a no-context +function (no \f(CW\*(C`pTHX_\*(C'\fR) because \f(CW\*(C`Perl_signbit()\*(C'\fR is usually re\-\f(CW\*(C`#defined\*(C'\fR in +\&\fIperl.h\fR as a simple macro call to the system's \f(CW\*(C`signbit()\*(C'\fR. +Users should just always call \f(CW\*(C`Perl_signbit()\*(C'\fR. +.Sp +.Vb 1 +\& int Perl_signbit(NV f) +.Ve +.IP "scan_bin" 8 +.IX Xref "scan_bin" +.IX Item "scan_bin" +For backwards compatibility. Use \f(CW\*(C`grok_bin\*(C'\fR instead. +.Sp +.Vb 2 +\& NV scan_bin(const char* start, STRLEN len, +\& STRLEN* retlen) +.Ve +.IP "scan_hex" 8 +.IX Xref "scan_hex" +.IX Item "scan_hex" +For backwards compatibility. Use \f(CW\*(C`grok_hex\*(C'\fR instead. +.Sp +.Vb 2 +\& NV scan_hex(const char* start, STRLEN len, +\& STRLEN* retlen) +.Ve +.IP "scan_oct" 8 +.IX Xref "scan_oct" +.IX Item "scan_oct" +For backwards compatibility. Use \f(CW\*(C`grok_oct\*(C'\fR instead. +.Sp +.Vb 2 +\& NV scan_oct(const char* start, STRLEN len, +\& STRLEN* retlen) +.Ve +.IP "Strtod" 8 +.IX Xref "Strtod" +.IX Item "Strtod" +This is a synonym for \*(L"my_strtod\*(R". +.Sp +.Vb 2 +\& NV Strtod(NN const char * const s, +\& NULLOK char ** e) +.Ve +.IP "Strtol" 8 +.IX Xref "Strtol" +.IX Item "Strtol" +Platform and configuration independent \f(CW\*(C`strtol\*(C'\fR. This expands to the +appropriate \f(CW\*(C`strotol\*(C'\fR\-like function based on the platform and \fIConfigure\fR +options>. For example it could expand to \f(CW\*(C`strtoll\*(C'\fR or \f(CW\*(C`strtoq\*(C'\fR instead of +\&\f(CW\*(C`strtol\*(C'\fR. +.Sp +.Vb 2 +\& NV Strtol(NN const char * const s, +\& NULLOK char ** e, int base) +.Ve +.IP "Strtoul" 8 +.IX Xref "Strtoul" +.IX Item "Strtoul" +Platform and configuration independent \f(CW\*(C`strtoul\*(C'\fR. This expands to the +appropriate \f(CW\*(C`strotoul\*(C'\fR\-like function based on the platform and \fIConfigure\fR +options>. For example it could expand to \f(CW\*(C`strtoull\*(C'\fR or \f(CW\*(C`strtouq\*(C'\fR instead of +\&\f(CW\*(C`strtoul\*(C'\fR. +.Sp +.Vb 2 +\& NV Strtoul(NN const char * const s, +\& NULLOK char ** e, int base) +.Ve +.SH "Obsolete backwards compatibility functions" +.IX Header "Obsolete backwards compatibility functions" +Some of these are also deprecated. You can exclude these from +your compiled Perl by adding this option to Configure: +\&\f(CW\*(C`\-Accflags=\*(Aq\-DNO_MATHOMS\*(Aq\*(C'\fR +.IP "custom_op_desc" 8 +.IX Xref "custom_op_desc" +.IX Item "custom_op_desc" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Return the description of a given custom op. This was once used by the +\&\f(CW\*(C`OP_DESC\*(C'\fR macro, but is no longer: it has only been kept for +compatibility, and should not be used. +.Sp +.Vb 1 +\& const char * custom_op_desc(const OP *o) +.Ve +.IP "custom_op_name" 8 +.IX Xref "custom_op_name" +.IX Item "custom_op_name" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Return the name for a given custom op. This was once used by the \f(CW\*(C`OP_NAME\*(C'\fR +macro, but is no longer: it has only been kept for compatibility, and +should not be used. +.Sp +.Vb 1 +\& const char * custom_op_name(const OP *o) +.Ve +.IP "gv_fetchmethod" 8 +.IX Xref "gv_fetchmethod" +.IX Item "gv_fetchmethod" +See \*(L"gv_fetchmethod_autoload\*(R". +.Sp +.Vb 1 +\& GV* gv_fetchmethod(HV* stash, const char* name) +.Ve +.IP "is_utf8_char" 8 +.IX Xref "is_utf8_char" +.IX Item "is_utf8_char" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Tests if some arbitrary number of bytes begins in a valid \s-1UTF\-8\s0 +character. Note that an \s-1INVARIANT\s0 (i.e. \s-1ASCII\s0 on non-EBCDIC machines) +character is a valid \s-1UTF\-8\s0 character. The actual number of bytes in the \s-1UTF\-8\s0 +character will be returned if it is valid, otherwise 0. +.Sp +This function is deprecated due to the possibility that malformed input could +cause reading beyond the end of the input buffer. Use \*(L"isUTF8_CHAR\*(R" +instead. +.Sp +.Vb 1 +\& STRLEN is_utf8_char(const U8 *s) +.Ve +.IP "is_utf8_char_buf" 8 +.IX Xref "is_utf8_char_buf" +.IX Item "is_utf8_char_buf" +This is identical to the macro \*(L"isUTF8_CHAR\*(R" in perlapi. +.Sp +.Vb 2 +\& STRLEN is_utf8_char_buf(const U8 *buf, +\& const U8 *buf_end) +.Ve +.IP "pack_cat" 8 +.IX Xref "pack_cat" +.IX Item "pack_cat" +The engine implementing \f(CW\*(C`pack()\*(C'\fR Perl function. Note: parameters +\&\f(CW\*(C`next_in_list\*(C'\fR and \f(CW\*(C`flags\*(C'\fR are not used. This call should not be used; use +\&\f(CW\*(C`packlist\*(C'\fR instead. +.Sp +.Vb 4 +\& void pack_cat(SV *cat, const char *pat, +\& const char *patend, SV **beglist, +\& SV **endlist, SV ***next_in_list, +\& U32 flags) +.Ve +.IP "pad_compname_type" 8 +.IX Xref "pad_compname_type" +.IX Item "pad_compname_type" +Looks up the type of the lexical variable at position \f(CW\*(C`po\*(C'\fR in the +currently-compiling pad. If the variable is typed, the stash of the +class to which it is typed is returned. If not, \f(CW\*(C`NULL\*(C'\fR is returned. +.Sp +.Vb 1 +\& HV* pad_compname_type(const PADOFFSET po) +.Ve +.IP "sv_2pvbyte_nolen" 8 +.IX Xref "sv_2pvbyte_nolen" +.IX Item "sv_2pvbyte_nolen" +Return a pointer to the byte-encoded representation of the \s-1SV.\s0 +May cause the \s-1SV\s0 to be downgraded from \s-1UTF\-8\s0 as a side-effect. +.Sp +Usually accessed via the \f(CW\*(C`SvPVbyte_nolen\*(C'\fR macro. +.Sp +.Vb 1 +\& char* sv_2pvbyte_nolen(SV* sv) +.Ve +.IP "sv_2pvutf8_nolen" 8 +.IX Xref "sv_2pvutf8_nolen" +.IX Item "sv_2pvutf8_nolen" +Return a pointer to the UTF\-8\-encoded representation of the \s-1SV.\s0 +May cause the \s-1SV\s0 to be upgraded to \s-1UTF\-8\s0 as a side-effect. +.Sp +Usually accessed via the \f(CW\*(C`SvPVutf8_nolen\*(C'\fR macro. +.Sp +.Vb 1 +\& char* sv_2pvutf8_nolen(SV* sv) +.Ve +.IP "sv_2pv_nolen" 8 +.IX Xref "sv_2pv_nolen" +.IX Item "sv_2pv_nolen" +Like \f(CW\*(C`sv_2pv()\*(C'\fR, but doesn't return the length too. You should usually +use the macro wrapper \f(CW\*(C`SvPV_nolen(sv)\*(C'\fR instead. +.Sp +.Vb 1 +\& char* sv_2pv_nolen(SV* sv) +.Ve +.IP "sv_catpvn_mg" 8 +.IX Xref "sv_catpvn_mg" +.IX Item "sv_catpvn_mg" +Like \f(CW\*(C`sv_catpvn\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 2 +\& void sv_catpvn_mg(SV *sv, const char *ptr, +\& STRLEN len) +.Ve +.IP "sv_catsv_mg" 8 +.IX Xref "sv_catsv_mg" +.IX Item "sv_catsv_mg" +Like \f(CW\*(C`sv_catsv\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 1 +\& void sv_catsv_mg(SV *dsv, SV *ssv) +.Ve +.IP "sv_force_normal" 8 +.IX Xref "sv_force_normal" +.IX Item "sv_force_normal" +Undo various types of fakery on an \s-1SV:\s0 if the \s-1PV\s0 is a shared string, make +a private copy; if we're a ref, stop refing; if we're a glob, downgrade to +an \f(CW\*(C`xpvmg\*(C'\fR. See also \f(CW"sv_force_normal_flags"\fR. +.Sp +.Vb 1 +\& void sv_force_normal(SV *sv) +.Ve +.IP "sv_iv" 8 +.IX Xref "sv_iv" +.IX Item "sv_iv" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +A private implementation of the \f(CW\*(C`SvIVx\*(C'\fR macro for compilers which can't +cope with complex macro expressions. Always use the macro instead. +.Sp +.Vb 1 +\& IV sv_iv(SV* sv) +.Ve +.IP "sv_nolocking" 8 +.IX Xref "sv_nolocking" +.IX Item "sv_nolocking" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Dummy routine which \*(L"locks\*(R" an \s-1SV\s0 when there is no locking module present. +Exists to avoid test for a \f(CW\*(C`NULL\*(C'\fR function pointer and because it could +potentially warn under some level of strict-ness. +.Sp +\&\*(L"Superseded\*(R" by \f(CW\*(C`sv_nosharing()\*(C'\fR. +.Sp +.Vb 1 +\& void sv_nolocking(SV *sv) +.Ve +.IP "sv_nounlocking" 8 +.IX Xref "sv_nounlocking" +.IX Item "sv_nounlocking" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Dummy routine which \*(L"unlocks\*(R" an \s-1SV\s0 when there is no locking module present. +Exists to avoid test for a \f(CW\*(C`NULL\*(C'\fR function pointer and because it could +potentially warn under some level of strict-ness. +.Sp +\&\*(L"Superseded\*(R" by \f(CW\*(C`sv_nosharing()\*(C'\fR. +.Sp +.Vb 1 +\& void sv_nounlocking(SV *sv) +.Ve +.IP "sv_nv" 8 +.IX Xref "sv_nv" +.IX Item "sv_nv" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +A private implementation of the \f(CW\*(C`SvNVx\*(C'\fR macro for compilers which can't +cope with complex macro expressions. Always use the macro instead. +.Sp +.Vb 1 +\& NV sv_nv(SV* sv) +.Ve +.IP "sv_pv" 8 +.IX Xref "sv_pv" +.IX Item "sv_pv" +Use the \f(CW\*(C`SvPV_nolen\*(C'\fR macro instead +.Sp +.Vb 1 +\& char* sv_pv(SV *sv) +.Ve +.IP "sv_pvbyte" 8 +.IX Xref "sv_pvbyte" +.IX Item "sv_pvbyte" +Use \f(CW\*(C`SvPVbyte_nolen\*(C'\fR instead. +.Sp +.Vb 1 +\& char* sv_pvbyte(SV *sv) +.Ve +.IP "sv_pvbyten" 8 +.IX Xref "sv_pvbyten" +.IX Item "sv_pvbyten" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +A private implementation of the \f(CW\*(C`SvPVbyte\*(C'\fR macro for compilers +which can't cope with complex macro expressions. Always use the macro +instead. +.Sp +.Vb 1 +\& char* sv_pvbyten(SV *sv, STRLEN *lp) +.Ve +.IP "sv_pvn" 8 +.IX Xref "sv_pvn" +.IX Item "sv_pvn" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +A private implementation of the \f(CW\*(C`SvPV\*(C'\fR macro for compilers which can't +cope with complex macro expressions. Always use the macro instead. +.Sp +.Vb 1 +\& char* sv_pvn(SV *sv, STRLEN *lp) +.Ve +.IP "sv_pvutf8" 8 +.IX Xref "sv_pvutf8" +.IX Item "sv_pvutf8" +Use the \f(CW\*(C`SvPVutf8_nolen\*(C'\fR macro instead +.Sp +.Vb 1 +\& char* sv_pvutf8(SV *sv) +.Ve +.IP "sv_pvutf8n" 8 +.IX Xref "sv_pvutf8n" +.IX Item "sv_pvutf8n" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +A private implementation of the \f(CW\*(C`SvPVutf8\*(C'\fR macro for compilers +which can't cope with complex macro expressions. Always use the macro +instead. +.Sp +.Vb 1 +\& char* sv_pvutf8n(SV *sv, STRLEN *lp) +.Ve +.IP "sv_taint" 8 +.IX Xref "sv_taint" +.IX Item "sv_taint" +Taint an \s-1SV.\s0 Use \f(CW\*(C`SvTAINTED_on\*(C'\fR instead. +.Sp +.Vb 1 +\& void sv_taint(SV* sv) +.Ve +.IP "sv_unref" 8 +.IX Xref "sv_unref" +.IX Item "sv_unref" +Unsets the \s-1RV\s0 status of the \s-1SV,\s0 and decrements the reference count of +whatever was being referenced by the \s-1RV.\s0 This can almost be thought of +as a reversal of \f(CW\*(C`newSVrv\*(C'\fR. This is \f(CW\*(C`sv_unref_flags\*(C'\fR with the \f(CW\*(C`flag\*(C'\fR +being zero. See \f(CW"SvROK_off"\fR. +.Sp +.Vb 1 +\& void sv_unref(SV* sv) +.Ve +.IP "sv_usepvn" 8 +.IX Xref "sv_usepvn" +.IX Item "sv_usepvn" +Tells an \s-1SV\s0 to use \f(CW\*(C`ptr\*(C'\fR to find its string value. Implemented by +calling \f(CW\*(C`sv_usepvn_flags\*(C'\fR with \f(CW\*(C`flags\*(C'\fR of 0, hence does not handle 'set' +magic. See \f(CW"sv_usepvn_flags"\fR. +.Sp +.Vb 1 +\& void sv_usepvn(SV* sv, char* ptr, STRLEN len) +.Ve +.IP "sv_usepvn_mg" 8 +.IX Xref "sv_usepvn_mg" +.IX Item "sv_usepvn_mg" +Like \f(CW\*(C`sv_usepvn\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 1 +\& void sv_usepvn_mg(SV *sv, char *ptr, STRLEN len) +.Ve +.IP "sv_uv" 8 +.IX Xref "sv_uv" +.IX Item "sv_uv" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +A private implementation of the \f(CW\*(C`SvUVx\*(C'\fR macro for compilers which can't +cope with complex macro expressions. Always use the macro instead. +.Sp +.Vb 1 +\& UV sv_uv(SV* sv) +.Ve +.IP "unpack_str" 8 +.IX Xref "unpack_str" +.IX Item "unpack_str" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +The engine implementing \f(CW\*(C`unpack()\*(C'\fR Perl function. Note: parameters \f(CW\*(C`strbeg\*(C'\fR, +\&\f(CW\*(C`new_s\*(C'\fR and \f(CW\*(C`ocnt\*(C'\fR are not used. This call should not be used, use +\&\f(CW\*(C`unpackstring\*(C'\fR instead. +.Sp +.Vb 4 +\& SSize_t unpack_str(const char *pat, const char *patend, +\& const char *s, const char *strbeg, +\& const char *strend, char **new_s, +\& I32 ocnt, U32 flags) +.Ve +.IP "utf8_to_uvchr" 8 +.IX Xref "utf8_to_uvchr" +.IX Item "utf8_to_uvchr" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Returns the native code point of the first character in the string \f(CW\*(C`s\*(C'\fR +which is assumed to be in \s-1UTF\-8\s0 encoding; \f(CW\*(C`retlen\*(C'\fR will be set to the +length, in bytes, of that character. +.Sp +Some, but not all, \s-1UTF\-8\s0 malformations are detected, and in fact, some +malformed input could cause reading beyond the end of the input buffer, which +is why this function is deprecated. Use \*(L"utf8_to_uvchr_buf\*(R" instead. +.Sp +If \f(CW\*(C`s\*(C'\fR points to one of the detected malformations, and \s-1UTF8\s0 warnings are +enabled, zero is returned and \f(CW*retlen\fR is set (if \f(CW\*(C`retlen\*(C'\fR isn't +\&\f(CW\*(C`NULL\*(C'\fR) to \-1. If those warnings are off, the computed value if well-defined (or +the Unicode \s-1REPLACEMENT CHARACTER,\s0 if not) is silently returned, and \f(CW*retlen\fR +is set (if \f(CW\*(C`retlen\*(C'\fR isn't \s-1NULL\s0) so that (\f(CW\*(C`s\*(C'\fR\ +\ \f(CW*retlen\fR) is the +next possible position in \f(CW\*(C`s\*(C'\fR that could begin a non-malformed character. +See \*(L"utf8n_to_uvchr\*(R" for details on when the \s-1REPLACEMENT CHARACTER\s0 is returned. +.Sp +.Vb 1 +\& UV utf8_to_uvchr(const U8 *s, STRLEN *retlen) +.Ve +.SH "Optree construction" +.IX Header "Optree construction" +.IP "newASSIGNOP" 8 +.IX Xref "newASSIGNOP" +.IX Item "newASSIGNOP" +Constructs, checks, and returns an assignment op. \f(CW\*(C`left\*(C'\fR and \f(CW\*(C`right\*(C'\fR +supply the parameters of the assignment; they are consumed by this +function and become part of the constructed op tree. +.Sp +If \f(CW\*(C`optype\*(C'\fR is \f(CW\*(C`OP_ANDASSIGN\*(C'\fR, \f(CW\*(C`OP_ORASSIGN\*(C'\fR, or \f(CW\*(C`OP_DORASSIGN\*(C'\fR, then +a suitable conditional optree is constructed. If \f(CW\*(C`optype\*(C'\fR is the opcode +of a binary operator, such as \f(CW\*(C`OP_BIT_OR\*(C'\fR, then an op is constructed that +performs the binary operation and assigns the result to the left argument. +Either way, if \f(CW\*(C`optype\*(C'\fR is non-zero then \f(CW\*(C`flags\*(C'\fR has no effect. +.Sp +If \f(CW\*(C`optype\*(C'\fR is zero, then a plain scalar or list assignment is +constructed. Which type of assignment it is is automatically determined. +\&\f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR, except that \f(CW\*(C`OPf_KIDS\*(C'\fR +will be set automatically, and, shifted up eight bits, the eight bits +of \f(CW\*(C`op_private\*(C'\fR, except that the bit with value 1 or 2 is automatically +set as required. +.Sp +.Vb 2 +\& OP* newASSIGNOP(I32 flags, OP* left, I32 optype, +\& OP* right) +.Ve +.IP "newBINOP" 8 +.IX Xref "newBINOP" +.IX Item "newBINOP" +Constructs, checks, and returns an op of any binary type. \f(CW\*(C`type\*(C'\fR +is the opcode. \f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR, except +that \f(CW\*(C`OPf_KIDS\*(C'\fR will be set automatically, and, shifted up eight bits, +the eight bits of \f(CW\*(C`op_private\*(C'\fR, except that the bit with value 1 or +2 is automatically set as required. \f(CW\*(C`first\*(C'\fR and \f(CW\*(C`last\*(C'\fR supply up to +two ops to be the direct children of the binary op; they are consumed +by this function and become part of the constructed op tree. +.Sp +.Vb 2 +\& OP* newBINOP(I32 type, I32 flags, OP* first, +\& OP* last) +.Ve +.IP "newCONDOP" 8 +.IX Xref "newCONDOP" +.IX Item "newCONDOP" +Constructs, checks, and returns a conditional-expression (\f(CW\*(C`cond_expr\*(C'\fR) +op. \f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR, except that \f(CW\*(C`OPf_KIDS\*(C'\fR +will be set automatically, and, shifted up eight bits, the eight bits of +\&\f(CW\*(C`op_private\*(C'\fR, except that the bit with value 1 is automatically set. +\&\f(CW\*(C`first\*(C'\fR supplies the expression selecting between the two branches, +and \f(CW\*(C`trueop\*(C'\fR and \f(CW\*(C`falseop\*(C'\fR supply the branches; they are consumed by +this function and become part of the constructed op tree. +.Sp +.Vb 2 +\& OP* newCONDOP(I32 flags, OP* first, OP* trueop, +\& OP* falseop) +.Ve +.IP "newDEFSVOP" 8 +.IX Xref "newDEFSVOP" +.IX Item "newDEFSVOP" +Constructs and returns an op to access \f(CW$_\fR. +.Sp +.Vb 1 +\& OP* newDEFSVOP() +.Ve +.IP "newFOROP" 8 +.IX Xref "newFOROP" +.IX Item "newFOROP" +Constructs, checks, and returns an op tree expressing a \f(CW\*(C`foreach\*(C'\fR +loop (iteration through a list of values). This is a heavyweight loop, +with structure that allows exiting the loop by \f(CW\*(C`last\*(C'\fR and suchlike. +.Sp +\&\f(CW\*(C`sv\*(C'\fR optionally supplies the variable that will be aliased to each +item in turn; if null, it defaults to \f(CW$_\fR. +\&\f(CW\*(C`expr\*(C'\fR supplies the list of values to iterate over. \f(CW\*(C`block\*(C'\fR supplies +the main body of the loop, and \f(CW\*(C`cont\*(C'\fR optionally supplies a \f(CW\*(C`continue\*(C'\fR +block that operates as a second half of the body. All of these optree +inputs are consumed by this function and become part of the constructed +op tree. +.Sp +\&\f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR for the \f(CW\*(C`leaveloop\*(C'\fR +op and, shifted up eight bits, the eight bits of \f(CW\*(C`op_private\*(C'\fR for +the \f(CW\*(C`leaveloop\*(C'\fR op, except that (in both cases) some bits will be set +automatically. +.Sp +.Vb 2 +\& OP* newFOROP(I32 flags, OP* sv, OP* expr, OP* block, +\& OP* cont) +.Ve +.IP "newGIVENOP" 8 +.IX Xref "newGIVENOP" +.IX Item "newGIVENOP" +Constructs, checks, and returns an op tree expressing a \f(CW\*(C`given\*(C'\fR block. +\&\f(CW\*(C`cond\*(C'\fR supplies the expression to whose value \f(CW$_\fR will be locally +aliased, and \f(CW\*(C`block\*(C'\fR supplies the body of the \f(CW\*(C`given\*(C'\fR construct; they +are consumed by this function and become part of the constructed op tree. +\&\f(CW\*(C`defsv_off\*(C'\fR must be zero (it used to identity the pad slot of lexical \f(CW$_\fR). +.Sp +.Vb 2 +\& OP* newGIVENOP(OP* cond, OP* block, +\& PADOFFSET defsv_off) +.Ve +.IP "newGVOP" 8 +.IX Xref "newGVOP" +.IX Item "newGVOP" +Constructs, checks, and returns an op of any type that involves an +embedded reference to a \s-1GV.\s0 \f(CW\*(C`type\*(C'\fR is the opcode. \f(CW\*(C`flags\*(C'\fR gives the +eight bits of \f(CW\*(C`op_flags\*(C'\fR. \f(CW\*(C`gv\*(C'\fR identifies the \s-1GV\s0 that the op should +reference; calling this function does not transfer ownership of any +reference to it. +.Sp +.Vb 1 +\& OP* newGVOP(I32 type, I32 flags, GV* gv) +.Ve +.IP "newLISTOP" 8 +.IX Xref "newLISTOP" +.IX Item "newLISTOP" +Constructs, checks, and returns an op of any list type. \f(CW\*(C`type\*(C'\fR is +the opcode. \f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR, except that +\&\f(CW\*(C`OPf_KIDS\*(C'\fR will be set automatically if required. \f(CW\*(C`first\*(C'\fR and \f(CW\*(C`last\*(C'\fR +supply up to two ops to be direct children of the list op; they are +consumed by this function and become part of the constructed op tree. +.Sp +For most list operators, the check function expects all the kid ops to be +present already, so calling \f(CW\*(C`newLISTOP(OP_JOIN, ...)\*(C'\fR (e.g.) is not +appropriate. What you want to do in that case is create an op of type +\&\f(CW\*(C`OP_LIST\*(C'\fR, append more children to it, and then call \*(L"op_convert_list\*(R". +See \*(L"op_convert_list\*(R" for more information. +.Sp +.Vb 2 +\& OP* newLISTOP(I32 type, I32 flags, OP* first, +\& OP* last) +.Ve +.IP "newLOGOP" 8 +.IX Xref "newLOGOP" +.IX Item "newLOGOP" +Constructs, checks, and returns a logical (flow control) op. \f(CW\*(C`type\*(C'\fR +is the opcode. \f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR, except +that \f(CW\*(C`OPf_KIDS\*(C'\fR will be set automatically, and, shifted up eight bits, +the eight bits of \f(CW\*(C`op_private\*(C'\fR, except that the bit with value 1 is +automatically set. \f(CW\*(C`first\*(C'\fR supplies the expression controlling the +flow, and \f(CW\*(C`other\*(C'\fR supplies the side (alternate) chain of ops; they are +consumed by this function and become part of the constructed op tree. +.Sp +.Vb 2 +\& OP* newLOGOP(I32 optype, I32 flags, OP *first, +\& OP *other) +.Ve +.IP "newLOOPEX" 8 +.IX Xref "newLOOPEX" +.IX Item "newLOOPEX" +Constructs, checks, and returns a loop-exiting op (such as \f(CW\*(C`goto\*(C'\fR +or \f(CW\*(C`last\*(C'\fR). \f(CW\*(C`type\*(C'\fR is the opcode. \f(CW\*(C`label\*(C'\fR supplies the parameter +determining the target of the op; it is consumed by this function and +becomes part of the constructed op tree. +.Sp +.Vb 1 +\& OP* newLOOPEX(I32 type, OP* label) +.Ve +.IP "newLOOPOP" 8 +.IX Xref "newLOOPOP" +.IX Item "newLOOPOP" +Constructs, checks, and returns an op tree expressing a loop. This is +only a loop in the control flow through the op tree; it does not have +the heavyweight loop structure that allows exiting the loop by \f(CW\*(C`last\*(C'\fR +and suchlike. \f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR for the +top-level op, except that some bits will be set automatically as required. +\&\f(CW\*(C`expr\*(C'\fR supplies the expression controlling loop iteration, and \f(CW\*(C`block\*(C'\fR +supplies the body of the loop; they are consumed by this function and +become part of the constructed op tree. \f(CW\*(C`debuggable\*(C'\fR is currently +unused and should always be 1. +.Sp +.Vb 2 +\& OP* newLOOPOP(I32 flags, I32 debuggable, OP* expr, +\& OP* block) +.Ve +.IP "newMETHOP" 8 +.IX Xref "newMETHOP" +.IX Item "newMETHOP" +Constructs, checks, and returns an op of method type with a method name +evaluated at runtime. \f(CW\*(C`type\*(C'\fR is the opcode. \f(CW\*(C`flags\*(C'\fR gives the eight +bits of \f(CW\*(C`op_flags\*(C'\fR, except that \f(CW\*(C`OPf_KIDS\*(C'\fR will be set automatically, +and, shifted up eight bits, the eight bits of \f(CW\*(C`op_private\*(C'\fR, except that +the bit with value 1 is automatically set. \f(CW\*(C`dynamic_meth\*(C'\fR supplies an +op which evaluates method name; it is consumed by this function and +become part of the constructed op tree. +Supported optypes: \f(CW\*(C`OP_METHOD\*(C'\fR. +.Sp +.Vb 1 +\& OP* newMETHOP(I32 type, I32 flags, OP* dynamic_meth) +.Ve +.IP "newMETHOP_named" 8 +.IX Xref "newMETHOP_named" +.IX Item "newMETHOP_named" +Constructs, checks, and returns an op of method type with a constant +method name. \f(CW\*(C`type\*(C'\fR is the opcode. \f(CW\*(C`flags\*(C'\fR gives the eight bits of +\&\f(CW\*(C`op_flags\*(C'\fR, and, shifted up eight bits, the eight bits of +\&\f(CW\*(C`op_private\*(C'\fR. \f(CW\*(C`const_meth\*(C'\fR supplies a constant method name; +it must be a shared \s-1COW\s0 string. +Supported optypes: \f(CW\*(C`OP_METHOD_NAMED\*(C'\fR. +.Sp +.Vb 2 +\& OP* newMETHOP_named(I32 type, I32 flags, +\& SV* const_meth) +.Ve +.IP "newNULLLIST" 8 +.IX Xref "newNULLLIST" +.IX Item "newNULLLIST" +Constructs, checks, and returns a new \f(CW\*(C`stub\*(C'\fR op, which represents an +empty list expression. +.Sp +.Vb 1 +\& OP* newNULLLIST() +.Ve +.IP "newOP" 8 +.IX Xref "newOP" +.IX Item "newOP" +Constructs, checks, and returns an op of any base type (any type that +has no extra fields). \f(CW\*(C`type\*(C'\fR is the opcode. \f(CW\*(C`flags\*(C'\fR gives the +eight bits of \f(CW\*(C`op_flags\*(C'\fR, and, shifted up eight bits, the eight bits +of \f(CW\*(C`op_private\*(C'\fR. +.Sp +.Vb 1 +\& OP* newOP(I32 optype, I32 flags) +.Ve +.IP "newPADOP" 8 +.IX Xref "newPADOP" +.IX Item "newPADOP" +Constructs, checks, and returns an op of any type that involves a +reference to a pad element. \f(CW\*(C`type\*(C'\fR is the opcode. \f(CW\*(C`flags\*(C'\fR gives the +eight bits of \f(CW\*(C`op_flags\*(C'\fR. A pad slot is automatically allocated, and +is populated with \f(CW\*(C`sv\*(C'\fR; this function takes ownership of one reference +to it. +.Sp +This function only exists if Perl has been compiled to use ithreads. +.Sp +.Vb 1 +\& OP* newPADOP(I32 type, I32 flags, SV* sv) +.Ve +.IP "newPMOP" 8 +.IX Xref "newPMOP" +.IX Item "newPMOP" +Constructs, checks, and returns an op of any pattern matching type. +\&\f(CW\*(C`type\*(C'\fR is the opcode. \f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR +and, shifted up eight bits, the eight bits of \f(CW\*(C`op_private\*(C'\fR. +.Sp +.Vb 1 +\& OP* newPMOP(I32 type, I32 flags) +.Ve +.IP "newPVOP" 8 +.IX Xref "newPVOP" +.IX Item "newPVOP" +Constructs, checks, and returns an op of any type that involves an +embedded C\-level pointer (\s-1PV\s0). \f(CW\*(C`type\*(C'\fR is the opcode. \f(CW\*(C`flags\*(C'\fR gives +the eight bits of \f(CW\*(C`op_flags\*(C'\fR. \f(CW\*(C`pv\*(C'\fR supplies the C\-level pointer. +Depending on the op type, the memory referenced by \f(CW\*(C`pv\*(C'\fR may be freed +when the op is destroyed. If the op is of a freeing type, \f(CW\*(C`pv\*(C'\fR must +have been allocated using \f(CW\*(C`PerlMemShared_malloc\*(C'\fR. +.Sp +.Vb 1 +\& OP* newPVOP(I32 type, I32 flags, char* pv) +.Ve +.IP "newRANGE" 8 +.IX Xref "newRANGE" +.IX Item "newRANGE" +Constructs and returns a \f(CW\*(C`range\*(C'\fR op, with subordinate \f(CW\*(C`flip\*(C'\fR and +\&\f(CW\*(C`flop\*(C'\fR ops. \f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR for the +\&\f(CW\*(C`flip\*(C'\fR op and, shifted up eight bits, the eight bits of \f(CW\*(C`op_private\*(C'\fR +for both the \f(CW\*(C`flip\*(C'\fR and \f(CW\*(C`range\*(C'\fR ops, except that the bit with value +1 is automatically set. \f(CW\*(C`left\*(C'\fR and \f(CW\*(C`right\*(C'\fR supply the expressions +controlling the endpoints of the range; they are consumed by this function +and become part of the constructed op tree. +.Sp +.Vb 1 +\& OP* newRANGE(I32 flags, OP* left, OP* right) +.Ve +.IP "newSLICEOP" 8 +.IX Xref "newSLICEOP" +.IX Item "newSLICEOP" +Constructs, checks, and returns an \f(CW\*(C`lslice\*(C'\fR (list slice) op. \f(CW\*(C`flags\*(C'\fR +gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR, except that \f(CW\*(C`OPf_KIDS\*(C'\fR will +be set automatically, and, shifted up eight bits, the eight bits of +\&\f(CW\*(C`op_private\*(C'\fR, except that the bit with value 1 or 2 is automatically +set as required. \f(CW\*(C`listval\*(C'\fR and \f(CW\*(C`subscript\*(C'\fR supply the parameters of +the slice; they are consumed by this function and become part of the +constructed op tree. +.Sp +.Vb 1 +\& OP* newSLICEOP(I32 flags, OP* subscript, OP* listop) +.Ve +.IP "newSTATEOP" 8 +.IX Xref "newSTATEOP" +.IX Item "newSTATEOP" +Constructs a state op (\s-1COP\s0). The state op is normally a \f(CW\*(C`nextstate\*(C'\fR op, +but will be a \f(CW\*(C`dbstate\*(C'\fR op if debugging is enabled for currently-compiled +code. The state op is populated from \f(CW\*(C`PL_curcop\*(C'\fR (or \f(CW\*(C`PL_compiling\*(C'\fR). +If \f(CW\*(C`label\*(C'\fR is non-null, it supplies the name of a label to attach to +the state op; this function takes ownership of the memory pointed at by +\&\f(CW\*(C`label\*(C'\fR, and will free it. \f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR +for the state op. +.Sp +If \f(CW\*(C`o\*(C'\fR is null, the state op is returned. Otherwise the state op is +combined with \f(CW\*(C`o\*(C'\fR into a \f(CW\*(C`lineseq\*(C'\fR list op, which is returned. \f(CW\*(C`o\*(C'\fR +is consumed by this function and becomes part of the returned op tree. +.Sp +.Vb 1 +\& OP* newSTATEOP(I32 flags, char* label, OP* o) +.Ve +.IP "newSVOP" 8 +.IX Xref "newSVOP" +.IX Item "newSVOP" +Constructs, checks, and returns an op of any type that involves an +embedded \s-1SV.\s0 \f(CW\*(C`type\*(C'\fR is the opcode. \f(CW\*(C`flags\*(C'\fR gives the eight bits +of \f(CW\*(C`op_flags\*(C'\fR. \f(CW\*(C`sv\*(C'\fR gives the \s-1SV\s0 to embed in the op; this function +takes ownership of one reference to it. +.Sp +.Vb 1 +\& OP* newSVOP(I32 type, I32 flags, SV* sv) +.Ve +.IP "newUNOP" 8 +.IX Xref "newUNOP" +.IX Item "newUNOP" +Constructs, checks, and returns an op of any unary type. \f(CW\*(C`type\*(C'\fR is +the opcode. \f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR, except that +\&\f(CW\*(C`OPf_KIDS\*(C'\fR will be set automatically if required, and, shifted up eight +bits, the eight bits of \f(CW\*(C`op_private\*(C'\fR, except that the bit with value 1 +is automatically set. \f(CW\*(C`first\*(C'\fR supplies an optional op to be the direct +child of the unary op; it is consumed by this function and become part +of the constructed op tree. +.Sp +.Vb 1 +\& OP* newUNOP(I32 type, I32 flags, OP* first) +.Ve +.IP "newUNOP_AUX" 8 +.IX Xref "newUNOP_AUX" +.IX Item "newUNOP_AUX" +Similar to \f(CW\*(C`newUNOP\*(C'\fR, but creates an \f(CW\*(C`UNOP_AUX\*(C'\fR struct instead, with \f(CW\*(C`op_aux\*(C'\fR +initialised to \f(CW\*(C`aux\*(C'\fR +.Sp +.Vb 2 +\& OP* newUNOP_AUX(I32 type, I32 flags, OP* first, +\& UNOP_AUX_item *aux) +.Ve +.IP "newWHENOP" 8 +.IX Xref "newWHENOP" +.IX Item "newWHENOP" +Constructs, checks, and returns an op tree expressing a \f(CW\*(C`when\*(C'\fR block. +\&\f(CW\*(C`cond\*(C'\fR supplies the test expression, and \f(CW\*(C`block\*(C'\fR supplies the block +that will be executed if the test evaluates to true; they are consumed +by this function and become part of the constructed op tree. \f(CW\*(C`cond\*(C'\fR +will be interpreted DWIMically, often as a comparison against \f(CW$_\fR, +and may be null to generate a \f(CW\*(C`default\*(C'\fR block. +.Sp +.Vb 1 +\& OP* newWHENOP(OP* cond, OP* block) +.Ve +.IP "newWHILEOP" 8 +.IX Xref "newWHILEOP" +.IX Item "newWHILEOP" +Constructs, checks, and returns an op tree expressing a \f(CW\*(C`while\*(C'\fR loop. +This is a heavyweight loop, with structure that allows exiting the loop +by \f(CW\*(C`last\*(C'\fR and suchlike. +.Sp +\&\f(CW\*(C`loop\*(C'\fR is an optional preconstructed \f(CW\*(C`enterloop\*(C'\fR op to use in the +loop; if it is null then a suitable op will be constructed automatically. +\&\f(CW\*(C`expr\*(C'\fR supplies the loop's controlling expression. \f(CW\*(C`block\*(C'\fR supplies the +main body of the loop, and \f(CW\*(C`cont\*(C'\fR optionally supplies a \f(CW\*(C`continue\*(C'\fR block +that operates as a second half of the body. All of these optree inputs +are consumed by this function and become part of the constructed op tree. +.Sp +\&\f(CW\*(C`flags\*(C'\fR gives the eight bits of \f(CW\*(C`op_flags\*(C'\fR for the \f(CW\*(C`leaveloop\*(C'\fR +op and, shifted up eight bits, the eight bits of \f(CW\*(C`op_private\*(C'\fR for +the \f(CW\*(C`leaveloop\*(C'\fR op, except that (in both cases) some bits will be set +automatically. \f(CW\*(C`debuggable\*(C'\fR is currently unused and should always be 1. +\&\f(CW\*(C`has_my\*(C'\fR can be supplied as true to force the +loop body to be enclosed in its own scope. +.Sp +.Vb 3 +\& OP* newWHILEOP(I32 flags, I32 debuggable, +\& LOOP* loop, OP* expr, OP* block, +\& OP* cont, I32 has_my) +.Ve +.SH "Optree Manipulation Functions" +.IX Header "Optree Manipulation Functions" +.IP "alloccopstash" 8 +.IX Xref "alloccopstash" +.IX Item "alloccopstash" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Available only under threaded builds, this function allocates an entry in +\&\f(CW\*(C`PL_stashpad\*(C'\fR for the stash passed to it. +.Sp +.Vb 1 +\& PADOFFSET alloccopstash(HV *hv) +.Ve +.IP "block_end" 8 +.IX Xref "block_end" +.IX Item "block_end" +Handles compile-time scope exit. \f(CW\*(C`floor\*(C'\fR +is the savestack index returned by +\&\f(CW\*(C`block_start\*(C'\fR, and \f(CW\*(C`seq\*(C'\fR is the body of the block. Returns the block, +possibly modified. +.Sp +.Vb 1 +\& OP* block_end(I32 floor, OP* seq) +.Ve +.IP "block_start" 8 +.IX Xref "block_start" +.IX Item "block_start" +Handles compile-time scope entry. +Arranges for hints to be restored on block +exit and also handles pad sequence numbers to make lexical variables scope +right. Returns a savestack index for use with \f(CW\*(C`block_end\*(C'\fR. +.Sp +.Vb 1 +\& int block_start(int full) +.Ve +.IP "ck_entersub_args_list" 8 +.IX Xref "ck_entersub_args_list" +.IX Item "ck_entersub_args_list" +Performs the default fixup of the arguments part of an \f(CW\*(C`entersub\*(C'\fR +op tree. This consists of applying list context to each of the +argument ops. This is the standard treatment used on a call marked +with \f(CW\*(C`&\*(C'\fR, or a method call, or a call through a subroutine reference, +or any other call where the callee can't be identified at compile time, +or a call where the callee has no prototype. +.Sp +.Vb 1 +\& OP* ck_entersub_args_list(OP *entersubop) +.Ve +.IP "ck_entersub_args_proto" 8 +.IX Xref "ck_entersub_args_proto" +.IX Item "ck_entersub_args_proto" +Performs the fixup of the arguments part of an \f(CW\*(C`entersub\*(C'\fR op tree +based on a subroutine prototype. This makes various modifications to +the argument ops, from applying context up to inserting \f(CW\*(C`refgen\*(C'\fR ops, +and checking the number and syntactic types of arguments, as directed by +the prototype. This is the standard treatment used on a subroutine call, +not marked with \f(CW\*(C`&\*(C'\fR, where the callee can be identified at compile time +and has a prototype. +.Sp +\&\f(CW\*(C`protosv\*(C'\fR supplies the subroutine prototype to be applied to the call. +It may be a normal defined scalar, of which the string value will be used. +Alternatively, for convenience, it may be a subroutine object (a \f(CW\*(C`CV*\*(C'\fR +that has been cast to \f(CW\*(C`SV*\*(C'\fR) which has a prototype. The prototype +supplied, in whichever form, does not need to match the actual callee +referenced by the op tree. +.Sp +If the argument ops disagree with the prototype, for example by having +an unacceptable number of arguments, a valid op tree is returned anyway. +The error is reflected in the parser state, normally resulting in a single +exception at the top level of parsing which covers all the compilation +errors that occurred. In the error message, the callee is referred to +by the name defined by the \f(CW\*(C`namegv\*(C'\fR parameter. +.Sp +.Vb 2 +\& OP* ck_entersub_args_proto(OP *entersubop, +\& GV *namegv, SV *protosv) +.Ve +.IP "ck_entersub_args_proto_or_list" 8 +.IX Xref "ck_entersub_args_proto_or_list" +.IX Item "ck_entersub_args_proto_or_list" +Performs the fixup of the arguments part of an \f(CW\*(C`entersub\*(C'\fR op tree either +based on a subroutine prototype or using default list-context processing. +This is the standard treatment used on a subroutine call, not marked +with \f(CW\*(C`&\*(C'\fR, where the callee can be identified at compile time. +.Sp +\&\f(CW\*(C`protosv\*(C'\fR supplies the subroutine prototype to be applied to the call, +or indicates that there is no prototype. It may be a normal scalar, +in which case if it is defined then the string value will be used +as a prototype, and if it is undefined then there is no prototype. +Alternatively, for convenience, it may be a subroutine object (a \f(CW\*(C`CV*\*(C'\fR +that has been cast to \f(CW\*(C`SV*\*(C'\fR), of which the prototype will be used if it +has one. The prototype (or lack thereof) supplied, in whichever form, +does not need to match the actual callee referenced by the op tree. +.Sp +If the argument ops disagree with the prototype, for example by having +an unacceptable number of arguments, a valid op tree is returned anyway. +The error is reflected in the parser state, normally resulting in a single +exception at the top level of parsing which covers all the compilation +errors that occurred. In the error message, the callee is referred to +by the name defined by the \f(CW\*(C`namegv\*(C'\fR parameter. +.Sp +.Vb 3 +\& OP* ck_entersub_args_proto_or_list(OP *entersubop, +\& GV *namegv, +\& SV *protosv) +.Ve +.IP "cv_const_sv" 8 +.IX Xref "cv_const_sv" +.IX Item "cv_const_sv" +If \f(CW\*(C`cv\*(C'\fR is a constant sub eligible for inlining, returns the constant +value returned by the sub. Otherwise, returns \f(CW\*(C`NULL\*(C'\fR. +.Sp +Constant subs can be created with \f(CW\*(C`newCONSTSUB\*(C'\fR or as described in +\&\*(L"Constant Functions\*(R" in perlsub. +.Sp +.Vb 1 +\& SV* cv_const_sv(const CV *const cv) +.Ve +.IP "cv_get_call_checker" 8 +.IX Xref "cv_get_call_checker" +.IX Item "cv_get_call_checker" +The original form of \*(L"cv_get_call_checker_flags\*(R", which does not return +checker flags. When using a checker function returned by this function, +it is only safe to call it with a genuine \s-1GV\s0 as its \f(CW\*(C`namegv\*(C'\fR argument. +.Sp +.Vb 3 +\& void cv_get_call_checker(CV *cv, +\& Perl_call_checker *ckfun_p, +\& SV **ckobj_p) +.Ve +.IP "cv_get_call_checker_flags" 8 +.IX Xref "cv_get_call_checker_flags" +.IX Item "cv_get_call_checker_flags" +Retrieves the function that will be used to fix up a call to \f(CW\*(C`cv\*(C'\fR. +Specifically, the function is applied to an \f(CW\*(C`entersub\*(C'\fR op tree for a +subroutine call, not marked with \f(CW\*(C`&\*(C'\fR, where the callee can be identified +at compile time as \f(CW\*(C`cv\*(C'\fR. +.Sp +The C\-level function pointer is returned in \f(CW*ckfun_p\fR, an \s-1SV\s0 argument +for it is returned in \f(CW*ckobj_p\fR, and control flags are returned in +\&\f(CW*ckflags_p\fR. The function is intended to be called in this manner: +.Sp +.Vb 1 +\& entersubop = (*ckfun_p)(aTHX_ entersubop, namegv, (*ckobj_p)); +.Ve +.Sp +In this call, \f(CW\*(C`entersubop\*(C'\fR is a pointer to the \f(CW\*(C`entersub\*(C'\fR op, +which may be replaced by the check function, and \f(CW\*(C`namegv\*(C'\fR supplies +the name that should be used by the check function to refer +to the callee of the \f(CW\*(C`entersub\*(C'\fR op if it needs to emit any diagnostics. +It is permitted to apply the check function in non-standard situations, +such as to a call to a different subroutine or to a method call. +.Sp +\&\f(CW\*(C`namegv\*(C'\fR may not actually be a \s-1GV.\s0 If the \f(CW\*(C`CALL_CHECKER_REQUIRE_GV\*(C'\fR +bit is clear in \f(CW*ckflags_p\fR, it is permitted to pass a \s-1CV\s0 or other \s-1SV\s0 +instead, anything that can be used as the first argument to \*(L"cv_name\*(R". +If the \f(CW\*(C`CALL_CHECKER_REQUIRE_GV\*(C'\fR bit is set in \f(CW*ckflags_p\fR then the +check function requires \f(CW\*(C`namegv\*(C'\fR to be a genuine \s-1GV.\s0 +.Sp +By default, the check function is +Perl_ck_entersub_args_proto_or_list, +the \s-1SV\s0 parameter is \f(CW\*(C`cv\*(C'\fR itself, and the \f(CW\*(C`CALL_CHECKER_REQUIRE_GV\*(C'\fR +flag is clear. This implements standard prototype processing. It can +be changed, for a particular subroutine, by \*(L"cv_set_call_checker_flags\*(R". +.Sp +If the \f(CW\*(C`CALL_CHECKER_REQUIRE_GV\*(C'\fR bit is set in \f(CW\*(C`gflags\*(C'\fR then it +indicates that the caller only knows about the genuine \s-1GV\s0 version of +\&\f(CW\*(C`namegv\*(C'\fR, and accordingly the corresponding bit will always be set in +\&\f(CW*ckflags_p\fR, regardless of the check function's recorded requirements. +If the \f(CW\*(C`CALL_CHECKER_REQUIRE_GV\*(C'\fR bit is clear in \f(CW\*(C`gflags\*(C'\fR then it +indicates the caller knows about the possibility of passing something +other than a \s-1GV\s0 as \f(CW\*(C`namegv\*(C'\fR, and accordingly the corresponding bit may +be either set or clear in \f(CW*ckflags_p\fR, indicating the check function's +recorded requirements. +.Sp +\&\f(CW\*(C`gflags\*(C'\fR is a bitset passed into \f(CW\*(C`cv_get_call_checker_flags\*(C'\fR, in which +only the \f(CW\*(C`CALL_CHECKER_REQUIRE_GV\*(C'\fR bit currently has a defined meaning +(for which see above). All other bits should be clear. +.Sp +.Vb 5 +\& void cv_get_call_checker_flags( +\& CV *cv, U32 gflags, +\& Perl_call_checker *ckfun_p, SV **ckobj_p, +\& U32 *ckflags_p +\& ) +.Ve +.IP "cv_set_call_checker" 8 +.IX Xref "cv_set_call_checker" +.IX Item "cv_set_call_checker" +The original form of \*(L"cv_set_call_checker_flags\*(R", which passes it the +\&\f(CW\*(C`CALL_CHECKER_REQUIRE_GV\*(C'\fR flag for backward-compatibility. The effect +of that flag setting is that the check function is guaranteed to get a +genuine \s-1GV\s0 as its \f(CW\*(C`namegv\*(C'\fR argument. +.Sp +.Vb 3 +\& void cv_set_call_checker(CV *cv, +\& Perl_call_checker ckfun, +\& SV *ckobj) +.Ve +.IP "cv_set_call_checker_flags" 8 +.IX Xref "cv_set_call_checker_flags" +.IX Item "cv_set_call_checker_flags" +Sets the function that will be used to fix up a call to \f(CW\*(C`cv\*(C'\fR. +Specifically, the function is applied to an \f(CW\*(C`entersub\*(C'\fR op tree for a +subroutine call, not marked with \f(CW\*(C`&\*(C'\fR, where the callee can be identified +at compile time as \f(CW\*(C`cv\*(C'\fR. +.Sp +The C\-level function pointer is supplied in \f(CW\*(C`ckfun\*(C'\fR, an \s-1SV\s0 argument for +it is supplied in \f(CW\*(C`ckobj\*(C'\fR, and control flags are supplied in \f(CW\*(C`ckflags\*(C'\fR. +The function should be defined like this: +.Sp +.Vb 1 +\& STATIC OP * ckfun(pTHX_ OP *op, GV *namegv, SV *ckobj) +.Ve +.Sp +It is intended to be called in this manner: +.Sp +.Vb 1 +\& entersubop = ckfun(aTHX_ entersubop, namegv, ckobj); +.Ve +.Sp +In this call, \f(CW\*(C`entersubop\*(C'\fR is a pointer to the \f(CW\*(C`entersub\*(C'\fR op, +which may be replaced by the check function, and \f(CW\*(C`namegv\*(C'\fR supplies +the name that should be used by the check function to refer +to the callee of the \f(CW\*(C`entersub\*(C'\fR op if it needs to emit any diagnostics. +It is permitted to apply the check function in non-standard situations, +such as to a call to a different subroutine or to a method call. +.Sp +\&\f(CW\*(C`namegv\*(C'\fR may not actually be a \s-1GV.\s0 For efficiency, perl may pass a +\&\s-1CV\s0 or other \s-1SV\s0 instead. Whatever is passed can be used as the first +argument to \*(L"cv_name\*(R". You can force perl to pass a \s-1GV\s0 by including +\&\f(CW\*(C`CALL_CHECKER_REQUIRE_GV\*(C'\fR in the \f(CW\*(C`ckflags\*(C'\fR. +.Sp +\&\f(CW\*(C`ckflags\*(C'\fR is a bitset, in which only the \f(CW\*(C`CALL_CHECKER_REQUIRE_GV\*(C'\fR +bit currently has a defined meaning (for which see above). All other +bits should be clear. +.Sp +The current setting for a particular \s-1CV\s0 can be retrieved by +\&\*(L"cv_get_call_checker_flags\*(R". +.Sp +.Vb 4 +\& void cv_set_call_checker_flags( +\& CV *cv, Perl_call_checker ckfun, SV *ckobj, +\& U32 ckflags +\& ) +.Ve +.IP "\s-1LINKLIST\s0" 8 +.IX Xref "LINKLIST" +.IX Item "LINKLIST" +Given the root of an optree, link the tree in execution order using the +\&\f(CW\*(C`op_next\*(C'\fR pointers and return the first op executed. If this has +already been done, it will not be redone, and \f(CW\*(C`o\->op_next\*(C'\fR will be +returned. If \f(CW\*(C`o\->op_next\*(C'\fR is not already set, \f(CW\*(C`o\*(C'\fR should be at +least an \f(CW\*(C`UNOP\*(C'\fR. +.Sp +.Vb 1 +\& OP* LINKLIST(OP *o) +.Ve +.IP "newCONSTSUB" 8 +.IX Xref "newCONSTSUB" +.IX Item "newCONSTSUB" +Behaves like \*(L"newCONSTSUB_flags\*(R", except that \f(CW\*(C`name\*(C'\fR is nul-terminated +rather than of counted length, and no flags are set. (This means that +\&\f(CW\*(C`name\*(C'\fR is always interpreted as Latin\-1.) +.Sp +.Vb 1 +\& CV* newCONSTSUB(HV* stash, const char* name, SV* sv) +.Ve +.IP "newCONSTSUB_flags" 8 +.IX Xref "newCONSTSUB_flags" +.IX Item "newCONSTSUB_flags" +Construct a constant subroutine, also performing some surrounding +jobs. A scalar constant-valued subroutine is eligible for inlining +at compile-time, and in Perl code can be created by \f(CW\*(C`sub\ FOO\ ()\ {\ 123\ }\*(C'\fR. Other kinds of constant subroutine have other treatment. +.Sp +The subroutine will have an empty prototype and will ignore any arguments +when called. Its constant behaviour is determined by \f(CW\*(C`sv\*(C'\fR. If \f(CW\*(C`sv\*(C'\fR +is null, the subroutine will yield an empty list. If \f(CW\*(C`sv\*(C'\fR points to a +scalar, the subroutine will always yield that scalar. If \f(CW\*(C`sv\*(C'\fR points +to an array, the subroutine will always yield a list of the elements of +that array in list context, or the number of elements in the array in +scalar context. This function takes ownership of one counted reference +to the scalar or array, and will arrange for the object to live as long +as the subroutine does. If \f(CW\*(C`sv\*(C'\fR points to a scalar then the inlining +assumes that the value of the scalar will never change, so the caller +must ensure that the scalar is not subsequently written to. If \f(CW\*(C`sv\*(C'\fR +points to an array then no such assumption is made, so it is ostensibly +safe to mutate the array or its elements, but whether this is really +supported has not been determined. +.Sp +The subroutine will have \f(CW\*(C`CvFILE\*(C'\fR set according to \f(CW\*(C`PL_curcop\*(C'\fR. +Other aspects of the subroutine will be left in their default state. +The caller is free to mutate the subroutine beyond its initial state +after this function has returned. +.Sp +If \f(CW\*(C`name\*(C'\fR is null then the subroutine will be anonymous, with its +\&\f(CW\*(C`CvGV\*(C'\fR referring to an \f(CW\*(C`_\|_ANON_\|_\*(C'\fR glob. If \f(CW\*(C`name\*(C'\fR is non-null then the +subroutine will be named accordingly, referenced by the appropriate glob. +\&\f(CW\*(C`name\*(C'\fR is a string of length \f(CW\*(C`len\*(C'\fR bytes giving a sigilless symbol +name, in \s-1UTF\-8\s0 if \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SVf_UTF8\*(C'\fR bit set and in Latin\-1 +otherwise. The name may be either qualified or unqualified. If the +name is unqualified then it defaults to being in the stash specified by +\&\f(CW\*(C`stash\*(C'\fR if that is non-null, or to \f(CW\*(C`PL_curstash\*(C'\fR if \f(CW\*(C`stash\*(C'\fR is null. +The symbol is always added to the stash if necessary, with \f(CW\*(C`GV_ADDMULTI\*(C'\fR +semantics. +.Sp +\&\f(CW\*(C`flags\*(C'\fR should not have bits set other than \f(CW\*(C`SVf_UTF8\*(C'\fR. +.Sp +If there is already a subroutine of the specified name, then the new sub +will replace the existing one in the glob. A warning may be generated +about the redefinition. +.Sp +If the subroutine has one of a few special names, such as \f(CW\*(C`BEGIN\*(C'\fR or +\&\f(CW\*(C`END\*(C'\fR, then it will be claimed by the appropriate queue for automatic +running of phase-related subroutines. In this case the relevant glob will +be left not containing any subroutine, even if it did contain one before. +Execution of the subroutine will likely be a no-op, unless \f(CW\*(C`sv\*(C'\fR was +a tied array or the caller modified the subroutine in some interesting +way before it was executed. In the case of \f(CW\*(C`BEGIN\*(C'\fR, the treatment is +buggy: the sub will be executed when only half built, and may be deleted +prematurely, possibly causing a crash. +.Sp +The function returns a pointer to the constructed subroutine. If the sub +is anonymous then ownership of one counted reference to the subroutine +is transferred to the caller. If the sub is named then the caller does +not get ownership of a reference. In most such cases, where the sub +has a non-phase name, the sub will be alive at the point it is returned +by virtue of being contained in the glob that names it. A phase-named +subroutine will usually be alive by virtue of the reference owned by +the phase's automatic run queue. A \f(CW\*(C`BEGIN\*(C'\fR subroutine may have been +destroyed already by the time this function returns, but currently bugs +occur in that case before the caller gets control. It is the caller's +responsibility to ensure that it knows which of these situations applies. +.Sp +.Vb 2 +\& CV* newCONSTSUB_flags(HV* stash, const char* name, +\& STRLEN len, U32 flags, SV* sv) +.Ve +.IP "newXS" 8 +.IX Xref "newXS" +.IX Item "newXS" +Used by \f(CW\*(C`xsubpp\*(C'\fR to hook up XSUBs as Perl subs. \f(CW\*(C`filename\*(C'\fR needs to be +static storage, as it is used directly as \fBCvFILE()\fR, without a copy being made. +.IP "op_append_elem" 8 +.IX Xref "op_append_elem" +.IX Item "op_append_elem" +Append an item to the list of ops contained directly within a list-type +op, returning the lengthened list. \f(CW\*(C`first\*(C'\fR is the list-type op, +and \f(CW\*(C`last\*(C'\fR is the op to append to the list. \f(CW\*(C`optype\*(C'\fR specifies the +intended opcode for the list. If \f(CW\*(C`first\*(C'\fR is not already a list of the +right type, it will be upgraded into one. If either \f(CW\*(C`first\*(C'\fR or \f(CW\*(C`last\*(C'\fR +is null, the other is returned unchanged. +.Sp +.Vb 1 +\& OP* op_append_elem(I32 optype, OP* first, OP* last) +.Ve +.IP "op_append_list" 8 +.IX Xref "op_append_list" +.IX Item "op_append_list" +Concatenate the lists of ops contained directly within two list-type ops, +returning the combined list. \f(CW\*(C`first\*(C'\fR and \f(CW\*(C`last\*(C'\fR are the list-type ops +to concatenate. \f(CW\*(C`optype\*(C'\fR specifies the intended opcode for the list. +If either \f(CW\*(C`first\*(C'\fR or \f(CW\*(C`last\*(C'\fR is not already a list of the right type, +it will be upgraded into one. If either \f(CW\*(C`first\*(C'\fR or \f(CW\*(C`last\*(C'\fR is null, +the other is returned unchanged. +.Sp +.Vb 1 +\& OP* op_append_list(I32 optype, OP* first, OP* last) +.Ve +.IP "\s-1OP_CLASS\s0" 8 +.IX Xref "OP_CLASS" +.IX Item "OP_CLASS" +Return the class of the provided \s-1OP:\s0 that is, which of the *OP +structures it uses. For core ops this currently gets the information out +of \f(CW\*(C`PL_opargs\*(C'\fR, which does not always accurately reflect the type used; +in v5.26 onwards, see also the function \f(CW"op_class"\fR which can do a better +job of determining the used type. +.Sp +For custom ops the type is returned from the registration, and it is up +to the registree to ensure it is accurate. The value returned will be +one of the \f(CW\*(C`OA_\*(C'\fR* constants from \fIop.h\fR. +.Sp +.Vb 1 +\& U32 OP_CLASS(OP *o) +.Ve +.IP "op_contextualize" 8 +.IX Xref "op_contextualize" +.IX Item "op_contextualize" +Applies a syntactic context to an op tree representing an expression. +\&\f(CW\*(C`o\*(C'\fR is the op tree, and \f(CW\*(C`context\*(C'\fR must be \f(CW\*(C`G_SCALAR\*(C'\fR, \f(CW\*(C`G_ARRAY\*(C'\fR, +or \f(CW\*(C`G_VOID\*(C'\fR to specify the context to apply. The modified op tree +is returned. +.Sp +.Vb 1 +\& OP* op_contextualize(OP* o, I32 context) +.Ve +.IP "op_convert_list" 8 +.IX Xref "op_convert_list" +.IX Item "op_convert_list" +Converts \f(CW\*(C`o\*(C'\fR into a list op if it is not one already, and then converts it +into the specified \f(CW\*(C`type\*(C'\fR, calling its check function, allocating a target if +it needs one, and folding constants. +.Sp +A list-type op is usually constructed one kid at a time via \f(CW\*(C`newLISTOP\*(C'\fR, +\&\f(CW\*(C`op_prepend_elem\*(C'\fR and \f(CW\*(C`op_append_elem\*(C'\fR. Then finally it is passed to +\&\f(CW\*(C`op_convert_list\*(C'\fR to make it the right type. +.Sp +.Vb 1 +\& OP* op_convert_list(I32 optype, I32 flags, OP* o) +.Ve +.IP "\s-1OP_DESC\s0" 8 +.IX Xref "OP_DESC" +.IX Item "OP_DESC" +Return a short description of the provided \s-1OP.\s0 +.Sp +.Vb 1 +\& const char * OP_DESC(OP *o) +.Ve +.IP "op_free" 8 +.IX Xref "op_free" +.IX Item "op_free" +Free an op and its children. Only use this when an op is no longer linked +to from any optree. +.Sp +.Vb 1 +\& void op_free(OP* arg) +.Ve +.IP "OpHAS_SIBLING" 8 +.IX Xref "OpHAS_SIBLING" +.IX Item "OpHAS_SIBLING" +Returns true if \f(CW\*(C`o\*(C'\fR has a sibling +.Sp +.Vb 1 +\& bool OpHAS_SIBLING(OP *o) +.Ve +.IP "OpLASTSIB_set" 8 +.IX Xref "OpLASTSIB_set" +.IX Item "OpLASTSIB_set" +Marks \f(CW\*(C`o\*(C'\fR as having no further siblings and marks +o as having the specified parent. See also \f(CW"OpMORESIB_set"\fR and +\&\f(CW\*(C`OpMAYBESIB_set\*(C'\fR. For a higher-level interface, see +\&\f(CW"op_sibling_splice"\fR. +.Sp +.Vb 1 +\& void OpLASTSIB_set(OP *o, OP *parent) +.Ve +.IP "op_linklist" 8 +.IX Xref "op_linklist" +.IX Item "op_linklist" +This function is the implementation of the \*(L"\s-1LINKLIST\*(R"\s0 macro. It should +not be called directly. +.Sp +.Vb 1 +\& OP* op_linklist(OP *o) +.Ve +.IP "op_lvalue" 8 +.IX Xref "op_lvalue" +.IX Item "op_lvalue" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Propagate lvalue (\*(L"modifiable\*(R") context to an op and its children. +\&\f(CW\*(C`type\*(C'\fR represents the context type, roughly based on the type of op that +would do the modifying, although \f(CW\*(C`local()\*(C'\fR is represented by \f(CW\*(C`OP_NULL\*(C'\fR, +because it has no op type of its own (it is signalled by a flag on +the lvalue op). +.Sp +This function detects things that can't be modified, such as \f(CW\*(C`$x+1\*(C'\fR, and +generates errors for them. For example, \f(CW\*(C`$x+1 = 2\*(C'\fR would cause it to be +called with an op of type \f(CW\*(C`OP_ADD\*(C'\fR and a \f(CW\*(C`type\*(C'\fR argument of \f(CW\*(C`OP_SASSIGN\*(C'\fR. +.Sp +It also flags things that need to behave specially in an lvalue context, +such as \f(CW\*(C`$$x = 5\*(C'\fR which might have to vivify a reference in \f(CW$x\fR. +.Sp +.Vb 1 +\& OP* op_lvalue(OP* o, I32 type) +.Ve +.IP "OpMAYBESIB_set" 8 +.IX Xref "OpMAYBESIB_set" +.IX Item "OpMAYBESIB_set" +Conditionally does \f(CW\*(C`OpMORESIB_set\*(C'\fR or \f(CW\*(C`OpLASTSIB_set\*(C'\fR depending on whether +\&\f(CW\*(C`sib\*(C'\fR is non-null. For a higher-level interface, see \f(CW"op_sibling_splice"\fR. +.Sp +.Vb 1 +\& void OpMAYBESIB_set(OP *o, OP *sib, OP *parent) +.Ve +.IP "OpMORESIB_set" 8 +.IX Xref "OpMORESIB_set" +.IX Item "OpMORESIB_set" +Sets the sibling of \f(CW\*(C`o\*(C'\fR to the non-zero value \f(CW\*(C`sib\*(C'\fR. See also \f(CW"OpLASTSIB_set"\fR +and \f(CW"OpMAYBESIB_set"\fR. For a higher-level interface, see +\&\f(CW"op_sibling_splice"\fR. +.Sp +.Vb 1 +\& void OpMORESIB_set(OP *o, OP *sib) +.Ve +.IP "\s-1OP_NAME\s0" 8 +.IX Xref "OP_NAME" +.IX Item "OP_NAME" +Return the name of the provided \s-1OP.\s0 For core ops this looks up the name +from the op_type; for custom ops from the op_ppaddr. +.Sp +.Vb 1 +\& const char * OP_NAME(OP *o) +.Ve +.IP "op_null" 8 +.IX Xref "op_null" +.IX Item "op_null" +Neutralizes an op when it is no longer needed, but is still linked to from +other ops. +.Sp +.Vb 1 +\& void op_null(OP* o) +.Ve +.IP "op_parent" 8 +.IX Xref "op_parent" +.IX Item "op_parent" +Returns the parent \s-1OP\s0 of \f(CW\*(C`o\*(C'\fR, if it has a parent. Returns \f(CW\*(C`NULL\*(C'\fR otherwise. +.Sp +.Vb 1 +\& OP* op_parent(OP *o) +.Ve +.IP "op_prepend_elem" 8 +.IX Xref "op_prepend_elem" +.IX Item "op_prepend_elem" +Prepend an item to the list of ops contained directly within a list-type +op, returning the lengthened list. \f(CW\*(C`first\*(C'\fR is the op to prepend to the +list, and \f(CW\*(C`last\*(C'\fR is the list-type op. \f(CW\*(C`optype\*(C'\fR specifies the intended +opcode for the list. If \f(CW\*(C`last\*(C'\fR is not already a list of the right type, +it will be upgraded into one. If either \f(CW\*(C`first\*(C'\fR or \f(CW\*(C`last\*(C'\fR is null, +the other is returned unchanged. +.Sp +.Vb 1 +\& OP* op_prepend_elem(I32 optype, OP* first, OP* last) +.Ve +.IP "op_scope" 8 +.IX Xref "op_scope" +.IX Item "op_scope" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Wraps up an op tree with some additional ops so that at runtime a dynamic +scope will be created. The original ops run in the new dynamic scope, +and then, provided that they exit normally, the scope will be unwound. +The additional ops used to create and unwind the dynamic scope will +normally be an \f(CW\*(C`enter\*(C'\fR/\f(CW\*(C`leave\*(C'\fR pair, but a \f(CW\*(C`scope\*(C'\fR op may be used +instead if the ops are simple enough to not need the full dynamic scope +structure. +.Sp +.Vb 1 +\& OP* op_scope(OP* o) +.Ve +.IP "OpSIBLING" 8 +.IX Xref "OpSIBLING" +.IX Item "OpSIBLING" +Returns the sibling of \f(CW\*(C`o\*(C'\fR, or \f(CW\*(C`NULL\*(C'\fR if there is no sibling +.Sp +.Vb 1 +\& OP* OpSIBLING(OP *o) +.Ve +.IP "op_sibling_splice" 8 +.IX Xref "op_sibling_splice" +.IX Item "op_sibling_splice" +A general function for editing the structure of an existing chain of +op_sibling nodes. By analogy with the perl-level \f(CW\*(C`splice()\*(C'\fR function, allows +you to delete zero or more sequential nodes, replacing them with zero or +more different nodes. Performs the necessary op_first/op_last +housekeeping on the parent node and op_sibling manipulation on the +children. The last deleted node will be marked as the last node by +updating the op_sibling/op_sibparent or op_moresib field as appropriate. +.Sp +Note that op_next is not manipulated, and nodes are not freed; that is the +responsibility of the caller. It also won't create a new list op for an +empty list etc; use higher-level functions like \fBop_append_elem()\fR for that. +.Sp +\&\f(CW\*(C`parent\*(C'\fR is the parent node of the sibling chain. It may passed as \f(CW\*(C`NULL\*(C'\fR if +the splicing doesn't affect the first or last op in the chain. +.Sp +\&\f(CW\*(C`start\*(C'\fR is the node preceding the first node to be spliced. Node(s) +following it will be deleted, and ops will be inserted after it. If it is +\&\f(CW\*(C`NULL\*(C'\fR, the first node onwards is deleted, and nodes are inserted at the +beginning. +.Sp +\&\f(CW\*(C`del_count\*(C'\fR is the number of nodes to delete. If zero, no nodes are deleted. +If \-1 or greater than or equal to the number of remaining kids, all +remaining kids are deleted. +.Sp +\&\f(CW\*(C`insert\*(C'\fR is the first of a chain of nodes to be inserted in place of the nodes. +If \f(CW\*(C`NULL\*(C'\fR, no nodes are inserted. +.Sp +The head of the chain of deleted ops is returned, or \f(CW\*(C`NULL\*(C'\fR if no ops were +deleted. +.Sp +For example: +.Sp +.Vb 2 +\& action before after returns +\& \-\-\-\-\-\- \-\-\-\-\- \-\-\-\-\- \-\-\-\-\-\-\- +\& +\& P P +\& splice(P, A, 2, X\-Y\-Z) | | B\-C +\& A\-B\-C\-D A\-X\-Y\-Z\-D +\& +\& P P +\& splice(P, NULL, 1, X\-Y) | | A +\& A\-B\-C\-D X\-Y\-B\-C\-D +\& +\& P P +\& splice(P, NULL, 3, NULL) | | A\-B\-C +\& A\-B\-C\-D D +\& +\& P P +\& splice(P, B, 0, X\-Y) | | NULL +\& A\-B\-C\-D A\-B\-X\-Y\-C\-D +.Ve +.Sp +For lower-level direct manipulation of \f(CW\*(C`op_sibparent\*(C'\fR and \f(CW\*(C`op_moresib\*(C'\fR, +see \f(CW"OpMORESIB_set"\fR, \f(CW"OpLASTSIB_set"\fR, \f(CW"OpMAYBESIB_set"\fR. +.Sp +.Vb 2 +\& OP* op_sibling_splice(OP *parent, OP *start, +\& int del_count, OP* insert) +.Ve +.IP "\s-1OP_TYPE_IS\s0" 8 +.IX Xref "OP_TYPE_IS" +.IX Item "OP_TYPE_IS" +Returns true if the given \s-1OP\s0 is not a \f(CW\*(C`NULL\*(C'\fR pointer +and if it is of the given type. +.Sp +The negation of this macro, \f(CW\*(C`OP_TYPE_ISNT\*(C'\fR is also available +as well as \f(CW\*(C`OP_TYPE_IS_NN\*(C'\fR and \f(CW\*(C`OP_TYPE_ISNT_NN\*(C'\fR which elide +the \s-1NULL\s0 pointer check. +.Sp +.Vb 1 +\& bool OP_TYPE_IS(OP *o, Optype type) +.Ve +.IP "\s-1OP_TYPE_IS_OR_WAS\s0" 8 +.IX Xref "OP_TYPE_IS_OR_WAS" +.IX Item "OP_TYPE_IS_OR_WAS" +Returns true if the given \s-1OP\s0 is not a \s-1NULL\s0 pointer and +if it is of the given type or used to be before being +replaced by an \s-1OP\s0 of type \s-1OP_NULL.\s0 +.Sp +The negation of this macro, \f(CW\*(C`OP_TYPE_ISNT_AND_WASNT\*(C'\fR +is also available as well as \f(CW\*(C`OP_TYPE_IS_OR_WAS_NN\*(C'\fR +and \f(CW\*(C`OP_TYPE_ISNT_AND_WASNT_NN\*(C'\fR which elide +the \f(CW\*(C`NULL\*(C'\fR pointer check. +.Sp +.Vb 1 +\& bool OP_TYPE_IS_OR_WAS(OP *o, Optype type) +.Ve +.IP "rv2cv_op_cv" 8 +.IX Xref "rv2cv_op_cv" +.IX Item "rv2cv_op_cv" +Examines an op, which is expected to identify a subroutine at runtime, +and attempts to determine at compile time which subroutine it identifies. +This is normally used during Perl compilation to determine whether +a prototype can be applied to a function call. \f(CW\*(C`cvop\*(C'\fR is the op +being considered, normally an \f(CW\*(C`rv2cv\*(C'\fR op. A pointer to the identified +subroutine is returned, if it could be determined statically, and a null +pointer is returned if it was not possible to determine statically. +.Sp +Currently, the subroutine can be identified statically if the \s-1RV\s0 that the +\&\f(CW\*(C`rv2cv\*(C'\fR is to operate on is provided by a suitable \f(CW\*(C`gv\*(C'\fR or \f(CW\*(C`const\*(C'\fR op. +A \f(CW\*(C`gv\*(C'\fR op is suitable if the \s-1GV\s0's \s-1CV\s0 slot is populated. A \f(CW\*(C`const\*(C'\fR op is +suitable if the constant value must be an \s-1RV\s0 pointing to a \s-1CV.\s0 Details of +this process may change in future versions of Perl. If the \f(CW\*(C`rv2cv\*(C'\fR op +has the \f(CW\*(C`OPpENTERSUB_AMPER\*(C'\fR flag set then no attempt is made to identify +the subroutine statically: this flag is used to suppress compile-time +magic on a subroutine call, forcing it to use default runtime behaviour. +.Sp +If \f(CW\*(C`flags\*(C'\fR has the bit \f(CW\*(C`RV2CVOPCV_MARK_EARLY\*(C'\fR set, then the handling +of a \s-1GV\s0 reference is modified. If a \s-1GV\s0 was examined and its \s-1CV\s0 slot was +found to be empty, then the \f(CW\*(C`gv\*(C'\fR op has the \f(CW\*(C`OPpEARLY_CV\*(C'\fR flag set. +If the op is not optimised away, and the \s-1CV\s0 slot is later populated with +a subroutine having a prototype, that flag eventually triggers the warning +\&\*(L"called too early to check prototype\*(R". +.Sp +If \f(CW\*(C`flags\*(C'\fR has the bit \f(CW\*(C`RV2CVOPCV_RETURN_NAME_GV\*(C'\fR set, then instead +of returning a pointer to the subroutine it returns a pointer to the +\&\s-1GV\s0 giving the most appropriate name for the subroutine in this context. +Normally this is just the \f(CW\*(C`CvGV\*(C'\fR of the subroutine, but for an anonymous +(\f(CW\*(C`CvANON\*(C'\fR) subroutine that is referenced through a \s-1GV\s0 it will be the +referencing \s-1GV.\s0 The resulting \f(CW\*(C`GV*\*(C'\fR is cast to \f(CW\*(C`CV*\*(C'\fR to be returned. +A null pointer is returned as usual if there is no statically-determinable +subroutine. +.Sp +.Vb 1 +\& CV* rv2cv_op_cv(OP *cvop, U32 flags) +.Ve +.SH "Pack and Unpack" +.IX Header "Pack and Unpack" +.IP "packlist" 8 +.IX Xref "packlist" +.IX Item "packlist" +The engine implementing \f(CW\*(C`pack()\*(C'\fR Perl function. +.Sp +.Vb 3 +\& void packlist(SV *cat, const char *pat, +\& const char *patend, SV **beglist, +\& SV **endlist) +.Ve +.IP "unpackstring" 8 +.IX Xref "unpackstring" +.IX Item "unpackstring" +The engine implementing the \f(CW\*(C`unpack()\*(C'\fR Perl function. +.Sp +Using the template \f(CW\*(C`pat..patend\*(C'\fR, this function unpacks the string +\&\f(CW\*(C`s..strend\*(C'\fR into a number of mortal SVs, which it pushes onto the perl +argument (\f(CW@_\fR) stack (so you will need to issue a \f(CW\*(C`PUTBACK\*(C'\fR before and +\&\f(CW\*(C`SPAGAIN\*(C'\fR after the call to this function). It returns the number of +pushed elements. +.Sp +The \f(CW\*(C`strend\*(C'\fR and \f(CW\*(C`patend\*(C'\fR pointers should point to the byte following the +last character of each string. +.Sp +Although this function returns its values on the perl argument stack, it +doesn't take any parameters from that stack (and thus in particular +there's no need to do a \f(CW\*(C`PUSHMARK\*(C'\fR before calling it, unlike \*(L"call_pv\*(R" for +example). +.Sp +.Vb 3 +\& SSize_t unpackstring(const char *pat, +\& const char *patend, const char *s, +\& const char *strend, U32 flags) +.Ve +.SH "Pad Data Structures" +.IX Header "Pad Data Structures" +.IP "CvPADLIST" 8 +.IX Xref "CvPADLIST" +.IX Item "CvPADLIST" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +\&\s-1CV\s0's can have CvPADLIST(cv) set to point to a \s-1PADLIST.\s0 This is the \s-1CV\s0's +scratchpad, which stores lexical variables and opcode temporary and +per-thread values. +.Sp +For these purposes \*(L"formats\*(R" are a kind-of \s-1CV\s0; eval"\*(L"s are too (except they're +not callable at will and are always thrown away after the eval\*(R"" is done +executing). Require'd files are simply evals without any outer lexical +scope. +.Sp +XSUBs do not have a \f(CW\*(C`CvPADLIST\*(C'\fR. \f(CW\*(C`dXSTARG\*(C'\fR fetches values from \f(CW\*(C`PL_curpad\*(C'\fR, +but that is really the callers pad (a slot of which is allocated by +every entersub). Do not get or set \f(CW\*(C`CvPADLIST\*(C'\fR if a \s-1CV\s0 is an \s-1XSUB\s0 (as +determined by \f(CW\*(C`CvISXSUB()\*(C'\fR), \f(CW\*(C`CvPADLIST\*(C'\fR slot is reused for a different +internal purpose in XSUBs. +.Sp +The \s-1PADLIST\s0 has a C array where pads are stored. +.Sp +The 0th entry of the \s-1PADLIST\s0 is a \s-1PADNAMELIST\s0 +which represents the \*(L"names\*(R" or rather +the \*(L"static type information\*(R" for lexicals. The individual elements of a +\&\s-1PADNAMELIST\s0 are PADNAMEs. Future +refactorings might stop the \s-1PADNAMELIST\s0 from being stored in the \s-1PADLIST\s0's +array, so don't rely on it. See \*(L"PadlistNAMES\*(R". +.Sp +The CvDEPTH'th entry of a \s-1PADLIST\s0 is a \s-1PAD\s0 (an \s-1AV\s0) which is the stack frame +at that depth of recursion into the \s-1CV.\s0 The 0th slot of a frame \s-1AV\s0 is an +\&\s-1AV\s0 which is \f(CW@_\fR. Other entries are storage for variables and op targets. +.Sp +Iterating over the \s-1PADNAMELIST\s0 iterates over all possible pad +items. Pad slots for targets (\f(CW\*(C`SVs_PADTMP\*(C'\fR) +and GVs end up having &PL_padname_undef \*(L"names\*(R", while slots for constants +have \f(CW&PL_padname_const\fR \*(L"names\*(R" (see \f(CW"pad_alloc"\fR). That +\&\f(CW&PL_padname_undef\fR +and \f(CW&PL_padname_const\fR are used is an implementation detail subject to +change. To test for them, use \f(CW\*(C`!PadnamePV(name)\*(C'\fR and +\&\f(CW\*(C`PadnamePV(name)\ &&\ !PadnameLEN(name)\*(C'\fR, respectively. +.Sp +Only \f(CW\*(C`my\*(C'\fR/\f(CW\*(C`our\*(C'\fR variable slots get valid names. +The rest are op targets/GVs/constants which are statically allocated +or resolved at compile time. These don't have names by which they +can be looked up from Perl code at run time through eval"" the way +\&\f(CW\*(C`my\*(C'\fR/\f(CW\*(C`our\*(C'\fR variables can be. Since they can't be looked up by \*(L"name\*(R" +but only by their index allocated at compile time (which is usually +in \f(CW\*(C`PL_op\->op_targ\*(C'\fR), wasting a name \s-1SV\s0 for them doesn't make sense. +.Sp +The pad names in the \s-1PADNAMELIST\s0 have their \s-1PV\s0 holding the name of +the variable. The \f(CW\*(C`COP_SEQ_RANGE_LOW\*(C'\fR and \f(CW\*(C`_HIGH\*(C'\fR fields form a range +(low+1..high inclusive) of cop_seq numbers for which the name is +valid. During compilation, these fields may hold the special value +\&\s-1PERL_PADSEQ_INTRO\s0 to indicate various stages: +.Sp +.Vb 8 +\& COP_SEQ_RANGE_LOW _HIGH +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\- +\& PERL_PADSEQ_INTRO 0 variable not yet introduced: +\& { my ($x +\& valid\-seq# PERL_PADSEQ_INTRO variable in scope: +\& { my ($x); +\& valid\-seq# valid\-seq# compilation of scope complete: +\& { my ($x); .... } +.Ve +.Sp +When a lexical var hasn't yet been introduced, it already exists from the +perspective of duplicate declarations, but not for variable lookups, e.g. +.Sp +.Vb 2 +\& my ($x, $x); # \*(Aq"my" variable $x masks earlier declaration\*(Aq +\& my $x = $x; # equal to my $x = $::x; +.Ve +.Sp +For typed lexicals \f(CW\*(C`PadnameTYPE\*(C'\fR points at the type stash. For \f(CW\*(C`our\*(C'\fR +lexicals, \f(CW\*(C`PadnameOURSTASH\*(C'\fR points at the stash of the associated global (so +that duplicate \f(CW\*(C`our\*(C'\fR declarations in the same package can be detected). +\&\f(CW\*(C`PadnameGEN\*(C'\fR is sometimes used to store the generation number during +compilation. +.Sp +If \f(CW\*(C`PadnameOUTER\*(C'\fR is set on the pad name, then that slot in the frame \s-1AV\s0 +is a \s-1REFCNT\s0'ed reference to a lexical from \*(L"outside\*(R". Such entries +are sometimes referred to as 'fake'. In this case, the name does not +use 'low' and 'high' to store a cop_seq range, since it is in scope +throughout. Instead 'high' stores some flags containing info about +the real lexical (is it declared in an anon, and is it capable of being +instantiated multiple times?), and for fake ANONs, 'low' contains the index +within the parent's pad where the lexical's value is stored, to make +cloning quicker. +.Sp +If the 'name' is \f(CW\*(C`&\*(C'\fR the corresponding entry in the \s-1PAD\s0 +is a \s-1CV\s0 representing a possible closure. +.Sp +Note that formats are treated as anon subs, and are cloned each time +write is called (if necessary). +.Sp +The flag \f(CW\*(C`SVs_PADSTALE\*(C'\fR is cleared on lexicals each time the \f(CW\*(C`my()\*(C'\fR is executed, +and set on scope exit. This allows the +\&\f(CW"Variable $x is not available"\fR warning +to be generated in evals, such as +.Sp +.Vb 1 +\& { my $x = 1; sub f { eval \*(Aq$x\*(Aq} } f(); +.Ve +.Sp +For state vars, \f(CW\*(C`SVs_PADSTALE\*(C'\fR is overloaded to mean 'not yet initialised', +but this internal state is stored in a separate pad entry. +.Sp +.Vb 1 +\& PADLIST * CvPADLIST(CV *cv) +.Ve +.IP "pad_add_name_pvs" 8 +.IX Xref "pad_add_name_pvs" +.IX Item "pad_add_name_pvs" +Exactly like \*(L"pad_add_name_pvn\*(R", but takes a literal string +instead of a string/length pair. +.Sp +.Vb 2 +\& PADOFFSET pad_add_name_pvs("name", U32 flags, +\& HV *typestash, HV *ourstash) +.Ve +.IP "PadARRAY" 8 +.IX Xref "PadARRAY" +.IX Item "PadARRAY" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The C array of pad entries. +.Sp +.Vb 1 +\& SV ** PadARRAY(PAD * pad) +.Ve +.IP "pad_findmy_pvs" 8 +.IX Xref "pad_findmy_pvs" +.IX Item "pad_findmy_pvs" +Exactly like \*(L"pad_findmy_pvn\*(R", but takes a literal string +instead of a string/length pair. +.Sp +.Vb 1 +\& PADOFFSET pad_findmy_pvs("name", U32 flags) +.Ve +.IP "PadlistARRAY" 8 +.IX Xref "PadlistARRAY" +.IX Item "PadlistARRAY" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The C array of a padlist, containing the pads. Only subscript it with +numbers >= 1, as the 0th entry is not guaranteed to remain usable. +.Sp +.Vb 1 +\& PAD ** PadlistARRAY(PADLIST * padlist) +.Ve +.IP "PadlistMAX" 8 +.IX Xref "PadlistMAX" +.IX Item "PadlistMAX" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The index of the last allocated space in the padlist. Note that the last +pad may be in an earlier slot. Any entries following it will be \f(CW\*(C`NULL\*(C'\fR in +that case. +.Sp +.Vb 1 +\& SSize_t PadlistMAX(PADLIST * padlist) +.Ve +.IP "PadlistNAMES" 8 +.IX Xref "PadlistNAMES" +.IX Item "PadlistNAMES" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The names associated with pad entries. +.Sp +.Vb 1 +\& PADNAMELIST * PadlistNAMES(PADLIST * padlist) +.Ve +.IP "PadlistNAMESARRAY" 8 +.IX Xref "PadlistNAMESARRAY" +.IX Item "PadlistNAMESARRAY" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The C array of pad names. +.Sp +.Vb 1 +\& PADNAME ** PadlistNAMESARRAY(PADLIST * padlist) +.Ve +.IP "PadlistNAMESMAX" 8 +.IX Xref "PadlistNAMESMAX" +.IX Item "PadlistNAMESMAX" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The index of the last pad name. +.Sp +.Vb 1 +\& SSize_t PadlistNAMESMAX(PADLIST * padlist) +.Ve +.IP "PadlistREFCNT" 8 +.IX Xref "PadlistREFCNT" +.IX Item "PadlistREFCNT" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The reference count of the padlist. Currently this is always 1. +.Sp +.Vb 1 +\& U32 PadlistREFCNT(PADLIST * padlist) +.Ve +.IP "PadMAX" 8 +.IX Xref "PadMAX" +.IX Item "PadMAX" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The index of the last pad entry. +.Sp +.Vb 1 +\& SSize_t PadMAX(PAD * pad) +.Ve +.IP "PadnameLEN" 8 +.IX Xref "PadnameLEN" +.IX Item "PadnameLEN" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The length of the name. +.Sp +.Vb 1 +\& STRLEN PadnameLEN(PADNAME * pn) +.Ve +.IP "PadnamelistARRAY" 8 +.IX Xref "PadnamelistARRAY" +.IX Item "PadnamelistARRAY" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The C array of pad names. +.Sp +.Vb 1 +\& PADNAME ** PadnamelistARRAY(PADNAMELIST * pnl) +.Ve +.IP "PadnamelistMAX" 8 +.IX Xref "PadnamelistMAX" +.IX Item "PadnamelistMAX" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The index of the last pad name. +.Sp +.Vb 1 +\& SSize_t PadnamelistMAX(PADNAMELIST * pnl) +.Ve +.IP "PadnamelistREFCNT" 8 +.IX Xref "PadnamelistREFCNT" +.IX Item "PadnamelistREFCNT" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The reference count of the pad name list. +.Sp +.Vb 1 +\& SSize_t PadnamelistREFCNT(PADNAMELIST * pnl) +.Ve +.IP "PadnamelistREFCNT_dec" 8 +.IX Xref "PadnamelistREFCNT_dec" +.IX Item "PadnamelistREFCNT_dec" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Lowers the reference count of the pad name list. +.Sp +.Vb 1 +\& void PadnamelistREFCNT_dec(PADNAMELIST * pnl) +.Ve +.IP "PadnamePV" 8 +.IX Xref "PadnamePV" +.IX Item "PadnamePV" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The name stored in the pad name struct. This returns \f(CW\*(C`NULL\*(C'\fR for a target +slot. +.Sp +.Vb 1 +\& char * PadnamePV(PADNAME * pn) +.Ve +.IP "PadnameREFCNT" 8 +.IX Xref "PadnameREFCNT" +.IX Item "PadnameREFCNT" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +The reference count of the pad name. +.Sp +.Vb 1 +\& SSize_t PadnameREFCNT(PADNAME * pn) +.Ve +.IP "PadnameREFCNT_dec" 8 +.IX Xref "PadnameREFCNT_dec" +.IX Item "PadnameREFCNT_dec" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Lowers the reference count of the pad name. +.Sp +.Vb 1 +\& void PadnameREFCNT_dec(PADNAME * pn) +.Ve +.IP "PadnameSV" 8 +.IX Xref "PadnameSV" +.IX Item "PadnameSV" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Returns the pad name as a mortal \s-1SV.\s0 +.Sp +.Vb 1 +\& SV * PadnameSV(PADNAME * pn) +.Ve +.IP "PadnameUTF8" 8 +.IX Xref "PadnameUTF8" +.IX Item "PadnameUTF8" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Whether PadnamePV is in \s-1UTF\-8.\s0 Currently, this is always true. +.Sp +.Vb 1 +\& bool PadnameUTF8(PADNAME * pn) +.Ve +.IP "pad_new" 8 +.IX Xref "pad_new" +.IX Item "pad_new" +Create a new padlist, updating the global variables for the +currently-compiling padlist to point to the new padlist. The following +flags can be \s-1OR\s0'ed together: +.Sp +.Vb 3 +\& padnew_CLONE this pad is for a cloned CV +\& padnew_SAVE save old globals on the save stack +\& padnew_SAVESUB also save extra stuff for start of sub +\& +\& PADLIST* pad_new(int flags) +.Ve +.IP "PL_comppad" 8 +.IX Xref "PL_comppad" +.IX Item "PL_comppad" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +During compilation, this points to the array containing the values +part of the pad for the currently-compiling code. (At runtime a \s-1CV\s0 may +have many such value arrays; at compile time just one is constructed.) +At runtime, this points to the array containing the currently-relevant +values for the pad for the currently-executing code. +.IP "PL_comppad_name" 8 +.IX Xref "PL_comppad_name" +.IX Item "PL_comppad_name" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +During compilation, this points to the array containing the names part +of the pad for the currently-compiling code. +.IP "PL_curpad" 8 +.IX Xref "PL_curpad" +.IX Item "PL_curpad" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Points directly to the body of the \*(L"PL_comppad\*(R" array. +(I.e., this is \f(CW\*(C`PadARRAY(PL_comppad)\*(C'\fR.) +.SH "Per-Interpreter Variables" +.IX Header "Per-Interpreter Variables" +.IP "PL_curcop" 8 +.IX Xref "PL_curcop" +.IX Item "PL_curcop" +The currently active \s-1COP\s0 (control op) roughly representing the current +statement in the source. +.Sp +.Vb 1 +\& COP* PL_curcop +.Ve +.IP "PL_curstash" 8 +.IX Xref "PL_curstash" +.IX Item "PL_curstash" +The stash for the package code will be compiled into. +.Sp +.Vb 1 +\& HV* PL_curstash +.Ve +.IP "PL_defgv" 8 +.IX Xref "PL_defgv" +.IX Item "PL_defgv" +The \s-1GV\s0 representing \f(CW*_\fR. Useful for access to \f(CW$_\fR. +.Sp +.Vb 1 +\& GV * PL_defgv +.Ve +.IP "PL_exit_flags" 8 +.IX Xref "PL_exit_flags" +.IX Item "PL_exit_flags" +Contains flags controlling perl's behaviour on \fBexit()\fR: +.RS 8 +.IP "\(bu" 4 +\&\f(CW\*(C`PERL_EXIT_DESTRUCT_END\*(C'\fR +.Sp +If set, \s-1END\s0 blocks are executed when the interpreter is destroyed. +This is normally set by perl itself after the interpreter is +constructed. +.IP "\(bu" 4 +\&\f(CW\*(C`PERL_EXIT_ABORT\*(C'\fR +.Sp +Call \f(CW\*(C`abort()\*(C'\fR on exit. This is used internally by perl itself to +abort if exit is called while processing exit. +.IP "\(bu" 4 +\&\f(CW\*(C`PERL_EXIT_WARN\*(C'\fR +.Sp +Warn on exit. +.IP "\(bu" 4 +\&\f(CW\*(C`PERL_EXIT_EXPECTED\*(C'\fR +.Sp +Set by the \*(L"exit\*(R" in perlfunc operator. +.RE +.RS 8 +.Sp +.Vb 1 +\& U8 PL_exit_flags +.Ve +.RE +.IP "PL_modglobal" 8 +.IX Xref "PL_modglobal" +.IX Item "PL_modglobal" +\&\f(CW\*(C`PL_modglobal\*(C'\fR is a general purpose, interpreter global \s-1HV\s0 for use by +extensions that need to keep information on a per-interpreter basis. +In a pinch, it can also be used as a symbol table for extensions +to share data among each other. It is a good idea to use keys +prefixed by the package name of the extension that owns the data. +.Sp +.Vb 1 +\& HV* PL_modglobal +.Ve +.IP "PL_na" 8 +.IX Xref "PL_na" +.IX Item "PL_na" +A convenience variable which is typically used with \f(CW\*(C`SvPV\*(C'\fR when one +doesn't care about the length of the string. It is usually more efficient +to either declare a local variable and use that instead or to use the +\&\f(CW\*(C`SvPV_nolen\*(C'\fR macro. +.Sp +.Vb 1 +\& STRLEN PL_na +.Ve +.IP "PL_opfreehook" 8 +.IX Xref "PL_opfreehook" +.IX Item "PL_opfreehook" +When non\-\f(CW\*(C`NULL\*(C'\fR, the function pointed by this variable will be called each time an \s-1OP\s0 is freed with the corresponding \s-1OP\s0 as the argument. +This allows extensions to free any extra attribute they have locally attached to an \s-1OP.\s0 +It is also assured to first fire for the parent \s-1OP\s0 and then for its kids. +.Sp +When you replace this variable, it is considered a good practice to store the possibly previously installed hook and that you recall it inside your own. +.Sp +.Vb 1 +\& Perl_ophook_t PL_opfreehook +.Ve +.IP "PL_peepp" 8 +.IX Xref "PL_peepp" +.IX Item "PL_peepp" +Pointer to the per-subroutine peephole optimiser. This is a function +that gets called at the end of compilation of a Perl subroutine (or +equivalently independent piece of Perl code) to perform fixups of +some ops and to perform small-scale optimisations. The function is +called once for each subroutine that is compiled, and is passed, as sole +parameter, a pointer to the op that is the entry point to the subroutine. +It modifies the op tree in place. +.Sp +The peephole optimiser should never be completely replaced. Rather, +add code to it by wrapping the existing optimiser. The basic way to do +this can be seen in \*(L"Compile pass 3: peephole optimization\*(R" in perlguts. +If the new code wishes to operate on ops throughout the subroutine's +structure, rather than just at the top level, it is likely to be more +convenient to wrap the \*(L"PL_rpeepp\*(R" hook. +.Sp +.Vb 1 +\& peep_t PL_peepp +.Ve +.IP "PL_perl_destruct_level" 8 +.IX Xref "PL_perl_destruct_level" +.IX Item "PL_perl_destruct_level" +This value may be set when embedding for full cleanup. +.Sp +Possible values: +.RS 8 +.IP "\(bu" 4 +0 \- none +.IP "\(bu" 4 +1 \- full +.IP "\(bu" 4 +2 or greater \- full with checks. +.RE +.RS 8 +.Sp +If \f(CW$ENV{PERL_DESTRUCT_LEVEL}\fR is set to an integer greater than the +value of \f(CW\*(C`PL_perl_destruct_level\*(C'\fR its value is used instead. +.Sp +.Vb 1 +\& signed char PL_perl_destruct_level +.Ve +.RE +.IP "PL_rpeepp" 8 +.IX Xref "PL_rpeepp" +.IX Item "PL_rpeepp" +Pointer to the recursive peephole optimiser. This is a function +that gets called at the end of compilation of a Perl subroutine (or +equivalently independent piece of Perl code) to perform fixups of some +ops and to perform small-scale optimisations. The function is called +once for each chain of ops linked through their \f(CW\*(C`op_next\*(C'\fR fields; +it is recursively called to handle each side chain. It is passed, as +sole parameter, a pointer to the op that is at the head of the chain. +It modifies the op tree in place. +.Sp +The peephole optimiser should never be completely replaced. Rather, +add code to it by wrapping the existing optimiser. The basic way to do +this can be seen in \*(L"Compile pass 3: peephole optimization\*(R" in perlguts. +If the new code wishes to operate only on ops at a subroutine's top level, +rather than throughout the structure, it is likely to be more convenient +to wrap the \*(L"PL_peepp\*(R" hook. +.Sp +.Vb 1 +\& peep_t PL_rpeepp +.Ve +.IP "PL_runops" 8 +.IX Xref "PL_runops" +.IX Item "PL_runops" +See \*(L"Pluggable runops\*(R" in perlguts. +.Sp +.Vb 1 +\& runops_proc_t PL_runops +.Ve +.IP "PL_sv_no" 8 +.IX Xref "PL_sv_no" +.IX Item "PL_sv_no" +This is the \f(CW\*(C`false\*(C'\fR \s-1SV.\s0 See \f(CW"PL_sv_yes"\fR. Always refer to this as +\&\f(CW&PL_sv_no\fR. +.Sp +.Vb 1 +\& SV PL_sv_no +.Ve +.IP "PL_sv_undef" 8 +.IX Xref "PL_sv_undef" +.IX Item "PL_sv_undef" +This is the \f(CW\*(C`undef\*(C'\fR \s-1SV.\s0 Always refer to this as \f(CW&PL_sv_undef\fR. +.Sp +.Vb 1 +\& SV PL_sv_undef +.Ve +.IP "PL_sv_yes" 8 +.IX Xref "PL_sv_yes" +.IX Item "PL_sv_yes" +This is the \f(CW\*(C`true\*(C'\fR \s-1SV.\s0 See \f(CW"PL_sv_no"\fR. Always refer to this as +\&\f(CW&PL_sv_yes\fR. +.Sp +.Vb 1 +\& SV PL_sv_yes +.Ve +.IP "PL_sv_zero" 8 +.IX Xref "PL_sv_zero" +.IX Item "PL_sv_zero" +This readonly \s-1SV\s0 has a zero numeric value and a \f(CW"0"\fR string value. It's +similar to \f(CW"PL_sv_no"\fR except for its string value. Can be used as a +cheap alternative to \f(CWmXPUSHi(0)\fR for example. Always refer to this as +\&\f(CW&PL_sv_zero\fR. Introduced in 5.28. +.Sp +.Vb 1 +\& SV PL_sv_zero +.Ve +.SH "REGEXP Functions" +.IX Header "REGEXP Functions" +.IP "SvRX" 8 +.IX Xref "SvRX" +.IX Item "SvRX" +Convenience macro to get the \s-1REGEXP\s0 from a \s-1SV.\s0 This is approximately +equivalent to the following snippet: +.Sp +.Vb 6 +\& if (SvMAGICAL(sv)) +\& mg_get(sv); +\& if (SvROK(sv)) +\& sv = MUTABLE_SV(SvRV(sv)); +\& if (SvTYPE(sv) == SVt_REGEXP) +\& return (REGEXP*) sv; +.Ve +.Sp +\&\f(CW\*(C`NULL\*(C'\fR will be returned if a REGEXP* is not found. +.Sp +.Vb 1 +\& REGEXP * SvRX(SV *sv) +.Ve +.IP "SvRXOK" 8 +.IX Xref "SvRXOK" +.IX Item "SvRXOK" +Returns a boolean indicating whether the \s-1SV\s0 (or the one it references) +is a \s-1REGEXP.\s0 +.Sp +If you want to do something with the REGEXP* later use SvRX instead +and check for \s-1NULL.\s0 +.Sp +.Vb 1 +\& bool SvRXOK(SV* sv) +.Ve +.SH "Stack Manipulation Macros" +.IX Header "Stack Manipulation Macros" +.IP "dMARK" 8 +.IX Xref "dMARK" +.IX Item "dMARK" +Declare a stack marker variable, \f(CW\*(C`mark\*(C'\fR, for the \s-1XSUB.\s0 See \f(CW"MARK"\fR and +\&\f(CW"dORIGMARK"\fR. +.Sp +.Vb 1 +\& dMARK; +.Ve +.IP "dORIGMARK" 8 +.IX Xref "dORIGMARK" +.IX Item "dORIGMARK" +Saves the original stack mark for the \s-1XSUB.\s0 See \f(CW"ORIGMARK"\fR. +.Sp +.Vb 1 +\& dORIGMARK; +.Ve +.IP "dSP" 8 +.IX Xref "dSP" +.IX Item "dSP" +Declares a local copy of perl's stack pointer for the \s-1XSUB,\s0 available via +the \f(CW\*(C`SP\*(C'\fR macro. See \f(CW"SP"\fR. +.Sp +.Vb 1 +\& dSP; +.Ve +.IP "\s-1EXTEND\s0" 8 +.IX Xref "EXTEND" +.IX Item "EXTEND" +Used to extend the argument stack for an \s-1XSUB\s0's return values. Once +used, guarantees that there is room for at least \f(CW\*(C`nitems\*(C'\fR to be pushed +onto the stack. +.Sp +.Vb 1 +\& void EXTEND(SP, SSize_t nitems) +.Ve +.IP "\s-1MARK\s0" 8 +.IX Xref "MARK" +.IX Item "MARK" +Stack marker variable for the \s-1XSUB.\s0 See \f(CW"dMARK"\fR. +.IP "mPUSHi" 8 +.IX Xref "mPUSHi" +.IX Item "mPUSHi" +Push an integer onto the stack. The stack must have room for this element. +Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"PUSHi"\fR, \f(CW"mXPUSHi"\fR and \f(CW"XPUSHi"\fR. +.Sp +.Vb 1 +\& void mPUSHi(IV iv) +.Ve +.IP "mPUSHn" 8 +.IX Xref "mPUSHn" +.IX Item "mPUSHn" +Push a double onto the stack. The stack must have room for this element. +Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"PUSHn"\fR, \f(CW"mXPUSHn"\fR and \f(CW"XPUSHn"\fR. +.Sp +.Vb 1 +\& void mPUSHn(NV nv) +.Ve +.IP "mPUSHp" 8 +.IX Xref "mPUSHp" +.IX Item "mPUSHp" +Push a string onto the stack. The stack must have room for this element. +The \f(CW\*(C`len\*(C'\fR indicates the length of the string. Does not use \f(CW\*(C`TARG\*(C'\fR. +See also \f(CW"PUSHp"\fR, \f(CW"mXPUSHp"\fR and \f(CW"XPUSHp"\fR. +.Sp +.Vb 1 +\& void mPUSHp(char* str, STRLEN len) +.Ve +.IP "mPUSHs" 8 +.IX Xref "mPUSHs" +.IX Item "mPUSHs" +Push an \s-1SV\s0 onto the stack and mortalizes the \s-1SV.\s0 The stack must have room +for this element. Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"PUSHs"\fR and +\&\f(CW"mXPUSHs"\fR. +.Sp +.Vb 1 +\& void mPUSHs(SV* sv) +.Ve +.IP "mPUSHu" 8 +.IX Xref "mPUSHu" +.IX Item "mPUSHu" +Push an unsigned integer onto the stack. The stack must have room for this +element. Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"PUSHu"\fR, \f(CW"mXPUSHu"\fR and +\&\f(CW"XPUSHu"\fR. +.Sp +.Vb 1 +\& void mPUSHu(UV uv) +.Ve +.IP "mXPUSHi" 8 +.IX Xref "mXPUSHi" +.IX Item "mXPUSHi" +Push an integer onto the stack, extending the stack if necessary. +Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"XPUSHi"\fR, \f(CW"mPUSHi"\fR and \f(CW"PUSHi"\fR. +.Sp +.Vb 1 +\& void mXPUSHi(IV iv) +.Ve +.IP "mXPUSHn" 8 +.IX Xref "mXPUSHn" +.IX Item "mXPUSHn" +Push a double onto the stack, extending the stack if necessary. +Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"XPUSHn"\fR, \f(CW"mPUSHn"\fR and \f(CW"PUSHn"\fR. +.Sp +.Vb 1 +\& void mXPUSHn(NV nv) +.Ve +.IP "mXPUSHp" 8 +.IX Xref "mXPUSHp" +.IX Item "mXPUSHp" +Push a string onto the stack, extending the stack if necessary. The \f(CW\*(C`len\*(C'\fR +indicates the length of the string. Does not use \f(CW\*(C`TARG\*(C'\fR. See also +\&\f(CW"XPUSHp"\fR, \f(CW\*(C`mPUSHp\*(C'\fR and \f(CW\*(C`PUSHp\*(C'\fR. +.Sp +.Vb 1 +\& void mXPUSHp(char* str, STRLEN len) +.Ve +.IP "mXPUSHs" 8 +.IX Xref "mXPUSHs" +.IX Item "mXPUSHs" +Push an \s-1SV\s0 onto the stack, extending the stack if necessary and mortalizes +the \s-1SV.\s0 Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"XPUSHs"\fR and \f(CW"mPUSHs"\fR. +.Sp +.Vb 1 +\& void mXPUSHs(SV* sv) +.Ve +.IP "mXPUSHu" 8 +.IX Xref "mXPUSHu" +.IX Item "mXPUSHu" +Push an unsigned integer onto the stack, extending the stack if necessary. +Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"XPUSHu"\fR, \f(CW"mPUSHu"\fR and \f(CW"PUSHu"\fR. +.Sp +.Vb 1 +\& void mXPUSHu(UV uv) +.Ve +.IP "\s-1ORIGMARK\s0" 8 +.IX Xref "ORIGMARK" +.IX Item "ORIGMARK" +The original stack mark for the \s-1XSUB.\s0 See \f(CW"dORIGMARK"\fR. +.IP "POPi" 8 +.IX Xref "POPi" +.IX Item "POPi" +Pops an integer off the stack. +.Sp +.Vb 1 +\& IV POPi +.Ve +.IP "POPl" 8 +.IX Xref "POPl" +.IX Item "POPl" +Pops a long off the stack. +.Sp +.Vb 1 +\& long POPl +.Ve +.IP "POPn" 8 +.IX Xref "POPn" +.IX Item "POPn" +Pops a double off the stack. +.Sp +.Vb 1 +\& NV POPn +.Ve +.IP "POPp" 8 +.IX Xref "POPp" +.IX Item "POPp" +Pops a string off the stack. +.Sp +.Vb 1 +\& char* POPp +.Ve +.IP "POPpbytex" 8 +.IX Xref "POPpbytex" +.IX Item "POPpbytex" +Pops a string off the stack which must consist of bytes i.e. characters < 256. +.Sp +.Vb 1 +\& char* POPpbytex +.Ve +.IP "POPpx" 8 +.IX Xref "POPpx" +.IX Item "POPpx" +Pops a string off the stack. Identical to POPp. There are two names for +historical reasons. +.Sp +.Vb 1 +\& char* POPpx +.Ve +.IP "POPs" 8 +.IX Xref "POPs" +.IX Item "POPs" +Pops an \s-1SV\s0 off the stack. +.Sp +.Vb 1 +\& SV* POPs +.Ve +.IP "POPu" 8 +.IX Xref "POPu" +.IX Item "POPu" +Pops an unsigned integer off the stack. +.Sp +.Vb 1 +\& UV POPu +.Ve +.IP "POPul" 8 +.IX Xref "POPul" +.IX Item "POPul" +Pops an unsigned long off the stack. +.Sp +.Vb 1 +\& long POPul +.Ve +.IP "PUSHi" 8 +.IX Xref "PUSHi" +.IX Item "PUSHi" +Push an integer onto the stack. The stack must have room for this element. +Handles 'set' magic. Uses \f(CW\*(C`TARG\*(C'\fR, so \f(CW\*(C`dTARGET\*(C'\fR or \f(CW\*(C`dXSTARG\*(C'\fR should be +called to declare it. Do not call multiple \f(CW\*(C`TARG\*(C'\fR\-oriented macros to +return lists from \s-1XSUB\s0's \- see \f(CW"mPUSHi"\fR instead. See also \f(CW"XPUSHi"\fR +and \f(CW"mXPUSHi"\fR. +.Sp +.Vb 1 +\& void PUSHi(IV iv) +.Ve +.IP "\s-1PUSHMARK\s0" 8 +.IX Xref "PUSHMARK" +.IX Item "PUSHMARK" +Opening bracket for arguments on a callback. See \f(CW"PUTBACK"\fR and +perlcall. +.Sp +.Vb 1 +\& void PUSHMARK(SP) +.Ve +.IP "PUSHmortal" 8 +.IX Xref "PUSHmortal" +.IX Item "PUSHmortal" +Push a new mortal \s-1SV\s0 onto the stack. The stack must have room for this +element. Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"PUSHs"\fR, \f(CW"XPUSHmortal"\fR and +\&\f(CW"XPUSHs"\fR. +.Sp +.Vb 1 +\& void PUSHmortal +.Ve +.IP "PUSHn" 8 +.IX Xref "PUSHn" +.IX Item "PUSHn" +Push a double onto the stack. The stack must have room for this element. +Handles 'set' magic. Uses \f(CW\*(C`TARG\*(C'\fR, so \f(CW\*(C`dTARGET\*(C'\fR or \f(CW\*(C`dXSTARG\*(C'\fR should be +called to declare it. Do not call multiple \f(CW\*(C`TARG\*(C'\fR\-oriented macros to +return lists from \s-1XSUB\s0's \- see \f(CW"mPUSHn"\fR instead. See also \f(CW"XPUSHn"\fR +and \f(CW"mXPUSHn"\fR. +.Sp +.Vb 1 +\& void PUSHn(NV nv) +.Ve +.IP "PUSHp" 8 +.IX Xref "PUSHp" +.IX Item "PUSHp" +Push a string onto the stack. The stack must have room for this element. +The \f(CW\*(C`len\*(C'\fR indicates the length of the string. Handles 'set' magic. Uses +\&\f(CW\*(C`TARG\*(C'\fR, so \f(CW\*(C`dTARGET\*(C'\fR or \f(CW\*(C`dXSTARG\*(C'\fR should be called to declare it. Do not +call multiple \f(CW\*(C`TARG\*(C'\fR\-oriented macros to return lists from \s-1XSUB\s0's \- see +\&\f(CW"mPUSHp"\fR instead. See also \f(CW"XPUSHp"\fR and \f(CW"mXPUSHp"\fR. +.Sp +.Vb 1 +\& void PUSHp(char* str, STRLEN len) +.Ve +.IP "PUSHs" 8 +.IX Xref "PUSHs" +.IX Item "PUSHs" +Push an \s-1SV\s0 onto the stack. The stack must have room for this element. +Does not handle 'set' magic. Does not use \f(CW\*(C`TARG\*(C'\fR. See also +\&\f(CW"PUSHmortal"\fR, \f(CW"XPUSHs"\fR, and \f(CW"XPUSHmortal"\fR. +.Sp +.Vb 1 +\& void PUSHs(SV* sv) +.Ve +.IP "PUSHu" 8 +.IX Xref "PUSHu" +.IX Item "PUSHu" +Push an unsigned integer onto the stack. The stack must have room for this +element. Handles 'set' magic. Uses \f(CW\*(C`TARG\*(C'\fR, so \f(CW\*(C`dTARGET\*(C'\fR or \f(CW\*(C`dXSTARG\*(C'\fR +should be called to declare it. Do not call multiple \f(CW\*(C`TARG\*(C'\fR\-oriented +macros to return lists from \s-1XSUB\s0's \- see \f(CW"mPUSHu"\fR instead. See also +\&\f(CW"XPUSHu"\fR and \f(CW"mXPUSHu"\fR. +.Sp +.Vb 1 +\& void PUSHu(UV uv) +.Ve +.IP "\s-1PUTBACK\s0" 8 +.IX Xref "PUTBACK" +.IX Item "PUTBACK" +Closing bracket for \s-1XSUB\s0 arguments. This is usually handled by \f(CW\*(C`xsubpp\*(C'\fR. +See \f(CW"PUSHMARK"\fR and perlcall for other uses. +.Sp +.Vb 1 +\& PUTBACK; +.Ve +.IP "\s-1SP\s0" 8 +.IX Xref "SP" +.IX Item "SP" +Stack pointer. This is usually handled by \f(CW\*(C`xsubpp\*(C'\fR. See \f(CW"dSP"\fR and +\&\f(CW\*(C`SPAGAIN\*(C'\fR. +.IP "\s-1SPAGAIN\s0" 8 +.IX Xref "SPAGAIN" +.IX Item "SPAGAIN" +Refetch the stack pointer. Used after a callback. See perlcall. +.Sp +.Vb 1 +\& SPAGAIN; +.Ve +.IP "XPUSHi" 8 +.IX Xref "XPUSHi" +.IX Item "XPUSHi" +Push an integer onto the stack, extending the stack if necessary. Handles +\&'set' magic. Uses \f(CW\*(C`TARG\*(C'\fR, so \f(CW\*(C`dTARGET\*(C'\fR or \f(CW\*(C`dXSTARG\*(C'\fR should be called to +declare it. Do not call multiple \f(CW\*(C`TARG\*(C'\fR\-oriented macros to return lists +from \s-1XSUB\s0's \- see \f(CW"mXPUSHi"\fR instead. See also \f(CW"PUSHi"\fR and +\&\f(CW"mPUSHi"\fR. +.Sp +.Vb 1 +\& void XPUSHi(IV iv) +.Ve +.IP "XPUSHmortal" 8 +.IX Xref "XPUSHmortal" +.IX Item "XPUSHmortal" +Push a new mortal \s-1SV\s0 onto the stack, extending the stack if necessary. +Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"XPUSHs"\fR, \f(CW"PUSHmortal"\fR and +\&\f(CW"PUSHs"\fR. +.Sp +.Vb 1 +\& void XPUSHmortal +.Ve +.IP "XPUSHn" 8 +.IX Xref "XPUSHn" +.IX Item "XPUSHn" +Push a double onto the stack, extending the stack if necessary. Handles +\&'set' magic. Uses \f(CW\*(C`TARG\*(C'\fR, so \f(CW\*(C`dTARGET\*(C'\fR or \f(CW\*(C`dXSTARG\*(C'\fR should be called to +declare it. Do not call multiple \f(CW\*(C`TARG\*(C'\fR\-oriented macros to return lists +from \s-1XSUB\s0's \- see \f(CW"mXPUSHn"\fR instead. See also \f(CW"PUSHn"\fR and +\&\f(CW"mPUSHn"\fR. +.Sp +.Vb 1 +\& void XPUSHn(NV nv) +.Ve +.IP "XPUSHp" 8 +.IX Xref "XPUSHp" +.IX Item "XPUSHp" +Push a string onto the stack, extending the stack if necessary. The \f(CW\*(C`len\*(C'\fR +indicates the length of the string. Handles 'set' magic. Uses \f(CW\*(C`TARG\*(C'\fR, so +\&\f(CW\*(C`dTARGET\*(C'\fR or \f(CW\*(C`dXSTARG\*(C'\fR should be called to declare it. Do not call +multiple \f(CW\*(C`TARG\*(C'\fR\-oriented macros to return lists from \s-1XSUB\s0's \- see +\&\f(CW"mXPUSHp"\fR instead. See also \f(CW"PUSHp"\fR and \f(CW"mPUSHp"\fR. +.Sp +.Vb 1 +\& void XPUSHp(char* str, STRLEN len) +.Ve +.IP "XPUSHs" 8 +.IX Xref "XPUSHs" +.IX Item "XPUSHs" +Push an \s-1SV\s0 onto the stack, extending the stack if necessary. Does not +handle 'set' magic. Does not use \f(CW\*(C`TARG\*(C'\fR. See also \f(CW"XPUSHmortal"\fR, +\&\f(CW\*(C`PUSHs\*(C'\fR and \f(CW\*(C`PUSHmortal\*(C'\fR. +.Sp +.Vb 1 +\& void XPUSHs(SV* sv) +.Ve +.IP "XPUSHu" 8 +.IX Xref "XPUSHu" +.IX Item "XPUSHu" +Push an unsigned integer onto the stack, extending the stack if necessary. +Handles 'set' magic. Uses \f(CW\*(C`TARG\*(C'\fR, so \f(CW\*(C`dTARGET\*(C'\fR or \f(CW\*(C`dXSTARG\*(C'\fR should be +called to declare it. Do not call multiple \f(CW\*(C`TARG\*(C'\fR\-oriented macros to +return lists from \s-1XSUB\s0's \- see \f(CW"mXPUSHu"\fR instead. See also \f(CW"PUSHu"\fR and +\&\f(CW"mPUSHu"\fR. +.Sp +.Vb 1 +\& void XPUSHu(UV uv) +.Ve +.IP "\s-1XSRETURN\s0" 8 +.IX Xref "XSRETURN" +.IX Item "XSRETURN" +Return from \s-1XSUB,\s0 indicating number of items on the stack. This is usually +handled by \f(CW\*(C`xsubpp\*(C'\fR. +.Sp +.Vb 1 +\& void XSRETURN(int nitems) +.Ve +.IP "\s-1XSRETURN_EMPTY\s0" 8 +.IX Xref "XSRETURN_EMPTY" +.IX Item "XSRETURN_EMPTY" +Return an empty list from an \s-1XSUB\s0 immediately. +.Sp +.Vb 1 +\& XSRETURN_EMPTY; +.Ve +.IP "\s-1XSRETURN_IV\s0" 8 +.IX Xref "XSRETURN_IV" +.IX Item "XSRETURN_IV" +Return an integer from an \s-1XSUB\s0 immediately. Uses \f(CW\*(C`XST_mIV\*(C'\fR. +.Sp +.Vb 1 +\& void XSRETURN_IV(IV iv) +.Ve +.IP "\s-1XSRETURN_NO\s0" 8 +.IX Xref "XSRETURN_NO" +.IX Item "XSRETURN_NO" +Return \f(CW&PL_sv_no\fR from an \s-1XSUB\s0 immediately. Uses \f(CW\*(C`XST_mNO\*(C'\fR. +.Sp +.Vb 1 +\& XSRETURN_NO; +.Ve +.IP "\s-1XSRETURN_NV\s0" 8 +.IX Xref "XSRETURN_NV" +.IX Item "XSRETURN_NV" +Return a double from an \s-1XSUB\s0 immediately. Uses \f(CW\*(C`XST_mNV\*(C'\fR. +.Sp +.Vb 1 +\& void XSRETURN_NV(NV nv) +.Ve +.IP "\s-1XSRETURN_PV\s0" 8 +.IX Xref "XSRETURN_PV" +.IX Item "XSRETURN_PV" +Return a copy of a string from an \s-1XSUB\s0 immediately. Uses \f(CW\*(C`XST_mPV\*(C'\fR. +.Sp +.Vb 1 +\& void XSRETURN_PV(char* str) +.Ve +.IP "\s-1XSRETURN_UNDEF\s0" 8 +.IX Xref "XSRETURN_UNDEF" +.IX Item "XSRETURN_UNDEF" +Return \f(CW&PL_sv_undef\fR from an \s-1XSUB\s0 immediately. Uses \f(CW\*(C`XST_mUNDEF\*(C'\fR. +.Sp +.Vb 1 +\& XSRETURN_UNDEF; +.Ve +.IP "\s-1XSRETURN_UV\s0" 8 +.IX Xref "XSRETURN_UV" +.IX Item "XSRETURN_UV" +Return an integer from an \s-1XSUB\s0 immediately. Uses \f(CW\*(C`XST_mUV\*(C'\fR. +.Sp +.Vb 1 +\& void XSRETURN_UV(IV uv) +.Ve +.IP "\s-1XSRETURN_YES\s0" 8 +.IX Xref "XSRETURN_YES" +.IX Item "XSRETURN_YES" +Return \f(CW&PL_sv_yes\fR from an \s-1XSUB\s0 immediately. Uses \f(CW\*(C`XST_mYES\*(C'\fR. +.Sp +.Vb 1 +\& XSRETURN_YES; +.Ve +.IP "XST_mIV" 8 +.IX Xref "XST_mIV" +.IX Item "XST_mIV" +Place an integer into the specified position \f(CW\*(C`pos\*(C'\fR on the stack. The +value is stored in a new mortal \s-1SV.\s0 +.Sp +.Vb 1 +\& void XST_mIV(int pos, IV iv) +.Ve +.IP "XST_mNO" 8 +.IX Xref "XST_mNO" +.IX Item "XST_mNO" +Place \f(CW&PL_sv_no\fR into the specified position \f(CW\*(C`pos\*(C'\fR on the +stack. +.Sp +.Vb 1 +\& void XST_mNO(int pos) +.Ve +.IP "XST_mNV" 8 +.IX Xref "XST_mNV" +.IX Item "XST_mNV" +Place a double into the specified position \f(CW\*(C`pos\*(C'\fR on the stack. The value +is stored in a new mortal \s-1SV.\s0 +.Sp +.Vb 1 +\& void XST_mNV(int pos, NV nv) +.Ve +.IP "XST_mPV" 8 +.IX Xref "XST_mPV" +.IX Item "XST_mPV" +Place a copy of a string into the specified position \f(CW\*(C`pos\*(C'\fR on the stack. +The value is stored in a new mortal \s-1SV.\s0 +.Sp +.Vb 1 +\& void XST_mPV(int pos, char* str) +.Ve +.IP "XST_mUNDEF" 8 +.IX Xref "XST_mUNDEF" +.IX Item "XST_mUNDEF" +Place \f(CW&PL_sv_undef\fR into the specified position \f(CW\*(C`pos\*(C'\fR on the +stack. +.Sp +.Vb 1 +\& void XST_mUNDEF(int pos) +.Ve +.IP "XST_mUV" 8 +.IX Xref "XST_mUV" +.IX Item "XST_mUV" +Place an unsigned integer into the specified position \f(CW\*(C`pos\*(C'\fR on the stack. The +value is stored in a new mortal \s-1SV.\s0 +.Sp +.Vb 1 +\& void XST_mUV(int pos, UV uv) +.Ve +.IP "XST_mYES" 8 +.IX Xref "XST_mYES" +.IX Item "XST_mYES" +Place \f(CW&PL_sv_yes\fR into the specified position \f(CW\*(C`pos\*(C'\fR on the +stack. +.Sp +.Vb 1 +\& void XST_mYES(int pos) +.Ve +.SH "SV Flags" +.IX Header "SV Flags" +.IP "SVt_IV" 8 +.IX Xref "SVt_IV" +.IX Item "SVt_IV" +Type flag for scalars. See \*(L"svtype\*(R". +.IP "SVt_NULL" 8 +.IX Xref "SVt_NULL" +.IX Item "SVt_NULL" +Type flag for scalars. See \*(L"svtype\*(R". +.IP "SVt_NV" 8 +.IX Xref "SVt_NV" +.IX Item "SVt_NV" +Type flag for scalars. See \*(L"svtype\*(R". +.IP "SVt_PV" 8 +.IX Xref "SVt_PV" +.IX Item "SVt_PV" +Type flag for scalars. See \*(L"svtype\*(R". +.IP "SVt_PVAV" 8 +.IX Xref "SVt_PVAV" +.IX Item "SVt_PVAV" +Type flag for arrays. See \*(L"svtype\*(R". +.IP "SVt_PVCV" 8 +.IX Xref "SVt_PVCV" +.IX Item "SVt_PVCV" +Type flag for subroutines. See \*(L"svtype\*(R". +.IP "SVt_PVFM" 8 +.IX Xref "SVt_PVFM" +.IX Item "SVt_PVFM" +Type flag for formats. See \*(L"svtype\*(R". +.IP "SVt_PVGV" 8 +.IX Xref "SVt_PVGV" +.IX Item "SVt_PVGV" +Type flag for typeglobs. See \*(L"svtype\*(R". +.IP "SVt_PVHV" 8 +.IX Xref "SVt_PVHV" +.IX Item "SVt_PVHV" +Type flag for hashes. See \*(L"svtype\*(R". +.IP "SVt_PVIO" 8 +.IX Xref "SVt_PVIO" +.IX Item "SVt_PVIO" +Type flag for I/O objects. See \*(L"svtype\*(R". +.IP "SVt_PVIV" 8 +.IX Xref "SVt_PVIV" +.IX Item "SVt_PVIV" +Type flag for scalars. See \*(L"svtype\*(R". +.IP "SVt_PVLV" 8 +.IX Xref "SVt_PVLV" +.IX Item "SVt_PVLV" +Type flag for scalars. See \*(L"svtype\*(R". +.IP "SVt_PVMG" 8 +.IX Xref "SVt_PVMG" +.IX Item "SVt_PVMG" +Type flag for scalars. See \*(L"svtype\*(R". +.IP "SVt_PVNV" 8 +.IX Xref "SVt_PVNV" +.IX Item "SVt_PVNV" +Type flag for scalars. See \*(L"svtype\*(R". +.IP "SVt_REGEXP" 8 +.IX Xref "SVt_REGEXP" +.IX Item "SVt_REGEXP" +Type flag for regular expressions. See \*(L"svtype\*(R". +.IP "svtype" 8 +.IX Xref "svtype" +.IX Item "svtype" +An enum of flags for Perl types. These are found in the file \fIsv.h\fR +in the \f(CW\*(C`svtype\*(C'\fR enum. Test these flags with the \f(CW\*(C`SvTYPE\*(C'\fR macro. +.Sp +The types are: +.Sp +.Vb 10 +\& SVt_NULL +\& SVt_IV +\& SVt_NV +\& SVt_RV +\& SVt_PV +\& SVt_PVIV +\& SVt_PVNV +\& SVt_PVMG +\& SVt_INVLIST +\& SVt_REGEXP +\& SVt_PVGV +\& SVt_PVLV +\& SVt_PVAV +\& SVt_PVHV +\& SVt_PVCV +\& SVt_PVFM +\& SVt_PVIO +.Ve +.Sp +These are most easily explained from the bottom up. +.Sp +\&\f(CW\*(C`SVt_PVIO\*(C'\fR is for I/O objects, \f(CW\*(C`SVt_PVFM\*(C'\fR for formats, \f(CW\*(C`SVt_PVCV\*(C'\fR for +subroutines, \f(CW\*(C`SVt_PVHV\*(C'\fR for hashes and \f(CW\*(C`SVt_PVAV\*(C'\fR for arrays. +.Sp +All the others are scalar types, that is, things that can be bound to a +\&\f(CW\*(C`$\*(C'\fR variable. For these, the internal types are mostly orthogonal to +types in the Perl language. +.Sp +Hence, checking \f(CW\*(C`SvTYPE(sv) < SVt_PVAV\*(C'\fR is the best way to see whether +something is a scalar. +.Sp +\&\f(CW\*(C`SVt_PVGV\*(C'\fR represents a typeglob. If \f(CW\*(C`!SvFAKE(sv)\*(C'\fR, then it is a real, +incoercible typeglob. If \f(CW\*(C`SvFAKE(sv)\*(C'\fR, then it is a scalar to which a +typeglob has been assigned. Assigning to it again will stop it from being +a typeglob. \f(CW\*(C`SVt_PVLV\*(C'\fR represents a scalar that delegates to another scalar +behind the scenes. It is used, e.g., for the return value of \f(CW\*(C`substr\*(C'\fR and +for tied hash and array elements. It can hold any scalar value, including +a typeglob. \f(CW\*(C`SVt_REGEXP\*(C'\fR is for regular +expressions. \f(CW\*(C`SVt_INVLIST\*(C'\fR is for Perl +core internal use only. +.Sp +\&\f(CW\*(C`SVt_PVMG\*(C'\fR represents a \*(L"normal\*(R" scalar (not a typeglob, regular expression, +or delegate). Since most scalars do not need all the internal fields of a +\&\s-1PVMG,\s0 we save memory by allocating smaller structs when possible. All the +other types are just simpler forms of \f(CW\*(C`SVt_PVMG\*(C'\fR, with fewer internal fields. +\&\f(CW\*(C`SVt_NULL\*(C'\fR can only hold undef. \f(CW\*(C`SVt_IV\*(C'\fR can hold undef, an integer, or a +reference. (\f(CW\*(C`SVt_RV\*(C'\fR is an alias for \f(CW\*(C`SVt_IV\*(C'\fR, which exists for backward +compatibility.) \f(CW\*(C`SVt_NV\*(C'\fR can hold any of those or a double. \f(CW\*(C`SVt_PV\*(C'\fR can only +hold \f(CW\*(C`undef\*(C'\fR or a string. \f(CW\*(C`SVt_PVIV\*(C'\fR is a superset of \f(CW\*(C`SVt_PV\*(C'\fR and \f(CW\*(C`SVt_IV\*(C'\fR. +\&\f(CW\*(C`SVt_PVNV\*(C'\fR is similar. \f(CW\*(C`SVt_PVMG\*(C'\fR can hold anything \f(CW\*(C`SVt_PVNV\*(C'\fR can hold, but it +can, but does not have to, be blessed or magical. +.SH "SV Manipulation Functions" +.IX Header "SV Manipulation Functions" +.IP "boolSV" 8 +.IX Xref "boolSV" +.IX Item "boolSV" +Returns a true \s-1SV\s0 if \f(CW\*(C`b\*(C'\fR is a true value, or a false \s-1SV\s0 if \f(CW\*(C`b\*(C'\fR is 0. +.Sp +See also \f(CW"PL_sv_yes"\fR and \f(CW"PL_sv_no"\fR. +.Sp +.Vb 1 +\& SV * boolSV(bool b) +.Ve +.IP "croak_xs_usage" 8 +.IX Xref "croak_xs_usage" +.IX Item "croak_xs_usage" +A specialised variant of \f(CW\*(C`croak()\*(C'\fR for emitting the usage message for xsubs +.Sp +.Vb 1 +\& croak_xs_usage(cv, "eee_yow"); +.Ve +.Sp +works out the package name and subroutine name from \f(CW\*(C`cv\*(C'\fR, and then calls +\&\f(CW\*(C`croak()\*(C'\fR. Hence if \f(CW\*(C`cv\*(C'\fR is \f(CW&ouch::awk\fR, it would call \f(CW\*(C`croak\*(C'\fR as: +.Sp +.Vb 2 +\& Perl_croak(aTHX_ "Usage: %" SVf "::%" SVf "(%s)", "ouch" "awk", +\& "eee_yow"); +\& +\& void croak_xs_usage(const CV *const cv, +\& const char *const params) +.Ve +.IP "get_sv" 8 +.IX Xref "get_sv" +.IX Item "get_sv" +Returns the \s-1SV\s0 of the specified Perl scalar. \f(CW\*(C`flags\*(C'\fR are passed to +\&\f(CW\*(C`gv_fetchpv\*(C'\fR. If \f(CW\*(C`GV_ADD\*(C'\fR is set and the +Perl variable does not exist then it will be created. If \f(CW\*(C`flags\*(C'\fR is zero +and the variable does not exist then \s-1NULL\s0 is returned. +.Sp +\&\s-1NOTE:\s0 the perl_ form of this function is deprecated. +.Sp +.Vb 1 +\& SV* get_sv(const char *name, I32 flags) +.Ve +.IP "looks_like_number" 8 +.IX Xref "looks_like_number" +.IX Item "looks_like_number" +Test if the content of an \s-1SV\s0 looks like a number (or is a number). +\&\f(CW\*(C`Inf\*(C'\fR and \f(CW\*(C`Infinity\*(C'\fR are treated as numbers (so will not issue a +non-numeric warning), even if your \f(CW\*(C`atof()\*(C'\fR doesn't grok them. Get-magic is +ignored. +.Sp +.Vb 1 +\& I32 looks_like_number(SV *const sv) +.Ve +.IP "newRV_inc" 8 +.IX Xref "newRV_inc" +.IX Item "newRV_inc" +Creates an \s-1RV\s0 wrapper for an \s-1SV.\s0 The reference count for the original \s-1SV\s0 is +incremented. +.Sp +.Vb 1 +\& SV* newRV_inc(SV* sv) +.Ve +.IP "newRV_noinc" 8 +.IX Xref "newRV_noinc" +.IX Item "newRV_noinc" +Creates an \s-1RV\s0 wrapper for an \s-1SV.\s0 The reference count for the original +\&\s-1SV\s0 is \fBnot\fR incremented. +.Sp +.Vb 1 +\& SV* newRV_noinc(SV *const tmpRef) +.Ve +.IP "newSV" 8 +.IX Xref "newSV" +.IX Item "newSV" +Creates a new \s-1SV.\s0 A non-zero \f(CW\*(C`len\*(C'\fR parameter indicates the number of +bytes of preallocated string space the \s-1SV\s0 should have. An extra byte for a +trailing \f(CW\*(C`NUL\*(C'\fR is also reserved. (\f(CW\*(C`SvPOK\*(C'\fR is not set for the \s-1SV\s0 even if string +space is allocated.) The reference count for the new \s-1SV\s0 is set to 1. +.Sp +In 5.9.3, \f(CW\*(C`newSV()\*(C'\fR replaces the older \f(CW\*(C`NEWSV()\*(C'\fR \s-1API,\s0 and drops the first +parameter, \fIx\fR, a debug aid which allowed callers to identify themselves. +This aid has been superseded by a new build option, \f(CW\*(C`PERL_MEM_LOG\*(C'\fR (see +\&\*(L"\s-1PERL_MEM_LOG\*(R"\s0 in perlhacktips). The older \s-1API\s0 is still there for use in \s-1XS\s0 +modules supporting older perls. +.Sp +.Vb 1 +\& SV* newSV(const STRLEN len) +.Ve +.IP "newSVhek" 8 +.IX Xref "newSVhek" +.IX Item "newSVhek" +Creates a new \s-1SV\s0 from the hash key structure. It will generate scalars that +point to the shared string table where possible. Returns a new (undefined) +\&\s-1SV\s0 if \f(CW\*(C`hek\*(C'\fR is \s-1NULL.\s0 +.Sp +.Vb 1 +\& SV* newSVhek(const HEK *const hek) +.Ve +.IP "newSViv" 8 +.IX Xref "newSViv" +.IX Item "newSViv" +Creates a new \s-1SV\s0 and copies an integer into it. The reference count for the +\&\s-1SV\s0 is set to 1. +.Sp +.Vb 1 +\& SV* newSViv(const IV i) +.Ve +.IP "newSVnv" 8 +.IX Xref "newSVnv" +.IX Item "newSVnv" +Creates a new \s-1SV\s0 and copies a floating point value into it. +The reference count for the \s-1SV\s0 is set to 1. +.Sp +.Vb 1 +\& SV* newSVnv(const NV n) +.Ve +.IP "newSVpadname" 8 +.IX Xref "newSVpadname" +.IX Item "newSVpadname" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Creates a new \s-1SV\s0 containing the pad name. +.Sp +.Vb 1 +\& SV* newSVpadname(PADNAME *pn) +.Ve +.IP "newSVpv" 8 +.IX Xref "newSVpv" +.IX Item "newSVpv" +Creates a new \s-1SV\s0 and copies a string (which may contain \f(CW\*(C`NUL\*(C'\fR (\f(CW\*(C`\e0\*(C'\fR) +characters) into it. The reference count for the +\&\s-1SV\s0 is set to 1. If \f(CW\*(C`len\*(C'\fR is zero, Perl will compute the length using +\&\f(CW\*(C`strlen()\*(C'\fR, (which means if you use this option, that \f(CW\*(C`s\*(C'\fR can't have embedded +\&\f(CW\*(C`NUL\*(C'\fR characters and has to have a terminating \f(CW\*(C`NUL\*(C'\fR byte). +.Sp +This function can cause reliability issues if you are likely to pass in +empty strings that are not null terminated, because it will run +strlen on the string and potentially run past valid memory. +.Sp +Using \*(L"newSVpvn\*(R" is a safer alternative for non \f(CW\*(C`NUL\*(C'\fR terminated strings. +For string literals use \*(L"newSVpvs\*(R" instead. This function will work fine for +\&\f(CW\*(C`NUL\*(C'\fR terminated strings, but if you want to avoid the if statement on whether +to call \f(CW\*(C`strlen\*(C'\fR use \f(CW\*(C`newSVpvn\*(C'\fR instead (calling \f(CW\*(C`strlen\*(C'\fR yourself). +.Sp +.Vb 1 +\& SV* newSVpv(const char *const s, const STRLEN len) +.Ve +.IP "newSVpvf" 8 +.IX Xref "newSVpvf" +.IX Item "newSVpvf" +Creates a new \s-1SV\s0 and initializes it with the string formatted like +\&\f(CW\*(C`sv_catpvf\*(C'\fR. +.Sp +.Vb 1 +\& SV* newSVpvf(const char *const pat, ...) +.Ve +.IP "newSVpvn" 8 +.IX Xref "newSVpvn" +.IX Item "newSVpvn" +Creates a new \s-1SV\s0 and copies a string into it, which may contain \f(CW\*(C`NUL\*(C'\fR characters +(\f(CW\*(C`\e0\*(C'\fR) and other binary data. The reference count for the \s-1SV\s0 is set to 1. +Note that if \f(CW\*(C`len\*(C'\fR is zero, Perl will create a zero length (Perl) string. You +are responsible for ensuring that the source buffer is at least +\&\f(CW\*(C`len\*(C'\fR bytes long. If the \f(CW\*(C`buffer\*(C'\fR argument is \s-1NULL\s0 the new \s-1SV\s0 will be +undefined. +.Sp +.Vb 2 +\& SV* newSVpvn(const char *const buffer, +\& const STRLEN len) +.Ve +.IP "newSVpvn_flags" 8 +.IX Xref "newSVpvn_flags" +.IX Item "newSVpvn_flags" +Creates a new \s-1SV\s0 and copies a string (which may contain \f(CW\*(C`NUL\*(C'\fR (\f(CW\*(C`\e0\*(C'\fR) +characters) into it. The reference count for the +\&\s-1SV\s0 is set to 1. Note that if \f(CW\*(C`len\*(C'\fR is zero, Perl will create a zero length +string. You are responsible for ensuring that the source string is at least +\&\f(CW\*(C`len\*(C'\fR bytes long. If the \f(CW\*(C`s\*(C'\fR argument is \s-1NULL\s0 the new \s-1SV\s0 will be undefined. +Currently the only flag bits accepted are \f(CW\*(C`SVf_UTF8\*(C'\fR and \f(CW\*(C`SVs_TEMP\*(C'\fR. +If \f(CW\*(C`SVs_TEMP\*(C'\fR is set, then \f(CW\*(C`sv_2mortal()\*(C'\fR is called on the result before +returning. If \f(CW\*(C`SVf_UTF8\*(C'\fR is set, \f(CW\*(C`s\*(C'\fR +is considered to be in \s-1UTF\-8\s0 and the +\&\f(CW\*(C`SVf_UTF8\*(C'\fR flag will be set on the new \s-1SV.\s0 +\&\f(CW\*(C`newSVpvn_utf8()\*(C'\fR is a convenience wrapper for this function, defined as +.Sp +.Vb 2 +\& #define newSVpvn_utf8(s, len, u) \e +\& newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0) +\& +\& SV* newSVpvn_flags(const char *const s, +\& const STRLEN len, +\& const U32 flags) +.Ve +.IP "newSVpvn_share" 8 +.IX Xref "newSVpvn_share" +.IX Item "newSVpvn_share" +Creates a new \s-1SV\s0 with its \f(CW\*(C`SvPVX_const\*(C'\fR pointing to a shared string in the string +table. If the string does not already exist in the table, it is +created first. Turns on the \f(CW\*(C`SvIsCOW\*(C'\fR flag (or \f(CW\*(C`READONLY\*(C'\fR +and \f(CW\*(C`FAKE\*(C'\fR in 5.16 and earlier). If the \f(CW\*(C`hash\*(C'\fR parameter +is non-zero, that value is used; otherwise the hash is computed. +The string's hash can later be retrieved from the \s-1SV\s0 +with the \f(CW\*(C`SvSHARED_HASH()\*(C'\fR macro. The idea here is +that as the string table is used for shared hash keys these strings will have +\&\f(CW\*(C`SvPVX_const == HeKEY\*(C'\fR and hash lookup will avoid string compare. +.Sp +.Vb 1 +\& SV* newSVpvn_share(const char* s, I32 len, U32 hash) +.Ve +.IP "newSVpvn_utf8" 8 +.IX Xref "newSVpvn_utf8" +.IX Item "newSVpvn_utf8" +Creates a new \s-1SV\s0 and copies a string (which may contain \f(CW\*(C`NUL\*(C'\fR (\f(CW\*(C`\e0\*(C'\fR) +characters) into it. If \f(CW\*(C`utf8\*(C'\fR is true, calls +\&\f(CW\*(C`SvUTF8_on\*(C'\fR on the new \s-1SV.\s0 Implemented as a wrapper around \f(CW\*(C`newSVpvn_flags\*(C'\fR. +.Sp +.Vb 2 +\& SV* newSVpvn_utf8(const char* s, STRLEN len, +\& U32 utf8) +.Ve +.IP "newSVpvs" 8 +.IX Xref "newSVpvs" +.IX Item "newSVpvs" +Like \f(CW\*(C`newSVpvn\*(C'\fR, but takes a literal string instead of a +string/length pair. +.Sp +.Vb 1 +\& SV* newSVpvs("literal string") +.Ve +.IP "newSVpvs_flags" 8 +.IX Xref "newSVpvs_flags" +.IX Item "newSVpvs_flags" +Like \f(CW\*(C`newSVpvn_flags\*(C'\fR, but takes a literal string instead of +a string/length pair. +.Sp +.Vb 1 +\& SV* newSVpvs_flags("literal string", U32 flags) +.Ve +.IP "newSVpv_share" 8 +.IX Xref "newSVpv_share" +.IX Item "newSVpv_share" +Like \f(CW\*(C`newSVpvn_share\*(C'\fR, but takes a \f(CW\*(C`NUL\*(C'\fR\-terminated string instead of a +string/length pair. +.Sp +.Vb 1 +\& SV* newSVpv_share(const char* s, U32 hash) +.Ve +.IP "newSVpvs_share" 8 +.IX Xref "newSVpvs_share" +.IX Item "newSVpvs_share" +Like \f(CW\*(C`newSVpvn_share\*(C'\fR, but takes a literal string instead of +a string/length pair and omits the hash parameter. +.Sp +.Vb 1 +\& SV* newSVpvs_share("literal string") +.Ve +.IP "newSVrv" 8 +.IX Xref "newSVrv" +.IX Item "newSVrv" +Creates a new \s-1SV\s0 for the existing \s-1RV,\s0 \f(CW\*(C`rv\*(C'\fR, to point to. If \f(CW\*(C`rv\*(C'\fR is not an +\&\s-1RV\s0 then it will be upgraded to one. If \f(CW\*(C`classname\*(C'\fR is non-null then the new +\&\s-1SV\s0 will be blessed in the specified package. The new \s-1SV\s0 is returned and its +reference count is 1. The reference count 1 is owned by \f(CW\*(C`rv\*(C'\fR. See also +\&\fBnewRV_inc()\fR and \fBnewRV_noinc()\fR for creating a new \s-1RV\s0 properly. +.Sp +.Vb 2 +\& SV* newSVrv(SV *const rv, +\& const char *const classname) +.Ve +.IP "newSVsv" 8 +.IX Xref "newSVsv" +.IX Item "newSVsv" +Creates a new \s-1SV\s0 which is an exact duplicate of the original \s-1SV.\s0 +(Uses \f(CW\*(C`sv_setsv\*(C'\fR.) +.Sp +.Vb 1 +\& SV* newSVsv(SV *const old) +.Ve +.IP "newSVsv_nomg" 8 +.IX Xref "newSVsv_nomg" +.IX Item "newSVsv_nomg" +Like \f(CW\*(C`newSVsv\*(C'\fR but does not process get magic. +.Sp +.Vb 1 +\& SV* newSVsv_nomg(SV *const old) +.Ve +.IP "newSV_type" 8 +.IX Xref "newSV_type" +.IX Item "newSV_type" +Creates a new \s-1SV,\s0 of the type specified. The reference count for the new \s-1SV\s0 +is set to 1. +.Sp +.Vb 1 +\& SV* newSV_type(const svtype type) +.Ve +.IP "newSVuv" 8 +.IX Xref "newSVuv" +.IX Item "newSVuv" +Creates a new \s-1SV\s0 and copies an unsigned integer into it. +The reference count for the \s-1SV\s0 is set to 1. +.Sp +.Vb 1 +\& SV* newSVuv(const UV u) +.Ve +.IP "sortsv_flags" 8 +.IX Xref "sortsv_flags" +.IX Item "sortsv_flags" +In-place sort an array of \s-1SV\s0 pointers with the given comparison routine, +with various SORTf_* flag options. +.Sp +.Vb 2 +\& void sortsv_flags(SV** array, size_t num_elts, +\& SVCOMPARE_t cmp, U32 flags) +.Ve +.IP "sv_2bool" 8 +.IX Xref "sv_2bool" +.IX Item "sv_2bool" +This macro is only used by \f(CW\*(C`sv_true()\*(C'\fR or its macro equivalent, and only if +the latter's argument is neither \f(CW\*(C`SvPOK\*(C'\fR, \f(CW\*(C`SvIOK\*(C'\fR nor \f(CW\*(C`SvNOK\*(C'\fR. +It calls \f(CW\*(C`sv_2bool_flags\*(C'\fR with the \f(CW\*(C`SV_GMAGIC\*(C'\fR flag. +.Sp +.Vb 1 +\& bool sv_2bool(SV *const sv) +.Ve +.IP "sv_2bool_flags" 8 +.IX Xref "sv_2bool_flags" +.IX Item "sv_2bool_flags" +This function is only used by \f(CW\*(C`sv_true()\*(C'\fR and friends, and only if +the latter's argument is neither \f(CW\*(C`SvPOK\*(C'\fR, \f(CW\*(C`SvIOK\*(C'\fR nor \f(CW\*(C`SvNOK\*(C'\fR. If the flags +contain \f(CW\*(C`SV_GMAGIC\*(C'\fR, then it does an \f(CW\*(C`mg_get()\*(C'\fR first. +.Sp +.Vb 1 +\& bool sv_2bool_flags(SV *sv, I32 flags) +.Ve +.IP "sv_2cv" 8 +.IX Xref "sv_2cv" +.IX Item "sv_2cv" +Using various gambits, try to get a \s-1CV\s0 from an \s-1SV\s0; in addition, try if +possible to set \f(CW*st\fR and \f(CW*gvp\fR to the stash and \s-1GV\s0 associated with it. +The flags in \f(CW\*(C`lref\*(C'\fR are passed to \f(CW\*(C`gv_fetchsv\*(C'\fR. +.Sp +.Vb 2 +\& CV* sv_2cv(SV* sv, HV **const st, GV **const gvp, +\& const I32 lref) +.Ve +.IP "sv_2io" 8 +.IX Xref "sv_2io" +.IX Item "sv_2io" +Using various gambits, try to get an \s-1IO\s0 from an \s-1SV:\s0 the \s-1IO\s0 slot if its a +\&\s-1GV\s0; or the recursive result if we're an \s-1RV\s0; or the \s-1IO\s0 slot of the symbol +named after the \s-1PV\s0 if we're a string. +.Sp +\&'Get' magic is ignored on the \f(CW\*(C`sv\*(C'\fR passed in, but will be called on +\&\f(CW\*(C`SvRV(sv)\*(C'\fR if \f(CW\*(C`sv\*(C'\fR is an \s-1RV.\s0 +.Sp +.Vb 1 +\& IO* sv_2io(SV *const sv) +.Ve +.IP "sv_2iv_flags" 8 +.IX Xref "sv_2iv_flags" +.IX Item "sv_2iv_flags" +Return the integer value of an \s-1SV,\s0 doing any necessary string +conversion. If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, does an \f(CW\*(C`mg_get()\*(C'\fR first. +Normally used via the \f(CW\*(C`SvIV(sv)\*(C'\fR and \f(CW\*(C`SvIVx(sv)\*(C'\fR macros. +.Sp +.Vb 1 +\& IV sv_2iv_flags(SV *const sv, const I32 flags) +.Ve +.IP "sv_2mortal" 8 +.IX Xref "sv_2mortal" +.IX Item "sv_2mortal" +Marks an existing \s-1SV\s0 as mortal. The \s-1SV\s0 will be destroyed \*(L"soon\*(R", either +by an explicit call to \f(CW\*(C`FREETMPS\*(C'\fR, or by an implicit call at places such as +statement boundaries. \f(CW\*(C`SvTEMP()\*(C'\fR is turned on which means that the \s-1SV\s0's +string buffer can be \*(L"stolen\*(R" if this \s-1SV\s0 is copied. See also +\&\f(CW"sv_newmortal"\fR and \f(CW"sv_mortalcopy"\fR. +.Sp +.Vb 1 +\& SV* sv_2mortal(SV *const sv) +.Ve +.IP "sv_2nv_flags" 8 +.IX Xref "sv_2nv_flags" +.IX Item "sv_2nv_flags" +Return the num value of an \s-1SV,\s0 doing any necessary string or integer +conversion. If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, does an \f(CW\*(C`mg_get()\*(C'\fR first. +Normally used via the \f(CW\*(C`SvNV(sv)\*(C'\fR and \f(CW\*(C`SvNVx(sv)\*(C'\fR macros. +.Sp +.Vb 1 +\& NV sv_2nv_flags(SV *const sv, const I32 flags) +.Ve +.IP "sv_2pvbyte" 8 +.IX Xref "sv_2pvbyte" +.IX Item "sv_2pvbyte" +Return a pointer to the byte-encoded representation of the \s-1SV,\s0 and set \f(CW*lp\fR +to its length. If the \s-1SV\s0 is marked as being encoded as \s-1UTF\-8,\s0 it will +downgrade it to a byte string as a side-effect, if possible. If the \s-1SV\s0 cannot +be downgraded, this croaks. +.Sp +Usually accessed via the \f(CW\*(C`SvPVbyte\*(C'\fR macro. +.Sp +.Vb 1 +\& char* sv_2pvbyte(SV *sv, STRLEN *const lp) +.Ve +.IP "sv_2pvutf8" 8 +.IX Xref "sv_2pvutf8" +.IX Item "sv_2pvutf8" +Return a pointer to the UTF\-8\-encoded representation of the \s-1SV,\s0 and set \f(CW*lp\fR +to its length. May cause the \s-1SV\s0 to be upgraded to \s-1UTF\-8\s0 as a side-effect. +.Sp +Usually accessed via the \f(CW\*(C`SvPVutf8\*(C'\fR macro. +.Sp +.Vb 1 +\& char* sv_2pvutf8(SV *sv, STRLEN *const lp) +.Ve +.IP "sv_2pv_flags" 8 +.IX Xref "sv_2pv_flags" +.IX Item "sv_2pv_flags" +Returns a pointer to the string value of an \s-1SV,\s0 and sets \f(CW*lp\fR to its length. +If flags has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, does an \f(CW\*(C`mg_get()\*(C'\fR first. Coerces \f(CW\*(C`sv\*(C'\fR to a +string if necessary. Normally invoked via the \f(CW\*(C`SvPV_flags\*(C'\fR macro. +\&\f(CW\*(C`sv_2pv()\*(C'\fR and \f(CW\*(C`sv_2pv_nomg\*(C'\fR usually end up here too. +.Sp +.Vb 2 +\& char* sv_2pv_flags(SV *const sv, STRLEN *const lp, +\& const I32 flags) +.Ve +.IP "sv_2uv_flags" 8 +.IX Xref "sv_2uv_flags" +.IX Item "sv_2uv_flags" +Return the unsigned integer value of an \s-1SV,\s0 doing any necessary string +conversion. If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, does an \f(CW\*(C`mg_get()\*(C'\fR first. +Normally used via the \f(CW\*(C`SvUV(sv)\*(C'\fR and \f(CW\*(C`SvUVx(sv)\*(C'\fR macros. +.Sp +.Vb 1 +\& UV sv_2uv_flags(SV *const sv, const I32 flags) +.Ve +.IP "sv_backoff" 8 +.IX Xref "sv_backoff" +.IX Item "sv_backoff" +Remove any string offset. You should normally use the \f(CW\*(C`SvOOK_off\*(C'\fR macro +wrapper instead. +.Sp +.Vb 1 +\& void sv_backoff(SV *const sv) +.Ve +.IP "sv_bless" 8 +.IX Xref "sv_bless" +.IX Item "sv_bless" +Blesses an \s-1SV\s0 into a specified package. The \s-1SV\s0 must be an \s-1RV.\s0 The package +must be designated by its stash (see \f(CW"gv_stashpv"\fR). The reference count +of the \s-1SV\s0 is unaffected. +.Sp +.Vb 1 +\& SV* sv_bless(SV *const sv, HV *const stash) +.Ve +.IP "sv_catpv" 8 +.IX Xref "sv_catpv" +.IX Item "sv_catpv" +Concatenates the \f(CW\*(C`NUL\*(C'\fR\-terminated string onto the end of the string which is +in the \s-1SV.\s0 +If the \s-1SV\s0 has the \s-1UTF\-8\s0 status set, then the bytes appended should be +valid \s-1UTF\-8.\s0 Handles 'get' magic, but not 'set' magic. See +\&\f(CW"sv_catpv_mg"\fR. +.Sp +.Vb 1 +\& void sv_catpv(SV *const sv, const char* ptr) +.Ve +.IP "sv_catpvf" 8 +.IX Xref "sv_catpvf" +.IX Item "sv_catpvf" +Processes its arguments like \f(CW\*(C`sprintf\*(C'\fR, and appends the formatted +output to an \s-1SV.\s0 As with \f(CW\*(C`sv_vcatpvfn\*(C'\fR called with a non-null C\-style +variable argument list, argument reordering is not supported. +If the appended data contains \*(L"wide\*(R" characters +(including, but not limited to, SVs with a \s-1UTF\-8 PV\s0 formatted with \f(CW%s\fR, +and characters >255 formatted with \f(CW%c\fR), the original \s-1SV\s0 might get +upgraded to \s-1UTF\-8.\s0 Handles 'get' magic, but not 'set' magic. See +\&\f(CW"sv_catpvf_mg"\fR. If the original \s-1SV\s0 was \s-1UTF\-8,\s0 the pattern should be +valid \s-1UTF\-8\s0; if the original \s-1SV\s0 was bytes, the pattern should be too. +.Sp +.Vb 2 +\& void sv_catpvf(SV *const sv, const char *const pat, +\& ...) +.Ve +.IP "sv_catpvf_mg" 8 +.IX Xref "sv_catpvf_mg" +.IX Item "sv_catpvf_mg" +Like \f(CW\*(C`sv_catpvf\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 2 +\& void sv_catpvf_mg(SV *const sv, +\& const char *const pat, ...) +.Ve +.IP "sv_catpvn" 8 +.IX Xref "sv_catpvn" +.IX Item "sv_catpvn" +Concatenates the string onto the end of the string which is in the \s-1SV.\s0 +\&\f(CW\*(C`len\*(C'\fR indicates number of bytes to copy. If the \s-1SV\s0 has the \s-1UTF\-8\s0 +status set, then the bytes appended should be valid \s-1UTF\-8.\s0 +Handles 'get' magic, but not 'set' magic. See \f(CW"sv_catpvn_mg"\fR. +.Sp +.Vb 1 +\& void sv_catpvn(SV *dsv, const char *sstr, STRLEN len) +.Ve +.IP "sv_catpvn_flags" 8 +.IX Xref "sv_catpvn_flags" +.IX Item "sv_catpvn_flags" +Concatenates the string onto the end of the string which is in the \s-1SV.\s0 The +\&\f(CW\*(C`len\*(C'\fR indicates number of bytes to copy. +.Sp +By default, the string appended is assumed to be valid \s-1UTF\-8\s0 if the \s-1SV\s0 has +the \s-1UTF\-8\s0 status set, and a string of bytes otherwise. One can force the +appended string to be interpreted as \s-1UTF\-8\s0 by supplying the \f(CW\*(C`SV_CATUTF8\*(C'\fR +flag, and as bytes by supplying the \f(CW\*(C`SV_CATBYTES\*(C'\fR flag; the \s-1SV\s0 or the +string appended will be upgraded to \s-1UTF\-8\s0 if necessary. +.Sp +If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SV_SMAGIC\*(C'\fR bit set, will +\&\f(CW\*(C`mg_set\*(C'\fR on \f(CW\*(C`dsv\*(C'\fR afterwards if appropriate. +\&\f(CW\*(C`sv_catpvn\*(C'\fR and \f(CW\*(C`sv_catpvn_nomg\*(C'\fR are implemented +in terms of this function. +.Sp +.Vb 4 +\& void sv_catpvn_flags(SV *const dstr, +\& const char *sstr, +\& const STRLEN len, +\& const I32 flags) +.Ve +.IP "sv_catpvn_nomg" 8 +.IX Xref "sv_catpvn_nomg" +.IX Item "sv_catpvn_nomg" +Like \f(CW\*(C`sv_catpvn\*(C'\fR but doesn't process magic. +.Sp +.Vb 2 +\& void sv_catpvn_nomg(SV* sv, const char* ptr, +\& STRLEN len) +.Ve +.IP "sv_catpvs" 8 +.IX Xref "sv_catpvs" +.IX Item "sv_catpvs" +Like \f(CW\*(C`sv_catpvn\*(C'\fR, but takes a literal string instead of a +string/length pair. +.Sp +.Vb 1 +\& void sv_catpvs(SV* sv, "literal string") +.Ve +.IP "sv_catpvs_flags" 8 +.IX Xref "sv_catpvs_flags" +.IX Item "sv_catpvs_flags" +Like \f(CW\*(C`sv_catpvn_flags\*(C'\fR, but takes a literal string instead +of a string/length pair. +.Sp +.Vb 2 +\& void sv_catpvs_flags(SV* sv, "literal string", +\& I32 flags) +.Ve +.IP "sv_catpvs_mg" 8 +.IX Xref "sv_catpvs_mg" +.IX Item "sv_catpvs_mg" +Like \f(CW\*(C`sv_catpvn_mg\*(C'\fR, but takes a literal string instead of a +string/length pair. +.Sp +.Vb 1 +\& void sv_catpvs_mg(SV* sv, "literal string") +.Ve +.IP "sv_catpvs_nomg" 8 +.IX Xref "sv_catpvs_nomg" +.IX Item "sv_catpvs_nomg" +Like \f(CW\*(C`sv_catpvn_nomg\*(C'\fR, but takes a literal string instead of +a string/length pair. +.Sp +.Vb 1 +\& void sv_catpvs_nomg(SV* sv, "literal string") +.Ve +.IP "sv_catpv_flags" 8 +.IX Xref "sv_catpv_flags" +.IX Item "sv_catpv_flags" +Concatenates the \f(CW\*(C`NUL\*(C'\fR\-terminated string onto the end of the string which is +in the \s-1SV.\s0 +If the \s-1SV\s0 has the \s-1UTF\-8\s0 status set, then the bytes appended should +be valid \s-1UTF\-8.\s0 If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SV_SMAGIC\*(C'\fR bit set, will \f(CW\*(C`mg_set\*(C'\fR +on the modified \s-1SV\s0 if appropriate. +.Sp +.Vb 2 +\& void sv_catpv_flags(SV *dstr, const char *sstr, +\& const I32 flags) +.Ve +.IP "sv_catpv_mg" 8 +.IX Xref "sv_catpv_mg" +.IX Item "sv_catpv_mg" +Like \f(CW\*(C`sv_catpv\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 1 +\& void sv_catpv_mg(SV *const sv, const char *const ptr) +.Ve +.IP "sv_catpv_nomg" 8 +.IX Xref "sv_catpv_nomg" +.IX Item "sv_catpv_nomg" +Like \f(CW\*(C`sv_catpv\*(C'\fR but doesn't process magic. +.Sp +.Vb 1 +\& void sv_catpv_nomg(SV* sv, const char* ptr) +.Ve +.IP "sv_catsv" 8 +.IX Xref "sv_catsv" +.IX Item "sv_catsv" +Concatenates the string from \s-1SV\s0 \f(CW\*(C`ssv\*(C'\fR onto the end of the string in \s-1SV\s0 +\&\f(CW\*(C`dsv\*(C'\fR. If \f(CW\*(C`ssv\*(C'\fR is null, does nothing; otherwise modifies only \f(CW\*(C`dsv\*(C'\fR. +Handles 'get' magic on both SVs, but no 'set' magic. See \f(CW"sv_catsv_mg"\fR +and \f(CW"sv_catsv_nomg"\fR. +.Sp +.Vb 1 +\& void sv_catsv(SV *dstr, SV *sstr) +.Ve +.IP "sv_catsv_flags" 8 +.IX Xref "sv_catsv_flags" +.IX Item "sv_catsv_flags" +Concatenates the string from \s-1SV\s0 \f(CW\*(C`ssv\*(C'\fR onto the end of the string in \s-1SV\s0 +\&\f(CW\*(C`dsv\*(C'\fR. If \f(CW\*(C`ssv\*(C'\fR is null, does nothing; otherwise modifies only \f(CW\*(C`dsv\*(C'\fR. +If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, will call \f(CW\*(C`mg_get\*(C'\fR on both SVs if +appropriate. If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SV_SMAGIC\*(C'\fR bit set, \f(CW\*(C`mg_set\*(C'\fR will be called on +the modified \s-1SV\s0 afterward, if appropriate. \f(CW\*(C`sv_catsv\*(C'\fR, \f(CW\*(C`sv_catsv_nomg\*(C'\fR, +and \f(CW\*(C`sv_catsv_mg\*(C'\fR are implemented in terms of this function. +.Sp +.Vb 2 +\& void sv_catsv_flags(SV *const dsv, SV *const ssv, +\& const I32 flags) +.Ve +.IP "sv_catsv_nomg" 8 +.IX Xref "sv_catsv_nomg" +.IX Item "sv_catsv_nomg" +Like \f(CW\*(C`sv_catsv\*(C'\fR but doesn't process magic. +.Sp +.Vb 1 +\& void sv_catsv_nomg(SV* dsv, SV* ssv) +.Ve +.IP "sv_chop" 8 +.IX Xref "sv_chop" +.IX Item "sv_chop" +Efficient removal of characters from the beginning of the string buffer. +\&\f(CW\*(C`SvPOK(sv)\*(C'\fR, or at least \f(CW\*(C`SvPOKp(sv)\*(C'\fR, must be true and \f(CW\*(C`ptr\*(C'\fR must be a +pointer to somewhere inside the string buffer. \f(CW\*(C`ptr\*(C'\fR becomes the first +character of the adjusted string. Uses the \f(CW\*(C`OOK\*(C'\fR hack. On return, only +\&\f(CW\*(C`SvPOK(sv)\*(C'\fR and \f(CW\*(C`SvPOKp(sv)\*(C'\fR among the \f(CW\*(C`OK\*(C'\fR flags will be true. +.Sp +Beware: after this function returns, \f(CW\*(C`ptr\*(C'\fR and SvPVX_const(sv) may no longer +refer to the same chunk of data. +.Sp +The unfortunate similarity of this function's name to that of Perl's \f(CW\*(C`chop\*(C'\fR +operator is strictly coincidental. This function works from the left; +\&\f(CW\*(C`chop\*(C'\fR works from the right. +.Sp +.Vb 1 +\& void sv_chop(SV *const sv, const char *const ptr) +.Ve +.IP "sv_clear" 8 +.IX Xref "sv_clear" +.IX Item "sv_clear" +Clear an \s-1SV:\s0 call any destructors, free up any memory used by the body, +and free the body itself. The \s-1SV\s0's head is \fInot\fR freed, although +its type is set to all 1's so that it won't inadvertently be assumed +to be live during global destruction etc. +This function should only be called when \f(CW\*(C`REFCNT\*(C'\fR is zero. Most of the time +you'll want to call \f(CW\*(C`sv_free()\*(C'\fR (or its macro wrapper \f(CW\*(C`SvREFCNT_dec\*(C'\fR) +instead. +.Sp +.Vb 1 +\& void sv_clear(SV *const orig_sv) +.Ve +.IP "sv_cmp" 8 +.IX Xref "sv_cmp" +.IX Item "sv_cmp" +Compares the strings in two SVs. Returns \-1, 0, or 1 indicating whether the +string in \f(CW\*(C`sv1\*(C'\fR is less than, equal to, or greater than the string in +\&\f(CW\*(C`sv2\*(C'\fR. Is \s-1UTF\-8\s0 and \f(CW\*(Aquse\ bytes\*(Aq\fR aware, handles get magic, and will +coerce its args to strings if necessary. See also \f(CW"sv_cmp_locale"\fR. +.Sp +.Vb 1 +\& I32 sv_cmp(SV *const sv1, SV *const sv2) +.Ve +.IP "sv_cmp_flags" 8 +.IX Xref "sv_cmp_flags" +.IX Item "sv_cmp_flags" +Compares the strings in two SVs. Returns \-1, 0, or 1 indicating whether the +string in \f(CW\*(C`sv1\*(C'\fR is less than, equal to, or greater than the string in +\&\f(CW\*(C`sv2\*(C'\fR. Is \s-1UTF\-8\s0 and \f(CW\*(Aquse\ bytes\*(Aq\fR aware and will coerce its args to strings +if necessary. If the flags has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, it handles get magic. See +also \f(CW"sv_cmp_locale_flags"\fR. +.Sp +.Vb 2 +\& I32 sv_cmp_flags(SV *const sv1, SV *const sv2, +\& const U32 flags) +.Ve +.IP "sv_cmp_locale" 8 +.IX Xref "sv_cmp_locale" +.IX Item "sv_cmp_locale" +Compares the strings in two SVs in a locale-aware manner. Is \s-1UTF\-8\s0 and +\&\f(CW\*(Aquse\ bytes\*(Aq\fR aware, handles get magic, and will coerce its args to strings +if necessary. See also \f(CW"sv_cmp"\fR. +.Sp +.Vb 1 +\& I32 sv_cmp_locale(SV *const sv1, SV *const sv2) +.Ve +.IP "sv_cmp_locale_flags" 8 +.IX Xref "sv_cmp_locale_flags" +.IX Item "sv_cmp_locale_flags" +Compares the strings in two SVs in a locale-aware manner. Is \s-1UTF\-8\s0 and +\&\f(CW\*(Aquse\ bytes\*(Aq\fR aware and will coerce its args to strings if necessary. If +the flags contain \f(CW\*(C`SV_GMAGIC\*(C'\fR, it handles get magic. See also +\&\f(CW"sv_cmp_flags"\fR. +.Sp +.Vb 3 +\& I32 sv_cmp_locale_flags(SV *const sv1, +\& SV *const sv2, +\& const U32 flags) +.Ve +.IP "sv_collxfrm" 8 +.IX Xref "sv_collxfrm" +.IX Item "sv_collxfrm" +This calls \f(CW\*(C`sv_collxfrm_flags\*(C'\fR with the \s-1SV_GMAGIC\s0 flag. See +\&\f(CW"sv_collxfrm_flags"\fR. +.Sp +.Vb 1 +\& char* sv_collxfrm(SV *const sv, STRLEN *const nxp) +.Ve +.IP "sv_collxfrm_flags" 8 +.IX Xref "sv_collxfrm_flags" +.IX Item "sv_collxfrm_flags" +Add Collate Transform magic to an \s-1SV\s0 if it doesn't already have it. If the +flags contain \f(CW\*(C`SV_GMAGIC\*(C'\fR, it handles get-magic. +.Sp +Any scalar variable may carry \f(CW\*(C`PERL_MAGIC_collxfrm\*(C'\fR magic that contains the +scalar data of the variable, but transformed to such a format that a normal +memory comparison can be used to compare the data according to the locale +settings. +.Sp +.Vb 3 +\& char* sv_collxfrm_flags(SV *const sv, +\& STRLEN *const nxp, +\& I32 const flags) +.Ve +.IP "sv_copypv" 8 +.IX Xref "sv_copypv" +.IX Item "sv_copypv" +Copies a stringified representation of the source \s-1SV\s0 into the +destination \s-1SV.\s0 Automatically performs any necessary \f(CW\*(C`mg_get\*(C'\fR and +coercion of numeric values into strings. Guaranteed to preserve +\&\f(CW\*(C`UTF8\*(C'\fR flag even from overloaded objects. Similar in nature to +\&\f(CW\*(C`sv_2pv[_flags]\*(C'\fR but operates directly on an \s-1SV\s0 instead of just the +string. Mostly uses \f(CW\*(C`sv_2pv_flags\*(C'\fR to do its work, except when that +would lose the \s-1UTF\-8\s0'ness of the \s-1PV.\s0 +.Sp +.Vb 1 +\& void sv_copypv(SV *const dsv, SV *const ssv) +.Ve +.IP "sv_copypv_flags" 8 +.IX Xref "sv_copypv_flags" +.IX Item "sv_copypv_flags" +Implementation of \f(CW\*(C`sv_copypv\*(C'\fR and \f(CW\*(C`sv_copypv_nomg\*(C'\fR. Calls get magic iff flags +has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set. +.Sp +.Vb 2 +\& void sv_copypv_flags(SV *const dsv, SV *const ssv, +\& const I32 flags) +.Ve +.IP "sv_copypv_nomg" 8 +.IX Xref "sv_copypv_nomg" +.IX Item "sv_copypv_nomg" +Like \f(CW\*(C`sv_copypv\*(C'\fR, but doesn't invoke get magic first. +.Sp +.Vb 1 +\& void sv_copypv_nomg(SV *const dsv, SV *const ssv) +.Ve +.IP "SvCUR" 8 +.IX Xref "SvCUR" +.IX Item "SvCUR" +Returns the length of the string which is in the \s-1SV.\s0 See \f(CW"SvLEN"\fR. +.Sp +.Vb 1 +\& STRLEN SvCUR(SV* sv) +.Ve +.IP "SvCUR_set" 8 +.IX Xref "SvCUR_set" +.IX Item "SvCUR_set" +Set the current length of the string which is in the \s-1SV.\s0 See \f(CW"SvCUR"\fR +and \f(CW\*(C`SvIV_set\*(C'\fR>. +.Sp +.Vb 1 +\& void SvCUR_set(SV* sv, STRLEN len) +.Ve +.IP "sv_dec" 8 +.IX Xref "sv_dec" +.IX Item "sv_dec" +Auto-decrement of the value in the \s-1SV,\s0 doing string to numeric conversion +if necessary. Handles 'get' magic and operator overloading. +.Sp +.Vb 1 +\& void sv_dec(SV *const sv) +.Ve +.IP "sv_dec_nomg" 8 +.IX Xref "sv_dec_nomg" +.IX Item "sv_dec_nomg" +Auto-decrement of the value in the \s-1SV,\s0 doing string to numeric conversion +if necessary. Handles operator overloading. Skips handling 'get' magic. +.Sp +.Vb 1 +\& void sv_dec_nomg(SV *const sv) +.Ve +.IP "sv_derived_from" 8 +.IX Xref "sv_derived_from" +.IX Item "sv_derived_from" +Exactly like \*(L"sv_derived_from_pv\*(R", but doesn't take a \f(CW\*(C`flags\*(C'\fR parameter. +.Sp +.Vb 1 +\& bool sv_derived_from(SV* sv, const char *const name) +.Ve +.IP "sv_derived_from_pv" 8 +.IX Xref "sv_derived_from_pv" +.IX Item "sv_derived_from_pv" +Exactly like \*(L"sv_derived_from_pvn\*(R", but takes a nul-terminated string +instead of a string/length pair. +.Sp +.Vb 3 +\& bool sv_derived_from_pv(SV* sv, +\& const char *const name, +\& U32 flags) +.Ve +.IP "sv_derived_from_pvn" 8 +.IX Xref "sv_derived_from_pvn" +.IX Item "sv_derived_from_pvn" +Returns a boolean indicating whether the \s-1SV\s0 is derived from the specified class +\&\fIat the C level\fR. To check derivation at the Perl level, call \f(CW\*(C`isa()\*(C'\fR as a +normal Perl method. +.Sp +Currently, the only significant value for \f(CW\*(C`flags\*(C'\fR is SVf_UTF8. +.Sp +.Vb 3 +\& bool sv_derived_from_pvn(SV* sv, +\& const char *const name, +\& const STRLEN len, U32 flags) +.Ve +.IP "sv_derived_from_sv" 8 +.IX Xref "sv_derived_from_sv" +.IX Item "sv_derived_from_sv" +Exactly like \*(L"sv_derived_from_pvn\*(R", but takes the name string in the form +of an \s-1SV\s0 instead of a string/length pair. This is the advised form. +.Sp +.Vb 2 +\& bool sv_derived_from_sv(SV* sv, SV *namesv, +\& U32 flags) +.Ve +.IP "sv_does" 8 +.IX Xref "sv_does" +.IX Item "sv_does" +Like \*(L"sv_does_pv\*(R", but doesn't take a \f(CW\*(C`flags\*(C'\fR parameter. +.Sp +.Vb 1 +\& bool sv_does(SV* sv, const char *const name) +.Ve +.IP "sv_does_pv" 8 +.IX Xref "sv_does_pv" +.IX Item "sv_does_pv" +Like \*(L"sv_does_sv\*(R", but takes a nul-terminated string instead of an \s-1SV.\s0 +.Sp +.Vb 2 +\& bool sv_does_pv(SV* sv, const char *const name, +\& U32 flags) +.Ve +.IP "sv_does_pvn" 8 +.IX Xref "sv_does_pvn" +.IX Item "sv_does_pvn" +Like \*(L"sv_does_sv\*(R", but takes a string/length pair instead of an \s-1SV.\s0 +.Sp +.Vb 2 +\& bool sv_does_pvn(SV* sv, const char *const name, +\& const STRLEN len, U32 flags) +.Ve +.IP "sv_does_sv" 8 +.IX Xref "sv_does_sv" +.IX Item "sv_does_sv" +Returns a boolean indicating whether the \s-1SV\s0 performs a specific, named role. +The \s-1SV\s0 can be a Perl object or the name of a Perl class. +.Sp +.Vb 1 +\& bool sv_does_sv(SV* sv, SV* namesv, U32 flags) +.Ve +.IP "SvEND" 8 +.IX Xref "SvEND" +.IX Item "SvEND" +Returns a pointer to the spot just after the last character in +the string which is in the \s-1SV,\s0 where there is usually a trailing +\&\f(CW\*(C`NUL\*(C'\fR character (even though Perl scalars do not strictly require it). +See \f(CW"SvCUR"\fR. Access the character as \f(CW\*(C`*(SvEND(sv))\*(C'\fR. +.Sp +Warning: If \f(CW\*(C`SvCUR\*(C'\fR is equal to \f(CW\*(C`SvLEN\*(C'\fR, then \f(CW\*(C`SvEND\*(C'\fR points to +unallocated memory. +.Sp +.Vb 1 +\& char* SvEND(SV* sv) +.Ve +.IP "sv_eq" 8 +.IX Xref "sv_eq" +.IX Item "sv_eq" +Returns a boolean indicating whether the strings in the two SVs are +identical. Is \s-1UTF\-8\s0 and \f(CW\*(Aquse\ bytes\*(Aq\fR aware, handles get magic, and will +coerce its args to strings if necessary. +.Sp +.Vb 1 +\& I32 sv_eq(SV* sv1, SV* sv2) +.Ve +.IP "sv_eq_flags" 8 +.IX Xref "sv_eq_flags" +.IX Item "sv_eq_flags" +Returns a boolean indicating whether the strings in the two SVs are +identical. Is \s-1UTF\-8\s0 and \f(CW\*(Aquse\ bytes\*(Aq\fR aware and coerces its args to strings +if necessary. If the flags has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, it handles get-magic, too. +.Sp +.Vb 1 +\& I32 sv_eq_flags(SV* sv1, SV* sv2, const U32 flags) +.Ve +.IP "sv_force_normal_flags" 8 +.IX Xref "sv_force_normal_flags" +.IX Item "sv_force_normal_flags" +Undo various types of fakery on an \s-1SV,\s0 where fakery means +\&\*(L"more than\*(R" a string: if the \s-1PV\s0 is a shared string, make +a private copy; if we're a ref, stop refing; if we're a glob, downgrade to +an \f(CW\*(C`xpvmg\*(C'\fR; if we're a copy-on-write scalar, this is the on-write time when +we do the copy, and is also used locally; if this is a +vstring, drop the vstring magic. If \f(CW\*(C`SV_COW_DROP_PV\*(C'\fR is set +then a copy-on-write scalar drops its \s-1PV\s0 buffer (if any) and becomes +\&\f(CW\*(C`SvPOK_off\*(C'\fR rather than making a copy. (Used where this +scalar is about to be set to some other value.) In addition, +the \f(CW\*(C`flags\*(C'\fR parameter gets passed to \f(CW\*(C`sv_unref_flags()\*(C'\fR +when unreffing. \f(CW\*(C`sv_force_normal\*(C'\fR calls this function +with flags set to 0. +.Sp +This function is expected to be used to signal to perl that this \s-1SV\s0 is +about to be written to, and any extra book-keeping needs to be taken care +of. Hence, it croaks on read-only values. +.Sp +.Vb 2 +\& void sv_force_normal_flags(SV *const sv, +\& const U32 flags) +.Ve +.IP "sv_free" 8 +.IX Xref "sv_free" +.IX Item "sv_free" +Decrement an \s-1SV\s0's reference count, and if it drops to zero, call +\&\f(CW\*(C`sv_clear\*(C'\fR to invoke destructors and free up any memory used by +the body; finally, deallocating the \s-1SV\s0's head itself. +Normally called via a wrapper macro \f(CW\*(C`SvREFCNT_dec\*(C'\fR. +.Sp +.Vb 1 +\& void sv_free(SV *const sv) +.Ve +.IP "SvGAMAGIC" 8 +.IX Xref "SvGAMAGIC" +.IX Item "SvGAMAGIC" +Returns true if the \s-1SV\s0 has get magic or +overloading. If either is true then +the scalar is active data, and has the potential to return a new value every +time it is accessed. Hence you must be careful to +only read it once per user logical operation and work +with that returned value. If neither is true then +the scalar's value cannot change unless written to. +.Sp +.Vb 1 +\& U32 SvGAMAGIC(SV* sv) +.Ve +.IP "sv_gets" 8 +.IX Xref "sv_gets" +.IX Item "sv_gets" +Get a line from the filehandle and store it into the \s-1SV,\s0 optionally +appending to the currently-stored string. If \f(CW\*(C`append\*(C'\fR is not 0, the +line is appended to the \s-1SV\s0 instead of overwriting it. \f(CW\*(C`append\*(C'\fR should +be set to the byte offset that the appended string should start at +in the \s-1SV\s0 (typically, \f(CW\*(C`SvCUR(sv)\*(C'\fR is a suitable choice). +.Sp +.Vb 2 +\& char* sv_gets(SV *const sv, PerlIO *const fp, +\& I32 append) +.Ve +.IP "sv_get_backrefs" 8 +.IX Xref "sv_get_backrefs" +.IX Item "sv_get_backrefs" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +If \f(CW\*(C`sv\*(C'\fR is the target of a weak reference then it returns the back +references structure associated with the sv; otherwise return \f(CW\*(C`NULL\*(C'\fR. +.Sp +When returning a non-null result the type of the return is relevant. If it +is an \s-1AV\s0 then the elements of the \s-1AV\s0 are the weak reference RVs which +point at this item. If it is any other type then the item itself is the +weak reference. +.Sp +See also \f(CW\*(C`Perl_sv_add_backref()\*(C'\fR, \f(CW\*(C`Perl_sv_del_backref()\*(C'\fR, +\&\f(CW\*(C`Perl_sv_kill_backrefs()\*(C'\fR +.Sp +.Vb 1 +\& SV* sv_get_backrefs(SV *const sv) +.Ve +.IP "SvGROW" 8 +.IX Xref "SvGROW" +.IX Item "SvGROW" +Expands the character buffer in the \s-1SV\s0 so that it has room for the +indicated number of bytes (remember to reserve space for an extra trailing +\&\f(CW\*(C`NUL\*(C'\fR character). Calls \f(CW\*(C`sv_grow\*(C'\fR to perform the expansion if necessary. +Returns a pointer to the character +buffer. \s-1SV\s0 must be of type >= \f(CW\*(C`SVt_PV\*(C'\fR. One +alternative is to call \f(CW\*(C`sv_grow\*(C'\fR if you are not sure of the type of \s-1SV.\s0 +.Sp +You might mistakenly think that \f(CW\*(C`len\*(C'\fR is the number of bytes to add to the +existing size, but instead it is the total size \f(CW\*(C`sv\*(C'\fR should be. +.Sp +.Vb 1 +\& char * SvGROW(SV* sv, STRLEN len) +.Ve +.IP "sv_grow" 8 +.IX Xref "sv_grow" +.IX Item "sv_grow" +Expands the character buffer in the \s-1SV.\s0 If necessary, uses \f(CW\*(C`sv_unref\*(C'\fR and +upgrades the \s-1SV\s0 to \f(CW\*(C`SVt_PV\*(C'\fR. Returns a pointer to the character buffer. +Use the \f(CW\*(C`SvGROW\*(C'\fR wrapper instead. +.Sp +.Vb 1 +\& char* sv_grow(SV *const sv, STRLEN newlen) +.Ve +.IP "sv_inc" 8 +.IX Xref "sv_inc" +.IX Item "sv_inc" +Auto-increment of the value in the \s-1SV,\s0 doing string to numeric conversion +if necessary. Handles 'get' magic and operator overloading. +.Sp +.Vb 1 +\& void sv_inc(SV *const sv) +.Ve +.IP "sv_inc_nomg" 8 +.IX Xref "sv_inc_nomg" +.IX Item "sv_inc_nomg" +Auto-increment of the value in the \s-1SV,\s0 doing string to numeric conversion +if necessary. Handles operator overloading. Skips handling 'get' magic. +.Sp +.Vb 1 +\& void sv_inc_nomg(SV *const sv) +.Ve +.IP "sv_insert" 8 +.IX Xref "sv_insert" +.IX Item "sv_insert" +Inserts and/or replaces a string at the specified offset/length within the \s-1SV.\s0 +Similar to the Perl \f(CW\*(C`substr()\*(C'\fR function, with \f(CW\*(C`littlelen\*(C'\fR bytes starting at +\&\f(CW\*(C`little\*(C'\fR replacing \f(CW\*(C`len\*(C'\fR bytes of the string in \f(CW\*(C`bigstr\*(C'\fR starting at +\&\f(CW\*(C`offset\*(C'\fR. Handles get magic. +.Sp +.Vb 4 +\& void sv_insert(SV *const bigstr, const STRLEN offset, +\& const STRLEN len, +\& const char *const little, +\& const STRLEN littlelen) +.Ve +.IP "sv_insert_flags" 8 +.IX Xref "sv_insert_flags" +.IX Item "sv_insert_flags" +Same as \f(CW\*(C`sv_insert\*(C'\fR, but the extra \f(CW\*(C`flags\*(C'\fR are passed to the +\&\f(CW\*(C`SvPV_force_flags\*(C'\fR that applies to \f(CW\*(C`bigstr\*(C'\fR. +.Sp +.Vb 6 +\& void sv_insert_flags(SV *const bigstr, +\& const STRLEN offset, +\& const STRLEN len, +\& const char *little, +\& const STRLEN littlelen, +\& const U32 flags) +.Ve +.IP "SvIOK" 8 +.IX Xref "SvIOK" +.IX Item "SvIOK" +Returns a U32 value indicating whether the \s-1SV\s0 contains an integer. +.Sp +.Vb 1 +\& U32 SvIOK(SV* sv) +.Ve +.IP "SvIOK_notUV" 8 +.IX Xref "SvIOK_notUV" +.IX Item "SvIOK_notUV" +Returns a boolean indicating whether the \s-1SV\s0 contains a signed integer. +.Sp +.Vb 1 +\& bool SvIOK_notUV(SV* sv) +.Ve +.IP "SvIOK_off" 8 +.IX Xref "SvIOK_off" +.IX Item "SvIOK_off" +Unsets the \s-1IV\s0 status of an \s-1SV.\s0 +.Sp +.Vb 1 +\& void SvIOK_off(SV* sv) +.Ve +.IP "SvIOK_on" 8 +.IX Xref "SvIOK_on" +.IX Item "SvIOK_on" +Tells an \s-1SV\s0 that it is an integer. +.Sp +.Vb 1 +\& void SvIOK_on(SV* sv) +.Ve +.IP "SvIOK_only" 8 +.IX Xref "SvIOK_only" +.IX Item "SvIOK_only" +Tells an \s-1SV\s0 that it is an integer and disables all other \f(CW\*(C`OK\*(C'\fR bits. +.Sp +.Vb 1 +\& void SvIOK_only(SV* sv) +.Ve +.IP "SvIOK_only_UV" 8 +.IX Xref "SvIOK_only_UV" +.IX Item "SvIOK_only_UV" +Tells an \s-1SV\s0 that it is an unsigned integer and disables all other \f(CW\*(C`OK\*(C'\fR bits. +.Sp +.Vb 1 +\& void SvIOK_only_UV(SV* sv) +.Ve +.IP "SvIOKp" 8 +.IX Xref "SvIOKp" +.IX Item "SvIOKp" +Returns a U32 value indicating whether the \s-1SV\s0 contains an integer. Checks +the \fBprivate\fR setting. Use \f(CW\*(C`SvIOK\*(C'\fR instead. +.Sp +.Vb 1 +\& U32 SvIOKp(SV* sv) +.Ve +.IP "SvIOK_UV" 8 +.IX Xref "SvIOK_UV" +.IX Item "SvIOK_UV" +Returns a boolean indicating whether the \s-1SV\s0 contains an integer that must be +interpreted as unsigned. A non-negative integer whose value is within the +range of both an \s-1IV\s0 and a \s-1UV\s0 may be flagged as either \f(CW\*(C`SvUOK\*(C'\fR or \f(CW\*(C`SvIOK\*(C'\fR. +.Sp +.Vb 1 +\& bool SvIOK_UV(SV* sv) +.Ve +.IP "sv_isa" 8 +.IX Xref "sv_isa" +.IX Item "sv_isa" +Returns a boolean indicating whether the \s-1SV\s0 is blessed into the specified +class. +.Sp +This does not check for subtypes or method overloading. Use \f(CW\*(C`sv_isa_sv\*(C'\fR to +verify an inheritance relationship in the same way as the \f(CW\*(C`isa\*(C'\fR operator by +respecting any \f(CW\*(C`isa()\*(C'\fR method overloading; or \f(CW\*(C`sv_derived_from_sv\*(C'\fR to test +directly on the actual object type. +.Sp +.Vb 1 +\& int sv_isa(SV* sv, const char *const name) +.Ve +.IP "sv_isa_sv" 8 +.IX Xref "sv_isa_sv" +.IX Item "sv_isa_sv" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Returns a boolean indicating whether the \s-1SV\s0 is an object reference and is +derived from the specified class, respecting any \f(CW\*(C`isa()\*(C'\fR method overloading +it may have. Returns false if \f(CW\*(C`sv\*(C'\fR is not a reference to an object, or is +not derived from the specified class. +.Sp +This is the function used to implement the behaviour of the \f(CW\*(C`isa\*(C'\fR operator. +.Sp +Does not invoke magic on \f(CW\*(C`sv\*(C'\fR. +.Sp +Not to be confused with the older \f(CW\*(C`sv_isa\*(C'\fR function, which does not use an +overloaded \f(CW\*(C`isa()\*(C'\fR method, nor will check subclassing. +.Sp +.Vb 1 +\& bool sv_isa_sv(SV* sv, SV* namesv) +.Ve +.IP "SvIsCOW" 8 +.IX Xref "SvIsCOW" +.IX Item "SvIsCOW" +Returns a U32 value indicating whether the \s-1SV\s0 is Copy-On-Write (either shared +hash key scalars, or full Copy On Write scalars if 5.9.0 is configured for +\&\s-1COW\s0). +.Sp +.Vb 1 +\& U32 SvIsCOW(SV* sv) +.Ve +.IP "SvIsCOW_shared_hash" 8 +.IX Xref "SvIsCOW_shared_hash" +.IX Item "SvIsCOW_shared_hash" +Returns a boolean indicating whether the \s-1SV\s0 is Copy-On-Write shared hash key +scalar. +.Sp +.Vb 1 +\& bool SvIsCOW_shared_hash(SV* sv) +.Ve +.IP "sv_isobject" 8 +.IX Xref "sv_isobject" +.IX Item "sv_isobject" +Returns a boolean indicating whether the \s-1SV\s0 is an \s-1RV\s0 pointing to a blessed +object. If the \s-1SV\s0 is not an \s-1RV,\s0 or if the object is not blessed, then this +will return false. +.Sp +.Vb 1 +\& int sv_isobject(SV* sv) +.Ve +.IP "SvIV" 8 +.IX Xref "SvIV" +.IX Item "SvIV" +Coerces the given \s-1SV\s0 to \s-1IV\s0 and returns it. The returned value in many +circumstances will get stored in \f(CW\*(C`sv\*(C'\fR's \s-1IV\s0 slot, but not in all cases. (Use +\&\f(CW"sv_setiv"\fR to make sure it does). +.Sp +See \f(CW"SvIVx"\fR for a version which guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once. +.Sp +.Vb 1 +\& IV SvIV(SV* sv) +.Ve +.IP "SvIV_nomg" 8 +.IX Xref "SvIV_nomg" +.IX Item "SvIV_nomg" +Like \f(CW\*(C`SvIV\*(C'\fR but doesn't process magic. +.Sp +.Vb 1 +\& IV SvIV_nomg(SV* sv) +.Ve +.IP "SvIV_set" 8 +.IX Xref "SvIV_set" +.IX Item "SvIV_set" +Set the value of the \s-1IV\s0 pointer in sv to val. It is possible to perform +the same function of this macro with an lvalue assignment to \f(CW\*(C`SvIVX\*(C'\fR. +With future Perls, however, it will be more efficient to use +\&\f(CW\*(C`SvIV_set\*(C'\fR instead of the lvalue assignment to \f(CW\*(C`SvIVX\*(C'\fR. +.Sp +.Vb 1 +\& void SvIV_set(SV* sv, IV val) +.Ve +.IP "SvIVX" 8 +.IX Xref "SvIVX" +.IX Item "SvIVX" +Returns the raw value in the \s-1SV\s0's \s-1IV\s0 slot, without checks or conversions. +Only use when you are sure \f(CW\*(C`SvIOK\*(C'\fR is true. See also \f(CW"SvIV"\fR. +.Sp +.Vb 1 +\& IV SvIVX(SV* sv) +.Ve +.IP "SvIVx" 8 +.IX Xref "SvIVx" +.IX Item "SvIVx" +Coerces the given \s-1SV\s0 to \s-1IV\s0 and returns it. The returned value in many +circumstances will get stored in \f(CW\*(C`sv\*(C'\fR's \s-1IV\s0 slot, but not in all cases. (Use +\&\f(CW"sv_setiv"\fR to make sure it does). +.Sp +This form guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once. Only use this if \f(CW\*(C`sv\*(C'\fR is an +expression with side effects, otherwise use the more efficient \f(CW\*(C`SvIV\*(C'\fR. +.Sp +.Vb 1 +\& IV SvIVx(SV* sv) +.Ve +.IP "SvLEN" 8 +.IX Xref "SvLEN" +.IX Item "SvLEN" +Returns the size of the string buffer in the \s-1SV,\s0 not including any part +attributable to \f(CW\*(C`SvOOK\*(C'\fR. See \f(CW"SvCUR"\fR. +.Sp +.Vb 1 +\& STRLEN SvLEN(SV* sv) +.Ve +.IP "sv_len" 8 +.IX Xref "sv_len" +.IX Item "sv_len" +Returns the length of the string in the \s-1SV.\s0 Handles magic and type +coercion and sets the \s-1UTF8\s0 flag appropriately. See also \f(CW"SvCUR"\fR, which +gives raw access to the \f(CW\*(C`xpv_cur\*(C'\fR slot. +.Sp +.Vb 1 +\& STRLEN sv_len(SV *const sv) +.Ve +.IP "SvLEN_set" 8 +.IX Xref "SvLEN_set" +.IX Item "SvLEN_set" +Set the size of the string buffer for the \s-1SV.\s0 See \f(CW"SvLEN"\fR. +.Sp +.Vb 1 +\& void SvLEN_set(SV* sv, STRLEN len) +.Ve +.IP "sv_len_utf8" 8 +.IX Xref "sv_len_utf8" +.IX Item "sv_len_utf8" +Returns the number of characters in the string in an \s-1SV,\s0 counting wide +\&\s-1UTF\-8\s0 bytes as a single character. Handles magic and type coercion. +.Sp +.Vb 1 +\& STRLEN sv_len_utf8(SV *const sv) +.Ve +.IP "sv_magic" 8 +.IX Xref "sv_magic" +.IX Item "sv_magic" +Adds magic to an \s-1SV.\s0 First upgrades \f(CW\*(C`sv\*(C'\fR to type \f(CW\*(C`SVt_PVMG\*(C'\fR if +necessary, then adds a new magic item of type \f(CW\*(C`how\*(C'\fR to the head of the +magic list. +.Sp +See \f(CW"sv_magicext"\fR (which \f(CW\*(C`sv_magic\*(C'\fR now calls) for a description of the +handling of the \f(CW\*(C`name\*(C'\fR and \f(CW\*(C`namlen\*(C'\fR arguments. +.Sp +You need to use \f(CW\*(C`sv_magicext\*(C'\fR to add magic to \f(CW\*(C`SvREADONLY\*(C'\fR SVs and also +to add more than one instance of the same \f(CW\*(C`how\*(C'\fR. +.Sp +.Vb 3 +\& void sv_magic(SV *const sv, SV *const obj, +\& const int how, const char *const name, +\& const I32 namlen) +.Ve +.IP "sv_magicext" 8 +.IX Xref "sv_magicext" +.IX Item "sv_magicext" +Adds magic to an \s-1SV,\s0 upgrading it if necessary. Applies the +supplied \f(CW\*(C`vtable\*(C'\fR and returns a pointer to the magic added. +.Sp +Note that \f(CW\*(C`sv_magicext\*(C'\fR will allow things that \f(CW\*(C`sv_magic\*(C'\fR will not. +In particular, you can add magic to \f(CW\*(C`SvREADONLY\*(C'\fR SVs, and add more than +one instance of the same \f(CW\*(C`how\*(C'\fR. +.Sp +If \f(CW\*(C`namlen\*(C'\fR is greater than zero then a \f(CW\*(C`savepvn\*(C'\fR \fIcopy\fR of \f(CW\*(C`name\*(C'\fR is +stored, if \f(CW\*(C`namlen\*(C'\fR is zero then \f(CW\*(C`name\*(C'\fR is stored as-is and \- as another +special case \- if \f(CW\*(C`(name && namlen == HEf_SVKEY)\*(C'\fR then \f(CW\*(C`name\*(C'\fR is assumed +to contain an SV* and is stored as-is with its \f(CW\*(C`REFCNT\*(C'\fR incremented. +.Sp +(This is now used as a subroutine by \f(CW\*(C`sv_magic\*(C'\fR.) +.Sp +.Vb 5 +\& MAGIC * sv_magicext(SV *const sv, SV *const obj, +\& const int how, +\& const MGVTBL *const vtbl, +\& const char *const name, +\& const I32 namlen) +.Ve +.IP "SvMAGIC_set" 8 +.IX Xref "SvMAGIC_set" +.IX Item "SvMAGIC_set" +Set the value of the \s-1MAGIC\s0 pointer in \f(CW\*(C`sv\*(C'\fR to val. See \f(CW"SvIV_set"\fR. +.Sp +.Vb 1 +\& void SvMAGIC_set(SV* sv, MAGIC* val) +.Ve +.IP "sv_mortalcopy" 8 +.IX Xref "sv_mortalcopy" +.IX Item "sv_mortalcopy" +Creates a new \s-1SV\s0 which is a copy of the original \s-1SV\s0 (using \f(CW\*(C`sv_setsv\*(C'\fR). +The new \s-1SV\s0 is marked as mortal. It will be destroyed \*(L"soon\*(R", either by an +explicit call to \f(CW\*(C`FREETMPS\*(C'\fR, or by an implicit call at places such as +statement boundaries. See also \f(CW"sv_newmortal"\fR and \f(CW"sv_2mortal"\fR. +.Sp +.Vb 1 +\& SV* sv_mortalcopy(SV *const oldsv) +.Ve +.IP "sv_mortalcopy_flags" 8 +.IX Xref "sv_mortalcopy_flags" +.IX Item "sv_mortalcopy_flags" +Like \f(CW\*(C`sv_mortalcopy\*(C'\fR, but the extra \f(CW\*(C`flags\*(C'\fR are passed to the +\&\f(CW\*(C`sv_setsv_flags\*(C'\fR. +.Sp +.Vb 1 +\& SV* sv_mortalcopy_flags(SV *const oldsv, U32 flags) +.Ve +.IP "sv_newmortal" 8 +.IX Xref "sv_newmortal" +.IX Item "sv_newmortal" +Creates a new null \s-1SV\s0 which is mortal. The reference count of the \s-1SV\s0 is +set to 1. It will be destroyed \*(L"soon\*(R", either by an explicit call to +\&\f(CW\*(C`FREETMPS\*(C'\fR, or by an implicit call at places such as statement boundaries. +See also \f(CW"sv_mortalcopy"\fR and \f(CW"sv_2mortal"\fR. +.Sp +.Vb 1 +\& SV* sv_newmortal() +.Ve +.IP "sv_newref" 8 +.IX Xref "sv_newref" +.IX Item "sv_newref" +Increment an \s-1SV\s0's reference count. Use the \f(CW\*(C`SvREFCNT_inc()\*(C'\fR wrapper +instead. +.Sp +.Vb 1 +\& SV* sv_newref(SV *const sv) +.Ve +.IP "SvNIOK" 8 +.IX Xref "SvNIOK" +.IX Item "SvNIOK" +Returns a U32 value indicating whether the \s-1SV\s0 contains a number, integer or +double. +.Sp +.Vb 1 +\& U32 SvNIOK(SV* sv) +.Ve +.IP "SvNIOK_off" 8 +.IX Xref "SvNIOK_off" +.IX Item "SvNIOK_off" +Unsets the \s-1NV/IV\s0 status of an \s-1SV.\s0 +.Sp +.Vb 1 +\& void SvNIOK_off(SV* sv) +.Ve +.IP "SvNIOKp" 8 +.IX Xref "SvNIOKp" +.IX Item "SvNIOKp" +Returns a U32 value indicating whether the \s-1SV\s0 contains a number, integer or +double. Checks the \fBprivate\fR setting. Use \f(CW\*(C`SvNIOK\*(C'\fR instead. +.Sp +.Vb 1 +\& U32 SvNIOKp(SV* sv) +.Ve +.IP "SvNOK" 8 +.IX Xref "SvNOK" +.IX Item "SvNOK" +Returns a U32 value indicating whether the \s-1SV\s0 contains a double. +.Sp +.Vb 1 +\& U32 SvNOK(SV* sv) +.Ve +.IP "SvNOK_off" 8 +.IX Xref "SvNOK_off" +.IX Item "SvNOK_off" +Unsets the \s-1NV\s0 status of an \s-1SV.\s0 +.Sp +.Vb 1 +\& void SvNOK_off(SV* sv) +.Ve +.IP "SvNOK_on" 8 +.IX Xref "SvNOK_on" +.IX Item "SvNOK_on" +Tells an \s-1SV\s0 that it is a double. +.Sp +.Vb 1 +\& void SvNOK_on(SV* sv) +.Ve +.IP "SvNOK_only" 8 +.IX Xref "SvNOK_only" +.IX Item "SvNOK_only" +Tells an \s-1SV\s0 that it is a double and disables all other \s-1OK\s0 bits. +.Sp +.Vb 1 +\& void SvNOK_only(SV* sv) +.Ve +.IP "SvNOKp" 8 +.IX Xref "SvNOKp" +.IX Item "SvNOKp" +Returns a U32 value indicating whether the \s-1SV\s0 contains a double. Checks the +\&\fBprivate\fR setting. Use \f(CW\*(C`SvNOK\*(C'\fR instead. +.Sp +.Vb 1 +\& U32 SvNOKp(SV* sv) +.Ve +.IP "SvNV" 8 +.IX Xref "SvNV" +.IX Item "SvNV" +Coerces the given \s-1SV\s0 to \s-1NV\s0 and returns it. The returned value in many +circumstances will get stored in \f(CW\*(C`sv\*(C'\fR's \s-1NV\s0 slot, but not in all cases. (Use +\&\f(CW"sv_setnv"\fR to make sure it does). +.Sp +See \f(CW"SvNVx"\fR for a version which guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once. +.Sp +.Vb 1 +\& NV SvNV(SV* sv) +.Ve +.IP "SvNV_nomg" 8 +.IX Xref "SvNV_nomg" +.IX Item "SvNV_nomg" +Like \f(CW\*(C`SvNV\*(C'\fR but doesn't process magic. +.Sp +.Vb 1 +\& NV SvNV_nomg(SV* sv) +.Ve +.IP "SvNV_set" 8 +.IX Xref "SvNV_set" +.IX Item "SvNV_set" +Set the value of the \s-1NV\s0 pointer in \f(CW\*(C`sv\*(C'\fR to val. See \f(CW"SvIV_set"\fR. +.Sp +.Vb 1 +\& void SvNV_set(SV* sv, NV val) +.Ve +.IP "SvNVX" 8 +.IX Xref "SvNVX" +.IX Item "SvNVX" +Returns the raw value in the \s-1SV\s0's \s-1NV\s0 slot, without checks or conversions. +Only use when you are sure \f(CW\*(C`SvNOK\*(C'\fR is true. See also \f(CW"SvNV"\fR. +.Sp +.Vb 1 +\& NV SvNVX(SV* sv) +.Ve +.IP "SvNVx" 8 +.IX Xref "SvNVx" +.IX Item "SvNVx" +Coerces the given \s-1SV\s0 to \s-1NV\s0 and returns it. The returned value in many +circumstances will get stored in \f(CW\*(C`sv\*(C'\fR's \s-1NV\s0 slot, but not in all cases. (Use +\&\f(CW"sv_setnv"\fR to make sure it does). +.Sp +This form guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once. Only use this if \f(CW\*(C`sv\*(C'\fR is an +expression with side effects, otherwise use the more efficient \f(CW\*(C`SvNV\*(C'\fR. +.Sp +.Vb 1 +\& NV SvNVx(SV* sv) +.Ve +.IP "SvOK" 8 +.IX Xref "SvOK" +.IX Item "SvOK" +Returns a U32 value indicating whether the value is defined. This is +only meaningful for scalars. +.Sp +.Vb 1 +\& U32 SvOK(SV* sv) +.Ve +.IP "SvOOK" 8 +.IX Xref "SvOOK" +.IX Item "SvOOK" +Returns a U32 indicating whether the pointer to the string buffer is offset. +This hack is used internally to speed up removal of characters from the +beginning of a \f(CW\*(C`SvPV\*(C'\fR. When \f(CW\*(C`SvOOK\*(C'\fR is true, then the start of the +allocated string buffer is actually \f(CW\*(C`SvOOK_offset()\*(C'\fR bytes before \f(CW\*(C`SvPVX\*(C'\fR. +This offset used to be stored in \f(CW\*(C`SvIVX\*(C'\fR, but is now stored within the spare +part of the buffer. +.Sp +.Vb 1 +\& U32 SvOOK(SV* sv) +.Ve +.IP "SvOOK_offset" 8 +.IX Xref "SvOOK_offset" +.IX Item "SvOOK_offset" +Reads into \f(CW\*(C`len\*(C'\fR the offset from \f(CW\*(C`SvPVX\*(C'\fR back to the true start of the +allocated buffer, which will be non-zero if \f(CW\*(C`sv_chop\*(C'\fR has been used to +efficiently remove characters from start of the buffer. Implemented as a +macro, which takes the address of \f(CW\*(C`len\*(C'\fR, which must be of type \f(CW\*(C`STRLEN\*(C'\fR. +Evaluates \f(CW\*(C`sv\*(C'\fR more than once. Sets \f(CW\*(C`len\*(C'\fR to 0 if \f(CW\*(C`SvOOK(sv)\*(C'\fR is false. +.Sp +.Vb 1 +\& void SvOOK_offset(SV*sv, STRLEN len) +.Ve +.IP "SvPOK" 8 +.IX Xref "SvPOK" +.IX Item "SvPOK" +Returns a U32 value indicating whether the \s-1SV\s0 contains a character +string. +.Sp +.Vb 1 +\& U32 SvPOK(SV* sv) +.Ve +.IP "SvPOK_off" 8 +.IX Xref "SvPOK_off" +.IX Item "SvPOK_off" +Unsets the \s-1PV\s0 status of an \s-1SV.\s0 +.Sp +.Vb 1 +\& void SvPOK_off(SV* sv) +.Ve +.IP "SvPOK_on" 8 +.IX Xref "SvPOK_on" +.IX Item "SvPOK_on" +Tells an \s-1SV\s0 that it is a string. +.Sp +.Vb 1 +\& void SvPOK_on(SV* sv) +.Ve +.IP "SvPOK_only" 8 +.IX Xref "SvPOK_only" +.IX Item "SvPOK_only" +Tells an \s-1SV\s0 that it is a string and disables all other \f(CW\*(C`OK\*(C'\fR bits. +Will also turn off the \s-1UTF\-8\s0 status. +.Sp +.Vb 1 +\& void SvPOK_only(SV* sv) +.Ve +.IP "SvPOK_only_UTF8" 8 +.IX Xref "SvPOK_only_UTF8" +.IX Item "SvPOK_only_UTF8" +Tells an \s-1SV\s0 that it is a string and disables all other \f(CW\*(C`OK\*(C'\fR bits, +and leaves the \s-1UTF\-8\s0 status as it was. +.Sp +.Vb 1 +\& void SvPOK_only_UTF8(SV* sv) +.Ve +.IP "SvPOKp" 8 +.IX Xref "SvPOKp" +.IX Item "SvPOKp" +Returns a U32 value indicating whether the \s-1SV\s0 contains a character string. +Checks the \fBprivate\fR setting. Use \f(CW\*(C`SvPOK\*(C'\fR instead. +.Sp +.Vb 1 +\& U32 SvPOKp(SV* sv) +.Ve +.IP "sv_pos_b2u" 8 +.IX Xref "sv_pos_b2u" +.IX Item "sv_pos_b2u" +Converts the value pointed to by \f(CW\*(C`offsetp\*(C'\fR from a count of bytes from the +start of the string, to a count of the equivalent number of \s-1UTF\-8\s0 chars. +Handles magic and type coercion. +.Sp +Use \f(CW\*(C`sv_pos_b2u_flags\*(C'\fR in preference, which correctly handles strings +longer than 2Gb. +.Sp +.Vb 1 +\& void sv_pos_b2u(SV *const sv, I32 *const offsetp) +.Ve +.IP "sv_pos_b2u_flags" 8 +.IX Xref "sv_pos_b2u_flags" +.IX Item "sv_pos_b2u_flags" +Converts \f(CW\*(C`offset\*(C'\fR from a count of bytes from the start of the string, to +a count of the equivalent number of \s-1UTF\-8\s0 chars. Handles type coercion. +\&\f(CW\*(C`flags\*(C'\fR is passed to \f(CW\*(C`SvPV_flags\*(C'\fR, and usually should be +\&\f(CW\*(C`SV_GMAGIC|SV_CONST_RETURN\*(C'\fR to handle magic. +.Sp +.Vb 2 +\& STRLEN sv_pos_b2u_flags(SV *const sv, +\& STRLEN const offset, U32 flags) +.Ve +.IP "sv_pos_u2b" 8 +.IX Xref "sv_pos_u2b" +.IX Item "sv_pos_u2b" +Converts the value pointed to by \f(CW\*(C`offsetp\*(C'\fR from a count of \s-1UTF\-8\s0 chars from +the start of the string, to a count of the equivalent number of bytes; if +\&\f(CW\*(C`lenp\*(C'\fR is non-zero, it does the same to \f(CW\*(C`lenp\*(C'\fR, but this time starting from +the offset, rather than from the start of the string. Handles magic and +type coercion. +.Sp +Use \f(CW\*(C`sv_pos_u2b_flags\*(C'\fR in preference, which correctly handles strings longer +than 2Gb. +.Sp +.Vb 2 +\& void sv_pos_u2b(SV *const sv, I32 *const offsetp, +\& I32 *const lenp) +.Ve +.IP "sv_pos_u2b_flags" 8 +.IX Xref "sv_pos_u2b_flags" +.IX Item "sv_pos_u2b_flags" +Converts the offset from a count of \s-1UTF\-8\s0 chars from +the start of the string, to a count of the equivalent number of bytes; if +\&\f(CW\*(C`lenp\*(C'\fR is non-zero, it does the same to \f(CW\*(C`lenp\*(C'\fR, but this time starting from +\&\f(CW\*(C`offset\*(C'\fR, rather than from the start +of the string. Handles type coercion. +\&\f(CW\*(C`flags\*(C'\fR is passed to \f(CW\*(C`SvPV_flags\*(C'\fR, and usually should be +\&\f(CW\*(C`SV_GMAGIC|SV_CONST_RETURN\*(C'\fR to handle magic. +.Sp +.Vb 2 +\& STRLEN sv_pos_u2b_flags(SV *const sv, STRLEN uoffset, +\& STRLEN *const lenp, U32 flags) +.Ve +.IP "SvPV" 8 +.IX Xref "SvPV" +.IX Item "SvPV" +Returns a pointer to the string in the \s-1SV,\s0 or a stringified form of +the \s-1SV\s0 if the \s-1SV\s0 does not contain a string. The \s-1SV\s0 may cache the +stringified version becoming \f(CW\*(C`SvPOK\*(C'\fR. Handles 'get' magic. The +\&\f(CW\*(C`len\*(C'\fR variable will be set to the length of the string (this is a macro, so +don't use \f(CW&len\fR). See also \f(CW"SvPVx"\fR for a version which guarantees to +evaluate \f(CW\*(C`sv\*(C'\fR only once. +.Sp +Note that there is no guarantee that the return value of \f(CW\*(C`SvPV()\*(C'\fR is +equal to \f(CW\*(C`SvPVX(sv)\*(C'\fR, or that \f(CW\*(C`SvPVX(sv)\*(C'\fR contains valid data, or that +successive calls to \f(CW\*(C`SvPV(sv)\*(C'\fR will return the same pointer value each +time. This is due to the way that things like overloading and +Copy-On-Write are handled. In these cases, the return value may point to +a temporary buffer or similar. If you absolutely need the \f(CW\*(C`SvPVX\*(C'\fR field to +be valid (for example, if you intend to write to it), then see +\&\f(CW"SvPV_force"\fR. +.Sp +.Vb 1 +\& char* SvPV(SV* sv, STRLEN len) +.Ve +.IP "SvPVbyte" 8 +.IX Xref "SvPVbyte" +.IX Item "SvPVbyte" +Like \f(CW\*(C`SvPV\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to byte representation first if necessary. If +the \s-1SV\s0 cannot be downgraded from \s-1UTF\-8,\s0 this croaks. +.Sp +.Vb 1 +\& char* SvPVbyte(SV* sv, STRLEN len) +.Ve +.IP "SvPVbyte_force" 8 +.IX Xref "SvPVbyte_force" +.IX Item "SvPVbyte_force" +Like \f(CW\*(C`SvPV_force\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to byte representation first if +necessary. If the \s-1SV\s0 cannot be downgraded from \s-1UTF\-8,\s0 this croaks. +.Sp +.Vb 1 +\& char* SvPVbyte_force(SV* sv, STRLEN len) +.Ve +.IP "SvPVbyte_nolen" 8 +.IX Xref "SvPVbyte_nolen" +.IX Item "SvPVbyte_nolen" +Like \f(CW\*(C`SvPV_nolen\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to byte representation first if +necessary. If the \s-1SV\s0 cannot be downgraded from \s-1UTF\-8,\s0 this croaks. +.Sp +.Vb 1 +\& char* SvPVbyte_nolen(SV* sv) +.Ve +.IP "SvPVbyte_nomg" 8 +.IX Xref "SvPVbyte_nomg" +.IX Item "SvPVbyte_nomg" +Like \f(CW\*(C`SvPVbyte\*(C'\fR, but does not process get magic. +.Sp +.Vb 1 +\& char* SvPVbyte_nomg(SV* sv, STRLEN len) +.Ve +.IP "sv_pvbyten_force" 8 +.IX Xref "sv_pvbyten_force" +.IX Item "sv_pvbyten_force" +The backend for the \f(CW\*(C`SvPVbytex_force\*(C'\fR macro. Always use the macro +instead. If the \s-1SV\s0 cannot be downgraded from \s-1UTF\-8,\s0 this croaks. +.Sp +.Vb 1 +\& char* sv_pvbyten_force(SV *const sv, STRLEN *const lp) +.Ve +.IP "SvPVbyte_or_null" 8 +.IX Xref "SvPVbyte_or_null" +.IX Item "SvPVbyte_or_null" +Like \f(CW\*(C`SvPVbyte\*(C'\fR, but when \f(CW\*(C`sv\*(C'\fR is undef, returns \f(CW\*(C`NULL\*(C'\fR. +.Sp +.Vb 1 +\& char* SvPVbyte_or_null(SV* sv, STRLEN len) +.Ve +.IP "SvPVbyte_or_null_nomg" 8 +.IX Xref "SvPVbyte_or_null_nomg" +.IX Item "SvPVbyte_or_null_nomg" +Like \f(CW\*(C`SvPVbyte_or_null\*(C'\fR, but does not process get magic. +.Sp +.Vb 1 +\& char* SvPVbyte_or_null_nomg(SV* sv, STRLEN len) +.Ve +.IP "SvPVbytex" 8 +.IX Xref "SvPVbytex" +.IX Item "SvPVbytex" +Like \f(CW\*(C`SvPV\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to byte representation first if necessary. +Guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once; use the more efficient \f(CW\*(C`SvPVbyte\*(C'\fR +otherwise. If the \s-1SV\s0 cannot be downgraded from \s-1UTF\-8,\s0 this croaks. +.Sp +.Vb 1 +\& char* SvPVbytex(SV* sv, STRLEN len) +.Ve +.IP "SvPVbytex_force" 8 +.IX Xref "SvPVbytex_force" +.IX Item "SvPVbytex_force" +Like \f(CW\*(C`SvPV_force\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to byte representation first if necessary. +Guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once; use the more efficient \f(CW\*(C`SvPVbyte_force\*(C'\fR +otherwise. If the \s-1SV\s0 cannot be downgraded from \s-1UTF\-8,\s0 this croaks. +.Sp +.Vb 1 +\& char* SvPVbytex_force(SV* sv, STRLEN len) +.Ve +.IP "SvPVCLEAR" 8 +.IX Xref "SvPVCLEAR" +.IX Item "SvPVCLEAR" +Ensures that sv is a SVt_PV and that its SvCUR is 0, and that it is +properly null terminated. Equivalent to sv_setpvs(""), but more efficient. +.Sp +.Vb 1 +\& char * SvPVCLEAR(SV* sv) +.Ve +.IP "SvPV_force" 8 +.IX Xref "SvPV_force" +.IX Item "SvPV_force" +Like \f(CW\*(C`SvPV\*(C'\fR but will force the \s-1SV\s0 into containing a string (\f(CW\*(C`SvPOK\*(C'\fR), and +only a string (\f(CW\*(C`SvPOK_only\*(C'\fR), by hook or by crook. You need force if you are +going to update the \f(CW\*(C`SvPVX\*(C'\fR directly. Processes get magic. +.Sp +Note that coercing an arbitrary scalar into a plain \s-1PV\s0 will potentially +strip useful data from it. For example if the \s-1SV\s0 was \f(CW\*(C`SvROK\*(C'\fR, then the +referent will have its reference count decremented, and the \s-1SV\s0 itself may +be converted to an \f(CW\*(C`SvPOK\*(C'\fR scalar with a string buffer containing a value +such as \f(CW"ARRAY(0x1234)"\fR. +.Sp +.Vb 1 +\& char* SvPV_force(SV* sv, STRLEN len) +.Ve +.IP "SvPV_force_nomg" 8 +.IX Xref "SvPV_force_nomg" +.IX Item "SvPV_force_nomg" +Like \f(CW\*(C`SvPV_force\*(C'\fR, but doesn't process get magic. +.Sp +.Vb 1 +\& char* SvPV_force_nomg(SV* sv, STRLEN len) +.Ve +.IP "SvPV_nolen" 8 +.IX Xref "SvPV_nolen" +.IX Item "SvPV_nolen" +Like \f(CW\*(C`SvPV\*(C'\fR but doesn't set a length variable. +.Sp +.Vb 1 +\& char* SvPV_nolen(SV* sv) +.Ve +.IP "SvPV_nomg" 8 +.IX Xref "SvPV_nomg" +.IX Item "SvPV_nomg" +Like \f(CW\*(C`SvPV\*(C'\fR but doesn't process magic. +.Sp +.Vb 1 +\& char* SvPV_nomg(SV* sv, STRLEN len) +.Ve +.IP "SvPV_nomg_nolen" 8 +.IX Xref "SvPV_nomg_nolen" +.IX Item "SvPV_nomg_nolen" +Like \f(CW\*(C`SvPV_nolen\*(C'\fR but doesn't process magic. +.Sp +.Vb 1 +\& char* SvPV_nomg_nolen(SV* sv) +.Ve +.IP "sv_pvn_force" 8 +.IX Xref "sv_pvn_force" +.IX Item "sv_pvn_force" +Get a sensible string out of the \s-1SV\s0 somehow. +A private implementation of the \f(CW\*(C`SvPV_force\*(C'\fR macro for compilers which +can't cope with complex macro expressions. Always use the macro instead. +.Sp +.Vb 1 +\& char* sv_pvn_force(SV* sv, STRLEN* lp) +.Ve +.IP "sv_pvn_force_flags" 8 +.IX Xref "sv_pvn_force_flags" +.IX Item "sv_pvn_force_flags" +Get a sensible string out of the \s-1SV\s0 somehow. +If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, will \f(CW\*(C`mg_get\*(C'\fR on \f(CW\*(C`sv\*(C'\fR if +appropriate, else not. \f(CW\*(C`sv_pvn_force\*(C'\fR and \f(CW\*(C`sv_pvn_force_nomg\*(C'\fR are +implemented in terms of this function. +You normally want to use the various wrapper macros instead: see +\&\f(CW"SvPV_force"\fR and \f(CW"SvPV_force_nomg"\fR. +.Sp +.Vb 3 +\& char* sv_pvn_force_flags(SV *const sv, +\& STRLEN *const lp, +\& const I32 flags) +.Ve +.IP "SvPV_set" 8 +.IX Xref "SvPV_set" +.IX Item "SvPV_set" +This is probably not what you want to use, you probably wanted +\&\*(L"sv_usepvn_flags\*(R" or \*(L"sv_setpvn\*(R" or \*(L"sv_setpvs\*(R". +.Sp +Set the value of the \s-1PV\s0 pointer in \f(CW\*(C`sv\*(C'\fR to the Perl allocated +\&\f(CW\*(C`NUL\*(C'\fR\-terminated string \f(CW\*(C`val\*(C'\fR. See also \f(CW"SvIV_set"\fR. +.Sp +Remember to free the previous \s-1PV\s0 buffer. There are many things to check. +Beware that the existing pointer may be involved in copy-on-write or other +mischief, so do \f(CW\*(C`SvOOK_off(sv)\*(C'\fR and use \f(CW\*(C`sv_force_normal\*(C'\fR or +\&\f(CW\*(C`SvPV_force\*(C'\fR (or check the \f(CW\*(C`SvIsCOW\*(C'\fR flag) first to make sure this +modification is safe. Then finally, if it is not a \s-1COW,\s0 call \f(CW\*(C`SvPV_free\*(C'\fR to +free the previous \s-1PV\s0 buffer. +.Sp +.Vb 1 +\& void SvPV_set(SV* sv, char* val) +.Ve +.IP "SvPVutf8" 8 +.IX Xref "SvPVutf8" +.IX Item "SvPVutf8" +Like \f(CW\*(C`SvPV\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to \s-1UTF\-8\s0 first if necessary. +.Sp +.Vb 1 +\& char* SvPVutf8(SV* sv, STRLEN len) +.Ve +.IP "sv_pvutf8n_force" 8 +.IX Xref "sv_pvutf8n_force" +.IX Item "sv_pvutf8n_force" +The backend for the \f(CW\*(C`SvPVutf8x_force\*(C'\fR macro. Always use the macro +instead. +.Sp +.Vb 1 +\& char* sv_pvutf8n_force(SV *const sv, STRLEN *const lp) +.Ve +.IP "SvPVutf8x" 8 +.IX Xref "SvPVutf8x" +.IX Item "SvPVutf8x" +Like \f(CW\*(C`SvPV\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to \s-1UTF\-8\s0 first if necessary. +Guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once; use the more efficient \f(CW\*(C`SvPVutf8\*(C'\fR +otherwise. +.Sp +.Vb 1 +\& char* SvPVutf8x(SV* sv, STRLEN len) +.Ve +.IP "SvPVutf8x_force" 8 +.IX Xref "SvPVutf8x_force" +.IX Item "SvPVutf8x_force" +Like \f(CW\*(C`SvPV_force\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to \s-1UTF\-8\s0 first if necessary. +Guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once; use the more efficient \f(CW\*(C`SvPVutf8_force\*(C'\fR +otherwise. +.Sp +.Vb 1 +\& char* SvPVutf8x_force(SV* sv, STRLEN len) +.Ve +.IP "SvPVutf8_force" 8 +.IX Xref "SvPVutf8_force" +.IX Item "SvPVutf8_force" +Like \f(CW\*(C`SvPV_force\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to \s-1UTF\-8\s0 first if necessary. +.Sp +.Vb 1 +\& char* SvPVutf8_force(SV* sv, STRLEN len) +.Ve +.IP "SvPVutf8_nolen" 8 +.IX Xref "SvPVutf8_nolen" +.IX Item "SvPVutf8_nolen" +Like \f(CW\*(C`SvPV_nolen\*(C'\fR, but converts \f(CW\*(C`sv\*(C'\fR to \s-1UTF\-8\s0 first if necessary. +.Sp +.Vb 1 +\& char* SvPVutf8_nolen(SV* sv) +.Ve +.IP "SvPVutf8_nomg" 8 +.IX Xref "SvPVutf8_nomg" +.IX Item "SvPVutf8_nomg" +Like \f(CW\*(C`SvPVutf8\*(C'\fR, but does not process get magic. +.Sp +.Vb 1 +\& char* SvPVutf8_nomg(SV* sv, STRLEN len) +.Ve +.IP "SvPVutf8_or_null" 8 +.IX Xref "SvPVutf8_or_null" +.IX Item "SvPVutf8_or_null" +Like \f(CW\*(C`SvPVutf8\*(C'\fR, but when \f(CW\*(C`sv\*(C'\fR is undef, returns \f(CW\*(C`NULL\*(C'\fR. +.Sp +.Vb 1 +\& char* SvPVutf8_or_null(SV* sv, STRLEN len) +.Ve +.IP "SvPVutf8_or_null_nomg" 8 +.IX Xref "SvPVutf8_or_null_nomg" +.IX Item "SvPVutf8_or_null_nomg" +Like \f(CW\*(C`SvPVutf8_or_null\*(C'\fR, but does not process get magic. +.Sp +.Vb 1 +\& char* SvPVutf8_or_null_nomg(SV* sv, STRLEN len) +.Ve +.IP "SvPVX" 8 +.IX Xref "SvPVX" +.IX Item "SvPVX" +Returns a pointer to the physical string in the \s-1SV.\s0 The \s-1SV\s0 must contain a +string. Prior to 5.9.3 it is not safe +to execute this macro unless the \s-1SV\s0's +type >= \f(CW\*(C`SVt_PV\*(C'\fR. +.Sp +This is also used to store the name of an autoloaded subroutine in an \s-1XS +AUTOLOAD\s0 routine. See \*(L"Autoloading with XSUBs\*(R" in perlguts. +.Sp +.Vb 1 +\& char* SvPVX(SV* sv) +.Ve +.IP "SvPVx" 8 +.IX Xref "SvPVx" +.IX Item "SvPVx" +A version of \f(CW\*(C`SvPV\*(C'\fR which guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once. +Only use this if \f(CW\*(C`sv\*(C'\fR is an expression with side effects, otherwise use the +more efficient \f(CW\*(C`SvPV\*(C'\fR. +.Sp +.Vb 1 +\& char* SvPVx(SV* sv, STRLEN len) +.Ve +.IP "SvREADONLY" 8 +.IX Xref "SvREADONLY" +.IX Item "SvREADONLY" +Returns true if the argument is readonly, otherwise returns false. +Exposed to perl code via \fBInternals::SvREADONLY()\fR. +.Sp +.Vb 1 +\& U32 SvREADONLY(SV* sv) +.Ve +.IP "SvREADONLY_off" 8 +.IX Xref "SvREADONLY_off" +.IX Item "SvREADONLY_off" +Mark an object as not-readonly. Exactly what this mean depends on the +object type. Exposed to perl code via \fBInternals::SvREADONLY()\fR. +.Sp +.Vb 1 +\& U32 SvREADONLY_off(SV* sv) +.Ve +.IP "SvREADONLY_on" 8 +.IX Xref "SvREADONLY_on" +.IX Item "SvREADONLY_on" +Mark an object as readonly. Exactly what this means depends on the object +type. Exposed to perl code via \fBInternals::SvREADONLY()\fR. +.Sp +.Vb 1 +\& U32 SvREADONLY_on(SV* sv) +.Ve +.IP "sv_ref" 8 +.IX Xref "sv_ref" +.IX Item "sv_ref" +Returns a \s-1SV\s0 describing what the \s-1SV\s0 passed in is a reference to. +.Sp +dst can be a \s-1SV\s0 to be set to the description or \s-1NULL,\s0 in which case a +mortal \s-1SV\s0 is returned. +.Sp +If ob is true and the \s-1SV\s0 is blessed, the description is the class +name, otherwise it is the type of the \s-1SV, \*(L"SCALAR\*(R", \*(L"ARRAY\*(R"\s0 etc. +.Sp +.Vb 2 +\& SV* sv_ref(SV *dst, const SV *const sv, +\& const int ob) +.Ve +.IP "SvREFCNT" 8 +.IX Xref "SvREFCNT" +.IX Item "SvREFCNT" +Returns the value of the object's reference count. Exposed +to perl code via \fBInternals::SvREFCNT()\fR. +.Sp +.Vb 1 +\& U32 SvREFCNT(SV* sv) +.Ve +.IP "SvREFCNT_dec" 8 +.IX Xref "SvREFCNT_dec" +.IX Item "SvREFCNT_dec" +Decrements the reference count of the given \s-1SV.\s0 \f(CW\*(C`sv\*(C'\fR may be \f(CW\*(C`NULL\*(C'\fR. +.Sp +.Vb 1 +\& void SvREFCNT_dec(SV *sv) +.Ve +.IP "SvREFCNT_dec_NN" 8 +.IX Xref "SvREFCNT_dec_NN" +.IX Item "SvREFCNT_dec_NN" +Same as \f(CW\*(C`SvREFCNT_dec\*(C'\fR, but can only be used if you know \f(CW\*(C`sv\*(C'\fR +is not \f(CW\*(C`NULL\*(C'\fR. Since we don't have to check the NULLness, it's faster +and smaller. +.Sp +.Vb 1 +\& void SvREFCNT_dec_NN(SV *sv) +.Ve +.IP "SvREFCNT_inc" 8 +.IX Xref "SvREFCNT_inc" +.IX Item "SvREFCNT_inc" +Increments the reference count of the given \s-1SV,\s0 returning the \s-1SV.\s0 +.Sp +All of the following \f(CW\*(C`SvREFCNT_inc\*(C'\fR* are optimized versions of +\&\f(CW\*(C`SvREFCNT_inc\*(C'\fR, and can be replaced with \f(CW\*(C`SvREFCNT_inc\*(C'\fR. +.Sp +.Vb 1 +\& SV * SvREFCNT_inc(SV *sv) +.Ve +.IP "SvREFCNT_inc_NN" 8 +.IX Xref "SvREFCNT_inc_NN" +.IX Item "SvREFCNT_inc_NN" +Same as \f(CW\*(C`SvREFCNT_inc\*(C'\fR, but can only be used if you know \f(CW\*(C`sv\*(C'\fR +is not \f(CW\*(C`NULL\*(C'\fR. Since we don't have to check the NULLness, it's faster +and smaller. +.Sp +.Vb 1 +\& SV * SvREFCNT_inc_NN(SV *sv) +.Ve +.IP "SvREFCNT_inc_simple" 8 +.IX Xref "SvREFCNT_inc_simple" +.IX Item "SvREFCNT_inc_simple" +Same as \f(CW\*(C`SvREFCNT_inc\*(C'\fR, but can only be used with expressions without side +effects. Since we don't have to store a temporary value, it's faster. +.Sp +.Vb 1 +\& SV* SvREFCNT_inc_simple(SV* sv) +.Ve +.IP "SvREFCNT_inc_simple_NN" 8 +.IX Xref "SvREFCNT_inc_simple_NN" +.IX Item "SvREFCNT_inc_simple_NN" +Same as \f(CW\*(C`SvREFCNT_inc_simple\*(C'\fR, but can only be used if you know \f(CW\*(C`sv\*(C'\fR +is not \f(CW\*(C`NULL\*(C'\fR. Since we don't have to check the NULLness, it's faster +and smaller. +.Sp +.Vb 1 +\& SV* SvREFCNT_inc_simple_NN(SV* sv) +.Ve +.IP "SvREFCNT_inc_simple_void" 8 +.IX Xref "SvREFCNT_inc_simple_void" +.IX Item "SvREFCNT_inc_simple_void" +Same as \f(CW\*(C`SvREFCNT_inc_simple\*(C'\fR, but can only be used if you don't need the +return value. The macro doesn't need to return a meaningful value. +.Sp +.Vb 1 +\& void SvREFCNT_inc_simple_void(SV* sv) +.Ve +.IP "SvREFCNT_inc_simple_void_NN" 8 +.IX Xref "SvREFCNT_inc_simple_void_NN" +.IX Item "SvREFCNT_inc_simple_void_NN" +Same as \f(CW\*(C`SvREFCNT_inc\*(C'\fR, but can only be used if you don't need the return +value, and you know that \f(CW\*(C`sv\*(C'\fR is not \f(CW\*(C`NULL\*(C'\fR. The macro doesn't need +to return a meaningful value, or check for NULLness, so it's smaller +and faster. +.Sp +.Vb 1 +\& void SvREFCNT_inc_simple_void_NN(SV* sv) +.Ve +.IP "SvREFCNT_inc_void" 8 +.IX Xref "SvREFCNT_inc_void" +.IX Item "SvREFCNT_inc_void" +Same as \f(CW\*(C`SvREFCNT_inc\*(C'\fR, but can only be used if you don't need the +return value. The macro doesn't need to return a meaningful value. +.Sp +.Vb 1 +\& void SvREFCNT_inc_void(SV *sv) +.Ve +.IP "SvREFCNT_inc_void_NN" 8 +.IX Xref "SvREFCNT_inc_void_NN" +.IX Item "SvREFCNT_inc_void_NN" +Same as \f(CW\*(C`SvREFCNT_inc\*(C'\fR, but can only be used if you don't need the return +value, and you know that \f(CW\*(C`sv\*(C'\fR is not \f(CW\*(C`NULL\*(C'\fR. The macro doesn't need +to return a meaningful value, or check for NULLness, so it's smaller +and faster. +.Sp +.Vb 1 +\& void SvREFCNT_inc_void_NN(SV* sv) +.Ve +.IP "sv_reftype" 8 +.IX Xref "sv_reftype" +.IX Item "sv_reftype" +Returns a string describing what the \s-1SV\s0 is a reference to. +.Sp +If ob is true and the \s-1SV\s0 is blessed, the string is the class name, +otherwise it is the type of the \s-1SV, \*(L"SCALAR\*(R", \*(L"ARRAY\*(R"\s0 etc. +.Sp +.Vb 1 +\& const char* sv_reftype(const SV *const sv, const int ob) +.Ve +.IP "sv_replace" 8 +.IX Xref "sv_replace" +.IX Item "sv_replace" +Make the first argument a copy of the second, then delete the original. +The target \s-1SV\s0 physically takes over ownership of the body of the source \s-1SV\s0 +and inherits its flags; however, the target keeps any magic it owns, +and any magic in the source is discarded. +Note that this is a rather specialist \s-1SV\s0 copying operation; most of the +time you'll want to use \f(CW\*(C`sv_setsv\*(C'\fR or one of its many macro front-ends. +.Sp +.Vb 1 +\& void sv_replace(SV *const sv, SV *const nsv) +.Ve +.IP "sv_report_used" 8 +.IX Xref "sv_report_used" +.IX Item "sv_report_used" +Dump the contents of all SVs not yet freed (debugging aid). +.Sp +.Vb 1 +\& void sv_report_used() +.Ve +.IP "sv_reset" 8 +.IX Xref "sv_reset" +.IX Item "sv_reset" +Underlying implementation for the \f(CW\*(C`reset\*(C'\fR Perl function. +Note that the perl-level function is vaguely deprecated. +.Sp +.Vb 1 +\& void sv_reset(const char* s, HV *const stash) +.Ve +.IP "SvROK" 8 +.IX Xref "SvROK" +.IX Item "SvROK" +Tests if the \s-1SV\s0 is an \s-1RV.\s0 +.Sp +.Vb 1 +\& U32 SvROK(SV* sv) +.Ve +.IP "SvROK_off" 8 +.IX Xref "SvROK_off" +.IX Item "SvROK_off" +Unsets the \s-1RV\s0 status of an \s-1SV.\s0 +.Sp +.Vb 1 +\& void SvROK_off(SV* sv) +.Ve +.IP "SvROK_on" 8 +.IX Xref "SvROK_on" +.IX Item "SvROK_on" +Tells an \s-1SV\s0 that it is an \s-1RV.\s0 +.Sp +.Vb 1 +\& void SvROK_on(SV* sv) +.Ve +.IP "SvRV" 8 +.IX Xref "SvRV" +.IX Item "SvRV" +Dereferences an \s-1RV\s0 to return the \s-1SV.\s0 +.Sp +.Vb 1 +\& SV* SvRV(SV* sv) +.Ve +.IP "SvRV_set" 8 +.IX Xref "SvRV_set" +.IX Item "SvRV_set" +Set the value of the \s-1RV\s0 pointer in \f(CW\*(C`sv\*(C'\fR to val. See \f(CW"SvIV_set"\fR. +.Sp +.Vb 1 +\& void SvRV_set(SV* sv, SV* val) +.Ve +.IP "sv_rvunweaken" 8 +.IX Xref "sv_rvunweaken" +.IX Item "sv_rvunweaken" +Unweaken a reference: Clear the \f(CW\*(C`SvWEAKREF\*(C'\fR flag on this \s-1RV\s0; remove +the backreference to this \s-1RV\s0 from the array of backreferences +associated with the target \s-1SV,\s0 increment the refcount of the target. +Silently ignores \f(CW\*(C`undef\*(C'\fR and warns on non-weak references. +.Sp +.Vb 1 +\& SV* sv_rvunweaken(SV *const sv) +.Ve +.IP "sv_rvweaken" 8 +.IX Xref "sv_rvweaken" +.IX Item "sv_rvweaken" +Weaken a reference: set the \f(CW\*(C`SvWEAKREF\*(C'\fR flag on this \s-1RV\s0; give the +referred-to \s-1SV\s0 \f(CW\*(C`PERL_MAGIC_backref\*(C'\fR magic if it hasn't already; and +push a back-reference to this \s-1RV\s0 onto the array of backreferences +associated with that magic. If the \s-1RV\s0 is magical, set magic will be +called after the \s-1RV\s0 is cleared. Silently ignores \f(CW\*(C`undef\*(C'\fR and warns +on already-weak references. +.Sp +.Vb 1 +\& SV* sv_rvweaken(SV *const sv) +.Ve +.IP "sv_setiv" 8 +.IX Xref "sv_setiv" +.IX Item "sv_setiv" +Copies an integer into the given \s-1SV,\s0 upgrading first if necessary. +Does not handle 'set' magic. See also \f(CW"sv_setiv_mg"\fR. +.Sp +.Vb 1 +\& void sv_setiv(SV *const sv, const IV num) +.Ve +.IP "sv_setiv_mg" 8 +.IX Xref "sv_setiv_mg" +.IX Item "sv_setiv_mg" +Like \f(CW\*(C`sv_setiv\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 1 +\& void sv_setiv_mg(SV *const sv, const IV i) +.Ve +.IP "sv_setnv" 8 +.IX Xref "sv_setnv" +.IX Item "sv_setnv" +Copies a double into the given \s-1SV,\s0 upgrading first if necessary. +Does not handle 'set' magic. See also \f(CW"sv_setnv_mg"\fR. +.Sp +.Vb 1 +\& void sv_setnv(SV *const sv, const NV num) +.Ve +.IP "sv_setnv_mg" 8 +.IX Xref "sv_setnv_mg" +.IX Item "sv_setnv_mg" +Like \f(CW\*(C`sv_setnv\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 1 +\& void sv_setnv_mg(SV *const sv, const NV num) +.Ve +.IP "sv_setpv" 8 +.IX Xref "sv_setpv" +.IX Item "sv_setpv" +Copies a string into an \s-1SV.\s0 The string must be terminated with a \f(CW\*(C`NUL\*(C'\fR +character, and not contain embeded \f(CW\*(C`NUL\*(C'\fR's. +Does not handle 'set' magic. See \f(CW"sv_setpv_mg"\fR. +.Sp +.Vb 1 +\& void sv_setpv(SV *const sv, const char *const ptr) +.Ve +.IP "sv_setpvf" 8 +.IX Xref "sv_setpvf" +.IX Item "sv_setpvf" +Works like \f(CW\*(C`sv_catpvf\*(C'\fR but copies the text into the \s-1SV\s0 instead of +appending it. Does not handle 'set' magic. See \f(CW"sv_setpvf_mg"\fR. +.Sp +.Vb 2 +\& void sv_setpvf(SV *const sv, const char *const pat, +\& ...) +.Ve +.IP "sv_setpvf_mg" 8 +.IX Xref "sv_setpvf_mg" +.IX Item "sv_setpvf_mg" +Like \f(CW\*(C`sv_setpvf\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 2 +\& void sv_setpvf_mg(SV *const sv, +\& const char *const pat, ...) +.Ve +.IP "sv_setpviv" 8 +.IX Xref "sv_setpviv" +.IX Item "sv_setpviv" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Copies an integer into the given \s-1SV,\s0 also updating its string value. +Does not handle 'set' magic. See \f(CW"sv_setpviv_mg"\fR. +.Sp +.Vb 1 +\& void sv_setpviv(SV *const sv, const IV num) +.Ve +.IP "sv_setpviv_mg" 8 +.IX Xref "sv_setpviv_mg" +.IX Item "sv_setpviv_mg" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Like \f(CW\*(C`sv_setpviv\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 1 +\& void sv_setpviv_mg(SV *const sv, const IV iv) +.Ve +.IP "sv_setpvn" 8 +.IX Xref "sv_setpvn" +.IX Item "sv_setpvn" +Copies a string (possibly containing embedded \f(CW\*(C`NUL\*(C'\fR characters) into an \s-1SV.\s0 +The \f(CW\*(C`len\*(C'\fR parameter indicates the number of +bytes to be copied. If the \f(CW\*(C`ptr\*(C'\fR argument is \s-1NULL\s0 the \s-1SV\s0 will become +undefined. Does not handle 'set' magic. See \f(CW"sv_setpvn_mg"\fR. +.Sp +The \s-1UTF\-8\s0 flag is not changed by this function. A terminating \s-1NUL\s0 byte is +guaranteed. +.Sp +.Vb 2 +\& void sv_setpvn(SV *const sv, const char *const ptr, +\& const STRLEN len) +.Ve +.IP "sv_setpvn_mg" 8 +.IX Xref "sv_setpvn_mg" +.IX Item "sv_setpvn_mg" +Like \f(CW\*(C`sv_setpvn\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 3 +\& void sv_setpvn_mg(SV *const sv, +\& const char *const ptr, +\& const STRLEN len) +.Ve +.IP "sv_setpvs" 8 +.IX Xref "sv_setpvs" +.IX Item "sv_setpvs" +Like \f(CW\*(C`sv_setpvn\*(C'\fR, but takes a literal string instead of a +string/length pair. +.Sp +.Vb 1 +\& void sv_setpvs(SV* sv, "literal string") +.Ve +.IP "sv_setpvs_mg" 8 +.IX Xref "sv_setpvs_mg" +.IX Item "sv_setpvs_mg" +Like \f(CW\*(C`sv_setpvn_mg\*(C'\fR, but takes a literal string instead of a +string/length pair. +.Sp +.Vb 1 +\& void sv_setpvs_mg(SV* sv, "literal string") +.Ve +.IP "sv_setpv_bufsize" 8 +.IX Xref "sv_setpv_bufsize" +.IX Item "sv_setpv_bufsize" +Sets the \s-1SV\s0 to be a string of cur bytes length, with at least +len bytes available. Ensures that there is a null byte at SvEND. +Returns a char * pointer to the SvPV buffer. +.Sp +.Vb 2 +\& char * sv_setpv_bufsize(SV *const sv, const STRLEN cur, +\& const STRLEN len) +.Ve +.IP "sv_setpv_mg" 8 +.IX Xref "sv_setpv_mg" +.IX Item "sv_setpv_mg" +Like \f(CW\*(C`sv_setpv\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 1 +\& void sv_setpv_mg(SV *const sv, const char *const ptr) +.Ve +.IP "sv_setref_iv" 8 +.IX Xref "sv_setref_iv" +.IX Item "sv_setref_iv" +Copies an integer into a new \s-1SV,\s0 optionally blessing the \s-1SV.\s0 The \f(CW\*(C`rv\*(C'\fR +argument will be upgraded to an \s-1RV.\s0 That \s-1RV\s0 will be modified to point to +the new \s-1SV.\s0 The \f(CW\*(C`classname\*(C'\fR argument indicates the package for the +blessing. Set \f(CW\*(C`classname\*(C'\fR to \f(CW\*(C`NULL\*(C'\fR to avoid the blessing. The new \s-1SV\s0 +will have a reference count of 1, and the \s-1RV\s0 will be returned. +.Sp +.Vb 3 +\& SV* sv_setref_iv(SV *const rv, +\& const char *const classname, +\& const IV iv) +.Ve +.IP "sv_setref_nv" 8 +.IX Xref "sv_setref_nv" +.IX Item "sv_setref_nv" +Copies a double into a new \s-1SV,\s0 optionally blessing the \s-1SV.\s0 The \f(CW\*(C`rv\*(C'\fR +argument will be upgraded to an \s-1RV.\s0 That \s-1RV\s0 will be modified to point to +the new \s-1SV.\s0 The \f(CW\*(C`classname\*(C'\fR argument indicates the package for the +blessing. Set \f(CW\*(C`classname\*(C'\fR to \f(CW\*(C`NULL\*(C'\fR to avoid the blessing. The new \s-1SV\s0 +will have a reference count of 1, and the \s-1RV\s0 will be returned. +.Sp +.Vb 3 +\& SV* sv_setref_nv(SV *const rv, +\& const char *const classname, +\& const NV nv) +.Ve +.IP "sv_setref_pv" 8 +.IX Xref "sv_setref_pv" +.IX Item "sv_setref_pv" +Copies a pointer into a new \s-1SV,\s0 optionally blessing the \s-1SV.\s0 The \f(CW\*(C`rv\*(C'\fR +argument will be upgraded to an \s-1RV.\s0 That \s-1RV\s0 will be modified to point to +the new \s-1SV.\s0 If the \f(CW\*(C`pv\*(C'\fR argument is \f(CW\*(C`NULL\*(C'\fR, then \f(CW\*(C`PL_sv_undef\*(C'\fR will be placed +into the \s-1SV.\s0 The \f(CW\*(C`classname\*(C'\fR argument indicates the package for the +blessing. Set \f(CW\*(C`classname\*(C'\fR to \f(CW\*(C`NULL\*(C'\fR to avoid the blessing. The new \s-1SV\s0 +will have a reference count of 1, and the \s-1RV\s0 will be returned. +.Sp +Do not use with other Perl types such as \s-1HV, AV, SV, CV,\s0 because those +objects will become corrupted by the pointer copy process. +.Sp +Note that \f(CW\*(C`sv_setref_pvn\*(C'\fR copies the string while this copies the pointer. +.Sp +.Vb 3 +\& SV* sv_setref_pv(SV *const rv, +\& const char *const classname, +\& void *const pv) +.Ve +.IP "sv_setref_pvn" 8 +.IX Xref "sv_setref_pvn" +.IX Item "sv_setref_pvn" +Copies a string into a new \s-1SV,\s0 optionally blessing the \s-1SV.\s0 The length of the +string must be specified with \f(CW\*(C`n\*(C'\fR. The \f(CW\*(C`rv\*(C'\fR argument will be upgraded to +an \s-1RV.\s0 That \s-1RV\s0 will be modified to point to the new \s-1SV.\s0 The \f(CW\*(C`classname\*(C'\fR +argument indicates the package for the blessing. Set \f(CW\*(C`classname\*(C'\fR to +\&\f(CW\*(C`NULL\*(C'\fR to avoid the blessing. The new \s-1SV\s0 will have a reference count +of 1, and the \s-1RV\s0 will be returned. +.Sp +Note that \f(CW\*(C`sv_setref_pv\*(C'\fR copies the pointer while this copies the string. +.Sp +.Vb 4 +\& SV* sv_setref_pvn(SV *const rv, +\& const char *const classname, +\& const char *const pv, +\& const STRLEN n) +.Ve +.IP "sv_setref_pvs" 8 +.IX Xref "sv_setref_pvs" +.IX Item "sv_setref_pvs" +Like \f(CW\*(C`sv_setref_pvn\*(C'\fR, but takes a literal string instead of +a string/length pair. +.Sp +.Vb 3 +\& SV * sv_setref_pvs(SV *const rv, +\& const char *const classname, +\& "literal string") +.Ve +.IP "sv_setref_uv" 8 +.IX Xref "sv_setref_uv" +.IX Item "sv_setref_uv" +Copies an unsigned integer into a new \s-1SV,\s0 optionally blessing the \s-1SV.\s0 The \f(CW\*(C`rv\*(C'\fR +argument will be upgraded to an \s-1RV.\s0 That \s-1RV\s0 will be modified to point to +the new \s-1SV.\s0 The \f(CW\*(C`classname\*(C'\fR argument indicates the package for the +blessing. Set \f(CW\*(C`classname\*(C'\fR to \f(CW\*(C`NULL\*(C'\fR to avoid the blessing. The new \s-1SV\s0 +will have a reference count of 1, and the \s-1RV\s0 will be returned. +.Sp +.Vb 3 +\& SV* sv_setref_uv(SV *const rv, +\& const char *const classname, +\& const UV uv) +.Ve +.IP "sv_setsv" 8 +.IX Xref "sv_setsv" +.IX Item "sv_setsv" +Copies the contents of the source \s-1SV\s0 \f(CW\*(C`ssv\*(C'\fR into the destination \s-1SV\s0 +\&\f(CW\*(C`dsv\*(C'\fR. The source \s-1SV\s0 may be destroyed if it is mortal, so don't use this +function if the source \s-1SV\s0 needs to be reused. Does not handle 'set' magic on +destination \s-1SV.\s0 Calls 'get' magic on source \s-1SV.\s0 Loosely speaking, it +performs a copy-by-value, obliterating any previous content of the +destination. +.Sp +You probably want to use one of the assortment of wrappers, such as +\&\f(CW\*(C`SvSetSV\*(C'\fR, \f(CW\*(C`SvSetSV_nosteal\*(C'\fR, \f(CW\*(C`SvSetMagicSV\*(C'\fR and +\&\f(CW\*(C`SvSetMagicSV_nosteal\*(C'\fR. +.Sp +.Vb 1 +\& void sv_setsv(SV *dstr, SV *sstr) +.Ve +.IP "sv_setsv_flags" 8 +.IX Xref "sv_setsv_flags" +.IX Item "sv_setsv_flags" +Copies the contents of the source \s-1SV\s0 \f(CW\*(C`ssv\*(C'\fR into the destination \s-1SV\s0 +\&\f(CW\*(C`dsv\*(C'\fR. The source \s-1SV\s0 may be destroyed if it is mortal, so don't use this +function if the source \s-1SV\s0 needs to be reused. Does not handle 'set' magic. +Loosely speaking, it performs a copy-by-value, obliterating any previous +content of the destination. +If the \f(CW\*(C`flags\*(C'\fR parameter has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, will \f(CW\*(C`mg_get\*(C'\fR on +\&\f(CW\*(C`ssv\*(C'\fR if appropriate, else not. If the \f(CW\*(C`flags\*(C'\fR +parameter has the \f(CW\*(C`SV_NOSTEAL\*(C'\fR bit set then the +buffers of temps will not be stolen. \f(CW\*(C`sv_setsv\*(C'\fR +and \f(CW\*(C`sv_setsv_nomg\*(C'\fR are implemented in terms of this function. +.Sp +You probably want to use one of the assortment of wrappers, such as +\&\f(CW\*(C`SvSetSV\*(C'\fR, \f(CW\*(C`SvSetSV_nosteal\*(C'\fR, \f(CW\*(C`SvSetMagicSV\*(C'\fR and +\&\f(CW\*(C`SvSetMagicSV_nosteal\*(C'\fR. +.Sp +This is the primary function for copying scalars, and most other +copy-ish functions and macros use this underneath. +.Sp +.Vb 2 +\& void sv_setsv_flags(SV *dstr, SV *sstr, +\& const I32 flags) +.Ve +.IP "sv_setsv_mg" 8 +.IX Xref "sv_setsv_mg" +.IX Item "sv_setsv_mg" +Like \f(CW\*(C`sv_setsv\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 1 +\& void sv_setsv_mg(SV *const dstr, SV *const sstr) +.Ve +.IP "sv_setsv_nomg" 8 +.IX Xref "sv_setsv_nomg" +.IX Item "sv_setsv_nomg" +Like \f(CW\*(C`sv_setsv\*(C'\fR but doesn't process magic. +.Sp +.Vb 1 +\& void sv_setsv_nomg(SV* dsv, SV* ssv) +.Ve +.IP "sv_setuv" 8 +.IX Xref "sv_setuv" +.IX Item "sv_setuv" +Copies an unsigned integer into the given \s-1SV,\s0 upgrading first if necessary. +Does not handle 'set' magic. See also \f(CW"sv_setuv_mg"\fR. +.Sp +.Vb 1 +\& void sv_setuv(SV *const sv, const UV num) +.Ve +.IP "sv_setuv_mg" 8 +.IX Xref "sv_setuv_mg" +.IX Item "sv_setuv_mg" +Like \f(CW\*(C`sv_setuv\*(C'\fR, but also handles 'set' magic. +.Sp +.Vb 1 +\& void sv_setuv_mg(SV *const sv, const UV u) +.Ve +.IP "sv_set_undef" 8 +.IX Xref "sv_set_undef" +.IX Item "sv_set_undef" +Equivalent to \f(CW\*(C`sv_setsv(sv, &PL_sv_undef)\*(C'\fR, but more efficient. +Doesn't handle set magic. +.Sp +The perl equivalent is \f(CW\*(C`$sv = undef;\*(C'\fR. Note that it doesn't free any string +buffer, unlike \f(CW\*(C`undef $sv\*(C'\fR. +.Sp +Introduced in perl 5.25.12. +.Sp +.Vb 1 +\& void sv_set_undef(SV *sv) +.Ve +.IP "SvSTASH" 8 +.IX Xref "SvSTASH" +.IX Item "SvSTASH" +Returns the stash of the \s-1SV.\s0 +.Sp +.Vb 1 +\& HV* SvSTASH(SV* sv) +.Ve +.IP "SvSTASH_set" 8 +.IX Xref "SvSTASH_set" +.IX Item "SvSTASH_set" +Set the value of the \s-1STASH\s0 pointer in \f(CW\*(C`sv\*(C'\fR to val. See \f(CW"SvIV_set"\fR. +.Sp +.Vb 1 +\& void SvSTASH_set(SV* sv, HV* val) +.Ve +.IP "SvTAINT" 8 +.IX Xref "SvTAINT" +.IX Item "SvTAINT" +Taints an \s-1SV\s0 if tainting is enabled, and if some input to the current +expression is tainted\*(--usually a variable, but possibly also implicit +inputs such as locale settings. \f(CW\*(C`SvTAINT\*(C'\fR propagates that taintedness to +the outputs of an expression in a pessimistic fashion; i.e., without paying +attention to precisely which outputs are influenced by which inputs. +.Sp +.Vb 1 +\& void SvTAINT(SV* sv) +.Ve +.IP "SvTAINTED" 8 +.IX Xref "SvTAINTED" +.IX Item "SvTAINTED" +Checks to see if an \s-1SV\s0 is tainted. Returns \s-1TRUE\s0 if it is, \s-1FALSE\s0 if +not. +.Sp +.Vb 1 +\& bool SvTAINTED(SV* sv) +.Ve +.IP "sv_tainted" 8 +.IX Xref "sv_tainted" +.IX Item "sv_tainted" +Test an \s-1SV\s0 for taintedness. Use \f(CW\*(C`SvTAINTED\*(C'\fR instead. +.Sp +.Vb 1 +\& bool sv_tainted(SV *const sv) +.Ve +.IP "SvTAINTED_off" 8 +.IX Xref "SvTAINTED_off" +.IX Item "SvTAINTED_off" +Untaints an \s-1SV.\s0 Be \fIvery\fR careful with this routine, as it short-circuits +some of Perl's fundamental security features. \s-1XS\s0 module authors should not +use this function unless they fully understand all the implications of +unconditionally untainting the value. Untainting should be done in the +standard perl fashion, via a carefully crafted regexp, rather than directly +untainting variables. +.Sp +.Vb 1 +\& void SvTAINTED_off(SV* sv) +.Ve +.IP "SvTAINTED_on" 8 +.IX Xref "SvTAINTED_on" +.IX Item "SvTAINTED_on" +Marks an \s-1SV\s0 as tainted if tainting is enabled. +.Sp +.Vb 1 +\& void SvTAINTED_on(SV* sv) +.Ve +.IP "SvTRUE" 8 +.IX Xref "SvTRUE" +.IX Item "SvTRUE" +Returns a boolean indicating whether Perl would evaluate the \s-1SV\s0 as true or +false. See \f(CW"SvOK"\fR for a defined/undefined test. Handles 'get' magic +unless the scalar is already \f(CW\*(C`SvPOK\*(C'\fR, \f(CW\*(C`SvIOK\*(C'\fR or \f(CW\*(C`SvNOK\*(C'\fR (the public, not the +private flags). +.Sp +See \f(CW"SvTRUEx"\fR for a version which guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once. +.Sp +.Vb 1 +\& bool SvTRUE(SV* sv) +.Ve +.IP "sv_true" 8 +.IX Xref "sv_true" +.IX Item "sv_true" +Returns true if the \s-1SV\s0 has a true value by Perl's rules. +Use the \f(CW\*(C`SvTRUE\*(C'\fR macro instead, which may call \f(CW\*(C`sv_true()\*(C'\fR or may +instead use an in-line version. +.Sp +.Vb 1 +\& I32 sv_true(SV *const sv) +.Ve +.IP "SvTRUE_nomg" 8 +.IX Xref "SvTRUE_nomg" +.IX Item "SvTRUE_nomg" +Returns a boolean indicating whether Perl would evaluate the \s-1SV\s0 as true or +false. See \f(CW"SvOK"\fR for a defined/undefined test. Does not handle 'get' magic. +.Sp +.Vb 1 +\& bool SvTRUE_nomg(SV* sv) +.Ve +.IP "SvTRUEx" 8 +.IX Xref "SvTRUEx" +.IX Item "SvTRUEx" +Returns a boolean indicating whether Perl would evaluate the \s-1SV\s0 as true or +false. See \f(CW"SvOK"\fR for a defined/undefined test. Handles 'get' magic +unless the scalar is already \f(CW\*(C`SvPOK\*(C'\fR, \f(CW\*(C`SvIOK\*(C'\fR or \f(CW\*(C`SvNOK\*(C'\fR (the public, not the +private flags). +.Sp +This form guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once. Only use this if \f(CW\*(C`sv\*(C'\fR is an +expression with side effects, otherwise use the more efficient \f(CW\*(C`SvTRUE\*(C'\fR. +.Sp +.Vb 1 +\& bool SvTRUEx(SV* sv) +.Ve +.IP "SvTYPE" 8 +.IX Xref "SvTYPE" +.IX Item "SvTYPE" +Returns the type of the \s-1SV.\s0 See \f(CW"svtype"\fR. +.Sp +.Vb 1 +\& svtype SvTYPE(SV* sv) +.Ve +.IP "sv_unmagic" 8 +.IX Xref "sv_unmagic" +.IX Item "sv_unmagic" +Removes all magic of type \f(CW\*(C`type\*(C'\fR from an \s-1SV.\s0 +.Sp +.Vb 1 +\& int sv_unmagic(SV *const sv, const int type) +.Ve +.IP "sv_unmagicext" 8 +.IX Xref "sv_unmagicext" +.IX Item "sv_unmagicext" +Removes all magic of type \f(CW\*(C`type\*(C'\fR with the specified \f(CW\*(C`vtbl\*(C'\fR from an \s-1SV.\s0 +.Sp +.Vb 2 +\& int sv_unmagicext(SV *const sv, const int type, +\& MGVTBL *vtbl) +.Ve +.IP "sv_unref_flags" 8 +.IX Xref "sv_unref_flags" +.IX Item "sv_unref_flags" +Unsets the \s-1RV\s0 status of the \s-1SV,\s0 and decrements the reference count of +whatever was being referenced by the \s-1RV.\s0 This can almost be thought of +as a reversal of \f(CW\*(C`newSVrv\*(C'\fR. The \f(CW\*(C`cflags\*(C'\fR argument can contain +\&\f(CW\*(C`SV_IMMEDIATE_UNREF\*(C'\fR to force the reference count to be decremented +(otherwise the decrementing is conditional on the reference count being +different from one or the reference being a readonly \s-1SV\s0). +See \f(CW"SvROK_off"\fR. +.Sp +.Vb 1 +\& void sv_unref_flags(SV *const ref, const U32 flags) +.Ve +.IP "sv_untaint" 8 +.IX Xref "sv_untaint" +.IX Item "sv_untaint" +Untaint an \s-1SV.\s0 Use \f(CW\*(C`SvTAINTED_off\*(C'\fR instead. +.Sp +.Vb 1 +\& void sv_untaint(SV *const sv) +.Ve +.IP "SvUOK" 8 +.IX Xref "SvUOK" +.IX Item "SvUOK" +Returns a boolean indicating whether the \s-1SV\s0 contains an integer that must be +interpreted as unsigned. A non-negative integer whose value is within the +range of both an \s-1IV\s0 and a \s-1UV\s0 may be flagged as either \f(CW\*(C`SvUOK\*(C'\fR or \f(CW\*(C`SvIOK\*(C'\fR. +.Sp +.Vb 1 +\& bool SvUOK(SV* sv) +.Ve +.IP "SvUPGRADE" 8 +.IX Xref "SvUPGRADE" +.IX Item "SvUPGRADE" +Used to upgrade an \s-1SV\s0 to a more complex form. Uses \f(CW\*(C`sv_upgrade\*(C'\fR to +perform the upgrade if necessary. See \f(CW"svtype"\fR. +.Sp +.Vb 1 +\& void SvUPGRADE(SV* sv, svtype type) +.Ve +.IP "sv_upgrade" 8 +.IX Xref "sv_upgrade" +.IX Item "sv_upgrade" +Upgrade an \s-1SV\s0 to a more complex form. Generally adds a new body type to the +\&\s-1SV,\s0 then copies across as much information as possible from the old body. +It croaks if the \s-1SV\s0 is already in a more complex form than requested. You +generally want to use the \f(CW\*(C`SvUPGRADE\*(C'\fR macro wrapper, which checks the type +before calling \f(CW\*(C`sv_upgrade\*(C'\fR, and hence does not croak. See also +\&\f(CW"svtype"\fR. +.Sp +.Vb 1 +\& void sv_upgrade(SV *const sv, svtype new_type) +.Ve +.IP "sv_usepvn_flags" 8 +.IX Xref "sv_usepvn_flags" +.IX Item "sv_usepvn_flags" +Tells an \s-1SV\s0 to use \f(CW\*(C`ptr\*(C'\fR to find its string value. Normally the +string is stored inside the \s-1SV,\s0 but sv_usepvn allows the \s-1SV\s0 to use an +outside string. \f(CW\*(C`ptr\*(C'\fR should point to memory that was allocated +by \f(CW\*(C`Newx\*(C'\fR. It must be +the start of a \f(CW\*(C`Newx\*(C'\fR\-ed block of memory, and not a pointer to the +middle of it (beware of \f(CW\*(C`OOK\*(C'\fR and copy-on-write), +and not be from a non\-\f(CW\*(C`Newx\*(C'\fR memory allocator like \f(CW\*(C`malloc\*(C'\fR. The +string length, \f(CW\*(C`len\*(C'\fR, must be supplied. By default this function +will \f(CW\*(C`Renew\*(C'\fR (i.e. realloc, move) the memory pointed to by \f(CW\*(C`ptr\*(C'\fR, +so that pointer should not be freed or used by the programmer after +giving it to \f(CW\*(C`sv_usepvn\*(C'\fR, and neither should any pointers from \*(L"behind\*(R" +that pointer (e.g. ptr + 1) be used. +.Sp +If \f(CW\*(C`flags\ &\ SV_SMAGIC\*(C'\fR is true, will call \f(CW\*(C`SvSETMAGIC\*(C'\fR. If +\&\f(CW\*(C`flags\ &\ SV_HAS_TRAILING_NUL\*(C'\fR is true, then \f(CW\*(C`ptr[len]\*(C'\fR must be \f(CW\*(C`NUL\*(C'\fR, +and the realloc +will be skipped (i.e. the buffer is actually at least 1 byte longer than +\&\f(CW\*(C`len\*(C'\fR, and already meets the requirements for storing in \f(CW\*(C`SvPVX\*(C'\fR). +.Sp +.Vb 3 +\& void sv_usepvn_flags(SV *const sv, char* ptr, +\& const STRLEN len, +\& const U32 flags) +.Ve +.IP "SvUTF8" 8 +.IX Xref "SvUTF8" +.IX Item "SvUTF8" +Returns a U32 value indicating the \s-1UTF\-8\s0 status of an \s-1SV.\s0 If things are set-up +properly, this indicates whether or not the \s-1SV\s0 contains \s-1UTF\-8\s0 encoded data. +You should use this \fIafter\fR a call to \f(CW\*(C`SvPV()\*(C'\fR or one of its variants, in +case any call to string overloading updates the internal flag. +.Sp +If you want to take into account the bytes pragma, use \f(CW"DO_UTF8"\fR +instead. +.Sp +.Vb 1 +\& U32 SvUTF8(SV* sv) +.Ve +.IP "sv_utf8_decode" 8 +.IX Xref "sv_utf8_decode" +.IX Item "sv_utf8_decode" +If the \s-1PV\s0 of the \s-1SV\s0 is an octet sequence in Perl's extended \s-1UTF\-8\s0 +and contains a multiple-byte character, the \f(CW\*(C`SvUTF8\*(C'\fR flag is turned on +so that it looks like a character. If the \s-1PV\s0 contains only single-byte +characters, the \f(CW\*(C`SvUTF8\*(C'\fR flag stays off. +Scans \s-1PV\s0 for validity and returns \s-1FALSE\s0 if the \s-1PV\s0 is invalid \s-1UTF\-8.\s0 +.Sp +.Vb 1 +\& bool sv_utf8_decode(SV *const sv) +.Ve +.IP "sv_utf8_downgrade" 8 +.IX Xref "sv_utf8_downgrade" +.IX Item "sv_utf8_downgrade" +Attempts to convert the \s-1PV\s0 of an \s-1SV\s0 from characters to bytes. +If the \s-1PV\s0 contains a character that cannot fit +in a byte, this conversion will fail; +in this case, either returns false or, if \f(CW\*(C`fail_ok\*(C'\fR is not +true, croaks. +.Sp +This is not a general purpose Unicode to byte encoding interface: +use the \f(CW\*(C`Encode\*(C'\fR extension for that. +.Sp +This function process get magic on \f(CW\*(C`sv\*(C'\fR. +.Sp +.Vb 2 +\& bool sv_utf8_downgrade(SV *const sv, +\& const bool fail_ok) +.Ve +.IP "sv_utf8_downgrade_flags" 8 +.IX Xref "sv_utf8_downgrade_flags" +.IX Item "sv_utf8_downgrade_flags" +Like \f(CW\*(C`sv_utf8_downgrade\*(C'\fR, but with additional \f(CW\*(C`flags\*(C'\fR. +If \f(CW\*(C`flags\*(C'\fR has \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, processes get magic on \f(CW\*(C`sv\*(C'\fR. +.Sp +.Vb 3 +\& bool sv_utf8_downgrade_flags(SV *const sv, +\& const bool fail_ok, +\& const U32 flags) +.Ve +.IP "sv_utf8_downgrade_nomg" 8 +.IX Xref "sv_utf8_downgrade_nomg" +.IX Item "sv_utf8_downgrade_nomg" +Like \f(CW\*(C`sv_utf8_downgrade\*(C'\fR, but does not process get magic on \f(CW\*(C`sv\*(C'\fR. +.Sp +.Vb 2 +\& bool sv_utf8_downgrade_nomg(SV *const sv, +\& const bool fail_ok) +.Ve +.IP "sv_utf8_encode" 8 +.IX Xref "sv_utf8_encode" +.IX Item "sv_utf8_encode" +Converts the \s-1PV\s0 of an \s-1SV\s0 to \s-1UTF\-8,\s0 but then turns the \f(CW\*(C`SvUTF8\*(C'\fR +flag off so that it looks like octets again. +.Sp +.Vb 1 +\& void sv_utf8_encode(SV *const sv) +.Ve +.IP "sv_utf8_upgrade" 8 +.IX Xref "sv_utf8_upgrade" +.IX Item "sv_utf8_upgrade" +Converts the \s-1PV\s0 of an \s-1SV\s0 to its UTF\-8\-encoded form. +Forces the \s-1SV\s0 to string form if it is not already. +Will \f(CW\*(C`mg_get\*(C'\fR on \f(CW\*(C`sv\*(C'\fR if appropriate. +Always sets the \f(CW\*(C`SvUTF8\*(C'\fR flag to avoid future validity checks even +if the whole string is the same in \s-1UTF\-8\s0 as not. +Returns the number of bytes in the converted string +.Sp +This is not a general purpose byte encoding to Unicode interface: +use the Encode extension for that. +.Sp +.Vb 1 +\& STRLEN sv_utf8_upgrade(SV *sv) +.Ve +.IP "sv_utf8_upgrade_flags" 8 +.IX Xref "sv_utf8_upgrade_flags" +.IX Item "sv_utf8_upgrade_flags" +Converts the \s-1PV\s0 of an \s-1SV\s0 to its UTF\-8\-encoded form. +Forces the \s-1SV\s0 to string form if it is not already. +Always sets the SvUTF8 flag to avoid future validity checks even +if all the bytes are invariant in \s-1UTF\-8.\s0 +If \f(CW\*(C`flags\*(C'\fR has \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, +will \f(CW\*(C`mg_get\*(C'\fR on \f(CW\*(C`sv\*(C'\fR if appropriate, else not. +.Sp +The \f(CW\*(C`SV_FORCE_UTF8_UPGRADE\*(C'\fR flag is now ignored. +.Sp +Returns the number of bytes in the converted string. +.Sp +This is not a general purpose byte encoding to Unicode interface: +use the Encode extension for that. +.Sp +.Vb 2 +\& STRLEN sv_utf8_upgrade_flags(SV *const sv, +\& const I32 flags) +.Ve +.IP "sv_utf8_upgrade_flags_grow" 8 +.IX Xref "sv_utf8_upgrade_flags_grow" +.IX Item "sv_utf8_upgrade_flags_grow" +Like \f(CW\*(C`sv_utf8_upgrade_flags\*(C'\fR, but has an additional parameter \f(CW\*(C`extra\*(C'\fR, which is +the number of unused bytes the string of \f(CW\*(C`sv\*(C'\fR is guaranteed to have free after +it upon return. This allows the caller to reserve extra space that it intends +to fill, to avoid extra grows. +.Sp +\&\f(CW\*(C`sv_utf8_upgrade\*(C'\fR, \f(CW\*(C`sv_utf8_upgrade_nomg\*(C'\fR, and \f(CW\*(C`sv_utf8_upgrade_flags\*(C'\fR +are implemented in terms of this function. +.Sp +Returns the number of bytes in the converted string (not including the spares). +.Sp +.Vb 3 +\& STRLEN sv_utf8_upgrade_flags_grow(SV *const sv, +\& const I32 flags, +\& STRLEN extra) +.Ve +.IP "sv_utf8_upgrade_nomg" 8 +.IX Xref "sv_utf8_upgrade_nomg" +.IX Item "sv_utf8_upgrade_nomg" +Like \f(CW\*(C`sv_utf8_upgrade\*(C'\fR, but doesn't do magic on \f(CW\*(C`sv\*(C'\fR. +.Sp +.Vb 1 +\& STRLEN sv_utf8_upgrade_nomg(SV *sv) +.Ve +.IP "SvUTF8_off" 8 +.IX Xref "SvUTF8_off" +.IX Item "SvUTF8_off" +Unsets the \s-1UTF\-8\s0 status of an \s-1SV\s0 (the data is not changed, just the flag). +Do not use frivolously. +.Sp +.Vb 1 +\& void SvUTF8_off(SV *sv) +.Ve +.IP "SvUTF8_on" 8 +.IX Xref "SvUTF8_on" +.IX Item "SvUTF8_on" +Turn on the \s-1UTF\-8\s0 status of an \s-1SV\s0 (the data is not changed, just the flag). +Do not use frivolously. +.Sp +.Vb 1 +\& void SvUTF8_on(SV *sv) +.Ve +.IP "SvUV" 8 +.IX Xref "SvUV" +.IX Item "SvUV" +Coerces the given \s-1SV\s0 to \s-1UV\s0 and returns it. The returned value in many +circumstances will get stored in \f(CW\*(C`sv\*(C'\fR's \s-1UV\s0 slot, but not in all cases. (Use +\&\f(CW"sv_setuv"\fR to make sure it does). +.Sp +See \f(CW"SvUVx"\fR for a version which guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once. +.Sp +.Vb 1 +\& UV SvUV(SV* sv) +.Ve +.IP "SvUV_nomg" 8 +.IX Xref "SvUV_nomg" +.IX Item "SvUV_nomg" +Like \f(CW\*(C`SvUV\*(C'\fR but doesn't process magic. +.Sp +.Vb 1 +\& UV SvUV_nomg(SV* sv) +.Ve +.IP "SvUV_set" 8 +.IX Xref "SvUV_set" +.IX Item "SvUV_set" +Set the value of the \s-1UV\s0 pointer in \f(CW\*(C`sv\*(C'\fR to val. See \f(CW"SvIV_set"\fR. +.Sp +.Vb 1 +\& void SvUV_set(SV* sv, UV val) +.Ve +.IP "SvUVX" 8 +.IX Xref "SvUVX" +.IX Item "SvUVX" +Returns the raw value in the \s-1SV\s0's \s-1UV\s0 slot, without checks or conversions. +Only use when you are sure \f(CW\*(C`SvIOK\*(C'\fR is true. See also \f(CW"SvUV"\fR. +.Sp +.Vb 1 +\& UV SvUVX(SV* sv) +.Ve +.IP "SvUVx" 8 +.IX Xref "SvUVx" +.IX Item "SvUVx" +Coerces the given \s-1SV\s0 to \s-1UV\s0 and returns it. The returned value in many +circumstances will get stored in \f(CW\*(C`sv\*(C'\fR's \s-1UV\s0 slot, but not in all cases. (Use +\&\f(CW"sv_setuv"\fR to make sure it does). +.Sp +This form guarantees to evaluate \f(CW\*(C`sv\*(C'\fR only once. Only use this if \f(CW\*(C`sv\*(C'\fR is an +expression with side effects, otherwise use the more efficient \f(CW\*(C`SvUV\*(C'\fR. +.Sp +.Vb 1 +\& UV SvUVx(SV* sv) +.Ve +.IP "SvUVXx" 8 +.IX Xref "SvUVXx" +.IX Item "SvUVXx" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +This is an unnecessary synonym for \*(L"SvUVX\*(R" +.Sp +.Vb 1 +\& UV SvUVXx(SV* sv) +.Ve +.IP "sv_vcatpvf" 8 +.IX Xref "sv_vcatpvf" +.IX Item "sv_vcatpvf" +Processes its arguments like \f(CW\*(C`sv_vcatpvfn\*(C'\fR called with a non-null C\-style +variable argument list, and appends the formatted output +to an \s-1SV.\s0 Does not handle 'set' magic. See \f(CW"sv_vcatpvf_mg"\fR. +.Sp +Usually used via its frontend \f(CW\*(C`sv_catpvf\*(C'\fR. +.Sp +.Vb 2 +\& void sv_vcatpvf(SV *const sv, const char *const pat, +\& va_list *const args) +.Ve +.IP "sv_vcatpvfn" 8 +.IX Xref "sv_vcatpvfn" +.IX Item "sv_vcatpvfn" +.Vb 6 +\& void sv_vcatpvfn(SV *const sv, const char *const pat, +\& const STRLEN patlen, +\& va_list *const args, +\& SV **const svargs, +\& const Size_t sv_count, +\& bool *const maybe_tainted) +.Ve +.IP "sv_vcatpvfn_flags" 8 +.IX Xref "sv_vcatpvfn_flags" +.IX Item "sv_vcatpvfn_flags" +Processes its arguments like \f(CW\*(C`vsprintf\*(C'\fR and appends the formatted output +to an \s-1SV.\s0 Uses an array of SVs if the C\-style variable argument list is +missing (\f(CW\*(C`NULL\*(C'\fR). Argument reordering (using format specifiers like \f(CW\*(C`%2$d\*(C'\fR +or \f(CW\*(C`%*2$d\*(C'\fR) is supported only when using an array of SVs; using a C\-style +\&\f(CW\*(C`va_list\*(C'\fR argument list with a format string that uses argument reordering +will yield an exception. +.Sp +When running with taint checks enabled, indicates via +\&\f(CW\*(C`maybe_tainted\*(C'\fR if results are untrustworthy (often due to the use of +locales). +.Sp +If called as \f(CW\*(C`sv_vcatpvfn\*(C'\fR or flags has the \f(CW\*(C`SV_GMAGIC\*(C'\fR bit set, calls get magic. +.Sp +It assumes that pat has the same utf8\-ness as sv. It's the caller's +responsibility to ensure that this is so. +.Sp +Usually used via one of its frontends \f(CW\*(C`sv_vcatpvf\*(C'\fR and \f(CW\*(C`sv_vcatpvf_mg\*(C'\fR. +.Sp +.Vb 8 +\& void sv_vcatpvfn_flags(SV *const sv, +\& const char *const pat, +\& const STRLEN patlen, +\& va_list *const args, +\& SV **const svargs, +\& const Size_t sv_count, +\& bool *const maybe_tainted, +\& const U32 flags) +.Ve +.IP "sv_vcatpvf_mg" 8 +.IX Xref "sv_vcatpvf_mg" +.IX Item "sv_vcatpvf_mg" +Like \f(CW\*(C`sv_vcatpvf\*(C'\fR, but also handles 'set' magic. +.Sp +Usually used via its frontend \f(CW\*(C`sv_catpvf_mg\*(C'\fR. +.Sp +.Vb 3 +\& void sv_vcatpvf_mg(SV *const sv, +\& const char *const pat, +\& va_list *const args) +.Ve +.IP "SvVOK" 8 +.IX Xref "SvVOK" +.IX Item "SvVOK" +Returns a boolean indicating whether the \s-1SV\s0 contains a v\-string. +.Sp +.Vb 1 +\& bool SvVOK(SV* sv) +.Ve +.IP "sv_vsetpvf" 8 +.IX Xref "sv_vsetpvf" +.IX Item "sv_vsetpvf" +Works like \f(CW\*(C`sv_vcatpvf\*(C'\fR but copies the text into the \s-1SV\s0 instead of +appending it. Does not handle 'set' magic. See \f(CW"sv_vsetpvf_mg"\fR. +.Sp +Usually used via its frontend \f(CW\*(C`sv_setpvf\*(C'\fR. +.Sp +.Vb 2 +\& void sv_vsetpvf(SV *const sv, const char *const pat, +\& va_list *const args) +.Ve +.IP "sv_vsetpvfn" 8 +.IX Xref "sv_vsetpvfn" +.IX Item "sv_vsetpvfn" +Works like \f(CW\*(C`sv_vcatpvfn\*(C'\fR but copies the text into the \s-1SV\s0 instead of +appending it. +.Sp +Usually used via one of its frontends \f(CW\*(C`sv_vsetpvf\*(C'\fR and \f(CW\*(C`sv_vsetpvf_mg\*(C'\fR. +.Sp +.Vb 6 +\& void sv_vsetpvfn(SV *const sv, const char *const pat, +\& const STRLEN patlen, +\& va_list *const args, +\& SV **const svargs, +\& const Size_t sv_count, +\& bool *const maybe_tainted) +.Ve +.IP "sv_vsetpvf_mg" 8 +.IX Xref "sv_vsetpvf_mg" +.IX Item "sv_vsetpvf_mg" +Like \f(CW\*(C`sv_vsetpvf\*(C'\fR, but also handles 'set' magic. +.Sp +Usually used via its frontend \f(CW\*(C`sv_setpvf_mg\*(C'\fR. +.Sp +.Vb 3 +\& void sv_vsetpvf_mg(SV *const sv, +\& const char *const pat, +\& va_list *const args) +.Ve +.SH "Unicode Support" +.IX Header "Unicode Support" +\&\*(L"Unicode Support\*(R" in perlguts has an introduction to this \s-1API.\s0 +.PP +See also \*(L"Character classification\*(R", +and \*(L"Character case changing\*(R". +Various functions outside this section also work specially with Unicode. +Search for the string \*(L"utf8\*(R" in this document. +.IP "\s-1BOM_UTF8\s0" 8 +.IX Xref "BOM_UTF8" +.IX Item "BOM_UTF8" +This is a macro that evaluates to a string constant of the \s-1UTF\-8\s0 bytes that +define the Unicode \s-1BYTE ORDER MARK\s0 (U+FEFF) for the platform that perl +is compiled on. This allows code to use a mnemonic for this character that +works on both \s-1ASCII\s0 and \s-1EBCDIC\s0 platforms. +\&\f(CW\*(C`sizeof(BOM_UTF8)\ \-\ 1\*(C'\fR can be used to get its length in +bytes. +.IP "bytes_cmp_utf8" 8 +.IX Xref "bytes_cmp_utf8" +.IX Item "bytes_cmp_utf8" +Compares the sequence of characters (stored as octets) in \f(CW\*(C`b\*(C'\fR, \f(CW\*(C`blen\*(C'\fR with the +sequence of characters (stored as \s-1UTF\-8\s0) +in \f(CW\*(C`u\*(C'\fR, \f(CW\*(C`ulen\*(C'\fR. Returns 0 if they are +equal, \-1 or \-2 if the first string is less than the second string, +1 or +2 +if the first string is greater than the second string. +.Sp +\&\-1 or +1 is returned if the shorter string was identical to the start of the +longer string. \-2 or +2 is returned if +there was a difference between characters +within the strings. +.Sp +.Vb 2 +\& int bytes_cmp_utf8(const U8 *b, STRLEN blen, +\& const U8 *u, STRLEN ulen) +.Ve +.IP "bytes_from_utf8" 8 +.IX Xref "bytes_from_utf8" +.IX Item "bytes_from_utf8" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Converts a potentially \s-1UTF\-8\s0 encoded string \f(CW\*(C`s\*(C'\fR of length \f(CW*lenp\fR into native +byte encoding. On input, the boolean \f(CW*is_utf8p\fR gives whether or not \f(CW\*(C`s\*(C'\fR is +actually encoded in \s-1UTF\-8.\s0 +.Sp +Unlike \*(L"utf8_to_bytes\*(R" but like \*(L"bytes_to_utf8\*(R", this is non-destructive of +the input string. +.Sp +Do nothing if \f(CW*is_utf8p\fR is 0, or if there are code points in the string +not expressible in native byte encoding. In these cases, \f(CW*is_utf8p\fR and +\&\f(CW*lenp\fR are unchanged, and the return value is the original \f(CW\*(C`s\*(C'\fR. +.Sp +Otherwise, \f(CW*is_utf8p\fR is set to 0, and the return value is a pointer to a +newly created string containing a downgraded copy of \f(CW\*(C`s\*(C'\fR, and whose length is +returned in \f(CW*lenp\fR, updated. The new string is \f(CW\*(C`NUL\*(C'\fR\-terminated. The +caller is responsible for arranging for the memory used by this string to get +freed. +.Sp +Upon successful return, the number of variants in the string can be computed by +having saved the value of \f(CW*lenp\fR before the call, and subtracting the +after-call value of \f(CW*lenp\fR from it. +.Sp +.Vb 2 +\& U8* bytes_from_utf8(const U8 *s, STRLEN *lenp, +\& bool *is_utf8p) +.Ve +.IP "bytes_to_utf8" 8 +.IX Xref "bytes_to_utf8" +.IX Item "bytes_to_utf8" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Converts a string \f(CW\*(C`s\*(C'\fR of length \f(CW*lenp\fR bytes from the native encoding into +\&\s-1UTF\-8.\s0 +Returns a pointer to the newly-created string, and sets \f(CW*lenp\fR to +reflect the new length in bytes. The caller is responsible for arranging for +the memory used by this string to get freed. +.Sp +Upon successful return, the number of variants in the string can be computed by +having saved the value of \f(CW*lenp\fR before the call, and subtracting it from the +after-call value of \f(CW*lenp\fR. +.Sp +A \f(CW\*(C`NUL\*(C'\fR character will be written after the end of the string. +.Sp +If you want to convert to \s-1UTF\-8\s0 from encodings other than +the native (Latin1 or \s-1EBCDIC\s0), +see \*(L"sv_recode_to_utf8\*(R"(). +.Sp +.Vb 1 +\& U8* bytes_to_utf8(const U8 *s, STRLEN *lenp) +.Ve +.IP "\s-1DO_UTF8\s0" 8 +.IX Xref "DO_UTF8" +.IX Item "DO_UTF8" +Returns a bool giving whether or not the \s-1PV\s0 in \f(CW\*(C`sv\*(C'\fR is to be treated as being +encoded in \s-1UTF\-8.\s0 +.Sp +You should use this \fIafter\fR a call to \f(CW\*(C`SvPV()\*(C'\fR or one of its variants, in +case any call to string overloading updates the internal \s-1UTF\-8\s0 encoding flag. +.Sp +.Vb 1 +\& bool DO_UTF8(SV* sv) +.Ve +.IP "foldEQ_utf8" 8 +.IX Xref "foldEQ_utf8" +.IX Item "foldEQ_utf8" +Returns true if the leading portions of the strings \f(CW\*(C`s1\*(C'\fR and \f(CW\*(C`s2\*(C'\fR (either or +both of which may be in \s-1UTF\-8\s0) are the same case-insensitively; false +otherwise. How far into the strings to compare is determined by other input +parameters. +.Sp +If \f(CW\*(C`u1\*(C'\fR is true, the string \f(CW\*(C`s1\*(C'\fR is assumed to be in UTF\-8\-encoded Unicode; +otherwise it is assumed to be in native 8\-bit encoding. Correspondingly for +\&\f(CW\*(C`u2\*(C'\fR with respect to \f(CW\*(C`s2\*(C'\fR. +.Sp +If the byte length \f(CW\*(C`l1\*(C'\fR is non-zero, it says how far into \f(CW\*(C`s1\*(C'\fR to check for +fold equality. In other words, \f(CW\*(C`s1\*(C'\fR+\f(CW\*(C`l1\*(C'\fR will be used as a goal to reach. +The scan will not be considered to be a match unless the goal is reached, and +scanning won't continue past that goal. Correspondingly for \f(CW\*(C`l2\*(C'\fR with respect +to \f(CW\*(C`s2\*(C'\fR. +.Sp +If \f(CW\*(C`pe1\*(C'\fR is non\-\f(CW\*(C`NULL\*(C'\fR and the pointer it points to is not \f(CW\*(C`NULL\*(C'\fR, that +pointer is considered an end pointer to the position 1 byte past the maximum +point in \f(CW\*(C`s1\*(C'\fR beyond which scanning will not continue under any circumstances. +(This routine assumes that \s-1UTF\-8\s0 encoded input strings are not malformed; +malformed input can cause it to read past \f(CW\*(C`pe1\*(C'\fR). This means that if both +\&\f(CW\*(C`l1\*(C'\fR and \f(CW\*(C`pe1\*(C'\fR are specified, and \f(CW\*(C`pe1\*(C'\fR is less than \f(CW\*(C`s1\*(C'\fR+\f(CW\*(C`l1\*(C'\fR, the match +will never be successful because it can never +get as far as its goal (and in fact is asserted against). Correspondingly for +\&\f(CW\*(C`pe2\*(C'\fR with respect to \f(CW\*(C`s2\*(C'\fR. +.Sp +At least one of \f(CW\*(C`s1\*(C'\fR and \f(CW\*(C`s2\*(C'\fR must have a goal (at least one of \f(CW\*(C`l1\*(C'\fR and +\&\f(CW\*(C`l2\*(C'\fR must be non-zero), and if both do, both have to be +reached for a successful match. Also, if the fold of a character is multiple +characters, all of them must be matched (see tr21 reference below for +\&'folding'). +.Sp +Upon a successful match, if \f(CW\*(C`pe1\*(C'\fR is non\-\f(CW\*(C`NULL\*(C'\fR, +it will be set to point to the beginning of the \fInext\fR character of \f(CW\*(C`s1\*(C'\fR +beyond what was matched. Correspondingly for \f(CW\*(C`pe2\*(C'\fR and \f(CW\*(C`s2\*(C'\fR. +.Sp +For case-insensitiveness, the \*(L"casefolding\*(R" of Unicode is used +instead of upper/lowercasing both the characters, see + (Case Mappings). +.Sp +.Vb 3 +\& I32 foldEQ_utf8(const char *s1, char **pe1, UV l1, +\& bool u1, const char *s2, char **pe2, +\& UV l2, bool u2) +.Ve +.IP "is_ascii_string" 8 +.IX Xref "is_ascii_string" +.IX Item "is_ascii_string" +This is a misleadingly-named synonym for \*(L"is_utf8_invariant_string\*(R". +On ASCII-ish platforms, the name isn't misleading: the ASCII-range characters +are exactly the \s-1UTF\-8\s0 invariants. But \s-1EBCDIC\s0 machines have more invariants +than just the \s-1ASCII\s0 characters, so \f(CW\*(C`is_utf8_invariant_string\*(C'\fR is preferred. +.Sp +.Vb 1 +\& bool is_ascii_string(const U8* const s, STRLEN len) +.Ve +.IP "is_c9strict_utf8_string" 8 +.IX Xref "is_c9strict_utf8_string" +.IX Item "is_c9strict_utf8_string" +Returns \s-1TRUE\s0 if the first \f(CW\*(C`len\*(C'\fR bytes of string \f(CW\*(C`s\*(C'\fR form a valid +UTF\-8\-encoded string that conforms to +Unicode Corrigendum #9 ; +otherwise it returns \s-1FALSE.\s0 If \f(CW\*(C`len\*(C'\fR is 0, it will be calculated using +\&\f(CWstrlen(s)\fR (which means if you use this option, that \f(CW\*(C`s\*(C'\fR can't have embedded +\&\f(CW\*(C`NUL\*(C'\fR characters and has to have a terminating \f(CW\*(C`NUL\*(C'\fR byte). Note that all +characters being \s-1ASCII\s0 constitute 'a valid \s-1UTF\-8\s0 string'. +.Sp +This function returns \s-1FALSE\s0 for strings containing any code points above the +Unicode max of 0x10FFFF or surrogate code points, but accepts non-character +code points per +Corrigendum #9 . +.Sp +See also +\&\f(CW"is_utf8_invariant_string"\fR, +\&\f(CW"is_utf8_invariant_string_loc"\fR, +\&\f(CW"is_utf8_string"\fR, +\&\f(CW"is_utf8_string_flags"\fR, +\&\f(CW"is_utf8_string_loc"\fR, +\&\f(CW"is_utf8_string_loc_flags"\fR, +\&\f(CW"is_utf8_string_loclen"\fR, +\&\f(CW"is_utf8_string_loclen_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loc_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loclen_flags"\fR, +\&\f(CW"is_strict_utf8_string"\fR, +\&\f(CW"is_strict_utf8_string_loc"\fR, +\&\f(CW"is_strict_utf8_string_loclen"\fR, +\&\f(CW"is_c9strict_utf8_string_loc"\fR, +and +\&\f(CW"is_c9strict_utf8_string_loclen"\fR. +.Sp +.Vb 1 +\& bool is_c9strict_utf8_string(const U8 *s, STRLEN len) +.Ve +.IP "is_c9strict_utf8_string_loc" 8 +.IX Xref "is_c9strict_utf8_string_loc" +.IX Item "is_c9strict_utf8_string_loc" +Like \f(CW"is_c9strict_utf8_string"\fR but stores the location of the failure (in +the case of \*(L"utf8ness failure\*(R") or the location \f(CW\*(C`s\*(C'\fR+\f(CW\*(C`len\*(C'\fR (in the case of +\&\*(L"utf8ness success\*(R") in the \f(CW\*(C`ep\*(C'\fR pointer. +.Sp +See also \f(CW"is_c9strict_utf8_string_loclen"\fR. +.Sp +.Vb 3 +\& bool is_c9strict_utf8_string_loc(const U8 *s, +\& STRLEN len, +\& const U8 **ep) +.Ve +.IP "is_c9strict_utf8_string_loclen" 8 +.IX Xref "is_c9strict_utf8_string_loclen" +.IX Item "is_c9strict_utf8_string_loclen" +Like \f(CW"is_c9strict_utf8_string"\fR but stores the location of the failure (in +the case of \*(L"utf8ness failure\*(R") or the location \f(CW\*(C`s\*(C'\fR+\f(CW\*(C`len\*(C'\fR (in the case of +\&\*(L"utf8ness success\*(R") in the \f(CW\*(C`ep\*(C'\fR pointer, and the number of \s-1UTF\-8\s0 encoded +characters in the \f(CW\*(C`el\*(C'\fR pointer. +.Sp +See also \f(CW"is_c9strict_utf8_string_loc"\fR. +.Sp +.Vb 4 +\& bool is_c9strict_utf8_string_loclen(const U8 *s, +\& STRLEN len, +\& const U8 **ep, +\& STRLEN *el) +.Ve +.IP "isC9_STRICT_UTF8_CHAR" 8 +.IX Xref "isC9_STRICT_UTF8_CHAR" +.IX Item "isC9_STRICT_UTF8_CHAR" +Evaluates to non-zero if the first few bytes of the string starting at \f(CW\*(C`s\*(C'\fR and +looking no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR are well-formed \s-1UTF\-8\s0 that represents some +Unicode non-surrogate code point; otherwise it evaluates to 0. If non-zero, +the value gives how many bytes starting at \f(CW\*(C`s\*(C'\fR comprise the code point's +representation. Any bytes remaining before \f(CW\*(C`e\*(C'\fR, but beyond the ones needed to +form the first code point in \f(CW\*(C`s\*(C'\fR, are not examined. +.Sp +The largest acceptable code point is the Unicode maximum 0x10FFFF. This +differs from \f(CW"isSTRICT_UTF8_CHAR"\fR only in that it accepts non-character +code points. This corresponds to +Unicode Corrigendum #9 . +which said that non-character code points are merely discouraged rather than +completely forbidden in open interchange. See +\&\*(L"Noncharacter code points\*(R" in perlunicode. +.Sp +Use \f(CW"isUTF8_CHAR"\fR to check for Perl's extended \s-1UTF\-8\s0; and +\&\f(CW"isUTF8_CHAR_flags"\fR for a more customized definition. +.Sp +Use \f(CW"is_c9strict_utf8_string"\fR, \f(CW"is_c9strict_utf8_string_loc"\fR, and +\&\f(CW"is_c9strict_utf8_string_loclen"\fR to check entire strings. +.Sp +.Vb 2 +\& Size_t isC9_STRICT_UTF8_CHAR(const U8 * const s0, +\& const U8 * const e) +.Ve +.IP "is_invariant_string" 8 +.IX Xref "is_invariant_string" +.IX Item "is_invariant_string" +This is a somewhat misleadingly-named synonym for \*(L"is_utf8_invariant_string\*(R". +\&\f(CW\*(C`is_utf8_invariant_string\*(C'\fR is preferred, as it indicates under what conditions +the string is invariant. +.Sp +.Vb 2 +\& bool is_invariant_string(const U8* const s, +\& STRLEN len) +.Ve +.IP "isSTRICT_UTF8_CHAR" 8 +.IX Xref "isSTRICT_UTF8_CHAR" +.IX Item "isSTRICT_UTF8_CHAR" +Evaluates to non-zero if the first few bytes of the string starting at \f(CW\*(C`s\*(C'\fR and +looking no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR are well-formed \s-1UTF\-8\s0 that represents some +Unicode code point completely acceptable for open interchange between all +applications; otherwise it evaluates to 0. If non-zero, the value gives how +many bytes starting at \f(CW\*(C`s\*(C'\fR comprise the code point's representation. Any +bytes remaining before \f(CW\*(C`e\*(C'\fR, but beyond the ones needed to form the first code +point in \f(CW\*(C`s\*(C'\fR, are not examined. +.Sp +The largest acceptable code point is the Unicode maximum 0x10FFFF, and must not +be a surrogate nor a non-character code point. Thus this excludes any code +point from Perl's extended \s-1UTF\-8.\s0 +.Sp +This is used to efficiently decide if the next few bytes in \f(CW\*(C`s\*(C'\fR is +legal Unicode-acceptable \s-1UTF\-8\s0 for a single character. +.Sp +Use \f(CW"isC9_STRICT_UTF8_CHAR"\fR to use the Unicode Corrigendum +#9 definition of allowable +code points; \f(CW"isUTF8_CHAR"\fR to check for Perl's extended \s-1UTF\-8\s0; +and \f(CW"isUTF8_CHAR_flags"\fR for a more customized definition. +.Sp +Use \f(CW"is_strict_utf8_string"\fR, \f(CW"is_strict_utf8_string_loc"\fR, and +\&\f(CW"is_strict_utf8_string_loclen"\fR to check entire strings. +.Sp +.Vb 2 +\& Size_t isSTRICT_UTF8_CHAR(const U8 * const s0, +\& const U8 * const e) +.Ve +.IP "is_strict_utf8_string" 8 +.IX Xref "is_strict_utf8_string" +.IX Item "is_strict_utf8_string" +Returns \s-1TRUE\s0 if the first \f(CW\*(C`len\*(C'\fR bytes of string \f(CW\*(C`s\*(C'\fR form a valid +UTF\-8\-encoded string that is fully interchangeable by any application using +Unicode rules; otherwise it returns \s-1FALSE.\s0 If \f(CW\*(C`len\*(C'\fR is 0, it will be +calculated using \f(CWstrlen(s)\fR (which means if you use this option, that \f(CW\*(C`s\*(C'\fR +can't have embedded \f(CW\*(C`NUL\*(C'\fR characters and has to have a terminating \f(CW\*(C`NUL\*(C'\fR +byte). Note that all characters being \s-1ASCII\s0 constitute 'a valid \s-1UTF\-8\s0 string'. +.Sp +This function returns \s-1FALSE\s0 for strings containing any +code points above the Unicode max of 0x10FFFF, surrogate code points, or +non-character code points. +.Sp +See also +\&\f(CW"is_utf8_invariant_string"\fR, +\&\f(CW"is_utf8_invariant_string_loc"\fR, +\&\f(CW"is_utf8_string"\fR, +\&\f(CW"is_utf8_string_flags"\fR, +\&\f(CW"is_utf8_string_loc"\fR, +\&\f(CW"is_utf8_string_loc_flags"\fR, +\&\f(CW"is_utf8_string_loclen"\fR, +\&\f(CW"is_utf8_string_loclen_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loc_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loclen_flags"\fR, +\&\f(CW"is_strict_utf8_string_loc"\fR, +\&\f(CW"is_strict_utf8_string_loclen"\fR, +\&\f(CW"is_c9strict_utf8_string"\fR, +\&\f(CW"is_c9strict_utf8_string_loc"\fR, +and +\&\f(CW"is_c9strict_utf8_string_loclen"\fR. +.Sp +.Vb 1 +\& bool is_strict_utf8_string(const U8 *s, STRLEN len) +.Ve +.IP "is_strict_utf8_string_loc" 8 +.IX Xref "is_strict_utf8_string_loc" +.IX Item "is_strict_utf8_string_loc" +Like \f(CW"is_strict_utf8_string"\fR but stores the location of the failure (in the +case of \*(L"utf8ness failure\*(R") or the location \f(CW\*(C`s\*(C'\fR+\f(CW\*(C`len\*(C'\fR (in the case of +\&\*(L"utf8ness success\*(R") in the \f(CW\*(C`ep\*(C'\fR pointer. +.Sp +See also \f(CW"is_strict_utf8_string_loclen"\fR. +.Sp +.Vb 3 +\& bool is_strict_utf8_string_loc(const U8 *s, +\& STRLEN len, +\& const U8 **ep) +.Ve +.IP "is_strict_utf8_string_loclen" 8 +.IX Xref "is_strict_utf8_string_loclen" +.IX Item "is_strict_utf8_string_loclen" +Like \f(CW"is_strict_utf8_string"\fR but stores the location of the failure (in the +case of \*(L"utf8ness failure\*(R") or the location \f(CW\*(C`s\*(C'\fR+\f(CW\*(C`len\*(C'\fR (in the case of +\&\*(L"utf8ness success\*(R") in the \f(CW\*(C`ep\*(C'\fR pointer, and the number of \s-1UTF\-8\s0 +encoded characters in the \f(CW\*(C`el\*(C'\fR pointer. +.Sp +See also \f(CW"is_strict_utf8_string_loc"\fR. +.Sp +.Vb 4 +\& bool is_strict_utf8_string_loclen(const U8 *s, +\& STRLEN len, +\& const U8 **ep, +\& STRLEN *el) +.Ve +.IP "is_utf8_fixed_width_buf_flags" 8 +.IX Xref "is_utf8_fixed_width_buf_flags" +.IX Item "is_utf8_fixed_width_buf_flags" +Returns \s-1TRUE\s0 if the fixed-width buffer starting at \f(CW\*(C`s\*(C'\fR with length \f(CW\*(C`len\*(C'\fR +is entirely valid \s-1UTF\-8,\s0 subject to the restrictions given by \f(CW\*(C`flags\*(C'\fR; +otherwise it returns \s-1FALSE.\s0 +.Sp +If \f(CW\*(C`flags\*(C'\fR is 0, any well-formed \s-1UTF\-8,\s0 as extended by Perl, is accepted +without restriction. If the final few bytes of the buffer do not form a +complete code point, this will return \s-1TRUE\s0 anyway, provided that +\&\f(CW"is_utf8_valid_partial_char_flags"\fR returns \s-1TRUE\s0 for them. +.Sp +If \f(CW\*(C`flags\*(C'\fR in non-zero, it can be any combination of the +\&\f(CW\*(C`UTF8_DISALLOW_\f(CIfoo\f(CW\*(C'\fR flags accepted by \f(CW"utf8n_to_uvchr"\fR, and with the +same meanings. +.Sp +This function differs from \f(CW"is_utf8_string_flags"\fR only in that the latter +returns \s-1FALSE\s0 if the final few bytes of the string don't form a complete code +point. +.Sp +.Vb 4 +\& bool is_utf8_fixed_width_buf_flags( +\& const U8 * const s, STRLEN len, +\& const U32 flags +\& ) +.Ve +.IP "is_utf8_fixed_width_buf_loclen_flags" 8 +.IX Xref "is_utf8_fixed_width_buf_loclen_flags" +.IX Item "is_utf8_fixed_width_buf_loclen_flags" +Like \f(CW"is_utf8_fixed_width_buf_loc_flags"\fR but stores the number of +complete, valid characters found in the \f(CW\*(C`el\*(C'\fR pointer. +.Sp +.Vb 4 +\& bool is_utf8_fixed_width_buf_loclen_flags( +\& const U8 * const s, STRLEN len, +\& const U8 **ep, STRLEN *el, const U32 flags +\& ) +.Ve +.IP "is_utf8_fixed_width_buf_loc_flags" 8 +.IX Xref "is_utf8_fixed_width_buf_loc_flags" +.IX Item "is_utf8_fixed_width_buf_loc_flags" +Like \f(CW"is_utf8_fixed_width_buf_flags"\fR but stores the location of the +failure in the \f(CW\*(C`ep\*(C'\fR pointer. If the function returns \s-1TRUE,\s0 \f(CW*ep\fR will point +to the beginning of any partial character at the end of the buffer; if there is +no partial character \f(CW*ep\fR will contain \f(CW\*(C`s\*(C'\fR+\f(CW\*(C`len\*(C'\fR. +.Sp +See also \f(CW"is_utf8_fixed_width_buf_loclen_flags"\fR. +.Sp +.Vb 4 +\& bool is_utf8_fixed_width_buf_loc_flags( +\& const U8 * const s, STRLEN len, +\& const U8 **ep, const U32 flags +\& ) +.Ve +.IP "is_utf8_invariant_string" 8 +.IX Xref "is_utf8_invariant_string" +.IX Item "is_utf8_invariant_string" +Returns \s-1TRUE\s0 if the first \f(CW\*(C`len\*(C'\fR bytes of the string \f(CW\*(C`s\*(C'\fR are the same +regardless of the \s-1UTF\-8\s0 encoding of the string (or UTF-EBCDIC encoding on +\&\s-1EBCDIC\s0 machines); otherwise it returns \s-1FALSE.\s0 That is, it returns \s-1TRUE\s0 if they +are \s-1UTF\-8\s0 invariant. On ASCII-ish machines, all the \s-1ASCII\s0 characters and only +the \s-1ASCII\s0 characters fit this definition. On \s-1EBCDIC\s0 machines, the ASCII-range +characters are invariant, but so also are the C1 controls. +.Sp +If \f(CW\*(C`len\*(C'\fR is 0, it will be calculated using \f(CWstrlen(s)\fR, (which means if you +use this option, that \f(CW\*(C`s\*(C'\fR can't have embedded \f(CW\*(C`NUL\*(C'\fR characters and has to +have a terminating \f(CW\*(C`NUL\*(C'\fR byte). +.Sp +See also +\&\f(CW"is_utf8_string"\fR, +\&\f(CW"is_utf8_string_flags"\fR, +\&\f(CW"is_utf8_string_loc"\fR, +\&\f(CW"is_utf8_string_loc_flags"\fR, +\&\f(CW"is_utf8_string_loclen"\fR, +\&\f(CW"is_utf8_string_loclen_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loc_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loclen_flags"\fR, +\&\f(CW"is_strict_utf8_string"\fR, +\&\f(CW"is_strict_utf8_string_loc"\fR, +\&\f(CW"is_strict_utf8_string_loclen"\fR, +\&\f(CW"is_c9strict_utf8_string"\fR, +\&\f(CW"is_c9strict_utf8_string_loc"\fR, +and +\&\f(CW"is_c9strict_utf8_string_loclen"\fR. +.Sp +.Vb 2 +\& bool is_utf8_invariant_string(const U8* const s, +\& STRLEN len) +.Ve +.IP "is_utf8_invariant_string_loc" 8 +.IX Xref "is_utf8_invariant_string_loc" +.IX Item "is_utf8_invariant_string_loc" +Like \f(CW"is_utf8_invariant_string"\fR but upon failure, stores the location of +the first \s-1UTF\-8\s0 variant character in the \f(CW\*(C`ep\*(C'\fR pointer; if all characters are +\&\s-1UTF\-8\s0 invariant, this function does not change the contents of \f(CW*ep\fR. +.Sp +.Vb 3 +\& bool is_utf8_invariant_string_loc(const U8* const s, +\& STRLEN len, +\& const U8 ** ep) +.Ve +.IP "is_utf8_string" 8 +.IX Xref "is_utf8_string" +.IX Item "is_utf8_string" +Returns \s-1TRUE\s0 if the first \f(CW\*(C`len\*(C'\fR bytes of string \f(CW\*(C`s\*(C'\fR form a valid +Perl\-extended\-UTF\-8 string; returns \s-1FALSE\s0 otherwise. If \f(CW\*(C`len\*(C'\fR is 0, it will +be calculated using \f(CWstrlen(s)\fR (which means if you use this option, that \f(CW\*(C`s\*(C'\fR +can't have embedded \f(CW\*(C`NUL\*(C'\fR characters and has to have a terminating \f(CW\*(C`NUL\*(C'\fR +byte). Note that all characters being \s-1ASCII\s0 constitute 'a valid \s-1UTF\-8\s0 string'. +.Sp +This function considers Perl's extended \s-1UTF\-8\s0 to be valid. That means that +code points above Unicode, surrogates, and non-character code points are +considered valid by this function. Use \f(CW"is_strict_utf8_string"\fR, +\&\f(CW"is_c9strict_utf8_string"\fR, or \f(CW"is_utf8_string_flags"\fR to restrict what +code points are considered valid. +.Sp +See also +\&\f(CW"is_utf8_invariant_string"\fR, +\&\f(CW"is_utf8_invariant_string_loc"\fR, +\&\f(CW"is_utf8_string_loc"\fR, +\&\f(CW"is_utf8_string_loclen"\fR, +\&\f(CW"is_utf8_fixed_width_buf_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loc_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loclen_flags"\fR, +.Sp +.Vb 1 +\& bool is_utf8_string(const U8 *s, STRLEN len) +.Ve +.IP "is_utf8_string_flags" 8 +.IX Xref "is_utf8_string_flags" +.IX Item "is_utf8_string_flags" +Returns \s-1TRUE\s0 if the first \f(CW\*(C`len\*(C'\fR bytes of string \f(CW\*(C`s\*(C'\fR form a valid +\&\s-1UTF\-8\s0 string, subject to the restrictions imposed by \f(CW\*(C`flags\*(C'\fR; +returns \s-1FALSE\s0 otherwise. If \f(CW\*(C`len\*(C'\fR is 0, it will be calculated +using \f(CWstrlen(s)\fR (which means if you use this option, that \f(CW\*(C`s\*(C'\fR can't have +embedded \f(CW\*(C`NUL\*(C'\fR characters and has to have a terminating \f(CW\*(C`NUL\*(C'\fR byte). Note +that all characters being \s-1ASCII\s0 constitute 'a valid \s-1UTF\-8\s0 string'. +.Sp +If \f(CW\*(C`flags\*(C'\fR is 0, this gives the same results as \f(CW"is_utf8_string"\fR; if +\&\f(CW\*(C`flags\*(C'\fR is \f(CW\*(C`UTF8_DISALLOW_ILLEGAL_INTERCHANGE\*(C'\fR, this gives the same results +as \f(CW"is_strict_utf8_string"\fR; and if \f(CW\*(C`flags\*(C'\fR is +\&\f(CW\*(C`UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE\*(C'\fR, this gives the same results as +\&\f(CW"is_c9strict_utf8_string"\fR. Otherwise \f(CW\*(C`flags\*(C'\fR may be any +combination of the \f(CW\*(C`UTF8_DISALLOW_\f(CIfoo\f(CW\*(C'\fR flags understood by +\&\f(CW"utf8n_to_uvchr"\fR, with the same meanings. +.Sp +See also +\&\f(CW"is_utf8_invariant_string"\fR, +\&\f(CW"is_utf8_invariant_string_loc"\fR, +\&\f(CW"is_utf8_string"\fR, +\&\f(CW"is_utf8_string_loc"\fR, +\&\f(CW"is_utf8_string_loc_flags"\fR, +\&\f(CW"is_utf8_string_loclen"\fR, +\&\f(CW"is_utf8_string_loclen_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loc_flags"\fR, +\&\f(CW"is_utf8_fixed_width_buf_loclen_flags"\fR, +\&\f(CW"is_strict_utf8_string"\fR, +\&\f(CW"is_strict_utf8_string_loc"\fR, +\&\f(CW"is_strict_utf8_string_loclen"\fR, +\&\f(CW"is_c9strict_utf8_string"\fR, +\&\f(CW"is_c9strict_utf8_string_loc"\fR, +and +\&\f(CW"is_c9strict_utf8_string_loclen"\fR. +.Sp +.Vb 2 +\& bool is_utf8_string_flags(const U8 *s, STRLEN len, +\& const U32 flags) +.Ve +.IP "is_utf8_string_loc" 8 +.IX Xref "is_utf8_string_loc" +.IX Item "is_utf8_string_loc" +Like \f(CW"is_utf8_string"\fR but stores the location of the failure (in the +case of \*(L"utf8ness failure\*(R") or the location \f(CW\*(C`s\*(C'\fR+\f(CW\*(C`len\*(C'\fR (in the case of +\&\*(L"utf8ness success\*(R") in the \f(CW\*(C`ep\*(C'\fR pointer. +.Sp +See also \f(CW"is_utf8_string_loclen"\fR. +.Sp +.Vb 3 +\& bool is_utf8_string_loc(const U8 *s, +\& const STRLEN len, +\& const U8 **ep) +.Ve +.IP "is_utf8_string_loclen" 8 +.IX Xref "is_utf8_string_loclen" +.IX Item "is_utf8_string_loclen" +Like \f(CW"is_utf8_string"\fR but stores the location of the failure (in the +case of \*(L"utf8ness failure\*(R") or the location \f(CW\*(C`s\*(C'\fR+\f(CW\*(C`len\*(C'\fR (in the case of +\&\*(L"utf8ness success\*(R") in the \f(CW\*(C`ep\*(C'\fR pointer, and the number of \s-1UTF\-8\s0 +encoded characters in the \f(CW\*(C`el\*(C'\fR pointer. +.Sp +See also \f(CW"is_utf8_string_loc"\fR. +.Sp +.Vb 2 +\& bool is_utf8_string_loclen(const U8 *s, STRLEN len, +\& const U8 **ep, STRLEN *el) +.Ve +.IP "is_utf8_string_loclen_flags" 8 +.IX Xref "is_utf8_string_loclen_flags" +.IX Item "is_utf8_string_loclen_flags" +Like \f(CW"is_utf8_string_flags"\fR but stores the location of the failure (in the +case of \*(L"utf8ness failure\*(R") or the location \f(CW\*(C`s\*(C'\fR+\f(CW\*(C`len\*(C'\fR (in the case of +\&\*(L"utf8ness success\*(R") in the \f(CW\*(C`ep\*(C'\fR pointer, and the number of \s-1UTF\-8\s0 +encoded characters in the \f(CW\*(C`el\*(C'\fR pointer. +.Sp +See also \f(CW"is_utf8_string_loc_flags"\fR. +.Sp +.Vb 5 +\& bool is_utf8_string_loclen_flags(const U8 *s, +\& STRLEN len, +\& const U8 **ep, +\& STRLEN *el, +\& const U32 flags) +.Ve +.IP "is_utf8_string_loc_flags" 8 +.IX Xref "is_utf8_string_loc_flags" +.IX Item "is_utf8_string_loc_flags" +Like \f(CW"is_utf8_string_flags"\fR but stores the location of the failure (in the +case of \*(L"utf8ness failure\*(R") or the location \f(CW\*(C`s\*(C'\fR+\f(CW\*(C`len\*(C'\fR (in the case of +\&\*(L"utf8ness success\*(R") in the \f(CW\*(C`ep\*(C'\fR pointer. +.Sp +See also \f(CW"is_utf8_string_loclen_flags"\fR. +.Sp +.Vb 4 +\& bool is_utf8_string_loc_flags(const U8 *s, +\& STRLEN len, +\& const U8 **ep, +\& const U32 flags) +.Ve +.IP "is_utf8_valid_partial_char" 8 +.IX Xref "is_utf8_valid_partial_char" +.IX Item "is_utf8_valid_partial_char" +Returns 0 if the sequence of bytes starting at \f(CW\*(C`s\*(C'\fR and looking no further than +\&\f(CW\*(C`e\ \-\ 1\*(C'\fR is the \s-1UTF\-8\s0 encoding, as extended by Perl, for one or more code +points. Otherwise, it returns 1 if there exists at least one non-empty +sequence of bytes that when appended to sequence \f(CW\*(C`s\*(C'\fR, starting at position +\&\f(CW\*(C`e\*(C'\fR causes the entire sequence to be the well-formed \s-1UTF\-8\s0 of some code point; +otherwise returns 0. +.Sp +In other words this returns \s-1TRUE\s0 if \f(CW\*(C`s\*(C'\fR points to a partial UTF\-8\-encoded code +point. +.Sp +This is useful when a fixed-length buffer is being tested for being well-formed +\&\s-1UTF\-8,\s0 but the final few bytes in it don't comprise a full character; that is, +it is split somewhere in the middle of the final code point's \s-1UTF\-8\s0 +representation. (Presumably when the buffer is refreshed with the next chunk +of data, the new first bytes will complete the partial code point.) This +function is used to verify that the final bytes in the current buffer are in +fact the legal beginning of some code point, so that if they aren't, the +failure can be signalled without having to wait for the next read. +.Sp +.Vb 2 +\& bool is_utf8_valid_partial_char(const U8 * const s, +\& const U8 * const e) +.Ve +.IP "is_utf8_valid_partial_char_flags" 8 +.IX Xref "is_utf8_valid_partial_char_flags" +.IX Item "is_utf8_valid_partial_char_flags" +Like \f(CW"is_utf8_valid_partial_char"\fR, it returns a boolean giving whether +or not the input is a valid \s-1UTF\-8\s0 encoded partial character, but it takes an +extra parameter, \f(CW\*(C`flags\*(C'\fR, which can further restrict which code points are +considered valid. +.Sp +If \f(CW\*(C`flags\*(C'\fR is 0, this behaves identically to +\&\f(CW"is_utf8_valid_partial_char"\fR. Otherwise \f(CW\*(C`flags\*(C'\fR can be any combination +of the \f(CW\*(C`UTF8_DISALLOW_\f(CIfoo\f(CW\*(C'\fR flags accepted by \f(CW"utf8n_to_uvchr"\fR. If +there is any sequence of bytes that can complete the input partial character in +such a way that a non-prohibited character is formed, the function returns +\&\s-1TRUE\s0; otherwise \s-1FALSE.\s0 Non character code points cannot be determined based on +partial character input. But many of the other possible excluded types can be +determined from just the first one or two bytes. +.Sp +.Vb 4 +\& bool is_utf8_valid_partial_char_flags( +\& const U8 * const s, const U8 * const e, +\& const U32 flags +\& ) +.Ve +.IP "isUTF8_CHAR" 8 +.IX Xref "isUTF8_CHAR" +.IX Item "isUTF8_CHAR" +Evaluates to non-zero if the first few bytes of the string starting at \f(CW\*(C`s\*(C'\fR and +looking no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR are well-formed \s-1UTF\-8,\s0 as extended by Perl, +that represents some code point; otherwise it evaluates to 0. If non-zero, the +value gives how many bytes starting at \f(CW\*(C`s\*(C'\fR comprise the code point's +representation. Any bytes remaining before \f(CW\*(C`e\*(C'\fR, but beyond the ones needed to +form the first code point in \f(CW\*(C`s\*(C'\fR, are not examined. +.Sp +The code point can be any that will fit in an \s-1IV\s0 on this machine, using Perl's +extension to official \s-1UTF\-8\s0 to represent those higher than the Unicode maximum +of 0x10FFFF. That means that this macro is used to efficiently decide if the +next few bytes in \f(CW\*(C`s\*(C'\fR is legal \s-1UTF\-8\s0 for a single character. +.Sp +Use \f(CW"isSTRICT_UTF8_CHAR"\fR to restrict the acceptable code points to those +defined by Unicode to be fully interchangeable across applications; +\&\f(CW"isC9_STRICT_UTF8_CHAR"\fR to use the Unicode Corrigendum +#9 definition of allowable +code points; and \f(CW"isUTF8_CHAR_flags"\fR for a more customized definition. +.Sp +Use \f(CW"is_utf8_string"\fR, \f(CW"is_utf8_string_loc"\fR, and +\&\f(CW"is_utf8_string_loclen"\fR to check entire strings. +.Sp +Note also that a \s-1UTF\-8\s0 \*(L"invariant\*(R" character (i.e. \s-1ASCII\s0 on non-EBCDIC +machines) is a valid \s-1UTF\-8\s0 character. +.Sp +.Vb 2 +\& Size_t isUTF8_CHAR(const U8 * const s0, +\& const U8 * const e) +.Ve +.IP "isUTF8_CHAR_flags" 8 +.IX Xref "isUTF8_CHAR_flags" +.IX Item "isUTF8_CHAR_flags" +Evaluates to non-zero if the first few bytes of the string starting at \f(CW\*(C`s\*(C'\fR and +looking no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR are well-formed \s-1UTF\-8,\s0 as extended by Perl, +that represents some code point, subject to the restrictions given by \f(CW\*(C`flags\*(C'\fR; +otherwise it evaluates to 0. If non-zero, the value gives how many bytes +starting at \f(CW\*(C`s\*(C'\fR comprise the code point's representation. Any bytes remaining +before \f(CW\*(C`e\*(C'\fR, but beyond the ones needed to form the first code point in \f(CW\*(C`s\*(C'\fR, +are not examined. +.Sp +If \f(CW\*(C`flags\*(C'\fR is 0, this gives the same results as \f(CW"isUTF8_CHAR"\fR; +if \f(CW\*(C`flags\*(C'\fR is \f(CW\*(C`UTF8_DISALLOW_ILLEGAL_INTERCHANGE\*(C'\fR, this gives the same results +as \f(CW"isSTRICT_UTF8_CHAR"\fR; +and if \f(CW\*(C`flags\*(C'\fR is \f(CW\*(C`UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE\*(C'\fR, this gives +the same results as \f(CW"isC9_STRICT_UTF8_CHAR"\fR. +Otherwise \f(CW\*(C`flags\*(C'\fR may be any combination of the \f(CW\*(C`UTF8_DISALLOW_\f(CIfoo\f(CW\*(C'\fR flags +understood by \f(CW"utf8n_to_uvchr"\fR, with the same meanings. +.Sp +The three alternative macros are for the most commonly needed validations; they +are likely to run somewhat faster than this more general one, as they can be +inlined into your code. +.Sp +Use \*(L"is_utf8_string_flags\*(R", \*(L"is_utf8_string_loc_flags\*(R", and +\&\*(L"is_utf8_string_loclen_flags\*(R" to check entire strings. +.Sp +.Vb 2 +\& STRLEN isUTF8_CHAR_flags(const U8 *s, const U8 *e, +\& const U32 flags) +.Ve +.IP "\s-1LATIN1_TO_NATIVE\s0" 8 +.IX Xref "LATIN1_TO_NATIVE" +.IX Item "LATIN1_TO_NATIVE" +Returns the native equivalent of the input Latin\-1 code point (including \s-1ASCII\s0 +and control characters) given by \f(CW\*(C`ch\*(C'\fR. Thus, \f(CW\*(C`LATIN1_TO_NATIVE(66)\*(C'\fR on +\&\s-1EBCDIC\s0 platforms returns 194. These each represent the character \f(CW"B"\fR on +their respective platforms. On \s-1ASCII\s0 platforms no conversion is needed, so +this macro expands to just its input, adding no time nor space requirements to +the implementation. +.Sp +For conversion of code points potentially larger than will fit in a character, +use \*(L"\s-1UNI_TO_NATIVE\*(R"\s0. +.Sp +.Vb 1 +\& U8 LATIN1_TO_NATIVE(U8 ch) +.Ve +.IP "\s-1NATIVE_TO_LATIN1\s0" 8 +.IX Xref "NATIVE_TO_LATIN1" +.IX Item "NATIVE_TO_LATIN1" +Returns the Latin\-1 (including \s-1ASCII\s0 and control characters) equivalent of the +input native code point given by \f(CW\*(C`ch\*(C'\fR. Thus, \f(CW\*(C`NATIVE_TO_LATIN1(193)\*(C'\fR on +\&\s-1EBCDIC\s0 platforms returns 65. These each represent the character \f(CW"A"\fR on +their respective platforms. On \s-1ASCII\s0 platforms no conversion is needed, so +this macro expands to just its input, adding no time nor space requirements to +the implementation. +.Sp +For conversion of code points potentially larger than will fit in a character, +use \*(L"\s-1NATIVE_TO_UNI\*(R"\s0. +.Sp +.Vb 1 +\& U8 NATIVE_TO_LATIN1(U8 ch) +.Ve +.IP "\s-1NATIVE_TO_UNI\s0" 8 +.IX Xref "NATIVE_TO_UNI" +.IX Item "NATIVE_TO_UNI" +Returns the Unicode equivalent of the input native code point given by \f(CW\*(C`ch\*(C'\fR. +Thus, \f(CW\*(C`NATIVE_TO_UNI(195)\*(C'\fR on \s-1EBCDIC\s0 platforms returns 67. These each +represent the character \f(CW"C"\fR on their respective platforms. On \s-1ASCII\s0 +platforms no conversion is needed, so this macro expands to just its input, +adding no time nor space requirements to the implementation. +.Sp +.Vb 1 +\& UV NATIVE_TO_UNI(UV ch) +.Ve +.IP "pv_uni_display" 8 +.IX Xref "pv_uni_display" +.IX Item "pv_uni_display" +Build to the scalar \f(CW\*(C`dsv\*(C'\fR a displayable version of the \s-1UTF\-8\s0 encoded string +\&\f(CW\*(C`spv\*(C'\fR, length \f(CW\*(C`len\*(C'\fR, the displayable version being at most \f(CW\*(C`pvlim\*(C'\fR bytes +long (if longer, the rest is truncated and \f(CW"..."\fR will be appended). +.Sp +The \f(CW\*(C`flags\*(C'\fR argument can have \f(CW\*(C`UNI_DISPLAY_ISPRINT\*(C'\fR set to display +\&\f(CW\*(C`isPRINT()\*(C'\fRable characters as themselves, \f(CW\*(C`UNI_DISPLAY_BACKSLASH\*(C'\fR +to display the \f(CW\*(C`\e\e[nrfta\e\e]\*(C'\fR as the backslashed versions (like \f(CW"\en"\fR) +(\f(CW\*(C`UNI_DISPLAY_BACKSLASH\*(C'\fR is preferred over \f(CW\*(C`UNI_DISPLAY_ISPRINT\*(C'\fR for \f(CW"\e\e"\fR). +\&\f(CW\*(C`UNI_DISPLAY_QQ\*(C'\fR (and its alias \f(CW\*(C`UNI_DISPLAY_REGEX\*(C'\fR) have both +\&\f(CW\*(C`UNI_DISPLAY_BACKSLASH\*(C'\fR and \f(CW\*(C`UNI_DISPLAY_ISPRINT\*(C'\fR turned on. +.Sp +Additionally, there is now \f(CW\*(C`UNI_DISPLAY_BACKSPACE\*(C'\fR which allows \f(CW\*(C`\eb\*(C'\fR for a +backspace, but only when \f(CW\*(C`UNI_DISPLAY_BACKSLASH\*(C'\fR also is set. +.Sp +The pointer to the \s-1PV\s0 of the \f(CW\*(C`dsv\*(C'\fR is returned. +.Sp +See also \*(L"sv_uni_display\*(R". +.Sp +.Vb 3 +\& char* pv_uni_display(SV *dsv, const U8 *spv, +\& STRLEN len, STRLEN pvlim, +\& UV flags) +.Ve +.IP "\s-1REPLACEMENT_CHARACTER_UTF8\s0" 8 +.IX Xref "REPLACEMENT_CHARACTER_UTF8" +.IX Item "REPLACEMENT_CHARACTER_UTF8" +This is a macro that evaluates to a string constant of the \s-1UTF\-8\s0 bytes that +define the Unicode \s-1REPLACEMENT CHARACTER\s0 (U+FFFD) for the platform that perl +is compiled on. This allows code to use a mnemonic for this character that +works on both \s-1ASCII\s0 and \s-1EBCDIC\s0 platforms. +\&\f(CW\*(C`sizeof(REPLACEMENT_CHARACTER_UTF8)\ \-\ 1\*(C'\fR can be used to get its length in +bytes. +.IP "sv_cat_decode" 8 +.IX Xref "sv_cat_decode" +.IX Item "sv_cat_decode" +\&\f(CW\*(C`encoding\*(C'\fR is assumed to be an \f(CW\*(C`Encode\*(C'\fR object, the \s-1PV\s0 of \f(CW\*(C`ssv\*(C'\fR is +assumed to be octets in that encoding and decoding the input starts +from the position which \f(CW\*(C`(PV\ +\ *offset)\*(C'\fR pointed to. \f(CW\*(C`dsv\*(C'\fR will be +concatenated with the decoded \s-1UTF\-8\s0 string from \f(CW\*(C`ssv\*(C'\fR. Decoding will terminate +when the string \f(CW\*(C`tstr\*(C'\fR appears in decoding output or the input ends on +the \s-1PV\s0 of \f(CW\*(C`ssv\*(C'\fR. The value which \f(CW\*(C`offset\*(C'\fR points will be modified +to the last input position on \f(CW\*(C`ssv\*(C'\fR. +.Sp +Returns \s-1TRUE\s0 if the terminator was found, else returns \s-1FALSE.\s0 +.Sp +.Vb 2 +\& bool sv_cat_decode(SV* dsv, SV *encoding, SV *ssv, +\& int *offset, char* tstr, int tlen) +.Ve +.IP "sv_recode_to_utf8" 8 +.IX Xref "sv_recode_to_utf8" +.IX Item "sv_recode_to_utf8" +\&\f(CW\*(C`encoding\*(C'\fR is assumed to be an \f(CW\*(C`Encode\*(C'\fR object, on entry the \s-1PV\s0 +of \f(CW\*(C`sv\*(C'\fR is assumed to be octets in that encoding, and \f(CW\*(C`sv\*(C'\fR +will be converted into Unicode (and \s-1UTF\-8\s0). +.Sp +If \f(CW\*(C`sv\*(C'\fR already is \s-1UTF\-8\s0 (or if it is not \f(CW\*(C`POK\*(C'\fR), or if \f(CW\*(C`encoding\*(C'\fR +is not a reference, nothing is done to \f(CW\*(C`sv\*(C'\fR. If \f(CW\*(C`encoding\*(C'\fR is not +an \f(CW\*(C`Encode::XS\*(C'\fR Encoding object, bad things will happen. +(See \fIcpan/Encode/encoding.pm\fR and Encode.) +.Sp +The \s-1PV\s0 of \f(CW\*(C`sv\*(C'\fR is returned. +.Sp +.Vb 1 +\& char* sv_recode_to_utf8(SV* sv, SV *encoding) +.Ve +.IP "sv_uni_display" 8 +.IX Xref "sv_uni_display" +.IX Item "sv_uni_display" +Build to the scalar \f(CW\*(C`dsv\*(C'\fR a displayable version of the scalar \f(CW\*(C`sv\*(C'\fR, +the displayable version being at most \f(CW\*(C`pvlim\*(C'\fR bytes long +(if longer, the rest is truncated and \*(L"...\*(R" will be appended). +.Sp +The \f(CW\*(C`flags\*(C'\fR argument is as in \*(L"pv_uni_display\*(R"(). +.Sp +The pointer to the \s-1PV\s0 of the \f(CW\*(C`dsv\*(C'\fR is returned. +.Sp +.Vb 2 +\& char* sv_uni_display(SV *dsv, SV *ssv, STRLEN pvlim, +\& UV flags) +.Ve +.IP "\s-1UNICODE_REPLACEMENT\s0" 8 +.IX Xref "UNICODE_REPLACEMENT" +.IX Item "UNICODE_REPLACEMENT" +Evaluates to 0xFFFD, the code point of the Unicode \s-1REPLACEMENT CHARACTER\s0 +.IP "\s-1UNI_TO_NATIVE\s0" 8 +.IX Xref "UNI_TO_NATIVE" +.IX Item "UNI_TO_NATIVE" +Returns the native equivalent of the input Unicode code point given by \f(CW\*(C`ch\*(C'\fR. +Thus, \f(CW\*(C`UNI_TO_NATIVE(68)\*(C'\fR on \s-1EBCDIC\s0 platforms returns 196. These each +represent the character \f(CW"D"\fR on their respective platforms. On \s-1ASCII\s0 +platforms no conversion is needed, so this macro expands to just its input, +adding no time nor space requirements to the implementation. +.Sp +.Vb 1 +\& UV UNI_TO_NATIVE(UV ch) +.Ve +.IP "utf8n_to_uvchr" 8 +.IX Xref "utf8n_to_uvchr" +.IX Item "utf8n_to_uvchr" +\&\s-1THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES.\s0 +Most code should use \*(L"utf8_to_uvchr_buf\*(R"() rather than call this +directly. +.Sp +Bottom level \s-1UTF\-8\s0 decode routine. +Returns the native code point value of the first character in the string \f(CW\*(C`s\*(C'\fR, +which is assumed to be in \s-1UTF\-8\s0 (or UTF-EBCDIC) encoding, and no longer than +\&\f(CW\*(C`curlen\*(C'\fR bytes; \f(CW*retlen\fR (if \f(CW\*(C`retlen\*(C'\fR isn't \s-1NULL\s0) will be set to +the length, in bytes, of that character. +.Sp +The value of \f(CW\*(C`flags\*(C'\fR determines the behavior when \f(CW\*(C`s\*(C'\fR does not point to a +well-formed \s-1UTF\-8\s0 character. If \f(CW\*(C`flags\*(C'\fR is 0, encountering a malformation +causes zero to be returned and \f(CW*retlen\fR is set so that (\f(CW\*(C`s\*(C'\fR\ +\ \f(CW*retlen\fR) +is the next possible position in \f(CW\*(C`s\*(C'\fR that could begin a non-malformed +character. Also, if \s-1UTF\-8\s0 warnings haven't been lexically disabled, a warning +is raised. Some \s-1UTF\-8\s0 input sequences may contain multiple malformations. +This function tries to find every possible one in each call, so multiple +warnings can be raised for the same sequence. +.Sp +Various \s-1ALLOW\s0 flags can be set in \f(CW\*(C`flags\*(C'\fR to allow (and not warn on) +individual types of malformations, such as the sequence being overlong (that +is, when there is a shorter sequence that can express the same code point; +overlong sequences are expressly forbidden in the \s-1UTF\-8\s0 standard due to +potential security issues). Another malformation example is the first byte of +a character not being a legal first byte. See \fIutf8.h\fR for the list of such +flags. Even if allowed, this function generally returns the Unicode +\&\s-1REPLACEMENT CHARACTER\s0 when it encounters a malformation. There are flags in +\&\fIutf8.h\fR to override this behavior for the overlong malformations, but don't +do that except for very specialized purposes. +.Sp +The \f(CW\*(C`UTF8_CHECK_ONLY\*(C'\fR flag overrides the behavior when a non-allowed (by other +flags) malformation is found. If this flag is set, the routine assumes that +the caller will raise a warning, and this function will silently just set +\&\f(CW\*(C`retlen\*(C'\fR to \f(CW\*(C`\-1\*(C'\fR (cast to \f(CW\*(C`STRLEN\*(C'\fR) and return zero. +.Sp +Note that this \s-1API\s0 requires disambiguation between successful decoding a \f(CW\*(C`NUL\*(C'\fR +character, and an error return (unless the \f(CW\*(C`UTF8_CHECK_ONLY\*(C'\fR flag is set), as +in both cases, 0 is returned, and, depending on the malformation, \f(CW\*(C`retlen\*(C'\fR may +be set to 1. To disambiguate, upon a zero return, see if the first byte of +\&\f(CW\*(C`s\*(C'\fR is 0 as well. If so, the input was a \f(CW\*(C`NUL\*(C'\fR; if not, the input had an +error. Or you can use \f(CW"utf8n_to_uvchr_error"\fR. +.Sp +Certain code points are considered problematic. These are Unicode surrogates, +Unicode non-characters, and code points above the Unicode maximum of 0x10FFFF. +By default these are considered regular code points, but certain situations +warrant special handling for them, which can be specified using the \f(CW\*(C`flags\*(C'\fR +parameter. If \f(CW\*(C`flags\*(C'\fR contains \f(CW\*(C`UTF8_DISALLOW_ILLEGAL_INTERCHANGE\*(C'\fR, all +three classes are treated as malformations and handled as such. The flags +\&\f(CW\*(C`UTF8_DISALLOW_SURROGATE\*(C'\fR, \f(CW\*(C`UTF8_DISALLOW_NONCHAR\*(C'\fR, and +\&\f(CW\*(C`UTF8_DISALLOW_SUPER\*(C'\fR (meaning above the legal Unicode maximum) can be set to +disallow these categories individually. \f(CW\*(C`UTF8_DISALLOW_ILLEGAL_INTERCHANGE\*(C'\fR +restricts the allowed inputs to the strict \s-1UTF\-8\s0 traditionally defined by +Unicode. Use \f(CW\*(C`UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE\*(C'\fR to use the strictness +definition given by +Unicode Corrigendum #9 . +The difference between traditional strictness and C9 strictness is that the +latter does not forbid non-character code points. (They are still discouraged, +however.) For more discussion see \*(L"Noncharacter code points\*(R" in perlunicode. +.Sp +The flags \f(CW\*(C`UTF8_WARN_ILLEGAL_INTERCHANGE\*(C'\fR, +\&\f(CW\*(C`UTF8_WARN_ILLEGAL_C9_INTERCHANGE\*(C'\fR, \f(CW\*(C`UTF8_WARN_SURROGATE\*(C'\fR, +\&\f(CW\*(C`UTF8_WARN_NONCHAR\*(C'\fR, and \f(CW\*(C`UTF8_WARN_SUPER\*(C'\fR will cause warning messages to be +raised for their respective categories, but otherwise the code points are +considered valid (not malformations). To get a category to both be treated as +a malformation and raise a warning, specify both the \s-1WARN\s0 and \s-1DISALLOW\s0 flags. +(But note that warnings are not raised if lexically disabled nor if +\&\f(CW\*(C`UTF8_CHECK_ONLY\*(C'\fR is also specified.) +.Sp +Extremely high code points were never specified in any standard, and require an +extension to \s-1UTF\-8\s0 to express, which Perl does. It is likely that programs +written in something other than Perl would not be able to read files that +contain these; nor would Perl understand files written by something that uses a +different extension. For these reasons, there is a separate set of flags that +can warn and/or disallow these extremely high code points, even if other +above-Unicode ones are accepted. They are the \f(CW\*(C`UTF8_WARN_PERL_EXTENDED\*(C'\fR and +\&\f(CW\*(C`UTF8_DISALLOW_PERL_EXTENDED\*(C'\fR flags. For more information see +"\f(CW\*(C`UTF8_GOT_PERL_EXTENDED\*(C'\fR". Of course \f(CW\*(C`UTF8_DISALLOW_SUPER\*(C'\fR will treat all +above-Unicode code points, including these, as malformations. +(Note that the Unicode standard considers anything above 0x10FFFF to be +illegal, but there are standards predating it that allow up to 0x7FFF_FFFF +(2**31 \-1)) +.Sp +A somewhat misleadingly named synonym for \f(CW\*(C`UTF8_WARN_PERL_EXTENDED\*(C'\fR is +retained for backward compatibility: \f(CW\*(C`UTF8_WARN_ABOVE_31_BIT\*(C'\fR. Similarly, +\&\f(CW\*(C`UTF8_DISALLOW_ABOVE_31_BIT\*(C'\fR is usable instead of the more accurately named +\&\f(CW\*(C`UTF8_DISALLOW_PERL_EXTENDED\*(C'\fR. The names are misleading because these flags +can apply to code points that actually do fit in 31 bits. This happens on +\&\s-1EBCDIC\s0 platforms, and sometimes when the overlong +malformation is also present. The new names accurately +describe the situation in all cases. +.Sp +All other code points corresponding to Unicode characters, including private +use and those yet to be assigned, are never considered malformed and never +warn. +.Sp +.Vb 2 +\& UV utf8n_to_uvchr(const U8 *s, STRLEN curlen, +\& STRLEN *retlen, const U32 flags) +.Ve +.IP "utf8n_to_uvchr_error" 8 +.IX Xref "utf8n_to_uvchr_error" +.IX Item "utf8n_to_uvchr_error" +\&\s-1THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES.\s0 +Most code should use \*(L"utf8_to_uvchr_buf\*(R"() rather than call this +directly. +.Sp +This function is for code that needs to know what the precise malformation(s) +are when an error is found. If you also need to know the generated warning +messages, use \*(L"utf8n_to_uvchr_msgs\*(R"() instead. +.Sp +It is like \f(CW"utf8n_to_uvchr"\fR but it takes an extra parameter placed after +all the others, \f(CW\*(C`errors\*(C'\fR. If this parameter is 0, this function behaves +identically to \f(CW"utf8n_to_uvchr"\fR. Otherwise, \f(CW\*(C`errors\*(C'\fR should be a pointer +to a \f(CW\*(C`U32\*(C'\fR variable, which this function sets to indicate any errors found. +Upon return, if \f(CW*errors\fR is 0, there were no errors found. Otherwise, +\&\f(CW*errors\fR is the bit-wise \f(CW\*(C`OR\*(C'\fR of the bits described in the list below. Some +of these bits will be set if a malformation is found, even if the input +\&\f(CW\*(C`flags\*(C'\fR parameter indicates that the given malformation is allowed; those +exceptions are noted: +.RS 8 +.ie n .IP """UTF8_GOT_PERL_EXTENDED""" 4 +.el .IP "\f(CWUTF8_GOT_PERL_EXTENDED\fR" 4 +.IX Item "UTF8_GOT_PERL_EXTENDED" +The input sequence is not standard \s-1UTF\-8,\s0 but a Perl extension. This bit is +set only if the input \f(CW\*(C`flags\*(C'\fR parameter contains either the +\&\f(CW\*(C`UTF8_DISALLOW_PERL_EXTENDED\*(C'\fR or the \f(CW\*(C`UTF8_WARN_PERL_EXTENDED\*(C'\fR flags. +.Sp +Code points above 0x7FFF_FFFF (2**31 \- 1) were never specified in any standard, +and so some extension must be used to express them. Perl uses a natural +extension to \s-1UTF\-8\s0 to represent the ones up to 2**36\-1, and invented a further +extension to represent even higher ones, so that any code point that fits in a +64\-bit word can be represented. Text using these extensions is not likely to +be portable to non-Perl code. We lump both of these extensions together and +refer to them as Perl extended \s-1UTF\-8.\s0 There exist other extensions that people +have invented, incompatible with Perl's. +.Sp +On \s-1EBCDIC\s0 platforms starting in Perl v5.24, the Perl extension for representing +extremely high code points kicks in at 0x3FFF_FFFF (2**30 \-1), which is lower +than on \s-1ASCII.\s0 Prior to that, code points 2**31 and higher were simply +unrepresentable, and a different, incompatible method was used to represent +code points between 2**30 and 2**31 \- 1. +.Sp +On both platforms, \s-1ASCII\s0 and \s-1EBCDIC,\s0 \f(CW\*(C`UTF8_GOT_PERL_EXTENDED\*(C'\fR is set if +Perl extended \s-1UTF\-8\s0 is used. +.Sp +In earlier Perls, this bit was named \f(CW\*(C`UTF8_GOT_ABOVE_31_BIT\*(C'\fR, which you still +may use for backward compatibility. That name is misleading, as this flag may +be set when the code point actually does fit in 31 bits. This happens on +\&\s-1EBCDIC\s0 platforms, and sometimes when the overlong +malformation is also present. The new name accurately +describes the situation in all cases. +.ie n .IP """UTF8_GOT_CONTINUATION""" 4 +.el .IP "\f(CWUTF8_GOT_CONTINUATION\fR" 4 +.IX Item "UTF8_GOT_CONTINUATION" +The input sequence was malformed in that the first byte was a \s-1UTF\-8\s0 +continuation byte. +.ie n .IP """UTF8_GOT_EMPTY""" 4 +.el .IP "\f(CWUTF8_GOT_EMPTY\fR" 4 +.IX Item "UTF8_GOT_EMPTY" +The input \f(CW\*(C`curlen\*(C'\fR parameter was 0. +.ie n .IP """UTF8_GOT_LONG""" 4 +.el .IP "\f(CWUTF8_GOT_LONG\fR" 4 +.IX Item "UTF8_GOT_LONG" +The input sequence was malformed in that there is some other sequence that +evaluates to the same code point, but that sequence is shorter than this one. +.Sp +Until Unicode 3.1, it was legal for programs to accept this malformation, but +it was discovered that this created security issues. +.ie n .IP """UTF8_GOT_NONCHAR""" 4 +.el .IP "\f(CWUTF8_GOT_NONCHAR\fR" 4 +.IX Item "UTF8_GOT_NONCHAR" +The code point represented by the input \s-1UTF\-8\s0 sequence is for a Unicode +non-character code point. +This bit is set only if the input \f(CW\*(C`flags\*(C'\fR parameter contains either the +\&\f(CW\*(C`UTF8_DISALLOW_NONCHAR\*(C'\fR or the \f(CW\*(C`UTF8_WARN_NONCHAR\*(C'\fR flags. +.ie n .IP """UTF8_GOT_NON_CONTINUATION""" 4 +.el .IP "\f(CWUTF8_GOT_NON_CONTINUATION\fR" 4 +.IX Item "UTF8_GOT_NON_CONTINUATION" +The input sequence was malformed in that a non-continuation type byte was found +in a position where only a continuation type one should be. See also +"\f(CW\*(C`UTF8_GOT_SHORT\*(C'\fR". +.ie n .IP """UTF8_GOT_OVERFLOW""" 4 +.el .IP "\f(CWUTF8_GOT_OVERFLOW\fR" 4 +.IX Item "UTF8_GOT_OVERFLOW" +The input sequence was malformed in that it is for a code point that is not +representable in the number of bits available in an \s-1IV\s0 on the current platform. +.ie n .IP """UTF8_GOT_SHORT""" 4 +.el .IP "\f(CWUTF8_GOT_SHORT\fR" 4 +.IX Item "UTF8_GOT_SHORT" +The input sequence was malformed in that \f(CW\*(C`curlen\*(C'\fR is smaller than required for +a complete sequence. In other words, the input is for a partial character +sequence. +.Sp +\&\f(CW\*(C`UTF8_GOT_SHORT\*(C'\fR and \f(CW\*(C`UTF8_GOT_NON_CONTINUATION\*(C'\fR both indicate a too short +sequence. The difference is that \f(CW\*(C`UTF8_GOT_NON_CONTINUATION\*(C'\fR indicates always +that there is an error, while \f(CW\*(C`UTF8_GOT_SHORT\*(C'\fR means that an incomplete +sequence was looked at. If no other flags are present, it means that the +sequence was valid as far as it went. Depending on the application, this could +mean one of three things: +.RS 4 +.IP "\(bu" 4 +The \f(CW\*(C`curlen\*(C'\fR length parameter passed in was too small, and the function was +prevented from examining all the necessary bytes. +.IP "\(bu" 4 +The buffer being looked at is based on reading data, and the data received so +far stopped in the middle of a character, so that the next read will +read the remainder of this character. (It is up to the caller to deal with the +split bytes somehow.) +.IP "\(bu" 4 +This is a real error, and the partial sequence is all we're going to get. +.RE +.RS 4 +.RE +.ie n .IP """UTF8_GOT_SUPER""" 4 +.el .IP "\f(CWUTF8_GOT_SUPER\fR" 4 +.IX Item "UTF8_GOT_SUPER" +The input sequence was malformed in that it is for a non-Unicode code point; +that is, one above the legal Unicode maximum. +This bit is set only if the input \f(CW\*(C`flags\*(C'\fR parameter contains either the +\&\f(CW\*(C`UTF8_DISALLOW_SUPER\*(C'\fR or the \f(CW\*(C`UTF8_WARN_SUPER\*(C'\fR flags. +.ie n .IP """UTF8_GOT_SURROGATE""" 4 +.el .IP "\f(CWUTF8_GOT_SURROGATE\fR" 4 +.IX Item "UTF8_GOT_SURROGATE" +The input sequence was malformed in that it is for a \-Unicode \s-1UTF\-16\s0 surrogate +code point. +This bit is set only if the input \f(CW\*(C`flags\*(C'\fR parameter contains either the +\&\f(CW\*(C`UTF8_DISALLOW_SURROGATE\*(C'\fR or the \f(CW\*(C`UTF8_WARN_SURROGATE\*(C'\fR flags. +.RE +.RS 8 +.Sp +To do your own error handling, call this function with the \f(CW\*(C`UTF8_CHECK_ONLY\*(C'\fR +flag to suppress any warnings, and then examine the \f(CW*errors\fR return. +.Sp +.Vb 4 +\& UV utf8n_to_uvchr_error(const U8 *s, STRLEN curlen, +\& STRLEN *retlen, +\& const U32 flags, +\& U32 * errors) +.Ve +.RE +.IP "utf8n_to_uvchr_msgs" 8 +.IX Xref "utf8n_to_uvchr_msgs" +.IX Item "utf8n_to_uvchr_msgs" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +\&\s-1THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES.\s0 +Most code should use \*(L"utf8_to_uvchr_buf\*(R"() rather than call this +directly. +.Sp +This function is for code that needs to know what the precise malformation(s) +are when an error is found, and wants the corresponding warning and/or error +messages to be returned to the caller rather than be displayed. All messages +that would have been displayed if all lexcial warnings are enabled will be +returned. +.Sp +It is just like \f(CW"utf8n_to_uvchr_error"\fR but it takes an extra parameter +placed after all the others, \f(CW\*(C`msgs\*(C'\fR. If this parameter is 0, this function +behaves identically to \f(CW"utf8n_to_uvchr_error"\fR. Otherwise, \f(CW\*(C`msgs\*(C'\fR should +be a pointer to an \f(CW\*(C`AV *\*(C'\fR variable, in which this function creates a new \s-1AV\s0 to +contain any appropriate messages. The elements of the array are ordered so +that the first message that would have been displayed is in the 0th element, +and so on. Each element is a hash with three key-value pairs, as follows: +.RS 8 +.ie n .IP """text""" 4 +.el .IP "\f(CWtext\fR" 4 +.IX Item "text" +The text of the message as a \f(CW\*(C`SVpv\*(C'\fR. +.ie n .IP """warn_categories""" 4 +.el .IP "\f(CWwarn_categories\fR" 4 +.IX Item "warn_categories" +The warning category (or categories) packed into a \f(CW\*(C`SVuv\*(C'\fR. +.ie n .IP """flag""" 4 +.el .IP "\f(CWflag\fR" 4 +.IX Item "flag" +A single flag bit associated with this message, in a \f(CW\*(C`SVuv\*(C'\fR. +The bit corresponds to some bit in the \f(CW*errors\fR return value, +such as \f(CW\*(C`UTF8_GOT_LONG\*(C'\fR. +.RE +.RS 8 +.Sp +It's important to note that specifying this parameter as non-null will cause +any warnings this function would otherwise generate to be suppressed, and +instead be placed in \f(CW*msgs\fR. The caller can check the lexical warnings state +(or not) when choosing what to do with the returned messages. +.Sp +If the flag \f(CW\*(C`UTF8_CHECK_ONLY\*(C'\fR is passed, no warnings are generated, and hence +no \s-1AV\s0 is created. +.Sp +The caller, of course, is responsible for freeing any returned \s-1AV.\s0 +.Sp +.Vb 4 +\& UV utf8n_to_uvchr_msgs(const U8 *s, STRLEN curlen, +\& STRLEN *retlen, +\& const U32 flags, +\& U32 * errors, AV ** msgs) +.Ve +.RE +.IP "\s-1UTF8SKIP\s0" 8 +.IX Xref "UTF8SKIP" +.IX Item "UTF8SKIP" +returns the number of bytes a non-malformed \s-1UTF\-8\s0 encoded character whose first +(perhaps only) byte is pointed to by \f(CW\*(C`s\*(C'\fR. +.Sp +If there is a possibility of malformed input, use instead: +.RS 8 +.ie n .IP """""UTF8_SAFE_SKIP"""" if you know the maximum ending pointer in the buffer pointed to by ""s""; or" 4 +.el .IP "``\f(CWUTF8_SAFE_SKIP\fR'' if you know the maximum ending pointer in the buffer pointed to by \f(CWs\fR; or" 4 +.IX Item """UTF8_SAFE_SKIP"" if you know the maximum ending pointer in the buffer pointed to by s; or" +.PD 0 +.ie n .IP """""UTF8_CHK_SKIP"""" if you don't know it." 4 +.el .IP "``\f(CWUTF8_CHK_SKIP\fR'' if you don't know it." 4 +.IX Item """UTF8_CHK_SKIP"" if you don't know it." +.RE +.RS 8 +.PD +.Sp +It is better to restructure your code so the end pointer is passed down so that +you know what it actually is at the point of this call, but if that isn't +possible, "\f(CW\*(C`UTF8_CHK_SKIP\*(C'\fR" can minimize the chance of accessing beyond the end +of the input buffer. +.Sp +.Vb 1 +\& STRLEN UTF8SKIP(char* s) +.Ve +.RE +.IP "\s-1UTF8_CHK_SKIP\s0" 8 +.IX Xref "UTF8_CHK_SKIP" +.IX Item "UTF8_CHK_SKIP" +This is a safer version of "\f(CW\*(C`UTF8SKIP\*(C'\fR", but still not as safe as +"\f(CW\*(C`UTF8_SAFE_SKIP\*(C'\fR". This version doesn't blindly assume that the input +string pointed to by \f(CW\*(C`s\*(C'\fR is well-formed, but verifies that there isn't a \s-1NUL\s0 +terminating character before the expected end of the next character in \f(CW\*(C`s\*(C'\fR. +The length \f(CW\*(C`UTF8_CHK_SKIP\*(C'\fR returns stops just before any such \s-1NUL.\s0 +.Sp +Perl tends to add NULs, as an insurance policy, after the end of strings in +\&\s-1SV\s0's, so it is likely that using this macro will prevent inadvertent reading +beyond the end of the input buffer, even if it is malformed \s-1UTF\-8.\s0 +.Sp +This macro is intended to be used by \s-1XS\s0 modules where the inputs could be +malformed, and it isn't feasible to restructure to use the safer +"\f(CW\*(C`UTF8_SAFE_SKIP\*(C'\fR", for example when interfacing with a C library. +.Sp +.Vb 1 +\& STRLEN UTF8_CHK_SKIP(char* s) +.Ve +.IP "utf8_distance" 8 +.IX Xref "utf8_distance" +.IX Item "utf8_distance" +Returns the number of \s-1UTF\-8\s0 characters between the \s-1UTF\-8\s0 pointers \f(CW\*(C`a\*(C'\fR +and \f(CW\*(C`b\*(C'\fR. +.Sp +\&\s-1WARNING:\s0 use only if you *know* that the pointers point inside the +same \s-1UTF\-8\s0 buffer. +.Sp +.Vb 1 +\& IV utf8_distance(const U8 *a, const U8 *b) +.Ve +.IP "utf8_hop" 8 +.IX Xref "utf8_hop" +.IX Item "utf8_hop" +Return the \s-1UTF\-8\s0 pointer \f(CW\*(C`s\*(C'\fR displaced by \f(CW\*(C`off\*(C'\fR characters, either +forward or backward. +.Sp +\&\s-1WARNING:\s0 do not use the following unless you *know* \f(CW\*(C`off\*(C'\fR is within +the \s-1UTF\-8\s0 data pointed to by \f(CW\*(C`s\*(C'\fR *and* that on entry \f(CW\*(C`s\*(C'\fR is aligned +on the first byte of character or just after the last byte of a character. +.Sp +.Vb 1 +\& U8* utf8_hop(const U8 *s, SSize_t off) +.Ve +.IP "utf8_hop_back" 8 +.IX Xref "utf8_hop_back" +.IX Item "utf8_hop_back" +Return the \s-1UTF\-8\s0 pointer \f(CW\*(C`s\*(C'\fR displaced by up to \f(CW\*(C`off\*(C'\fR characters, +backward. +.Sp +\&\f(CW\*(C`off\*(C'\fR must be non-positive. +.Sp +\&\f(CW\*(C`s\*(C'\fR must be after or equal to \f(CW\*(C`start\*(C'\fR. +.Sp +When moving backward it will not move before \f(CW\*(C`start\*(C'\fR. +.Sp +Will not exceed this limit even if the string is not valid \*(L"\s-1UTF\-8\*(R".\s0 +.Sp +.Vb 2 +\& U8* utf8_hop_back(const U8 *s, SSize_t off, +\& const U8 *start) +.Ve +.IP "utf8_hop_forward" 8 +.IX Xref "utf8_hop_forward" +.IX Item "utf8_hop_forward" +Return the \s-1UTF\-8\s0 pointer \f(CW\*(C`s\*(C'\fR displaced by up to \f(CW\*(C`off\*(C'\fR characters, +forward. +.Sp +\&\f(CW\*(C`off\*(C'\fR must be non-negative. +.Sp +\&\f(CW\*(C`s\*(C'\fR must be before or equal to \f(CW\*(C`end\*(C'\fR. +.Sp +When moving forward it will not move beyond \f(CW\*(C`end\*(C'\fR. +.Sp +Will not exceed this limit even if the string is not valid \*(L"\s-1UTF\-8\*(R".\s0 +.Sp +.Vb 2 +\& U8* utf8_hop_forward(const U8 *s, SSize_t off, +\& const U8 *end) +.Ve +.IP "utf8_hop_safe" 8 +.IX Xref "utf8_hop_safe" +.IX Item "utf8_hop_safe" +Return the \s-1UTF\-8\s0 pointer \f(CW\*(C`s\*(C'\fR displaced by up to \f(CW\*(C`off\*(C'\fR characters, +either forward or backward. +.Sp +When moving backward it will not move before \f(CW\*(C`start\*(C'\fR. +.Sp +When moving forward it will not move beyond \f(CW\*(C`end\*(C'\fR. +.Sp +Will not exceed those limits even if the string is not valid \*(L"\s-1UTF\-8\*(R".\s0 +.Sp +.Vb 2 +\& U8* utf8_hop_safe(const U8 *s, SSize_t off, +\& const U8 *start, const U8 *end) +.Ve +.IP "\s-1UTF8_IS_INVARIANT\s0" 8 +.IX Xref "UTF8_IS_INVARIANT" +.IX Item "UTF8_IS_INVARIANT" +Evaluates to 1 if the byte \f(CW\*(C`c\*(C'\fR represents the same character when encoded in +\&\s-1UTF\-8\s0 as when not; otherwise evaluates to 0. \s-1UTF\-8\s0 invariant characters can be +copied as-is when converting to/from \s-1UTF\-8,\s0 saving time. +.Sp +In spite of the name, this macro gives the correct result if the input string +from which \f(CW\*(C`c\*(C'\fR comes is not encoded in \s-1UTF\-8.\s0 +.Sp +See \f(CW"UVCHR_IS_INVARIANT"\fR for checking if a \s-1UV\s0 is invariant. +.Sp +.Vb 1 +\& bool UTF8_IS_INVARIANT(char c) +.Ve +.IP "\s-1UTF8_IS_NONCHAR\s0" 8 +.IX Xref "UTF8_IS_NONCHAR" +.IX Item "UTF8_IS_NONCHAR" +Evaluates to non-zero if the first few bytes of the string starting at \f(CW\*(C`s\*(C'\fR and +looking no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR are well-formed \s-1UTF\-8\s0 that represents one +of the Unicode non-character code points; otherwise it evaluates to 0. If +non-zero, the value gives how many bytes starting at \f(CW\*(C`s\*(C'\fR comprise the code +point's representation. +.Sp +.Vb 1 +\& bool UTF8_IS_NONCHAR(const U8 *s, const U8 *e) +.Ve +.IP "\s-1UTF8_IS_SUPER\s0" 8 +.IX Xref "UTF8_IS_SUPER" +.IX Item "UTF8_IS_SUPER" +Recall that Perl recognizes an extension to \s-1UTF\-8\s0 that can encode code +points larger than the ones defined by Unicode, which are 0..0x10FFFF. +.Sp +This macro evaluates to non-zero if the first few bytes of the string starting +at \f(CW\*(C`s\*(C'\fR and looking no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR are from this \s-1UTF\-8\s0 extension; +otherwise it evaluates to 0. If non-zero, the value gives how many bytes +starting at \f(CW\*(C`s\*(C'\fR comprise the code point's representation. +.Sp +0 is returned if the bytes are not well-formed extended \s-1UTF\-8,\s0 or if they +represent a code point that cannot fit in a \s-1UV\s0 on the current platform. Hence +this macro can give different results when run on a 64\-bit word machine than on +one with a 32\-bit word size. +.Sp +Note that it is illegal to have code points that are larger than what can +fit in an \s-1IV\s0 on the current machine. +.Sp +.Vb 1 +\& bool UTF8_IS_SUPER(const U8 *s, const U8 *e) +.Ve +.IP "\s-1UTF8_IS_SURROGATE\s0" 8 +.IX Xref "UTF8_IS_SURROGATE" +.IX Item "UTF8_IS_SURROGATE" +Evaluates to non-zero if the first few bytes of the string starting at \f(CW\*(C`s\*(C'\fR and +looking no further than \f(CW\*(C`e\ \-\ 1\*(C'\fR are well-formed \s-1UTF\-8\s0 that represents one +of the Unicode surrogate code points; otherwise it evaluates to 0. If +non-zero, the value gives how many bytes starting at \f(CW\*(C`s\*(C'\fR comprise the code +point's representation. +.Sp +.Vb 1 +\& bool UTF8_IS_SURROGATE(const U8 *s, const U8 *e) +.Ve +.IP "utf8_length" 8 +.IX Xref "utf8_length" +.IX Item "utf8_length" +Returns the number of characters in the sequence of UTF\-8\-encoded bytes starting +at \f(CW\*(C`s\*(C'\fR and ending at the byte just before \f(CW\*(C`e\*(C'\fR. If and point to the +same place, it returns 0 with no warning raised. +.Sp +If \f(CW\*(C`e < s\*(C'\fR or if the scan would end up past \f(CW\*(C`e\*(C'\fR, it raises a \s-1UTF8\s0 warning +and returns the number of valid characters. +.Sp +.Vb 1 +\& STRLEN utf8_length(const U8* s, const U8 *e) +.Ve +.IP "\s-1UTF8_MAXBYTES\s0" 8 +.IX Xref "UTF8_MAXBYTES" +.IX Item "UTF8_MAXBYTES" +The maximum width of a single \s-1UTF\-8\s0 encoded character, in bytes. +.Sp +\&\s-1NOTE:\s0 Strictly speaking Perl's \s-1UTF\-8\s0 should not be called \s-1UTF\-8\s0 since \s-1UTF\-8\s0 +is an encoding of Unicode, and Unicode's upper limit, 0x10FFFF, can be +expressed with 4 bytes. However, Perl thinks of \s-1UTF\-8\s0 as a way to encode +non-negative integers in a binary format, even those above Unicode. +.IP "\s-1UTF8_MAXBYTES_CASE\s0" 8 +.IX Xref "UTF8_MAXBYTES_CASE" +.IX Item "UTF8_MAXBYTES_CASE" +The maximum number of \s-1UTF\-8\s0 bytes a single Unicode character can +uppercase/lowercase/titlecase/fold into. +.IP "\s-1UTF8_SAFE_SKIP\s0" 8 +.IX Xref "UTF8_SAFE_SKIP" +.IX Item "UTF8_SAFE_SKIP" +returns 0 if \f(CW\*(C`s\ >=\ e\*(C'\fR; otherwise returns the number of bytes in the +\&\s-1UTF\-8\s0 encoded character whose first byte is pointed to by \f(CW\*(C`s\*(C'\fR. But it never +returns beyond \f(CW\*(C`e\*(C'\fR. On \s-1DEBUGGING\s0 builds, it asserts that \f(CW\*(C`s\ <=\ e\*(C'\fR. +.Sp +.Vb 1 +\& STRLEN UTF8_SAFE_SKIP(char* s, char* e) +.Ve +.IP "\s-1UTF8_SKIP\s0" 8 +.IX Xref "UTF8_SKIP" +.IX Item "UTF8_SKIP" +This is a synonym for "\f(CW\*(C`UTF8SKIP\*(C'\fR" +.Sp +.Vb 1 +\& STRLEN UTF8_SKIP(char* s) +.Ve +.IP "utf8_to_bytes" 8 +.IX Xref "utf8_to_bytes" +.IX Item "utf8_to_bytes" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Converts a string \f(CW"s"\fR of length \f(CW*lenp\fR from \s-1UTF\-8\s0 into native byte encoding. +Unlike \*(L"bytes_to_utf8\*(R", this over-writes the original string, and +updates \f(CW*lenp\fR to contain the new length. +Returns zero on failure (leaving \f(CW"s"\fR unchanged) setting \f(CW*lenp\fR to \-1. +.Sp +Upon successful return, the number of variants in the string can be computed by +having saved the value of \f(CW*lenp\fR before the call, and subtracting the +after-call value of \f(CW*lenp\fR from it. +.Sp +If you need a copy of the string, see \*(L"bytes_from_utf8\*(R". +.Sp +.Vb 1 +\& U8* utf8_to_bytes(U8 *s, STRLEN *lenp) +.Ve +.IP "utf8_to_uvchr_buf" 8 +.IX Xref "utf8_to_uvchr_buf" +.IX Item "utf8_to_uvchr_buf" +Returns the native code point of the first character in the string \f(CW\*(C`s\*(C'\fR which +is assumed to be in \s-1UTF\-8\s0 encoding; \f(CW\*(C`send\*(C'\fR points to 1 beyond the end of \f(CW\*(C`s\*(C'\fR. +\&\f(CW*retlen\fR will be set to the length, in bytes, of that character. +.Sp +If \f(CW\*(C`s\*(C'\fR does not point to a well-formed \s-1UTF\-8\s0 character and \s-1UTF8\s0 warnings are +enabled, zero is returned and \f(CW*retlen\fR is set (if \f(CW\*(C`retlen\*(C'\fR isn't +\&\f(CW\*(C`NULL\*(C'\fR) to \-1. If those warnings are off, the computed value, if well-defined +(or the Unicode \s-1REPLACEMENT CHARACTER\s0 if not), is silently returned, and +\&\f(CW*retlen\fR is set (if \f(CW\*(C`retlen\*(C'\fR isn't \f(CW\*(C`NULL\*(C'\fR) so that (\f(CW\*(C`s\*(C'\fR\ +\ \f(CW*retlen\fR) is +the next possible position in \f(CW\*(C`s\*(C'\fR that could begin a non-malformed character. +See \*(L"utf8n_to_uvchr\*(R" for details on when the \s-1REPLACEMENT CHARACTER\s0 is +returned. +.Sp +.Vb 2 +\& UV utf8_to_uvchr_buf(const U8 *s, const U8 *send, +\& STRLEN *retlen) +.Ve +.IP "\s-1UVCHR_IS_INVARIANT\s0" 8 +.IX Xref "UVCHR_IS_INVARIANT" +.IX Item "UVCHR_IS_INVARIANT" +Evaluates to 1 if the representation of code point \f(CW\*(C`cp\*(C'\fR is the same whether or +not it is encoded in \s-1UTF\-8\s0; otherwise evaluates to 0. \s-1UTF\-8\s0 invariant +characters can be copied as-is when converting to/from \s-1UTF\-8,\s0 saving time. +\&\f(CW\*(C`cp\*(C'\fR is Unicode if above 255; otherwise is platform-native. +.Sp +.Vb 1 +\& bool UVCHR_IS_INVARIANT(UV cp) +.Ve +.IP "\s-1UVCHR_SKIP\s0" 8 +.IX Xref "UVCHR_SKIP" +.IX Item "UVCHR_SKIP" +returns the number of bytes required to represent the code point \f(CW\*(C`cp\*(C'\fR when +encoded as \s-1UTF\-8.\s0 \f(CW\*(C`cp\*(C'\fR is a native (\s-1ASCII\s0 or \s-1EBCDIC\s0) code point if less than +255; a Unicode code point otherwise. +.Sp +.Vb 1 +\& STRLEN UVCHR_SKIP(UV cp) +.Ve +.IP "uvchr_to_utf8" 8 +.IX Xref "uvchr_to_utf8" +.IX Item "uvchr_to_utf8" +Adds the \s-1UTF\-8\s0 representation of the native code point \f(CW\*(C`uv\*(C'\fR to the end +of the string \f(CW\*(C`d\*(C'\fR; \f(CW\*(C`d\*(C'\fR should have at least \f(CW\*(C`UVCHR_SKIP(uv)+1\*(C'\fR (up to +\&\f(CW\*(C`UTF8_MAXBYTES+1\*(C'\fR) free bytes available. The return value is the pointer to +the byte after the end of the new character. In other words, +.Sp +.Vb 1 +\& d = uvchr_to_utf8(d, uv); +.Ve +.Sp +is the recommended wide native character-aware way of saying +.Sp +.Vb 1 +\& *(d++) = uv; +.Ve +.Sp +This function accepts any code point from 0..\f(CW\*(C`IV_MAX\*(C'\fR as input. +\&\f(CW\*(C`IV_MAX\*(C'\fR is typically 0x7FFF_FFFF in a 32\-bit word. +.Sp +It is possible to forbid or warn on non-Unicode code points, or those that may +be problematic by using \*(L"uvchr_to_utf8_flags\*(R". +.Sp +.Vb 1 +\& U8* uvchr_to_utf8(U8 *d, UV uv) +.Ve +.IP "uvchr_to_utf8_flags" 8 +.IX Xref "uvchr_to_utf8_flags" +.IX Item "uvchr_to_utf8_flags" +Adds the \s-1UTF\-8\s0 representation of the native code point \f(CW\*(C`uv\*(C'\fR to the end +of the string \f(CW\*(C`d\*(C'\fR; \f(CW\*(C`d\*(C'\fR should have at least \f(CW\*(C`UVCHR_SKIP(uv)+1\*(C'\fR (up to +\&\f(CW\*(C`UTF8_MAXBYTES+1\*(C'\fR) free bytes available. The return value is the pointer to +the byte after the end of the new character. In other words, +.Sp +.Vb 1 +\& d = uvchr_to_utf8_flags(d, uv, flags); +.Ve +.Sp +or, in most cases, +.Sp +.Vb 1 +\& d = uvchr_to_utf8_flags(d, uv, 0); +.Ve +.Sp +This is the Unicode-aware way of saying +.Sp +.Vb 1 +\& *(d++) = uv; +.Ve +.Sp +If \f(CW\*(C`flags\*(C'\fR is 0, this function accepts any code point from 0..\f(CW\*(C`IV_MAX\*(C'\fR as +input. \f(CW\*(C`IV_MAX\*(C'\fR is typically 0x7FFF_FFFF in a 32\-bit word. +.Sp +Specifying \f(CW\*(C`flags\*(C'\fR can further restrict what is allowed and not warned on, as +follows: +.Sp +If \f(CW\*(C`uv\*(C'\fR is a Unicode surrogate code point and \f(CW\*(C`UNICODE_WARN_SURROGATE\*(C'\fR is set, +the function will raise a warning, provided \s-1UTF8\s0 warnings are enabled. If +instead \f(CW\*(C`UNICODE_DISALLOW_SURROGATE\*(C'\fR is set, the function will fail and return +\&\s-1NULL.\s0 If both flags are set, the function will both warn and return \s-1NULL.\s0 +.Sp +Similarly, the \f(CW\*(C`UNICODE_WARN_NONCHAR\*(C'\fR and \f(CW\*(C`UNICODE_DISALLOW_NONCHAR\*(C'\fR flags +affect how the function handles a Unicode non-character. +.Sp +And likewise, the \f(CW\*(C`UNICODE_WARN_SUPER\*(C'\fR and \f(CW\*(C`UNICODE_DISALLOW_SUPER\*(C'\fR flags +affect the handling of code points that are above the Unicode maximum of +0x10FFFF. Languages other than Perl may not be able to accept files that +contain these. +.Sp +The flag \f(CW\*(C`UNICODE_WARN_ILLEGAL_INTERCHANGE\*(C'\fR selects all three of +the above \s-1WARN\s0 flags; and \f(CW\*(C`UNICODE_DISALLOW_ILLEGAL_INTERCHANGE\*(C'\fR selects all +three \s-1DISALLOW\s0 flags. \f(CW\*(C`UNICODE_DISALLOW_ILLEGAL_INTERCHANGE\*(C'\fR restricts the +allowed inputs to the strict \s-1UTF\-8\s0 traditionally defined by Unicode. +Similarly, \f(CW\*(C`UNICODE_WARN_ILLEGAL_C9_INTERCHANGE\*(C'\fR and +\&\f(CW\*(C`UNICODE_DISALLOW_ILLEGAL_C9_INTERCHANGE\*(C'\fR are shortcuts to select the +above-Unicode and surrogate flags, but not the non-character ones, as +defined in +Unicode Corrigendum #9 . +See \*(L"Noncharacter code points\*(R" in perlunicode. +.Sp +Extremely high code points were never specified in any standard, and require an +extension to \s-1UTF\-8\s0 to express, which Perl does. It is likely that programs +written in something other than Perl would not be able to read files that +contain these; nor would Perl understand files written by something that uses a +different extension. For these reasons, there is a separate set of flags that +can warn and/or disallow these extremely high code points, even if other +above-Unicode ones are accepted. They are the \f(CW\*(C`UNICODE_WARN_PERL_EXTENDED\*(C'\fR +and \f(CW\*(C`UNICODE_DISALLOW_PERL_EXTENDED\*(C'\fR flags. For more information see +"\f(CW\*(C`UTF8_GOT_PERL_EXTENDED\*(C'\fR". Of course \f(CW\*(C`UNICODE_DISALLOW_SUPER\*(C'\fR will +treat all above-Unicode code points, including these, as malformations. (Note +that the Unicode standard considers anything above 0x10FFFF to be illegal, but +there are standards predating it that allow up to 0x7FFF_FFFF (2**31 \-1)) +.Sp +A somewhat misleadingly named synonym for \f(CW\*(C`UNICODE_WARN_PERL_EXTENDED\*(C'\fR is +retained for backward compatibility: \f(CW\*(C`UNICODE_WARN_ABOVE_31_BIT\*(C'\fR. Similarly, +\&\f(CW\*(C`UNICODE_DISALLOW_ABOVE_31_BIT\*(C'\fR is usable instead of the more accurately named +\&\f(CW\*(C`UNICODE_DISALLOW_PERL_EXTENDED\*(C'\fR. The names are misleading because on \s-1EBCDIC\s0 +platforms,these flags can apply to code points that actually do fit in 31 bits. +The new names accurately describe the situation in all cases. +.Sp +.Vb 1 +\& U8* uvchr_to_utf8_flags(U8 *d, UV uv, UV flags) +.Ve +.IP "uvchr_to_utf8_flags_msgs" 8 +.IX Xref "uvchr_to_utf8_flags_msgs" +.IX Item "uvchr_to_utf8_flags_msgs" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +\&\s-1THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES.\s0 +.Sp +Most code should use \f(CW\*(C`"uvchr_to_utf8_flags"()\*(C'\fR rather than call this directly. +.Sp +This function is for code that wants any warning and/or error messages to be +returned to the caller rather than be displayed. All messages that would have +been displayed if all lexical warnings are enabled will be returned. +.Sp +It is just like \f(CW"uvchr_to_utf8_flags"\fR but it takes an extra parameter +placed after all the others, \f(CW\*(C`msgs\*(C'\fR. If this parameter is 0, this function +behaves identically to \f(CW"uvchr_to_utf8_flags"\fR. Otherwise, \f(CW\*(C`msgs\*(C'\fR should +be a pointer to an \f(CW\*(C`HV *\*(C'\fR variable, in which this function creates a new \s-1HV\s0 to +contain any appropriate messages. The hash has three key-value pairs, as +follows: +.RS 8 +.ie n .IP """text""" 4 +.el .IP "\f(CWtext\fR" 4 +.IX Item "text" +The text of the message as a \f(CW\*(C`SVpv\*(C'\fR. +.ie n .IP """warn_categories""" 4 +.el .IP "\f(CWwarn_categories\fR" 4 +.IX Item "warn_categories" +The warning category (or categories) packed into a \f(CW\*(C`SVuv\*(C'\fR. +.ie n .IP """flag""" 4 +.el .IP "\f(CWflag\fR" 4 +.IX Item "flag" +A single flag bit associated with this message, in a \f(CW\*(C`SVuv\*(C'\fR. +The bit corresponds to some bit in the \f(CW*errors\fR return value, +such as \f(CW\*(C`UNICODE_GOT_SURROGATE\*(C'\fR. +.RE +.RS 8 +.Sp +It's important to note that specifying this parameter as non-null will cause +any warnings this function would otherwise generate to be suppressed, and +instead be placed in \f(CW*msgs\fR. The caller can check the lexical warnings state +(or not) when choosing what to do with the returned messages. +.Sp +The caller, of course, is responsible for freeing any returned \s-1HV.\s0 +.Sp +.Vb 2 +\& U8* uvchr_to_utf8_flags_msgs(U8 *d, UV uv, UV flags, +\& HV ** msgs) +.Ve +.RE +.ie n .SH "Variables created by ""xsubpp"" and ""xsubpp"" internal functions" +.el .SH "Variables created by \f(CWxsubpp\fP and \f(CWxsubpp\fP internal functions" +.IX Header "Variables created by xsubpp and xsubpp internal functions" +.IP "newXSproto" 8 +.IX Xref "newXSproto" +.IX Item "newXSproto" +Used by \f(CW\*(C`xsubpp\*(C'\fR to hook up XSUBs as Perl subs. Adds Perl prototypes to +the subs. +.IP "\s-1XS_APIVERSION_BOOTCHECK\s0" 8 +.IX Xref "XS_APIVERSION_BOOTCHECK" +.IX Item "XS_APIVERSION_BOOTCHECK" +Macro to verify that the perl api version an \s-1XS\s0 module has been compiled against +matches the api version of the perl interpreter it's being loaded into. +.Sp +.Vb 1 +\& XS_APIVERSION_BOOTCHECK; +.Ve +.IP "\s-1XS_VERSION\s0" 8 +.IX Xref "XS_VERSION" +.IX Item "XS_VERSION" +The version identifier for an \s-1XS\s0 module. This is usually +handled automatically by \f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR. See +\&\f(CW"XS_VERSION_BOOTCHECK"\fR. +.IP "\s-1XS_VERSION_BOOTCHECK\s0" 8 +.IX Xref "XS_VERSION_BOOTCHECK" +.IX Item "XS_VERSION_BOOTCHECK" +Macro to verify that a \s-1PM\s0 module's \f(CW$VERSION\fR variable matches the \s-1XS\s0 +module's \f(CW\*(C`XS_VERSION\*(C'\fR variable. This is usually handled automatically by +\&\f(CW\*(C`xsubpp\*(C'\fR. See \*(L"The \s-1VERSIONCHECK:\s0 Keyword\*(R" in perlxs. +.Sp +.Vb 1 +\& XS_VERSION_BOOTCHECK; +.Ve +.SH "Warning and Dieing" +.IX Header "Warning and Dieing" +In all these calls, the \f(CW\*(C`U32 w\f(CIn\f(CW\*(C'\fR parameters are warning category +constants. You can see the ones currently available in +\&\*(L"Category Hierarchy\*(R" in warnings, just capitalize all letters in the names +and prefix them by \f(CW\*(C`WARN_\*(C'\fR. So, for example, the category \f(CW\*(C`void\*(C'\fR used in a +perl program becomes \f(CW\*(C`WARN_VOID\*(C'\fR when used in \s-1XS\s0 code and passed to one of +the calls below. +.IP "ckWARN" 8 +.IX Xref "ckWARN" +.IX Item "ckWARN" +Returns a boolean as to whether or not warnings are enabled for the warning +category \f(CW\*(C`w\*(C'\fR. If the category is by default enabled even if not within the +scope of \f(CW\*(C`use\ warnings\*(C'\fR, instead use the \*(L"ckWARN_d\*(R" macro. +.Sp +.Vb 1 +\& bool ckWARN(U32 w) +.Ve +.IP "ckWARN2" 8 +.IX Xref "ckWARN2" +.IX Item "ckWARN2" +Like \f(CW"ckWARN"\fR, but takes two warnings categories as input, and returns +\&\s-1TRUE\s0 if either is enabled. If either category is by default enabled even if +not within the scope of \f(CW\*(C`use\ warnings\*(C'\fR, instead use the \*(L"ckWARN2_d\*(R" +macro. The categories must be completely independent, one may not be +subclassed from the other. +.Sp +.Vb 1 +\& bool ckWARN2(U32 w1, U32 w2) +.Ve +.IP "ckWARN3" 8 +.IX Xref "ckWARN3" +.IX Item "ckWARN3" +Like \f(CW"ckWARN2"\fR, but takes three warnings categories as input, and returns +\&\s-1TRUE\s0 if any is enabled. If any of the categories is by default enabled even +if not within the scope of \f(CW\*(C`use\ warnings\*(C'\fR, instead use the \*(L"ckWARN3_d\*(R" +macro. The categories must be completely independent, one may not be +subclassed from any other. +.Sp +.Vb 1 +\& bool ckWARN3(U32 w1, U32 w2, U32 w3) +.Ve +.IP "ckWARN4" 8 +.IX Xref "ckWARN4" +.IX Item "ckWARN4" +Like \f(CW"ckWARN3"\fR, but takes four warnings categories as input, and returns +\&\s-1TRUE\s0 if any is enabled. If any of the categories is by default enabled even +if not within the scope of \f(CW\*(C`use\ warnings\*(C'\fR, instead use the \*(L"ckWARN4_d\*(R" +macro. The categories must be completely independent, one may not be +subclassed from any other. +.Sp +.Vb 1 +\& bool ckWARN4(U32 w1, U32 w2, U32 w3, U32 w4) +.Ve +.IP "ckWARN_d" 8 +.IX Xref "ckWARN_d" +.IX Item "ckWARN_d" +Like \f(CW"ckWARN"\fR, but for use if and only if the warning category is by +default enabled even if not within the scope of \f(CW\*(C`use\ warnings\*(C'\fR. +.Sp +.Vb 1 +\& bool ckWARN_d(U32 w) +.Ve +.IP "ckWARN2_d" 8 +.IX Xref "ckWARN2_d" +.IX Item "ckWARN2_d" +Like \f(CW"ckWARN2"\fR, but for use if and only if either warning category is by +default enabled even if not within the scope of \f(CW\*(C`use\ warnings\*(C'\fR. +.Sp +.Vb 1 +\& bool ckWARN2_d(U32 w1, U32 w2) +.Ve +.IP "ckWARN3_d" 8 +.IX Xref "ckWARN3_d" +.IX Item "ckWARN3_d" +Like \f(CW"ckWARN3"\fR, but for use if and only if any of the warning categories +is by default enabled even if not within the scope of \f(CW\*(C`use\ warnings\*(C'\fR. +.Sp +.Vb 1 +\& bool ckWARN3_d(U32 w1, U32 w2, U32 w3) +.Ve +.IP "ckWARN4_d" 8 +.IX Xref "ckWARN4_d" +.IX Item "ckWARN4_d" +Like \f(CW"ckWARN4"\fR, but for use if and only if any of the warning categories +is by default enabled even if not within the scope of \f(CW\*(C`use\ warnings\*(C'\fR. +.Sp +.Vb 1 +\& bool ckWARN4_d(U32 w1, U32 w2, U32 w3, U32 w4) +.Ve +.IP "\s-1CLEAR_ERRSV\s0" 8 +.IX Xref "CLEAR_ERRSV" +.IX Item "CLEAR_ERRSV" +Clear the contents of \f(CW$@\fR, setting it to the empty string. +.Sp +This replaces any read-only \s-1SV\s0 with a fresh \s-1SV\s0 and removes any magic. +.Sp +.Vb 1 +\& void CLEAR_ERRSV() +.Ve +.IP "croak" 8 +.IX Xref "croak" +.IX Item "croak" +This is an \s-1XS\s0 interface to Perl's \f(CW\*(C`die\*(C'\fR function. +.Sp +Take a sprintf-style format pattern and argument list. These are used to +generate a string message. If the message does not end with a newline, +then it will be extended with some indication of the current location +in the code, as described for \*(L"mess_sv\*(R". +.Sp +The error message will be used as an exception, by default +returning control to the nearest enclosing \f(CW\*(C`eval\*(C'\fR, but subject to +modification by a \f(CW$SIG{_\|_DIE_\|_}\fR handler. In any case, the \f(CW\*(C`croak\*(C'\fR +function never returns normally. +.Sp +For historical reasons, if \f(CW\*(C`pat\*(C'\fR is null then the contents of \f(CW\*(C`ERRSV\*(C'\fR +(\f(CW$@\fR) will be used as an error message or object instead of building an +error message from arguments. If you want to throw a non-string object, +or build an error message in an \s-1SV\s0 yourself, it is preferable to use +the \*(L"croak_sv\*(R" function, which does not involve clobbering \f(CW\*(C`ERRSV\*(C'\fR. +.Sp +.Vb 1 +\& void croak(const char* pat, ...) +.Ve +.IP "croak_no_modify" 8 +.IX Xref "croak_no_modify" +.IX Item "croak_no_modify" +Exactly equivalent to \f(CW\*(C`Perl_croak(aTHX_ "%s", PL_no_modify)\*(C'\fR, but generates +terser object code than using \f(CW\*(C`Perl_croak\*(C'\fR. Less code used on exception code +paths reduces \s-1CPU\s0 cache pressure. +.Sp +.Vb 1 +\& void croak_no_modify() +.Ve +.IP "croak_sv" 8 +.IX Xref "croak_sv" +.IX Item "croak_sv" +This is an \s-1XS\s0 interface to Perl's \f(CW\*(C`die\*(C'\fR function. +.Sp +\&\f(CW\*(C`baseex\*(C'\fR is the error message or object. If it is a reference, it +will be used as-is. Otherwise it is used as a string, and if it does +not end with a newline then it will be extended with some indication of +the current location in the code, as described for \*(L"mess_sv\*(R". +.Sp +The error message or object will be used as an exception, by default +returning control to the nearest enclosing \f(CW\*(C`eval\*(C'\fR, but subject to +modification by a \f(CW$SIG{_\|_DIE_\|_}\fR handler. In any case, the \f(CW\*(C`croak_sv\*(C'\fR +function never returns normally. +.Sp +To die with a simple string message, the \*(L"croak\*(R" function may be +more convenient. +.Sp +.Vb 1 +\& void croak_sv(SV *baseex) +.Ve +.IP "die" 8 +.IX Xref "die" +.IX Item "die" +Behaves the same as \*(L"croak\*(R", except for the return type. +It should be used only where the \f(CW\*(C`OP *\*(C'\fR return type is required. +The function never actually returns. +.Sp +.Vb 1 +\& OP* die(const char* pat, ...) +.Ve +.IP "die_sv" 8 +.IX Xref "die_sv" +.IX Item "die_sv" +Behaves the same as \*(L"croak_sv\*(R", except for the return type. +It should be used only where the \f(CW\*(C`OP *\*(C'\fR return type is required. +The function never actually returns. +.Sp +.Vb 1 +\& OP* die_sv(SV *baseex) +.Ve +.IP "\s-1ERRSV\s0" 8 +.IX Xref "ERRSV" +.IX Item "ERRSV" +Returns the \s-1SV\s0 for \f(CW$@\fR, creating it if needed. +.Sp +.Vb 1 +\& SV * ERRSV +.Ve +.IP "my_setenv" 8 +.IX Xref "my_setenv" +.IX Item "my_setenv" +A wrapper for the C library \fBsetenv\fR\|(3). Don't use the latter, as the perl +version has desirable safeguards +.Sp +.Vb 1 +\& void my_setenv(const char* nam, const char* val) +.Ve +.IP "rsignal" 8 +.IX Xref "rsignal" +.IX Item "rsignal" +A wrapper for the C library \fBsignal\fR\|(2). Don't use the latter, as the Perl +version knows things that interact with the rest of the perl interpreter. +.Sp +.Vb 1 +\& Sighandler_t rsignal(int i, Sighandler_t t) +.Ve +.IP "\s-1SANE_ERRSV\s0" 8 +.IX Xref "SANE_ERRSV" +.IX Item "SANE_ERRSV" +Clean up \s-1ERRSV\s0 so we can safely set it. +.Sp +This replaces any read-only \s-1SV\s0 with a fresh writable copy and removes +any magic. +.Sp +.Vb 1 +\& void SANE_ERRSV() +.Ve +.IP "vcroak" 8 +.IX Xref "vcroak" +.IX Item "vcroak" +This is an \s-1XS\s0 interface to Perl's \f(CW\*(C`die\*(C'\fR function. +.Sp +\&\f(CW\*(C`pat\*(C'\fR and \f(CW\*(C`args\*(C'\fR are a sprintf-style format pattern and encapsulated +argument list. These are used to generate a string message. If the +message does not end with a newline, then it will be extended with +some indication of the current location in the code, as described for +\&\*(L"mess_sv\*(R". +.Sp +The error message will be used as an exception, by default +returning control to the nearest enclosing \f(CW\*(C`eval\*(C'\fR, but subject to +modification by a \f(CW$SIG{_\|_DIE_\|_}\fR handler. In any case, the \f(CW\*(C`croak\*(C'\fR +function never returns normally. +.Sp +For historical reasons, if \f(CW\*(C`pat\*(C'\fR is null then the contents of \f(CW\*(C`ERRSV\*(C'\fR +(\f(CW$@\fR) will be used as an error message or object instead of building an +error message from arguments. If you want to throw a non-string object, +or build an error message in an \s-1SV\s0 yourself, it is preferable to use +the \*(L"croak_sv\*(R" function, which does not involve clobbering \f(CW\*(C`ERRSV\*(C'\fR. +.Sp +.Vb 1 +\& void vcroak(const char* pat, va_list* args) +.Ve +.IP "vwarn" 8 +.IX Xref "vwarn" +.IX Item "vwarn" +This is an \s-1XS\s0 interface to Perl's \f(CW\*(C`warn\*(C'\fR function. +.Sp +\&\f(CW\*(C`pat\*(C'\fR and \f(CW\*(C`args\*(C'\fR are a sprintf-style format pattern and encapsulated +argument list. These are used to generate a string message. If the +message does not end with a newline, then it will be extended with +some indication of the current location in the code, as described for +\&\*(L"mess_sv\*(R". +.Sp +The error message or object will by default be written to standard error, +but this is subject to modification by a \f(CW$SIG{_\|_WARN_\|_}\fR handler. +.Sp +Unlike with \*(L"vcroak\*(R", \f(CW\*(C`pat\*(C'\fR is not permitted to be null. +.Sp +.Vb 1 +\& void vwarn(const char* pat, va_list* args) +.Ve +.IP "warn" 8 +.IX Xref "warn" +.IX Item "warn" +This is an \s-1XS\s0 interface to Perl's \f(CW\*(C`warn\*(C'\fR function. +.Sp +Take a sprintf-style format pattern and argument list. These are used to +generate a string message. If the message does not end with a newline, +then it will be extended with some indication of the current location +in the code, as described for \*(L"mess_sv\*(R". +.Sp +The error message or object will by default be written to standard error, +but this is subject to modification by a \f(CW$SIG{_\|_WARN_\|_}\fR handler. +.Sp +Unlike with \*(L"croak\*(R", \f(CW\*(C`pat\*(C'\fR is not permitted to be null. +.Sp +.Vb 1 +\& void warn(const char* pat, ...) +.Ve +.IP "warn_sv" 8 +.IX Xref "warn_sv" +.IX Item "warn_sv" +This is an \s-1XS\s0 interface to Perl's \f(CW\*(C`warn\*(C'\fR function. +.Sp +\&\f(CW\*(C`baseex\*(C'\fR is the error message or object. If it is a reference, it +will be used as-is. Otherwise it is used as a string, and if it does +not end with a newline then it will be extended with some indication of +the current location in the code, as described for \*(L"mess_sv\*(R". +.Sp +The error message or object will by default be written to standard error, +but this is subject to modification by a \f(CW$SIG{_\|_WARN_\|_}\fR handler. +.Sp +To warn with a simple string message, the \*(L"warn\*(R" function may be +more convenient. +.Sp +.Vb 1 +\& void warn_sv(SV *baseex) +.Ve +.SH "Undocumented functions" +.IX Header "Undocumented functions" +The following functions have been flagged as part of the public \s-1API,\s0 +but are currently undocumented. Use them at your own risk, as the +interfaces are subject to change. Functions that are not listed in this +document are not intended for public use, and should \s-1NOT\s0 be used under any +circumstances. +.PP +If you feel you need to use one of these functions, first send email to +perl5\-porters@perl.org . It may be +that there is a good reason for the function not being documented, and it +should be removed from this list; or it may just be that no one has gotten +around to documenting it. In the latter case, you will be asked to submit a +patch to document the function. Once your patch is accepted, it will indicate +that the interface is stable (unless it is explicitly marked otherwise) and +usable by you. +.IP "CvDEPTH" 4 +.IX Xref "CvDEPTH" +.IX Item "CvDEPTH" +.PD 0 +.IP "CvGV" 4 +.IX Xref "CvGV" +.IX Item "CvGV" +.IP "GetVars" 4 +.IX Xref "GetVars" +.IX Item "GetVars" +.IP "Gv_AMupdate" 4 +.IX Xref "Gv_AMupdate" +.IX Item "Gv_AMupdate" +.IP "PerlIO_close" 4 +.IX Xref "PerlIO_close" +.IX Item "PerlIO_close" +.IP "PerlIO_context_layers" 4 +.IX Xref "PerlIO_context_layers" +.IX Item "PerlIO_context_layers" +.IP "PerlIO_error" 4 +.IX Xref "PerlIO_error" +.IX Item "PerlIO_error" +.IP "PerlIO_fill" 4 +.IX Xref "PerlIO_fill" +.IX Item "PerlIO_fill" +.IP "PerlIO_flush" 4 +.IX Xref "PerlIO_flush" +.IX Item "PerlIO_flush" +.IP "PerlIO_get_bufsiz" 4 +.IX Xref "PerlIO_get_bufsiz" +.IX Item "PerlIO_get_bufsiz" +.IP "PerlIO_get_ptr" 4 +.IX Xref "PerlIO_get_ptr" +.IX Item "PerlIO_get_ptr" +.IP "PerlIO_read" 4 +.IX Xref "PerlIO_read" +.IX Item "PerlIO_read" +.IP "PerlIO_seek" 4 +.IX Xref "PerlIO_seek" +.IX Item "PerlIO_seek" +.IP "PerlIO_set_cnt" 4 +.IX Xref "PerlIO_set_cnt" +.IX Item "PerlIO_set_cnt" +.IP "PerlIO_setlinebuf" 4 +.IX Xref "PerlIO_setlinebuf" +.IX Item "PerlIO_setlinebuf" +.IP "PerlIO_stdout" 4 +.IX Xref "PerlIO_stdout" +.IX Item "PerlIO_stdout" +.IP "PerlIO_unread" 4 +.IX Xref "PerlIO_unread" +.IX Item "PerlIO_unread" +.IP "SvAMAGIC_off" 4 +.IX Xref "SvAMAGIC_off" +.IX Item "SvAMAGIC_off" +.IP "SvAMAGIC_on" 4 +.IX Xref "SvAMAGIC_on" +.IX Item "SvAMAGIC_on" +.IP "amagic_call" 4 +.IX Xref "amagic_call" +.IX Item "amagic_call" +.IP "amagic_deref_call" 4 +.IX Xref "amagic_deref_call" +.IX Item "amagic_deref_call" +.IP "any_dup" 4 +.IX Xref "any_dup" +.IX Item "any_dup" +.IP "atfork_lock" 4 +.IX Xref "atfork_lock" +.IX Item "atfork_lock" +.IP "atfork_unlock" 4 +.IX Xref "atfork_unlock" +.IX Item "atfork_unlock" +.IP "av_arylen_p" 4 +.IX Xref "av_arylen_p" +.IX Item "av_arylen_p" +.IP "av_iter_p" 4 +.IX Xref "av_iter_p" +.IX Item "av_iter_p" +.IP "block_gimme" 4 +.IX Xref "block_gimme" +.IX Item "block_gimme" +.IP "call_atexit" 4 +.IX Xref "call_atexit" +.IX Item "call_atexit" +.IP "call_list" 4 +.IX Xref "call_list" +.IX Item "call_list" +.IP "calloc" 4 +.IX Xref "calloc" +.IX Item "calloc" +.IP "cast_i32" 4 +.IX Xref "cast_i32" +.IX Item "cast_i32" +.IP "cast_iv" 4 +.IX Xref "cast_iv" +.IX Item "cast_iv" +.IP "cast_ulong" 4 +.IX Xref "cast_ulong" +.IX Item "cast_ulong" +.IP "cast_uv" 4 +.IX Xref "cast_uv" +.IX Item "cast_uv" +.IP "ck_warner" 4 +.IX Xref "ck_warner" +.IX Item "ck_warner" +.IP "ck_warner_d" 4 +.IX Xref "ck_warner_d" +.IX Item "ck_warner_d" +.IP "ckwarn" 4 +.IX Xref "ckwarn" +.IX Item "ckwarn" +.IP "ckwarn_d" 4 +.IX Xref "ckwarn_d" +.IX Item "ckwarn_d" +.IP "clear_defarray" 4 +.IX Xref "clear_defarray" +.IX Item "clear_defarray" +.IP "clone_params_del" 4 +.IX Xref "clone_params_del" +.IX Item "clone_params_del" +.IP "clone_params_new" 4 +.IX Xref "clone_params_new" +.IX Item "clone_params_new" +.IP "croak_nocontext" 4 +.IX Xref "croak_nocontext" +.IX Item "croak_nocontext" +.IP "csighandler" 4 +.IX Xref "csighandler" +.IX Item "csighandler" +.IP "csighandler1" 4 +.IX Xref "csighandler1" +.IX Item "csighandler1" +.IP "csighandler3" 4 +.IX Xref "csighandler3" +.IX Item "csighandler3" +.IP "cx_dump" 4 +.IX Xref "cx_dump" +.IX Item "cx_dump" +.IP "cx_dup" 4 +.IX Xref "cx_dup" +.IX Item "cx_dup" +.IP "cxinc" 4 +.IX Xref "cxinc" +.IX Item "cxinc" +.IP "deb" 4 +.IX Xref "deb" +.IX Item "deb" +.IP "deb_nocontext" 4 +.IX Xref "deb_nocontext" +.IX Item "deb_nocontext" +.IP "debop" 4 +.IX Xref "debop" +.IX Item "debop" +.IP "debprofdump" 4 +.IX Xref "debprofdump" +.IX Item "debprofdump" +.IP "debstack" 4 +.IX Xref "debstack" +.IX Item "debstack" +.IP "debstackptrs" 4 +.IX Xref "debstackptrs" +.IX Item "debstackptrs" +.IP "delimcpy" 4 +.IX Xref "delimcpy" +.IX Item "delimcpy" +.IP "despatch_signals" 4 +.IX Xref "despatch_signals" +.IX Item "despatch_signals" +.IP "die_nocontext" 4 +.IX Xref "die_nocontext" +.IX Item "die_nocontext" +.IP "dirp_dup" 4 +.IX Xref "dirp_dup" +.IX Item "dirp_dup" +.IP "do_aspawn" 4 +.IX Xref "do_aspawn" +.IX Item "do_aspawn" +.IP "do_close" 4 +.IX Xref "do_close" +.IX Item "do_close" +.IP "do_gv_dump" 4 +.IX Xref "do_gv_dump" +.IX Item "do_gv_dump" +.IP "do_gvgv_dump" 4 +.IX Xref "do_gvgv_dump" +.IX Item "do_gvgv_dump" +.IP "do_hv_dump" 4 +.IX Xref "do_hv_dump" +.IX Item "do_hv_dump" +.IP "do_join" 4 +.IX Xref "do_join" +.IX Item "do_join" +.IP "do_magic_dump" 4 +.IX Xref "do_magic_dump" +.IX Item "do_magic_dump" +.IP "do_op_dump" 4 +.IX Xref "do_op_dump" +.IX Item "do_op_dump" +.IP "do_open" 4 +.IX Xref "do_open" +.IX Item "do_open" +.IP "do_openn" 4 +.IX Xref "do_openn" +.IX Item "do_openn" +.IP "do_pmop_dump" 4 +.IX Xref "do_pmop_dump" +.IX Item "do_pmop_dump" +.IP "do_spawn" 4 +.IX Xref "do_spawn" +.IX Item "do_spawn" +.IP "do_spawn_nowait" 4 +.IX Xref "do_spawn_nowait" +.IX Item "do_spawn_nowait" +.IP "do_sprintf" 4 +.IX Xref "do_sprintf" +.IX Item "do_sprintf" +.IP "do_sv_dump" 4 +.IX Xref "do_sv_dump" +.IX Item "do_sv_dump" +.IP "doing_taint" 4 +.IX Xref "doing_taint" +.IX Item "doing_taint" +.IP "doref" 4 +.IX Xref "doref" +.IX Item "doref" +.IP "dounwind" 4 +.IX Xref "dounwind" +.IX Item "dounwind" +.IP "dowantarray" 4 +.IX Xref "dowantarray" +.IX Item "dowantarray" +.IP "dump_eval" 4 +.IX Xref "dump_eval" +.IX Item "dump_eval" +.IP "dump_form" 4 +.IX Xref "dump_form" +.IX Item "dump_form" +.IP "dump_indent" 4 +.IX Xref "dump_indent" +.IX Item "dump_indent" +.IP "dump_mstats" 4 +.IX Xref "dump_mstats" +.IX Item "dump_mstats" +.IP "dump_sub" 4 +.IX Xref "dump_sub" +.IX Item "dump_sub" +.IP "dump_vindent" 4 +.IX Xref "dump_vindent" +.IX Item "dump_vindent" +.IP "filter_del" 4 +.IX Xref "filter_del" +.IX Item "filter_del" +.IP "filter_read" 4 +.IX Xref "filter_read" +.IX Item "filter_read" +.IP "foldEQ_latin1" 4 +.IX Xref "foldEQ_latin1" +.IX Item "foldEQ_latin1" +.IP "form_nocontext" 4 +.IX Xref "form_nocontext" +.IX Item "form_nocontext" +.IP "fp_dup" 4 +.IX Xref "fp_dup" +.IX Item "fp_dup" +.IP "free_global_struct" 4 +.IX Xref "free_global_struct" +.IX Item "free_global_struct" +.IP "free_tmps" 4 +.IX Xref "free_tmps" +.IX Item "free_tmps" +.IP "get_context" 4 +.IX Xref "get_context" +.IX Item "get_context" +.IP "get_mstats" 4 +.IX Xref "get_mstats" +.IX Item "get_mstats" +.IP "get_op_descs" 4 +.IX Xref "get_op_descs" +.IX Item "get_op_descs" +.IP "get_op_names" 4 +.IX Xref "get_op_names" +.IX Item "get_op_names" +.IP "get_ppaddr" 4 +.IX Xref "get_ppaddr" +.IX Item "get_ppaddr" +.IP "get_vtbl" 4 +.IX Xref "get_vtbl" +.IX Item "get_vtbl" +.IP "gp_dup" 4 +.IX Xref "gp_dup" +.IX Item "gp_dup" +.IP "gp_free" 4 +.IX Xref "gp_free" +.IX Item "gp_free" +.IP "gp_ref" 4 +.IX Xref "gp_ref" +.IX Item "gp_ref" +.IP "gv_AVadd" 4 +.IX Xref "gv_AVadd" +.IX Item "gv_AVadd" +.IP "gv_HVadd" 4 +.IX Xref "gv_HVadd" +.IX Item "gv_HVadd" +.IP "gv_IOadd" 4 +.IX Xref "gv_IOadd" +.IX Item "gv_IOadd" +.IP "gv_SVadd" 4 +.IX Xref "gv_SVadd" +.IX Item "gv_SVadd" +.IP "gv_add_by_type" 4 +.IX Xref "gv_add_by_type" +.IX Item "gv_add_by_type" +.IP "gv_autoload4" 4 +.IX Xref "gv_autoload4" +.IX Item "gv_autoload4" +.IP "gv_autoload_pv" 4 +.IX Xref "gv_autoload_pv" +.IX Item "gv_autoload_pv" +.IP "gv_autoload_pvn" 4 +.IX Xref "gv_autoload_pvn" +.IX Item "gv_autoload_pvn" +.IP "gv_autoload_sv" 4 +.IX Xref "gv_autoload_sv" +.IX Item "gv_autoload_sv" +.IP "gv_check" 4 +.IX Xref "gv_check" +.IX Item "gv_check" +.IP "gv_dump" 4 +.IX Xref "gv_dump" +.IX Item "gv_dump" +.IP "gv_efullname3" 4 +.IX Xref "gv_efullname3" +.IX Item "gv_efullname3" +.IP "gv_efullname4" 4 +.IX Xref "gv_efullname4" +.IX Item "gv_efullname4" +.IP "gv_fetchfile" 4 +.IX Xref "gv_fetchfile" +.IX Item "gv_fetchfile" +.IP "gv_fetchfile_flags" 4 +.IX Xref "gv_fetchfile_flags" +.IX Item "gv_fetchfile_flags" +.IP "gv_fetchpv" 4 +.IX Xref "gv_fetchpv" +.IX Item "gv_fetchpv" +.IP "gv_fetchpvn_flags" 4 +.IX Xref "gv_fetchpvn_flags" +.IX Item "gv_fetchpvn_flags" +.IP "gv_fetchsv" 4 +.IX Xref "gv_fetchsv" +.IX Item "gv_fetchsv" +.IP "gv_fullname3" 4 +.IX Xref "gv_fullname3" +.IX Item "gv_fullname3" +.IP "gv_fullname4" 4 +.IX Xref "gv_fullname4" +.IX Item "gv_fullname4" +.IP "gv_handler" 4 +.IX Xref "gv_handler" +.IX Item "gv_handler" +.IP "gv_name_set" 4 +.IX Xref "gv_name_set" +.IX Item "gv_name_set" +.IP "he_dup" 4 +.IX Xref "he_dup" +.IX Item "he_dup" +.IP "hek_dup" 4 +.IX Xref "hek_dup" +.IX Item "hek_dup" +.IP "hv_common" 4 +.IX Xref "hv_common" +.IX Item "hv_common" +.IP "hv_common_key_len" 4 +.IX Xref "hv_common_key_len" +.IX Item "hv_common_key_len" +.IP "hv_delayfree_ent" 4 +.IX Xref "hv_delayfree_ent" +.IX Item "hv_delayfree_ent" +.IP "hv_eiter_p" 4 +.IX Xref "hv_eiter_p" +.IX Item "hv_eiter_p" +.IP "hv_eiter_set" 4 +.IX Xref "hv_eiter_set" +.IX Item "hv_eiter_set" +.IP "hv_free_ent" 4 +.IX Xref "hv_free_ent" +.IX Item "hv_free_ent" +.IP "hv_ksplit" 4 +.IX Xref "hv_ksplit" +.IX Item "hv_ksplit" +.IP "hv_name_set" 4 +.IX Xref "hv_name_set" +.IX Item "hv_name_set" +.IP "hv_placeholders_get" 4 +.IX Xref "hv_placeholders_get" +.IX Item "hv_placeholders_get" +.IP "hv_placeholders_set" 4 +.IX Xref "hv_placeholders_set" +.IX Item "hv_placeholders_set" +.IP "hv_rand_set" 4 +.IX Xref "hv_rand_set" +.IX Item "hv_rand_set" +.IP "hv_riter_p" 4 +.IX Xref "hv_riter_p" +.IX Item "hv_riter_p" +.IP "hv_riter_set" 4 +.IX Xref "hv_riter_set" +.IX Item "hv_riter_set" +.IP "ibcmp_utf8" 4 +.IX Xref "ibcmp_utf8" +.IX Item "ibcmp_utf8" +.IP "init_global_struct" 4 +.IX Xref "init_global_struct" +.IX Item "init_global_struct" +.IP "init_stacks" 4 +.IX Xref "init_stacks" +.IX Item "init_stacks" +.IP "init_tm" 4 +.IX Xref "init_tm" +.IX Item "init_tm" +.IP "is_lvalue_sub" 4 +.IX Xref "is_lvalue_sub" +.IX Item "is_lvalue_sub" +.IP "leave_scope" 4 +.IX Xref "leave_scope" +.IX Item "leave_scope" +.IP "load_module_nocontext" 4 +.IX Xref "load_module_nocontext" +.IX Item "load_module_nocontext" +.IP "magic_dump" 4 +.IX Xref "magic_dump" +.IX Item "magic_dump" +.IP "markstack_grow" 4 +.IX Xref "markstack_grow" +.IX Item "markstack_grow" +.IP "mess_nocontext" 4 +.IX Xref "mess_nocontext" +.IX Item "mess_nocontext" +.IP "mfree" 4 +.IX Xref "mfree" +.IX Item "mfree" +.IP "mg_dup" 4 +.IX Xref "mg_dup" +.IX Item "mg_dup" +.IP "mg_size" 4 +.IX Xref "mg_size" +.IX Item "mg_size" +.IP "mini_mktime" 4 +.IX Xref "mini_mktime" +.IX Item "mini_mktime" +.IP "moreswitches" 4 +.IX Xref "moreswitches" +.IX Item "moreswitches" +.IP "mro_get_from_name" 4 +.IX Xref "mro_get_from_name" +.IX Item "mro_get_from_name" +.IP "mro_set_mro" 4 +.IX Xref "mro_set_mro" +.IX Item "mro_set_mro" +.IP "mro_set_private_data" 4 +.IX Xref "mro_set_private_data" +.IX Item "mro_set_private_data" +.IP "my_atof" 4 +.IX Xref "my_atof" +.IX Item "my_atof" +.IP "my_chsize" 4 +.IX Xref "my_chsize" +.IX Item "my_chsize" +.IP "my_cxt_index" 4 +.IX Xref "my_cxt_index" +.IX Item "my_cxt_index" +.IP "my_cxt_init" 4 +.IX Xref "my_cxt_init" +.IX Item "my_cxt_init" +.IP "my_dirfd" 4 +.IX Xref "my_dirfd" +.IX Item "my_dirfd" +.IP "my_failure_exit" 4 +.IX Xref "my_failure_exit" +.IX Item "my_failure_exit" +.IP "my_fflush_all" 4 +.IX Xref "my_fflush_all" +.IX Item "my_fflush_all" +.IP "my_fork" 4 +.IX Xref "my_fork" +.IX Item "my_fork" +.IP "my_lstat" 4 +.IX Xref "my_lstat" +.IX Item "my_lstat" +.IP "my_pclose" 4 +.IX Xref "my_pclose" +.IX Item "my_pclose" +.IP "my_popen" 4 +.IX Xref "my_popen" +.IX Item "my_popen" +.IP "my_popen_list" 4 +.IX Xref "my_popen_list" +.IX Item "my_popen_list" +.IP "my_socketpair" 4 +.IX Xref "my_socketpair" +.IX Item "my_socketpair" +.IP "my_stat" 4 +.IX Xref "my_stat" +.IX Item "my_stat" +.IP "my_strftime" 4 +.IX Xref "my_strftime" +.IX Item "my_strftime" +.IP "newANONATTRSUB" 4 +.IX Xref "newANONATTRSUB" +.IX Item "newANONATTRSUB" +.IP "newANONHASH" 4 +.IX Xref "newANONHASH" +.IX Item "newANONHASH" +.IP "newANONLIST" 4 +.IX Xref "newANONLIST" +.IX Item "newANONLIST" +.IP "newANONSUB" 4 +.IX Xref "newANONSUB" +.IX Item "newANONSUB" +.IP "newATTRSUB" 4 +.IX Xref "newATTRSUB" +.IX Item "newATTRSUB" +.IP "newAVREF" 4 +.IX Xref "newAVREF" +.IX Item "newAVREF" +.IP "newCVREF" 4 +.IX Xref "newCVREF" +.IX Item "newCVREF" +.IP "newFORM" 4 +.IX Xref "newFORM" +.IX Item "newFORM" +.IP "newGVREF" 4 +.IX Xref "newGVREF" +.IX Item "newGVREF" +.IP "newGVgen" 4 +.IX Xref "newGVgen" +.IX Item "newGVgen" +.IP "newGVgen_flags" 4 +.IX Xref "newGVgen_flags" +.IX Item "newGVgen_flags" +.IP "newHVREF" 4 +.IX Xref "newHVREF" +.IX Item "newHVREF" +.IP "newHVhv" 4 +.IX Xref "newHVhv" +.IX Item "newHVhv" +.IP "newIO" 4 +.IX Xref "newIO" +.IX Item "newIO" +.IP "newMYSUB" 4 +.IX Xref "newMYSUB" +.IX Item "newMYSUB" +.IP "newPROG" 4 +.IX Xref "newPROG" +.IX Item "newPROG" +.IP "newRV" 4 +.IX Xref "newRV" +.IX Item "newRV" +.IP "newSUB" 4 +.IX Xref "newSUB" +.IX Item "newSUB" +.IP "newSVREF" 4 +.IX Xref "newSVREF" +.IX Item "newSVREF" +.IP "newSVpvf_nocontext" 4 +.IX Xref "newSVpvf_nocontext" +.IX Item "newSVpvf_nocontext" +.IP "newSVsv_flags" 4 +.IX Xref "newSVsv_flags" +.IX Item "newSVsv_flags" +.IP "new_stackinfo" 4 +.IX Xref "new_stackinfo" +.IX Item "new_stackinfo" +.IP "op_refcnt_lock" 4 +.IX Xref "op_refcnt_lock" +.IX Item "op_refcnt_lock" +.IP "op_refcnt_unlock" 4 +.IX Xref "op_refcnt_unlock" +.IX Item "op_refcnt_unlock" +.IP "parser_dup" 4 +.IX Xref "parser_dup" +.IX Item "parser_dup" +.IP "perl_alloc_using" 4 +.IX Xref "perl_alloc_using" +.IX Item "perl_alloc_using" +.IP "perl_clone_using" 4 +.IX Xref "perl_clone_using" +.IX Item "perl_clone_using" +.IP "perly_sighandler" 4 +.IX Xref "perly_sighandler" +.IX Item "perly_sighandler" +.IP "pmop_dump" 4 +.IX Xref "pmop_dump" +.IX Item "pmop_dump" +.IP "pop_scope" 4 +.IX Xref "pop_scope" +.IX Item "pop_scope" +.IP "pregcomp" 4 +.IX Xref "pregcomp" +.IX Item "pregcomp" +.IP "pregexec" 4 +.IX Xref "pregexec" +.IX Item "pregexec" +.IP "pregfree" 4 +.IX Xref "pregfree" +.IX Item "pregfree" +.IP "pregfree2" 4 +.IX Xref "pregfree2" +.IX Item "pregfree2" +.IP "ptr_table_fetch" 4 +.IX Xref "ptr_table_fetch" +.IX Item "ptr_table_fetch" +.IP "ptr_table_free" 4 +.IX Xref "ptr_table_free" +.IX Item "ptr_table_free" +.IP "ptr_table_new" 4 +.IX Xref "ptr_table_new" +.IX Item "ptr_table_new" +.IP "ptr_table_split" 4 +.IX Xref "ptr_table_split" +.IX Item "ptr_table_split" +.IP "ptr_table_store" 4 +.IX Xref "ptr_table_store" +.IX Item "ptr_table_store" +.IP "push_scope" 4 +.IX Xref "push_scope" +.IX Item "push_scope" +.IP "re_compile" 4 +.IX Xref "re_compile" +.IX Item "re_compile" +.IP "re_dup_guts" 4 +.IX Xref "re_dup_guts" +.IX Item "re_dup_guts" +.IP "reentrant_free" 4 +.IX Xref "reentrant_free" +.IX Item "reentrant_free" +.IP "reentrant_init" 4 +.IX Xref "reentrant_init" +.IX Item "reentrant_init" +.IP "reentrant_retry" 4 +.IX Xref "reentrant_retry" +.IX Item "reentrant_retry" +.IP "reentrant_size" 4 +.IX Xref "reentrant_size" +.IX Item "reentrant_size" +.IP "ref" 4 +.IX Xref "ref" +.IX Item "ref" +.IP "reg_named_buff_all" 4 +.IX Xref "reg_named_buff_all" +.IX Item "reg_named_buff_all" +.IP "reg_named_buff_exists" 4 +.IX Xref "reg_named_buff_exists" +.IX Item "reg_named_buff_exists" +.IP "reg_named_buff_fetch" 4 +.IX Xref "reg_named_buff_fetch" +.IX Item "reg_named_buff_fetch" +.IP "reg_named_buff_firstkey" 4 +.IX Xref "reg_named_buff_firstkey" +.IX Item "reg_named_buff_firstkey" +.IP "reg_named_buff_nextkey" 4 +.IX Xref "reg_named_buff_nextkey" +.IX Item "reg_named_buff_nextkey" +.IP "reg_named_buff_scalar" 4 +.IX Xref "reg_named_buff_scalar" +.IX Item "reg_named_buff_scalar" +.IP "regdump" 4 +.IX Xref "regdump" +.IX Item "regdump" +.IP "regdupe_internal" 4 +.IX Xref "regdupe_internal" +.IX Item "regdupe_internal" +.IP "regexec_flags" 4 +.IX Xref "regexec_flags" +.IX Item "regexec_flags" +.IP "regfree_internal" 4 +.IX Xref "regfree_internal" +.IX Item "regfree_internal" +.IP "reginitcolors" 4 +.IX Xref "reginitcolors" +.IX Item "reginitcolors" +.IP "regnext" 4 +.IX Xref "regnext" +.IX Item "regnext" +.IP "repeatcpy" 4 +.IX Xref "repeatcpy" +.IX Item "repeatcpy" +.IP "rsignal_state" 4 +.IX Xref "rsignal_state" +.IX Item "rsignal_state" +.IP "runops_debug" 4 +.IX Xref "runops_debug" +.IX Item "runops_debug" +.IP "runops_standard" 4 +.IX Xref "runops_standard" +.IX Item "runops_standard" +.IP "rvpv_dup" 4 +.IX Xref "rvpv_dup" +.IX Item "rvpv_dup" +.IP "safesyscalloc" 4 +.IX Xref "safesyscalloc" +.IX Item "safesyscalloc" +.IP "safesysfree" 4 +.IX Xref "safesysfree" +.IX Item "safesysfree" +.IP "safesysmalloc" 4 +.IX Xref "safesysmalloc" +.IX Item "safesysmalloc" +.IP "safesysrealloc" 4 +.IX Xref "safesysrealloc" +.IX Item "safesysrealloc" +.IP "save_I16" 4 +.IX Xref "save_I16" +.IX Item "save_I16" +.IP "save_I32" 4 +.IX Xref "save_I32" +.IX Item "save_I32" +.IP "save_I8" 4 +.IX Xref "save_I8" +.IX Item "save_I8" +.IP "save_adelete" 4 +.IX Xref "save_adelete" +.IX Item "save_adelete" +.IP "save_aelem" 4 +.IX Xref "save_aelem" +.IX Item "save_aelem" +.IP "save_aelem_flags" 4 +.IX Xref "save_aelem_flags" +.IX Item "save_aelem_flags" +.IP "save_alloc" 4 +.IX Xref "save_alloc" +.IX Item "save_alloc" +.IP "save_ary" 4 +.IX Xref "save_ary" +.IX Item "save_ary" +.IP "save_bool" 4 +.IX Xref "save_bool" +.IX Item "save_bool" +.IP "save_clearsv" 4 +.IX Xref "save_clearsv" +.IX Item "save_clearsv" +.IP "save_delete" 4 +.IX Xref "save_delete" +.IX Item "save_delete" +.IP "save_destructor" 4 +.IX Xref "save_destructor" +.IX Item "save_destructor" +.IP "save_destructor_x" 4 +.IX Xref "save_destructor_x" +.IX Item "save_destructor_x" +.IP "save_freeop" 4 +.IX Xref "save_freeop" +.IX Item "save_freeop" +.IP "save_freepv" 4 +.IX Xref "save_freepv" +.IX Item "save_freepv" +.IP "save_freesv" 4 +.IX Xref "save_freesv" +.IX Item "save_freesv" +.IP "save_generic_pvref" 4 +.IX Xref "save_generic_pvref" +.IX Item "save_generic_pvref" +.IP "save_generic_svref" 4 +.IX Xref "save_generic_svref" +.IX Item "save_generic_svref" +.IP "save_hdelete" 4 +.IX Xref "save_hdelete" +.IX Item "save_hdelete" +.IP "save_helem" 4 +.IX Xref "save_helem" +.IX Item "save_helem" +.IP "save_helem_flags" 4 +.IX Xref "save_helem_flags" +.IX Item "save_helem_flags" +.IP "save_hints" 4 +.IX Xref "save_hints" +.IX Item "save_hints" +.IP "save_hptr" 4 +.IX Xref "save_hptr" +.IX Item "save_hptr" +.IP "save_int" 4 +.IX Xref "save_int" +.IX Item "save_int" +.IP "save_item" 4 +.IX Xref "save_item" +.IX Item "save_item" +.IP "save_iv" 4 +.IX Xref "save_iv" +.IX Item "save_iv" +.IP "save_mortalizesv" 4 +.IX Xref "save_mortalizesv" +.IX Item "save_mortalizesv" +.IP "save_op" 4 +.IX Xref "save_op" +.IX Item "save_op" +.IP "save_padsv_and_mortalize" 4 +.IX Xref "save_padsv_and_mortalize" +.IX Item "save_padsv_and_mortalize" +.IP "save_pptr" 4 +.IX Xref "save_pptr" +.IX Item "save_pptr" +.IP "save_pushi32ptr" 4 +.IX Xref "save_pushi32ptr" +.IX Item "save_pushi32ptr" +.IP "save_pushptr" 4 +.IX Xref "save_pushptr" +.IX Item "save_pushptr" +.IP "save_pushptrptr" 4 +.IX Xref "save_pushptrptr" +.IX Item "save_pushptrptr" +.IP "save_re_context" 4 +.IX Xref "save_re_context" +.IX Item "save_re_context" +.IP "save_set_svflags" 4 +.IX Xref "save_set_svflags" +.IX Item "save_set_svflags" +.IP "save_shared_pvref" 4 +.IX Xref "save_shared_pvref" +.IX Item "save_shared_pvref" +.IP "save_sptr" 4 +.IX Xref "save_sptr" +.IX Item "save_sptr" +.IP "save_svref" 4 +.IX Xref "save_svref" +.IX Item "save_svref" +.IP "save_vptr" 4 +.IX Xref "save_vptr" +.IX Item "save_vptr" +.IP "savestack_grow" 4 +.IX Xref "savestack_grow" +.IX Item "savestack_grow" +.IP "savestack_grow_cnt" 4 +.IX Xref "savestack_grow_cnt" +.IX Item "savestack_grow_cnt" +.IP "scan_num" 4 +.IX Xref "scan_num" +.IX Item "scan_num" +.IP "scan_vstring" 4 +.IX Xref "scan_vstring" +.IX Item "scan_vstring" +.IP "seed" 4 +.IX Xref "seed" +.IX Item "seed" +.IP "set_context" 4 +.IX Xref "set_context" +.IX Item "set_context" +.IP "share_hek" 4 +.IX Xref "share_hek" +.IX Item "share_hek" +.IP "si_dup" 4 +.IX Xref "si_dup" +.IX Item "si_dup" +.IP "ss_dup" 4 +.IX Xref "ss_dup" +.IX Item "ss_dup" +.IP "stack_grow" 4 +.IX Xref "stack_grow" +.IX Item "stack_grow" +.IP "start_subparse" 4 +.IX Xref "start_subparse" +.IX Item "start_subparse" +.IP "str_to_version" 4 +.IX Xref "str_to_version" +.IX Item "str_to_version" +.IP "sv_2iv" 4 +.IX Xref "sv_2iv" +.IX Item "sv_2iv" +.IP "sv_2pv" 4 +.IX Xref "sv_2pv" +.IX Item "sv_2pv" +.IP "sv_2pvbyte_flags" 4 +.IX Xref "sv_2pvbyte_flags" +.IX Item "sv_2pvbyte_flags" +.IP "sv_2pvutf8_flags" 4 +.IX Xref "sv_2pvutf8_flags" +.IX Item "sv_2pvutf8_flags" +.IP "sv_2uv" 4 +.IX Xref "sv_2uv" +.IX Item "sv_2uv" +.IP "sv_catpvf_mg_nocontext" 4 +.IX Xref "sv_catpvf_mg_nocontext" +.IX Item "sv_catpvf_mg_nocontext" +.IP "sv_catpvf_nocontext" 4 +.IX Xref "sv_catpvf_nocontext" +.IX Item "sv_catpvf_nocontext" +.IP "sv_dup" 4 +.IX Xref "sv_dup" +.IX Item "sv_dup" +.IP "sv_dup_inc" 4 +.IX Xref "sv_dup_inc" +.IX Item "sv_dup_inc" +.IP "sv_peek" 4 +.IX Xref "sv_peek" +.IX Item "sv_peek" +.IP "sv_setpvf_mg_nocontext" 4 +.IX Xref "sv_setpvf_mg_nocontext" +.IX Item "sv_setpvf_mg_nocontext" +.IP "sv_setpvf_nocontext" 4 +.IX Xref "sv_setpvf_nocontext" +.IX Item "sv_setpvf_nocontext" +.IP "sys_init" 4 +.IX Xref "sys_init" +.IX Item "sys_init" +.IP "sys_init3" 4 +.IX Xref "sys_init3" +.IX Item "sys_init3" +.IP "sys_intern_clear" 4 +.IX Xref "sys_intern_clear" +.IX Item "sys_intern_clear" +.IP "sys_intern_dup" 4 +.IX Xref "sys_intern_dup" +.IX Item "sys_intern_dup" +.IP "sys_intern_init" 4 +.IX Xref "sys_intern_init" +.IX Item "sys_intern_init" +.IP "sys_term" 4 +.IX Xref "sys_term" +.IX Item "sys_term" +.IP "taint_env" 4 +.IX Xref "taint_env" +.IX Item "taint_env" +.IP "taint_proper" 4 +.IX Xref "taint_proper" +.IX Item "taint_proper" +.IP "unlnk" 4 +.IX Xref "unlnk" +.IX Item "unlnk" +.IP "unsharepvn" 4 +.IX Xref "unsharepvn" +.IX Item "unsharepvn" +.IP "vdeb" 4 +.IX Xref "vdeb" +.IX Item "vdeb" +.IP "vform" 4 +.IX Xref "vform" +.IX Item "vform" +.IP "vload_module" 4 +.IX Xref "vload_module" +.IX Item "vload_module" +.IP "vnewSVpvf" 4 +.IX Xref "vnewSVpvf" +.IX Item "vnewSVpvf" +.IP "vwarner" 4 +.IX Xref "vwarner" +.IX Item "vwarner" +.IP "warn_nocontext" 4 +.IX Xref "warn_nocontext" +.IX Item "warn_nocontext" +.IP "warner" 4 +.IX Xref "warner" +.IX Item "warner" +.IP "warner_nocontext" 4 +.IX Xref "warner_nocontext" +.IX Item "warner_nocontext" +.IP "whichsig" 4 +.IX Xref "whichsig" +.IX Item "whichsig" +.IP "whichsig_pv" 4 +.IX Xref "whichsig_pv" +.IX Item "whichsig_pv" +.IP "whichsig_pvn" 4 +.IX Xref "whichsig_pvn" +.IX Item "whichsig_pvn" +.IP "whichsig_sv" 4 +.IX Xref "whichsig_sv" +.IX Item "whichsig_sv" +.PD +.SH "AUTHORS" +.IX Header "AUTHORS" +Until May 1997, this document was maintained by Jeff Okamoto +. It is now maintained as part of Perl itself. +.PP +With lots of help and suggestions from Dean Roehrich, Malcolm Beattie, +Andreas Koenig, Paul Hudson, Ilya Zakharevich, Paul Marquess, Neil +Bowers, Matthew Green, Tim Bunce, Spider Boardman, Ulrich Pfeifer, +Stephen McCamant, and Gurusamy Sarathy. +.PP +\&\s-1API\s0 Listing originally by Dean Roehrich . +.PP +Updated to be autogenerated from comments in the source by Benjamin Stuhl. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\fIconfig.h\fR perlapio perlcall perlclib perlfilter perlguts perlintern perlmroapi perlxs perlxstut warnings diff --git a/data/miniconda3/man/man1/perlartistic.1 b/data/miniconda3/man/man1/perlartistic.1 new file mode 100644 index 0000000000000000000000000000000000000000..535e37bdc92ca0e8a7eab4dd86d89774018c5277 --- /dev/null +++ b/data/miniconda3/man/man1/perlartistic.1 @@ -0,0 +1,323 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLARTISTIC 1" +.TH PERLARTISTIC 1 "2020-12-18" "perl v5.32.1" "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" +perlartistic \- the Perl Artistic License +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 2 +\& You can refer to this document in Pod via "L" +\& Or you can see this document by entering "perldoc perlartistic" +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Perl is free software; you can redistribute it and/or modify +it under the terms of either: +.PP +.Vb 3 +\& a) the GNU General Public License as published by the Free +\& Software Foundation; either version 1, or (at your option) any +\& later version, or +\& +\& b) the "Artistic License" which comes with this Kit. +.Ve +.PP +This is \fB\*(L"The Artistic License\*(R"\fR. +It's here so that modules, programs, etc., that want to declare +this as their distribution license can link to it. +.PP +For the \s-1GNU\s0 General Public License, see perlgpl. +.ie n .SH "The ""Artistic License""" +.el .SH "The ``Artistic License''" +.IX Header "The Artistic License" +.SS "Preamble" +.IX Subsection "Preamble" +The intent of this document is to state the conditions under which a +Package may be copied, such that the Copyright Holder maintains some +semblance of artistic control over the development of the package, +while giving the users of the package the right to use and distribute +the Package in a more-or-less customary fashion, plus the right to make +reasonable modifications. +.SS "Definitions" +.IX Subsection "Definitions" +.ie n .IP """Package""" 4 +.el .IP "``Package''" 4 +.IX Item "Package" +refers to the collection of files distributed by the +Copyright Holder, and derivatives of that collection of files created +through textual modification. +.ie n .IP """Standard Version""" 4 +.el .IP "``Standard Version''" 4 +.IX Item "Standard Version" +refers to such a Package if it has not been +modified, or has been modified in accordance with the wishes of the +Copyright Holder as specified below. +.ie n .IP """Copyright Holder""" 4 +.el .IP "``Copyright Holder''" 4 +.IX Item "Copyright Holder" +is whoever is named in the copyright or +copyrights for the package. +.ie n .IP """You""" 4 +.el .IP "``You''" 4 +.IX Item "You" +is you, if you're thinking about copying or distributing this Package. +.ie n .IP """Reasonable copying fee""" 4 +.el .IP "``Reasonable copying fee''" 4 +.IX Item "Reasonable copying fee" +is whatever you can justify on the basis +of media cost, duplication charges, time of people involved, and so on. +(You will not be required to justify it to the Copyright Holder, but +only to the computing community at large as a market that must bear the +fee.) +.ie n .IP """Freely Available""" 4 +.el .IP "``Freely Available''" 4 +.IX Item "Freely Available" +means that no fee is charged for the item +itself, though there may be fees involved in handling the item. It also +means that recipients of the item may redistribute it under the same +conditions they received it. +.SS "Conditions" +.IX Subsection "Conditions" +.IP "1." 4 +You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that you +duplicate all of the original copyright notices and associated disclaimers. +.IP "2." 4 +You may apply bug fixes, portability fixes and other modifications +derived from the Public Domain or from the Copyright Holder. A Package +modified in such a way shall still be considered the Standard Version. +.IP "3." 4 +You may otherwise modify your copy of this Package in any way, provided +that you insert a prominent notice in each changed file stating how and +when you changed that file, and provided that you do at least \s-1ONE\s0 of the +following: +.RS 4 +.IP "a)" 4 +.IX Item "a)" +place your modifications in the Public Domain or otherwise make them +Freely Available, such as by posting said modifications to Usenet or an +equivalent medium, or placing the modifications on a major archive site +such as uunet.uu.net, or by allowing the Copyright Holder to include +your modifications in the Standard Version of the Package. +.IP "b)" 4 +.IX Item "b)" +use the modified Package only within your corporation or organization. +.IP "c)" 4 +.IX Item "c)" +rename any non-standard executables so the names do not conflict with +standard executables, which must also be provided, and provide a +separate manual page for each non-standard executable that clearly +documents how it differs from the Standard Version. +.IP "d)" 4 +.IX Item "d)" +make other distribution arrangements with the Copyright Holder. +.RE +.RS 4 +.RE +.IP "4." 4 +You may distribute the programs of this Package in object code or +executable form, provided that you do at least \s-1ONE\s0 of the following: +.RS 4 +.IP "a)" 4 +.IX Item "a)" +distribute a Standard Version of the executables and library files, +together with instructions (in the manual page or equivalent) on where +to get the Standard Version. +.IP "b)" 4 +.IX Item "b)" +accompany the distribution with the machine-readable source of the +Package with your modifications. +.IP "c)" 4 +.IX Item "c)" +give non-standard executables non-standard names, and clearly +document the differences in manual pages (or equivalent), together with +instructions on where to get the Standard Version. +.IP "d)" 4 +.IX Item "d)" +make other distribution arrangements with the Copyright Holder. +.RE +.RS 4 +.RE +.IP "5." 4 +You may charge a reasonable copying fee for any distribution of this +Package. You may charge any fee you choose for support of this +Package. You may not charge a fee for this Package itself. However, +you may distribute this Package in aggregate with other (possibly +commercial) programs as part of a larger (possibly commercial) software +distribution provided that you do not advertise this Package as a +product of your own. You may embed this Package's interpreter within +an executable of yours (by linking); this shall be construed as a mere +form of aggregation, provided that the complete Standard Version of the +interpreter is so embedded. +.IP "6." 4 +The scripts and library files supplied as input to or produced as +output from the programs of this Package do not automatically fall +under the copyright of this Package, but belong to whoever generated +them, and may be sold commercially, and may be aggregated with this +Package. If such scripts or library files are aggregated with this +Package via the so-called \*(L"undump\*(R" or \*(L"unexec\*(R" methods of producing a +binary executable image, then distribution of such an image shall +neither be construed as a distribution of this Package nor shall it +fall under the restrictions of Paragraphs 3 and 4, provided that you do +not represent such an executable image as a Standard Version of this +Package. +.IP "7." 4 +C subroutines (or comparably compiled subroutines in other +languages) supplied by you and linked into this Package in order to +emulate subroutines and variables of the language defined by this +Package shall not be considered part of this Package, but are the +equivalent of input as in Paragraph 6, provided these subroutines do +not change the language in any way that would cause it to fail the +regression tests for the language. +.IP "8." 4 +Aggregation of this Package with a commercial distribution is always +permitted provided that the use of this Package is embedded; that is, +when no overt attempt is made to make this Package's interfaces visible +to the end user of the commercial distribution. Such use shall not be +construed as a distribution of this Package. +.IP "9." 4 +The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. +.IP "10." 4 +\&\s-1THIS PACKAGE IS PROVIDED \*(L"AS IS\*(R" AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\s0 +.PP +The End diff --git a/data/miniconda3/man/man1/perlbook.1 b/data/miniconda3/man/man1/perlbook.1 new file mode 100644 index 0000000000000000000000000000000000000000..badfb03ba4db8edf8aee9b1426ca6712e5cbb1e3 --- /dev/null +++ b/data/miniconda3/man/man1/perlbook.1 @@ -0,0 +1,451 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLBOOK 1" +.TH PERLBOOK 1 "2020-12-18" "perl v5.32.1" "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" +perlbook \- Books about and related to Perl +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +There are many books on Perl and Perl-related. A few of these are +good, some are \s-1OK,\s0 but many aren't worth your money. There is a list +of these books, some with extensive reviews, at + . We list some of the books here, and while +listing a book implies our +endorsement, don't think that not including a book means anything. +.PP +Most of these books are available online through Safari Books Online +( ). +.SS "The most popular books" +.IX Subsection "The most popular books" +The major reference book on Perl, written by the creator of Perl, is +\&\fIProgramming Perl\fR: +.ie n .IP "\fIProgramming Perl\fR (the ""Camel Book""):" 4 +.el .IP "\fIProgramming Perl\fR (the ``Camel Book''):" 4 +.IX Item "Programming Perl (the Camel Book):" +.Vb 4 +\& by Tom Christiansen, brian d foy, Larry Wall with Jon Orwant +\& ISBN 978\-0\-596\-00492\-7 [4th edition February 2012] +\& ISBN 978\-1\-4493\-9890\-3 [ebook] +\& https://oreilly.com/catalog/9780596004927 +.Ve +.PP +The Ram is a cookbook with hundreds of examples of using Perl to +accomplish specific tasks: +.ie n .IP "\fIThe Perl Cookbook\fR (the ""Ram Book""):" 4 +.el .IP "\fIThe Perl Cookbook\fR (the ``Ram Book''):" 4 +.IX Item "The Perl Cookbook (the Ram Book):" +.Vb 5 +\& by Tom Christiansen and Nathan Torkington, +\& with Foreword by Larry Wall +\& ISBN 978\-0\-596\-00313\-5 [2nd Edition August 2003] +\& ISBN 978\-0\-596\-15888\-0 [ebook] +\& https://oreilly.com/catalog/9780596003135/ +.Ve +.PP +If you want to learn the basics of Perl, you might start with the +Llama book, which assumes that you already know a little about +programming: +.ie n .IP "\fILearning Perl\fR (the ""Llama Book"")" 4 +.el .IP "\fILearning Perl\fR (the ``Llama Book'')" 4 +.IX Item "Learning Perl (the Llama Book)" +.Vb 4 +\& by Randal L. Schwartz, Tom Phoenix, and brian d foy +\& ISBN 978\-1\-4493\-0358\-7 [6th edition June 2011] +\& ISBN 978\-1\-4493\-0458\-4 [ebook] +\& https://www.learning\-perl.com/ +.Ve +.PP +The tutorial started in the Llama continues in the Alpaca, which +introduces the intermediate features of references, data structures, +object-oriented programming, and modules: +.ie n .IP "\fIIntermediate Perl\fR (the ""Alpaca Book"")" 4 +.el .IP "\fIIntermediate Perl\fR (the ``Alpaca Book'')" 4 +.IX Item "Intermediate Perl (the Alpaca Book)" +.Vb 5 +\& by Randal L. Schwartz and brian d foy, with Tom Phoenix +\& foreword by Damian Conway +\& ISBN 978\-1\-4493\-9309\-0 [2nd edition August 2012] +\& ISBN 978\-1\-4493\-0459\-1 [ebook] +\& https://www.intermediateperl.com/ +.Ve +.SS "References" +.IX Subsection "References" +You might want to keep these desktop references close by your keyboard: +.IP "\fIPerl 5 Pocket Reference\fR" 4 +.IX Item "Perl 5 Pocket Reference" +.Vb 4 +\& by Johan Vromans +\& ISBN 978\-1\-4493\-0370\-9 [5th edition July 2011] +\& ISBN 978\-1\-4493\-0813\-1 [ebook] +\& https://oreilly.com/catalog/0636920018476/ +.Ve +.IP "\fIPerl Debugger Pocket Reference\fR" 4 +.IX Item "Perl Debugger Pocket Reference" +.Vb 4 +\& by Richard Foley +\& ISBN 978\-0\-596\-00503\-0 [1st edition January 2004] +\& ISBN 978\-0\-596\-55625\-9 [ebook] +\& https://oreilly.com/catalog/9780596005030/ +.Ve +.IP "\fIRegular Expression Pocket Reference\fR" 4 +.IX Item "Regular Expression Pocket Reference" +.Vb 4 +\& by Tony Stubblebine +\& ISBN 978\-0\-596\-51427\-3 [2nd edition July 2007] +\& ISBN 978\-0\-596\-55782\-9 [ebook] +\& https://oreilly.com/catalog/9780596514273/ +.Ve +.SS "Tutorials" +.IX Subsection "Tutorials" +.IP "\fIBeginning Perl\fR" 4 +.IX Item "Beginning Perl" +(There are 2 books with this title) +.Sp +.Vb 3 +\& by Curtis \*(AqOvid\*(Aq Poe +\& ISBN 978\-1\-118\-01384\-7 +\& http://www.wrox.com/WileyCDA/WroxTitle/productCd\-1118013840.html +\& +\& by James Lee +\& ISBN 1\-59059\-391\-X [3rd edition April 2010 & ebook] +\& https://www.apress.com/9781430227939 +.Ve +.ie n .IP "\fILearning Perl\fR (the ""Llama Book"")" 4 +.el .IP "\fILearning Perl\fR (the ``Llama Book'')" 4 +.IX Item "Learning Perl (the Llama Book)" +.Vb 4 +\& by Randal L. Schwartz, Tom Phoenix, and brian d foy +\& ISBN 978\-1\-4493\-0358\-7 [6th edition June 2011] +\& ISBN 978\-1\-4493\-0458\-4 [ebook] +\& https://www.learning\-perl.com/ +.Ve +.ie n .IP "\fIIntermediate Perl\fR (the ""Alpaca Book"")" 4 +.el .IP "\fIIntermediate Perl\fR (the ``Alpaca Book'')" 4 +.IX Item "Intermediate Perl (the Alpaca Book)" +.Vb 5 +\& by Randal L. Schwartz and brian d foy, with Tom Phoenix +\& foreword by Damian Conway +\& ISBN 978\-1\-4493\-9309\-0 [2nd edition August 2012] +\& ISBN 978\-1\-4493\-0459\-1 [ebook] +\& https://www.intermediateperl.com/ +.Ve +.IP "\fIMastering Perl\fR" 4 +.IX Item "Mastering Perl" +.Vb 4 +\& by brian d foy +\& ISBN 9978\-1\-4493\-9311\-3 [2st edition January 2014] +\& ISBN 978\-1\-4493\-6487\-8 [ebook] +\& https://www.masteringperl.org/ +.Ve +.IP "\fIEffective Perl Programming\fR" 4 +.IX Item "Effective Perl Programming" +.Vb 3 +\& by Joseph N. Hall, Joshua A. McAdams, brian d foy +\& ISBN 0\-321\-49694\-9 [2nd edition 2010] +\& https://www.effectiveperlprogramming.com/ +.Ve +.SS "Task-Oriented" +.IX Subsection "Task-Oriented" +.IP "\fIWriting Perl Modules for \s-1CPAN\s0\fR" 4 +.IX Item "Writing Perl Modules for CPAN" +.Vb 3 +\& by Sam Tregar +\& ISBN 1\-59059\-018\-X [1st edition August 2002 & ebook] +\& https://www.apress.com/9781590590188 +.Ve +.IP "\fIThe Perl Cookbook\fR" 4 +.IX Item "The Perl Cookbook" +.Vb 5 +\& by Tom Christiansen and Nathan Torkington, +\& with Foreword by Larry Wall +\& ISBN 978\-0\-596\-00313\-5 [2nd Edition August 2003] +\& ISBN 978\-0\-596\-15888\-0 [ebook] +\& https://oreilly.com/catalog/9780596003135/ +.Ve +.IP "\fIAutomating System Administration with Perl\fR" 4 +.IX Item "Automating System Administration with Perl" +.Vb 4 +\& by David N. Blank\-Edelman +\& ISBN 978\-0\-596\-00639\-6 [2nd edition May 2009] +\& ISBN 978\-0\-596\-80251\-6 [ebook] +\& https://oreilly.com/catalog/9780596006396 +.Ve +.IP "\fIReal World \s-1SQL\s0 Server Administration with Perl\fR" 4 +.IX Item "Real World SQL Server Administration with Perl" +.Vb 3 +\& by Linchi Shea +\& ISBN 1\-59059\-097\-X [1st edition July 2003 & ebook] +\& https://www.apress.com/9781590590973 +.Ve +.SS "Special Topics" +.IX Subsection "Special Topics" +.IP "\fIRegular Expressions Cookbook\fR" 4 +.IX Item "Regular Expressions Cookbook" +.Vb 4 +\& by Jan Goyvaerts and Steven Levithan +\& ISBN 978\-1\-4493\-1943\-4 [2nd edition August 2012] +\& ISBN 978\-1\-4493\-2747\-7 [ebook] +\& https://shop.oreilly.com/product/0636920023630.do +.Ve +.IP "\fIProgramming the Perl \s-1DBI\s0\fR" 4 +.IX Item "Programming the Perl DBI" +.Vb 4 +\& by Tim Bunce and Alligator Descartes +\& ISBN 978\-1\-56592\-699\-8 [February 2000] +\& ISBN 978\-1\-4493\-8670\-2 [ebook] +\& https://oreilly.com/catalog/9781565926998 +.Ve +.IP "\fIPerl Best Practices\fR" 4 +.IX Item "Perl Best Practices" +.Vb 4 +\& by Damian Conway +\& ISBN 978\-0\-596\-00173\-5 [1st edition July 2005] +\& ISBN 978\-0\-596\-15900\-9 [ebook] +\& https://oreilly.com/catalog/9780596001735 +.Ve +.IP "\fIHigher-Order Perl\fR" 4 +.IX Item "Higher-Order Perl" +.Vb 4 +\& by Mark\-Jason Dominus +\& ISBN 1\-55860\-701\-3 [1st edition March 2005] +\& free ebook https://hop.perl.plover.com/book/ +\& https://hop.perl.plover.com/ +.Ve +.IP "\fIMastering Regular Expressions\fR" 4 +.IX Item "Mastering Regular Expressions" +.Vb 4 +\& by Jeffrey E. F. Friedl +\& ISBN 978\-0\-596\-52812\-6 [3rd edition August 2006] +\& ISBN 978\-0\-596\-55899\-4 [ebook] +\& https://oreilly.com/catalog/9780596528126 +.Ve +.IP "\fINetwork Programming with Perl\fR" 4 +.IX Item "Network Programming with Perl" +.Vb 3 +\& by Lincoln Stein +\& ISBN 0\-201\-61571\-1 [1st edition 2001] +\& https://www.pearsonhighered.com/educator/product/Network\-Programming\-with\-Perl/9780201615715.page +.Ve +.IP "\fIPerl Template Toolkit\fR" 4 +.IX Item "Perl Template Toolkit" +.Vb 4 +\& by Darren Chamberlain, Dave Cross, and Andy Wardley +\& ISBN 978\-0\-596\-00476\-7 [December 2003] +\& ISBN 978\-1\-4493\-8647\-4 [ebook] +\& https://oreilly.com/catalog/9780596004767 +.Ve +.IP "\fIObject Oriented Perl\fR" 4 +.IX Item "Object Oriented Perl" +.Vb 4 +\& by Damian Conway +\& with foreword by Randal L. Schwartz +\& ISBN 1\-884777\-79\-1 [1st edition August 1999 & ebook] +\& https://www.manning.com/conway/ +.Ve +.IP "\fIData Munging with Perl\fR" 4 +.IX Item "Data Munging with Perl" +.Vb 3 +\& by Dave Cross +\& ISBN 1\-930110\-00\-6 [1st edition 2001 & ebook] +\& https://www.manning.com/cross +.Ve +.IP "\fIMastering Perl/Tk\fR" 4 +.IX Item "Mastering Perl/Tk" +.Vb 4 +\& by Steve Lidie and Nancy Walsh +\& ISBN 978\-1\-56592\-716\-2 [1st edition January 2002] +\& ISBN 978\-0\-596\-10344\-6 [ebook] +\& https://oreilly.com/catalog/9781565927162 +.Ve +.IP "\fIExtending and Embedding Perl\fR" 4 +.IX Item "Extending and Embedding Perl" +.Vb 3 +\& by Tim Jenness and Simon Cozens +\& ISBN 1\-930110\-82\-0 [1st edition August 2002 & ebook] +\& https://www.manning.com/jenness +.Ve +.IP "\fIPro Perl Debugging\fR" 4 +.IX Item "Pro Perl Debugging" +.Vb 3 +\& by Richard Foley with Andy Lester +\& ISBN 1\-59059\-454\-1 [1st edition July 2005 & ebook] +\& https://www.apress.com/9781590594544 +.Ve +.SS "Free (as in beer) books" +.IX Subsection "Free (as in beer) books" +Some of these books are available as free downloads. +.PP +\&\fIHigher-Order Perl\fR: +.PP +\&\fIModern Perl\fR: +.SS "Other interesting, non-Perl books" +.IX Subsection "Other interesting, non-Perl books" +You might notice several familiar Perl concepts in this collection of +\&\s-1ACM\s0 columns from Jon Bentley. The similarity to the title of the major +Perl book (which came later) is not completely accidental: +.IP "\fIProgramming Pearls\fR" 4 +.IX Item "Programming Pearls" +.Vb 2 +\& by Jon Bentley +\& ISBN 978\-0\-201\-65788\-3 [2 edition, October 1999] +.Ve +.IP "\fIMore Programming Pearls\fR" 4 +.IX Item "More Programming Pearls" +.Vb 2 +\& by Jon Bentley +\& ISBN 0\-201\-11889\-0 [January 1988] +.Ve +.SS "A note on freshness" +.IX Subsection "A note on freshness" +Each version of Perl comes with the documentation that was current at +the time of release. This poses a problem for content such as book +lists. There are probably very nice books published after this list +was included in your Perl release, and you can check the latest +released version at . +.PP +Some of the books we've listed appear almost ancient in internet +scale, but we've included those books because they still describe the +current way of doing things. Not everything in Perl changes every day. +Many of the beginner-level books, too, go over basic features and +techniques that are still valid today. In general though, we try to +limit this list to books published in the past five years. +.SS "Get your book listed" +.IX Subsection "Get your book listed" +If your Perl book isn't listed and you think it should be, let us know. + diff --git a/data/miniconda3/man/man1/perlboot.1 b/data/miniconda3/man/man1/perlboot.1 new file mode 100644 index 0000000000000000000000000000000000000000..4c8202f6ce4b221fe628dd7e253d946683b2e4f1 --- /dev/null +++ b/data/miniconda3/man/man1/perlboot.1 @@ -0,0 +1,149 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLBOOT 1" +.TH PERLBOOT 1 "2020-12-18" "perl v5.32.1" "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" +perlboot \- Links to information on object\-oriented programming in Perl +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +For information on \s-1OO\s0 programming with Perl, please see perlootut +and perlobj. +.PP +(The above documents supersede the tutorial that was formerly here in +perlboot.) diff --git a/data/miniconda3/man/man1/perlbs2000.1 b/data/miniconda3/man/man1/perlbs2000.1 new file mode 100644 index 0000000000000000000000000000000000000000..4ca945cf915b74ba9a180819c724f65f305beb79 --- /dev/null +++ b/data/miniconda3/man/man1/perlbs2000.1 @@ -0,0 +1,369 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLBS2000 1" +.TH PERLBS2000 1 "2020-12-18" "perl v5.32.1" "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" +perlbs2000 \- building and installing Perl for BS2000. +.PP +This document needs to be updated, but we don't know what it should say. +Please submit comments to . +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +This document will help you Configure, build, test and install Perl +on \s-1BS2000\s0 in the \s-1POSIX\s0 subsystem. +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This is a ported perl for the \s-1POSIX\s0 subsystem in \s-1BS2000 VERSION OSD +V3.1A\s0 or later. It may work on other versions, but we started porting +and testing it with 3.1A and are currently using Version V4.0A. +.PP +You may need the following \s-1GNU\s0 programs in order to install perl: +.SS "gzip on \s-1BS2000\s0" +.IX Subsection "gzip on BS2000" +We used version 1.2.4, which could be installed out of the box with +one failure during 'make check'. +.SS "bison on \s-1BS2000\s0" +.IX Subsection "bison on BS2000" +The yacc coming with \s-1BS2000 POSIX\s0 didn't work for us. So we had to +use bison. We had to make a few changes to perl in order to use the +pure (reentrant) parser of bison. We used version 1.25, but we had to +add a few changes due to \s-1EBCDIC.\s0 See below for more details +concerning yacc. +.SS "Unpacking Perl Distribution on \s-1BS2000\s0" +.IX Subsection "Unpacking Perl Distribution on BS2000" +To extract an \s-1ASCII\s0 tar archive on \s-1BS2000 POSIX\s0 you need an \s-1ASCII\s0 +filesystem (we used the mountpoint /usr/local/ascii for this). Now +you extract the archive in the \s-1ASCII\s0 filesystem without +I/O\-conversion: +.PP +cd /usr/local/ascii +export IO_CONVERSION=NO +gunzip < /usr/local/src/perl.tar.gz | pax \-r +.PP +You may ignore the error message for the first element of the archive +(this doesn't look like a tar archive / skipping to next file...), +it's only the directory which will be created automatically anyway. +.PP +After extracting the archive you copy the whole directory tree to your +\&\s-1EBCDIC\s0 filesystem. \fBThis time you use I/O\-conversion\fR: +.PP +cd /usr/local/src +IO_CONVERSION=YES +cp \-r /usr/local/ascii/perl5.005_02 ./ +.SS "Compiling Perl on \s-1BS2000\s0" +.IX Subsection "Compiling Perl on BS2000" +There is a \*(L"hints\*(R" file for \s-1BS2000\s0 called hints.posix\-bc (because +posix-bc is the \s-1OS\s0 name given by `uname`) that specifies the correct +values for most things. The major problem is (of course) the \s-1EBCDIC\s0 +character set. We have german \s-1EBCDIC\s0 version. +.PP +Because of our problems with the native yacc we used \s-1GNU\s0 bison to +generate a pure (=reentrant) parser for perly.y. So our yacc is +really the following script: +.PP +\&\-\-\-\-\-8<\-\-\-\-\-/usr/local/bin/yacc\-\-\-\-\-8<\-\-\-\-\- +#! /usr/bin/sh +.PP +# Bison as a reentrant yacc: +.PP +# save parameters: +params="\*(L" +while [[ $# \-gt 1 ]]; do + params=\*(R"$params \f(CW$1\fR" + shift +done +.PP +# add flag \f(CW%pure_parser:\fR +.PP +tmpfile=/tmp/bison.$$.y +echo \f(CW%pure_parser\fR > \f(CW$tmpfile\fR +cat \f(CW$1\fR >> \f(CW$tmpfile\fR +.PP +# call bison: +.PP +echo \*(L"/usr/local/bin/bison \-\-yacc \f(CW$params\fR \f(CW$1\fR\et\et\et(Pure Parser)\*(R" +/usr/local/bin/bison \-\-yacc \f(CW$params\fR \f(CW$tmpfile\fR +.PP +# cleanup: +.PP +rm \-f \f(CW$tmpfile\fR +\&\-\-\-\-\-8<\-\-\-\-\-\-\-\-\-\-8<\-\-\-\-\- +.PP +We still use the normal yacc for a2p.y though!!! We made a softlink +called byacc to distinguish between the two versions: +.PP +ln \-s /usr/bin/yacc /usr/local/bin/byacc +.PP +We build perl using \s-1GNU\s0 make. We tried the native make once and it +worked too. +.SS "Testing Perl on \s-1BS2000\s0" +.IX Subsection "Testing Perl on BS2000" +We still got a few errors during \f(CW\*(C`make test\*(C'\fR. Some of them are the +result of using bison. Bison prints \fIparser error\fR instead of \fIsyntax +error\fR, so we may ignore them. The following list shows +our errors, your results may differ: +.PP +op/numconvert.......FAILED tests 1409\-1440 +op/regexp...........FAILED tests 483, 496 +op/regexp_noamp.....FAILED tests 483, 496 +pragma/overload.....FAILED tests 152\-153, 170\-171 +pragma/warnings.....FAILED tests 14, 82, 129, 155, 192, 205, 207 +lib/bigfloat........FAILED tests 351\-352, 355 +lib/bigfltpm........FAILED tests 354\-355, 358 +lib/complex.........FAILED tests 267, 487 +lib/dumper..........FAILED tests 43, 45 +Failed 11/231 test scripts, 95.24% okay. 57/10595 subtests failed, 99.46% okay. +.SS "Installing Perl on \s-1BS2000\s0" +.IX Subsection "Installing Perl on BS2000" +We have no nroff on \s-1BS2000 POSIX\s0 (yet), so we ignored any errors while +installing the documentation. +.SS "Using Perl in the Posix-Shell of \s-1BS2000\s0" +.IX Subsection "Using Perl in the Posix-Shell of BS2000" +\&\s-1BS2000 POSIX\s0 doesn't support the shebang notation +(\f(CW\*(C`#!/usr/local/bin/perl\*(C'\fR), so you have to use the following lines +instead: +.PP +: # use perl + eval 'exec /usr/local/bin/perl \-S \f(CW$0\fR ${1+\*(L"$@\*(R"}' + if \f(CW$running_under_some_shell\fR; +.ie n .SS "Using Perl in ""native"" \s-1BS2000\s0" +.el .SS "Using Perl in ``native'' \s-1BS2000\s0" +.IX Subsection "Using Perl in native BS2000" +We don't have much experience with this yet, but try the following: +.PP +Copy your Perl executable to a \s-1BS2000 LLM\s0 using bs2cp: +.PP +\&\f(CW\*(C`bs2cp /usr/local/bin/perl \*(Aqbs2:perl(perl,l)\*(Aq\*(C'\fR +.PP +Now you can start it with the following (\s-1SDF\s0) command: +.PP +\&\f(CW\*(C`/START\-PROG FROM\-FILE=*MODULE(PERL,PERL),PROG\-MODE=*ANY,RUN\-MODE=*ADV\*(C'\fR +.PP +First you get the \s-1BS2000\s0 commandline prompt ('*'). Here you may enter +your parameters, e.g. \f(CW\*(C`\-e \*(Aqprint "Hello World!\e\en";\*(Aq\*(C'\fR (note the +double backslash!) or \f(CW\*(C`\-w\*(C'\fR and the name of your Perl script. +Filenames starting with \f(CW\*(C`/\*(C'\fR are searched in the Posix filesystem, +others are searched in the \s-1BS2000\s0 filesystem. You may even use +wildcards if you put a \f(CW\*(C`%\*(C'\fR in front of your filename (e.g. \f(CW\*(C`\-w +checkfiles.pl %*.c\*(C'\fR). Read your C/\*(C+ manual for additional +possibilities of the commandline prompt (look for +PARAMETER-PROMPTING). +.SS "Floating point anomalies on \s-1BS2000\s0" +.IX Subsection "Floating point anomalies on BS2000" +There appears to be a bug in the floating point implementation on \s-1BS2000 POSIX\s0 +systems such that calling \fBint()\fR on the product of a number and a small +magnitude number is not the same as calling \fBint()\fR on the quotient of +that number and a large magnitude number. For example, in the following +Perl code: +.PP +.Vb 4 +\& my $x = 100000.0; +\& my $y = int($x * 1e\-5) * 1e5; # \*(Aq0\*(Aq +\& my $z = int($x / 1e+5) * 1e5; # \*(Aq100000\*(Aq +\& print "\e$y is $y and \e$z is $z\en"; # $y is 0 and $z is 100000 +.Ve +.PP +Although one would expect the quantities \f(CW$y\fR and \f(CW$z\fR to be the same and equal +to 100000 they will differ and instead will be 0 and 100000 respectively. +.SS "Using PerlIO and different encodings on \s-1ASCII\s0 and \s-1EBCDIC\s0 partitions" +.IX Subsection "Using PerlIO and different encodings on ASCII and EBCDIC partitions" +Since version 5.8 Perl uses the new PerlIO on \s-1BS2000.\s0 This enables +you using different encodings per \s-1IO\s0 channel. For example you may use +.PP +.Vb 9 +\& use Encode; +\& open($f, ">:encoding(ascii)", "test.ascii"); +\& print $f "Hello World!\en"; +\& open($f, ">:encoding(posix\-bc)", "test.ebcdic"); +\& print $f "Hello World!\en"; +\& open($f, ">:encoding(latin1)", "test.latin1"); +\& print $f "Hello World!\en"; +\& open($f, ">:encoding(utf8)", "test.utf8"); +\& print $f "Hello World!\en"; +.Ve +.PP +to get two files containing \*(L"Hello World!\en\*(R" in \s-1ASCII, EBCDIC, ISO\s0 +Latin\-1 (in this example identical to \s-1ASCII\s0) respective UTF-EBCDIC (in +this example identical to normal \s-1EBCDIC\s0). See the documentation of +Encode::PerlIO for details. +.PP +As the PerlIO layer uses raw \s-1IO\s0 internally, all this totally ignores +the type of your filesystem (\s-1ASCII\s0 or \s-1EBCDIC\s0) and the \s-1IO_CONVERSION\s0 +environment variable. If you want to get the old behavior, that the +\&\s-1BS2000 IO\s0 functions determine conversion depending on the filesystem +PerlIO still is your friend. You use \s-1IO_CONVERSION\s0 as usual and tell +Perl, that it should use the native \s-1IO\s0 layer: +.PP +.Vb 2 +\& export IO_CONVERSION=YES +\& export PERLIO=stdio +.Ve +.PP +Now your \s-1IO\s0 would be \s-1ASCII\s0 on \s-1ASCII\s0 partitions and \s-1EBCDIC\s0 on \s-1EBCDIC\s0 +partitions. See the documentation of PerlIO (without \f(CW\*(C`Encode::\*(C'\fR!) +for further possibilities. +.SH "AUTHORS" +.IX Header "AUTHORS" +Thomas Dorner +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\s-1INSTALL\s0, perlport. +.SS "Mailing list" +.IX Subsection "Mailing list" +If you are interested in the z/OS (formerly known as \s-1OS/390\s0) +and POSIX-BC (\s-1BS2000\s0) ports of Perl then see the perl-mvs mailing list. +To subscribe, send an empty message to perl\-mvs\-subscribe@perl.org. +.PP +See also: +.PP +.Vb 1 +\& https://lists.perl.org/list/perl\-mvs.html +.Ve +.PP +There are web archives of the mailing list at: +.PP +.Vb 1 +\& https://www.nntp.perl.org/group/perl.mvs/ +.Ve +.SH "HISTORY" +.IX Header "HISTORY" +This document was originally written by Thomas Dorner for the 5.005 +release of Perl. +.PP +This document was podified for the 5.6 release of perl 11 July 2000. diff --git a/data/miniconda3/man/man1/perlcommunity.1 b/data/miniconda3/man/man1/perlcommunity.1 new file mode 100644 index 0000000000000000000000000000000000000000..4c97ca89d577f8fa8e4268166bece113ae373fed --- /dev/null +++ b/data/miniconda3/man/man1/perlcommunity.1 @@ -0,0 +1,297 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLCOMMUNITY 1" +.TH PERLCOMMUNITY 1 "2020-12-18" "perl v5.32.1" "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" +perlcommunity \- a brief overview of the Perl community +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document aims to provide an overview of the vast perl community, which is +far too large and diverse to provide a detailed listing. If any specific niche +has been forgotten, it is not meant as an insult but an omission for the sake +of brevity. +.PP +The Perl community is as diverse as Perl, and there is a large amount of +evidence that the Perl users apply \s-1TMTOWTDI\s0 to all endeavors, not just +programming. From websites, to \s-1IRC,\s0 to mailing lists, there is more than one +way to get involved in the community. +.SS "Where to Find the Community" +.IX Subsection "Where to Find the Community" +There is a central directory for the Perl community: +maintained by the Perl Foundation (), +which tracks and provides services for a variety of other community sites. +.SS "Mailing Lists and Newsgroups" +.IX Subsection "Mailing Lists and Newsgroups" +Perl runs on e\-mail; there is no doubt about it. The Camel book was originally +written mostly over e\-mail and today Perl's development is co-ordinated through +mailing lists. The largest repository of Perl mailing lists is located at +. +.PP +Most Perl-related projects set up mailing lists for both users and +contributors. If you don't see a certain project listed at +, check the particular website for that project. +Most mailing lists are archived at . +.SS "\s-1IRC\s0" +.IX Subsection "IRC" +The Perl community has a rather large \s-1IRC\s0 presence. For starters, it has its +own \s-1IRC\s0 network, . General (not help-oriented) chat can be +found at . Many other more specific chats are also +hosted on the network. Information about irc.perl.org is located on the +network's website: . For a more help-oriented #perl, +check out . Raku development also has a +presence in . Most Perl-related channels +will be kind enough to point you in the right direction if you ask nicely. +.PP +Any large \s-1IRC\s0 network (Dalnet, EFnet) is also likely to have a #perl channel, +with varying activity levels. +.SS "Websites" +.IX Subsection "Websites" +Perl websites come in a variety of forms, but they fit into two large +categories: forums and news websites. There are many Perl-related +websites, so only a few of the community's largest are mentioned here. +.PP +\fINews sites\fR +.IX Subsection "News sites" +.IP "" 4 +.IX Item "" +Originally run by O'Reilly Media (the publisher of the Camel Book, +this site provides quality articles mostly about technical details of Perl. +.IP "" 4 +.IX Item "" +Many members of the community have a Perl-related blog on this site. If +you'd like to join them, you can sign up for free. +.IP "" 4 +.IX Item "" +Perlsphere is one of several aggregators of Perl-related blog feeds. +.IP "" 4 +.IX Item "" +Perl Weekly is a weekly mailing list that keeps you up to date on conferences, +releases and notable blog posts. +.PP +\fIForums\fR +.IX Subsection "Forums" +.IP "" 4 +.IX Item "" +PerlMonks is one of the largest Perl forums, and describes itself as \*(L"A place +for individuals to polish, improve, and showcase their Perl skills.\*(R" and \*(L"A +community which allows everyone to grow and learn from each other.\*(R" +.IP "" 4 +.IX Item "" +Stack Overflow is a free question-and-answer site for programmers. It's not +focussed solely on Perl, but it does have an active group of users who do +their best to help people with their Perl programming questions. +.IP "" 4 +.IX Item "" +PrePAN is used as a place to discuss modules that you're considering uploading +to the \s-1CPAN.\s0 You can get feedback on their design before you upload. +.SS "User Groups" +.IX Subsection "User Groups" +Many cities around the world have local Perl Mongers chapters. A Perl Mongers +chapter is a local user group which typically holds regular in-person meetings, +both social and technical; helps organize local conferences, workshops, and +hackathons; and provides a mailing list or other continual contact method for +its members to keep in touch. +.PP +To find your local Perl Mongers (or \s-1PM\s0 as they're commonly abbreviated) group +check the international Perl Mongers directory at . +.SS "Workshops" +.IX Subsection "Workshops" +Perl workshops are, as the name might suggest, workshops where Perl is taught +in a variety of ways. At the workshops, subjects range from a beginner's +introduction (such as the Pittsburgh Perl Workshop's \*(L"Zero To Perl\*(R") to much +more advanced subjects. +.PP +There are several great resources for locating workshops: the +websites mentioned above, the +calendar mentioned below, and the \s-1YAPC\s0 Europe +website, , which is probably the best resource for +European Perl events. +.SS "Hackathons" +.IX Subsection "Hackathons" +Hackathons are a very different kind of gathering where Perl hackers gather to +do just that, hack nonstop for an extended (several day) period on a specific +project or projects. Information about hackathons can be located in the same +place as information about workshops as well as in +. +.PP +If you have never been to a hackathon, here are a few basic things you need to +know before attending: have a working laptop and know how to use it; check out +the involved projects beforehand; have the necessary version control client; +and bring backup equipment (an extra \s-1LAN\s0 cable, additional power strips, etc.) +because someone will forget. +.SS "Conventions" +.IX Subsection "Conventions" +Perl had two major annual conventions: The Perl Conference (now part of \s-1OSCON\s0), +put on by O'Reilly, and Yet Another Perl Conference or \s-1YAPC\s0 (pronounced +yap-see), which is localized into several regional YAPCs (North America, +Europe, Asia) in a stunning grassroots display by the Perl community. +.PP +In 2016, \s-1YAPC\s0 was rebranded as The Perl Conference again. It is now referred +to as The Perl and Raku Conference. +.PP +\&\s-1OSCON\s0 had been discontinued. +.PP +For more information about either conference, check out their respective web +pages: +.IP "\(bu" 4 +The Perl Conference +.Sp +. +.IP "\(bu" 4 +\&\s-1OSCON\s0 +.Sp + +.PP +An additional conference franchise with a large Perl portion was the +Open Source Developers Conference or \s-1OSDC.\s0 First held in Australia, it +also spread to Israel and France. More information can be found at: + for Israel, and for France. +.SS "Calendar of Perl Events" +.IX Subsection "Calendar of Perl Events" +The Perl Review, maintains a website +and Google calendar for tracking +workshops, hackathons, Perl Mongers meetings, and other events. A view +of this calendar is available at . +.PP +Not every event or Perl Mongers group is on that calendar, so don't lose +heart if you don't see yours posted. To have your event or group listed, +contact brian d foy (brian@theperlreview.com). +.SH "AUTHOR" +.IX Header "AUTHOR" +Edgar \*(L"Trizor\*(R" Bering diff --git a/data/miniconda3/man/man1/perldata.1 b/data/miniconda3/man/man1/perldata.1 new file mode 100644 index 0000000000000000000000000000000000000000..9fab0e14e3ba843c266c65da7a2398bfb5552713 --- /dev/null +++ b/data/miniconda3/man/man1/perldata.1 @@ -0,0 +1,1443 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLDATA 1" +.TH PERLDATA 1 "2020-12-18" "perl v5.32.1" "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" +perldata \- Perl data types +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +.SS "Variable names" +.IX Xref "variable, name variable name data type type" +.IX Subsection "Variable names" +Perl has three built-in data types: scalars, arrays of scalars, and +associative arrays of scalars, known as \*(L"hashes\*(R". A scalar is a +single string (of any size, limited only by the available memory), +number, or a reference to something (which will be discussed +in perlref). Normal arrays are ordered lists of scalars indexed +by number, starting with 0. Hashes are unordered collections of scalar +values indexed by their associated string key. +.PP +Values are usually referred to by name, or through a named reference. +The first character of the name tells you to what sort of data +structure it refers. The rest of the name tells you the particular +value to which it refers. Usually this name is a single \fIidentifier\fR, +that is, a string beginning with a letter or underscore, and +containing letters, underscores, and digits. In some cases, it may +be a chain of identifiers, separated by \f(CW\*(C`::\*(C'\fR (or by the slightly +archaic \f(CW\*(C`\*(Aq\*(C'\fR); all but the last are interpreted as names of packages, +to locate the namespace in which to look up the final identifier +(see \*(L"Packages\*(R" in perlmod for details). For a more in-depth discussion +on identifiers, see \*(L"Identifier parsing\*(R". It's possible to +substitute for a simple identifier, an expression that produces a reference +to the value at runtime. This is described in more detail below +and in perlref. +.IX Xref "identifier" +.PP +Perl also has its own built-in variables whose names don't follow +these rules. They have strange names so they don't accidentally +collide with one of your normal variables. Strings that match +parenthesized parts of a regular expression are saved under names +containing only digits after the \f(CW\*(C`$\*(C'\fR (see perlop and perlre). +In addition, several special variables that provide windows into +the inner working of Perl have names containing punctuation characters. +These are documented in perlvar. +.IX Xref "variable, built-in" +.PP +Scalar values are always named with '$', even when referring to a +scalar that is part of an array or a hash. The '$' symbol works +semantically like the English word \*(L"the\*(R" in that it indicates a +single value is expected. +.IX Xref "scalar" +.PP +.Vb 4 +\& $days # the simple scalar value "days" +\& $days[28] # the 29th element of array @days +\& $days{\*(AqFeb\*(Aq} # the \*(AqFeb\*(Aq value from hash %days +\& $#days # the last index of array @days +.Ve +.PP +Entire arrays (and slices of arrays and hashes) are denoted by '@', +which works much as the word \*(L"these\*(R" or \*(L"those\*(R" does in English, +in that it indicates multiple values are expected. +.IX Xref "array" +.PP +.Vb 3 +\& @days # ($days[0], $days[1],... $days[n]) +\& @days[3,4,5] # same as ($days[3],$days[4],$days[5]) +\& @days{\*(Aqa\*(Aq,\*(Aqc\*(Aq} # same as ($days{\*(Aqa\*(Aq},$days{\*(Aqc\*(Aq}) +.Ve +.PP +Entire hashes are denoted by '%': +.IX Xref "hash" +.PP +.Vb 1 +\& %days # (key1, val1, key2, val2 ...) +.Ve +.PP +In addition, subroutines are named with an initial '&', though this +is optional when unambiguous, just as the word \*(L"do\*(R" is often redundant +in English. Symbol table entries can be named with an initial '*', +but you don't really care about that yet (if ever :\-). +.PP +Every variable type has its own namespace, as do several +non-variable identifiers. This means that you can, without fear +of conflict, use the same name for a scalar variable, an array, or +a hash\*(--or, for that matter, for a filehandle, a directory handle, a +subroutine name, a format name, or a label. This means that \f(CW$foo\fR +and \f(CW@foo\fR are two different variables. It also means that \f(CW$foo[1]\fR +is a part of \f(CW@foo\fR, not a part of \f(CW$foo\fR. This may seem a bit weird, +but that's okay, because it is weird. +.IX Xref "namespace" +.PP +Because variable references always start with '$', '@', or '%', the +\&\*(L"reserved\*(R" words aren't in fact reserved with respect to variable +names. They \fIare\fR reserved with respect to labels and filehandles, +however, which don't have an initial special character. You can't +have a filehandle named \*(L"log\*(R", for instance. Hint: you could say +\&\f(CW\*(C`open(LOG,\*(Aqlogfile\*(Aq)\*(C'\fR rather than \f(CW\*(C`open(log,\*(Aqlogfile\*(Aq)\*(C'\fR. Using +uppercase filehandles also improves readability and protects you +from conflict with future reserved words. Case \fIis\fR significant\-\-\*(L"\s-1FOO\*(R",\s0 +\&\*(L"Foo\*(R", and \*(L"foo\*(R" are all different names. Names that start with a +letter or underscore may also contain digits and underscores. +.IX Xref "identifier, case sensitivity case" +.PP +It is possible to replace such an alphanumeric name with an expression +that returns a reference to the appropriate type. For a description +of this, see perlref. +.PP +Names that start with a digit may contain only more digits. Names +that do not start with a letter, underscore, digit or a caret are +limited to one character, e.g., \f(CW$%\fR or +\&\f(CW$$\fR. (Most of these one character names have a predefined +significance to Perl. For instance, \f(CW$$\fR is the current process +id. And all such names are reserved for Perl's possible use.) +.SS "Identifier parsing" +.IX Xref "identifiers" +.IX Subsection "Identifier parsing" +Up until Perl 5.18, the actual rules of what a valid identifier +was were a bit fuzzy. However, in general, anything defined here should +work on previous versions of Perl, while the opposite \*(-- edge cases +that work in previous versions, but aren't defined here \*(-- probably +won't work on newer versions. +As an important side note, please note that the following only applies +to bareword identifiers as found in Perl source code, not identifiers +introduced through symbolic references, which have much fewer +restrictions. +If working under the effect of the \f(CW\*(C`use utf8;\*(C'\fR pragma, the following +rules apply: +.PP +.Vb 2 +\& / (?[ ( \ep{Word} & \ep{XID_Start} ) + [_] ]) +\& (?[ ( \ep{Word} & \ep{XID_Continue} ) ]) * /x +.Ve +.PP +That is, a \*(L"start\*(R" character followed by any number of \*(L"continue\*(R" +characters. Perl requires every character in an identifier to also +match \f(CW\*(C`\ew\*(C'\fR (this prevents some problematic cases); and Perl +additionally accepts identfier names beginning with an underscore. +.PP +If not under \f(CW\*(C`use utf8\*(C'\fR, the source is treated as \s-1ASCII + 128\s0 extra +generic characters, and identifiers should match +.PP +.Vb 1 +\& / (?aa) (?!\ed) \ew+ /x +.Ve +.PP +That is, any word character in the \s-1ASCII\s0 range, as long as the first +character is not a digit. +.PP +There are two package separators in Perl: A double colon (\f(CW\*(C`::\*(C'\fR) and a single +quote (\f(CW\*(C`\*(Aq\*(C'\fR). Normal identifiers can start or end with a double colon, and +can contain several parts delimited by double colons. +Single quotes have similar rules, but with the exception that they are not +legal at the end of an identifier: That is, \f(CW\*(C`$\*(Aqfoo\*(C'\fR and \f(CW\*(C`$foo\*(Aqbar\*(C'\fR are +legal, but \f(CW\*(C`$foo\*(Aqbar\*(Aq\*(C'\fR is not. +.PP +Additionally, if the identifier is preceded by a sigil \*(-- +that is, if the identifier is part of a variable name \*(-- it +may optionally be enclosed in braces. +.PP +While you can mix double colons with singles quotes, the quotes must come +after the colons: \f(CW\*(C`$::::\*(Aqfoo\*(C'\fR and \f(CW\*(C`$foo::\*(Aqbar\*(C'\fR are legal, but \f(CW\*(C`$::\*(Aq::foo\*(C'\fR +and \f(CW\*(C`$foo\*(Aq::bar\*(C'\fR are not. +.PP +Put together, a grammar to match a basic identifier becomes +.PP +.Vb 10 +\& / +\& (?(DEFINE) +\& (? +\& (?&sigil) +\& (?: +\& (?&normal_identifier) +\& | \e{ \es* (?&normal_identifier) \es* \e} +\& ) +\& ) +\& (? +\& (?: :: )* \*(Aq? +\& (?&basic_identifier) +\& (?: (?= (?: :: )+ \*(Aq? | (?: :: )* \*(Aq ) (?&normal_identifier) )? +\& (?: :: )* +\& ) +\& (? +\& # is use utf8 on? +\& (?(?{ (caller(0))[8] & $utf8::hint_bits }) +\& (?&Perl_XIDS) (?&Perl_XIDC)* +\& | (?aa) (?!\ed) \ew+ +\& ) +\& ) +\& (? [&*\e$\e@\e%]) +\& (? (?[ ( \ep{Word} & \ep{XID_Start} ) + [_] ]) ) +\& (? (?[ \ep{Word} & \ep{XID_Continue} ]) ) +\& ) +\& /x +.Ve +.PP +Meanwhile, special identifiers don't follow the above rules; For the most +part, all of the identifiers in this category have a special meaning given +by Perl. Because they have special parsing rules, these generally can't be +fully-qualified. They come in six forms (but don't use forms 5 and 6): +.IP "1." 4 +A sigil, followed solely by digits matching \f(CW\*(C`\ep{POSIX_Digit}\*(C'\fR, like +\&\f(CW$0\fR, \f(CW$1\fR, or \f(CW$10000\fR. +.IP "2." 4 +A sigil followed by a single character matching the \f(CW\*(C`\ep{POSIX_Punct}\*(C'\fR +property, like \f(CW$!\fR or \f(CW\*(C`%+\*(C'\fR, except the character \f(CW"{"\fR doesn't work. +.IP "3." 4 +A sigil, followed by a caret and any one of the characters +\&\f(CW\*(C`[][A\-Z^_?\e]\*(C'\fR, like \f(CW$^V\fR or \f(CW$^]\fR. +.IP "4." 4 +Similar to the above, a sigil, followed by bareword text in braces, +where the first character is a caret. The next character is any one of +the characters \f(CW\*(C`[][A\-Z^_?\e]\*(C'\fR, followed by \s-1ASCII\s0 word characters. An +example is \f(CW\*(C`${^GLOBAL_PHASE}\*(C'\fR. +.IP "5." 4 +A sigil, followed by any single character in the range \f(CW\*(C`[\exA1\-\exAC\exAE\-\exFF]\*(C'\fR +when not under \f(CW"use\ utf8"\fR. (Under \f(CW"use\ utf8"\fR, the normal +identifier rules given earlier in this section apply.) Use of +non-graphic characters (the C1 controls, the NO-BREAK \s-1SPACE,\s0 and the +\&\s-1SOFT HYPHEN\s0) has been disallowed since v5.26.0. +The use of the other characters is unwise, as these are all +reserved to have special meaning to Perl, and none of them currently +do have special meaning, though this could change without notice. +.Sp +Note that an implication of this form is that there are identifiers only +legal under \f(CW"use\ utf8"\fR, and vice-versa, for example the identifier +\&\f(CW\*(C`$e\*'tat\*(C'\fR is legal under \f(CW"use\ utf8"\fR, but is otherwise +considered to be the single character variable \f(CW\*(C`$e\*'\*(C'\fR followed by +the bareword \f(CW"tat"\fR, the combination of which is a syntax error. +.IP "6." 4 +This is a combination of the previous two forms. It is valid only when +not under \f(CW"use\ utf8"\fR (normal identifier rules apply when under +\&\f(CW"use\ utf8"\fR). The form is a sigil, followed by text in braces, +where the first character is any one of the characters in the range +\&\f(CW\*(C`[\ex80\-\exFF]\*(C'\fR followed by \s-1ASCII\s0 word characters up to the trailing +brace. +.Sp +The same caveats as the previous form apply: The non-graphic +characters are no longer allowed with \*(L"use\ utf8\*(R", it is unwise +to use this form at all, and utf8ness makes a big difference. +.PP +Prior to Perl v5.24, non-graphical \s-1ASCII\s0 control characters were also +allowed in some situations; this had been deprecated since v5.20. +.SS "Context" +.IX Xref "context scalar context list context" +.IX Subsection "Context" +The interpretation of operations and values in Perl sometimes depends +on the requirements of the context around the operation or value. +There are two major contexts: list and scalar. Certain operations +return list values in contexts wanting a list, and scalar values +otherwise. If this is true of an operation it will be mentioned in +the documentation for that operation. In other words, Perl overloads +certain operations based on whether the expected return value is +singular or plural. Some words in English work this way, like \*(L"fish\*(R" +and \*(L"sheep\*(R". +.PP +In a reciprocal fashion, an operation provides either a scalar or a +list context to each of its arguments. For example, if you say +.PP +.Vb 1 +\& int( ) +.Ve +.PP +the integer operation provides scalar context for the <> +operator, which responds by reading one line from \s-1STDIN\s0 and passing it +back to the integer operation, which will then find the integer value +of that line and return that. If, on the other hand, you say +.PP +.Vb 1 +\& sort( ) +.Ve +.PP +then the sort operation provides list context for <>, which +will proceed to read every line available up to the end of file, and +pass that list of lines back to the sort routine, which will then +sort those lines and return them as a list to whatever the context +of the sort was. +.PP +Assignment is a little bit special in that it uses its left argument +to determine the context for the right argument. Assignment to a +scalar evaluates the right-hand side in scalar context, while +assignment to an array or hash evaluates the righthand side in list +context. Assignment to a list (or slice, which is just a list +anyway) also evaluates the right-hand side in list context. +.PP +When you use the \f(CW\*(C`use warnings\*(C'\fR pragma or Perl's \fB\-w\fR command-line +option, you may see warnings +about useless uses of constants or functions in \*(L"void context\*(R". +Void context just means the value has been discarded, such as a +statement containing only \f(CW\*(C`"fred";\*(C'\fR or \f(CW\*(C`getpwuid(0);\*(C'\fR. It still +counts as scalar context for functions that care whether or not +they're being called in list context. +.PP +User-defined subroutines may choose to care whether they are being +called in a void, scalar, or list context. Most subroutines do not +need to bother, though. That's because both scalars and lists are +automatically interpolated into lists. See \*(L"wantarray\*(R" in perlfunc +for how you would dynamically discern your function's calling +context. +.SS "Scalar values" +.IX Xref "scalar number string reference" +.IX Subsection "Scalar values" +All data in Perl is a scalar, an array of scalars, or a hash of +scalars. A scalar may contain one single value in any of three +different flavors: a number, a string, or a reference. In general, +conversion from one form to another is transparent. Although a +scalar may not directly hold multiple values, it may contain a +reference to an array or hash which in turn contains multiple values. +.PP +Scalars aren't necessarily one thing or another. There's no place +to declare a scalar variable to be of type \*(L"string\*(R", type \*(L"number\*(R", +type \*(L"reference\*(R", or anything else. Because of the automatic +conversion of scalars, operations that return scalars don't need +to care (and in fact, cannot care) whether their caller is looking +for a string, a number, or a reference. Perl is a contextually +polymorphic language whose scalars can be strings, numbers, or +references (which includes objects). Although strings and numbers +are considered pretty much the same thing for nearly all purposes, +references are strongly-typed, uncastable pointers with builtin +reference-counting and destructor invocation. +.PP + + +A scalar value is interpreted as \s-1FALSE\s0 in the Boolean sense +if it is undefined, the null string or the number 0 (or its +string equivalent, \*(L"0\*(R"), and \s-1TRUE\s0 if it is anything else. The +Boolean context is just a special kind of scalar context where no +conversion to a string or a number is ever performed. +Negation of a true value by \f(CW\*(C`!\*(C'\fR or \f(CW\*(C`not\*(C'\fR returns a special false value. +When evaluated as a string it is treated as \f(CW""\fR, but as a number, it +is treated as 0. Most Perl operators +that return true or false behave this way. +.IX Xref "truth falsehood true false ! not negation 0 boolean bool" +.PP +There are actually two varieties of null strings (sometimes referred +to as \*(L"empty\*(R" strings), a defined one and an undefined one. The +defined version is just a string of length zero, such as \f(CW""\fR. +The undefined version is the value that indicates that there is +no real value for something, such as when there was an error, or +at end of file, or when you refer to an uninitialized variable or +element of an array or hash. Although in early versions of Perl, +an undefined scalar could become defined when first used in a +place expecting a defined value, this no longer happens except for +rare cases of autovivification as explained in perlref. You can +use the \fBdefined()\fR operator to determine whether a scalar value is +defined (this has no meaning on arrays or hashes), and the \fBundef()\fR +operator to produce an undefined value. +.IX Xref "defined undefined undef null string, null" +.PP +To find out whether a given string is a valid non-zero number, it's +sometimes enough to test it against both numeric 0 and also lexical +\&\*(L"0\*(R" (although this will cause noises if warnings are on). That's +because strings that aren't numbers count as 0, just as they do in \fBawk\fR: +.PP +.Vb 3 +\& if ($str == 0 && $str ne "0") { +\& warn "That doesn\*(Aqt look like a number"; +\& } +.Ve +.PP +That method may be best because otherwise you won't treat \s-1IEEE\s0 +notations like \f(CW\*(C`NaN\*(C'\fR or \f(CW\*(C`Infinity\*(C'\fR properly. At other times, you +might prefer to determine whether string data can be used numerically +by calling the \fBPOSIX::strtod()\fR function or by inspecting your string +with a regular expression (as documented in perlre). +.PP +.Vb 8 +\& warn "has nondigits" if /\eD/; +\& warn "not a natural number" unless /^\ed+$/; # rejects \-3 +\& warn "not an integer" unless /^\-?\ed+$/; # rejects +3 +\& warn "not an integer" unless /^[+\-]?\ed+$/; +\& warn "not a decimal number" unless /^\-?\ed+\e.?\ed*$/; # rejects .2 +\& warn "not a decimal number" unless /^\-?(?:\ed+(?:\e.\ed*)?|\e.\ed+)$/; +\& warn "not a C float" +\& unless /^([+\-]?)(?=\ed|\e.\ed)\ed*(\e.\ed*)?([Ee]([+\-]?\ed+))?$/; +.Ve +.PP +The length of an array is a scalar value. You may find the length +of array \f(CW@days\fR by evaluating \f(CW$#days\fR, as in \fBcsh\fR. However, this +isn't the length of the array; it's the subscript of the last element, +which is a different value since there is ordinarily a 0th element. +Assigning to \f(CW$#days\fR actually changes the length of the array. +Shortening an array this way destroys intervening values. Lengthening +an array that was previously shortened does not recover values +that were in those elements. +.IX Xref "$# array, length" +.PP +You can also gain some minuscule measure of efficiency by pre-extending +an array that is going to get big. You can also extend an array +by assigning to an element that is off the end of the array. You +can truncate an array down to nothing by assigning the null list +() to it. The following are equivalent: +.PP +.Vb 2 +\& @whatever = (); +\& $#whatever = \-1; +.Ve +.PP +If you evaluate an array in scalar context, it returns the length +of the array. (Note that this is not true of lists, which return +the last value, like the C comma operator, nor of built-in functions, +which return whatever they feel like returning.) The following is +always true: +.IX Xref "array, length" +.PP +.Vb 1 +\& scalar(@whatever) == $#whatever + 1; +.Ve +.PP +Some programmers choose to use an explicit conversion so as to +leave nothing to doubt: +.PP +.Vb 1 +\& $element_count = scalar(@whatever); +.Ve +.PP +If you evaluate a hash in scalar context, it returns a false value if +the hash is empty. If there are any key/value pairs, it returns a +true value. A more precise definition is version dependent. +.PP +Prior to Perl 5.25 the value returned was a string consisting of the +number of used buckets and the number of allocated buckets, separated +by a slash. This is pretty much useful only to find out whether +Perl's internal hashing algorithm is performing poorly on your data +set. For example, you stick 10,000 things in a hash, but evaluating +\&\f(CW%HASH\fR in scalar context reveals \f(CW"1/16"\fR, which means only one out +of sixteen buckets has been touched, and presumably contains all +10,000 of your items. This isn't supposed to happen. +.PP +As of Perl 5.25 the return was changed to be the count of keys in the +hash. If you need access to the old behavior you can use +\&\f(CW\*(C`Hash::Util::bucket_ratio()\*(C'\fR instead. +.PP +If a tied hash is evaluated in scalar context, the \f(CW\*(C`SCALAR\*(C'\fR method is +called (with a fallback to \f(CW\*(C`FIRSTKEY\*(C'\fR). +.IX Xref "hash, scalar context hash, bucket bucket" +.PP +You can preallocate space for a hash by assigning to the \fBkeys()\fR function. +This rounds up the allocated buckets to the next power of two: +.PP +.Vb 1 +\& keys(%users) = 1000; # allocate 1024 buckets +.Ve +.SS "Scalar value constructors" +.IX Xref "scalar, literal scalar, constant" +.IX Subsection "Scalar value constructors" +Numeric literals are specified in any of the following floating point or +integer formats: +.PP +.Vb 10 +\& 12345 +\& 12345.67 +\& .23E\-10 # a very small number +\& 3.14_15_92 # a very important number +\& 4_294_967_296 # underscore for legibility +\& 0xff # hex +\& 0xdead_beef # more hex +\& 0377 # octal (only numbers, begins with 0) +\& 0b011011 # binary +\& 0x1.999ap\-4 # hexadecimal floating point (the \*(Aqp\*(Aq is required) +.Ve +.PP +You are allowed to use underscores (underbars) in numeric literals +between digits for legibility (but not multiple underscores in a row: +\&\f(CW\*(C`23_\|_500\*(C'\fR is not legal; \f(CW\*(C`23_500\*(C'\fR is). +You could, for example, group binary +digits by threes (as for a Unix-style mode argument such as 0b110_100_100) +or by fours (to represent nibbles, as in 0b1010_0110) or in other groups. +.IX Xref "number, literal" +.PP +String literals are usually delimited by either single or double +quotes. They work much like quotes in the standard Unix shells: +double-quoted string literals are subject to backslash and variable +substitution; single-quoted strings are not (except for \f(CW\*(C`\e\*(Aq\*(C'\fR and +\&\f(CW\*(C`\e\e\*(C'\fR). The usual C\-style backslash rules apply for making +characters such as newline, tab, etc., as well as some more exotic +forms. See \*(L"Quote and Quote-like Operators\*(R" in perlop for a list. +.IX Xref "string, literal" +.PP +Hexadecimal, octal, or binary, representations in string literals +(e.g. '0xff') are not automatically converted to their integer +representation. The \fBhex()\fR and \fBoct()\fR functions make these conversions +for you. See \*(L"hex\*(R" in perlfunc and \*(L"oct\*(R" in perlfunc for more details. +.PP +Hexadecimal floating point can start just like a hexadecimal literal, +and it can be followed by an optional fractional hexadecimal part, +but it must be followed by \f(CW\*(C`p\*(C'\fR, an optional sign, and a power of two. +The format is useful for accurately presenting floating point values, +avoiding conversions to or from decimal floating point, and therefore +avoiding possible loss in precision. Notice that while most current +platforms use the 64\-bit \s-1IEEE 754\s0 floating point, not all do. Another +potential source of (low-order) differences are the floating point +rounding modes, which can differ between CPUs, operating systems, +and compilers, and which Perl doesn't control. +.PP +You can also embed newlines directly in your strings, i.e., they can end +on a different line than they begin. This is nice, but if you forget +your trailing quote, the error will not be reported until Perl finds +another line containing the quote character, which may be much further +on in the script. Variable substitution inside strings is limited to +scalar variables, arrays, and array or hash slices. (In other words, +names beginning with $ or @, followed by an optional bracketed +expression as a subscript.) The following code segment prints out \*(L"The +price is \f(CW$100\fR.\*(R" +.IX Xref "interpolation" +.PP +.Vb 2 +\& $Price = \*(Aq$100\*(Aq; # not interpolated +\& print "The price is $Price.\en"; # interpolated +.Ve +.PP +There is no double interpolation in Perl, so the \f(CW$100\fR is left as is. +.PP +By default floating point numbers substituted inside strings use the +dot (\*(L".\*(R") as the decimal separator. If \f(CW\*(C`use locale\*(C'\fR is in effect, +and \fBPOSIX::setlocale()\fR has been called, the character used for the +decimal separator is affected by the \s-1LC_NUMERIC\s0 locale. +See perllocale and \s-1POSIX\s0. +.PP +As in some shells, you can enclose the variable name in braces to +disambiguate it from following alphanumerics (and underscores). +You must also do +this when interpolating a variable into a string to separate the +variable name from a following double-colon or an apostrophe, since +these would be otherwise treated as a package separator: +.IX Xref "interpolation" +.PP +.Vb 3 +\& $who = "Larry"; +\& print PASSWD "${who}::0:0:Superuser:/:/bin/perl\en"; +\& print "We use ${who}speak when ${who}\*(Aqs here.\en"; +.Ve +.PP +Without the braces, Perl would have looked for a \f(CW$whospeak\fR, a +\&\f(CW$who::0\fR, and a \f(CW\*(C`$who\*(Aqs\*(C'\fR variable. The last two would be the +\&\f(CW$0\fR and the \f(CW$s\fR variables in the (presumably) non-existent package +\&\f(CW\*(C`who\*(C'\fR. +.PP +In fact, a simple identifier within such curlies is forced to be +a string, and likewise within a hash subscript. Neither need +quoting. Our earlier example, \f(CW$days{\*(AqFeb\*(Aq}\fR can be written as +\&\f(CW$days{Feb}\fR and the quotes will be assumed automatically. But +anything more complicated in the subscript will be interpreted as an +expression. This means for example that \f(CW\*(C`$version{2.0}++\*(C'\fR is +equivalent to \f(CW\*(C`$version{2}++\*(C'\fR, not to \f(CW\*(C`$version{\*(Aq2.0\*(Aq}++\*(C'\fR. +.PP +\fISpecial floating point: infinity (Inf) and not-a-number (NaN)\fR +.IX Subsection "Special floating point: infinity (Inf) and not-a-number (NaN)" +.PP +Floating point values include the special values \f(CW\*(C`Inf\*(C'\fR and \f(CW\*(C`NaN\*(C'\fR, +for infinity and not-a-number. The infinity can be also negative. +.PP +The infinity is the result of certain math operations that overflow +the floating point range, like 9**9**9. The not-a-number is the +result when the result is undefined or unrepresentable. Though note +that you cannot get \f(CW\*(C`NaN\*(C'\fR from some common \*(L"undefined\*(R" or +\&\*(L"out-of-range\*(R" operations like dividing by zero, or square root of +a negative number, since Perl generates fatal errors for those. +.PP +The infinity and not-a-number have their own special arithmetic rules. +The general rule is that they are \*(L"contagious\*(R": \f(CW\*(C`Inf\*(C'\fR plus one is +\&\f(CW\*(C`Inf\*(C'\fR, and \f(CW\*(C`NaN\*(C'\fR plus one is \f(CW\*(C`NaN\*(C'\fR. Where things get interesting +is when you combine infinities and not-a-numbers: \f(CW\*(C`Inf\*(C'\fR minus \f(CW\*(C`Inf\*(C'\fR +and \f(CW\*(C`Inf\*(C'\fR divided by \f(CW\*(C`Inf\*(C'\fR are \f(CW\*(C`NaN\*(C'\fR (while \f(CW\*(C`Inf\*(C'\fR plus \f(CW\*(C`Inf\*(C'\fR is +\&\f(CW\*(C`Inf\*(C'\fR and \f(CW\*(C`Inf\*(C'\fR times \f(CW\*(C`Inf\*(C'\fR is \f(CW\*(C`Inf\*(C'\fR). \f(CW\*(C`NaN\*(C'\fR is also curious +in that it does not equal any number, \fIincluding\fR itself: +\&\f(CW\*(C`NaN\*(C'\fR != \f(CW\*(C`NaN\*(C'\fR. +.PP +Perl doesn't understand \f(CW\*(C`Inf\*(C'\fR and \f(CW\*(C`NaN\*(C'\fR as numeric literals, but +you can have them as strings, and Perl will convert them as needed: +\&\*(L"Inf\*(R" + 1. (You can, however, import them from the \s-1POSIX\s0 extension; +\&\f(CW\*(C`use POSIX qw(Inf NaN);\*(C'\fR and then use them as literals.) +.PP +Note that on input (string to number) Perl accepts \f(CW\*(C`Inf\*(C'\fR and \f(CW\*(C`NaN\*(C'\fR +in many forms. Case is ignored, and the Win32\-specific forms like +\&\f(CW\*(C`1.#INF\*(C'\fR are understood, but on output the values are normalized to +\&\f(CW\*(C`Inf\*(C'\fR and \f(CW\*(C`NaN\*(C'\fR. +.PP +\fIVersion Strings\fR +.IX Xref "version string vstring v-string" +.IX Subsection "Version Strings" +.PP +A literal of the form \f(CW\*(C`v1.20.300.4000\*(C'\fR is parsed as a string composed +of characters with the specified ordinals. This form, known as +v\-strings, provides an alternative, more readable way to construct +strings, rather than use the somewhat less readable interpolation form +\&\f(CW"\ex{1}\ex{14}\ex{12c}\ex{fa0}"\fR. This is useful for representing +Unicode strings, and for comparing version \*(L"numbers\*(R" using the string +comparison operators, \f(CW\*(C`cmp\*(C'\fR, \f(CW\*(C`gt\*(C'\fR, \f(CW\*(C`lt\*(C'\fR etc. If there are two or +more dots in the literal, the leading \f(CW\*(C`v\*(C'\fR may be omitted. +.PP +.Vb 3 +\& print v9786; # prints SMILEY, "\ex{263a}" +\& print v102.111.111; # prints "foo" +\& print 102.111.111; # same +.Ve +.PP +Such literals are accepted by both \f(CW\*(C`require\*(C'\fR and \f(CW\*(C`use\*(C'\fR for +doing a version check. Note that using the v\-strings for IPv4 +addresses is not portable unless you also use the +\&\fBinet_aton()\fR/\fBinet_ntoa()\fR routines of the Socket package. +.PP +Note that since Perl 5.8.1 the single-number v\-strings (like \f(CW\*(C`v65\*(C'\fR) +are not v\-strings before the \f(CW\*(C`=>\*(C'\fR operator (which is usually used +to separate a hash key from a hash value); instead they are interpreted +as literal strings ('v65'). They were v\-strings from Perl 5.6.0 to +Perl 5.8.0, but that caused more confusion and breakage than good. +Multi-number v\-strings like \f(CW\*(C`v65.66\*(C'\fR and \f(CW65.66.67\fR continue to +be v\-strings always. +.PP +\fISpecial Literals\fR +.IX Xref "special literal __END__ __DATA__ END DATA end data ^D ^Z" +.IX Subsection "Special Literals" +.PP +The special literals _\|_FILE_\|_, _\|_LINE_\|_, and _\|_PACKAGE_\|_ +represent the current filename, line number, and package name at that +point in your program. _\|_SUB_\|_ gives a reference to the current +subroutine. They may be used only as separate tokens; they +will not be interpolated into strings. If there is no current package +(due to an empty \f(CW\*(C`package;\*(C'\fR directive), _\|_PACKAGE_\|_ is the undefined +value. (But the empty \f(CW\*(C`package;\*(C'\fR is no longer supported, as of version +5.10.) Outside of a subroutine, _\|_SUB_\|_ is the undefined value. _\|_SUB_\|_ +is only available in 5.16 or higher, and only with a \f(CW\*(C`use v5.16\*(C'\fR or +\&\f(CW\*(C`use feature "current_sub"\*(C'\fR declaration. +.IX Xref "__FILE__ __LINE__ __PACKAGE__ __SUB__ line file package" +.PP +The two control characters ^D and ^Z, and the tokens _\|_END_\|_ and _\|_DATA_\|_ +may be used to indicate the logical end of the script before the actual +end of file. Any following text is ignored. +.PP +Text after _\|_DATA_\|_ may be read via the filehandle \f(CW\*(C`PACKNAME::DATA\*(C'\fR, +where \f(CW\*(C`PACKNAME\*(C'\fR is the package that was current when the _\|_DATA_\|_ +token was encountered. The filehandle is left open pointing to the +line after _\|_DATA_\|_. The program should \f(CW\*(C`close DATA\*(C'\fR when it is done +reading from it. (Leaving it open leaks filehandles if the module is +reloaded for any reason, so it's a safer practice to close it.) For +compatibility with older scripts written before _\|_DATA_\|_ was +introduced, _\|_END_\|_ behaves like _\|_DATA_\|_ in the top level script (but +not in files loaded with \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`do\*(C'\fR) and leaves the remaining +contents of the file accessible via \f(CW\*(C`main::DATA\*(C'\fR. +.PP +The \f(CW\*(C`DATA\*(C'\fR file handle by default has whatever PerlIO layers were +in place when Perl read the file to parse the source. Normally that +means that the file is being read bytewise, as if it were encoded in +Latin\-1, but there are two major ways for it to be otherwise. Firstly, +if the \f(CW\*(C`_\|_END_\|_\*(C'\fR/\f(CW\*(C`_\|_DATA_\|_\*(C'\fR token is in the scope of a \f(CW\*(C`use utf8\*(C'\fR +pragma then the \f(CW\*(C`DATA\*(C'\fR handle will be in \s-1UTF\-8\s0 mode. And secondly, +if the source is being read from perl's standard input then the \f(CW\*(C`DATA\*(C'\fR +file handle is actually aliased to the \f(CW\*(C`STDIN\*(C'\fR file handle, and may +be in \s-1UTF\-8\s0 mode because of the \f(CW\*(C`PERL_UNICODE\*(C'\fR environment variable or +perl's command-line switches. +.PP +See SelfLoader for more description of _\|_DATA_\|_, and +an example of its use. Note that you cannot read from the \s-1DATA\s0 +filehandle in a \s-1BEGIN\s0 block: the \s-1BEGIN\s0 block is executed as soon +as it is seen (during compilation), at which point the corresponding +_\|_DATA_\|_ (or _\|_END_\|_) token has not yet been seen. +.PP +\fIBarewords\fR +.IX Xref "bareword" +.IX Subsection "Barewords" +.PP +A word that has no other interpretation in the grammar will +be treated as if it were a quoted string. These are known as +\&\*(L"barewords\*(R". As with filehandles and labels, a bareword that consists +entirely of lowercase letters risks conflict with future reserved +words, and if you use the \f(CW\*(C`use warnings\*(C'\fR pragma or the \fB\-w\fR switch, +Perl will warn you about any such words. Perl limits barewords (like +identifiers) to about 250 characters. Future versions of Perl are likely +to eliminate these arbitrary limitations. +.PP +Some people may wish to outlaw barewords entirely. If you +say +.PP +.Vb 1 +\& use strict \*(Aqsubs\*(Aq; +.Ve +.PP +then any bareword that would \s-1NOT\s0 be interpreted as a subroutine call +produces a compile-time error instead. The restriction lasts to the +end of the enclosing block. An inner block may countermand this +by saying \f(CW\*(C`no strict \*(Aqsubs\*(Aq\*(C'\fR. +.PP +\fIArray Interpolation\fR +.IX Xref "array, interpolation interpolation, array $""" +.IX Subsection "Array Interpolation" +.PP +Arrays and slices are interpolated into double-quoted strings +by joining the elements with the delimiter specified in the \f(CW$"\fR +variable (\f(CW$LIST_SEPARATOR\fR if \*(L"use English;\*(R" is specified), +space by default. The following are equivalent: +.PP +.Vb 2 +\& $temp = join($", @ARGV); +\& system "echo $temp"; +\& +\& system "echo @ARGV"; +.Ve +.PP +Within search patterns (which also undergo double-quotish substitution) +there is an unfortunate ambiguity: Is \f(CW\*(C`/$foo[bar]/\*(C'\fR to be interpreted as +\&\f(CW\*(C`/${foo}[bar]/\*(C'\fR (where \f(CW\*(C`[bar]\*(C'\fR is a character class for the regular +expression) or as \f(CW\*(C`/${foo[bar]}/\*(C'\fR (where \f(CW\*(C`[bar]\*(C'\fR is the subscript to array +\&\f(CW@foo\fR)? If \f(CW@foo\fR doesn't otherwise exist, then it's obviously a +character class. If \f(CW@foo\fR exists, Perl takes a good guess about \f(CW\*(C`[bar]\*(C'\fR, +and is almost always right. If it does guess wrong, or if you're just +plain paranoid, you can force the correct interpretation with curly +braces as above. +.PP +If you're looking for the information on how to use here-documents, +which used to be here, that's been moved to +\&\*(L"Quote and Quote-like Operators\*(R" in perlop. +.SS "List value constructors" +.IX Xref "list" +.IX Subsection "List value constructors" +List values are denoted by separating individual values by commas +(and enclosing the list in parentheses where precedence requires it): +.PP +.Vb 1 +\& (LIST) +.Ve +.PP +In a context not requiring a list value, the value of what appears +to be a list literal is simply the value of the final element, as +with the C comma operator. For example, +.PP +.Vb 1 +\& @foo = (\*(Aqcc\*(Aq, \*(Aq\-E\*(Aq, $bar); +.Ve +.PP +assigns the entire list value to array \f(CW@foo\fR, but +.PP +.Vb 1 +\& $foo = (\*(Aqcc\*(Aq, \*(Aq\-E\*(Aq, $bar); +.Ve +.PP +assigns the value of variable \f(CW$bar\fR to the scalar variable \f(CW$foo\fR. +Note that the value of an actual array in scalar context is the +length of the array; the following assigns the value 3 to \f(CW$foo:\fR +.PP +.Vb 2 +\& @foo = (\*(Aqcc\*(Aq, \*(Aq\-E\*(Aq, $bar); +\& $foo = @foo; # $foo gets 3 +.Ve +.PP +You may have an optional comma before the closing parenthesis of a +list literal, so that you can say: +.PP +.Vb 5 +\& @foo = ( +\& 1, +\& 2, +\& 3, +\& ); +.Ve +.PP +To use a here-document to assign an array, one line per element, +you might use an approach like this: +.PP +.Vb 7 +\& @sauces = <"; +\& } +\& print "\en"; +\& # 101 102 +.Ve +.PP +List assignment in scalar context returns the number of elements +produced by the expression on the right side of the assignment: +.PP +.Vb 2 +\& $x = (($foo,$bar) = (3,2,1)); # set $x to 3, not 2 +\& $x = (($foo,$bar) = f()); # set $x to f()\*(Aqs return count +.Ve +.PP +This is handy when you want to do a list assignment in a Boolean +context, because most list functions return a null list when finished, +which when assigned produces a 0, which is interpreted as \s-1FALSE.\s0 +.PP +It's also the source of a useful idiom for executing a function or +performing an operation in list context and then counting the number of +return values, by assigning to an empty list and then using that +assignment in scalar context. For example, this code: +.PP +.Vb 1 +\& $count = () = $string =~ /\ed+/g; +.Ve +.PP +will place into \f(CW$count\fR the number of digit groups found in \f(CW$string\fR. +This happens because the pattern match is in list context (since it +is being assigned to the empty list), and will therefore return a list +of all matching parts of the string. The list assignment in scalar +context will translate that into the number of elements (here, the +number of times the pattern matched) and assign that to \f(CW$count\fR. Note +that simply using +.PP +.Vb 1 +\& $count = $string =~ /\ed+/g; +.Ve +.PP +would not have worked, since a pattern match in scalar context will +only return true or false, rather than a count of matches. +.PP +The final element of a list assignment may be an array or a hash: +.PP +.Vb 2 +\& ($x, $y, @rest) = split; +\& my($x, $y, %rest) = @_; +.Ve +.PP +You can actually put an array or hash anywhere in the list, but the first one +in the list will soak up all the values, and anything after it will become +undefined. This may be useful in a \fBmy()\fR or \fBlocal()\fR. +.PP +A hash can be initialized using a literal list holding pairs of +items to be interpreted as a key and a value: +.PP +.Vb 2 +\& # same as map assignment above +\& %map = (\*(Aqred\*(Aq,0x00f,\*(Aqblue\*(Aq,0x0f0,\*(Aqgreen\*(Aq,0xf00); +.Ve +.PP +While literal lists and named arrays are often interchangeable, that's +not the case for hashes. Just because you can subscript a list value like +a normal array does not mean that you can subscript a list value as a +hash. Likewise, hashes included as parts of other lists (including +parameters lists and return lists from functions) always flatten out into +key/value pairs. That's why it's good to use references sometimes. +.PP +It is often more readable to use the \f(CW\*(C`=>\*(C'\fR operator between key/value +pairs. The \f(CW\*(C`=>\*(C'\fR operator is mostly just a more visually distinctive +synonym for a comma, but it also arranges for its left-hand operand to be +interpreted as a string if it's a bareword that would be a legal simple +identifier. \f(CW\*(C`=>\*(C'\fR doesn't quote compound identifiers, that contain +double colons. This makes it nice for initializing hashes: +.PP +.Vb 5 +\& %map = ( +\& red => 0x00f, +\& blue => 0x0f0, +\& green => 0xf00, +\& ); +.Ve +.PP +or for initializing hash references to be used as records: +.PP +.Vb 5 +\& $rec = { +\& witch => \*(AqMable the Merciless\*(Aq, +\& cat => \*(AqFluffy the Ferocious\*(Aq, +\& date => \*(Aq10/31/1776\*(Aq, +\& }; +.Ve +.PP +or for using call-by-named-parameter to complicated functions: +.PP +.Vb 7 +\& $field = $query\->radio_group( +\& name => \*(Aqgroup_name\*(Aq, +\& values => [\*(Aqeenie\*(Aq,\*(Aqmeenie\*(Aq,\*(Aqminie\*(Aq], +\& default => \*(Aqmeenie\*(Aq, +\& linebreak => \*(Aqtrue\*(Aq, +\& labels => \e%labels +\& ); +.Ve +.PP +Note that just because a hash is initialized in that order doesn't +mean that it comes out in that order. See \*(L"sort\*(R" in perlfunc for examples +of how to arrange for an output ordering. +.PP +If a key appears more than once in the initializer list of a hash, the last +occurrence wins: +.PP +.Vb 7 +\& %circle = ( +\& center => [5, 10], +\& center => [27, 9], +\& radius => 100, +\& color => [0xDF, 0xFF, 0x00], +\& radius => 54, +\& ); +\& +\& # same as +\& %circle = ( +\& center => [27, 9], +\& color => [0xDF, 0xFF, 0x00], +\& radius => 54, +\& ); +.Ve +.PP +This can be used to provide overridable configuration defaults: +.PP +.Vb 2 +\& # values in %args take priority over %config_defaults +\& %config = (%config_defaults, %args); +.Ve +.SS "Subscripts" +.IX Subsection "Subscripts" +An array can be accessed one scalar at a +time by specifying a dollar sign (\f(CW\*(C`$\*(C'\fR), then the +name of the array (without the leading \f(CW\*(C`@\*(C'\fR), then the subscript inside +square brackets. For example: +.PP +.Vb 2 +\& @myarray = (5, 50, 500, 5000); +\& print "The Third Element is", $myarray[2], "\en"; +.Ve +.PP +The array indices start with 0. A negative subscript retrieves its +value from the end. In our example, \f(CW$myarray[\-1]\fR would have been +5000, and \f(CW$myarray[\-2]\fR would have been 500. +.PP +Hash subscripts are similar, only instead of square brackets curly brackets +are used. For example: +.PP +.Vb 7 +\& %scientists = +\& ( +\& "Newton" => "Isaac", +\& "Einstein" => "Albert", +\& "Darwin" => "Charles", +\& "Feynman" => "Richard", +\& ); +\& +\& print "Darwin\*(Aqs First Name is ", $scientists{"Darwin"}, "\en"; +.Ve +.PP +You can also subscript a list to get a single element from it: +.PP +.Vb 1 +\& $dir = (getpwnam("daemon"))[7]; +.Ve +.SS "Multi-dimensional array emulation" +.IX Subsection "Multi-dimensional array emulation" +Multidimensional arrays may be emulated by subscripting a hash with a +list. The elements of the list are joined with the subscript separator +(see \*(L"$;\*(R" in perlvar). +.PP +.Vb 1 +\& $foo{$x,$y,$z} +.Ve +.PP +is equivalent to +.PP +.Vb 1 +\& $foo{join($;, $x, $y, $z)} +.Ve +.PP +The default subscript separator is \*(L"\e034\*(R", the same as \s-1SUBSEP\s0 in \fBawk\fR. +.SS "Slices" +.IX Xref "slice array, slice hash, slice" +.IX Subsection "Slices" +A slice accesses several elements of a list, an array, or a hash +simultaneously using a list of subscripts. It's more convenient +than writing out the individual elements as a list of separate +scalar values. +.PP +.Vb 4 +\& ($him, $her) = @folks[0,\-1]; # array slice +\& @them = @folks[0 .. 3]; # array slice +\& ($who, $home) = @ENV{"USER", "HOME"}; # hash slice +\& ($uid, $dir) = (getpwnam("daemon"))[2,7]; # list slice +.Ve +.PP +Since you can assign to a list of variables, you can also assign to +an array or hash slice. +.PP +.Vb 4 +\& @days[3..5] = qw/Wed Thu Fri/; +\& @colors{\*(Aqred\*(Aq,\*(Aqblue\*(Aq,\*(Aqgreen\*(Aq} +\& = (0xff0000, 0x0000ff, 0x00ff00); +\& @folks[0, \-1] = @folks[\-1, 0]; +.Ve +.PP +The previous assignments are exactly equivalent to +.PP +.Vb 4 +\& ($days[3], $days[4], $days[5]) = qw/Wed Thu Fri/; +\& ($colors{\*(Aqred\*(Aq}, $colors{\*(Aqblue\*(Aq}, $colors{\*(Aqgreen\*(Aq}) +\& = (0xff0000, 0x0000ff, 0x00ff00); +\& ($folks[0], $folks[\-1]) = ($folks[\-1], $folks[0]); +.Ve +.PP +Since changing a slice changes the original array or hash that it's +slicing, a \f(CW\*(C`foreach\*(C'\fR construct will alter some\*(--or even all\*(--of the +values of the array or hash. +.PP +.Vb 1 +\& foreach (@array[ 4 .. 10 ]) { s/peter/paul/ } +\& +\& foreach (@hash{qw[key1 key2]}) { +\& s/^\es+//; # trim leading whitespace +\& s/\es+$//; # trim trailing whitespace +\& s/(\ew+)/\eu\eL$1/g; # "titlecase" words +\& } +.Ve +.PP +As a special exception, when you slice a list (but not an array or a hash), +if the list evaluates to empty, then taking a slice of that empty list will +always yield the empty list in turn. Thus: +.PP +.Vb 6 +\& @a = ()[0,1]; # @a has no elements +\& @b = (@a)[0,1]; # @b has no elements +\& @c = (sub{}\->())[0,1]; # @c has no elements +\& @d = (\*(Aqa\*(Aq,\*(Aqb\*(Aq)[0,1]; # @d has two elements +\& @e = (@d)[0,1,8,9]; # @e has four elements +\& @f = (@d)[8,9]; # @f has two elements +.Ve +.PP +This makes it easy to write loops that terminate when a null list +is returned: +.PP +.Vb 3 +\& while ( ($home, $user) = (getpwent)[7,0] ) { +\& printf "%\-8s %s\en", $user, $home; +\& } +.Ve +.PP +As noted earlier in this document, the scalar sense of list assignment +is the number of elements on the right-hand side of the assignment. +The null list contains no elements, so when the password file is +exhausted, the result is 0, not 2. +.PP +Slices in scalar context return the last item of the slice. +.PP +.Vb 4 +\& @a = qw/first second third/; +\& %h = (first => \*(AqA\*(Aq, second => \*(AqB\*(Aq); +\& $t = @a[0, 1]; # $t is now \*(Aqsecond\*(Aq +\& $u = @h{\*(Aqfirst\*(Aq, \*(Aqsecond\*(Aq}; # $u is now \*(AqB\*(Aq +.Ve +.PP +If you're confused about why you use an '@' there on a hash slice +instead of a '%', think of it like this. The type of bracket (square +or curly) governs whether it's an array or a hash being looked at. +On the other hand, the leading symbol ('$' or '@') on the array or +hash indicates whether you are getting back a singular value (a +scalar) or a plural one (a list). +.PP +\fIKey/Value Hash Slices\fR +.IX Subsection "Key/Value Hash Slices" +.PP +Starting in Perl 5.20, a hash slice operation +with the % symbol is a variant of slice operation +returning a list of key/value pairs rather than just values: +.PP +.Vb 6 +\& %h = (blonk => 2, foo => 3, squink => 5, bar => 8); +\& %subset = %h{\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq}; # key/value hash slice +\& # %subset is now (foo => 3, bar => 8) +\& %removed = delete %h{\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq}; +\& # %removed is now (foo => 3, bar => 8) +\& # %h is now (blonk => 2, squink => 5) +.Ve +.PP +However, the result of such a slice cannot be localized or assigned to. +These are otherwise very much consistent with hash slices +using the @ symbol. +.PP +\fIIndex/Value Array Slices\fR +.IX Subsection "Index/Value Array Slices" +.PP +Similar to key/value hash slices (and also introduced +in Perl 5.20), the % array slice syntax returns a list +of index/value pairs: +.PP +.Vb 6 +\& @a = "a".."z"; +\& @list = %a[3,4,6]; +\& # @list is now (3, "d", 4, "e", 6, "g") +\& @removed = delete %a[3,4,6] +\& # @removed is now (3, "d", 4, "e", 6, "g") +\& # @list[3,4,6] are now undef +.Ve +.PP +Note that calling \f(CW\*(C`delete\*(C'\fR on array values is +strongly discouraged. +.SS "Typeglobs and Filehandles" +.IX Xref "typeglob filehandle *" +.IX Subsection "Typeglobs and Filehandles" +Perl uses an internal type called a \fItypeglob\fR to hold an entire +symbol table entry. The type prefix of a typeglob is a \f(CW\*(C`*\*(C'\fR, because +it represents all types. This used to be the preferred way to +pass arrays and hashes by reference into a function, but now that +we have real references, this is seldom needed. +.PP +The main use of typeglobs in modern Perl is create symbol table aliases. +This assignment: +.PP +.Vb 1 +\& *this = *that; +.Ve +.PP +makes \f(CW$this\fR an alias for \f(CW$that\fR, \f(CW@this\fR an alias for \f(CW@that\fR, \f(CW%this\fR an alias +for \f(CW%that\fR, &this an alias for &that, etc. Much safer is to use a reference. +This: +.PP +.Vb 1 +\& local *Here::blue = \e$There::green; +.Ve +.PP +temporarily makes \f(CW$Here::blue\fR an alias for \f(CW$There::green\fR, but doesn't +make \f(CW@Here::blue\fR an alias for \f(CW@There::green\fR, or \f(CW%Here::blue\fR an alias for +\&\f(CW%There::green\fR, etc. See \*(L"Symbol Tables\*(R" in perlmod for more examples +of this. Strange though this may seem, this is the basis for the whole +module import/export system. +.PP +Another use for typeglobs is to pass filehandles into a function or +to create new filehandles. If you need to use a typeglob to save away +a filehandle, do it this way: +.PP +.Vb 1 +\& $fh = *STDOUT; +.Ve +.PP +or perhaps as a real reference, like this: +.PP +.Vb 1 +\& $fh = \e*STDOUT; +.Ve +.PP +See perlsub for examples of using these as indirect filehandles +in functions. +.PP +Typeglobs are also a way to create a local filehandle using the \fBlocal()\fR +operator. These last until their block is exited, but may be passed back. +For example: +.PP +.Vb 7 +\& sub newopen { +\& my $path = shift; +\& local *FH; # not my! +\& open (FH, $path) or return undef; +\& return *FH; +\& } +\& $fh = newopen(\*(Aq/etc/passwd\*(Aq); +.Ve +.PP +Now that we have the \f(CW*foo{THING}\fR notation, typeglobs aren't used as much +for filehandle manipulations, although they're still needed to pass brand +new file and directory handles into or out of functions. That's because +\&\f(CW*HANDLE{IO}\fR only works if \s-1HANDLE\s0 has already been used as a handle. +In other words, \f(CW*FH\fR must be used to create new symbol table entries; +\&\f(CW*foo{THING}\fR cannot. When in doubt, use \f(CW*FH\fR. +.PP +All functions that are capable of creating filehandles (\fBopen()\fR, +\&\fBopendir()\fR, \fBpipe()\fR, \fBsocketpair()\fR, \fBsysopen()\fR, \fBsocket()\fR, and \fBaccept()\fR) +automatically create an anonymous filehandle if the handle passed to +them is an uninitialized scalar variable. This allows the constructs +such as \f(CW\*(C`open(my $fh, ...)\*(C'\fR and \f(CW\*(C`open(local $fh,...)\*(C'\fR to be used to +create filehandles that will conveniently be closed automatically when +the scope ends, provided there are no other references to them. This +largely eliminates the need for typeglobs when opening filehandles +that must be passed around, as in the following example: +.PP +.Vb 5 +\& sub myopen { +\& open my $fh, "@_" +\& or die "Can\*(Aqt open \*(Aq@_\*(Aq: $!"; +\& return $fh; +\& } +\& +\& { +\& my $f = myopen("; +\& # $f implicitly closed here +\& } +.Ve +.PP +Note that if an initialized scalar variable is used instead the +result is different: \f(CW\*(C`my $fh=\*(Aqzzz\*(Aq; open($fh, ...)\*(C'\fR is equivalent +to \f(CW\*(C`open( *{\*(Aqzzz\*(Aq}, ...)\*(C'\fR. +\&\f(CW\*(C`use strict \*(Aqrefs\*(Aq\*(C'\fR forbids such practice. +.PP +Another way to create anonymous filehandles is with the Symbol +module or with the IO::Handle module and its ilk. These modules +have the advantage of not hiding different types of the same name +during the \fBlocal()\fR. See the bottom of \*(L"open\*(R" in perlfunc for an +example. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +See perlvar for a description of Perl's built-in variables and +a discussion of legal variable names. See perlref, perlsub, +and \*(L"Symbol Tables\*(R" in perlmod for more discussion on typeglobs and +the \f(CW*foo{THING}\fR syntax. diff --git a/data/miniconda3/man/man1/perldebtut.1 b/data/miniconda3/man/man1/perldebtut.1 new file mode 100644 index 0000000000000000000000000000000000000000..bcf59cfb83da6edf281faf5aafe933a5894c5651 --- /dev/null +++ b/data/miniconda3/man/man1/perldebtut.1 @@ -0,0 +1,948 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLDEBTUT 1" +.TH PERLDEBTUT 1 "2020-12-18" "perl v5.32.1" "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" +perldebtut \- Perl debugging tutorial +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +A (very) lightweight introduction in the use of the perl debugger, and a +pointer to existing, deeper sources of information on the subject of debugging +perl programs. +.PP +There's an extraordinary number of people out there who don't appear to know +anything about using the perl debugger, though they use the language every +day. +This is for them. +.SH "use strict" +.IX Header "use strict" +First of all, there's a few things you can do to make your life a lot more +straightforward when it comes to debugging perl programs, without using the +debugger at all. To demonstrate, here's a simple script, named \*(L"hello\*(R", with +a problem: +.PP +.Vb 1 +\& #!/usr/bin/perl +\& +\& $var1 = \*(AqHello World\*(Aq; # always wanted to do that :\-) +\& $var2 = "$varl\en"; +\& +\& print $var2; +\& exit; +.Ve +.PP +While this compiles and runs happily, it probably won't do what's expected, +namely it doesn't print \*(L"Hello World\en\*(R" at all; It will on the other hand do +exactly what it was told to do, computers being a bit that way inclined. That +is, it will print out a newline character, and you'll get what looks like a +blank line. It looks like there's 2 variables when (because of the typo) +there's really 3: +.PP +.Vb 3 +\& $var1 = \*(AqHello World\*(Aq; +\& $varl = undef; +\& $var2 = "\en"; +.Ve +.PP +To catch this kind of problem, we can force each variable to be declared +before use by pulling in the strict module, by putting 'use strict;' after the +first line of the script. +.PP +Now when you run it, perl complains about the 3 undeclared variables and we +get four error messages because one variable is referenced twice: +.PP +.Vb 5 +\& Global symbol "$var1" requires explicit package name at ./t1 line 4. +\& Global symbol "$var2" requires explicit package name at ./t1 line 5. +\& Global symbol "$varl" requires explicit package name at ./t1 line 5. +\& Global symbol "$var2" requires explicit package name at ./t1 line 7. +\& Execution of ./hello aborted due to compilation errors. +.Ve +.PP +Luvverly! and to fix this we declare all variables explicitly and now our +script looks like this: +.PP +.Vb 2 +\& #!/usr/bin/perl +\& use strict; +\& +\& my $var1 = \*(AqHello World\*(Aq; +\& my $varl = undef; +\& my $var2 = "$varl\en"; +\& +\& print $var2; +\& exit; +.Ve +.PP +We then do (always a good idea) a syntax check before we try to run it again: +.PP +.Vb 2 +\& > perl \-c hello +\& hello syntax OK +.Ve +.PP +And now when we run it, we get \*(L"\en\*(R" still, but at least we know why. Just +getting this script to compile has exposed the '$varl' (with the letter 'l') +variable, and simply changing \f(CW$varl\fR to \f(CW$var1\fR solves the problem. +.SH "Looking at data and \-w and v" +.IX Header "Looking at data and -w and v" +Ok, but how about when you want to really see your data, what's in that +dynamic variable, just before using it? +.PP +.Vb 2 +\& #!/usr/bin/perl +\& use strict; +\& +\& my $key = \*(Aqwelcome\*(Aq; +\& my %data = ( +\& \*(Aqthis\*(Aq => qw(that), +\& \*(Aqtom\*(Aq => qw(and jerry), +\& \*(Aqwelcome\*(Aq => q(Hello World), +\& \*(Aqzip\*(Aq => q(welcome), +\& ); +\& my @data = keys %data; +\& +\& print "$data{$key}\en"; +\& exit; +.Ve +.PP +Looks \s-1OK,\s0 after it's been through the syntax check (perl \-c scriptname), we +run it and all we get is a blank line again! Hmmmm. +.PP +One common debugging approach here, would be to liberally sprinkle a few print +statements, to add a check just before we print out our data, and another just +after: +.PP +.Vb 3 +\& print "All OK\en" if grep($key, keys %data); +\& print "$data{$key}\en"; +\& print "done: \*(Aq$data{$key}\*(Aq\en"; +.Ve +.PP +And try again: +.PP +.Vb 2 +\& > perl data +\& All OK +\& +\& done: \*(Aq\*(Aq +.Ve +.PP +After much staring at the same piece of code and not seeing the wood for the +trees for some time, we get a cup of coffee and try another approach. That +is, we bring in the cavalry by giving perl the '\fB\-d\fR' switch on the command +line: +.PP +.Vb 2 +\& > perl \-d data +\& Default die handler restored. +\& +\& Loading DB routines from perl5db.pl version 1.07 +\& Editor support available. +\& +\& Enter h or \`h h\*(Aq for help, or \`man perldebug\*(Aq for more help. +\& +\& main::(./data:4): my $key = \*(Aqwelcome\*(Aq; +.Ve +.PP +Now, what we've done here is to launch the built-in perl debugger on our +script. It's stopped at the first line of executable code and is waiting for +input. +.PP +Before we go any further, you'll want to know how to quit the debugger: use +just the letter '\fBq\fR', not the words 'quit' or 'exit': +.PP +.Vb 2 +\& DB<1> q +\& > +.Ve +.PP +That's it, you're back on home turf again. +.SH "help" +.IX Header "help" +Fire the debugger up again on your script and we'll look at the help menu. +There's a couple of ways of calling help: a simple '\fBh\fR' will get the summary +help list, '\fB|h\fR' (pipe-h) will pipe the help through your pager (which is +(probably 'more' or 'less'), and finally, '\fBh h\fR' (h\-space-h) will give you +the entire help screen. Here is the summary page: +.PP +D\fB1\fRh +.PP +.Vb 10 +\& List/search source lines: Control script execution: +\& l [ln|sub] List source code T Stack trace +\& \- or . List previous/current line s [expr] Single step +\& [in expr] +\& v [line] View around line n [expr] Next, steps over +\& subs +\& f filename View source in file Repeat last n or s +\& /pattern/ ?patt? Search forw/backw r Return from +\& subroutine +\& M Show module versions c [ln|sub] Continue until +\& position +\& Debugger controls: L List break/watch/ +\& actions +\& o [...] Set debugger options t [expr] Toggle trace +\& [trace expr] +\& <[<]|{[{]|>[>] [cmd] Do pre/post\-prompt b [ln|event|sub] [cnd] Set +\& breakpoint +\& ! [N|pat] Redo a previous command B ln|* Delete a/all +\& breakpoints +\& H [\-num] Display last num commands a [ln] cmd Do cmd before line +\& = [a val] Define/list an alias A ln|* Delete a/all +\& actions +\& h [db_cmd] Get help on command w expr Add a watch +\& expression +\& h h Complete help page W expr|* Delete a/all watch +\& exprs +\& |[|]db_cmd Send output to pager ![!] syscmd Run cmd in a +\& subprocess +\& q or ^D Quit R Attempt a restart +\& Data Examination: expr Execute perl code, also see: s,n,t expr +\& x|m expr Evals expr in list context, dumps the result or lists +\& methods. +\& p expr Print expression (uses script\*(Aqs current package). +\& S [[!]pat] List subroutine names [not] matching pattern +\& V [Pk [Vars]] List Variables in Package. Vars can be ~pattern or +\& !pattern. +\& X [Vars] Same as "V current_package [Vars]". +\& y [n [Vars]] List lexicals in higher scope . Vars same as V. +\& For more help, type h cmd_letter, or run man perldebug for all docs. +.Ve +.PP +More confusing options than you can shake a big stick at! It's not as bad as +it looks and it's very useful to know more about all of it, and fun too! +.PP +There's a couple of useful ones to know about straight away. You wouldn't +think we're using any libraries at all at the moment, but '\fBM\fR' will show +which modules are currently loaded, and their version number, while '\fBm\fR' +will show the methods, and '\fBS\fR' shows all subroutines (by pattern) as +shown below. '\fBV\fR' and '\fBX\fR' show variables in the program by package +scope and can be constrained by pattern. +.PP +.Vb 5 +\& DB<2>S str +\& dumpvar::stringify +\& strict::bits +\& strict::import +\& strict::unimport +.Ve +.PP +Using 'X' and cousins requires you not to use the type identifiers ($@%), just +the 'name': +.PP +.Vb 2 +\& DM<3>X ~err +\& FileHandle(stderr) => fileno(2) +.Ve +.PP +Remember we're in our tiny program with a problem, we should have a look at +where we are, and what our data looks like. First of all let's view some code +at our present position (the first line of code in this case), via '\fBv\fR': +.PP +.Vb 11 +\& DB<4> v +\& 1 #!/usr/bin/perl +\& 2: use strict; +\& 3 +\& 4==> my $key = \*(Aqwelcome\*(Aq; +\& 5: my %data = ( +\& 6 \*(Aqthis\*(Aq => qw(that), +\& 7 \*(Aqtom\*(Aq => qw(and jerry), +\& 8 \*(Aqwelcome\*(Aq => q(Hello World), +\& 9 \*(Aqzip\*(Aq => q(welcome), +\& 10 ); +.Ve +.PP +At line number 4 is a helpful pointer, that tells you where you are now. To +see more code, type 'v' again: +.PP +.Vb 9 +\& DB<4> v +\& 8 \*(Aqwelcome\*(Aq => q(Hello World), +\& 9 \*(Aqzip\*(Aq => q(welcome), +\& 10 ); +\& 11: my @data = keys %data; +\& 12: print "All OK\en" if grep($key, keys %data); +\& 13: print "$data{$key}\en"; +\& 14: print "done: \*(Aq$data{$key}\*(Aq\en"; +\& 15: exit; +.Ve +.PP +And if you wanted to list line 5 again, type 'l 5', (note the space): +.PP +.Vb 2 +\& DB<4> l 5 +\& 5: my %data = ( +.Ve +.PP +In this case, there's not much to see, but of course normally there's pages of +stuff to wade through, and 'l' can be very useful. To reset your view to the +line we're about to execute, type a lone period '.': +.PP +.Vb 2 +\& DB<5> . +\& main::(./data_a:4): my $key = \*(Aqwelcome\*(Aq; +.Ve +.PP +The line shown is the one that is about to be executed \fBnext\fR, it hasn't +happened yet. So while we can print a variable with the letter '\fBp\fR', at +this point all we'd get is an empty (undefined) value back. What we need to +do is to step through the next executable statement with an '\fBs\fR': +.PP +.Vb 7 +\& DB<6> s +\& main::(./data_a:5): my %data = ( +\& main::(./data_a:6): \*(Aqthis\*(Aq => qw(that), +\& main::(./data_a:7): \*(Aqtom\*(Aq => qw(and jerry), +\& main::(./data_a:8): \*(Aqwelcome\*(Aq => q(Hello World), +\& main::(./data_a:9): \*(Aqzip\*(Aq => q(welcome), +\& main::(./data_a:10): ); +.Ve +.PP +Now we can have a look at that first ($key) variable: +.PP +.Vb 2 +\& DB<7> p $key +\& welcome +.Ve +.PP +line 13 is where the action is, so let's continue down to there via the letter +\&'\fBc\fR', which by the way, inserts a 'one\-time\-only' breakpoint at the given +line or sub routine: +.PP +.Vb 3 +\& DB<8> c 13 +\& All OK +\& main::(./data_a:13): print "$data{$key}\en"; +.Ve +.PP +We've gone past our check (where 'All \s-1OK\s0' was printed) and have stopped just +before the meat of our task. We could try to print out a couple of variables +to see what is happening: +.PP +.Vb 1 +\& DB<9> p $data{$key} +.Ve +.PP +Not much in there, lets have a look at our hash: +.PP +.Vb 2 +\& DB<10> p %data +\& Hello Worldziptomandwelcomejerrywelcomethisthat +\& +\& DB<11> p keys %data +\& Hello Worldtomwelcomejerrythis +.Ve +.PP +Well, this isn't very easy to read, and using the helpful manual (\fBh h\fR), the +\&'\fBx\fR' command looks promising: +.PP +.Vb 11 +\& DB<12> x %data +\& 0 \*(AqHello World\*(Aq +\& 1 \*(Aqzip\*(Aq +\& 2 \*(Aqtom\*(Aq +\& 3 \*(Aqand\*(Aq +\& 4 \*(Aqwelcome\*(Aq +\& 5 undef +\& 6 \*(Aqjerry\*(Aq +\& 7 \*(Aqwelcome\*(Aq +\& 8 \*(Aqthis\*(Aq +\& 9 \*(Aqthat\*(Aq +.Ve +.PP +That's not much help, a couple of welcomes in there, but no indication of +which are keys, and which are values, it's just a listed array dump and, in +this case, not particularly helpful. The trick here, is to use a \fBreference\fR +to the data structure: +.PP +.Vb 7 +\& DB<13> x \e%data +\& 0 HASH(0x8194bc4) +\& \*(AqHello World\*(Aq => \*(Aqzip\*(Aq +\& \*(Aqjerry\*(Aq => \*(Aqwelcome\*(Aq +\& \*(Aqthis\*(Aq => \*(Aqthat\*(Aq +\& \*(Aqtom\*(Aq => \*(Aqand\*(Aq +\& \*(Aqwelcome\*(Aq => undef +.Ve +.PP +The reference is truly dumped and we can finally see what we're dealing with. +Our quoting was perfectly valid but wrong for our purposes, with 'and jerry' +being treated as 2 separate words rather than a phrase, thus throwing the +evenly paired hash structure out of alignment. +.PP +The '\fB\-w\fR' switch would have told us about this, had we used it at the start, +and saved us a lot of trouble: +.PP +.Vb 2 +\& > perl \-w data +\& Odd number of elements in hash assignment at ./data line 5. +.Ve +.PP +We fix our quoting: 'tom' => q(and jerry), and run it again, this time we get +our expected output: +.PP +.Vb 2 +\& > perl \-w data +\& Hello World +.Ve +.PP +While we're here, take a closer look at the '\fBx\fR' command, it's really useful +and will merrily dump out nested references, complete objects, partial objects +\&\- just about whatever you throw at it: +.PP +Let's make a quick object and x\-plode it, first we'll start the debugger: +it wants some form of input from \s-1STDIN,\s0 so we give it something non-committal, +a zero: +.PP +.Vb 2 +\& > perl \-de 0 +\& Default die handler restored. +\& +\& Loading DB routines from perl5db.pl version 1.07 +\& Editor support available. +\& +\& Enter h or \`h h\*(Aq for help, or \`man perldebug\*(Aq for more help. +\& +\& main::(\-e:1): 0 +.Ve +.PP +Now build an on-the-fly object over a couple of lines (note the backslash): +.PP +.Vb 2 +\& DB<1> $obj = bless({\*(Aqunique_id\*(Aq=>\*(Aq123\*(Aq, \*(Aqattr\*(Aq=> \e +\& cont: {\*(Aqcol\*(Aq => \*(Aqblack\*(Aq, \*(Aqthings\*(Aq => [qw(this that etc)]}}, \*(AqMY_class\*(Aq) +.Ve +.PP +And let's have a look at it: +.PP +.Vb 10 +\& DB<2> x $obj +\& 0 MY_class=HASH(0x828ad98) +\& \*(Aqattr\*(Aq => HASH(0x828ad68) +\& \*(Aqcol\*(Aq => \*(Aqblack\*(Aq +\& \*(Aqthings\*(Aq => ARRAY(0x828abb8) +\& 0 \*(Aqthis\*(Aq +\& 1 \*(Aqthat\*(Aq +\& 2 \*(Aqetc\*(Aq +\& \*(Aqunique_id\*(Aq => 123 +\& DB<3> +.Ve +.PP +Useful, huh? You can eval nearly anything in there, and experiment with bits +of code or regexes until the cows come home: +.PP +.Vb 1 +\& DB<3> @data = qw(this that the other atheism leather theory scythe) +\& +\& DB<4> p \*(Aqsaw \-> \*(Aq.($cnt += map { print "\et:\et$_\en" } grep(/the/, sort @data)) +\& atheism +\& leather +\& other +\& scythe +\& the +\& theory +\& saw \-> 6 +.Ve +.PP +If you want to see the command History, type an '\fBH\fR': +.PP +.Vb 7 +\& DB<5> H +\& 4: p \*(Aqsaw \-> \*(Aq.($cnt += map { print "\et:\et$_\en" } grep(/the/, sort @data)) +\& 3: @data = qw(this that the other atheism leather theory scythe) +\& 2: x $obj +\& 1: $obj = bless({\*(Aqunique_id\*(Aq=>\*(Aq123\*(Aq, \*(Aqattr\*(Aq=> +\& {\*(Aqcol\*(Aq => \*(Aqblack\*(Aq, \*(Aqthings\*(Aq => [qw(this that etc)]}}, \*(AqMY_class\*(Aq) +\& DB<5> +.Ve +.PP +And if you want to repeat any previous command, use the exclamation: '\fB!\fR': +.PP +.Vb 9 +\& DB<5> !4 +\& p \*(Aqsaw \-> \*(Aq.($cnt += map { print "$_\en" } grep(/the/, sort @data)) +\& atheism +\& leather +\& other +\& scythe +\& the +\& theory +\& saw \-> 12 +.Ve +.PP +For more on references see perlref and perlreftut +.SH "Stepping through code" +.IX Header "Stepping through code" +Here's a simple program which converts between Celsius and Fahrenheit, it too +has a problem: +.PP +.Vb 2 +\& #!/usr/bin/perl \-w +\& use strict; +\& +\& my $arg = $ARGV[0] || \*(Aq\-c20\*(Aq; +\& +\& if ($arg =~ /^\e\-(c|f)((\e\-|\e+)*\ed+(\e.\ed+)*)$/) { +\& my ($deg, $num) = ($1, $2); +\& my ($in, $out) = ($num, $num); +\& if ($deg eq \*(Aqc\*(Aq) { +\& $deg = \*(Aqf\*(Aq; +\& $out = &c2f($num); +\& } else { +\& $deg = \*(Aqc\*(Aq; +\& $out = &f2c($num); +\& } +\& $out = sprintf(\*(Aq%0.2f\*(Aq, $out); +\& $out =~ s/^((\e\-|\e+)*\ed+)\e.0+$/$1/; +\& print "$out $deg\en"; +\& } else { +\& print "Usage: $0 \-[c|f] num\en"; +\& } +\& exit; +\& +\& sub f2c { +\& my $f = shift; +\& my $c = 5 * $f \- 32 / 9; +\& return $c; +\& } +\& +\& sub c2f { +\& my $c = shift; +\& my $f = 9 * $c / 5 + 32; +\& return $f; +\& } +.Ve +.PP +For some reason, the Fahrenheit to Celsius conversion fails to return the +expected output. This is what it does: +.PP +.Vb 2 +\& > temp \-c0.72 +\& 33.30 f +\& +\& > temp \-f33.3 +\& 162.94 c +.Ve +.PP +Not very consistent! We'll set a breakpoint in the code manually and run it +under the debugger to see what's going on. A breakpoint is a flag, to which +the debugger will run without interruption, when it reaches the breakpoint, it +will stop execution and offer a prompt for further interaction. In normal +use, these debugger commands are completely ignored, and they are safe \- if a +little messy, to leave in production code. +.PP +.Vb 4 +\& my ($in, $out) = ($num, $num); +\& $DB::single=2; # insert at line 9! +\& if ($deg eq \*(Aqc\*(Aq) +\& ... +\& +\& > perl \-d temp \-f33.3 +\& Default die handler restored. +\& +\& Loading DB routines from perl5db.pl version 1.07 +\& Editor support available. +\& +\& Enter h or \`h h\*(Aq for help, or \`man perldebug\*(Aq for more help. +\& +\& main::(temp:4): my $arg = $ARGV[0] || \*(Aq\-c100\*(Aq; +.Ve +.PP +We'll simply continue down to our pre-set breakpoint with a '\fBc\fR': +.PP +.Vb 2 +\& DB<1> c +\& main::(temp:10): if ($deg eq \*(Aqc\*(Aq) { +.Ve +.PP +Followed by a view command to see where we are: +.PP +.Vb 11 +\& DB<1> v +\& 7: my ($deg, $num) = ($1, $2); +\& 8: my ($in, $out) = ($num, $num); +\& 9: $DB::single=2; +\& 10==> if ($deg eq \*(Aqc\*(Aq) { +\& 11: $deg = \*(Aqf\*(Aq; +\& 12: $out = &c2f($num); +\& 13 } else { +\& 14: $deg = \*(Aqc\*(Aq; +\& 15: $out = &f2c($num); +\& 16 } +.Ve +.PP +And a print to show what values we're currently using: +.PP +.Vb 2 +\& DB<1> p $deg, $num +\& f33.3 +.Ve +.PP +We can put another break point on any line beginning with a colon, we'll use +line 17 as that's just as we come out of the subroutine, and we'd like to +pause there later on: +.PP +.Vb 1 +\& DB<2> b 17 +.Ve +.PP +There's no feedback from this, but you can see what breakpoints are set by +using the list 'L' command: +.PP +.Vb 4 +\& DB<3> L +\& temp: +\& 17: print "$out $deg\en"; +\& break if (1) +.Ve +.PP +Note that to delete a breakpoint you use 'B'. +.PP +Now we'll continue down into our subroutine, this time rather than by line +number, we'll use the subroutine name, followed by the now familiar 'v': +.PP +.Vb 2 +\& DB<3> c f2c +\& main::f2c(temp:30): my $f = shift; +\& +\& DB<4> v +\& 24: exit; +\& 25 +\& 26 sub f2c { +\& 27==> my $f = shift; +\& 28: my $c = 5 * $f \- 32 / 9; +\& 29: return $c; +\& 30 } +\& 31 +\& 32 sub c2f { +\& 33: my $c = shift; +.Ve +.PP +Note that if there was a subroutine call between us and line 29, and we wanted +to \fBsingle-step\fR through it, we could use the '\fBs\fR' command, and to step +over it we would use '\fBn\fR' which would execute the sub, but not descend into +it for inspection. In this case though, we simply continue down to line 29: +.PP +.Vb 2 +\& DB<4> c 29 +\& main::f2c(temp:29): return $c; +.Ve +.PP +And have a look at the return value: +.PP +.Vb 2 +\& DB<5> p $c +\& 162.944444444444 +.Ve +.PP +This is not the right answer at all, but the sum looks correct. I wonder if +it's anything to do with operator precedence? We'll try a couple of other +possibilities with our sum: +.PP +.Vb 2 +\& DB<6> p (5 * $f \- 32 / 9) +\& 162.944444444444 +\& +\& DB<7> p 5 * $f \- (32 / 9) +\& 162.944444444444 +\& +\& DB<8> p (5 * $f) \- 32 / 9 +\& 162.944444444444 +\& +\& DB<9> p 5 * ($f \- 32) / 9 +\& 0.722222222222221 +.Ve +.PP +:\-) that's more like it! Ok, now we can set our return variable and we'll +return out of the sub with an 'r': +.PP +.Vb 1 +\& DB<10> $c = 5 * ($f \- 32) / 9 +\& +\& DB<11> r +\& scalar context return from main::f2c: 0.722222222222221 +.Ve +.PP +Looks good, let's just continue off the end of the script: +.PP +.Vb 5 +\& DB<12> c +\& 0.72 c +\& Debugged program terminated. Use q to quit or R to restart, +\& use O inhibit_exit to avoid stopping after program termination, +\& h q, h R or h O to get additional info. +.Ve +.PP +A quick fix to the offending line (insert the missing parentheses) in the +actual program and we're finished. +.SH "Placeholder for a, w, t, T" +.IX Header "Placeholder for a, w, t, T" +Actions, watch variables, stack traces etc.: on the \s-1TODO\s0 list. +.PP +.Vb 1 +\& a +\& +\& w +\& +\& t +\& +\& T +.Ve +.SH "REGULAR EXPRESSIONS" +.IX Header "REGULAR EXPRESSIONS" +Ever wanted to know what a regex looked like? You'll need perl compiled with +the \s-1DEBUGGING\s0 flag for this one: +.PP +.Vb 10 +\& > perl \-Dr \-e \*(Aq/^pe(a)*rl$/i\*(Aq +\& Compiling REx \`^pe(a)*rl$\*(Aq +\& size 17 first at 2 +\& rarest char +\& at 0 +\& 1: BOL(2) +\& 2: EXACTF (4) +\& 4: CURLYN[1] {0,32767}(14) +\& 6: NOTHING(8) +\& 8: EXACTF (0) +\& 12: WHILEM(0) +\& 13: NOTHING(14) +\& 14: EXACTF (16) +\& 16: EOL(17) +\& 17: END(0) +\& floating \`\*(Aq$ at 4..2147483647 (checking floating) stclass +\& \`EXACTF \*(Aq anchored(BOL) minlen 4 +\& Omitting $\` $& $\*(Aq support. +\& +\& EXECUTING... +\& +\& Freeing REx: \`^pe(a)*rl$\*(Aq +.Ve +.PP +Did you really want to know? :\-) +For more gory details on getting regular expressions to work, have a look at +perlre, perlretut, and to decode the mysterious labels (\s-1BOL\s0 and \s-1CURLYN,\s0 +etc. above), see perldebguts. +.SH "OUTPUT TIPS" +.IX Header "OUTPUT TIPS" +To get all the output from your error log, and not miss any messages via +helpful operating system buffering, insert a line like this, at the start of +your script: +.PP +.Vb 1 +\& $|=1; +.Ve +.PP +To watch the tail of a dynamically growing logfile, (from the command line): +.PP +.Vb 1 +\& tail \-f $error_log +.Ve +.PP +Wrapping all die calls in a handler routine can be useful to see how, and from +where, they're being called, perlvar has more information: +.PP +.Vb 1 +\& BEGIN { $SIG{_\|_DIE_\|_} = sub { require Carp; Carp::confess(@_) } } +.Ve +.PP +Various useful techniques for the redirection of \s-1STDOUT\s0 and \s-1STDERR\s0 filehandles +are explained in perlopentut and perlfaq8. +.SH "CGI" +.IX Header "CGI" +Just a quick hint here for all those \s-1CGI\s0 programmers who can't figure out how +on earth to get past that 'waiting for input' prompt, when running their \s-1CGI\s0 +script from the command-line, try something like this: +.PP +.Vb 1 +\& > perl \-d my_cgi.pl \-nodebug +.Ve +.PP +Of course \s-1CGI\s0 and perlfaq9 will tell you more. +.SH "GUIs" +.IX Header "GUIs" +The command line interface is tightly integrated with an \fBemacs\fR extension +and there's a \fBvi\fR interface too. +.PP +You don't have to do this all on the command line, though, there are a few \s-1GUI\s0 +options out there. The nice thing about these is you can wave a mouse over a +variable and a dump of its data will appear in an appropriate window, or in a +popup balloon, no more tiresome typing of 'x \f(CW$varname\fR' :\-) +.PP +In particular have a hunt around for the following: +.PP +\&\fBptkdb\fR perlTK based wrapper for the built-in debugger +.PP +\&\fBddd\fR data display debugger +.PP +\&\fBPerlDevKit\fR and \fBPerlBuilder\fR are \s-1NT\s0 specific +.PP +\&\s-1NB.\s0 (more info on these and others would be appreciated). +.SH "SUMMARY" +.IX Header "SUMMARY" +We've seen how to encourage good coding practices with \fBuse strict\fR and +\&\fB\-w\fR. We can run the perl debugger \fBperl \-d scriptname\fR to inspect your +data from within the perl debugger with the \fBp\fR and \fBx\fR commands. You can +walk through your code, set breakpoints with \fBb\fR and step through that code +with \fBs\fR or \fBn\fR, continue with \fBc\fR and return from a sub with \fBr\fR. Fairly +intuitive stuff when you get down to it. +.PP +There is of course lots more to find out about, this has just scratched the +surface. The best way to learn more is to use perldoc to find out more about +the language, to read the on-line help (perldebug is probably the next +place to go), and of course, experiment. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perldebug, +perldebguts, +perldiag, +perlrun +.SH "AUTHOR" +.IX Header "AUTHOR" +Richard Foley Copyright (c) 2000 +.SH "CONTRIBUTORS" +.IX Header "CONTRIBUTORS" +Various people have made helpful suggestions and contributions, in particular: +.PP +Ronald J Kimball +.PP +Hugo van der Sanden +.PP +Peter Scott diff --git a/data/miniconda3/man/man1/perldebug.1 b/data/miniconda3/man/man1/perldebug.1 new file mode 100644 index 0000000000000000000000000000000000000000..e6c056ea9e88db7ed7ba9277d49443f3cc09cac7 --- /dev/null +++ b/data/miniconda3/man/man1/perldebug.1 @@ -0,0 +1,1274 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLDEBUG 1" +.TH PERLDEBUG 1 "2020-12-18" "perl v5.32.1" "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" +perldebug \- Perl debugging +.IX Xref "debug debugger" +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +First of all, have you tried using \f(CW\*(C`use strict;\*(C'\fR and +\&\f(CW\*(C`use warnings;\*(C'\fR? +.PP +If you're new to the Perl debugger, you may prefer to read +perldebtut, which is a tutorial introduction to the debugger. +.PP +If you're looking for the nitty gritty details of how the debugger is +\&\fIimplemented\fR, you may prefer to read perldebguts. +.SH "The Perl Debugger" +.IX Header "The Perl Debugger" +If you invoke Perl with the \fB\-d\fR switch, your script runs under the +Perl source debugger. This works like an interactive Perl +environment, prompting for debugger commands that let you examine +source code, set breakpoints, get stack backtraces, change the values of +variables, etc. This is so convenient that you often fire up +the debugger all by itself just to test out Perl constructs +interactively to see what they do. For example: +.IX Xref "-d" +.PP +.Vb 1 +\& $ perl \-d \-e 42 +.Ve +.PP +In Perl, the debugger is not a separate program the way it usually is in the +typical compiled environment. Instead, the \fB\-d\fR flag tells the compiler +to insert source information into the parse trees it's about to hand off +to the interpreter. That means your code must first compile correctly +for the debugger to work on it. Then when the interpreter starts up, it +preloads a special Perl library file containing the debugger. +.PP +The program will halt \fIright before\fR the first run-time executable +statement (but see below regarding compile-time statements) and ask you +to enter a debugger command. Contrary to popular expectations, whenever +the debugger halts and shows you a line of code, it always displays the +line it's \fIabout\fR to execute, rather than the one it has just executed. +.PP +Any command not recognized by the debugger is directly executed +(\f(CW\*(C`eval\*(C'\fR'd) as Perl code in the current package. (The debugger +uses the \s-1DB\s0 package for keeping its own state information.) +.PP +Note that the said \f(CW\*(C`eval\*(C'\fR is bound by an implicit scope. As a +result any newly introduced lexical variable or any modified +capture buffer content is lost after the eval. The debugger is a +nice environment to learn Perl, but if you interactively experiment using +material which should be in the same scope, stuff it in one line. +.PP +For any text entered at the debugger prompt, leading and trailing whitespace +is first stripped before further processing. If a debugger command +coincides with some function in your own program, merely precede the +function with something that doesn't look like a debugger command, such +as a leading \f(CW\*(C`;\*(C'\fR or perhaps a \f(CW\*(C`+\*(C'\fR, or by wrapping it with parentheses +or braces. +.SS "Calling the Debugger" +.IX Subsection "Calling the Debugger" +There are several ways to call the debugger: +.IP "perl \-d program_name" 4 +.IX Item "perl -d program_name" +On the given program identified by \f(CW\*(C`program_name\*(C'\fR. +.IP "perl \-d \-e 0" 4 +.IX Item "perl -d -e 0" +Interactively supply an arbitrary \f(CW\*(C`expression\*(C'\fR using \f(CW\*(C`\-e\*(C'\fR. +.IP "perl \-d:ptkdb program_name" 4 +.IX Item "perl -d:ptkdb program_name" +Debug a given program via the \f(CW\*(C`Devel::ptkdb\*(C'\fR \s-1GUI.\s0 +.IP "perl \-dt threaded_program_name" 4 +.IX Item "perl -dt threaded_program_name" +Debug a given program using threads (experimental). +.SS "Debugger Commands" +.IX Subsection "Debugger Commands" +The interactive debugger understands the following commands: +.IP "h" 12 +.IX Xref "debugger command, h" +.IX Item "h" +Prints out a summary help message +.IP "h [command]" 12 +.IX Item "h [command]" +Prints out a help message for the given debugger command. +.IP "h h" 12 +.IX Item "h h" +The special argument of \f(CW\*(C`h h\*(C'\fR produces the entire help page, which is quite long. +.Sp +If the output of the \f(CW\*(C`h h\*(C'\fR command (or any command, for that matter) scrolls +past your screen, precede the command with a leading pipe symbol so +that it's run through your pager, as in +.Sp +.Vb 1 +\& DB> |h h +.Ve +.Sp +You may change the pager which is used via \f(CW\*(C`o pager=...\*(C'\fR command. +.IP "p expr" 12 +.IX Xref "debugger command, p" +.IX Item "p expr" +Same as \f(CW\*(C`print {$DB::OUT} expr\*(C'\fR in the current package. In particular, +because this is just Perl's own \f(CW\*(C`print\*(C'\fR function, this means that nested +data structures and objects are not dumped, unlike with the \f(CW\*(C`x\*(C'\fR command. +.Sp +The \f(CW\*(C`DB::OUT\*(C'\fR filehandle is opened to \fI/dev/tty\fR, regardless of +where \s-1STDOUT\s0 may be redirected to. +.IP "x [maxdepth] expr" 12 +.IX Xref "debugger command, x" +.IX Item "x [maxdepth] expr" +Evaluates its expression in list context and dumps out the result in a +pretty-printed fashion. Nested data structures are printed out +recursively, unlike the real \f(CW\*(C`print\*(C'\fR function in Perl. When dumping +hashes, you'll probably prefer 'x \e%h' rather than 'x \f(CW%h\fR'. +See Dumpvalue if you'd like to do this yourself. +.Sp +The output format is governed by multiple options described under +\&\*(L"Configurable Options\*(R". +.Sp +If the \f(CW\*(C`maxdepth\*(C'\fR is included, it must be a numeral \fIN\fR; the value is +dumped only \fIN\fR levels deep, as if the \f(CW\*(C`dumpDepth\*(C'\fR option had been +temporarily set to \fIN\fR. +.IP "V [pkg [vars]]" 12 +.IX Xref "debugger command, V" +.IX Item "V [pkg [vars]]" +Display all (or some) variables in package (defaulting to \f(CW\*(C`main\*(C'\fR) +using a data pretty-printer (hashes show their keys and values so +you see what's what, control characters are made printable, etc.). +Make sure you don't put the type specifier (like \f(CW\*(C`$\*(C'\fR) there, just +the symbol names, like this: +.Sp +.Vb 1 +\& V DB filename line +.Ve +.Sp +Use \f(CW\*(C`~pattern\*(C'\fR and \f(CW\*(C`!pattern\*(C'\fR for positive and negative regexes. +.Sp +This is similar to calling the \f(CW\*(C`x\*(C'\fR command on each applicable var. +.IP "X [vars]" 12 +.IX Xref "debugger command, X" +.IX Item "X [vars]" +Same as \f(CW\*(C`V currentpackage [vars]\*(C'\fR. +.IP "y [level [vars]]" 12 +.IX Xref "debugger command, y" +.IX Item "y [level [vars]]" +Display all (or some) lexical variables (mnemonic: \f(CW\*(C`mY\*(C'\fR variables) +in the current scope or \fIlevel\fR scopes higher. You can limit the +variables that you see with \fIvars\fR which works exactly as it does +for the \f(CW\*(C`V\*(C'\fR and \f(CW\*(C`X\*(C'\fR commands. Requires the \f(CW\*(C`PadWalker\*(C'\fR module +version 0.08 or higher; will warn if this isn't installed. Output +is pretty-printed in the same style as for \f(CW\*(C`V\*(C'\fR and the format is +controlled by the same options. +.IP "T" 12 +.IX Xref "debugger command, T backtrace stack, backtrace" +.IX Item "T" +Produce a stack backtrace. See below for details on its output. +.IP "s [expr]" 12 +.IX Xref "debugger command, s step" +.IX Item "s [expr]" +Single step. Executes until the beginning of another +statement, descending into subroutine calls. If an expression is +supplied that includes function calls, it too will be single-stepped. +.IP "n [expr]" 12 +.IX Xref "debugger command, n" +.IX Item "n [expr]" +Next. Executes over subroutine calls, until the beginning +of the next statement. If an expression is supplied that includes +function calls, those functions will be executed with stops before +each statement. +.IP "r" 12 +.IX Xref "debugger command, r" +.IX Item "r" +Continue until the return from the current subroutine. +Dump the return value if the \f(CW\*(C`PrintRet\*(C'\fR option is set (default). +.IP "<\s-1CR\s0>" 12 +.IX Item "" +Repeat last \f(CW\*(C`n\*(C'\fR or \f(CW\*(C`s\*(C'\fR command. +.IP "c [line|sub]" 12 +.IX Xref "debugger command, c" +.IX Item "c [line|sub]" +Continue, optionally inserting a one-time-only breakpoint +at the specified line or subroutine. +.IP "l" 12 +.IX Xref "debugger command, l" +.IX Item "l" +List next window of lines. +.IP "l min+incr" 12 +.IX Item "l min+incr" +List \f(CW\*(C`incr+1\*(C'\fR lines starting at \f(CW\*(C`min\*(C'\fR. +.IP "l min-max" 12 +.IX Item "l min-max" +List lines \f(CW\*(C`min\*(C'\fR through \f(CW\*(C`max\*(C'\fR. \f(CW\*(C`l \-\*(C'\fR is synonymous to \f(CW\*(C`\-\*(C'\fR. +.IP "l line" 12 +.IX Item "l line" +List a single line. +.IP "l subname" 12 +.IX Item "l subname" +List first window of lines from subroutine. \fIsubname\fR may +be a variable that contains a code reference. +.IP "\-" 12 +.IX Xref "debugger command, -" +List previous window of lines. +.IP "v [line]" 12 +.IX Xref "debugger command, v" +.IX Item "v [line]" +View a few lines of code around the current line. +.IP "." 12 +.IX Xref "debugger command, ." +Return the internal debugger pointer to the line last +executed, and print out that line. +.IP "f filename" 12 +.IX Xref "debugger command, f" +.IX Item "f filename" +Switch to viewing a different file or \f(CW\*(C`eval\*(C'\fR statement. If \fIfilename\fR +is not a full pathname found in the values of \f(CW%INC\fR, it is considered +a regex. +.Sp +\&\f(CW\*(C`eval\*(C'\fRed strings (when accessible) are considered to be filenames: +\&\f(CW\*(C`f (eval 7)\*(C'\fR and \f(CW\*(C`f eval 7\eb\*(C'\fR access the body of the 7th \f(CW\*(C`eval\*(C'\fRed string +(in the order of execution). The bodies of the currently executed \f(CW\*(C`eval\*(C'\fR +and of \f(CW\*(C`eval\*(C'\fRed strings that define subroutines are saved and thus +accessible. +.IP "/pattern/" 12 +.IX Item "/pattern/" +Search forwards for pattern (a Perl regex); final / is optional. +The search is case-insensitive by default. +.IP "?pattern?" 12 +.IX Item "?pattern?" +Search backwards for pattern; final ? is optional. +The search is case-insensitive by default. +.IP "L [abw]" 12 +.IX Xref "debugger command, L" +.IX Item "L [abw]" +List (default all) actions, breakpoints and watch expressions +.IP "S [[!]regex]" 12 +.IX Xref "debugger command, S" +.IX Item "S [[!]regex]" +List subroutine names [not] matching the regex. +.IP "t [n]" 12 +.IX Xref "debugger command, t" +.IX Item "t [n]" +Toggle trace mode (see also the \f(CW\*(C`AutoTrace\*(C'\fR option). +Optional argument is the maximum number of levels to trace below +the current one; anything deeper than that will be silent. +.IP "t [n] expr" 12 +.IX Xref "debugger command, t" +.IX Item "t [n] expr" +Trace through execution of \f(CW\*(C`expr\*(C'\fR. +Optional first argument is the maximum number of levels to trace below +the current one; anything deeper than that will be silent. +See \*(L"Frame Listing Output Examples\*(R" in perldebguts for examples. +.IP "b" 12 +.IX Xref "breakpoint debugger command, b" +.IX Item "b" +Sets breakpoint on current line +.IP "b [line] [condition]" 12 +.IX Xref "breakpoint debugger command, b" +.IX Item "b [line] [condition]" +Set a breakpoint before the given line. If a condition +is specified, it's evaluated each time the statement is reached: a +breakpoint is taken only if the condition is true. Breakpoints may +only be set on lines that begin an executable statement. Conditions +don't use \f(CW\*(C`if\*(C'\fR: +.Sp +.Vb 3 +\& b 237 $x > 30 +\& b 237 ++$count237 < 11 +\& b 33 /pattern/i +.Ve +.Sp +If the line number is \f(CW\*(C`.\*(C'\fR, sets a breakpoint on the current line: +.Sp +.Vb 1 +\& b . $n > 100 +.Ve +.IP "b [file]:[line] [condition]" 12 +.IX Xref "breakpoint debugger command, b" +.IX Item "b [file]:[line] [condition]" +Set a breakpoint before the given line in a (possibly different) file. If a +condition is specified, it's evaluated each time the statement is reached: a +breakpoint is taken only if the condition is true. Breakpoints may only be set +on lines that begin an executable statement. Conditions don't use \f(CW\*(C`if\*(C'\fR: +.Sp +.Vb 2 +\& b lib/MyModule.pm:237 $x > 30 +\& b /usr/lib/perl5/site_perl/CGI.pm:100 ++$count100 < 11 +.Ve +.IP "b subname [condition]" 12 +.IX Xref "breakpoint debugger command, b" +.IX Item "b subname [condition]" +Set a breakpoint before the first line of the named subroutine. \fIsubname\fR may +be a variable containing a code reference (in this case \fIcondition\fR +is not supported). +.IP "b postpone subname [condition]" 12 +.IX Xref "breakpoint debugger command, b" +.IX Item "b postpone subname [condition]" +Set a breakpoint at first line of subroutine after it is compiled. +.IP "b load filename" 12 +.IX Xref "breakpoint debugger command, b" +.IX Item "b load filename" +Set a breakpoint before the first executed line of the \fIfilename\fR, +which should be a full pathname found amongst the \f(CW%INC\fR values. +.IP "b compile subname" 12 +.IX Xref "breakpoint debugger command, b" +.IX Item "b compile subname" +Sets a breakpoint before the first statement executed after the specified +subroutine is compiled. +.IP "B line" 12 +.IX Xref "breakpoint debugger command, B" +.IX Item "B line" +Delete a breakpoint from the specified \fIline\fR. +.IP "B *" 12 +.IX Xref "breakpoint debugger command, B" +.IX Item "B *" +Delete all installed breakpoints. +.IP "disable [file]:[line]" 12 +.IX Xref "breakpoint debugger command, disable disable" +.IX Item "disable [file]:[line]" +Disable the breakpoint so it won't stop the execution of the program. +Breakpoints are enabled by default and can be re-enabled using the \f(CW\*(C`enable\*(C'\fR +command. +.IP "disable [line]" 12 +.IX Xref "breakpoint debugger command, disable disable" +.IX Item "disable [line]" +Disable the breakpoint so it won't stop the execution of the program. +Breakpoints are enabled by default and can be re-enabled using the \f(CW\*(C`enable\*(C'\fR +command. +.Sp +This is done for a breakpoint in the current file. +.IP "enable [file]:[line]" 12 +.IX Xref "breakpoint debugger command, disable disable" +.IX Item "enable [file]:[line]" +Enable the breakpoint so it will stop the execution of the program. +.IP "enable [line]" 12 +.IX Xref "breakpoint debugger command, disable disable" +.IX Item "enable [line]" +Enable the breakpoint so it will stop the execution of the program. +.Sp +This is done for a breakpoint in the current file. +.IP "a [line] command" 12 +.IX Xref "debugger command, a" +.IX Item "a [line] command" +Set an action to be done before the line is executed. If \fIline\fR is +omitted, set an action on the line about to be executed. +The sequence of steps taken by the debugger is +.Sp +.Vb 5 +\& 1. check for a breakpoint at this line +\& 2. print the line if necessary (tracing) +\& 3. do any actions associated with that line +\& 4. prompt user if at a breakpoint or in single\-step +\& 5. evaluate line +.Ve +.Sp +For example, this will print out \f(CW$foo\fR every time line +53 is passed: +.Sp +.Vb 1 +\& a 53 print "DB FOUND $foo\en" +.Ve +.IP "A line" 12 +.IX Xref "debugger command, A" +.IX Item "A line" +Delete an action from the specified line. +.IP "A *" 12 +.IX Xref "debugger command, A" +.IX Item "A *" +Delete all installed actions. +.IP "w expr" 12 +.IX Xref "debugger command, w" +.IX Item "w expr" +Add a global watch-expression. Whenever a watched global changes the +debugger will stop and display the old and new values. +.IP "W expr" 12 +.IX Xref "debugger command, W" +.IX Item "W expr" +Delete watch-expression +.IP "W *" 12 +.IX Xref "debugger command, W" +.IX Item "W *" +Delete all watch-expressions. +.IP "o" 12 +.IX Xref "debugger command, o" +.IX Item "o" +Display all options. +.IP "o booloption ..." 12 +.IX Xref "debugger command, o" +.IX Item "o booloption ..." +Set each listed Boolean option to the value \f(CW1\fR. +.IP "o anyoption? ..." 12 +.IX Xref "debugger command, o" +.IX Item "o anyoption? ..." +Print out the value of one or more options. +.IP "o option=value ..." 12 +.IX Xref "debugger command, o" +.IX Item "o option=value ..." +Set the value of one or more options. If the value has internal +whitespace, it should be quoted. For example, you could set \f(CW\*(C`o +pager="less \-MQeicsNfr"\*(C'\fR to call \fBless\fR with those specific options. +You may use either single or double quotes, but if you do, you must +escape any embedded instances of same sort of quote you began with, +as well as any escaping any escapes that immediately precede that +quote but which are not meant to escape the quote itself. In other +words, you follow single-quoting rules irrespective of the quote; +eg: \f(CW\*(C`o option=\*(Aqthis isn\e\*(Aqt bad\*(Aq\*(C'\fR or \f(CW\*(C`o option="She said, \e"Isn\*(Aqt +it?\e""\*(C'\fR. +.Sp +For historical reasons, the \f(CW\*(C`=value\*(C'\fR is optional, but defaults to +1 only where it is safe to do so\*(--that is, mostly for Boolean +options. It is always better to assign a specific value using \f(CW\*(C`=\*(C'\fR. +The \f(CW\*(C`option\*(C'\fR can be abbreviated, but for clarity probably should +not be. Several options can be set together. See \*(L"Configurable Options\*(R" +for a list of these. +.IP "< ?" 12 +.IX Xref "debugger command, <" +List out all pre-prompt Perl command actions. +.IP "< [ command ]" 12 +.IX Xref "debugger command, <" +.IX Item "< [ command ]" +Set an action (Perl command) to happen before every debugger prompt. +A multi-line command may be entered by backslashing the newlines. +.IP "< *" 12 +.IX Xref "debugger command, <" +Delete all pre-prompt Perl command actions. +.IP "<< command" 12 +.IX Xref "debugger command, <<" +.IX Item "<< command" +Add an action (Perl command) to happen before every debugger prompt. +A multi-line command may be entered by backwhacking the newlines. +.IP "> ?" 12 +.IX Xref "debugger command, >" +List out post-prompt Perl command actions. +.IP "> command" 12 +.IX Xref "debugger command, >" +.IX Item "> command" +Set an action (Perl command) to happen after the prompt when you've +just given a command to return to executing the script. A multi-line +command may be entered by backslashing the newlines (we bet you +couldn't have guessed this by now). +.IP "> *" 12 +.IX Xref "debugger command, >" +Delete all post-prompt Perl command actions. +.IP ">> command" 12 +.IX Xref "debugger command, >>" +.IX Item ">> command" +Adds an action (Perl command) to happen after the prompt when you've +just given a command to return to executing the script. A multi-line +command may be entered by backslashing the newlines. +.IP "{ ?" 12 +.IX Xref "debugger command, {" +List out pre-prompt debugger commands. +.IP "{ [ command ]" 12 +.IX Item "{ [ command ]" +Set an action (debugger command) to happen before every debugger prompt. +A multi-line command may be entered in the customary fashion. +.Sp +Because this command is in some senses new, a warning is issued if +you appear to have accidentally entered a block instead. If that's +what you mean to do, write it as with \f(CW\*(C`;{ ... }\*(C'\fR or even +\&\f(CW\*(C`do { ... }\*(C'\fR. +.IP "{ *" 12 +.IX Xref "debugger command, {" +Delete all pre-prompt debugger commands. +.IP "{{ command" 12 +.IX Xref "debugger command, {{" +.IX Item "{{ command" +Add an action (debugger command) to happen before every debugger prompt. +A multi-line command may be entered, if you can guess how: see above. +.IP "! number" 12 +.IX Xref "debugger command, !" +.IX Item "! number" +Redo a previous command (defaults to the previous command). +.IP "! \-number" 12 +.IX Xref "debugger command, !" +.IX Item "! -number" +Redo number'th previous command. +.IP "! pattern" 12 +.IX Xref "debugger command, !" +.IX Item "! pattern" +Redo last command that started with pattern. +See \f(CW\*(C`o recallCommand\*(C'\fR, too. +.IP "!! cmd" 12 +.IX Xref "debugger command, !!" +.IX Item "!! cmd" +Run cmd in a subprocess (reads from \s-1DB::IN,\s0 writes to \s-1DB::OUT\s0) See +\&\f(CW\*(C`o shellBang\*(C'\fR, also. Note that the user's current shell (well, +their \f(CW$ENV{SHELL}\fR variable) will be used, which can interfere +with proper interpretation of exit status or signal and coredump +information. +.IP "source file" 12 +.IX Xref "debugger command, source" +.IX Item "source file" +Read and execute debugger commands from \fIfile\fR. +\&\fIfile\fR may itself contain \f(CW\*(C`source\*(C'\fR commands. +.IP "H \-number" 12 +.IX Xref "debugger command, H" +.IX Item "H -number" +Display last n commands. Only commands longer than one character are +listed. If \fInumber\fR is omitted, list them all. +.IP "q or ^D" 12 +.IX Xref "debugger command, q debugger command, ^D" +.IX Item "q or ^D" +Quit. (\*(L"quit\*(R" doesn't work for this, unless you've made an alias) +This is the only supported way to exit the debugger, though typing +\&\f(CW\*(C`exit\*(C'\fR twice might work. +.Sp +Set the \f(CW\*(C`inhibit_exit\*(C'\fR option to 0 if you want to be able to step +off the end the script. You may also need to set \f(CW$finished\fR to 0 +if you want to step through global destruction. +.IP "R" 12 +.IX Xref "debugger command, R" +.IX Item "R" +Restart the debugger by \f(CW\*(C`exec()\*(C'\fRing a new session. We try to maintain +your history across this, but internal settings and command-line options +may be lost. +.Sp +The following setting are currently preserved: history, breakpoints, +actions, debugger options, and the Perl command-line +options \fB\-w\fR, \fB\-I\fR, and \fB\-e\fR. +.IP "|dbcmd" 12 +.IX Xref "debugger command, |" +.IX Item "|dbcmd" +Run the debugger command, piping \s-1DB::OUT\s0 into your current pager. +.IP "||dbcmd" 12 +.IX Xref "debugger command, ||" +.IX Item "||dbcmd" +Same as \f(CW\*(C`|dbcmd\*(C'\fR but \s-1DB::OUT\s0 is temporarily \f(CW\*(C`select\*(C'\fRed as well. +.IP "= [alias value]" 12 +.IX Xref "debugger command, =" +.IX Item "= [alias value]" +Define a command alias, like +.Sp +.Vb 1 +\& = quit q +.Ve +.Sp +or list current aliases. +.IP "command" 12 +.IX Item "command" +Execute command as a Perl statement. A trailing semicolon will be +supplied. If the Perl statement would otherwise be confused for a +Perl debugger, use a leading semicolon, too. +.IP "m expr" 12 +.IX Xref "debugger command, m" +.IX Item "m expr" +List which methods may be called on the result of the evaluated +expression. The expression may evaluated to a reference to a +blessed object, or to a package name. +.IP "M" 12 +.IX Xref "debugger command, M" +.IX Item "M" +Display all loaded modules and their versions. +.IP "man [manpage]" 12 +.IX Xref "debugger command, man" +.IX Item "man [manpage]" +Despite its name, this calls your system's default documentation +viewer on the given page, or on the viewer itself if \fImanpage\fR is +omitted. If that viewer is \fBman\fR, the current \f(CW\*(C`Config\*(C'\fR information +is used to invoke \fBman\fR using the proper \s-1MANPATH\s0 or \fB\-M\fR\ \fImanpath\fR option. Failed lookups of the form \f(CW\*(C`XXX\*(C'\fR that match +known manpages of the form \fIperlXXX\fR will be retried. This lets +you type \f(CW\*(C`man debug\*(C'\fR or \f(CW\*(C`man op\*(C'\fR from the debugger. +.Sp +On systems traditionally bereft of a usable \fBman\fR command, the +debugger invokes \fBperldoc\fR. Occasionally this determination is +incorrect due to recalcitrant vendors or rather more felicitously, +to enterprising users. If you fall into either category, just +manually set the \f(CW$DB::doccmd\fR variable to whatever viewer to view +the Perl documentation on your system. This may be set in an rc +file, or through direct assignment. We're still waiting for a +working example of something along the lines of: +.Sp +.Vb 1 +\& $DB::doccmd = \*(Aqnetscape \-remote http://something.here/\*(Aq; +.Ve +.SS "Configurable Options" +.IX Subsection "Configurable Options" +The debugger has numerous options settable using the \f(CW\*(C`o\*(C'\fR command, +either interactively or from the environment or an rc file. +(./.perldb or ~/.perldb under Unix.) +.ie n .IP """recallCommand"", ""ShellBang""" 12 +.el .IP "\f(CWrecallCommand\fR, \f(CWShellBang\fR" 12 +.IX Xref "debugger option, recallCommand debugger option, ShellBang" +.IX Item "recallCommand, ShellBang" +The characters used to recall a command or spawn a shell. By +default, both are set to \f(CW\*(C`!\*(C'\fR, which is unfortunate. +.ie n .IP """pager""" 12 +.el .IP "\f(CWpager\fR" 12 +.IX Xref "debugger option, pager" +.IX Item "pager" +Program to use for output of pager-piped commands (those beginning +with a \f(CW\*(C`|\*(C'\fR character.) By default, \f(CW$ENV{PAGER}\fR will be used. +Because the debugger uses your current terminal characteristics +for bold and underlining, if the chosen pager does not pass escape +sequences through unchanged, the output of some debugger commands +will not be readable when sent through the pager. +.ie n .IP """tkRunning""" 12 +.el .IP "\f(CWtkRunning\fR" 12 +.IX Xref "debugger option, tkRunning" +.IX Item "tkRunning" +Run Tk while prompting (with ReadLine). +.ie n .IP """signalLevel"", ""warnLevel"", ""dieLevel""" 12 +.el .IP "\f(CWsignalLevel\fR, \f(CWwarnLevel\fR, \f(CWdieLevel\fR" 12 +.IX Xref "debugger option, signalLevel debugger option, warnLevel debugger option, dieLevel" +.IX Item "signalLevel, warnLevel, dieLevel" +Level of verbosity. By default, the debugger leaves your exceptions +and warnings alone, because altering them can break correctly running +programs. It will attempt to print a message when uncaught \s-1INT, BUS,\s0 or +\&\s-1SEGV\s0 signals arrive. (But see the mention of signals in \*(L"\s-1BUGS\*(R"\s0 below.) +.Sp +To disable this default safe mode, set these values to something higher +than 0. At a level of 1, you get backtraces upon receiving any kind +of warning (this is often annoying) or exception (this is +often valuable). Unfortunately, the debugger cannot discern fatal +exceptions from non-fatal ones. If \f(CW\*(C`dieLevel\*(C'\fR is even 1, then your +non-fatal exceptions are also traced and unceremoniously altered if they +came from \f(CW\*(C`eval\*(Aqed\*(C'\fR strings or from any kind of \f(CW\*(C`eval\*(C'\fR within modules +you're attempting to load. If \f(CW\*(C`dieLevel\*(C'\fR is 2, the debugger doesn't +care where they came from: It usurps your exception handler and prints +out a trace, then modifies all exceptions with its own embellishments. +This may perhaps be useful for some tracing purposes, but tends to hopelessly +destroy any program that takes its exception handling seriously. +.ie n .IP """AutoTrace""" 12 +.el .IP "\f(CWAutoTrace\fR" 12 +.IX Xref "debugger option, AutoTrace" +.IX Item "AutoTrace" +Trace mode (similar to \f(CW\*(C`t\*(C'\fR command, but can be put into +\&\f(CW\*(C`PERLDB_OPTS\*(C'\fR). +.ie n .IP """LineInfo""" 12 +.el .IP "\f(CWLineInfo\fR" 12 +.IX Xref "debugger option, LineInfo" +.IX Item "LineInfo" +File or pipe to print line number info to. If it is a pipe (say, +\&\f(CW\*(C`|visual_perl_db\*(C'\fR), then a short message is used. This is the +mechanism used to interact with a slave editor or visual debugger, +such as the special \f(CW\*(C`vi\*(C'\fR or \f(CW\*(C`emacs\*(C'\fR hooks, or the \f(CW\*(C`ddd\*(C'\fR graphical +debugger. +.ie n .IP """inhibit_exit""" 12 +.el .IP "\f(CWinhibit_exit\fR" 12 +.IX Xref "debugger option, inhibit_exit" +.IX Item "inhibit_exit" +If 0, allows \fIstepping off\fR the end of the script. +.ie n .IP """PrintRet""" 12 +.el .IP "\f(CWPrintRet\fR" 12 +.IX Xref "debugger option, PrintRet" +.IX Item "PrintRet" +Print return value after \f(CW\*(C`r\*(C'\fR command if set (default). +.ie n .IP """ornaments""" 12 +.el .IP "\f(CWornaments\fR" 12 +.IX Xref "debugger option, ornaments" +.IX Item "ornaments" +Affects screen appearance of the command line (see Term::ReadLine). +There is currently no way to disable these, which can render +some output illegible on some displays, or with some pagers. +This is considered a bug. +.ie n .IP """frame""" 12 +.el .IP "\f(CWframe\fR" 12 +.IX Xref "debugger option, frame" +.IX Item "frame" +Affects the printing of messages upon entry and exit from subroutines. If +\&\f(CW\*(C`frame & 2\*(C'\fR is false, messages are printed on entry only. (Printing +on exit might be useful if interspersed with other messages.) +.Sp +If \f(CW\*(C`frame & 4\*(C'\fR, arguments to functions are printed, plus context +and caller info. If \f(CW\*(C`frame & 8\*(C'\fR, overloaded \f(CW\*(C`stringify\*(C'\fR and +\&\f(CW\*(C`tie\*(C'\fRd \f(CW\*(C`FETCH\*(C'\fR is enabled on the printed arguments. If \f(CW\*(C`frame +& 16\*(C'\fR, the return value from the subroutine is printed. +.Sp +The length at which the argument list is truncated is governed by the +next option: +.ie n .IP """maxTraceLen""" 12 +.el .IP "\f(CWmaxTraceLen\fR" 12 +.IX Xref "debugger option, maxTraceLen" +.IX Item "maxTraceLen" +Length to truncate the argument list when the \f(CW\*(C`frame\*(C'\fR option's +bit 4 is set. +.ie n .IP """windowSize""" 12 +.el .IP "\f(CWwindowSize\fR" 12 +.IX Xref "debugger option, windowSize" +.IX Item "windowSize" +Change the size of code list window (default is 10 lines). +.PP +The following options affect what happens with \f(CW\*(C`V\*(C'\fR, \f(CW\*(C`X\*(C'\fR, and \f(CW\*(C`x\*(C'\fR +commands: +.ie n .IP """arrayDepth"", ""hashDepth""" 12 +.el .IP "\f(CWarrayDepth\fR, \f(CWhashDepth\fR" 12 +.IX Xref "debugger option, arrayDepth debugger option, hashDepth" +.IX Item "arrayDepth, hashDepth" +Print only first N elements ('' for all). +.ie n .IP """dumpDepth""" 12 +.el .IP "\f(CWdumpDepth\fR" 12 +.IX Xref "debugger option, dumpDepth" +.IX Item "dumpDepth" +Limit recursion depth to N levels when dumping structures. +Negative values are interpreted as infinity. Default: infinity. +.ie n .IP """compactDump"", ""veryCompact""" 12 +.el .IP "\f(CWcompactDump\fR, \f(CWveryCompact\fR" 12 +.IX Xref "debugger option, compactDump debugger option, veryCompact" +.IX Item "compactDump, veryCompact" +Change the style of array and hash output. If \f(CW\*(C`compactDump\*(C'\fR, short array +may be printed on one line. +.ie n .IP """globPrint""" 12 +.el .IP "\f(CWglobPrint\fR" 12 +.IX Xref "debugger option, globPrint" +.IX Item "globPrint" +Whether to print contents of globs. +.ie n .IP """DumpDBFiles""" 12 +.el .IP "\f(CWDumpDBFiles\fR" 12 +.IX Xref "debugger option, DumpDBFiles" +.IX Item "DumpDBFiles" +Dump arrays holding debugged files. +.ie n .IP """DumpPackages""" 12 +.el .IP "\f(CWDumpPackages\fR" 12 +.IX Xref "debugger option, DumpPackages" +.IX Item "DumpPackages" +Dump symbol tables of packages. +.ie n .IP """DumpReused""" 12 +.el .IP "\f(CWDumpReused\fR" 12 +.IX Xref "debugger option, DumpReused" +.IX Item "DumpReused" +Dump contents of \*(L"reused\*(R" addresses. +.ie n .IP """quote"", ""HighBit"", ""undefPrint""" 12 +.el .IP "\f(CWquote\fR, \f(CWHighBit\fR, \f(CWundefPrint\fR" 12 +.IX Xref "debugger option, quote debugger option, HighBit debugger option, undefPrint" +.IX Item "quote, HighBit, undefPrint" +Change the style of string dump. The default value for \f(CW\*(C`quote\*(C'\fR +is \f(CW\*(C`auto\*(C'\fR; one can enable double-quotish or single-quotish format +by setting it to \f(CW\*(C`"\*(C'\fR or \f(CW\*(C`\*(Aq\*(C'\fR, respectively. By default, characters +with their high bit set are printed verbatim. +.ie n .IP """UsageOnly""" 12 +.el .IP "\f(CWUsageOnly\fR" 12 +.IX Xref "debugger option, UsageOnly" +.IX Item "UsageOnly" +Rudimentary per-package memory usage dump. Calculates total +size of strings found in variables in the package. This does not +include lexicals in a module's file scope, or lost in closures. +.ie n .IP """HistFile""" 12 +.el .IP "\f(CWHistFile\fR" 12 +.IX Xref "debugger option, history, HistFile" +.IX Item "HistFile" +The path of the file from which the history (assuming a usable +Term::ReadLine backend) will be read on the debugger's startup, and to which +it will be saved on shutdown (for persistence across sessions). Similar in +concept to Bash's \f(CW\*(C`.bash_history\*(C'\fR file. +.ie n .IP """HistSize""" 12 +.el .IP "\f(CWHistSize\fR" 12 +.IX Xref "debugger option, history, HistSize" +.IX Item "HistSize" +The count of the saved lines in the history (assuming \f(CW\*(C`HistFile\*(C'\fR above). +.PP +After the rc file is read, the debugger reads the \f(CW$ENV{PERLDB_OPTS}\fR +environment variable and parses this as the remainder of a \*(L"O ...\*(R" +line as one might enter at the debugger prompt. You may place the +initialization options \f(CW\*(C`TTY\*(C'\fR, \f(CW\*(C`noTTY\*(C'\fR, \f(CW\*(C`ReadLine\*(C'\fR, and \f(CW\*(C`NonStop\*(C'\fR +there. +.PP +If your rc file contains: +.PP +.Vb 1 +\& parse_options("NonStop=1 LineInfo=db.out AutoTrace"); +.Ve +.PP +then your script will run without human intervention, putting trace +information into the file \fIdb.out\fR. (If you interrupt it, you'd +better reset \f(CW\*(C`LineInfo\*(C'\fR to \fI/dev/tty\fR if you expect to see anything.) +.ie n .IP """TTY""" 12 +.el .IP "\f(CWTTY\fR" 12 +.IX Xref "debugger option, TTY" +.IX Item "TTY" +The \s-1TTY\s0 to use for debugging I/O. +.ie n .IP """noTTY""" 12 +.el .IP "\f(CWnoTTY\fR" 12 +.IX Xref "debugger option, noTTY" +.IX Item "noTTY" +If set, the debugger goes into \f(CW\*(C`NonStop\*(C'\fR mode and will not connect to a \s-1TTY.\s0 If +interrupted (or if control goes to the debugger via explicit setting of +\&\f(CW$DB::signal\fR or \f(CW$DB::single\fR from the Perl script), it connects to a \s-1TTY\s0 +specified in the \f(CW\*(C`TTY\*(C'\fR option at startup, or to a tty found at +runtime using the \f(CW\*(C`Term::Rendezvous\*(C'\fR module of your choice. +.Sp +This module should implement a method named \f(CW\*(C`new\*(C'\fR that returns an object +with two methods: \f(CW\*(C`IN\*(C'\fR and \f(CW\*(C`OUT\*(C'\fR. These should return filehandles to use +for debugging input and output correspondingly. The \f(CW\*(C`new\*(C'\fR method should +inspect an argument containing the value of \f(CW$ENV{PERLDB_NOTTY}\fR at +startup, or \f(CW"$ENV{HOME}/.perldbtty$$"\fR otherwise. This file is not +inspected for proper ownership, so security hazards are theoretically +possible. +.ie n .IP """ReadLine""" 12 +.el .IP "\f(CWReadLine\fR" 12 +.IX Xref "debugger option, ReadLine" +.IX Item "ReadLine" +If false, readline support in the debugger is disabled in order +to debug applications that themselves use ReadLine. +.ie n .IP """NonStop""" 12 +.el .IP "\f(CWNonStop\fR" 12 +.IX Xref "debugger option, NonStop" +.IX Item "NonStop" +If set, the debugger goes into non-interactive mode until interrupted, or +programmatically by setting \f(CW$DB::signal\fR or \f(CW$DB::single\fR. +.PP +Here's an example of using the \f(CW$ENV{PERLDB_OPTS}\fR variable: +.PP +.Vb 1 +\& $ PERLDB_OPTS="NonStop frame=2" perl \-d myprogram +.Ve +.PP +That will run the script \fBmyprogram\fR without human intervention, +printing out the call tree with entry and exit points. Note that +\&\f(CW\*(C`NonStop=1 frame=2\*(C'\fR is equivalent to \f(CW\*(C`N f=2\*(C'\fR, and that originally, +options could be uniquely abbreviated by the first letter (modulo +the \f(CW\*(C`Dump*\*(C'\fR options). It is nevertheless recommended that you +always spell them out in full for legibility and future compatibility. +.PP +Other examples include +.PP +.Vb 1 +\& $ PERLDB_OPTS="NonStop LineInfo=listing frame=2" perl \-d myprogram +.Ve +.PP +which runs script non-interactively, printing info on each entry +into a subroutine and each executed line into the file named \fIlisting\fR. +(If you interrupt it, you would better reset \f(CW\*(C`LineInfo\*(C'\fR to something +\&\*(L"interactive\*(R"!) +.PP +Other examples include (using standard shell syntax to show environment +variable settings): +.PP +.Vb 2 +\& $ ( PERLDB_OPTS="NonStop frame=1 AutoTrace LineInfo=tperl.out" +\& perl \-d myprogram ) +.Ve +.PP +which may be useful for debugging a program that uses \f(CW\*(C`Term::ReadLine\*(C'\fR +itself. Do not forget to detach your shell from the \s-1TTY\s0 in the window that +corresponds to \fI/dev/ttyXX\fR, say, by issuing a command like +.PP +.Vb 1 +\& $ sleep 1000000 +.Ve +.PP +See \*(L"Debugger Internals\*(R" in perldebguts for details. +.SS "Debugger Input/Output" +.IX Subsection "Debugger Input/Output" +.IP "Prompt" 8 +.IX Item "Prompt" +The debugger prompt is something like +.Sp +.Vb 1 +\& DB<8> +.Ve +.Sp +or even +.Sp +.Vb 1 +\& DB<<17>> +.Ve +.Sp +where that number is the command number, and which you'd use to +access with the built-in \fBcsh\fR\-like history mechanism. For example, +\&\f(CW\*(C`!17\*(C'\fR would repeat command number 17. The depth of the angle +brackets indicates the nesting depth of the debugger. You could +get more than one set of brackets, for example, if you'd already +at a breakpoint and then printed the result of a function call that +itself has a breakpoint, or you step into an expression via \f(CW\*(C`s/n/t +expression\*(C'\fR command. +.IP "Multiline commands" 8 +.IX Item "Multiline commands" +If you want to enter a multi-line command, such as a subroutine +definition with several statements or a format, escape the newline +that would normally end the debugger command with a backslash. +Here's an example: +.Sp +.Vb 7 +\& DB<1> for (1..4) { \e +\& cont: print "ok\en"; \e +\& cont: } +\& ok +\& ok +\& ok +\& ok +.Ve +.Sp +Note that this business of escaping a newline is specific to interactive +commands typed into the debugger. +.IP "Stack backtrace" 8 +.IX Xref "backtrace stack, backtrace" +.IX Item "Stack backtrace" +Here's an example of what a stack backtrace via \f(CW\*(C`T\*(C'\fR command might +look like: +.Sp +.Vb 5 +\& $ = main::infested called from file \*(AqAmbulation.pm\*(Aq line 10 +\& @ = Ambulation::legs(1, 2, 3, 4) called from file \*(Aqcamel_flea\*(Aq +\& line 7 +\& $ = main::pests(\*(Aqbactrian\*(Aq, 4) called from file \*(Aqcamel_flea\*(Aq +\& line 4 +.Ve +.Sp +The left-hand character up there indicates the context in which the +function was called, with \f(CW\*(C`$\*(C'\fR and \f(CW\*(C`@\*(C'\fR meaning scalar or list +contexts respectively, and \f(CW\*(C`.\*(C'\fR meaning void context (which is +actually a sort of scalar context). The display above says +that you were in the function \f(CW\*(C`main::infested\*(C'\fR when you ran the +stack dump, and that it was called in scalar context from line +10 of the file \fIAmbulation.pm\fR, but without any arguments at all, +meaning it was called as \f(CW&infested\fR. The next stack frame shows +that the function \f(CW\*(C`Ambulation::legs\*(C'\fR was called in list context +from the \fIcamel_flea\fR file with four arguments. The last stack +frame shows that \f(CW\*(C`main::pests\*(C'\fR was called in scalar context, +also from \fIcamel_flea\fR, but from line 4. +.Sp +If you execute the \f(CW\*(C`T\*(C'\fR command from inside an active \f(CW\*(C`use\*(C'\fR +statement, the backtrace will contain both a \f(CW\*(C`require\*(C'\fR frame and +an \f(CW\*(C`eval\*(C'\fR frame. +.IP "Line Listing Format" 8 +.IX Item "Line Listing Format" +This shows the sorts of output the \f(CW\*(C`l\*(C'\fR command can produce: +.Sp +.Vb 11 +\& DB<<13>> l +\& 101: @i{@i} = (); +\& 102:b @isa{@i,$pack} = () +\& 103 if(exists $i{$prevpack} || exists $isa{$pack}); +\& 104 } +\& 105 +\& 106 next +\& 107==> if(exists $isa{$pack}); +\& 108 +\& 109:a if ($extra\-\- > 0) { +\& 110: %isa = ($pack,1); +.Ve +.Sp +Breakable lines are marked with \f(CW\*(C`:\*(C'\fR. Lines with breakpoints are +marked by \f(CW\*(C`b\*(C'\fR and those with actions by \f(CW\*(C`a\*(C'\fR. The line that's +about to be executed is marked by \f(CW\*(C`==>\*(C'\fR. +.Sp +Please be aware that code in debugger listings may not look the same +as your original source code. Line directives and external source +filters can alter the code before Perl sees it, causing code to move +from its original positions or take on entirely different forms. +.IP "Frame listing" 8 +.IX Item "Frame listing" +When the \f(CW\*(C`frame\*(C'\fR option is set, the debugger would print entered (and +optionally exited) subroutines in different styles. See perldebguts +for incredibly long examples of these. +.SS "Debugging Compile-Time Statements" +.IX Subsection "Debugging Compile-Time Statements" +If you have compile-time executable statements (such as code within +\&\s-1BEGIN, UNITCHECK\s0 and \s-1CHECK\s0 blocks or \f(CW\*(C`use\*(C'\fR statements), these will +\&\fInot\fR be stopped by debugger, although \f(CW\*(C`require\*(C'\fRs and \s-1INIT\s0 blocks +will, and compile-time statements can be traced with the \f(CW\*(C`AutoTrace\*(C'\fR +option set in \f(CW\*(C`PERLDB_OPTS\*(C'\fR). From your own Perl code, however, you +can transfer control back to the debugger using the following +statement, which is harmless if the debugger is not running: +.PP +.Vb 1 +\& $DB::single = 1; +.Ve +.PP +If you set \f(CW$DB::single\fR to 2, it's equivalent to having +just typed the \f(CW\*(C`n\*(C'\fR command, whereas a value of 1 means the \f(CW\*(C`s\*(C'\fR +command. The \f(CW$DB::trace\fR variable should be set to 1 to simulate +having typed the \f(CW\*(C`t\*(C'\fR command. +.PP +Another way to debug compile-time code is to start the debugger, set a +breakpoint on the \fIload\fR of some module: +.PP +.Vb 2 +\& DB<7> b load f:/perllib/lib/Carp.pm +\& Will stop on load of \*(Aqf:/perllib/lib/Carp.pm\*(Aq. +.Ve +.PP +and then restart the debugger using the \f(CW\*(C`R\*(C'\fR command (if possible). One can use \f(CW\*(C`b +compile subname\*(C'\fR for the same purpose. +.SS "Debugger Customization" +.IX Subsection "Debugger Customization" +The debugger probably contains enough configuration hooks that you +won't ever have to modify it yourself. You may change the behaviour +of the debugger from within the debugger using its \f(CW\*(C`o\*(C'\fR command, from +the command line via the \f(CW\*(C`PERLDB_OPTS\*(C'\fR environment variable, and +from customization files. +.PP +You can do some customization by setting up a \fI.perldb\fR file, which +contains initialization code. For instance, you could make aliases +like these (the last one is one people expect to be there): +.PP +.Vb 4 +\& $DB::alias{\*(Aqlen\*(Aq} = \*(Aqs/^len(.*)/p length($1)/\*(Aq; +\& $DB::alias{\*(Aqstop\*(Aq} = \*(Aqs/^stop (at|in)/b/\*(Aq; +\& $DB::alias{\*(Aqps\*(Aq} = \*(Aqs/^ps\eb/p scalar /\*(Aq; +\& $DB::alias{\*(Aqquit\*(Aq} = \*(Aqs/^quit(\es*)/exit/\*(Aq; +.Ve +.PP +You can change options from \fI.perldb\fR by using calls like this one; +.PP +.Vb 1 +\& parse_options("NonStop=1 LineInfo=db.out AutoTrace=1 frame=2"); +.Ve +.PP +The code is executed in the package \f(CW\*(C`DB\*(C'\fR. Note that \fI.perldb\fR is +processed before processing \f(CW\*(C`PERLDB_OPTS\*(C'\fR. If \fI.perldb\fR defines the +subroutine \f(CW\*(C`afterinit\*(C'\fR, that function is called after debugger +initialization ends. \fI.perldb\fR may be contained in the current +directory, or in the home directory. Because this file is sourced +in by Perl and may contain arbitrary commands, for security reasons, +it must be owned by the superuser or the current user, and writable +by no one but its owner. +.PP +You can mock \s-1TTY\s0 input to debugger by adding arbitrary commands to +\&\f(CW@DB::typeahead\fR. For example, your \fI.perldb\fR file might contain: +.PP +.Vb 1 +\& sub afterinit { push @DB::typeahead, "b 4", "b 6"; } +.Ve +.PP +Which would attempt to set breakpoints on lines 4 and 6 immediately +after debugger initialization. Note that \f(CW@DB::typeahead\fR is not a supported +interface and is subject to change in future releases. +.PP +If you want to modify the debugger, copy \fIperl5db.pl\fR from the +Perl library to another name and hack it to your heart's content. +You'll then want to set your \f(CW\*(C`PERL5DB\*(C'\fR environment variable to say +something like this: +.PP +.Vb 1 +\& BEGIN { require "myperl5db.pl" } +.Ve +.PP +As a last resort, you could also use \f(CW\*(C`PERL5DB\*(C'\fR to customize the debugger +by directly setting internal variables or calling debugger functions. +.PP +Note that any variables and functions that are not documented in +this document (or in perldebguts) are considered for internal +use only, and as such are subject to change without notice. +.SS "Readline Support / History in the Debugger" +.IX Subsection "Readline Support / History in the Debugger" +As shipped, the only command-line history supplied is a simplistic one +that checks for leading exclamation points. However, if you install +the Term::ReadKey and Term::ReadLine modules from \s-1CPAN\s0 (such as +Term::ReadLine::Gnu, Term::ReadLine::Perl, ...) you will +have full editing capabilities much like those \s-1GNU\s0 \fIreadline\fR(3) provides. +Look for these in the \fImodules/by\-module/Term\fR directory on \s-1CPAN.\s0 +These do not support normal \fBvi\fR command-line editing, however. +.PP +A rudimentary command-line completion is also available, including +lexical variables in the current scope if the \f(CW\*(C`PadWalker\*(C'\fR module +is installed. +.PP +Without Readline support you may see the symbols \*(L"^[[A\*(R", \*(L"^[[C\*(R", \*(L"^[[B\*(R", +\&\*(L"^[[D\*(R"\*(L", \*(R"^H", ... when using the arrow keys and/or the backspace key. +.SS "Editor Support for Debugging" +.IX Subsection "Editor Support for Debugging" +If you have the \s-1GNU\s0's version of \fBemacs\fR installed on your system, +it can interact with the Perl debugger to provide an integrated +software development environment reminiscent of its interactions +with C debuggers. +.PP +Recent versions of Emacs come with a +start file for making \fBemacs\fR act like a +syntax-directed editor that understands (some of) Perl's syntax. +See perlfaq3. +.PP +Users of \fBvi\fR should also look into \fBvim\fR and \fBgvim\fR, the mousey +and windy version, for coloring of Perl keywords. +.PP +Note that only perl can truly parse Perl, so all such \s-1CASE\s0 tools +fall somewhat short of the mark, especially if you don't program +your Perl as a C programmer might. +.SS "The Perl Profiler" +.IX Xref "profile profiling profiler" +.IX Subsection "The Perl Profiler" +If you wish to supply an alternative debugger for Perl to run, +invoke your script with a colon and a package argument given to the +\&\fB\-d\fR flag. Perl's alternative debuggers include a Perl profiler, +Devel::NYTProf, which is available separately as a \s-1CPAN\s0 +distribution. To profile your Perl program in the file \fImycode.pl\fR, +just type: +.PP +.Vb 1 +\& $ perl \-d:NYTProf mycode.pl +.Ve +.PP +When the script terminates the profiler will create a database of the +profile information that you can turn into reports using the profiler's +tools. See for details. +.SH "Debugging Regular Expressions" +.IX Xref "regular expression, debugging regex, debugging regexp, debugging" +.IX Header "Debugging Regular Expressions" +\&\f(CW\*(C`use re \*(Aqdebug\*(Aq\*(C'\fR enables you to see the gory details of how the Perl +regular expression engine works. In order to understand this typically +voluminous output, one must not only have some idea about how regular +expression matching works in general, but also know how Perl's regular +expressions are internally compiled into an automaton. These matters +are explored in some detail in +\&\*(L"Debugging Regular Expressions\*(R" in perldebguts. +.SH "Debugging Memory Usage" +.IX Xref "memory usage" +.IX Header "Debugging Memory Usage" +Perl contains internal support for reporting its own memory usage, +but this is a fairly advanced concept that requires some understanding +of how memory allocation works. +See \*(L"Debugging Perl Memory Usage\*(R" in perldebguts for the details. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +You do have \f(CW\*(C`use strict\*(C'\fR and \f(CW\*(C`use warnings\*(C'\fR enabled, don't you? +.PP +perldebtut, +perldebguts, +re, +\&\s-1DB\s0, +Devel::NYTProf, +Dumpvalue, +and +perlrun. +.PP +When debugging a script that uses #! and is thus normally found in +\&\f(CW$PATH\fR, the \-S option causes perl to search \f(CW$PATH\fR for it, so you don't +have to type the path or \f(CW\*(C`which $scriptname\*(C'\fR. +.PP +.Vb 1 +\& $ perl \-Sd foo.pl +.Ve +.SH "BUGS" +.IX Header "BUGS" +You cannot get stack frame information or in any fashion debug functions +that were not compiled by Perl, such as those from C or \*(C+ extensions. +.PP +If you alter your \f(CW@_\fR arguments in a subroutine (such as with \f(CW\*(C`shift\*(C'\fR +or \f(CW\*(C`pop\*(C'\fR), the stack backtrace will not show the original values. +.PP +The debugger does not currently work in conjunction with the \fB\-W\fR +command-line switch, because it itself is not free of warnings. +.PP +If you're in a slow syscall (like \f(CW\*(C`wait\*(C'\fRing, \f(CW\*(C`accept\*(C'\fRing, or \f(CW\*(C`read\*(C'\fRing +from your keyboard or a socket) and haven't set up your own \f(CW$SIG{INT}\fR +handler, then you won't be able to CTRL-C your way back to the debugger, +because the debugger's own \f(CW$SIG{INT}\fR handler doesn't understand that +it needs to raise an exception to \fBlongjmp\fR\|(3) out of slow syscalls. diff --git a/data/miniconda3/man/man1/perldoc.1 b/data/miniconda3/man/man1/perldoc.1 new file mode 100644 index 0000000000000000000000000000000000000000..d7baef70eae3296672ec95ace00a92803aba427e --- /dev/null +++ b/data/miniconda3/man/man1/perldoc.1 @@ -0,0 +1,416 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLDOC 1" +.TH PERLDOC 1 "2020-12-18" "perl v5.32.1" "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" +perldoc \- Look up Perl documentation in Pod format. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 10 +\& perldoc [\-h] [\-D] [\-t] [\-u] [\-m] [\-l] [\-U] [\-F] +\& [\-i] [\-V] [\-T] [\-r] +\& [\-d destination_file] +\& [\-o formatname] +\& [\-M FormatterClassName] +\& [\-w formatteroption:value] +\& [\-n nroff\-replacement] +\& [\-X] +\& [\-L language_code] +\& PageName|ModuleName|ProgramName|URL +.Ve +.PP +Examples: +.PP +.Vb 1 +\& perldoc \-f BuiltinFunction +\& +\& perldoc \-L it \-f BuiltinFunction +\& +\& perldoc \-q FAQ Keyword +\& +\& perldoc \-L fr \-q FAQ Keyword +\& +\& perldoc \-v PerlVariable +\& +\& perldoc \-a PerlAPI +.Ve +.PP +See below for more description of the switches. +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBperldoc\fR looks up documentation in .pod format that is embedded in the perl +installation tree or in a perl script, and displays it using a variety of +formatters. This is primarily used for the documentation for the perl library +modules. +.PP +Your system may also have man pages installed for those modules, in +which case you can probably just use the \fBman\fR\|(1) command. +.PP +If you are looking for a table of contents to the Perl library modules +documentation, see the perltoc page. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-h\fR" 5 +.IX Item "-h" +Prints out a brief \fBh\fRelp message. +.IP "\fB\-D\fR" 5 +.IX Item "-D" +\&\fBD\fRescribes search for the item in \fBd\fRetail. +.IP "\fB\-t\fR" 5 +.IX Item "-t" +Display docs using plain \fBt\fRext converter, instead of nroff. This may be faster, +but it probably won't look as nice. +.IP "\fB\-u\fR" 5 +.IX Item "-u" +Skip the real Pod formatting, and just show the raw Pod source (\fBU\fRnformatted) +.IP "\fB\-m\fR \fImodule\fR" 5 +.IX Item "-m module" +Display the entire module: both code and unformatted pod documentation. +This may be useful if the docs don't explain a function in the detail +you need, and you'd like to inspect the code directly; perldoc will find +the file for you and simply hand it off for display. +.IP "\fB\-l\fR" 5 +.IX Item "-l" +Display on\fBl\fRy the file name of the module found. +.IP "\fB\-U\fR" 5 +.IX Item "-U" +When running as the superuser, don't attempt drop privileges for security. +This option is implied with \fB\-F\fR. +.Sp +\&\fB\s-1NOTE\s0\fR: Please see the heading \s-1SECURITY\s0 below for more information. +.IP "\fB\-F\fR" 5 +.IX Item "-F" +Consider arguments as file names; no search in directories will be performed. +Implies \fB\-U\fR if run as the superuser. +.IP "\fB\-f\fR \fIperlfunc\fR" 5 +.IX Item "-f perlfunc" +The \fB\-f\fR option followed by the name of a perl built-in function will +extract the documentation of this function from perlfunc. +.Sp +Example: +.Sp +.Vb 1 +\& perldoc \-f sprintf +.Ve +.IP "\fB\-q\fR \fIperlfaq-search-regexp\fR" 5 +.IX Item "-q perlfaq-search-regexp" +The \fB\-q\fR option takes a regular expression as an argument. It will search +the \fBq\fRuestion headings in perlfaq[1\-9] and print the entries matching +the regular expression. +.Sp +Example: +.Sp +.Vb 1 +\& perldoc \-q shuffle +.Ve +.IP "\fB\-a\fR \fIperlapifunc\fR" 5 +.IX Item "-a perlapifunc" +The \fB\-a\fR option followed by the name of a perl api function will +extract the documentation of this function from perlapi. +.Sp +Example: +.Sp +.Vb 1 +\& perldoc \-a newHV +.Ve +.IP "\fB\-v\fR \fIperlvar\fR" 5 +.IX Item "-v perlvar" +The \fB\-v\fR option followed by the name of a Perl predefined variable will +extract the documentation of this variable from perlvar. +.Sp +Examples: +.Sp +.Vb 3 +\& perldoc \-v \*(Aq$"\*(Aq +\& perldoc \-v @+ +\& perldoc \-v DATA +.Ve +.IP "\fB\-T\fR" 5 +.IX Item "-T" +This specifies that the output is not to be sent to a pager, but is to +be sent directly to \s-1STDOUT.\s0 +.IP "\fB\-d\fR \fIdestination-filename\fR" 5 +.IX Item "-d destination-filename" +This specifies that the output is to be sent neither to a pager nor +to \s-1STDOUT,\s0 but is to be saved to the specified filename. Example: +\&\f(CW\*(C`perldoc \-oLaTeX \-dtextwrapdocs.tex Text::Wrap\*(C'\fR +.IP "\fB\-o\fR \fIoutput-formatname\fR" 5 +.IX Item "-o output-formatname" +This specifies that you want Perldoc to try using a Pod-formatting +class for the output format that you specify. For example: +\&\f(CW\*(C`\-oman\*(C'\fR. This is actually just a wrapper around the \f(CW\*(C`\-M\*(C'\fR switch; +using \f(CW\*(C`\-o\f(CIformatname\f(CW\*(C'\fR just looks for a loadable class by adding +that format name (with different capitalizations) to the end of +different classname prefixes. +.Sp +For example, \f(CW\*(C`\-oLaTeX\*(C'\fR currently tries all of the following classes: +Pod::Perldoc::ToLaTeX Pod::Perldoc::Tolatex Pod::Perldoc::ToLatex +Pod::Perldoc::ToLATEX Pod::Simple::LaTeX Pod::Simple::latex +Pod::Simple::Latex Pod::Simple::LATEX Pod::LaTeX Pod::latex Pod::Latex +Pod::LATEX. +.IP "\fB\-M\fR \fImodule-name\fR" 5 +.IX Item "-M module-name" +This specifies the module that you want to try using for formatting the +pod. The class must at least provide a \f(CW\*(C`parse_from_file\*(C'\fR method. +For example: \f(CW\*(C`perldoc \-MPod::Perldoc::ToChecker\*(C'\fR. +.Sp +You can specify several classes to try by joining them with commas +or semicolons, as in \f(CW\*(C`\-MTk::SuperPod;Tk::Pod\*(C'\fR. +.IP "\fB\-w\fR \fIoption:value\fR or \fB\-w\fR \fIoption\fR" 5 +.IX Item "-w option:value or -w option" +This specifies an option to call the formatter \fBw\fRith. For example, +\&\f(CW\*(C`\-w textsize:15\*(C'\fR will call +\&\f(CW\*(C`$formatter\->textsize(15)\*(C'\fR on the formatter object before it is +used to format the object. For this to be valid, the formatter class +must provide such a method, and the value you pass should be valid. +(So if \f(CW\*(C`textsize\*(C'\fR expects an integer, and you do \f(CW\*(C`\-w textsize:big\*(C'\fR, +expect trouble.) +.Sp +You can use \f(CW\*(C`\-w optionname\*(C'\fR (without a value) as shorthand for +\&\f(CW\*(C`\-w optionname:\f(CITRUE\f(CW\*(C'\fR. This is presumably useful in cases of on/off +features like: \f(CW\*(C`\-w page_numbering\*(C'\fR. +.Sp +You can use an \*(L"=\*(R" instead of the \*(L":\*(R", as in: \f(CW\*(C`\-w textsize=15\*(C'\fR. This +might be more (or less) convenient, depending on what shell you use. +.IP "\fB\-X\fR" 5 +.IX Item "-X" +Use an index if it is present. The \fB\-X\fR option looks for an entry +whose basename matches the name given on the command line in the file +\&\f(CW\*(C`$Config{archlib}/pod.idx\*(C'\fR. The \fIpod.idx\fR file should contain fully +qualified filenames, one per line. +.IP "\fB\-L\fR \fIlanguage_code\fR" 5 +.IX Item "-L language_code" +This allows one to specify the \fIlanguage code\fR for the desired language +translation. If the \f(CW\*(C`POD2::\*(C'\fR package isn't +installed in your system, the switch is ignored. +All available translation packages are to be found under the \f(CW\*(C`POD2::\*(C'\fR +namespace. See \s-1POD2::IT\s0 (or \s-1POD2::FR\s0) to see how to create new +localized \f(CW\*(C`POD2::*\*(C'\fR documentation packages and integrate them into +Pod::Perldoc. +.IP "\fBPageName|ModuleName|ProgramName|URL\fR" 5 +.IX Item "PageName|ModuleName|ProgramName|URL" +The item you want to look up. Nested modules (such as \f(CW\*(C`File::Basename\*(C'\fR) +are specified either as \f(CW\*(C`File::Basename\*(C'\fR or \f(CW\*(C`File/Basename\*(C'\fR. You may also +give a descriptive name of a page, such as \f(CW\*(C`perlfunc\*(C'\fR. For URLs, \s-1HTTP\s0 and +\&\s-1HTTPS\s0 are the only kind currently supported. +.Sp +For simple names like 'foo', when the normal search fails to find +a matching page, a search with the \*(L"perl\*(R" prefix is tried as well. +So \*(L"perldoc intro\*(R" is enough to find/render \*(L"perlintro.pod\*(R". +.IP "\fB\-n\fR \fIsome-formatter\fR" 5 +.IX Item "-n some-formatter" +Specify replacement for groff +.IP "\fB\-r\fR" 5 +.IX Item "-r" +Recursive search. +.IP "\fB\-i\fR" 5 +.IX Item "-i" +Ignore case. +.IP "\fB\-V\fR" 5 +.IX Item "-V" +Displays the version of perldoc you're running. +.SH "SECURITY" +.IX Header "SECURITY" +Because \fBperldoc\fR does not run properly tainted, and is known to +have security issues, when run as the superuser it will attempt to +drop privileges by setting the effective and real IDs to nobody's +or nouser's account, or \-2 if unavailable. If it cannot relinquish +its privileges, it will not run. +.PP +See the \f(CW\*(C`\-U\*(C'\fR option if you do not want this behavior but \fBbeware\fR +that there are significant security risks if you choose to use \f(CW\*(C`\-U\*(C'\fR. +.PP +Since 3.26, using \f(CW\*(C`\-F\*(C'\fR as the superuser also implies \f(CW\*(C`\-U\*(C'\fR as opening +most files and traversing directories requires privileges that are +above the nobody/nogroup level. +.SH "ENVIRONMENT" +.IX Header "ENVIRONMENT" +Any switches in the \f(CW\*(C`PERLDOC\*(C'\fR environment variable will be used before the +command line arguments. +.PP +Useful values for \f(CW\*(C`PERLDOC\*(C'\fR include \f(CW\*(C`\-oterm\*(C'\fR, \f(CW\*(C`\-otext\*(C'\fR, \f(CW\*(C`\-ortf\*(C'\fR, +\&\f(CW\*(C`\-oxml\*(C'\fR, and so on, depending on what modules you have on hand; or +the formatter class may be specified exactly with \f(CW\*(C`\-MPod::Perldoc::ToTerm\*(C'\fR +or the like. +.PP +\&\f(CW\*(C`perldoc\*(C'\fR also searches directories +specified by the \f(CW\*(C`PERL5LIB\*(C'\fR (or \f(CW\*(C`PERLLIB\*(C'\fR if \f(CW\*(C`PERL5LIB\*(C'\fR is not +defined) and \f(CW\*(C`PATH\*(C'\fR environment variables. +(The latter is so that embedded pods for executables, such as +\&\f(CW\*(C`perldoc\*(C'\fR itself, are available.) +.PP +In directories where either \f(CW\*(C`Makefile.PL\*(C'\fR or \f(CW\*(C`Build.PL\*(C'\fR exist, \f(CW\*(C`perldoc\*(C'\fR +will add \f(CW\*(C`.\*(C'\fR and \f(CW\*(C`lib\*(C'\fR first to its search path, and as long as you're not +the superuser will add \f(CW\*(C`blib\*(C'\fR too. This is really helpful if you're working +inside of a build directory and want to read through the docs even if you +have a version of a module previously installed. +.PP +\&\f(CW\*(C`perldoc\*(C'\fR will use, in order of preference, the pager defined in +\&\f(CW\*(C`PERLDOC_PAGER\*(C'\fR, \f(CW\*(C`MANPAGER\*(C'\fR, or \f(CW\*(C`PAGER\*(C'\fR before trying to find a pager +on its own. (\f(CW\*(C`MANPAGER\*(C'\fR is not used if \f(CW\*(C`perldoc\*(C'\fR was told to display +plain text or unformatted pod.) +.PP +When using perldoc in it's \f(CW\*(C`\-m\*(C'\fR mode (display module source code), +\&\f(CW\*(C`perldoc\*(C'\fR will attempt to use the pager set in \f(CW\*(C`PERLDOC_SRC_PAGER\*(C'\fR. +A useful setting for this command is your favorite editor as in +\&\f(CW\*(C`/usr/bin/nano\*(C'\fR. (Don't judge me.) +.PP +One useful value for \f(CW\*(C`PERLDOC_PAGER\*(C'\fR is \f(CW\*(C`less \-+C \-E\*(C'\fR. +.PP +Having \s-1PERLDOCDEBUG\s0 set to a positive integer will make perldoc emit +even more descriptive output than the \f(CW\*(C`\-D\*(C'\fR switch does; the higher the +number, the more it emits. +.SH "CHANGES" +.IX Header "CHANGES" +Up to 3.14_05, the switch \fB\-v\fR was used to produce verbose +messages of \fBperldoc\fR operation, which is now enabled by \fB\-D\fR. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perlpod, Pod::Perldoc +.SH "AUTHOR" +.IX Header "AUTHOR" +Current maintainer: Mark Allen \f(CW\*(C`\*(C'\fR +.PP +Past contributors are: +brian d foy \f(CW\*(C`\*(C'\fR +Adriano R. Ferreira \f(CW\*(C`\*(C'\fR, +Sean M. Burke \f(CW\*(C`\*(C'\fR, +Kenneth Albanowski \f(CW\*(C`\*(C'\fR, +Andy Dougherty \f(CW\*(C`\*(C'\fR, +and many others. diff --git a/data/miniconda3/man/man1/perldtrace.1 b/data/miniconda3/man/man1/perldtrace.1 new file mode 100644 index 0000000000000000000000000000000000000000..49932897bf999fa34848260f13c4d59ead8f5e4b --- /dev/null +++ b/data/miniconda3/man/man1/perldtrace.1 @@ -0,0 +1,356 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLDTRACE 1" +.TH PERLDTRACE 1 "2020-12-18" "perl v5.32.1" "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" +perldtrace \- Perl's support for DTrace +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 2 +\& # dtrace \-Zn \*(Aqperl::sub\-entry, perl::sub\-return { trace(copyinstr(arg0)) }\*(Aq +\& dtrace: description \*(Aqperl::sub\-entry, perl::sub\-return \*(Aq matched 10 probes +\& +\& # perl \-E \*(Aqsub outer { inner(@_) } sub inner { say shift } outer("hello")\*(Aq +\& hello +\& +\& (dtrace output) +\& CPU ID FUNCTION:NAME +\& 0 75915 Perl_pp_entersub:sub\-entry BEGIN +\& 0 75915 Perl_pp_entersub:sub\-entry import +\& 0 75922 Perl_pp_leavesub:sub\-return import +\& 0 75922 Perl_pp_leavesub:sub\-return BEGIN +\& 0 75915 Perl_pp_entersub:sub\-entry outer +\& 0 75915 Perl_pp_entersub:sub\-entry inner +\& 0 75922 Perl_pp_leavesub:sub\-return inner +\& 0 75922 Perl_pp_leavesub:sub\-return outer +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +DTrace is a framework for comprehensive system\- and application-level +tracing. Perl is a DTrace \fIprovider\fR, meaning it exposes several +\&\fIprobes\fR for instrumentation. You can use these in conjunction +with kernel-level probes, as well as probes from other providers +such as MySQL, in order to diagnose software defects, or even just +your application's bottlenecks. +.PP +Perl must be compiled with the \f(CW\*(C`\-Dusedtrace\*(C'\fR option in order to +make use of the provided probes. While DTrace aims to have no +overhead when its instrumentation is not active, Perl's support +itself cannot uphold that guarantee, so it is built without DTrace +probes under most systems. One notable exception is that Mac \s-1OS X\s0 +ships a \fI/usr/bin/perl\fR with DTrace support enabled. +.SH "HISTORY" +.IX Header "HISTORY" +.IP "5.10.1" 4 +.IX Item "5.10.1" +Perl's initial DTrace support was added, providing \f(CW\*(C`sub\-entry\*(C'\fR and +\&\f(CW\*(C`sub\-return\*(C'\fR probes. +.IP "5.14.0" 4 +.IX Item "5.14.0" +The \f(CW\*(C`sub\-entry\*(C'\fR and \f(CW\*(C`sub\-return\*(C'\fR probes gain a fourth argument: the +package name of the function. +.IP "5.16.0" 4 +.IX Item "5.16.0" +The \f(CW\*(C`phase\-change\*(C'\fR probe was added. +.IP "5.18.0" 4 +.IX Item "5.18.0" +The \f(CW\*(C`op\-entry\*(C'\fR, \f(CW\*(C`loading\-file\*(C'\fR, and \f(CW\*(C`loaded\-file\*(C'\fR probes were added. +.SH "PROBES" +.IX Header "PROBES" +.IP "sub\-entry(\s-1SUBNAME, FILE, LINE, PACKAGE\s0)" 4 +.IX Item "sub-entry(SUBNAME, FILE, LINE, PACKAGE)" +Traces the entry of any subroutine. Note that all of the variables +refer to the subroutine that is being invoked; there is currently +no way to get ahold of any information about the subroutine's +\&\fIcaller\fR from a DTrace action. +.Sp +.Vb 4 +\& :*perl*::sub\-entry { +\& printf("%s::%s entered at %s line %d\en", +\& copyinstr(arg3), copyinstr(arg0), copyinstr(arg1), arg2); +\& } +.Ve +.IP "sub\-return(\s-1SUBNAME, FILE, LINE, PACKAGE\s0)" 4 +.IX Item "sub-return(SUBNAME, FILE, LINE, PACKAGE)" +Traces the exit of any subroutine. Note that all of the variables +refer to the subroutine that is returning; there is currently no +way to get ahold of any information about the subroutine's \fIcaller\fR +from a DTrace action. +.Sp +.Vb 4 +\& :*perl*::sub\-return { +\& printf("%s::%s returned at %s line %d\en", +\& copyinstr(arg3), copyinstr(arg0), copyinstr(arg1), arg2); +\& } +.Ve +.IP "phase\-change(\s-1NEWPHASE, OLDPHASE\s0)" 4 +.IX Item "phase-change(NEWPHASE, OLDPHASE)" +Traces changes to Perl's interpreter state. You can internalize this +as tracing changes to Perl's \f(CW\*(C`${^GLOBAL_PHASE}\*(C'\fR variable, especially +since the values for \f(CW\*(C`NEWPHASE\*(C'\fR and \f(CW\*(C`OLDPHASE\*(C'\fR are the strings that +\&\f(CW\*(C`${^GLOBAL_PHASE}\*(C'\fR reports. +.Sp +.Vb 4 +\& :*perl*::phase\-change { +\& printf("Phase changed from %s to %s\en", +\& copyinstr(arg1), copyinstr(arg0)); +\& } +.Ve +.IP "op\-entry(\s-1OPNAME\s0)" 4 +.IX Item "op-entry(OPNAME)" +Traces the execution of each opcode in the Perl runloop. This probe +is fired before the opcode is executed. When the Perl debugger is +enabled, the DTrace probe is fired \fIafter\fR the debugger hooks (but +still before the opcode itself is executed). +.Sp +.Vb 3 +\& :*perl*::op\-entry { +\& printf("About to execute opcode %s\en", copyinstr(arg0)); +\& } +.Ve +.IP "loading\-file(\s-1FILENAME\s0)" 4 +.IX Item "loading-file(FILENAME)" +Fires when Perl is about to load an individual file, whether from +\&\f(CW\*(C`use\*(C'\fR, \f(CW\*(C`require\*(C'\fR, or \f(CW\*(C`do\*(C'\fR. This probe fires before the file is +read from disk. The filename argument is converted to local filesystem +paths instead of providing \f(CW\*(C`Module::Name\*(C'\fR\-style names. +.Sp +.Vb 3 +\& :*perl*:loading\-file { +\& printf("About to load %s\en", copyinstr(arg0)); +\& } +.Ve +.IP "loaded\-file(\s-1FILENAME\s0)" 4 +.IX Item "loaded-file(FILENAME)" +Fires when Perl has successfully loaded an individual file, whether +from \f(CW\*(C`use\*(C'\fR, \f(CW\*(C`require\*(C'\fR, or \f(CW\*(C`do\*(C'\fR. This probe fires after the file +is read from disk and its contents evaluated. The filename argument +is converted to local filesystem paths instead of providing +\&\f(CW\*(C`Module::Name\*(C'\fR\-style names. +.Sp +.Vb 3 +\& :*perl*:loaded\-file { +\& printf("Successfully loaded %s\en", copyinstr(arg0)); +\& } +.Ve +.SH "EXAMPLES" +.IX Header "EXAMPLES" +.IP "Most frequently called functions" 4 +.IX Item "Most frequently called functions" +.Vb 1 +\& # dtrace \-qZn \*(Aqsub\-entry { @[strjoin(strjoin(copyinstr(arg3),"::"),copyinstr(arg0))] = count() } END {trunc(@, 10)}\*(Aq +\& +\& Class::MOP::Attribute::slots 400 +\& Try::Tiny::catch 411 +\& Try::Tiny::try 411 +\& Class::MOP::Instance::inline_slot_access 451 +\& Class::MOP::Class::Immutable::Trait:::around 472 +\& Class::MOP::Mixin::AttributeCore::has_initializer 496 +\& Class::MOP::Method::Wrapped::_\|_ANON_\|_ 544 +\& Class::MOP::Package::_package_stash 737 +\& Class::MOP::Class::initialize 1128 +\& Class::MOP::get_metaclass_by_name 1204 +.Ve +.IP "Trace function calls" 4 +.IX Item "Trace function calls" +.Vb 1 +\& # dtrace \-qFZn \*(Aqsub\-entry, sub\-return { trace(copyinstr(arg0)) }\*(Aq +\& +\& 0 \-> Perl_pp_entersub BEGIN +\& 0 <\- Perl_pp_leavesub BEGIN +\& 0 \-> Perl_pp_entersub BEGIN +\& 0 \-> Perl_pp_entersub import +\& 0 <\- Perl_pp_leavesub import +\& 0 <\- Perl_pp_leavesub BEGIN +\& 0 \-> Perl_pp_entersub BEGIN +\& 0 \-> Perl_pp_entersub dress +\& 0 <\- Perl_pp_leavesub dress +\& 0 \-> Perl_pp_entersub dirty +\& 0 <\- Perl_pp_leavesub dirty +\& 0 \-> Perl_pp_entersub whiten +\& 0 <\- Perl_pp_leavesub whiten +\& 0 <\- Perl_dounwind BEGIN +.Ve +.IP "Function calls during interpreter cleanup" 4 +.IX Item "Function calls during interpreter cleanup" +.Vb 1 +\& # dtrace \-Zn \*(Aqphase\-change /copyinstr(arg0) == "END"/ { self\->ending = 1 } sub\-entry /self\->ending/ { trace(copyinstr(arg0)) }\*(Aq +\& +\& CPU ID FUNCTION:NAME +\& 1 77214 Perl_pp_entersub:sub\-entry END +\& 1 77214 Perl_pp_entersub:sub\-entry END +\& 1 77214 Perl_pp_entersub:sub\-entry cleanup +\& 1 77214 Perl_pp_entersub:sub\-entry _force_writable +\& 1 77214 Perl_pp_entersub:sub\-entry _force_writable +.Ve +.IP "System calls at compile time" 4 +.IX Item "System calls at compile time" +.Vb 1 +\& # dtrace \-qZn \*(Aqphase\-change /copyinstr(arg0) == "START"/ { self\->interesting = 1 } phase\-change /copyinstr(arg0) == "RUN"/ { self\->interesting = 0 } syscall::: /self\->interesting/ { @[probefunc] = count() } END { trunc(@, 3) }\*(Aq +\& +\& lseek 310 +\& read 374 +\& stat64 1056 +.Ve +.IP "Perl functions that execute the most opcodes" 4 +.IX Item "Perl functions that execute the most opcodes" +.Vb 1 +\& # dtrace \-qZn \*(Aqsub\-entry { self\->fqn = strjoin(copyinstr(arg3), strjoin("::", copyinstr(arg0))) } op\-entry /self\->fqn != ""/ { @[self\->fqn] = count() } END { trunc(@, 3) }\*(Aq +\& +\& warnings::unimport 4589 +\& Exporter::Heavy::_rebuild_cache 5039 +\& Exporter::import 14578 +.Ve +.SH "REFERENCES" +.IX Header "REFERENCES" +.IP "DTrace Dynamic Tracing Guide" 4 +.IX Item "DTrace Dynamic Tracing Guide" + +.IP "DTrace: Dynamic Tracing in Oracle Solaris, Mac \s-1OS X\s0 and FreeBSD" 4 +.IX Item "DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD" + +.SH "SEE ALSO" +.IX Header "SEE ALSO" +.IP "Devel::DTrace::Provider" 4 +.IX Item "Devel::DTrace::Provider" +This \s-1CPAN\s0 module lets you create application-level DTrace probes written in +Perl. +.SH "AUTHORS" +.IX Header "AUTHORS" +Shawn M Moore \f(CW\*(C`sartak@gmail.com\*(C'\fR diff --git a/data/miniconda3/man/man1/perlebcdic.1 b/data/miniconda3/man/man1/perlebcdic.1 new file mode 100644 index 0000000000000000000000000000000000000000..eab2df1d83330d361a9cb9798ef6e74c7002b379 --- /dev/null +++ b/data/miniconda3/man/man1/perlebcdic.1 @@ -0,0 +1,2076 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLEBCDIC 1" +.TH PERLEBCDIC 1 "2020-12-18" "perl v5.32.1" "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" +perlebcdic \- Considerations for running Perl on EBCDIC platforms +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +An exploration of some of the issues facing Perl programmers +on \s-1EBCDIC\s0 based computers. +.PP +Portions of this document that are still incomplete are marked with \s-1XXX.\s0 +.PP +Early Perl versions worked on some \s-1EBCDIC\s0 machines, but the last known +version that ran on \s-1EBCDIC\s0 was v5.8.7, until v5.22, when the Perl core +again works on z/OS. Theoretically, it could work on \s-1OS/400\s0 or Siemens' +\&\s-1BS2000\s0 (or their successors), but this is untested. In v5.22 and 5.24, +not all +the modules found on \s-1CPAN\s0 but shipped with core Perl work on z/OS. +.PP +If you want to use Perl on a non\-z/OS \s-1EBCDIC\s0 machine, please let us know +at . +.PP +Writing Perl on an \s-1EBCDIC\s0 platform is really no different than writing +on an \*(L"\s-1ASCII\*(R"\s0 one, but with different underlying numbers, as we'll see +shortly. You'll have to know something about those \*(L"\s-1ASCII\*(R"\s0 platforms +because the documentation is biased and will frequently use example +numbers that don't apply to \s-1EBCDIC.\s0 There are also very few \s-1CPAN\s0 +modules that are written for \s-1EBCDIC\s0 and which don't work on \s-1ASCII\s0; +instead the vast majority of \s-1CPAN\s0 modules are written for \s-1ASCII,\s0 and +some may happen to work on \s-1EBCDIC,\s0 while a few have been designed to +portably work on both. +.PP +If your code just uses the 52 letters A\-Z and a\-z, plus \s-1SPACE,\s0 the +digits 0\-9, and the punctuation characters that Perl uses, plus a few +controls that are denoted by escape sequences like \f(CW\*(C`\en\*(C'\fR and \f(CW\*(C`\et\*(C'\fR, then +there's nothing special about using Perl, and your code may very well +work on an \s-1ASCII\s0 machine without change. +.PP +But if you write code that uses \f(CW\*(C`\e005\*(C'\fR to mean a \s-1TAB\s0 or \f(CW\*(C`\exC1\*(C'\fR to mean +an \*(L"A\*(R", or \f(CW\*(C`\exDF\*(C'\fR to mean a \*(L"y\*:\*(R" (small \f(CW"y"\fR with a diaeresis), +then your code may well work on your \s-1EBCDIC\s0 platform, but not on an +\&\s-1ASCII\s0 one. That's fine to do if no one will ever want to run your code +on an \s-1ASCII\s0 platform; but the bias in this document will be towards writing +code portable between \s-1EBCDIC\s0 and \s-1ASCII\s0 systems. Again, if every +character you care about is easily enterable from your keyboard, you +don't have to know anything about \s-1ASCII,\s0 but many keyboards don't easily +allow you to directly enter, say, the character \f(CW\*(C`\exDF\*(C'\fR, so you have to +specify it indirectly, such as by using the \f(CW"\exDF"\fR escape sequence. +In those cases it's easiest to know something about the ASCII/Unicode +character sets. If you know that the small \*(L"y\*:\*(R" is \f(CW\*(C`U+00FF\*(C'\fR, then +you can instead specify it as \f(CW"\eN{U+FF}"\fR, and have the computer +automatically translate it to \f(CW\*(C`\exDF\*(C'\fR on your platform, and leave it as +\&\f(CW\*(C`\exFF\*(C'\fR on \s-1ASCII\s0 ones. Or you could specify it by name, \f(CW\*(C`\eN{LATIN +SMALL LETTER Y WITH DIAERESIS\*(C'\fR and not have to know the numbers. +Either way works, but both require familiarity with Unicode. +.SH "COMMON CHARACTER CODE SETS" +.IX Header "COMMON CHARACTER CODE SETS" +.SS "\s-1ASCII\s0" +.IX Subsection "ASCII" +The American Standard Code for Information Interchange (\s-1ASCII\s0 or +US-ASCII) is a set of +integers running from 0 to 127 (decimal) that have standardized +interpretations by the computers which use \s-1ASCII.\s0 For example, 65 means +the letter \*(L"A\*(R". +The range 0..127 can be covered by setting various bits in a 7\-bit binary +digit, hence the set is sometimes referred to as \*(L"7\-bit \s-1ASCII\*(R". +ASCII\s0 was described by the American National Standards Institute +document \s-1ANSI X3.4\-1986.\s0 It was also described by \s-1ISO 646:1991\s0 +(with localization for currency symbols). The full \s-1ASCII\s0 set is +given in the table below as the first 128 elements. +Languages that +can be written adequately with the characters in \s-1ASCII\s0 include +English, Hawaiian, Indonesian, Swahili and some Native American +languages. +.PP +Most non-EBCDIC character sets are supersets of \s-1ASCII.\s0 That is the +integers 0\-127 mean what \s-1ASCII\s0 says they mean. But integers 128 and +above are specific to the character set. +.PP +Many of these fit entirely into 8 bits, using \s-1ASCII\s0 as 0\-127, while +specifying what 128\-255 mean, and not using anything above 255. +Thus, these are single-byte (or octet if you prefer) character sets. +One important one (since Unicode is a superset of it) is the \s-1ISO 8859\-1\s0 +character set. +.SS "\s-1ISO 8859\s0" +.IX Subsection "ISO 8859" +The \s-1ISO 8859\-\s0\fI\f(BI\f(CB$n\f(BI\fI\fR are a collection of character code sets from the +International Organization for Standardization (\s-1ISO\s0), each of which adds +characters to the \s-1ASCII\s0 set that are typically found in various +languages, many of which are based on the Roman, or Latin, alphabet. +Most are for European languages, but there are also ones for Arabic, +Greek, Hebrew, and Thai. There are good references on the web about +all these. +.SS "Latin 1 (\s-1ISO 8859\-1\s0)" +.IX Subsection "Latin 1 (ISO 8859-1)" +A particular 8\-bit extension to \s-1ASCII\s0 that includes grave and acute +accented Latin characters. Languages that can employ \s-1ISO 8859\-1\s0 +include all the languages covered by \s-1ASCII\s0 as well as Afrikaans, +Albanian, Basque, Catalan, Danish, Faroese, Finnish, Norwegian, +Portuguese, Spanish, and Swedish. Dutch is covered albeit without +the ij ligature. French is covered too but without the oe ligature. +German can use \s-1ISO 8859\-1\s0 but must do so without German-style +quotation marks. This set is based on Western European extensions +to \s-1ASCII\s0 and is commonly encountered in world wide web work. +In \s-1IBM\s0 character code set identification terminology, \s-1ISO 8859\-1\s0 is +also known as \s-1CCSID 819\s0 (or sometimes 0819 or even 00819). +.SS "\s-1EBCDIC\s0" +.IX Subsection "EBCDIC" +The Extended Binary Coded Decimal Interchange Code refers to a +large collection of single\- and multi-byte coded character sets that are +quite different from \s-1ASCII\s0 and \s-1ISO 8859\-1,\s0 and are all slightly +different from each other; they typically run on host computers. The +\&\s-1EBCDIC\s0 encodings derive from 8\-bit byte extensions of Hollerith punched +card encodings, which long predate \s-1ASCII.\s0 The layout on the +cards was such that high bits were set for the upper and lower case +alphabetic +characters \f(CW\*(C`[a\-z]\*(C'\fR and \f(CW\*(C`[A\-Z]\*(C'\fR, but there were gaps within each Latin +alphabet range, visible in the table below. These gaps can +cause complications. +.PP +Some \s-1IBM EBCDIC\s0 character sets may be known by character code set +identification numbers (\s-1CCSID\s0 numbers) or code page numbers. +.PP +Perl can be compiled on platforms that run any of three commonly used \s-1EBCDIC\s0 +character sets, listed below. +.PP +\fIThe 13 variant characters\fR +.IX Subsection "The 13 variant characters" +.PP +Among \s-1IBM EBCDIC\s0 character code sets there are 13 characters that +are often mapped to different integer values. Those characters +are known as the 13 \*(L"variant\*(R" characters and are: +.PP +.Vb 1 +\& \e [ ] { } ^ ~ ! # | $ @ \` +.Ve +.PP +When Perl is compiled for a platform, it looks at all of these characters to +guess which \s-1EBCDIC\s0 character set the platform uses, and adapts itself +accordingly to that platform. If the platform uses a character set that is not +one of the three Perl knows about, Perl will either fail to compile, or +mistakenly and silently choose one of the three. +.PP +The Line Feed (\s-1LF\s0) character is actually a 14th variant character, and +Perl checks for that as well. +.PP +\fI\s-1EBCDIC\s0 code sets recognized by Perl\fR +.IX Subsection "EBCDIC code sets recognized by Perl" +.IP "\fB0037\fR" 4 +.IX Item "0037" +Character code set \s-1ID 0037\s0 is a mapping of the \s-1ASCII\s0 plus Latin\-1 +characters (i.e. \s-1ISO 8859\-1\s0) to an \s-1EBCDIC\s0 set. 0037 is used +in North American English locales on the \s-1OS/400\s0 operating system +that runs on \s-1AS/400\s0 computers. \s-1CCSID 0037\s0 differs from \s-1ISO 8859\-1\s0 +in 236 places; in other words they agree on only 20 code point values. +.IP "\fB1047\fR" 4 +.IX Item "1047" +Character code set \s-1ID 1047\s0 is also a mapping of the \s-1ASCII\s0 plus +Latin\-1 characters (i.e. \s-1ISO 8859\-1\s0) to an \s-1EBCDIC\s0 set. 1047 is +used under Unix System Services for \s-1OS/390\s0 or z/OS, and OpenEdition +for \s-1VM/ESA.\s0 \s-1CCSID 1047\s0 differs from \s-1CCSID 0037\s0 in eight places, +and from \s-1ISO 8859\-1\s0 in 236. +.IP "\fBPOSIX-BC\fR" 4 +.IX Item "POSIX-BC" +The \s-1EBCDIC\s0 code page in use on Siemens' \s-1BS2000\s0 system is distinct from +1047 and 0037. It is identified below as the POSIX-BC set. +Like 0037 and 1047, it is the same as \s-1ISO 8859\-1\s0 in 20 code point +values. +.SS "Unicode code points versus \s-1EBCDIC\s0 code points" +.IX Subsection "Unicode code points versus EBCDIC code points" +In Unicode terminology a \fIcode point\fR is the number assigned to a +character: for example, in \s-1EBCDIC\s0 the character \*(L"A\*(R" is usually assigned +the number 193. In Unicode, the character \*(L"A\*(R" is assigned the number 65. +All the code points in \s-1ASCII\s0 and Latin\-1 (\s-1ISO 8859\-1\s0) have the same +meaning in Unicode. All three of the recognized \s-1EBCDIC\s0 code sets have +256 code points, and in each code set, all 256 code points are mapped to +equivalent Latin1 code points. Obviously, \*(L"A\*(R" will map to \*(L"A\*(R", \*(L"B\*(R" => +\&\*(L"B\*(R", \*(L"%\*(R" => \*(L"%\*(R", etc., for all printable characters in Latin1 and these +code pages. +.PP +It also turns out that \s-1EBCDIC\s0 has nearly precise equivalents for the +ASCII/Latin1 C0 controls and the \s-1DELETE\s0 control. (The C0 controls are +those whose \s-1ASCII\s0 code points are 0..0x1F; things like \s-1TAB, ACK, BEL,\s0 +etc.) A mapping is set up between these \s-1ASCII/EBCDIC\s0 controls. There +isn't such a precise mapping between the C1 controls on \s-1ASCII\s0 platforms +and the remaining \s-1EBCDIC\s0 controls. What has been done is to map these +controls, mostly arbitrarily, to some otherwise unmatched character in +the other character set. Most of these are very very rarely used +nowadays in \s-1EBCDIC\s0 anyway, and their names have been dropped, without +much complaint. For example the \s-1EO\s0 (Eight Ones) \s-1EBCDIC\s0 control +(consisting of eight one bits = 0xFF) is mapped to the C1 \s-1APC\s0 control +(0x9F), and you can't use the name \*(L"\s-1EO\*(R".\s0 +.PP +The \s-1EBCDIC\s0 controls provide three possible line terminator characters, +\&\s-1CR\s0 (0x0D), \s-1LF\s0 (0x25), and \s-1NL\s0 (0x15). On \s-1ASCII\s0 platforms, the symbols +\&\*(L"\s-1NL\*(R"\s0 and \*(L"\s-1LF\*(R"\s0 refer to the same character, but in strict \s-1EBCDIC\s0 +terminology they are different ones. The \s-1EBCDIC NL\s0 is mapped to the C1 +control called \*(L"\s-1NEL\*(R"\s0 (\*(L"Next Line\*(R"; here's a case where the mapping makes +quite a bit of sense, and hence isn't just arbitrary). On some \s-1EBCDIC\s0 +platforms, this \s-1NL\s0 or \s-1NEL\s0 is the typical line terminator. This is true +of z/OS and \s-1BS2000.\s0 In these platforms, the C compilers will swap the +\&\s-1LF\s0 and \s-1NEL\s0 code points, so that \f(CW"\en"\fR is 0x15, and refers to \s-1NL.\s0 Perl +does that too; you can see it in the code chart below. +This makes things generally \*(L"just work\*(R" without you even having to be +aware that there is a swap. +.SS "Unicode and \s-1UTF\s0" +.IX Subsection "Unicode and UTF" +\&\s-1UTF\s0 stands for \*(L"Unicode Transformation Format\*(R". +\&\s-1UTF\-8\s0 is an encoding of Unicode into a sequence of 8\-bit byte chunks, based on +\&\s-1ASCII\s0 and Latin\-1. +The length of a sequence required to represent a Unicode code point +depends on the ordinal number of that code point, +with larger numbers requiring more bytes. +UTF-EBCDIC is like \s-1UTF\-8,\s0 but based on \s-1EBCDIC.\s0 +They are enough alike that often, casual usage will conflate the two +terms, and use \*(L"\s-1UTF\-8\*(R"\s0 to mean both the \s-1UTF\-8\s0 found on \s-1ASCII\s0 platforms, +and the UTF-EBCDIC found on \s-1EBCDIC\s0 ones. +.PP +You may see the term \*(L"invariant\*(R" character or code point. +This simply means that the character has the same numeric +value and representation when encoded in \s-1UTF\-8\s0 (or UTF-EBCDIC) as when +not. (Note that this is a very different concept from \*(L"The 13 variant +characters\*(R" mentioned above. Careful prose will use the term \*(L"\s-1UTF\-8\s0 +invariant\*(R" instead of just \*(L"invariant\*(R", but most often you'll see just +\&\*(L"invariant\*(R".) For example, the ordinal value of \*(L"A\*(R" is 193 in most +\&\s-1EBCDIC\s0 code pages, and also is 193 when encoded in UTF-EBCDIC. All +\&\s-1UTF\-8\s0 (or UTF-EBCDIC) variant code points occupy at least two bytes when +encoded in \s-1UTF\-8\s0 (or UTF-EBCDIC); by definition, the \s-1UTF\-8\s0 (or +UTF-EBCDIC) invariant code points are exactly one byte whether encoded +in \s-1UTF\-8\s0 (or UTF-EBCDIC), or not. (By now you see why people typically +just say \*(L"\s-1UTF\-8\*(R"\s0 when they also mean \*(L"UTF-EBCDIC\*(R". For the rest of this +document, we'll mostly be casual about it too.) +In \s-1ASCII UTF\-8,\s0 the code points corresponding to the lowest 128 +ordinal numbers (0 \- 127: the \s-1ASCII\s0 characters) are invariant. +In UTF-EBCDIC, there are 160 invariant characters. +(If you care, the \s-1EBCDIC\s0 invariants are those characters +which have \s-1ASCII\s0 equivalents, plus those that correspond to +the C1 controls (128 \- 159 on \s-1ASCII\s0 platforms).) +.PP +A string encoded in UTF-EBCDIC may be longer (very rarely shorter) than +one encoded in \s-1UTF\-8.\s0 Perl extends both \s-1UTF\-8\s0 and UTF-EBCDIC so that +they can encode code points above the Unicode maximum of U+10FFFF. Both +extensions are constructed to allow encoding of any code point that fits +in a 64\-bit word. +.PP +UTF-EBCDIC is defined by +Unicode Technical Report #16 +(often referred to as just \s-1TR16\s0). +It is defined based on \s-1CCSID 1047,\s0 not allowing for the differences for +other code pages. This allows for easy interchange of text between +computers running different code pages, but makes it unusable, without +adaptation, for Perl on those other code pages. +.PP +The reason for this unusability is that a fundamental assumption of Perl +is that the characters it cares about for parsing and lexical analysis +are the same whether or not the text is in \s-1UTF\-8.\s0 For example, Perl +expects the character \f(CW"["\fR to have the same representation, no matter +if the string containing it (or program text) is \s-1UTF\-8\s0 encoded or not. +To ensure this, Perl adapts UTF-EBCDIC to the particular code page so +that all characters it expects to be \s-1UTF\-8\s0 invariant are in fact \s-1UTF\-8\s0 +invariant. This means that text generated on a computer running one +version of Perl's UTF-EBCDIC has to be translated to be intelligible to +a computer running another. +.PP +\&\s-1TR16\s0 implies a method to extend UTF-EBCDIC to encode points up through +\&\f(CW\*(C`2\ **\ 31\ \-\ 1\*(C'\fR. Perl uses this method for code points up through +\&\f(CW\*(C`2\ **\ 30\ \-\ 1\*(C'\fR, but uses an incompatible method for larger ones, to +enable it to handle much larger code points than otherwise. +.SS "Using Encode" +.IX Subsection "Using Encode" +Starting from Perl 5.8 you can use the standard module Encode +to translate from \s-1EBCDIC\s0 to Latin\-1 code points. +Encode knows about more \s-1EBCDIC\s0 character sets than Perl can currently +be compiled to run on. +.PP +.Vb 1 +\& use Encode \*(Aqfrom_to\*(Aq; +\& +\& my %ebcdic = ( 176 => \*(Aqcp37\*(Aq, 95 => \*(Aqcp1047\*(Aq, 106 => \*(Aqposix\-bc\*(Aq ); +\& +\& # $a is in EBCDIC code points +\& from_to($a, $ebcdic{ord \*(Aq^\*(Aq}, \*(Aqlatin1\*(Aq); +\& # $a is ISO 8859\-1 code points +.Ve +.PP +and from Latin\-1 code points to \s-1EBCDIC\s0 code points +.PP +.Vb 1 +\& use Encode \*(Aqfrom_to\*(Aq; +\& +\& my %ebcdic = ( 176 => \*(Aqcp37\*(Aq, 95 => \*(Aqcp1047\*(Aq, 106 => \*(Aqposix\-bc\*(Aq ); +\& +\& # $a is ISO 8859\-1 code points +\& from_to($a, \*(Aqlatin1\*(Aq, $ebcdic{ord \*(Aq^\*(Aq}); +\& # $a is in EBCDIC code points +.Ve +.PP +For doing I/O it is suggested that you use the autotranslating features +of PerlIO, see perluniintro. +.PP +Since version 5.8 Perl uses the PerlIO I/O library. This enables +you to use different encodings per \s-1IO\s0 channel. For example you may use +.PP +.Vb 9 +\& use Encode; +\& open($f, ">:encoding(ascii)", "test.ascii"); +\& print $f "Hello World!\en"; +\& open($f, ">:encoding(cp37)", "test.ebcdic"); +\& print $f "Hello World!\en"; +\& open($f, ">:encoding(latin1)", "test.latin1"); +\& print $f "Hello World!\en"; +\& open($f, ">:encoding(utf8)", "test.utf8"); +\& print $f "Hello World!\en"; +.Ve +.PP +to get four files containing \*(L"Hello World!\en\*(R" in \s-1ASCII, CP 0037 EBCDIC, +ISO 8859\-1\s0 (Latin\-1) (in this example identical to \s-1ASCII\s0 since only \s-1ASCII\s0 +characters were printed), and +UTF-EBCDIC (in this example identical to normal \s-1EBCDIC\s0 since only characters +that don't differ between \s-1EBCDIC\s0 and UTF-EBCDIC were printed). See the +documentation of Encode::PerlIO for details. +.PP +As the PerlIO layer uses raw \s-1IO\s0 (bytes) internally, all this totally +ignores things like the type of your filesystem (\s-1ASCII\s0 or \s-1EBCDIC\s0). +.SH "SINGLE OCTET TABLES" +.IX Header "SINGLE OCTET TABLES" +The following tables list the \s-1ASCII\s0 and Latin 1 ordered sets including +the subsets: C0 controls (0..31), \s-1ASCII\s0 graphics (32..7e), delete (7f), +C1 controls (80..9f), and Latin\-1 (a.k.a. \s-1ISO 8859\-1\s0) (a0..ff). In the +table names of the Latin 1 +extensions to \s-1ASCII\s0 have been labelled with character names roughly +corresponding to \fIThe Unicode Standard, Version 6.1\fR albeit with +substitutions such as \f(CW\*(C`s/LATIN//\*(C'\fR and \f(CW\*(C`s/VULGAR//\*(C'\fR in all cases; +\&\f(CW\*(C`s/CAPITAL\ LETTER//\*(C'\fR in some cases; and +\&\f(CW\*(C`s/SMALL\ LETTER\ ([A\-Z])/\el$1/\*(C'\fR in some other +cases. Controls are listed using their Unicode 6.2 abbreviations. +The differences between the 0037 and 1047 sets are +flagged with \f(CW\*(C`**\*(C'\fR. The differences between the 1047 and POSIX-BC sets +are flagged with \f(CW\*(C`##.\*(C'\fR All \f(CW\*(C`ord()\*(C'\fR numbers listed are decimal. If you +would rather see this table listing octal values, then run the table +(that is, the pod source text of this document, since this recipe may not +work with a pod2_other_format translation) through: +.IP "recipe 0" 4 +.IX Item "recipe 0" +.PP +.Vb 3 +\& perl \-ne \*(Aqif(/(.{29})(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)/)\*(Aq \e +\& \-e \*(Aq{printf("%s%\-5.03o%\-5.03o%\-5.03o%.03o\en",$1,$2,$3,$4,$5)}\*(Aq \e +\& perlebcdic.pod +.Ve +.PP +If you want to retain the UTF-x code points then in script form you +might want to write: +.IP "recipe 1" 4 +.IX Item "recipe 1" +.PP +.Vb 10 +\& open(FH,") { +\& if (/(.{29})(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)\e.?(\ed*) +\& \es+(\ed+)\e.?(\ed*)/x) +\& { +\& if ($7 ne \*(Aq\*(Aq && $9 ne \*(Aq\*(Aq) { +\& printf( +\& "%s%\-5.03o%\-5.03o%\-5.03o%\-5.03o%\-3o.%\-5o%\-3o.%.03o\en", +\& $1,$2,$3,$4,$5,$6,$7,$8,$9); +\& } +\& elsif ($7 ne \*(Aq\*(Aq) { +\& printf("%s%\-5.03o%\-5.03o%\-5.03o%\-5.03o%\-3o.%\-5o%.03o\en", +\& $1,$2,$3,$4,$5,$6,$7,$8); +\& } +\& else { +\& printf("%s%\-5.03o%\-5.03o%\-5.03o%\-5.03o%\-5.03o%.03o\en", +\& $1,$2,$3,$4,$5,$6,$8); +\& } +\& } +\& } +.Ve +.PP +If you would rather see this table listing hexadecimal values then +run the table through: +.IP "recipe 2" 4 +.IX Item "recipe 2" +.PP +.Vb 3 +\& perl \-ne \*(Aqif(/(.{29})(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)/)\*(Aq \e +\& \-e \*(Aq{printf("%s%\-5.02X%\-5.02X%\-5.02X%.02X\en",$1,$2,$3,$4,$5)}\*(Aq \e +\& perlebcdic.pod +.Ve +.PP +Or, in order to retain the UTF-x code points in hexadecimal: +.IP "recipe 3" 4 +.IX Item "recipe 3" +.PP +.Vb 10 +\& open(FH,") { +\& if (/(.{29})(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)\es+(\ed+)\e.?(\ed*) +\& \es+(\ed+)\e.?(\ed*)/x) +\& { +\& if ($7 ne \*(Aq\*(Aq && $9 ne \*(Aq\*(Aq) { +\& printf( +\& "%s%\-5.02X%\-5.02X%\-5.02X%\-5.02X%\-2X.%\-6.02X%02X.%02X\en", +\& $1,$2,$3,$4,$5,$6,$7,$8,$9); +\& } +\& elsif ($7 ne \*(Aq\*(Aq) { +\& printf("%s%\-5.02X%\-5.02X%\-5.02X%\-5.02X%\-2X.%\-6.02X%02X\en", +\& $1,$2,$3,$4,$5,$6,$7,$8); +\& } +\& else { +\& printf("%s%\-5.02X%\-5.02X%\-5.02X%\-5.02X%\-5.02X%02X\en", +\& $1,$2,$3,$4,$5,$6,$8); +\& } +\& } +\& } +\& +\& +\& ISO +\& 8859\-1 POS\- CCSID +\& CCSID CCSID CCSID IX\- 1047 +\& chr 0819 0037 1047 BC UTF\-8 UTF\-EBCDIC +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& 0 0 0 0 0 0 +\& 1 1 1 1 1 1 +\& 2 2 2 2 2 2 +\& 3 3 3 3 3 3 +\& 4 55 55 55 4 55 +\& 5 45 45 45 5 45 +\& 6 46 46 46 6 46 +\& 7 47 47 47 7 47 +\& 8 22 22 22 8 22 +\& 9 5 5 5 9 5 +\& 10 37 21 21 10 21 ** +\& 11 11 11 11 11 11 +\& 12 12 12 12 12 12 +\& 13 13 13 13 13 13 +\& 14 14 14 14 14 14 +\& 15 15 15 15 15 15 +\& 16 16 16 16 16 16 +\& 17 17 17 17 17 17 +\& 18 18 18 18 18 18 +\& 19 19 19 19 19 19 +\& 20 60 60 60 20 60 +\& 21 61 61 61 21 61 +\& 22 50 50 50 22 50 +\& 23 38 38 38 23 38 +\& 24 24 24 24 24 24 +\& 25 25 25 25 25 25 +\& 26 63 63 63 26 63 +\& 27 39 39 39 27 39 +\& 28 28 28 28 28 28 +\& 29 29 29 29 29 29 +\& 30 30 30 30 30 30 +\& 31 31 31 31 31 31 +\& 32 64 64 64 32 64 +\& ! 33 90 90 90 33 90 +\& " 34 127 127 127 34 127 +\& # 35 123 123 123 35 123 +\& $ 36 91 91 91 36 91 +\& % 37 108 108 108 37 108 +\& & 38 80 80 80 38 80 +\& \*(Aq 39 125 125 125 39 125 +\& ( 40 77 77 77 40 77 +\& ) 41 93 93 93 41 93 +\& * 42 92 92 92 42 92 +\& + 43 78 78 78 43 78 +\& , 44 107 107 107 44 107 +\& \- 45 96 96 96 45 96 +\& . 46 75 75 75 46 75 +\& / 47 97 97 97 47 97 +\& 0 48 240 240 240 48 240 +\& 1 49 241 241 241 49 241 +\& 2 50 242 242 242 50 242 +\& 3 51 243 243 243 51 243 +\& 4 52 244 244 244 52 244 +\& 5 53 245 245 245 53 245 +\& 6 54 246 246 246 54 246 +\& 7 55 247 247 247 55 247 +\& 8 56 248 248 248 56 248 +\& 9 57 249 249 249 57 249 +\& : 58 122 122 122 58 122 +\& ; 59 94 94 94 59 94 +\& < 60 76 76 76 60 76 +\& = 61 126 126 126 61 126 +\& > 62 110 110 110 62 110 +\& ? 63 111 111 111 63 111 +\& @ 64 124 124 124 64 124 +\& A 65 193 193 193 65 193 +\& B 66 194 194 194 66 194 +\& C 67 195 195 195 67 195 +\& D 68 196 196 196 68 196 +\& E 69 197 197 197 69 197 +\& F 70 198 198 198 70 198 +\& G 71 199 199 199 71 199 +\& H 72 200 200 200 72 200 +\& I 73 201 201 201 73 201 +\& J 74 209 209 209 74 209 +\& K 75 210 210 210 75 210 +\& L 76 211 211 211 76 211 +\& M 77 212 212 212 77 212 +\& N 78 213 213 213 78 213 +\& O 79 214 214 214 79 214 +\& P 80 215 215 215 80 215 +\& Q 81 216 216 216 81 216 +\& R 82 217 217 217 82 217 +\& S 83 226 226 226 83 226 +\& T 84 227 227 227 84 227 +\& U 85 228 228 228 85 228 +\& V 86 229 229 229 86 229 +\& W 87 230 230 230 87 230 +\& X 88 231 231 231 88 231 +\& Y 89 232 232 232 89 232 +\& Z 90 233 233 233 90 233 +\& [ 91 186 173 187 91 173 ** ## +\& \e 92 224 224 188 92 224 ## +\& ] 93 187 189 189 93 189 ** +\& ^ 94 176 95 106 94 95 ** ## +\& _ 95 109 109 109 95 109 +\& \` 96 121 121 74 96 121 ## +\& a 97 129 129 129 97 129 +\& b 98 130 130 130 98 130 +\& c 99 131 131 131 99 131 +\& d 100 132 132 132 100 132 +\& e 101 133 133 133 101 133 +\& f 102 134 134 134 102 134 +\& g 103 135 135 135 103 135 +\& h 104 136 136 136 104 136 +\& i 105 137 137 137 105 137 +\& j 106 145 145 145 106 145 +\& k 107 146 146 146 107 146 +\& l 108 147 147 147 108 147 +\& m 109 148 148 148 109 148 +\& n 110 149 149 149 110 149 +\& o 111 150 150 150 111 150 +\& p 112 151 151 151 112 151 +\& q 113 152 152 152 113 152 +\& r 114 153 153 153 114 153 +\& s 115 162 162 162 115 162 +\& t 116 163 163 163 116 163 +\& u 117 164 164 164 117 164 +\& v 118 165 165 165 118 165 +\& w 119 166 166 166 119 166 +\& x 120 167 167 167 120 167 +\& y 121 168 168 168 121 168 +\& z 122 169 169 169 122 169 +\& { 123 192 192 251 123 192 ## +\& | 124 79 79 79 124 79 +\& } 125 208 208 253 125 208 ## +\& ~ 126 161 161 255 126 161 ## +\& 127 7 7 7 127 7 +\& 128 32 32 32 194.128 32 +\& 129 33 33 33 194.129 33 +\& 130 34 34 34 194.130 34 +\& 131 35 35 35 194.131 35 +\& 132 36 36 36 194.132 36 +\& 133 21 37 37 194.133 37 ** +\& 134 6 6 6 194.134 6 +\& 135 23 23 23 194.135 23 +\& 136 40 40 40 194.136 40 +\& 137 41 41 41 194.137 41 +\& 138 42 42 42 194.138 42 +\& 139 43 43 43 194.139 43 +\& 140 44 44 44 194.140 44 +\& 141 9 9 9 194.141 9 +\& 142 10 10 10 194.142 10 +\& 143 27 27 27 194.143 27 +\& 144 48 48 48 194.144 48 +\& 145 49 49 49 194.145 49 +\& 146 26 26 26 194.146 26 +\& 147 51 51 51 194.147 51 +\& 148 52 52 52 194.148 52 +\& 149 53 53 53 194.149 53 +\& 150 54 54 54 194.150 54 +\& 151 8 8 8 194.151 8 +\& 152 56 56 56 194.152 56 +\& 153 57 57 57 194.153 57 +\& 154 58 58 58 194.154 58 +\& 155 59 59 59 194.155 59 +\& 156 4 4 4 194.156 4 +\& 157 20 20 20 194.157 20 +\& 158 62 62 62 194.158 62 +\& 159 255 255 95 194.159 255 ## +\& 160 65 65 65 194.160 128.65 +\& 161 170 170 170 194.161 128.66 +\& 162 74 74 176 194.162 128.67 ## +\& 163 177 177 177 194.163 128.68 +\& 164 159 159 159 194.164 128.69 +\& 165 178 178 178 194.165 128.70 +\& 166 106 106 208 194.166 128.71 ## +\&
167 181 181 181 194.167 128.72 +\& 168 189 187 121 194.168 128.73 ** ## +\& 169 180 180 180 194.169 128.74 +\& 170 154 154 154 194.170 128.81 +\& 171 138 138 138 194.171 128.82 +\& 172 95 176 186 194.172 128.83 ** ## +\& 173 202 202 202 194.173 128.84 +\& 174 175 175 175 194.174 128.85 +\& 175 188 188 161 194.175 128.86 ## +\& 176 144 144 144 194.176 128.87 +\& 177 143 143 143 194.177 128.88 +\& 178 234 234 234 194.178 128.89 +\& 179 250 250 250 194.179 128.98 +\& 180 190 190 190 194.180 128.99 +\& 181 160 160 160 194.181 128.100 +\& 182 182 182 182 194.182 128.101 +\& 183 179 179 179 194.183 128.102 +\& 184 157 157 157 194.184 128.103 +\& 185 218 218 218 194.185 128.104 +\& 186 155 155 155 194.186 128.105 +\& 187 139 139 139 194.187 128.106 +\& 188 183 183 183 194.188 128.112 +\& 189 184 184 184 194.189 128.113 +\& 190 185 185 185 194.190 128.114 +\& 191 171 171 171 194.191 128.115 +\& 192 100 100 100 195.128 138.65 +\& 193 101 101 101 195.129 138.66 +\& 194 98 98 98 195.130 138.67 +\& 195 102 102 102 195.131 138.68 +\& 196 99 99 99 195.132 138.69 +\& 197 103 103 103 195.133 138.70 +\& 198 158 158 158 195.134 138.71 +\& 199 104 104 104 195.135 138.72 +\& 200 116 116 116 195.136 138.73 +\& 201 113 113 113 195.137 138.74 +\& 202 114 114 114 195.138 138.81 +\& 203 115 115 115 195.139 138.82 +\& 204 120 120 120 195.140 138.83 +\& 205 117 117 117 195.141 138.84 +\& 206 118 118 118 195.142 138.85 +\& 207 119 119 119 195.143 138.86 +\& 208 172 172 172 195.144 138.87 +\& 209 105 105 105 195.145 138.88 +\& 210 237 237 237 195.146 138.89 +\& 211 238 238 238 195.147 138.98 +\& 212 235 235 235 195.148 138.99 +\& 213 239 239 239 195.149 138.100 +\& 214 236 236 236 195.150 138.101 +\& 215 191 191 191 195.151 138.102 +\& 216 128 128 128 195.152 138.103 +\& 217 253 253 224 195.153 138.104 ## +\& 218 254 254 254 195.154 138.105 +\& 219 251 251 221 195.155 138.106 ## +\& 220 252 252 252 195.156 138.112 +\& 221 173 186 173 195.157 138.113 ** ## +\& 222 174 174 174 195.158 138.114 +\& 223 89 89 89 195.159 138.115 +\& 224 68 68 68 195.160 139.65 +\& 225 69 69 69 195.161 139.66 +\& 226 66 66 66 195.162 139.67 +\& 227 70 70 70 195.163 139.68 +\& 228 67 67 67 195.164 139.69 +\& 229 71 71 71 195.165 139.70 +\& 230 156 156 156 195.166 139.71 +\& 231 72 72 72 195.167 139.72 +\& 232 84 84 84 195.168 139.73 +\& 233 81 81 81 195.169 139.74 +\& 234 82 82 82 195.170 139.81 +\& 235 83 83 83 195.171 139.82 +\& 236 88 88 88 195.172 139.83 +\& 237 85 85 85 195.173 139.84 +\& 238 86 86 86 195.174 139.85 +\& 239 87 87 87 195.175 139.86 +\& 240 140 140 140 195.176 139.87 +\& 241 73 73 73 195.177 139.88 +\& 242 205 205 205 195.178 139.89 +\& 243 206 206 206 195.179 139.98 +\& 244 203 203 203 195.180 139.99 +\& 245 207 207 207 195.181 139.100 +\& 246 204 204 204 195.182 139.101 +\& 247 225 225 225 195.183 139.102 +\& 248 112 112 112 195.184 139.103 +\& 249 221 221 192 195.185 139.104 ## +\& 250 222 222 222 195.186 139.105 +\& 251 219 219 219 195.187 139.106 +\& 252 220 220 220 195.188 139.112 +\& 253 141 141 141 195.189 139.113 +\& 254 142 142 142 195.190 139.114 +\& 255 223 223 223 195.191 139.115 +.Ve +.PP +If you would rather see the above table in \s-1CCSID 0037\s0 order rather than +\&\s-1ASCII +\s0 Latin\-1 order then run the table through: +.IP "recipe 4" 4 +.IX Item "recipe 4" +.PP +.Vb 6 +\& perl \e +\& \-ne \*(Aqif(/.{29}\ed{1,3}\es{2,4}\ed{1,3}\es{2,4}\ed{1,3}\es{2,4}\ed{1,3}/)\*(Aq\e +\& \-e \*(Aq{push(@l,$_)}\*(Aq \e +\& \-e \*(AqEND{print map{$_\->[0]}\*(Aq \e +\& \-e \*(Aq sort{$a\->[1] <=> $b\->[1]}\*(Aq \e +\& \-e \*(Aq map{[$_,substr($_,34,3)]}@l;}\*(Aq perlebcdic.pod +.Ve +.PP +If you would rather see it in \s-1CCSID 1047\s0 order then change the number +34 in the last line to 39, like this: +.IP "recipe 5" 4 +.IX Item "recipe 5" +.PP +.Vb 6 +\& perl \e +\& \-ne \*(Aqif(/.{29}\ed{1,3}\es{2,4}\ed{1,3}\es{2,4}\ed{1,3}\es{2,4}\ed{1,3}/)\*(Aq\e +\& \-e \*(Aq{push(@l,$_)}\*(Aq \e +\& \-e \*(AqEND{print map{$_\->[0]}\*(Aq \e +\& \-e \*(Aq sort{$a\->[1] <=> $b\->[1]}\*(Aq \e +\& \-e \*(Aq map{[$_,substr($_,39,3)]}@l;}\*(Aq perlebcdic.pod +.Ve +.PP +If you would rather see it in POSIX-BC order then change the number +34 in the last line to 44, like this: +.IP "recipe 6" 4 +.IX Item "recipe 6" +.PP +.Vb 6 +\& perl \e +\& \-ne \*(Aqif(/.{29}\ed{1,3}\es{2,4}\ed{1,3}\es{2,4}\ed{1,3}\es{2,4}\ed{1,3}/)\*(Aq\e +\& \-e \*(Aq{push(@l,$_)}\*(Aq \e +\& \-e \*(AqEND{print map{$_\->[0]}\*(Aq \e +\& \-e \*(Aq sort{$a\->[1] <=> $b\->[1]}\*(Aq \e +\& \-e \*(Aq map{[$_,substr($_,44,3)]}@l;}\*(Aq perlebcdic.pod +.Ve +.SS "Table in hex, sorted in 1047 order" +.IX Subsection "Table in hex, sorted in 1047 order" +Since this document was first written, the convention has become more +and more to use hexadecimal notation for code points. To do this with +the recipes and to also sort is a multi-step process, so here, for +convenience, is the table from above, re-sorted to be in Code Page 1047 +order, and using hex notation. +.PP +.Vb 10 +\& ISO +\& 8859\-1 POS\- CCSID +\& CCSID CCSID CCSID IX\- 1047 +\& chr 0819 0037 1047 BC UTF\-8 UTF\-EBCDIC +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& 00 00 00 00 00 00 +\& 01 01 01 01 01 01 +\& 02 02 02 02 02 02 +\& 03 03 03 03 03 03 +\& 9C 04 04 04 C2.9C 04 +\& 09 05 05 05 09 05 +\& 86 06 06 06 C2.86 06 +\& 7F 07 07 07 7F 07 +\& 97 08 08 08 C2.97 08 +\& 8D 09 09 09 C2.8D 09 +\& 8E 0A 0A 0A C2.8E 0A +\& 0B 0B 0B 0B 0B 0B +\& 0C 0C 0C 0C 0C 0C +\& 0D 0D 0D 0D 0D 0D +\& 0E 0E 0E 0E 0E 0E +\& 0F 0F 0F 0F 0F 0F +\& 10 10 10 10 10 10 +\& 11 11 11 11 11 11 +\& 12 12 12 12 12 12 +\& 13 13 13 13 13 13 +\& 9D 14 14 14 C2.9D 14 +\& 0A 25 15 15 0A 15 ** +\& 08 16 16 16 08 16 +\& 87 17 17 17 C2.87 17 +\& 18 18 18 18 18 18 +\& 19 19 19 19 19 19 +\& 92 1A 1A 1A C2.92 1A +\& 8F 1B 1B 1B C2.8F 1B +\& 1C 1C 1C 1C 1C 1C +\& 1D 1D 1D 1D 1D 1D +\& 1E 1E 1E 1E 1E 1E +\& 1F 1F 1F 1F 1F 1F +\& 80 20 20 20 C2.80 20 +\& 81 21 21 21 C2.81 21 +\& 82 22 22 22 C2.82 22 +\& 83 23 23 23 C2.83 23 +\& 84 24 24 24 C2.84 24 +\& 85 15 25 25 C2.85 25 ** +\& 17 26 26 26 17 26 +\& 1B 27 27 27 1B 27 +\& 88 28 28 28 C2.88 28 +\& 89 29 29 29 C2.89 29 +\& 8A 2A 2A 2A C2.8A 2A +\& 8B 2B 2B 2B C2.8B 2B +\& 8C 2C 2C 2C C2.8C 2C +\& 05 2D 2D 2D 05 2D +\& 06 2E 2E 2E 06 2E +\& 07 2F 2F 2F 07 2F +\& 90 30 30 30 C2.90 30 +\& 91 31 31 31 C2.91 31 +\& 16 32 32 32 16 32 +\& 93 33 33 33 C2.93 33 +\& 94 34 34 34 C2.94 34 +\& 95 35 35 35 C2.95 35 +\& 96 36 36 36 C2.96 36 +\& 04 37 37 37 04 37 +\& 98 38 38 38 C2.98 38 +\& 99 39 39 39 C2.99 39 +\& 9A 3A 3A 3A C2.9A 3A +\& 9B 3B 3B 3B C2.9B 3B +\& 14 3C 3C 3C 14 3C +\& 15 3D 3D 3D 15 3D +\& 9E 3E 3E 3E C2.9E 3E +\& 1A 3F 3F 3F 1A 3F +\& 20 40 40 40 20 40 +\& A0 41 41 41 C2.A0 80.41 +\& E2 42 42 42 C3.A2 8B.43 +\& E4 43 43 43 C3.A4 8B.45 +\& E0 44 44 44 C3.A0 8B.41 +\& E1 45 45 45 C3.A1 8B.42 +\& E3 46 46 46 C3.A3 8B.44 +\& E5 47 47 47 C3.A5 8B.46 +\& E7 48 48 48 C3.A7 8B.48 +\& F1 49 49 49 C3.B1 8B.58 +\& A2 4A 4A B0 C2.A2 80.43 ## +\& . 2E 4B 4B 4B 2E 4B +\& < 3C 4C 4C 4C 3C 4C +\& ( 28 4D 4D 4D 28 4D +\& + 2B 4E 4E 4E 2B 4E +\& | 7C 4F 4F 4F 7C 4F +\& & 26 50 50 50 26 50 +\& E9 51 51 51 C3.A9 8B.4A +\& EA 52 52 52 C3.AA 8B.51 +\& EB 53 53 53 C3.AB 8B.52 +\& E8 54 54 54 C3.A8 8B.49 +\& ED 55 55 55 C3.AD 8B.54 +\& EE 56 56 56 C3.AE 8B.55 +\& EF 57 57 57 C3.AF 8B.56 +\& EC 58 58 58 C3.AC 8B.53 +\& DF 59 59 59 C3.9F 8A.73 +\& ! 21 5A 5A 5A 21 5A +\& $ 24 5B 5B 5B 24 5B +\& * 2A 5C 5C 5C 2A 5C +\& ) 29 5D 5D 5D 29 5D +\& ; 3B 5E 5E 5E 3B 5E +\& ^ 5E B0 5F 6A 5E 5F ** ## +\& \- 2D 60 60 60 2D 60 +\& / 2F 61 61 61 2F 61 +\& C2 62 62 62 C3.82 8A.43 +\& C4 63 63 63 C3.84 8A.45 +\& C0 64 64 64 C3.80 8A.41 +\& C1 65 65 65 C3.81 8A.42 +\& C3 66 66 66 C3.83 8A.44 +\& C5 67 67 67 C3.85 8A.46 +\& C7 68 68 68 C3.87 8A.48 +\& D1 69 69 69 C3.91 8A.58 +\& A6 6A 6A D0 C2.A6 80.47 ## +\& , 2C 6B 6B 6B 2C 6B +\& % 25 6C 6C 6C 25 6C +\& _ 5F 6D 6D 6D 5F 6D +\& > 3E 6E 6E 6E 3E 6E +\& ? 3F 6F 6F 6F 3F 6F +\& F8 70 70 70 C3.B8 8B.67 +\& C9 71 71 71 C3.89 8A.4A +\& CA 72 72 72 C3.8A 8A.51 +\& CB 73 73 73 C3.8B 8A.52 +\& C8 74 74 74 C3.88 8A.49 +\& CD 75 75 75 C3.8D 8A.54 +\& CE 76 76 76 C3.8E 8A.55 +\& CF 77 77 77 C3.8F 8A.56 +\& CC 78 78 78 C3.8C 8A.53 +\& \` 60 79 79 4A 60 79 ## +\& : 3A 7A 7A 7A 3A 7A +\& # 23 7B 7B 7B 23 7B +\& @ 40 7C 7C 7C 40 7C +\& \*(Aq 27 7D 7D 7D 27 7D +\& = 3D 7E 7E 7E 3D 7E +\& " 22 7F 7F 7F 22 7F +\& D8 80 80 80 C3.98 8A.67 +\& a 61 81 81 81 61 81 +\& b 62 82 82 82 62 82 +\& c 63 83 83 83 63 83 +\& d 64 84 84 84 64 84 +\& e 65 85 85 85 65 85 +\& f 66 86 86 86 66 86 +\& g 67 87 87 87 67 87 +\& h 68 88 88 88 68 88 +\& i 69 89 89 89 69 89 +\& AB 8A 8A 8A C2.AB 80.52 +\& BB 8B 8B 8B C2.BB 80.6A +\& F0 8C 8C 8C C3.B0 8B.57 +\& FD 8D 8D 8D C3.BD 8B.71 +\& FE 8E 8E 8E C3.BE 8B.72 +\& B1 8F 8F 8F C2.B1 80.58 +\& B0 90 90 90 C2.B0 80.57 +\& j 6A 91 91 91 6A 91 +\& k 6B 92 92 92 6B 92 +\& l 6C 93 93 93 6C 93 +\& m 6D 94 94 94 6D 94 +\& n 6E 95 95 95 6E 95 +\& o 6F 96 96 96 6F 96 +\& p 70 97 97 97 70 97 +\& q 71 98 98 98 71 98 +\& r 72 99 99 99 72 99 +\& AA 9A 9A 9A C2.AA 80.51 +\& BA 9B 9B 9B C2.BA 80.69 +\& E6 9C 9C 9C C3.A6 8B.47 +\& B8 9D 9D 9D C2.B8 80.67 +\& C6 9E 9E 9E C3.86 8A.47 +\& A4 9F 9F 9F C2.A4 80.45 +\& B5 A0 A0 A0 C2.B5 80.64 +\& ~ 7E A1 A1 FF 7E A1 ## +\& s 73 A2 A2 A2 73 A2 +\& t 74 A3 A3 A3 74 A3 +\& u 75 A4 A4 A4 75 A4 +\& v 76 A5 A5 A5 76 A5 +\& w 77 A6 A6 A6 77 A6 +\& x 78 A7 A7 A7 78 A7 +\& y 79 A8 A8 A8 79 A8 +\& z 7A A9 A9 A9 7A A9 +\& A1 AA AA AA C2.A1 80.42 +\& BF AB AB AB C2.BF 80.73 +\& D0 AC AC AC C3.90 8A.57 +\& [ 5B BA AD BB 5B AD ** ## +\& DE AE AE AE C3.9E 8A.72 +\& AE AF AF AF C2.AE 80.55 +\& AC 5F B0 BA C2.AC 80.53 ** ## +\& A3 B1 B1 B1 C2.A3 80.44 +\& A5 B2 B2 B2 C2.A5 80.46 +\& B7 B3 B3 B3 C2.B7 80.66 +\& A9 B4 B4 B4 C2.A9 80.4A +\&
A7 B5 B5 B5 C2.A7 80.48 +\& B6 B6 B6 B6 C2.B6 80.65 +\& BC B7 B7 B7 C2.BC 80.70 +\& BD B8 B8 B8 C2.BD 80.71 +\& BE B9 B9 B9 C2.BE 80.72 +\& DD AD BA AD C3.9D 8A.71 ** ## +\& A8 BD BB 79 C2.A8 80.49 ** ## +\& AF BC BC A1 C2.AF 80.56 ## +\& ] 5D BB BD BD 5D BD ** +\& B4 BE BE BE C2.B4 80.63 +\& D7 BF BF BF C3.97 8A.66 +\& { 7B C0 C0 FB 7B C0 ## +\& A 41 C1 C1 C1 41 C1 +\& B 42 C2 C2 C2 42 C2 +\& C 43 C3 C3 C3 43 C3 +\& D 44 C4 C4 C4 44 C4 +\& E 45 C5 C5 C5 45 C5 +\& F 46 C6 C6 C6 46 C6 +\& G 47 C7 C7 C7 47 C7 +\& H 48 C8 C8 C8 48 C8 +\& I 49 C9 C9 C9 49 C9 +\& AD CA CA CA C2.AD 80.54 +\& F4 CB CB CB C3.B4 8B.63 +\& F6 CC CC CC C3.B6 8B.65 +\& F2 CD CD CD C3.B2 8B.59 +\& F3 CE CE CE C3.B3 8B.62 +\& F5 CF CF CF C3.B5 8B.64 +\& } 7D D0 D0 FD 7D D0 ## +\& J 4A D1 D1 D1 4A D1 +\& K 4B D2 D2 D2 4B D2 +\& L 4C D3 D3 D3 4C D3 +\& M 4D D4 D4 D4 4D D4 +\& N 4E D5 D5 D5 4E D5 +\& O 4F D6 D6 D6 4F D6 +\& P 50 D7 D7 D7 50 D7 +\& Q 51 D8 D8 D8 51 D8 +\& R 52 D9 D9 D9 52 D9 +\& B9 DA DA DA C2.B9 80.68 +\& FB DB DB DB C3.BB 8B.6A +\& FC DC DC DC C3.BC 8B.70 +\& F9 DD DD C0 C3.B9 8B.68 ## +\& FA DE DE DE C3.BA 8B.69 +\& FF DF DF DF C3.BF 8B.73 +\& \e 5C E0 E0 BC 5C E0 ## +\& F7 E1 E1 E1 C3.B7 8B.66 +\& S 53 E2 E2 E2 53 E2 +\& T 54 E3 E3 E3 54 E3 +\& U 55 E4 E4 E4 55 E4 +\& V 56 E5 E5 E5 56 E5 +\& W 57 E6 E6 E6 57 E6 +\& X 58 E7 E7 E7 58 E7 +\& Y 59 E8 E8 E8 59 E8 +\& Z 5A E9 E9 E9 5A E9 +\& B2 EA EA EA C2.B2 80.59 +\& D4 EB EB EB C3.94 8A.63 +\& D6 EC EC EC C3.96 8A.65 +\& D2 ED ED ED C3.92 8A.59 +\& D3 EE EE EE C3.93 8A.62 +\& D5 EF EF EF C3.95 8A.64 +\& 0 30 F0 F0 F0 30 F0 +\& 1 31 F1 F1 F1 31 F1 +\& 2 32 F2 F2 F2 32 F2 +\& 3 33 F3 F3 F3 33 F3 +\& 4 34 F4 F4 F4 34 F4 +\& 5 35 F5 F5 F5 35 F5 +\& 6 36 F6 F6 F6 36 F6 +\& 7 37 F7 F7 F7 37 F7 +\& 8 38 F8 F8 F8 38 F8 +\& 9 39 F9 F9 F9 39 F9 +\& B3 FA FA FA C2.B3 80.62 +\& DB FB FB DD C3.9B 8A.6A ## +\& DC FC FC FC C3.9C 8A.70 +\& D9 FD FD E0 C3.99 8A.68 ## +\& DA FE FE FE C3.9A 8A.69 +\& 9F FF FF 5F C2.9F FF ## +.Ve +.SH "IDENTIFYING CHARACTER CODE SETS" +.IX Header "IDENTIFYING CHARACTER CODE SETS" +It is possible to determine which character set you are operating under. +But first you need to be really really sure you need to do this. Your +code will be simpler and probably just as portable if you don't have +to test the character set and do different things, depending. There are +actually only very few circumstances where it's not easy to write +straight-line code portable to all character sets. See +\&\*(L"Unicode and \s-1EBCDIC\*(R"\s0 in perluniintro for how to portably specify +characters. +.PP +But there are some cases where you may want to know which character set +you are running under. One possible example is doing +sorting in inner loops where performance is critical. +.PP +To determine if you are running under \s-1ASCII\s0 or \s-1EBCDIC,\s0 you can use the +return value of \f(CW\*(C`ord()\*(C'\fR or \f(CW\*(C`chr()\*(C'\fR to test one or more character +values. For example: +.PP +.Vb 4 +\& $is_ascii = "A" eq chr(65); +\& $is_ebcdic = "A" eq chr(193); +\& $is_ascii = ord("A") == 65; +\& $is_ebcdic = ord("A") == 193; +.Ve +.PP +There's even less need to distinguish between \s-1EBCDIC\s0 code pages, but to +do so try looking at one or more of the characters that differ between +them. +.PP +.Vb 4 +\& $is_ascii = ord(\*(Aq[\*(Aq) == 91; +\& $is_ebcdic_37 = ord(\*(Aq[\*(Aq) == 186; +\& $is_ebcdic_1047 = ord(\*(Aq[\*(Aq) == 173; +\& $is_ebcdic_POSIX_BC = ord(\*(Aq[\*(Aq) == 187; +.Ve +.PP +However, it would be unwise to write tests such as: +.PP +.Vb 2 +\& $is_ascii = "\er" ne chr(13); # WRONG +\& $is_ascii = "\en" ne chr(10); # ILL ADVISED +.Ve +.PP +Obviously the first of these will fail to distinguish most \s-1ASCII\s0 +platforms from either a \s-1CCSID 0037,\s0 a 1047, or a POSIX-BC \s-1EBCDIC\s0 +platform since \f(CW\*(C`"\er"\ eq\ chr(13)\*(C'\fR under all of those coded character +sets. But note too that because \f(CW"\en"\fR is \f(CW\*(C`chr(13)\*(C'\fR and \f(CW"\er"\fR is +\&\f(CW\*(C`chr(10)\*(C'\fR on old Macintosh (which is an \s-1ASCII\s0 platform) the second +\&\f(CW$is_ascii\fR test will lead to trouble there. +.PP +To determine whether or not perl was built under an \s-1EBCDIC\s0 +code page you can use the Config module like so: +.PP +.Vb 2 +\& use Config; +\& $is_ebcdic = $Config{\*(Aqebcdic\*(Aq} eq \*(Aqdefine\*(Aq; +.Ve +.SH "CONVERSIONS" +.IX Header "CONVERSIONS" +.ie n .SS """utf8::unicode_to_native()"" and ""utf8::native_to_unicode()""" +.el .SS "\f(CWutf8::unicode_to_native()\fP and \f(CWutf8::native_to_unicode()\fP" +.IX Subsection "utf8::unicode_to_native() and utf8::native_to_unicode()" +These functions take an input numeric code point in one encoding and +return what its equivalent value is in the other. +.PP +See utf8. +.SS "tr///" +.IX Subsection "tr///" +In order to convert a string of characters from one character set to +another a simple list of numbers, such as in the right columns in the +above table, along with Perl's \f(CW\*(C`tr///\*(C'\fR operator is all that is needed. +The data in the table are in ASCII/Latin1 order, hence the \s-1EBCDIC\s0 columns +provide easy-to-use ASCII/Latin1 to \s-1EBCDIC\s0 operations that are also easily +reversed. +.PP +For example, to convert ASCII/Latin1 to code page 037 take the output of the +second numbers column from the output of recipe 2 (modified to add +\&\f(CW"\e"\fR characters), and use it in \f(CW\*(C`tr///\*(C'\fR like so: +.PP +.Vb 10 +\& $cp_037 = +\& \*(Aq\ex00\ex01\ex02\ex03\ex37\ex2D\ex2E\ex2F\ex16\ex05\ex25\ex0B\ex0C\ex0D\ex0E\ex0F\*(Aq . +\& \*(Aq\ex10\ex11\ex12\ex13\ex3C\ex3D\ex32\ex26\ex18\ex19\ex3F\ex27\ex1C\ex1D\ex1E\ex1F\*(Aq . +\& \*(Aq\ex40\ex5A\ex7F\ex7B\ex5B\ex6C\ex50\ex7D\ex4D\ex5D\ex5C\ex4E\ex6B\ex60\ex4B\ex61\*(Aq . +\& \*(Aq\exF0\exF1\exF2\exF3\exF4\exF5\exF6\exF7\exF8\exF9\ex7A\ex5E\ex4C\ex7E\ex6E\ex6F\*(Aq . +\& \*(Aq\ex7C\exC1\exC2\exC3\exC4\exC5\exC6\exC7\exC8\exC9\exD1\exD2\exD3\exD4\exD5\exD6\*(Aq . +\& \*(Aq\exD7\exD8\exD9\exE2\exE3\exE4\exE5\exE6\exE7\exE8\exE9\exBA\exE0\exBB\exB0\ex6D\*(Aq . +\& \*(Aq\ex79\ex81\ex82\ex83\ex84\ex85\ex86\ex87\ex88\ex89\ex91\ex92\ex93\ex94\ex95\ex96\*(Aq . +\& \*(Aq\ex97\ex98\ex99\exA2\exA3\exA4\exA5\exA6\exA7\exA8\exA9\exC0\ex4F\exD0\exA1\ex07\*(Aq . +\& \*(Aq\ex20\ex21\ex22\ex23\ex24\ex15\ex06\ex17\ex28\ex29\ex2A\ex2B\ex2C\ex09\ex0A\ex1B\*(Aq . +\& \*(Aq\ex30\ex31\ex1A\ex33\ex34\ex35\ex36\ex08\ex38\ex39\ex3A\ex3B\ex04\ex14\ex3E\exFF\*(Aq . +\& \*(Aq\ex41\exAA\ex4A\exB1\ex9F\exB2\ex6A\exB5\exBD\exB4\ex9A\ex8A\ex5F\exCA\exAF\exBC\*(Aq . +\& \*(Aq\ex90\ex8F\exEA\exFA\exBE\exA0\exB6\exB3\ex9D\exDA\ex9B\ex8B\exB7\exB8\exB9\exAB\*(Aq . +\& \*(Aq\ex64\ex65\ex62\ex66\ex63\ex67\ex9E\ex68\ex74\ex71\ex72\ex73\ex78\ex75\ex76\ex77\*(Aq . +\& \*(Aq\exAC\ex69\exED\exEE\exEB\exEF\exEC\exBF\ex80\exFD\exFE\exFB\exFC\exAD\exAE\ex59\*(Aq . +\& \*(Aq\ex44\ex45\ex42\ex46\ex43\ex47\ex9C\ex48\ex54\ex51\ex52\ex53\ex58\ex55\ex56\ex57\*(Aq . +\& \*(Aq\ex8C\ex49\exCD\exCE\exCB\exCF\exCC\exE1\ex70\exDD\exDE\exDB\exDC\ex8D\ex8E\exDF\*(Aq; +\& +\& my $ebcdic_string = $ascii_string; +\& eval \*(Aq$ebcdic_string =~ tr/\e000\-\e377/\*(Aq . $cp_037 . \*(Aq/\*(Aq; +.Ve +.PP +To convert from \s-1EBCDIC 037\s0 to \s-1ASCII\s0 just reverse the order of the tr/// +arguments like so: +.PP +.Vb 2 +\& my $ascii_string = $ebcdic_string; +\& eval \*(Aq$ascii_string =~ tr/\*(Aq . $cp_037 . \*(Aq/\e000\-\e377/\*(Aq; +.Ve +.PP +Similarly one could take the output of the third numbers column from recipe 2 +to obtain a \f(CW$cp_1047\fR table. The fourth numbers column of the output from +recipe 2 could provide a \f(CW$cp_posix_bc\fR table suitable for transcoding as +well. +.PP +If you wanted to see the inverse tables, you would first have to sort on the +desired numbers column as in recipes 4, 5 or 6, then take the output of the +first numbers column. +.SS "iconv" +.IX Subsection "iconv" +\&\s-1XPG\s0 operability often implies the presence of an \fIiconv\fR utility +available from the shell or from the C library. Consult your system's +documentation for information on iconv. +.PP +On \s-1OS/390\s0 or z/OS see the \fBiconv\fR\|(1) manpage. One way to invoke the \f(CW\*(C`iconv\*(C'\fR +shell utility from within perl would be to: +.PP +.Vb 2 +\& # OS/390 or z/OS example +\& $ascii_data = \`echo \*(Aq$ebcdic_data\*(Aq| iconv \-f IBM\-1047 \-t ISO8859\-1\` +.Ve +.PP +or the inverse map: +.PP +.Vb 2 +\& # OS/390 or z/OS example +\& $ebcdic_data = \`echo \*(Aq$ascii_data\*(Aq| iconv \-f ISO8859\-1 \-t IBM\-1047\` +.Ve +.PP +For other Perl-based conversion options see the \f(CW\*(C`Convert::*\*(C'\fR modules on \s-1CPAN.\s0 +.SS "C \s-1RTL\s0" +.IX Subsection "C RTL" +The \s-1OS/390\s0 and z/OS C run-time libraries provide \f(CW\*(C`_atoe()\*(C'\fR and \f(CW\*(C`_etoa()\*(C'\fR functions. +.SH "OPERATOR DIFFERENCES" +.IX Header "OPERATOR DIFFERENCES" +The \f(CW\*(C`..\*(C'\fR range operator treats certain character ranges with +care on \s-1EBCDIC\s0 platforms. For example the following array +will have twenty six elements on either an \s-1EBCDIC\s0 platform +or an \s-1ASCII\s0 platform: +.PP +.Vb 1 +\& @alphabet = (\*(AqA\*(Aq..\*(AqZ\*(Aq); # $#alphabet == 25 +.Ve +.PP +The bitwise operators such as & ^ | may return different results +when operating on string or character data in a Perl program running +on an \s-1EBCDIC\s0 platform than when run on an \s-1ASCII\s0 platform. Here is +an example adapted from the one in perlop: +.PP +.Vb 5 +\& # EBCDIC\-based examples +\& print "j p \en" ^ " a h"; # prints "JAPH\en" +\& print "JA" | " ph\en"; # prints "japh\en" +\& print "JAPH\enJunk" & "\e277\e277\e277\e277\e277"; # prints "japh\en"; +\& print \*(Aqp N$\*(Aq ^ " E +\&\f(CW\*(C`(chr(1)\*(C'\fR eq \f(CW\*(C`\ecA\*(C'\fR)>, and so on. Perl on \s-1EBCDIC\s0 platforms has been +ported to take \f(CW\*(C`\ec@\*(C'\fR to \f(CWchr(0)\fR and \f(CW\*(C`\ecA\*(C'\fR to \f(CWchr(1)\fR, etc. as well, but the +characters that result depend on which code page you are +using. The table below uses the standard acronyms for the controls. +The POSIX-BC and 1047 sets are +identical throughout this range and differ from the 0037 set at only +one spot (21 decimal). Note that the line terminator character +may be generated by \f(CW\*(C`\ecJ\*(C'\fR on \s-1ASCII\s0 platforms but by \f(CW\*(C`\ecU\*(C'\fR on 1047 or POSIX-BC +platforms and cannot be generated as a \f(CW"\ec.letter."\fR control character on +0037 platforms. Note also that \f(CW\*(C`\ec\e\*(C'\fR cannot be the final element in a string +or regex, as it will absorb the terminator. But \f(CW\*(C`\ec\e\f(CIX\f(CW\*(C'\fR is a \f(CW\*(C`FILE +SEPARATOR\*(C'\fR concatenated with \fIX\fR for all \fIX\fR. +The outlier \f(CW\*(C`\ec?\*(C'\fR on \s-1ASCII,\s0 which yields a non\-C0 control \f(CW\*(C`DEL\*(C'\fR, +yields the outlier control \f(CW\*(C`APC\*(C'\fR on \s-1EBCDIC,\s0 the one that isn't in the +block of contiguous controls. Note that a subtlety of this is that +\&\f(CW\*(C`\ec?\*(C'\fR on \s-1ASCII\s0 platforms is an \s-1ASCII\s0 character, while it isn't +equivalent to any \s-1ASCII\s0 character in \s-1EBCDIC\s0 platforms. +.PP +.Vb 10 +\& chr ord 8859\-1 0037 1047 && POSIX\-BC +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& \ec@ 0 +\& \ecA 1 +\& \ecB 2 +\& \ecC 3 +\& \ecD 4 +\& \ecE 5 +\& \ecF 6 +\& \ecG 7 +\& \ecH 8 +\& \ecI 9 +\& \ecJ 10 +\& \ecK 11 +\& \ecL 12 +\& \ecM 13 +\& \ecN 14 +\& \ecO 15 +\& \ecP 16 +\& \ecQ 17 +\& \ecR 18 +\& \ecS 19 +\& \ecT 20 +\& \ecU 21 ** +\& \ecV 22 +\& \ecW 23 +\& \ecX 24 +\& \ecY 25 +\& \ecZ 26 +\& \ec[ 27 +\& \ec\eX 28 X X X +\& \ec] 29 +\& \ec^ 30 +\& \ec_ 31 +\& \ec? * +.Ve +.PP +\&\f(CW\*(C`*\*(C'\fR Note: \f(CW\*(C`\ec?\*(C'\fR maps to ordinal 127 (\f(CW\*(C`DEL\*(C'\fR) on \s-1ASCII\s0 platforms, but +since ordinal 127 is a not a control character on \s-1EBCDIC\s0 machines, +\&\f(CW\*(C`\ec?\*(C'\fR instead maps on them to \f(CW\*(C`APC\*(C'\fR, which is 255 in 0037 and 1047, +and 95 in POSIX-BC. +.SH "FUNCTION DIFFERENCES" +.IX Header "FUNCTION DIFFERENCES" +.ie n .IP """chr()""" 8 +.el .IP "\f(CWchr()\fR" 8 +.IX Item "chr()" +\&\f(CW\*(C`chr()\*(C'\fR must be given an \s-1EBCDIC\s0 code number argument to yield a desired +character return value on an \s-1EBCDIC\s0 platform. For example: +.Sp +.Vb 1 +\& $CAPITAL_LETTER_A = chr(193); +.Ve +.ie n .IP """ord()""" 8 +.el .IP "\f(CWord()\fR" 8 +.IX Item "ord()" +\&\f(CW\*(C`ord()\*(C'\fR will return \s-1EBCDIC\s0 code number values on an \s-1EBCDIC\s0 platform. +For example: +.Sp +.Vb 1 +\& $the_number_193 = ord("A"); +.Ve +.ie n .IP """pack()""" 8 +.el .IP "\f(CWpack()\fR" 8 +.IX Item "pack()" +The \f(CW"c"\fR and \f(CW"C"\fR templates for \f(CW\*(C`pack()\*(C'\fR are dependent upon character set +encoding. Examples of usage on \s-1EBCDIC\s0 include: +.Sp +.Vb 4 +\& $foo = pack("CCCC",193,194,195,196); +\& # $foo eq "ABCD" +\& $foo = pack("C4",193,194,195,196); +\& # same thing +\& +\& $foo = pack("ccxxcc",193,194,195,196); +\& # $foo eq "AB\e0\e0CD" +.Ve +.Sp +The \f(CW"U"\fR template has been ported to mean \*(L"Unicode\*(R" on all platforms so +that +.Sp +.Vb 1 +\& pack("U", 65) eq \*(AqA\*(Aq +.Ve +.Sp +is true on all platforms. If you want native code points for the low +256, use the \f(CW"W"\fR template. This means that the equivalences +.Sp +.Vb 2 +\& pack("W", ord($character)) eq $character +\& unpack("W", $character) == ord $character +.Ve +.Sp +will hold. +.ie n .IP """print()""" 8 +.el .IP "\f(CWprint()\fR" 8 +.IX Item "print()" +One must be careful with scalars and strings that are passed to +print that contain \s-1ASCII\s0 encodings. One common place +for this to occur is in the output of the \s-1MIME\s0 type header for +\&\s-1CGI\s0 script writing. For example, many Perl programming guides +recommend something similar to: +.Sp +.Vb 2 +\& print "Content\-type:\ettext/html\e015\e012\e015\e012"; +\& # this may be wrong on EBCDIC +.Ve +.Sp +You can instead write +.Sp +.Vb 1 +\& print "Content\-type:\ettext/html\er\en\er\en"; # OK for DGW et al +.Ve +.Sp +and have it work portably. +.Sp +That is because the translation from \s-1EBCDIC\s0 to \s-1ASCII\s0 is done +by the web server in this case. Consult your web server's documentation for +further details. +.ie n .IP """printf()""" 8 +.el .IP "\f(CWprintf()\fR" 8 +.IX Item "printf()" +The formats that can convert characters to numbers and vice versa +will be different from their \s-1ASCII\s0 counterparts when executed +on an \s-1EBCDIC\s0 platform. Examples include: +.Sp +.Vb 1 +\& printf("%c%c%c",193,194,195); # prints ABC +.Ve +.ie n .IP """sort()""" 8 +.el .IP "\f(CWsort()\fR" 8 +.IX Item "sort()" +\&\s-1EBCDIC\s0 sort results may differ from \s-1ASCII\s0 sort results especially for +mixed case strings. This is discussed in more detail below. +.ie n .IP """sprintf()""" 8 +.el .IP "\f(CWsprintf()\fR" 8 +.IX Item "sprintf()" +See the discussion of \f(CW"printf()"\fR above. An example of the use +of sprintf would be: +.Sp +.Vb 1 +\& $CAPITAL_LETTER_A = sprintf("%c",193); +.Ve +.ie n .IP """unpack()""" 8 +.el .IP "\f(CWunpack()\fR" 8 +.IX Item "unpack()" +See the discussion of \f(CW"pack()"\fR above. +.PP +Note that it is possible to write portable code for these by specifying +things in Unicode numbers, and using a conversion function: +.PP +.Vb 3 +\& printf("%c",utf8::unicode_to_native(65)); # prints A on all +\& # platforms +\& print utf8::native_to_unicode(ord("A")); # Likewise, prints 65 +.Ve +.PP +See \*(L"Unicode and \s-1EBCDIC\*(R"\s0 in perluniintro and \*(L"\s-1CONVERSIONS\*(R"\s0 +for other options. +.SH "REGULAR EXPRESSION DIFFERENCES" +.IX Header "REGULAR EXPRESSION DIFFERENCES" +You can write your regular expressions just like someone on an \s-1ASCII\s0 +platform would do. But keep in mind that using octal or hex notation to +specify a particular code point will give you the character that the +\&\s-1EBCDIC\s0 code page natively maps to it. (This is also true of all +double-quoted strings.) If you want to write portably, just use the +\&\f(CW\*(C`\eN{U+...}\*(C'\fR notation everywhere where you would have used \f(CW\*(C`\ex{...}\*(C'\fR, +and don't use octal notation at all. +.PP +Starting in Perl v5.22, this applies to ranges in bracketed character +classes. If you say, for example, \f(CW\*(C`qr/[\eN{U+20}\-\eN{U+7F}]/\*(C'\fR, it means +the characters \f(CW\*(C`\eN{U+20}\*(C'\fR, \f(CW\*(C`\eN{U+21}\*(C'\fR, ..., \f(CW\*(C`\eN{U+7F}\*(C'\fR. This range +is all the printable characters that the \s-1ASCII\s0 character set contains. +.PP +Prior to v5.22, you couldn't specify any ranges portably, except +(starting in Perl v5.5.3) all subsets of the \f(CW\*(C`[A\-Z]\*(C'\fR and \f(CW\*(C`[a\-z]\*(C'\fR +ranges are specially coded to not pick up gap characters. For example, +characters such as \*(L"o\*^\*(R" (\f(CW\*(C`o WITH CIRCUMFLEX\*(C'\fR) that lie between +\&\*(L"I\*(R" and \*(L"J\*(R" would not be matched by the regular expression range +\&\f(CW\*(C`/[H\-K]/\*(C'\fR. But if either of the range end points is explicitly numeric +(and neither is specified by \f(CW\*(C`\eN{U+...}\*(C'\fR), the gap characters are +matched: +.PP +.Vb 1 +\& /[\ex89\-\ex91]/ +.Ve +.PP +will match \f(CW\*(C`\ex8e\*(C'\fR, even though \f(CW\*(C`\ex89\*(C'\fR is \*(L"i\*(R" and \f(CW\*(C`\ex91 \*(C'\fR is \*(L"j\*(R", +and \f(CW\*(C`\ex8e\*(C'\fR is a gap character, from the alphabetic viewpoint. +.PP +Another construct to be wary of is the inappropriate use of hex (unless +you use \f(CW\*(C`\eN{U+...}\*(C'\fR) or +octal constants in regular expressions. Consider the following +set of subs: +.PP +.Vb 4 +\& sub is_c0 { +\& my $char = substr(shift,0,1); +\& $char =~ /[\e000\-\e037]/; +\& } +\& +\& sub is_print_ascii { +\& my $char = substr(shift,0,1); +\& $char =~ /[\e040\-\e176]/; +\& } +\& +\& sub is_delete { +\& my $char = substr(shift,0,1); +\& $char eq "\e177"; +\& } +\& +\& sub is_c1 { +\& my $char = substr(shift,0,1); +\& $char =~ /[\e200\-\e237]/; +\& } +\& +\& sub is_latin_1 { # But not ASCII; not C1 +\& my $char = substr(shift,0,1); +\& $char =~ /[\e240\-\e377]/; +\& } +.Ve +.PP +These are valid only on \s-1ASCII\s0 platforms. Starting in Perl v5.22, simply +changing the octal constants to equivalent \f(CW\*(C`\eN{U+...}\*(C'\fR values makes +them portable: +.PP +.Vb 4 +\& sub is_c0 { +\& my $char = substr(shift,0,1); +\& $char =~ /[\eN{U+00}\-\eN{U+1F}]/; +\& } +\& +\& sub is_print_ascii { +\& my $char = substr(shift,0,1); +\& $char =~ /[\eN{U+20}\-\eN{U+7E}]/; +\& } +\& +\& sub is_delete { +\& my $char = substr(shift,0,1); +\& $char eq "\eN{U+7F}"; +\& } +\& +\& sub is_c1 { +\& my $char = substr(shift,0,1); +\& $char =~ /[\eN{U+80}\-\eN{U+9F}]/; +\& } +\& +\& sub is_latin_1 { # But not ASCII; not C1 +\& my $char = substr(shift,0,1); +\& $char =~ /[\eN{U+A0}\-\eN{U+FF}]/; +\& } +.Ve +.PP +And here are some alternative portable ways to write them: +.PP +.Vb 3 +\& sub Is_c0 { +\& my $char = substr(shift,0,1); +\& return $char =~ /[[:cntrl:]]/a && ! Is_delete($char); +\& +\& # Alternatively: +\& # return $char =~ /[[:cntrl:]]/ +\& # && $char =~ /[[:ascii:]]/ +\& # && ! Is_delete($char); +\& } +\& +\& sub Is_print_ascii { +\& my $char = substr(shift,0,1); +\& +\& return $char =~ /[[:print:]]/a; +\& +\& # Alternatively: +\& # return $char =~ /[[:print:]]/ && $char =~ /[[:ascii:]]/; +\& +\& # Or +\& # return $char +\& # =~ /[ !"\e#\e$%&\*(Aq()*+,\e\-.\e/0\-9:;<=>?\e@A\-Z[\e\e\e]^_\`a\-z{|}~]/; +\& } +\& +\& sub Is_delete { +\& my $char = substr(shift,0,1); +\& return utf8::native_to_unicode(ord $char) == 0x7F; +\& } +\& +\& sub Is_c1 { +\& use feature \*(Aqunicode_strings\*(Aq; +\& my $char = substr(shift,0,1); +\& return $char =~ /[[:cntrl:]]/ && $char !~ /[[:ascii:]]/; +\& } +\& +\& sub Is_latin_1 { # But not ASCII; not C1 +\& use feature \*(Aqunicode_strings\*(Aq; +\& my $char = substr(shift,0,1); +\& return ord($char) < 256 +\& && $char !~ /[[:ascii:]]/ +\& && $char !~ /[[:cntrl:]]/; +\& } +.Ve +.PP +Another way to write \f(CW\*(C`Is_latin_1()\*(C'\fR would be +to use the characters in the range explicitly: +.PP +.Vb 5 +\& sub Is_latin_1 { +\& my $char = substr(shift,0,1); +\& $char =~ /[\ XXXXXXXXXXXX\%XXXXXXXXXXXXXXXXXXA\*`A\*'A\*^A\*~A\*:A\*o\*(AeC\*,E\*`E\*'E\*^E\*:I\*`I\*'I\*^I\*:] +\& [\*(D-N\*~O\*`O\*'O\*^O\*~O\*:XO\*/U\*`U\*'U\*^U\*:Y\*'\*(Th\*8a\*`a\*'a\*^a\*~a\*:a\*o\*(aec\*,e\*`e\*'e\*^e\*:i\*`i\*'i\*^i\*:\*(d-n\*~o\*`o\*'o\*^o\*~o\*:Xo\*/u\*`u\*'u\*^u\*:y\*'\*(thy\*:]/x; +\& } +.Ve +.PP +Although that form may run into trouble in network transit (due to the +presence of 8 bit characters) or on non ISO-Latin character sets. But +it does allow \f(CW\*(C`Is_c1\*(C'\fR to be rewritten so it works on Perls that don't +have \f(CW\*(Aqunicode_strings\*(Aq\fR (earlier than v5.14): +.PP +.Vb 6 +\& sub Is_latin_1 { # But not ASCII; not C1 +\& my $char = substr(shift,0,1); +\& return ord($char) < 256 +\& && $char !~ /[[:ascii:]]/ +\& && ! Is_latin1($char); +\& } +.Ve +.SH "SOCKETS" +.IX Header "SOCKETS" +Most socket programming assumes \s-1ASCII\s0 character encodings in network +byte order. Exceptions can include \s-1CGI\s0 script writing under a +host web server where the server may take care of translation for you. +Most host web servers convert \s-1EBCDIC\s0 data to \s-1ISO\-8859\-1\s0 or Unicode on +output. +.SH "SORTING" +.IX Header "SORTING" +One big difference between ASCII-based character sets and \s-1EBCDIC\s0 ones +are the relative positions of the characters when sorted in native +order. Of most concern are the upper\- and lowercase letters, the +digits, and the underscore (\f(CW"_"\fR). On \s-1ASCII\s0 platforms the native sort +order has the digits come before the uppercase letters which come before +the underscore which comes before the lowercase letters. On \s-1EBCDIC,\s0 the +underscore comes first, then the lowercase letters, then the uppercase +ones, and the digits last. If sorted on an ASCII-based platform, the +two-letter abbreviation for a physician comes before the two letter +abbreviation for drive; that is: +.PP +.Vb 2 +\& @sorted = sort(qw(Dr. dr.)); # @sorted holds (\*(AqDr.\*(Aq,\*(Aqdr.\*(Aq) on ASCII, +\& # but (\*(Aqdr.\*(Aq,\*(AqDr.\*(Aq) on EBCDIC +.Ve +.PP +The property of lowercase before uppercase letters in \s-1EBCDIC\s0 is +even carried to the Latin 1 \s-1EBCDIC\s0 pages such as 0037 and 1047. +An example would be that \*(L"E\*:\*(R" (\f(CW\*(C`E WITH DIAERESIS\*(C'\fR, 203) comes +before \*(L"e\*:\*(R" (\f(CW\*(C`e WITH DIAERESIS\*(C'\fR, 235) on an \s-1ASCII\s0 platform, but +the latter (83) comes before the former (115) on an \s-1EBCDIC\s0 platform. +(Astute readers will note that the uppercase version of \*(L"\*8\*(R" +\&\f(CW\*(C`SMALL LETTER SHARP S\*(C'\fR is simply \*(L"\s-1SS\*(R"\s0 and that the upper case versions +of \*(L"y\*:\*(R" (small \f(CW\*(C`y WITH DIAERESIS\*(C'\fR) and \*(L"X\*(R" (\f(CW\*(C`MICRO SIGN\*(C'\fR) +are not in the 0..255 range but are in Unicode, in a Unicode enabled +Perl). +.PP +The sort order will cause differences between results obtained on +\&\s-1ASCII\s0 platforms versus \s-1EBCDIC\s0 platforms. What follows are some suggestions +on how to deal with these differences. +.SS "Ignore \s-1ASCII\s0 vs. \s-1EBCDIC\s0 sort differences." +.IX Subsection "Ignore ASCII vs. EBCDIC sort differences." +This is the least computationally expensive strategy. It may require +some user education. +.SS "Use a sort helper function" +.IX Subsection "Use a sort helper function" +This is completely general, but the most computationally expensive +strategy. Choose one or the other character set and transform to that +for every sort comparison. Here's a complete example that transforms +to \s-1ASCII\s0 sort order: +.PP +.Vb 2 +\& sub native_to_uni($) { +\& my $string = shift; +\& +\& # Saves time on an ASCII platform +\& return $string if ord \*(AqA\*(Aq == 65; +\& +\& my $output = ""; +\& for my $i (0 .. length($string) \- 1) { +\& $output +\& .= chr(utf8::native_to_unicode(ord(substr($string, $i, 1)))); +\& } +\& +\& # Preserve utf8ness of input onto the output, even if it didn\*(Aqt need +\& # to be utf8 +\& utf8::upgrade($output) if utf8::is_utf8($string); +\& +\& return $output; +\& } +\& +\& sub ascii_order { # Sort helper +\& return native_to_uni($a) cmp native_to_uni($b); +\& } +\& +\& sort ascii_order @list; +.Ve +.SS "\s-1MONO CASE\s0 then sort data (for non-digits, non-underscore)" +.IX Subsection "MONO CASE then sort data (for non-digits, non-underscore)" +If you don't care about where digits and underscore sort to, you can do +something like this +.PP +.Vb 3 +\& sub case_insensitive_order { # Sort helper +\& return lc($a) cmp lc($b) +\& } +\& +\& sort case_insensitive_order @list; +.Ve +.PP +If performance is an issue, and you don't care if the output is in the +same case as the input, Use \f(CW\*(C`tr///\*(C'\fR to transform to the case most +employed within the data. If the data are primarily \s-1UPPERCASE\s0 +non\-Latin1, then apply \f(CW\*(C`tr/[a\-z]/[A\-Z]/\*(C'\fR, and then \f(CW\*(C`sort()\*(C'\fR. If the +data are primarily lowercase non Latin1 then apply \f(CW\*(C`tr/[A\-Z]/[a\-z]/\*(C'\fR +before sorting. If the data are primarily \s-1UPPERCASE\s0 and include Latin\-1 +characters then apply: +.PP +.Vb 3 +\& tr/[a\-z]/[A\-Z]/; +\& tr/[a\*`a\*'a\*^a\*~a\*:a\*o\*(aec\*,e\*`e\*'e\*^e\*:i\*`i\*'i\*^i\*:\*(d-n\*~o\*`o\*'o\*^o\*~o\*:o\*/u\*`u\*'u\*^u\*:y\*'\*(th]/[A\*`A\*'A\*^A\*~A\*:A\*o\*(AeC\*,E\*`E\*'E\*^E\*:I\*`I\*'I\*^I\*:\*(D-N\*~O\*`O\*'O\*^O\*~O\*:O\*/U\*`U\*'U\*^U\*:Y\*'\*(Th/; +\& s/\*8/SS/g; +.Ve +.PP +then \f(CW\*(C`sort()\*(C'\fR. If you have a choice, it's better to lowercase things +to avoid the problems of the two Latin\-1 characters whose uppercase is +outside Latin\-1: \*(L"y\*:\*(R" (small \f(CW\*(C`y WITH DIAERESIS\*(C'\fR) and \*(L"X\*(R" +(\f(CW\*(C`MICRO SIGN\*(C'\fR). If you do need to upppercase, you can; with a +Unicode-enabled Perl, do: +.PP +.Vb 2 +\& tr/y\*:/\ex{178}/; +\& tr/X/\ex{39C}/; +.Ve +.SS "Perform sorting on one type of platform only." +.IX Subsection "Perform sorting on one type of platform only." +This strategy can employ a network connection. As such +it would be computationally expensive. +.SH "TRANSFORMATION FORMATS" +.IX Header "TRANSFORMATION FORMATS" +There are a variety of ways of transforming data with an intra character set +mapping that serve a variety of purposes. Sorting was discussed in the +previous section and a few of the other more popular mapping techniques are +discussed next. +.SS "\s-1URL\s0 decoding and encoding" +.IX Subsection "URL decoding and encoding" +Note that some URLs have hexadecimal \s-1ASCII\s0 code points in them in an +attempt to overcome character or protocol limitation issues. For example +the tilde character is not on every keyboard hence a \s-1URL\s0 of the form: +.PP +.Vb 1 +\& http://www.pvhp.com/~pvhp/ +.Ve +.PP +may also be expressed as either of: +.PP +.Vb 1 +\& http://www.pvhp.com/%7Epvhp/ +\& +\& http://www.pvhp.com/%7epvhp/ +.Ve +.PP +where 7E is the hexadecimal \s-1ASCII\s0 code point for \*(L"~\*(R". Here is an example +of decoding such a \s-1URL\s0 in any \s-1EBCDIC\s0 code page: +.PP +.Vb 3 +\& $url = \*(Aqhttp://www.pvhp.com/%7Epvhp/\*(Aq; +\& $url =~ s/%([0\-9a\-fA\-F]{2})/ +\& pack("c",utf8::unicode_to_native(hex($1)))/xge; +.Ve +.PP +Conversely, here is a partial solution for the task of encoding such +a \s-1URL\s0 in any \s-1EBCDIC\s0 code page: +.PP +.Vb 5 +\& $url = \*(Aqhttp://www.pvhp.com/~pvhp/\*(Aq; +\& # The following regular expression does not address the +\& # mappings for: (\*(Aq.\*(Aq => \*(Aq%2E\*(Aq, \*(Aq/\*(Aq => \*(Aq%2F\*(Aq, \*(Aq:\*(Aq => \*(Aq%3A\*(Aq) +\& $url =~ s/([\et "#%&\e(\e),;<=>\e?\e@\e[\e\e\e]^\`{|}~])/ +\& sprintf("%%%02X",utf8::native_to_unicode(ord($1)))/xge; +.Ve +.PP +where a more complete solution would split the \s-1URL\s0 into components +and apply a full s/// substitution only to the appropriate parts. +.SS "uu encoding and decoding" +.IX Subsection "uu encoding and decoding" +The \f(CW\*(C`u\*(C'\fR template to \f(CW\*(C`pack()\*(C'\fR or \f(CW\*(C`unpack()\*(C'\fR will render \s-1EBCDIC\s0 data in +\&\s-1EBCDIC\s0 characters equivalent to their \s-1ASCII\s0 counterparts. For example, +the following will print \*(L"Yes indeed\en\*(R" on either an \s-1ASCII\s0 or \s-1EBCDIC\s0 +computer: +.PP +.Vb 10 +\& $all_byte_chrs = \*(Aq\*(Aq; +\& for (0..255) { $all_byte_chrs .= chr($_); } +\& $uuencode_byte_chrs = pack(\*(Aqu\*(Aq, $all_byte_chrs); +\& ($uu = <<\*(AqENDOFHEREDOC\*(Aq) =~ s/^\es*//gm; +\& M\`\`$"\`P0%!@<("0H+#\`T.#Q\`1$A,4%187&!D:&QP=\*(AqA\e@(2(C)"4F)R@I*BLL +\& M+2XO,#$R,S0U\-C\*(AqEZ>WQ]?G^\`@8*#A(6& +\& MAXB)BHN,C8Z/D)&2DY25EI>8F9J;G)V>GZ"AHJ.DI::GJ*FJJZRMKJ^PL;*S +\& MM+6VM[BYNKN\eO;Z_P,\*(Aq"P\e3%QL?(R+CY.7FY^CIZNOL[>[O\e/\*(AqR\e_3U]O?X^?K[_/W^_P\`\` +\& ENDOFHEREDOC +\& if ($uuencode_byte_chrs eq $uu) { +\& print "Yes "; +\& } +\& $uudecode_byte_chrs = unpack(\*(Aqu\*(Aq, $uuencode_byte_chrs); +\& if ($uudecode_byte_chrs eq $all_byte_chrs) { +\& print "indeed\en"; +\& } +.Ve +.PP +Here is a very spartan uudecoder that will work on \s-1EBCDIC:\s0 +.PP +.Vb 10 +\& #!/usr/local/bin/perl +\& $_ = <> until ($mode,$file) = /^begin\es*(\ed*)\es*(\eS*)/; +\& open(OUT, "> $file") if $file ne ""; +\& while(<>) { +\& last if /^end/; +\& next if /[a\-z]/; +\& next unless int((((utf8::native_to_unicode(ord()) \- 32 ) & 077) +\& + 2) / 3) +\& == int(length() / 4); +\& print OUT unpack("u", $_); +\& } +\& close(OUT); +\& chmod oct($mode), $file; +.Ve +.SS "Quoted-Printable encoding and decoding" +.IX Subsection "Quoted-Printable encoding and decoding" +On ASCII-encoded platforms it is possible to strip characters outside of +the printable set using: +.PP +.Vb 3 +\& # This QP encoder works on ASCII only +\& $qp_string =~ s/([=\ex00\-\ex1F\ex80\-\exFF])/ +\& sprintf("=%02X",ord($1))/xge; +.Ve +.PP +Starting in Perl v5.22, this is trivially changeable to work portably on +both \s-1ASCII\s0 and \s-1EBCDIC\s0 platforms. +.PP +.Vb 3 +\& # This QP encoder works on both ASCII and EBCDIC +\& $qp_string =~ s/([=\eN{U+00}\-\eN{U+1F}\eN{U+80}\-\eN{U+FF}])/ +\& sprintf("=%02X",ord($1))/xge; +.Ve +.PP +For earlier Perls, a \s-1QP\s0 encoder that works on both \s-1ASCII\s0 and \s-1EBCDIC\s0 +platforms would look somewhat like the following: +.PP +.Vb 4 +\& $delete = utf8::unicode_to_native(ord("\ex7F")); +\& $qp_string =~ +\& s/([^[:print:]$delete])/ +\& sprintf("=%02X",utf8::native_to_unicode(ord($1)))/xage; +.Ve +.PP +(although in production code the substitutions might be done +in the \s-1EBCDIC\s0 branch with the function call and separately in the +\&\s-1ASCII\s0 branch without the expense of the identity map; in Perl v5.22, the +identity map is optimized out so there is no expense, but the +alternative above is simpler and is also available in v5.22). +.PP +Such \s-1QP\s0 strings can be decoded with: +.PP +.Vb 3 +\& # This QP decoder is limited to ASCII only +\& $string =~ s/=([[:xdigit:][[:xdigit:])/chr hex $1/ge; +\& $string =~ s/=[\en\er]+$//; +.Ve +.PP +Whereas a \s-1QP\s0 decoder that works on both \s-1ASCII\s0 and \s-1EBCDIC\s0 platforms +would look somewhat like the following: +.PP +.Vb 3 +\& $string =~ s/=([[:xdigit:][:xdigit:]])/ +\& chr utf8::native_to_unicode(hex $1)/xge; +\& $string =~ s/=[\en\er]+$//; +.Ve +.SS "Caesarean ciphers" +.IX Subsection "Caesarean ciphers" +The practice of shifting an alphabet one or more characters for encipherment +dates back thousands of years and was explicitly detailed by Gaius Julius +Caesar in his \fBGallic Wars\fR text. A single alphabet shift is sometimes +referred to as a rotation and the shift amount is given as a number \f(CW$n\fR after +the string 'rot' or \*(L"rot$n\*(R". Rot0 and rot26 would designate identity maps +on the 26\-letter English version of the Latin alphabet. Rot13 has the +interesting property that alternate subsequent invocations are identity maps +(thus rot13 is its own non-trivial inverse in the group of 26 alphabet +rotations). Hence the following is a rot13 encoder and decoder that will +work on \s-1ASCII\s0 and \s-1EBCDIC\s0 platforms: +.PP +.Vb 1 +\& #!/usr/local/bin/perl +\& +\& while(<>){ +\& tr/n\-za\-mN\-ZA\-M/a\-zA\-Z/; +\& print; +\& } +.Ve +.PP +In one-liner form: +.PP +.Vb 1 +\& perl \-ne \*(Aqtr/n\-za\-mN\-ZA\-M/a\-zA\-Z/;print\*(Aq +.Ve +.SH "Hashing order and checksums" +.IX Header "Hashing order and checksums" +Perl deliberately randomizes hash order for security purposes on both +\&\s-1ASCII\s0 and \s-1EBCDIC\s0 platforms. +.PP +\&\s-1EBCDIC\s0 checksums will differ for the same file translated into \s-1ASCII\s0 +and vice versa. +.SH "I18N AND L10N" +.IX Header "I18N AND L10N" +Internationalization (I18N) and localization (L10N) are supported at least +in principle even on \s-1EBCDIC\s0 platforms. The details are system-dependent +and discussed under the \*(L"\s-1OS ISSUES\*(R"\s0 section below. +.SH "MULTI-OCTET CHARACTER SETS" +.IX Header "MULTI-OCTET CHARACTER SETS" +Perl works with UTF-EBCDIC, a multi-byte encoding. In Perls earlier +than v5.22, there may be various bugs in this regard. +.PP +Legacy multi byte \s-1EBCDIC\s0 code pages \s-1XXX.\s0 +.SH "OS ISSUES" +.IX Header "OS ISSUES" +There may be a few system-dependent issues +of concern to \s-1EBCDIC\s0 Perl programmers. +.SS "\s-1OS/400\s0" +.IX Subsection "OS/400" +.IP "\s-1PASE\s0" 8 +.IX Item "PASE" +The \s-1PASE\s0 environment is a runtime environment for \s-1OS/400\s0 that can run +executables built for PowerPC \s-1AIX\s0 in \s-1OS/400\s0; see perlos400. \s-1PASE\s0 +is ASCII-based, not EBCDIC-based as the \s-1ILE.\s0 +.IP "\s-1IFS\s0 access" 8 +.IX Item "IFS access" +\&\s-1XXX.\s0 +.SS "\s-1OS/390,\s0 z/OS" +.IX Subsection "OS/390, z/OS" +Perl runs under Unix Systems Services or \s-1USS.\s0 +.ie n .IP """sigaction""" 8 +.el .IP "\f(CWsigaction\fR" 8 +.IX Item "sigaction" +\&\f(CW\*(C`SA_SIGINFO\*(C'\fR can have segmentation faults. +.ie n .IP """chcp""" 8 +.el .IP "\f(CWchcp\fR" 8 +.IX Item "chcp" +\&\fBchcp\fR is supported as a shell utility for displaying and changing +one's code page. See also \fBchcp\fR\|(1). +.IP "dataset access" 8 +.IX Item "dataset access" +For sequential data set access try: +.Sp +.Vb 1 +\& my @ds_records = \`cat //DSNAME\`; +.Ve +.Sp +or: +.Sp +.Vb 1 +\& my @ds_records = \`cat //\*(AqHLQ.DSNAME\*(Aq\`; +.Ve +.Sp +See also the OS390::Stdio module on \s-1CPAN.\s0 +.ie n .IP """iconv""" 8 +.el .IP "\f(CWiconv\fR" 8 +.IX Item "iconv" +\&\fBiconv\fR is supported as both a shell utility and a C \s-1RTL\s0 routine. +See also the \fBiconv\fR\|(1) and \fBiconv\fR\|(3) manual pages. +.IP "locales" 8 +.IX Item "locales" +Locales are supported. There may be glitches when a locale is another +\&\s-1EBCDIC\s0 code page which has some of the +code-page variant characters in other +positions. +.Sp +There aren't currently any real \s-1UTF\-8\s0 locales, even though some locale +names contain the string \*(L"\s-1UTF\-8\*(R".\s0 +.Sp +See perllocale for information on locales. The L10N files +are in \fI/usr/nls/locale\fR. \f(CW$Config{d_setlocale}\fR is \f(CW\*(Aqdefine\*(Aq\fR on +\&\s-1OS/390\s0 or z/OS. +.SS "POSIX-BC?" +.IX Subsection "POSIX-BC?" +\&\s-1XXX.\s0 +.SH "BUGS" +.IX Header "BUGS" +.IP "\(bu" 4 +Not all shells will allow multiple \f(CW\*(C`\-e\*(C'\fR string arguments to perl to +be concatenated together properly as recipes in this document +0, 2, 4, 5, and 6 might +seem to imply. +.IP "\(bu" 4 +There are a significant number of test failures in the \s-1CPAN\s0 modules +shipped with Perl v5.22 and 5.24. These are only in modules not primarily +maintained by Perl 5 porters. Some of these are failures in the tests +only: they don't realize that it is proper to get different results on +\&\s-1EBCDIC\s0 platforms. And some of the failures are real bugs. If you +compile and do a \f(CW\*(C`make test\*(C'\fR on Perl, all tests on the \f(CW\*(C`/cpan\*(C'\fR +directory are skipped. +.Sp +Encode partially works. +.IP "\(bu" 4 +In earlier Perl versions, when byte and character data were +concatenated, the new string was sometimes created by +decoding the byte strings as \fI\s-1ISO 8859\-1\s0 (Latin\-1)\fR, even if the +old Unicode string used \s-1EBCDIC.\s0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perllocale, perlfunc, perlunicode, utf8. +.SH "REFERENCES" +.IX Header "REFERENCES" + +.PP + +.PP + +.PP + +\&\fB\s-1ASCII:\s0 American Standard Code for Information Infiltration\fR Tom Jennings, +September 1999. +.PP +\&\fBThe Unicode Standard, Version 3.0\fR The Unicode Consortium, Lisa Moore ed., +\&\s-1ISBN 0\-201\-61633\-5,\s0 Addison Wesley Developers Press, February 2000. +.PP +\&\fB\s-1CDRA: IBM\s0 \- Character Data Representation Architecture \- +Reference and Registry\fR, \s-1IBM SC09\-2190\-00,\s0 December 1996. +.PP +\&\*(L"Demystifying Character Sets\*(R", Andrea Vine, Multilingual Computing +& Technology, \fB#26 Vol. 10 Issue 4\fR, August/September 1999; +\&\s-1ISSN 1523\-0309\s0; Multilingual Computing Inc. Sandpoint \s-1ID, USA.\s0 +.PP +\&\fBCodes, Ciphers, and Other Cryptic and Clandestine Communication\fR +Fred B. Wrixon, \s-1ISBN 1\-57912\-040\-7,\s0 Black Dog & Leventhal Publishers, +1998. +.PP + +\&\fB\s-1IBM\s0 \- \s-1EBCDIC\s0 and the P\-bit; The biggest Computer Goof Ever\fR Robert Bemer. +.SH "HISTORY" +.IX Header "HISTORY" +15 April 2001: added \s-1UTF\-8\s0 and UTF-EBCDIC to main table, pvhp. +.SH "AUTHOR" +.IX Header "AUTHOR" +Peter Prymmer pvhp@best.com wrote this in 1999 and 2000 +with \s-1CCSID 0819\s0 and 0037 help from Chris Leach and +Andre\*' Pirard A.Pirard@ulg.ac.be as well as POSIX-BC +help from Thomas Dorner Thomas.Dorner@start.de. +Thanks also to Vickie Cooper, Philip Newton, William Raffloer, and +Joe Smith. Trademarks, registered trademarks, service marks and +registered service marks used in this document are the property of +their respective owners. +.PP +Now maintained by Perl5 Porters. diff --git a/data/miniconda3/man/man1/perlembed.1 b/data/miniconda3/man/man1/perlembed.1 new file mode 100644 index 0000000000000000000000000000000000000000..c6ffb92b128cbf5a8ab26b783171e82a370ab563 --- /dev/null +++ b/data/miniconda3/man/man1/perlembed.1 @@ -0,0 +1,1324 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLEMBED 1" +.TH PERLEMBED 1 "2020-12-18" "perl v5.32.1" "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" +perlembed \- how to embed perl in your C program +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +.SS "\s-1PREAMBLE\s0" +.IX Subsection "PREAMBLE" +Do you want to: +.IP "\fBUse C from Perl?\fR" 5 +.IX Item "Use C from Perl?" +Read perlxstut, perlxs, h2xs, perlguts, and perlapi. +.IP "\fBUse a Unix program from Perl?\fR" 5 +.IX Item "Use a Unix program from Perl?" +Read about back-quotes and about \f(CW\*(C`system\*(C'\fR and \f(CW\*(C`exec\*(C'\fR in perlfunc. +.IP "\fBUse Perl from Perl?\fR" 5 +.IX Item "Use Perl from Perl?" +Read about \*(L"do\*(R" in perlfunc and \*(L"eval\*(R" in perlfunc and \*(L"require\*(R" in perlfunc +and \*(L"use\*(R" in perlfunc. +.IP "\fBUse C from C?\fR" 5 +.IX Item "Use C from C?" +Rethink your design. +.IP "\fBUse Perl from C?\fR" 5 +.IX Item "Use Perl from C?" +Read on... +.SS "\s-1ROADMAP\s0" +.IX Subsection "ROADMAP" +.IP "\(bu" 5 +Compiling your C program +.IP "\(bu" 5 +Adding a Perl interpreter to your C program +.IP "\(bu" 5 +Calling a Perl subroutine from your C program +.IP "\(bu" 5 +Evaluating a Perl statement from your C program +.IP "\(bu" 5 +Performing Perl pattern matches and substitutions from your C program +.IP "\(bu" 5 +Fiddling with the Perl stack from your C program +.IP "\(bu" 5 +Maintaining a persistent interpreter +.IP "\(bu" 5 +Maintaining multiple interpreter instances +.IP "\(bu" 5 +Using Perl modules, which themselves use C libraries, from your C program +.IP "\(bu" 5 +Embedding Perl under Win32 +.SS "Compiling your C program" +.IX Subsection "Compiling your C program" +If you have trouble compiling the scripts in this documentation, +you're not alone. The cardinal rule: \s-1COMPILE THE PROGRAMS IN EXACTLY +THE SAME WAY THAT YOUR PERL WAS COMPILED.\s0 (Sorry for yelling.) +.PP +Also, every C program that uses Perl must link in the \fIperl library\fR. +What's that, you ask? Perl is itself written in C; the perl library +is the collection of compiled C programs that were used to create your +perl executable (\fI/usr/bin/perl\fR or equivalent). (Corollary: you +can't use Perl from your C program unless Perl has been compiled on +your machine, or installed properly\*(--that's why you shouldn't blithely +copy Perl executables from machine to machine without also copying the +\&\fIlib\fR directory.) +.PP +When you use Perl from C, your C program will\*(--usually\-\-allocate, +\&\*(L"run\*(R", and deallocate a \fIPerlInterpreter\fR object, which is defined by +the perl library. +.PP +If your copy of Perl is recent enough to contain this documentation +(version 5.002 or later), then the perl library (and \fI\s-1EXTERN\s0.h\fR and +\&\fIperl.h\fR, which you'll also need) will reside in a directory +that looks like this: +.PP +.Vb 1 +\& /usr/local/lib/perl5/your_architecture_here/CORE +.Ve +.PP +or perhaps just +.PP +.Vb 1 +\& /usr/local/lib/perl5/CORE +.Ve +.PP +or maybe something like +.PP +.Vb 1 +\& /usr/opt/perl5/CORE +.Ve +.PP +Execute this statement for a hint about where to find \s-1CORE:\s0 +.PP +.Vb 1 +\& perl \-MConfig \-e \*(Aqprint $Config{archlib}\*(Aq +.Ve +.PP +Here's how you'd compile the example in the next section, +\&\*(L"Adding a Perl interpreter to your C program\*(R", on my Linux box: +.PP +.Vb 4 +\& % gcc \-O2 \-Dbool=char \-DHAS_BOOL \-I/usr/local/include +\& \-I/usr/local/lib/perl5/i586\-linux/5.003/CORE +\& \-L/usr/local/lib/perl5/i586\-linux/5.003/CORE +\& \-o interp interp.c \-lperl \-lm +.Ve +.PP +(That's all one line.) On my \s-1DEC\s0 Alpha running old 5.003_05, the +incantation is a bit different: +.PP +.Vb 4 +\& % cc \-O2 \-Olimit 2900 \-I/usr/local/include +\& \-I/usr/local/lib/perl5/alpha\-dec_osf/5.00305/CORE +\& \-L/usr/local/lib/perl5/alpha\-dec_osf/5.00305/CORE \-L/usr/local/lib +\& \-D_\|_LANGUAGE_C_\|_ \-D_NO_PROTO \-o interp interp.c \-lperl \-lm +.Ve +.PP +How can you figure out what to add? Assuming your Perl is post\-5.001, +execute a \f(CW\*(C`perl \-V\*(C'\fR command and pay special attention to the \*(L"cc\*(R" and +\&\*(L"ccflags\*(R" information. +.PP +You'll have to choose the appropriate compiler (\fIcc\fR, \fIgcc\fR, et al.) for +your machine: \f(CW\*(C`perl \-MConfig \-e \*(Aqprint $Config{cc}\*(Aq\*(C'\fR will tell you what +to use. +.PP +You'll also have to choose the appropriate library directory +(\fI/usr/local/lib/...\fR) for your machine. If your compiler complains +that certain functions are undefined, or that it can't locate +\&\fI\-lperl\fR, then you need to change the path following the \f(CW\*(C`\-L\*(C'\fR. If it +complains that it can't find \fI\s-1EXTERN\s0.h\fR and \fIperl.h\fR, you need to +change the path following the \f(CW\*(C`\-I\*(C'\fR. +.PP +You may have to add extra libraries as well. Which ones? +Perhaps those printed by +.PP +.Vb 1 +\& perl \-MConfig \-e \*(Aqprint $Config{libs}\*(Aq +.Ve +.PP +Provided your perl binary was properly configured and installed the +\&\fBExtUtils::Embed\fR module will determine all of this information for +you: +.PP +.Vb 1 +\& % cc \-o interp interp.c \`perl \-MExtUtils::Embed \-e ccopts \-e ldopts\` +.Ve +.PP +If the \fBExtUtils::Embed\fR module isn't part of your Perl distribution, +you can retrieve it from + +(If this documentation came from your Perl distribution, then you're +running 5.004 or better and you already have it.) +.PP +The \fBExtUtils::Embed\fR kit on \s-1CPAN\s0 also contains all source code for +the examples in this document, tests, additional examples and other +information you may find useful. +.SS "Adding a Perl interpreter to your C program" +.IX Subsection "Adding a Perl interpreter to your C program" +In a sense, perl (the C program) is a good example of embedding Perl +(the language), so I'll demonstrate embedding with \fIminiperlmain.c\fR, +included in the source distribution. Here's a bastardized, non-portable +version of \fIminiperlmain.c\fR containing the essentials of embedding: +.PP +.Vb 2 +\& #include /* from the Perl distribution */ +\& #include /* from the Perl distribution */ +\& +\& static PerlInterpreter *my_perl; /*** The Perl interpreter ***/ +\& +\& int main(int argc, char **argv, char **env) +\& { +\& PERL_SYS_INIT3(&argc,&argv,&env); +\& my_perl = perl_alloc(); +\& perl_construct(my_perl); +\& PL_exit_flags |= PERL_EXIT_DESTRUCT_END; +\& perl_parse(my_perl, NULL, argc, argv, (char **)NULL); +\& perl_run(my_perl); +\& perl_destruct(my_perl); +\& perl_free(my_perl); +\& PERL_SYS_TERM(); +\& exit(EXIT_SUCCESS); +\& } +.Ve +.PP +Notice that we don't use the \f(CW\*(C`env\*(C'\fR pointer. Normally handed to +\&\f(CW\*(C`perl_parse\*(C'\fR as its final argument, \f(CW\*(C`env\*(C'\fR here is replaced by +\&\f(CW\*(C`NULL\*(C'\fR, which means that the current environment will be used. +.PP +The macros \s-1\fBPERL_SYS_INIT3\s0()\fR and \s-1\fBPERL_SYS_TERM\s0()\fR provide system-specific +tune up of the C runtime environment necessary to run Perl interpreters; +they should only be called once regardless of how many interpreters you +create or destroy. Call \s-1\fBPERL_SYS_INIT3\s0()\fR before you create your first +interpreter, and \s-1\fBPERL_SYS_TERM\s0()\fR after you free your last interpreter. +.PP +Since \s-1\fBPERL_SYS_INIT3\s0()\fR may change \f(CW\*(C`env\*(C'\fR, it may be more appropriate to +provide \f(CW\*(C`env\*(C'\fR as an argument to \fBperl_parse()\fR. +.PP +Also notice that no matter what arguments you pass to \fBperl_parse()\fR, +\&\s-1\fBPERL_SYS_INIT3\s0()\fR must be invoked on the C \fBmain()\fR argc, argv and env and +only once. +.PP +Mind that argv[argc] must be \s-1NULL,\s0 same as those passed to a main +function in C. +.PP +Now compile this program (I'll call it \fIinterp.c\fR) into an executable: +.PP +.Vb 1 +\& % cc \-o interp interp.c \`perl \-MExtUtils::Embed \-e ccopts \-e ldopts\` +.Ve +.PP +After a successful compilation, you'll be able to use \fIinterp\fR just +like perl itself: +.PP +.Vb 6 +\& % interp +\& print "Pretty Good Perl \en"; +\& print "10890 \- 9801 is ", 10890 \- 9801; +\& +\& Pretty Good Perl +\& 10890 \- 9801 is 1089 +.Ve +.PP +or +.PP +.Vb 2 +\& % interp \-e \*(Aqprintf("%x", 3735928559)\*(Aq +\& deadbeef +.Ve +.PP +You can also read and execute Perl statements from a file while in the +midst of your C program, by placing the filename in \fIargv[1]\fR before +calling \fIperl_run\fR. +.SS "Calling a Perl subroutine from your C program" +.IX Subsection "Calling a Perl subroutine from your C program" +To call individual Perl subroutines, you can use any of the \fBcall_*\fR +functions documented in perlcall. +In this example we'll use \f(CW\*(C`call_argv\*(C'\fR. +.PP +That's shown below, in a program I'll call \fIshowtime.c\fR. +.PP +.Vb 2 +\& #include +\& #include +\& +\& static PerlInterpreter *my_perl; +\& +\& int main(int argc, char **argv, char **env) +\& { +\& char *args[] = { NULL }; +\& PERL_SYS_INIT3(&argc,&argv,&env); +\& my_perl = perl_alloc(); +\& perl_construct(my_perl); +\& +\& perl_parse(my_perl, NULL, argc, argv, NULL); +\& PL_exit_flags |= PERL_EXIT_DESTRUCT_END; +\& +\& /*** skipping perl_run() ***/ +\& +\& call_argv("showtime", G_DISCARD | G_NOARGS, args); +\& +\& perl_destruct(my_perl); +\& perl_free(my_perl); +\& PERL_SYS_TERM(); +\& exit(EXIT_SUCCESS); +\& } +.Ve +.PP +where \fIshowtime\fR is a Perl subroutine that takes no arguments (that's the +\&\fIG_NOARGS\fR) and for which I'll ignore the return value (that's the +\&\fIG_DISCARD\fR). Those flags, and others, are discussed in perlcall. +.PP +I'll define the \fIshowtime\fR subroutine in a file called \fIshowtime.pl\fR: +.PP +.Vb 1 +\& print "I shan\*(Aqt be printed."; +\& +\& sub showtime { +\& print time; +\& } +.Ve +.PP +Simple enough. Now compile and run: +.PP +.Vb 4 +\& % cc \-o showtime showtime.c \e +\& \`perl \-MExtUtils::Embed \-e ccopts \-e ldopts\` +\& % showtime showtime.pl +\& 818284590 +.Ve +.PP +yielding the number of seconds that elapsed between January 1, 1970 +(the beginning of the Unix epoch), and the moment I began writing this +sentence. +.PP +In this particular case we don't have to call \fIperl_run\fR, as we set +the PL_exit_flag \s-1PERL_EXIT_DESTRUCT_END\s0 which executes \s-1END\s0 blocks in +perl_destruct. +.PP +If you want to pass arguments to the Perl subroutine, you can add +strings to the \f(CW\*(C`NULL\*(C'\fR\-terminated \f(CW\*(C`args\*(C'\fR list passed to +\&\fIcall_argv\fR. For other data types, or to examine return values, +you'll need to manipulate the Perl stack. That's demonstrated in +\&\*(L"Fiddling with the Perl stack from your C program\*(R". +.SS "Evaluating a Perl statement from your C program" +.IX Subsection "Evaluating a Perl statement from your C program" +Perl provides two \s-1API\s0 functions to evaluate pieces of Perl code. +These are \*(L"eval_sv\*(R" in perlapi and \*(L"eval_pv\*(R" in perlapi. +.PP +Arguably, these are the only routines you'll ever need to execute +snippets of Perl code from within your C program. Your code can be as +long as you wish; it can contain multiple statements; it can employ +\&\*(L"use\*(R" in perlfunc, \*(L"require\*(R" in perlfunc, and \*(L"do\*(R" in perlfunc to +include external Perl files. +.PP +\&\fIeval_pv\fR lets us evaluate individual Perl strings, and then +extract variables for coercion into C types. The following program, +\&\fIstring.c\fR, executes three Perl strings, extracting an \f(CW\*(C`int\*(C'\fR from +the first, a \f(CW\*(C`float\*(C'\fR from the second, and a \f(CW\*(C`char *\*(C'\fR from the third. +.PP +.Vb 2 +\& #include +\& #include +\& +\& static PerlInterpreter *my_perl; +\& +\& main (int argc, char **argv, char **env) +\& { +\& char *embedding[] = { "", "\-e", "0", NULL }; +\& +\& PERL_SYS_INIT3(&argc,&argv,&env); +\& my_perl = perl_alloc(); +\& perl_construct( my_perl ); +\& +\& perl_parse(my_perl, NULL, 3, embedding, NULL); +\& PL_exit_flags |= PERL_EXIT_DESTRUCT_END; +\& perl_run(my_perl); +\& +\& /** Treat $a as an integer **/ +\& eval_pv("$a = 3; $a **= 2", TRUE); +\& printf("a = %d\en", SvIV(get_sv("a", 0))); +\& +\& /** Treat $a as a float **/ +\& eval_pv("$a = 3.14; $a **= 2", TRUE); +\& printf("a = %f\en", SvNV(get_sv("a", 0))); +\& +\& /** Treat $a as a string **/ +\& eval_pv( +\& "$a = \*(AqrekcaH lreP rehtonA tsuJ\*(Aq; $a = reverse($a);", TRUE); +\& printf("a = %s\en", SvPV_nolen(get_sv("a", 0))); +\& +\& perl_destruct(my_perl); +\& perl_free(my_perl); +\& PERL_SYS_TERM(); +\& } +.Ve +.PP +All of those strange functions with \fIsv\fR in their names help convert Perl +scalars to C types. They're described in perlguts and perlapi. +.PP +If you compile and run \fIstring.c\fR, you'll see the results of using +\&\fI\f(BISvIV()\fI\fR to create an \f(CW\*(C`int\*(C'\fR, \fI\f(BISvNV()\fI\fR to create a \f(CW\*(C`float\*(C'\fR, and +\&\fI\f(BISvPV()\fI\fR to create a string: +.PP +.Vb 3 +\& a = 9 +\& a = 9.859600 +\& a = Just Another Perl Hacker +.Ve +.PP +In the example above, we've created a global variable to temporarily +store the computed value of our eval'ed expression. It is also +possible and in most cases a better strategy to fetch the return value +from \fI\f(BIeval_pv()\fI\fR instead. Example: +.PP +.Vb 4 +\& ... +\& SV *val = eval_pv("reverse \*(AqrekcaH lreP rehtonA tsuJ\*(Aq", TRUE); +\& printf("%s\en", SvPV_nolen(val)); +\& ... +.Ve +.PP +This way, we avoid namespace pollution by not creating global +variables and we've simplified our code as well. +.SS "Performing Perl pattern matches and substitutions from your C program" +.IX Subsection "Performing Perl pattern matches and substitutions from your C program" +The \fI\f(BIeval_sv()\fI\fR function lets us evaluate strings of Perl code, so we can +define some functions that use it to \*(L"specialize\*(R" in matches and +substitutions: \fI\f(BImatch()\fI\fR, \fI\f(BIsubstitute()\fI\fR, and \fI\f(BImatches()\fI\fR. +.PP +.Vb 1 +\& I32 match(SV *string, char *pattern); +.Ve +.PP +Given a string and a pattern (e.g., \f(CW\*(C`m/clasp/\*(C'\fR or \f(CW\*(C`/\eb\ew*\eb/\*(C'\fR, which +in your C program might appear as \*(L"/\e\eb\e\ew*\e\eb/\*(R"), \fBmatch()\fR +returns 1 if the string matches the pattern and 0 otherwise. +.PP +.Vb 1 +\& int substitute(SV **string, char *pattern); +.Ve +.PP +Given a pointer to an \f(CW\*(C`SV\*(C'\fR and an \f(CW\*(C`=~\*(C'\fR operation (e.g., +\&\f(CW\*(C`s/bob/robert/g\*(C'\fR or \f(CW\*(C`tr[A\-Z][a\-z]\*(C'\fR), \fBsubstitute()\fR modifies the string +within the \f(CW\*(C`SV\*(C'\fR as according to the operation, returning the number of +substitutions made. +.PP +.Vb 1 +\& SSize_t matches(SV *string, char *pattern, AV **matches); +.Ve +.PP +Given an \f(CW\*(C`SV\*(C'\fR, a pattern, and a pointer to an empty \f(CW\*(C`AV\*(C'\fR, +\&\fBmatches()\fR evaluates \f(CW\*(C`$string =~ $pattern\*(C'\fR in a list context, and +fills in \fImatches\fR with the array elements, returning the number of matches +found. +.PP +Here's a sample program, \fImatch.c\fR, that uses all three (long lines have +been wrapped here): +.PP +.Vb 2 +\& #include +\& #include +\& +\& static PerlInterpreter *my_perl; +\& +\& /** my_eval_sv(code, error_check) +\& ** kinda like eval_sv(), +\& ** but we pop the return value off the stack +\& **/ +\& SV* my_eval_sv(SV *sv, I32 croak_on_error) +\& { +\& dSP; +\& SV* retval; +\& +\& +\& PUSHMARK(SP); +\& eval_sv(sv, G_SCALAR); +\& +\& SPAGAIN; +\& retval = POPs; +\& PUTBACK; +\& +\& if (croak_on_error && SvTRUE(ERRSV)) +\& croak_sv(ERRSV); +\& +\& return retval; +\& } +\& +\& /** match(string, pattern) +\& ** +\& ** Used for matches in a scalar context. +\& ** +\& ** Returns 1 if the match was successful; 0 otherwise. +\& **/ +\& +\& I32 match(SV *string, char *pattern) +\& { +\& SV *command = newSV(0), *retval; +\& +\& sv_setpvf(command, "my $string = \*(Aq%s\*(Aq; $string =~ %s", +\& SvPV_nolen(string), pattern); +\& +\& retval = my_eval_sv(command, TRUE); +\& SvREFCNT_dec(command); +\& +\& return SvIV(retval); +\& } +\& +\& /** substitute(string, pattern) +\& ** +\& ** Used for =~ operations that +\& ** modify their left\-hand side (s/// and tr///) +\& ** +\& ** Returns the number of successful matches, and +\& ** modifies the input string if there were any. +\& **/ +\& +\& I32 substitute(SV **string, char *pattern) +\& { +\& SV *command = newSV(0), *retval; +\& +\& sv_setpvf(command, "$string = \*(Aq%s\*(Aq; ($string =~ %s)", +\& SvPV_nolen(*string), pattern); +\& +\& retval = my_eval_sv(command, TRUE); +\& SvREFCNT_dec(command); +\& +\& *string = get_sv("string", 0); +\& return SvIV(retval); +\& } +\& +\& /** matches(string, pattern, matches) +\& ** +\& ** Used for matches in a list context. +\& ** +\& ** Returns the number of matches, +\& ** and fills in **matches with the matching substrings +\& **/ +\& +\& SSize_t matches(SV *string, char *pattern, AV **match_list) +\& { +\& SV *command = newSV(0); +\& SSize_t num_matches; +\& +\& sv_setpvf(command, "my $string = \*(Aq%s\*(Aq; @array = ($string =~ %s)", +\& SvPV_nolen(string), pattern); +\& +\& my_eval_sv(command, TRUE); +\& SvREFCNT_dec(command); +\& +\& *match_list = get_av("array", 0); +\& num_matches = av_top_index(*match_list) + 1; +\& +\& return num_matches; +\& } +\& +\& main (int argc, char **argv, char **env) +\& { +\& char *embedding[] = { "", "\-e", "0", NULL }; +\& AV *match_list; +\& I32 num_matches, i; +\& SV *text; +\& +\& PERL_SYS_INIT3(&argc,&argv,&env); +\& my_perl = perl_alloc(); +\& perl_construct(my_perl); +\& perl_parse(my_perl, NULL, 3, embedding, NULL); +\& PL_exit_flags |= PERL_EXIT_DESTRUCT_END; +\& +\& text = newSV(0); +\& sv_setpv(text, "When he is at a convenience store and the " +\& "bill comes to some amount like 76 cents, Maynard is " +\& "aware that there is something he *should* do, something " +\& "that will enable him to get back a quarter, but he has " +\& "no idea *what*. He fumbles through his red squeezey " +\& "changepurse and gives the boy three extra pennies with " +\& "his dollar, hoping that he might luck into the correct " +\& "amount. The boy gives him back two of his own pennies " +\& "and then the big shiny quarter that is his prize. " +\& "\-RICHH"); +\& +\& if (match(text, "m/quarter/")) /** Does text contain \*(Aqquarter\*(Aq? **/ +\& printf("match: Text contains the word \*(Aqquarter\*(Aq.\en\en"); +\& else +\& printf("match: Text doesn\*(Aqt contain the word \*(Aqquarter\*(Aq.\en\en"); +\& +\& if (match(text, "m/eighth/")) /** Does text contain \*(Aqeighth\*(Aq? **/ +\& printf("match: Text contains the word \*(Aqeighth\*(Aq.\en\en"); +\& else +\& printf("match: Text doesn\*(Aqt contain the word \*(Aqeighth\*(Aq.\en\en"); +\& +\& /** Match all occurrences of /wi../ **/ +\& num_matches = matches(text, "m/(wi..)/g", &match_list); +\& printf("matches: m/(wi..)/g found %d matches...\en", num_matches); +\& +\& for (i = 0; i < num_matches; i++) +\& printf("match: %s\en", +\& SvPV_nolen(*av_fetch(match_list, i, FALSE))); +\& printf("\en"); +\& +\& /** Remove all vowels from text **/ +\& num_matches = substitute(&text, "s/[aeiou]//gi"); +\& if (num_matches) { +\& printf("substitute: s/[aeiou]//gi...%lu substitutions made.\en", +\& (unsigned long)num_matches); +\& printf("Now text is: %s\en\en", SvPV_nolen(text)); +\& } +\& +\& /** Attempt a substitution **/ +\& if (!substitute(&text, "s/Perl/C/")) { +\& printf("substitute: s/Perl/C...No substitution made.\en\en"); +\& } +\& +\& SvREFCNT_dec(text); +\& PL_perl_destruct_level = 1; +\& perl_destruct(my_perl); +\& perl_free(my_perl); +\& PERL_SYS_TERM(); +\& } +.Ve +.PP +which produces the output (again, long lines have been wrapped here) +.PP +.Vb 1 +\& match: Text contains the word \*(Aqquarter\*(Aq. +\& +\& match: Text doesn\*(Aqt contain the word \*(Aqeighth\*(Aq. +\& +\& matches: m/(wi..)/g found 2 matches... +\& match: will +\& match: with +\& +\& substitute: s/[aeiou]//gi...139 substitutions made. +\& Now text is: Whn h s t cnvnnc str nd th bll cms t sm mnt lk 76 cnts, +\& Mynrd s wr tht thr s smthng h *shld* d, smthng tht wll nbl hm t gt +\& bck qrtr, bt h hs n d *wht*. H fmbls thrgh hs rd sqzy chngprs nd +\& gvs th by thr xtr pnns wth hs dllr, hpng tht h mght lck nt th crrct +\& mnt. Th by gvs hm bck tw f hs wn pnns nd thn th bg shny qrtr tht s +\& hs prz. \-RCHH +\& +\& substitute: s/Perl/C...No substitution made. +.Ve +.SS "Fiddling with the Perl stack from your C program" +.IX Subsection "Fiddling with the Perl stack from your C program" +When trying to explain stacks, most computer science textbooks mumble +something about spring-loaded columns of cafeteria plates: the last +thing you pushed on the stack is the first thing you pop off. That'll +do for our purposes: your C program will push some arguments onto \*(L"the Perl +stack\*(R", shut its eyes while some magic happens, and then pop the +results\*(--the return value of your Perl subroutine\*(--off the stack. +.PP +First you'll need to know how to convert between C types and Perl +types, with \fBnewSViv()\fR and \fBsv_setnv()\fR and \fBnewAV()\fR and all their +friends. They're described in perlguts and perlapi. +.PP +Then you'll need to know how to manipulate the Perl stack. That's +described in perlcall. +.PP +Once you've understood those, embedding Perl in C is easy. +.PP +Because C has no builtin function for integer exponentiation, let's +make Perl's ** operator available to it (this is less useful than it +sounds, because Perl implements ** with C's \fI\f(BIpow()\fI\fR function). First +I'll create a stub exponentiation function in \fIpower.pl\fR: +.PP +.Vb 4 +\& sub expo { +\& my ($a, $b) = @_; +\& return $a ** $b; +\& } +.Ve +.PP +Now I'll create a C program, \fIpower.c\fR, with a function +\&\fI\f(BIPerlPower()\fI\fR that contains all the perlguts necessary to push the +two arguments into \fI\f(BIexpo()\fI\fR and to pop the return value out. Take a +deep breath... +.PP +.Vb 2 +\& #include +\& #include +\& +\& static PerlInterpreter *my_perl; +\& +\& static void +\& PerlPower(int a, int b) +\& { +\& dSP; /* initialize stack pointer */ +\& ENTER; /* everything created after here */ +\& SAVETMPS; /* ...is a temporary variable. */ +\& PUSHMARK(SP); /* remember the stack pointer */ +\& XPUSHs(sv_2mortal(newSViv(a))); /* push the base onto the stack */ +\& XPUSHs(sv_2mortal(newSViv(b))); /* push the exponent onto stack */ +\& PUTBACK; /* make local stack pointer global */ +\& call_pv("expo", G_SCALAR); /* call the function */ +\& SPAGAIN; /* refresh stack pointer */ +\& /* pop the return value from stack */ +\& printf ("%d to the %dth power is %d.\en", a, b, POPi); +\& PUTBACK; +\& FREETMPS; /* free that return value */ +\& LEAVE; /* ...and the XPUSHed "mortal" args.*/ +\& } +\& +\& int main (int argc, char **argv, char **env) +\& { +\& char *my_argv[] = { "", "power.pl", NULL }; +\& +\& PERL_SYS_INIT3(&argc,&argv,&env); +\& my_perl = perl_alloc(); +\& perl_construct( my_perl ); +\& +\& perl_parse(my_perl, NULL, 2, my_argv, (char **)NULL); +\& PL_exit_flags |= PERL_EXIT_DESTRUCT_END; +\& perl_run(my_perl); +\& +\& PerlPower(3, 4); /*** Compute 3 ** 4 ***/ +\& +\& perl_destruct(my_perl); +\& perl_free(my_perl); +\& PERL_SYS_TERM(); +\& exit(EXIT_SUCCESS); +\& } +.Ve +.PP +Compile and run: +.PP +.Vb 1 +\& % cc \-o power power.c \`perl \-MExtUtils::Embed \-e ccopts \-e ldopts\` +\& +\& % power +\& 3 to the 4th power is 81. +.Ve +.SS "Maintaining a persistent interpreter" +.IX Subsection "Maintaining a persistent interpreter" +When developing interactive and/or potentially long-running +applications, it's a good idea to maintain a persistent interpreter +rather than allocating and constructing a new interpreter multiple +times. The major reason is speed: since Perl will only be loaded into +memory once. +.PP +However, you have to be more cautious with namespace and variable +scoping when using a persistent interpreter. In previous examples +we've been using global variables in the default package \f(CW\*(C`main\*(C'\fR. We +knew exactly what code would be run, and assumed we could avoid +variable collisions and outrageous symbol table growth. +.PP +Let's say your application is a server that will occasionally run Perl +code from some arbitrary file. Your server has no way of knowing what +code it's going to run. Very dangerous. +.PP +If the file is pulled in by \f(CW\*(C`perl_parse()\*(C'\fR, compiled into a newly +constructed interpreter, and subsequently cleaned out with +\&\f(CW\*(C`perl_destruct()\*(C'\fR afterwards, you're shielded from most namespace +troubles. +.PP +One way to avoid namespace collisions in this scenario is to translate +the filename into a guaranteed-unique package name, and then compile +the code into that package using \*(L"eval\*(R" in perlfunc. In the example +below, each file will only be compiled once. Or, the application +might choose to clean out the symbol table associated with the file +after it's no longer needed. Using \*(L"call_argv\*(R" in perlapi, We'll +call the subroutine \f(CW\*(C`Embed::Persistent::eval_file\*(C'\fR which lives in the +file \f(CW\*(C`persistent.pl\*(C'\fR and pass the filename and boolean cleanup/cache +flag as arguments. +.PP +Note that the process will continue to grow for each file that it +uses. In addition, there might be \f(CW\*(C`AUTOLOAD\*(C'\fRed subroutines and other +conditions that cause Perl's symbol table to grow. You might want to +add some logic that keeps track of the process size, or restarts +itself after a certain number of requests, to ensure that memory +consumption is minimized. You'll also want to scope your variables +with \*(L"my\*(R" in perlfunc whenever possible. +.PP +.Vb 2 +\& package Embed::Persistent; +\& #persistent.pl +\& +\& use strict; +\& our %Cache; +\& use Symbol qw(delete_package); +\& +\& sub valid_package_name { +\& my($string) = @_; +\& $string =~ s/([^A\-Za\-z0\-9\e/])/sprintf("_%2x",unpack("C",$1))/eg; +\& # second pass only for words starting with a digit +\& $string =~ s|/(\ed)|sprintf("/_%2x",unpack("C",$1))|eg; +\& +\& # Dress it up as a real package name +\& $string =~ s|/|::|g; +\& return "Embed" . $string; +\& } +\& +\& sub eval_file { +\& my($filename, $delete) = @_; +\& my $package = valid_package_name($filename); +\& my $mtime = \-M $filename; +\& if(defined $Cache{$package}{mtime} +\& && +\& $Cache{$package}{mtime} <= $mtime) +\& { +\& # we have compiled this subroutine already, +\& # it has not been updated on disk, nothing left to do +\& print STDERR "already compiled $package\->handler\en"; +\& } +\& else { +\& local *FH; +\& open FH, $filename or die "open \*(Aq$filename\*(Aq $!"; +\& local($/) = undef; +\& my $sub = ; +\& close FH; +\& +\& #wrap the code into a subroutine inside our unique package +\& my $eval = qq{package $package; sub handler { $sub; }}; +\& { +\& # hide our variables within this block +\& my($filename,$mtime,$package,$sub); +\& eval $eval; +\& } +\& die $@ if $@; +\& +\& #cache it unless we\*(Aqre cleaning out each time +\& $Cache{$package}{mtime} = $mtime unless $delete; +\& } +\& +\& eval {$package\->handler;}; +\& die $@ if $@; +\& +\& delete_package($package) if $delete; +\& +\& #take a look if you want +\& #print Devel::Symdump\->rnew($package)\->as_string, $/; +\& } +\& +\& 1; +\& +\& _\|_END_\|_ +\& +\& /* persistent.c */ +\& #include +\& #include +\& +\& /* 1 = clean out filename\*(Aqs symbol table after each request, +\& 0 = don\*(Aqt +\& */ +\& #ifndef DO_CLEAN +\& #define DO_CLEAN 0 +\& #endif +\& +\& #define BUFFER_SIZE 1024 +\& +\& static PerlInterpreter *my_perl = NULL; +\& +\& int +\& main(int argc, char **argv, char **env) +\& { +\& char *embedding[] = { "", "persistent.pl", NULL }; +\& char *args[] = { "", DO_CLEAN, NULL }; +\& char filename[BUFFER_SIZE]; +\& int failing, exitstatus; +\& +\& PERL_SYS_INIT3(&argc,&argv,&env); +\& if((my_perl = perl_alloc()) == NULL) { +\& fprintf(stderr, "no memory!"); +\& exit(EXIT_FAILURE); +\& } +\& perl_construct(my_perl); +\& +\& PL_origalen = 1; /* don\*(Aqt let $0 assignment update the +\& proctitle or embedding[0] */ +\& failing = perl_parse(my_perl, NULL, 2, embedding, NULL); +\& PL_exit_flags |= PERL_EXIT_DESTRUCT_END; +\& if(!failing) +\& failing = perl_run(my_perl); +\& if(!failing) { +\& while(printf("Enter file name: ") && +\& fgets(filename, BUFFER_SIZE, stdin)) { +\& +\& filename[strlen(filename)\-1] = \*(Aq\e0\*(Aq; /* strip \en */ +\& /* call the subroutine, +\& passing it the filename as an argument */ +\& args[0] = filename; +\& call_argv("Embed::Persistent::eval_file", +\& G_DISCARD | G_EVAL, args); +\& +\& /* check $@ */ +\& if(SvTRUE(ERRSV)) +\& fprintf(stderr, "eval error: %s\en", SvPV_nolen(ERRSV)); +\& } +\& } +\& +\& PL_perl_destruct_level = 0; +\& exitstatus = perl_destruct(my_perl); +\& perl_free(my_perl); +\& PERL_SYS_TERM(); +\& exit(exitstatus); +\& } +.Ve +.PP +Now compile: +.PP +.Vb 2 +\& % cc \-o persistent persistent.c \e +\& \`perl \-MExtUtils::Embed \-e ccopts \-e ldopts\` +.Ve +.PP +Here's an example script file: +.PP +.Vb 3 +\& #test.pl +\& my $string = "hello"; +\& foo($string); +\& +\& sub foo { +\& print "foo says: @_\en"; +\& } +.Ve +.PP +Now run: +.PP +.Vb 7 +\& % persistent +\& Enter file name: test.pl +\& foo says: hello +\& Enter file name: test.pl +\& already compiled Embed::test_2epl\->handler +\& foo says: hello +\& Enter file name: ^C +.Ve +.SS "Execution of \s-1END\s0 blocks" +.IX Subsection "Execution of END blocks" +Traditionally \s-1END\s0 blocks have been executed at the end of the perl_run. +This causes problems for applications that never call perl_run. Since +perl 5.7.2 you can specify \f(CW\*(C`PL_exit_flags |= PERL_EXIT_DESTRUCT_END\*(C'\fR +to get the new behaviour. This also enables the running of \s-1END\s0 blocks if +the perl_parse fails and \f(CW\*(C`perl_destruct\*(C'\fR will return the exit value. +.ie n .SS "$0 assignments" +.el .SS "\f(CW$0\fP assignments" +.IX Subsection "$0 assignments" +When a perl script assigns a value to \f(CW$0\fR then the perl runtime will +try to make this value show up as the program name reported by \*(L"ps\*(R" by +updating the memory pointed to by the argv passed to \fBperl_parse()\fR and +also calling \s-1API\s0 functions like \fBsetproctitle()\fR where available. This +behaviour might not be appropriate when embedding perl and can be +disabled by assigning the value \f(CW1\fR to the variable \f(CW\*(C`PL_origalen\*(C'\fR +before \fBperl_parse()\fR is called. +.PP +The \fIpersistent.c\fR example above is for instance likely to segfault +when \f(CW$0\fR is assigned to if the \f(CW\*(C`PL_origalen = 1;\*(C'\fR assignment is +removed. This because perl will try to write to the read only memory +of the \f(CW\*(C`embedding[]\*(C'\fR strings. +.SS "Maintaining multiple interpreter instances" +.IX Subsection "Maintaining multiple interpreter instances" +Some rare applications will need to create more than one interpreter +during a session. Such an application might sporadically decide to +release any resources associated with the interpreter. +.PP +The program must take care to ensure that this takes place \fIbefore\fR +the next interpreter is constructed. By default, when perl is not +built with any special options, the global variable +\&\f(CW\*(C`PL_perl_destruct_level\*(C'\fR is set to \f(CW0\fR, since extra cleaning isn't +usually needed when a program only ever creates a single interpreter +in its entire lifetime. +.PP +Setting \f(CW\*(C`PL_perl_destruct_level\*(C'\fR to \f(CW1\fR makes everything squeaky clean: +.PP +.Vb 10 +\& while(1) { +\& ... +\& /* reset global variables here with PL_perl_destruct_level = 1 */ +\& PL_perl_destruct_level = 1; +\& perl_construct(my_perl); +\& ... +\& /* clean and reset _everything_ during perl_destruct */ +\& PL_perl_destruct_level = 1; +\& perl_destruct(my_perl); +\& perl_free(my_perl); +\& ... +\& /* let\*(Aqs go do it again! */ +\& } +.Ve +.PP +When \fI\f(BIperl_destruct()\fI\fR is called, the interpreter's syntax parse tree +and symbol tables are cleaned up, and global variables are reset. The +second assignment to \f(CW\*(C`PL_perl_destruct_level\*(C'\fR is needed because +perl_construct resets it to \f(CW0\fR. +.PP +Now suppose we have more than one interpreter instance running at the +same time. This is feasible, but only if you used the Configure option +\&\f(CW\*(C`\-Dusemultiplicity\*(C'\fR or the options \f(CW\*(C`\-Dusethreads \-Duseithreads\*(C'\fR when +building perl. By default, enabling one of these Configure options +sets the per-interpreter global variable \f(CW\*(C`PL_perl_destruct_level\*(C'\fR to +\&\f(CW1\fR, so that thorough cleaning is automatic and interpreter variables +are initialized correctly. Even if you don't intend to run two or +more interpreters at the same time, but to run them sequentially, like +in the above example, it is recommended to build perl with the +\&\f(CW\*(C`\-Dusemultiplicity\*(C'\fR option otherwise some interpreter variables may +not be initialized correctly between consecutive runs and your +application may crash. +.PP +See also \*(L"Thread-aware system interfaces\*(R" in perlxs. +.PP +Using \f(CW\*(C`\-Dusethreads \-Duseithreads\*(C'\fR rather than \f(CW\*(C`\-Dusemultiplicity\*(C'\fR +is more appropriate if you intend to run multiple interpreters +concurrently in different threads, because it enables support for +linking in the thread libraries of your system with the interpreter. +.PP +Let's give it a try: +.PP +.Vb 2 +\& #include +\& #include +\& +\& /* we\*(Aqre going to embed two interpreters */ +\& +\& #define SAY_HELLO "\-e", "print qq(Hi, I\*(Aqm $^X\en)" +\& +\& int main(int argc, char **argv, char **env) +\& { +\& PerlInterpreter *one_perl, *two_perl; +\& char *one_args[] = { "one_perl", SAY_HELLO, NULL }; +\& char *two_args[] = { "two_perl", SAY_HELLO, NULL }; +\& +\& PERL_SYS_INIT3(&argc,&argv,&env); +\& one_perl = perl_alloc(); +\& two_perl = perl_alloc(); +\& +\& PERL_SET_CONTEXT(one_perl); +\& perl_construct(one_perl); +\& PERL_SET_CONTEXT(two_perl); +\& perl_construct(two_perl); +\& +\& PERL_SET_CONTEXT(one_perl); +\& perl_parse(one_perl, NULL, 3, one_args, (char **)NULL); +\& PERL_SET_CONTEXT(two_perl); +\& perl_parse(two_perl, NULL, 3, two_args, (char **)NULL); +\& +\& PERL_SET_CONTEXT(one_perl); +\& perl_run(one_perl); +\& PERL_SET_CONTEXT(two_perl); +\& perl_run(two_perl); +\& +\& PERL_SET_CONTEXT(one_perl); +\& perl_destruct(one_perl); +\& PERL_SET_CONTEXT(two_perl); +\& perl_destruct(two_perl); +\& +\& PERL_SET_CONTEXT(one_perl); +\& perl_free(one_perl); +\& PERL_SET_CONTEXT(two_perl); +\& perl_free(two_perl); +\& PERL_SYS_TERM(); +\& exit(EXIT_SUCCESS); +\& } +.Ve +.PP +Note the calls to \s-1\fBPERL_SET_CONTEXT\s0()\fR. These are necessary to initialize +the global state that tracks which interpreter is the \*(L"current\*(R" one on +the particular process or thread that may be running it. It should +always be used if you have more than one interpreter and are making +perl \s-1API\s0 calls on both interpreters in an interleaved fashion. +.PP +\&\s-1PERL_SET_CONTEXT\s0(interp) should also be called whenever \f(CW\*(C`interp\*(C'\fR is +used by a thread that did not create it (using either \fBperl_alloc()\fR, or +the more esoteric \fBperl_clone()\fR). +.PP +Compile as usual: +.PP +.Vb 2 +\& % cc \-o multiplicity multiplicity.c \e +\& \`perl \-MExtUtils::Embed \-e ccopts \-e ldopts\` +.Ve +.PP +Run it, Run it: +.PP +.Vb 3 +\& % multiplicity +\& Hi, I\*(Aqm one_perl +\& Hi, I\*(Aqm two_perl +.Ve +.SS "Using Perl modules, which themselves use C libraries, from your C program" +.IX Subsection "Using Perl modules, which themselves use C libraries, from your C program" +If you've played with the examples above and tried to embed a script +that \fI\f(BIuse()\fI\fRs a Perl module (such as \fISocket\fR) which itself uses a C or \*(C+ +library, this probably happened: +.PP +.Vb 3 +\& Can\*(Aqt load module Socket, dynamic loading not available in this perl. +\& (You may need to build a new perl executable which either supports +\& dynamic loading or has the Socket module statically linked into it.) +.Ve +.PP +What's wrong? +.PP +Your interpreter doesn't know how to communicate with these extensions +on its own. A little glue will help. Up until now you've been +calling \fI\f(BIperl_parse()\fI\fR, handing it \s-1NULL\s0 for the second argument: +.PP +.Vb 1 +\& perl_parse(my_perl, NULL, argc, my_argv, NULL); +.Ve +.PP +That's where the glue code can be inserted to create the initial contact +between Perl and linked C/\*(C+ routines. Let's take a look some pieces of +\&\fIperlmain.c\fR to see how Perl does this: +.PP +.Vb 1 +\& static void xs_init (pTHX); +\& +\& EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); +\& EXTERN_C void boot_Socket (pTHX_ CV* cv); +\& +\& +\& EXTERN_C void +\& xs_init(pTHX) +\& { +\& char *file = _\|_FILE_\|_; +\& /* DynaLoader is a special case */ +\& newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); +\& newXS("Socket::bootstrap", boot_Socket, file); +\& } +.Ve +.PP +Simply put: for each extension linked with your Perl executable +(determined during its initial configuration on your +computer or when adding a new extension), +a Perl subroutine is created to incorporate the extension's +routines. Normally, that subroutine is named +\&\fI\f(BIModule::bootstrap()\fI\fR and is invoked when you say \fIuse Module\fR. In +turn, this hooks into an \s-1XSUB,\s0 \fIboot_Module\fR, which creates a Perl +counterpart for each of the extension's XSUBs. Don't worry about this +part; leave that to the \fIxsubpp\fR and extension authors. If your +extension is dynamically loaded, DynaLoader creates \fI\f(BIModule::bootstrap()\fI\fR +for you on the fly. In fact, if you have a working DynaLoader then there +is rarely any need to link in any other extensions statically. +.PP +Once you have this code, slap it into the second argument of \fI\f(BIperl_parse()\fI\fR: +.PP +.Vb 1 +\& perl_parse(my_perl, xs_init, argc, my_argv, NULL); +.Ve +.PP +Then compile: +.PP +.Vb 1 +\& % cc \-o interp interp.c \`perl \-MExtUtils::Embed \-e ccopts \-e ldopts\` +\& +\& % interp +\& use Socket; +\& use SomeDynamicallyLoadedModule; +\& +\& print "Now I can use extensions!\en"\*(Aq +.Ve +.PP +\&\fBExtUtils::Embed\fR can also automate writing the \fIxs_init\fR glue code. +.PP +.Vb 4 +\& % perl \-MExtUtils::Embed \-e xsinit \-\- \-o perlxsi.c +\& % cc \-c perlxsi.c \`perl \-MExtUtils::Embed \-e ccopts\` +\& % cc \-c interp.c \`perl \-MExtUtils::Embed \-e ccopts\` +\& % cc \-o interp perlxsi.o interp.o \`perl \-MExtUtils::Embed \-e ldopts\` +.Ve +.PP +Consult perlxs, perlguts, and perlapi for more details. +.SS "Using embedded Perl with \s-1POSIX\s0 locales" +.IX Subsection "Using embedded Perl with POSIX locales" +(See perllocale for information about these.) +When a Perl interpreter normally starts up, it tells the system it wants +to use the system's default locale. This is often, but not necessarily, +the \*(L"C\*(R" or \*(L"\s-1POSIX\*(R"\s0 locale. Absent a \f(CW"use\ locale"\fR within the perl +code, this mostly has no effect (but see \*(L"Not within the +scope of \*(R"use locale"" in perllocale). Also, there is not a problem if the +locale you want to use in your embedded perl is the same as the system +default. However, this doesn't work if you have set up and want to use +a locale that isn't the system default one. Starting in Perl v5.20, you +can tell the embedded Perl interpreter that the locale is already +properly set up, and to skip doing its own normal initialization. It +skips if the environment variable \f(CW\*(C`PERL_SKIP_LOCALE_INIT\*(C'\fR is set (even +if set to 0 or \f(CW""\fR). A perl that has this capability will define the +C pre-processor symbol \f(CW\*(C`HAS_SKIP_LOCALE_INIT\*(C'\fR. This allows code that +has to work with multiple Perl versions to do some sort of work-around +when confronted with an earlier Perl. +.PP +If your program is using the \s-1POSIX 2008\s0 multi-thread locale +functionality, you should switch into the global locale and set that up +properly before starting the Perl interpreter. It will then properly +switch back to using the thread-safe functions. +.SH "Hiding Perl_" +.IX Header "Hiding Perl_" +If you completely hide the short forms of the Perl public \s-1API,\s0 +add \-DPERL_NO_SHORT_NAMES to the compilation flags. This means that +for example instead of writing +.PP +.Vb 1 +\& warn("%d bottles of beer on the wall", bottlecount); +.Ve +.PP +you will have to write the explicit full form +.PP +.Vb 1 +\& Perl_warn(aTHX_ "%d bottles of beer on the wall", bottlecount); +.Ve +.PP +(See \*(L"Background and \s-1PERL_IMPLICIT_CONTEXT\*(R"\s0 in perlguts for the explanation +of the \f(CW\*(C`aTHX_\*(C'\fR. ) Hiding the short forms is very useful for avoiding +all sorts of nasty (C preprocessor or otherwise) conflicts with other +software packages (Perl defines about 2400 APIs with these short names, +take or leave few hundred, so there certainly is room for conflict.) +.SH "MORAL" +.IX Header "MORAL" +You can sometimes \fIwrite faster code\fR in C, but +you can always \fIwrite code faster\fR in Perl. Because you can use +each from the other, combine them as you wish. +.SH "AUTHOR" +.IX Header "AUTHOR" +Jon Orwant <\fIorwant@media.mit.edu\fR> and Doug MacEachern +<\fIdougm@covalent.net\fR>, with small contributions from Tim Bunce, Tom +Christiansen, Guy Decoux, Hallvard Furuseth, Dov Grobgeld, and Ilya +Zakharevich. +.PP +Doug MacEachern has an article on embedding in Volume 1, Issue 4 of +The Perl Journal ( ). Doug is also the developer of the +most widely-used Perl embedding: the mod_perl system +(perl.apache.org), which embeds Perl in the Apache web server. +Oracle, Binary Evolution, ActiveState, and Ben Sugars's nsapi_perl +have used this model for Oracle, Netscape and Internet Information +Server Perl plugins. +.SH "COPYRIGHT" +.IX Header "COPYRIGHT" +Copyright (C) 1995, 1996, 1997, 1998 Doug MacEachern and Jon Orwant. All +Rights Reserved. +.PP +This document may be distributed under the same terms as Perl itself. diff --git a/data/miniconda3/man/man1/perlexperiment.1 b/data/miniconda3/man/man1/perlexperiment.1 new file mode 100644 index 0000000000000000000000000000000000000000..bc157e40891bd089247a8b810af7e0fdefd09c18 --- /dev/null +++ b/data/miniconda3/man/man1/perlexperiment.1 @@ -0,0 +1,453 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLEXPERIMENT 1" +.TH PERLEXPERIMENT 1 "2020-12-18" "perl v5.32.1" "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" +perlexperiment \- A listing of experimental features in Perl +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document lists the current and past experimental features in the perl +core. Although all of these are documented with their appropriate topics, +this succinct listing gives you an overview and basic facts about their +status. +.PP +So far we've merely tried to find and list the experimental features and infer +their inception, versions, etc. There's a lot of speculation here. +.SS "Current experiments" +.IX Subsection "Current experiments" +.ie n .IP "Smart match (""~~"")" 8 +.el .IP "Smart match (\f(CW~~\fR)" 8 +.IX Item "Smart match (~~)" +Introduced in Perl 5.10.0 +.Sp +Modified in Perl 5.10.1, 5.12.0 +.Sp +Using this feature triggers warnings in the category +\&\f(CW\*(C`experimental::smartmatch\*(C'\fR. +.Sp +The ticket for this feature is +[perl #13173] . +.IP "Pluggable keywords" 8 +.IX Item "Pluggable keywords" +The ticket for this feature is +[perl #13199] . +.Sp +See \*(L"PL_keyword_plugin\*(R" in perlapi for the mechanism. +.Sp +Introduced in Perl 5.11.2 +.IP "Regular Expression Set Operations" 8 +.IX Item "Regular Expression Set Operations" +Introduced in Perl 5.18 +.Sp +The ticket for this feature is +[perl #13197] . +.Sp +See also: \*(L"Extended Bracketed Character Classes\*(R" in perlrecharclass +.Sp +Using this feature triggers warnings in the category +\&\f(CW\*(C`experimental::regex_sets\*(C'\fR. +.IP "Subroutine signatures" 8 +.IX Item "Subroutine signatures" +Introduced in Perl 5.20.0 +.Sp +Using this feature triggers warnings in the category +\&\f(CW\*(C`experimental::signatures\*(C'\fR. +.Sp +The ticket for this feature is +[perl #13681] . +.IP "Aliasing via reference" 8 +.IX Item "Aliasing via reference" +Introduced in Perl 5.22.0 +.Sp +Using this feature triggers warnings in the category +\&\f(CW\*(C`experimental::refaliasing\*(C'\fR. +.Sp +The ticket for this feature is +[perl #14150] . +.Sp +See also: \*(L"Assigning to References\*(R" in perlref +.ie n .IP "The ""const"" attribute" 8 +.el .IP "The ``const'' attribute" 8 +.IX Item "The const attribute" +Introduced in Perl 5.22.0 +.Sp +Using this feature triggers warnings in the category +\&\f(CW\*(C`experimental::const_attr\*(C'\fR. +.Sp +The ticket for this feature is +[perl #14428] . +.Sp +See also: \*(L"Constant Functions\*(R" in perlsub +.IP "use re 'strict';" 8 +.IX Item "use re 'strict';" +Introduced in Perl 5.22.0 +.Sp +Using this feature triggers warnings in the category +\&\f(CW\*(C`experimental::re_strict\*(C'\fR. +.Sp +See \*(L"'strict' mode\*(R" in re +.IP "The <:win32> \s-1IO\s0 pseudolayer" 8 +.IX Item "The <:win32> IO pseudolayer" +The ticket for this feature is +[perl #13198] . +.Sp +See also \*(L"\s-1PERLIO\*(R"\s0 in perlrun +.IP "Declaring a reference to a variable" 8 +.IX Item "Declaring a reference to a variable" +Introduced in Perl 5.26.0 +.Sp +Using this feature triggers warnings in the category +\&\f(CW\*(C`experimental::declared_refs\*(C'\fR. +.Sp +The ticket for this feature is +[perl #15458] . +.Sp +See also: \*(L"Declaring a Reference to a Variable\*(R" in perlref +.ie n .IP "There is an ""installhtml"" target in the Makefile." 8 +.el .IP "There is an \f(CWinstallhtml\fR target in the Makefile." 8 +.IX Item "There is an installhtml target in the Makefile." +The ticket for this feature is +[perl #12726] . +.IP "(Limited) Variable-length look-behind" 8 +.IX Item "(Limited) Variable-length look-behind" +Introduced in Perl 5.30.0. Variability of up to 255 characters is +handled. +.Sp +Using this feature triggers warnings in the category +\&\f(CW\*(C`experimental::vlb\*(C'\fR. +.Sp +See also: "(*positive_lookbehind:\fIpattern\fR)" in perlre and +"(*negative_lookbehind:\fIpattern\fR)" in perlre +.SS "Accepted features" +.IX Subsection "Accepted features" +These features were so wildly successful and played so well with others that +we decided to remove their experimental status and admit them as full, stable +features in the world of Perl, lavishing all the benefits and luxuries thereof. +They are also awarded +5 Stability and +3 Charisma. +.IP "64\-bit support" 8 +.IX Item "64-bit support" +Introduced in Perl 5.005 +.IP "die accepts a reference" 8 +.IX Item "die accepts a reference" +Introduced in Perl 5.005 +.IP "\s-1DB\s0 module" 8 +.IX Item "DB module" +Introduced in Perl 5.6.0 +.Sp +See also perldebug, perldebtut +.IP "Weak references" 8 +.IX Item "Weak references" +Introduced in Perl 5.6.0 +.IP "Internal file glob" 8 +.IX Item "Internal file glob" +Introduced in Perl 5.6.0 +.IP "\fBfork()\fR emulation" 8 +.IX Item "fork() emulation" +Introduced in Perl 5.6.1 +.Sp +See also perlfork +.IP "\-Dusemultiplicity \-Duseithreads" 8 +.IX Item "-Dusemultiplicity -Duseithreads" +Introduced in Perl 5.6.0 +.Sp +Accepted in Perl 5.8.0 +.IP "Support for long doubles" 8 +.IX Item "Support for long doubles" +Introduced in Perl 5.6.0 +.Sp +Accepted in Perl 5.8.1 +.ie n .IP "The ""\eN"" regex character class" 8 +.el .IP "The \f(CW\eN\fR regex character class" 8 +.IX Item "The N regex character class" +The \f(CW\*(C`\eN\*(C'\fR character class, not to be confused with the named character +sequence \f(CW\*(C`\eN{NAME}\*(C'\fR, denotes any non-newline character in a regular +expression. +.Sp +Introduced in Perl 5.12 +.Sp +Exact version of acceptance unclear, but no later than Perl 5.18. +.ie n .IP """(?{code})"" and ""(??{ code })""" 8 +.el .IP "\f(CW(?{code})\fR and \f(CW(??{ code })\fR" 8 +.IX Item "(?{code}) and (??{ code })" +Introduced in Perl 5.6.0 +.Sp +Accepted in Perl 5.20.0 +.Sp +See also perlre +.IP "Linux abstract Unix domain sockets" 8 +.IX Item "Linux abstract Unix domain sockets" +Introduced in Perl 5.9.2 +.Sp +Accepted before Perl 5.20.0. The Socket library is now primarily maintained +on \s-1CPAN,\s0 rather than in the perl core. +.Sp +See also Socket +.IP "Lvalue subroutines" 8 +.IX Item "Lvalue subroutines" +Introduced in Perl 5.6.0 +.Sp +Accepted in Perl 5.20.0 +.Sp +See also perlsub +.IP "Backtracking control verbs" 8 +.IX Item "Backtracking control verbs" +\&\f(CW\*(C`(*ACCEPT)\*(C'\fR +.Sp +Introduced in Perl 5.10 +.Sp +Accepted in Perl 5.20.0 +.IP "The <:pop> \s-1IO\s0 pseudolayer" 8 +.IX Item "The <:pop> IO pseudolayer" +See also \*(L"\s-1PERLIO\*(R"\s0 in perlrun +.Sp +Accepted in Perl 5.20.0 +.ie n .IP """\es"" in regexp matches vertical tab" 8 +.el .IP "\f(CW\es\fR in regexp matches vertical tab" 8 +.IX Item "s in regexp matches vertical tab" +Accepted in Perl 5.22.0 +.IP "Postfix dereference syntax" 8 +.IX Item "Postfix dereference syntax" +Introduced in Perl 5.20.0 +.Sp +Accepted in Perl 5.24.0 +.IP "Lexical subroutines" 8 +.IX Item "Lexical subroutines" +Introduced in Perl 5.18.0 +.Sp +Accepted in Perl 5.26.0 +.IP "String\- and number-specific bitwise operators" 8 +.IX Item "String- and number-specific bitwise operators" +Introduced in Perl 5.22.0 +.Sp +Accepted in Perl 5.28.0 +.IP "Alphabetic assertions" 8 +.IX Item "Alphabetic assertions" +Introduced in Perl 5.28.0 +.Sp +Accepted in Perl 5.32.0 +.IP "Script runs" 8 +.IX Item "Script runs" +Introduced in Perl 5.28.0 +.Sp +Accepted in Perl 5.32.0 +.SS "Removed features" +.IX Subsection "Removed features" +These features are no longer considered experimental and their functionality +has disappeared. It's your own fault if you wrote production programs using +these features after we explicitly told you not to (see perlpolicy). +.IP "5.005\-style threading" 8 +.IX Item "5.005-style threading" +Introduced in Perl 5.005 +.Sp +Removed in Perl 5.10 +.IP "perlcc" 8 +.IX Item "perlcc" +Introduced in Perl 5.005 +.Sp +Moved from Perl 5.9.0 to \s-1CPAN\s0 +.IP "The pseudo-hash data type" 8 +.IX Item "The pseudo-hash data type" +Introduced in Perl 5.6.0 +.Sp +Removed in Perl 5.9.0 +.IP "GetOpt::Long Options can now take multiple values at once (experimental)" 8 +.IX Item "GetOpt::Long Options can now take multiple values at once (experimental)" +\&\f(CW\*(C`Getopt::Long\*(C'\fR upgraded to version 2.35 +.Sp +Removed in Perl 5.8.8 +.IP "Assertions" 8 +.IX Item "Assertions" +The \f(CW\*(C`\-A\*(C'\fR command line switch +.Sp +Introduced in Perl 5.9.0 +.Sp +Removed in Perl 5.9.5 +.IP "Test::Harness::Straps" 8 +.IX Item "Test::Harness::Straps" +Moved from Perl 5.10.1 to \s-1CPAN\s0 +.ie n .IP """legacy""" 8 +.el .IP "\f(CWlegacy\fR" 8 +.IX Item "legacy" +The experimental \f(CW\*(C`legacy\*(C'\fR pragma was swallowed by the \f(CW\*(C`feature\*(C'\fR pragma. +.Sp +Introduced in Perl 5.11.2 +.Sp +Removed in Perl 5.11.3 +.ie n .IP "Lexical $_" 8 +.el .IP "Lexical \f(CW$_\fR" 8 +.IX Item "Lexical $_" +Using this feature triggered warnings in the category +\&\f(CW\*(C`experimental::lexical_topic\*(C'\fR. +.Sp +Introduced in Perl 5.10.0 +.Sp +Removed in Perl 5.24.0 +.IP "Array and hash container functions accept references" 8 +.IX Item "Array and hash container functions accept references" +Using this feature triggered warnings in the category +\&\f(CW\*(C`experimental::autoderef\*(C'\fR. +.Sp +Superseded by \*(L"Postfix dereference syntax\*(R". +.Sp +Introduced in Perl 5.14.0 +.Sp +Removed in Perl 5.24.0 +.ie n .IP """our"" can have an experimental optional attribute ""unique""" 8 +.el .IP "\f(CWour\fR can have an experimental optional attribute \f(CWunique\fR" 8 +.IX Item "our can have an experimental optional attribute unique" +Introduced in Perl 5.8.0 +.Sp +Deprecated in Perl 5.10.0 +.Sp +Removed in Perl 5.28.0 +.SH "SEE ALSO" +.IX Header "SEE ALSO" +For a complete list of features check feature. +.SH "AUTHORS" +.IX Header "AUTHORS" +brian d foy \f(CW\*(C`\*(C'\fR +.PP +Se\*'bastien Aperghis-Tramoni \f(CW\*(C`\*(C'\fR +.SH "COPYRIGHT" +.IX Header "COPYRIGHT" +Copyright 2010, brian d foy \f(CW\*(C`\*(C'\fR +.SH "LICENSE" +.IX Header "LICENSE" +You can use and redistribute this document under the same terms as Perl +itself. diff --git a/data/miniconda3/man/man1/perlfaq1.1 b/data/miniconda3/man/man1/perlfaq1.1 new file mode 100644 index 0000000000000000000000000000000000000000..e87d047ab7597b79a0504113d8342d801cd1c785 --- /dev/null +++ b/data/miniconda3/man/man1/perlfaq1.1 @@ -0,0 +1,450 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLFAQ1 1" +.TH PERLFAQ1 1 "2020-12-18" "perl v5.32.1" "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" +perlfaq1 \- General Questions About Perl +.SH "VERSION" +.IX Header "VERSION" +version 5.20200523 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This section of the \s-1FAQ\s0 answers very general, high-level questions +about Perl. +.SS "What is Perl?" +.IX Subsection "What is Perl?" +Perl is a high-level programming language with an eclectic heritage +written by Larry Wall and a cast of thousands. +.PP +Perl's process, file, and text manipulation facilities make it +particularly well-suited for tasks involving quick prototyping, system +utilities, software tools, system management tasks, database access, +graphical programming, networking, and web programming. +.PP +Perl derives from the ubiquitous C programming language and to a +lesser extent from sed, awk, the Unix shell, and many other tools +and languages. +.PP +These strengths make it especially popular with web developers +and system administrators. Mathematicians, geneticists, journalists, +managers and many other people also use Perl. +.SS "Who supports Perl? Who develops it? Why is it free?" +.IX Subsection "Who supports Perl? Who develops it? Why is it free?" +The original culture of the pre-populist Internet and the deeply-held +beliefs of Perl's author, Larry Wall, gave rise to the free and open +distribution policy of Perl. Perl is supported by its users. The +core, the standard Perl library, the optional modules, and the +documentation you're reading now were all written by volunteers. +.PP +The core development team (known as the Perl Porters) +are a group of highly altruistic individuals committed to +producing better software for free than you could hope to purchase for +money. You may snoop on pending developments via the +archives +or you can subscribe to the mailing list by sending +perl5\-porters\-subscribe@perl.org a subscription request +(an empty message with no subject is fine). +.PP +While the \s-1GNU\s0 project includes Perl in its distributions, there's no +such thing as \*(L"\s-1GNU\s0 Perl\*(R". Perl is not produced nor maintained by the +Free Software Foundation. Perl's licensing terms are also more open +than \s-1GNU\s0 software's tend to be. +.PP +You can get commercial support of Perl if you wish, although for most +users the informal support will more than suffice. See the answer to +\&\*(L"Where can I buy a commercial version of Perl?\*(R" for more information. +.SS "Which version of Perl should I use?" +.IX Subsection "Which version of Perl should I use?" +(contributed by brian d foy with updates from others) +.PP +There is often a matter of opinion and taste, and there isn't any one +answer that fits everyone. In general, you want to use either the current +stable release, or the stable release immediately prior to that one. +.PP +Beyond that, you have to consider several things and decide which is best +for you. +.IP "\(bu" 4 +If things aren't broken, upgrading perl may break them (or at least issue +new warnings). +.IP "\(bu" 4 +The latest versions of perl have more bug fixes. +.IP "\(bu" 4 +The latest versions of perl may contain performance improvements and +features not present in older versions. There have been many changes +in perl since perl5 was first introduced. +.IP "\(bu" 4 +The Perl community is geared toward supporting the most recent releases, +so you'll have an easier time finding help for those. +.IP "\(bu" 4 +Older versions of perl may have security vulnerabilities, some of which +are serious (see perlsec and search +CVEs for more +information). +.IP "\(bu" 4 +The latest versions are probably the least deployed and widely tested, so +you may want to wait a few months after their release and see what +problems others have if you are risk averse. +.IP "\(bu" 4 +The immediate, in addition to the current stable release, the previous +stable release is maintained. See +\&\*(L"\s-1MAINTENANCE AND SUPPORT\*(R"\s0 in perlpolicy for more information. +.IP "\(bu" 4 +There are really two tracks of perl development: a maintenance version +and an experimental version. The maintenance versions are stable, and +have an even number as the minor release (i.e. perl5.24.x, where 24 is the +minor release). The experimental versions may include features that +don't make it into the stable versions, and have an odd number as the +minor release (i.e. perl5.25.x, where 25 is the minor release). +.IP "\(bu" 4 +You can consult releases to determine the +current stable release of Perl. +.SS "What are Perl 4, Perl 5, or Raku (Perl 6)?" +.IX Subsection "What are Perl 4, Perl 5, or Raku (Perl 6)?" +In short, Perl 4 is the parent to both Perl 5 and Raku (formerly known as +Perl 6). Perl 5 is the older sibling, and though they are different languages, +someone who knows one will spot many similarities in the other. +.PP +The number after Perl (i.e. the 5 after Perl 5) is the major release +of the perl interpreter as well as the version of the language. Each +major version has significant differences that earlier versions cannot +support. +.PP +The current major release of Perl is Perl 5, first released in +1994. It can run scripts from the previous major release, Perl 4 +(March 1991), but has significant differences. +.PP +Raku is a reinvention of Perl, a language in the same lineage but +not compatible. The two are complementary, not mutually exclusive. Raku is +not meant to replace Perl, and vice versa. See \*(L"What is Raku (Perl 6)?\*(R" +below to find out more. +.PP +See perlhist for a history of Perl revisions. +.SS "What is Raku (Perl 6)?" +.IX Subsection "What is Raku (Perl 6)?" +Raku (formerly known as Perl 6) was \fIoriginally\fR described as the community's +rewrite of Perl, however as the language evolved, it became clear that it is +a separate language, but in the same language family as Perl. +.PP +Raku is not intended primarily as a replacement for Perl, but as its +own thing \- and libraries exist to allow you to call Perl code from Raku +programs and vice versa. +.PP +Contrary to popular belief, Raku and Perl peacefully coexist with one +another. Raku has proven to be a fascinating source of ideas for those +using Perl (the Moose object system is a well-known example). There is +overlap in the communities, and this overlap fosters the tradition of sharing +and borrowing that have been instrumental to Perl's success. +.PP +For more about Raku see . +.PP +\&\*(L"We're really serious about reinventing everything that needs reinventing.\*(R" +\&\-\-Larry Wall +.SS "How stable is Perl?" +.IX Subsection "How stable is Perl?" +Production releases, which incorporate bug fixes and new functionality, +are widely tested before release. Since the 5.000 release, we have +averaged about one production release per year. +.PP +The Perl development team occasionally make changes to the +internal core of the language, but all possible efforts are made toward +backward compatibility. +.SS "How often are new versions of Perl released?" +.IX Subsection "How often are new versions of Perl released?" +Recently, the plan has been to release a new version of Perl roughly every +April, but getting the release right is more important than sticking rigidly to +a calendar date, so the release date is somewhat flexible. The historical +release dates can be viewed at . +.PP +Even numbered minor versions (5.14, 5.16, 5.18) are production versions, and +odd numbered minor versions (5.15, 5.17, 5.19) are development versions. Unless +you want to try out an experimental feature, you probably never want to install +a development version of Perl. +.PP +The Perl development team are called Perl 5 Porters, and their +organization is described at . +The organizational rules really just boil down to one: Larry is always +right, even when he was wrong. +.SS "Is Perl difficult to learn?" +.IX Subsection "Is Perl difficult to learn?" +No, Perl is easy to start learning \-\-and easy to keep learning. It looks +like most programming languages you're likely to have experience +with, so if you've ever written a C program, an awk script, a shell +script, or even a \s-1BASIC\s0 program, you're already partway there. +.PP +Most tasks only require a small subset of the Perl language. One of +the guiding mottos for Perl development is \*(L"there's more than one way +to do it\*(R" (\s-1TMTOWTDI,\s0 sometimes pronounced \*(L"tim toady\*(R"). Perl's +learning curve is therefore shallow (easy to learn) and long (there's +a whole lot you can do if you really want). +.PP +Finally, because Perl is frequently (but not always, and certainly not by +definition) an interpreted language, you can write your programs and test +them without an intermediate compilation step, allowing you to experiment +and test/debug quickly and easily. This ease of experimentation flattens +the learning curve even more. +.PP +Things that make Perl easier to learn: Unix experience, almost any kind +of programming experience, an understanding of regular expressions, and +the ability to understand other people's code. If there's something you +need to do, then it's probably already been done, and a working example is +usually available for free. Don't forget Perl modules, either. +They're discussed in Part 3 of this \s-1FAQ,\s0 along with \s-1CPAN\s0 , which is +discussed in Part 2. +.SS "How does Perl compare with other languages like Java, Python, \s-1REXX,\s0 Scheme, or Tcl?" +.IX Subsection "How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl?" +Perl can be used for almost any coding problem, even ones which require +integrating specialist C code for extra speed. As with any tool it can +be used well or badly. Perl has many strengths, and a few weaknesses, +precisely which areas are good and bad is often a personal choice. +.PP +When choosing a language you should also be influenced by the +resources , testing culture +and community which surrounds it. +.PP +For comparisons to a specific language it is often best to create +a small project in both languages and compare the results, make sure +to use all the resources of each language, +as a language is far more than just it's syntax. +.SS "Can I do [task] in Perl?" +.IX Subsection "Can I do [task] in Perl?" +Perl is flexible and extensible enough for you to use on virtually any +task, from one-line file-processing tasks to large, elaborate systems. +.PP +For many people, Perl serves as a great replacement for shell scripting. +For others, it serves as a convenient, high-level replacement for most of +what they'd program in low-level languages like C or \*(C+. It's ultimately +up to you (and possibly your management) which tasks you'll use Perl +for and which you won't. +.PP +If you have a library that provides an \s-1API,\s0 you can make any component +of it available as just another Perl function or variable using a Perl +extension written in C or \*(C+ and dynamically linked into your main +perl interpreter. You can also go the other direction, and write your +main program in C or \*(C+, and then link in some Perl code on the fly, +to create a powerful application. See perlembed. +.PP +That said, there will always be small, focused, special-purpose +languages dedicated to a specific problem domain that are simply more +convenient for certain kinds of problems. Perl tries to be all things +to all people, but nothing special to anyone. Examples of specialized +languages that come to mind include prolog and matlab. +.SS "When shouldn't I program in Perl?" +.IX Subsection "When shouldn't I program in Perl?" +One good reason is when you already have an existing +application written in another language that's all done (and done +well), or you have an application language specifically designed for a +certain task (e.g. prolog, make). +.PP +If you find that you need to speed up a specific part of a Perl +application (not something you often need) you may want to use C, +but you can access this from your Perl code with perlxs. +.ie n .SS "What's the difference between ""perl"" and ""Perl""?" +.el .SS "What's the difference between ``perl'' and ``Perl''?" +.IX Subsection "What's the difference between perl and Perl?" +\&\*(L"Perl\*(R" is the name of the language. Only the \*(L"P\*(R" is capitalized. +The name of the interpreter (the program which runs the Perl script) +is \*(L"perl\*(R" with a lowercase \*(L"p\*(R". +.PP +You may or may not choose to follow this usage. But never write \*(L"\s-1PERL\*(R",\s0 +because perl is not an acronym. +.SS "What is a \s-1JAPH\s0?" +.IX Subsection "What is a JAPH?" +(contributed by brian d foy) +.PP +\&\s-1JAPH\s0 stands for \*(L"Just another Perl hacker,\*(R", which Randal Schwartz used +to sign email and usenet messages starting in the late 1980s. He +previously used the phrase with many subjects (\*(L"Just another x hacker,\*(R"), +so to distinguish his \s-1JAPH,\s0 he started to write them as Perl programs: +.PP +.Vb 1 +\& print "Just another Perl hacker,"; +.Ve +.PP +Other people picked up on this and started to write clever or obfuscated +programs to produce the same output, spinning things quickly out of +control while still providing hours of amusement for their creators and +readers. +.PP +\&\s-1CPAN\s0 has several \s-1JAPH\s0 programs at . +.SS "How can I convince others to use Perl?" +.IX Subsection "How can I convince others to use Perl?" +(contributed by brian d foy) +.PP +Appeal to their self interest! If Perl is new (and thus scary) to them, +find something that Perl can do to solve one of their problems. That +might mean that Perl either saves them something (time, headaches, money) +or gives them something (flexibility, power, testability). +.PP +In general, the benefit of a language is closely related to the skill of +the people using that language. If you or your team can be faster, +better, and stronger through Perl, you'll deliver more value. Remember, +people often respond better to what they get out of it. If you run +into resistance, figure out what those people get out of the other +choice and how Perl might satisfy that requirement. +.PP +You don't have to worry about finding or paying for Perl; it's freely +available and several popular operating systems come with Perl. Community +support in places such as Perlmonks ( ) +and the various Perl mailing lists ( ) means that +you can usually get quick answers to your problems. +.PP +Finally, keep in mind that Perl might not be the right tool for every +job. You're a much better advocate if your claims are reasonable and +grounded in reality. Dogmatically advocating anything tends to make +people discount your message. Be honest about possible disadvantages +to your choice of Perl since any choice has trade-offs. +.PP +You might find these links useful: +.IP "\(bu" 4 + +.IP "\(bu" 4 + +.SH "AUTHOR AND COPYRIGHT" +.IX Header "AUTHOR AND COPYRIGHT" +Copyright (c) 1997\-2010 Tom Christiansen, Nathan Torkington, and +other authors as noted. All rights reserved. +.PP +This documentation is free; you can redistribute it and/or modify it +under the same terms as Perl itself. +.PP +Irrespective of its distribution, all code examples here are in the public +domain. You are permitted and encouraged to use this code and any +derivatives thereof in your own programs for fun or for profit as you +see fit. A simple comment in the code giving credit to the \s-1FAQ\s0 would +be courteous but is not required. diff --git a/data/miniconda3/man/man1/perlfaq2.1 b/data/miniconda3/man/man1/perlfaq2.1 new file mode 100644 index 0000000000000000000000000000000000000000..6afbfa649e55f45076162934bda29df34de0b118 --- /dev/null +++ b/data/miniconda3/man/man1/perlfaq2.1 @@ -0,0 +1,366 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLFAQ2 1" +.TH PERLFAQ2 1 "2020-12-18" "perl v5.32.1" "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" +perlfaq2 \- Obtaining and Learning about Perl +.SH "VERSION" +.IX Header "VERSION" +version 5.20200523 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This section of the \s-1FAQ\s0 answers questions about where to find +source and documentation for Perl, support, and +related matters. +.SS "What machines support Perl? Where do I get it?" +.IX Subsection "What machines support Perl? Where do I get it?" +The standard release of Perl (the one maintained by the Perl +development team) is distributed only in source code form. You +can find the latest releases at . +.PP +Perl builds and runs on a bewildering number of platforms. Virtually +all known and current Unix derivatives are supported (perl's native +platform), as are other systems like \s-1VMS, DOS, OS/2,\s0 Windows, +\&\s-1QNX,\s0 BeOS, \s-1OS X,\s0 MPE/iX and the Amiga. +.PP +Binary distributions for some proprietary platforms can be found + directory. Because these are not part of +the standard distribution, they may and in fact do differ from the +base perl port in a variety of ways. You'll have to check their +respective release notes to see just what the differences are. These +differences can be either positive (e.g. extensions for the features +of the particular platform that are not supported in the source +release of perl) or negative (e.g. might be based upon a less current +source release of perl). +.SS "How can I get a binary version of Perl?" +.IX Subsection "How can I get a binary version of Perl?" +See \s-1CPAN\s0 Ports +.SS "I don't have a C compiler. How can I build my own Perl interpreter?" +.IX Subsection "I don't have a C compiler. How can I build my own Perl interpreter?" +For Windows, use a binary version of Perl, +Strawberry Perl and +ActivePerl come with a +bundled C compiler. +.PP +Otherwise if you really do want to build Perl, you need to get a +binary version of \f(CW\*(C`gcc\*(C'\fR for your system first. Use a search +engine to find out how to do this for your operating system. +.SS "I copied the Perl binary from one machine to another, but scripts don't work." +.IX Subsection "I copied the Perl binary from one machine to another, but scripts don't work." +That's probably because you forgot libraries, or library paths differ. +You really should build the whole distribution on the machine it will +eventually live on, and then type \f(CW\*(C`make install\*(C'\fR. Most other +approaches are doomed to failure. +.PP +One simple way to check that things are in the right place is to print out +the hard-coded \f(CW@INC\fR that perl looks through for libraries: +.PP +.Vb 1 +\& % perl \-le \*(Aqprint for @INC\*(Aq +.Ve +.PP +If this command lists any paths that don't exist on your system, then you +may need to move the appropriate libraries to these locations, or create +symbolic links, aliases, or shortcuts appropriately. \f(CW@INC\fR is also printed as +part of the output of +.PP +.Vb 1 +\& % perl \-V +.Ve +.PP +You might also want to check out +\&\*(L"How do I keep my own module/library directory?\*(R" in perlfaq8. +.SS "I grabbed the sources and tried to compile but gdbm/dynamic loading/malloc/linking/... failed. How do I make it work?" +.IX Subsection "I grabbed the sources and tried to compile but gdbm/dynamic loading/malloc/linking/... failed. How do I make it work?" +Read the \fI\s-1INSTALL\s0\fR file, which is part of the source distribution. +It describes in detail how to cope with most idiosyncrasies that the +\&\f(CW\*(C`Configure\*(C'\fR script can't work around for any given system or +architecture. +.SS "What modules and extensions are available for Perl? What is \s-1CPAN\s0?" +.IX Subsection "What modules and extensions are available for Perl? What is CPAN?" +\&\s-1CPAN\s0 stands for Comprehensive Perl Archive Network, a multi-gigabyte +archive replicated on hundreds of machines all over the world. \s-1CPAN\s0 +contains tens of thousands of modules and extensions, source code +and documentation, designed for \fIeverything\fR from commercial +database interfaces to keyboard/screen control and running large web sites. +.PP +You can search \s-1CPAN\s0 on . +.PP +The master web site for \s-1CPAN\s0 is , + lists all mirrors. +.PP +See the \s-1CPAN FAQ\s0 at for answers +to the most frequently asked questions about \s-1CPAN.\s0 +.PP +The Task::Kensho module has a list of recommended modules which +you should review as a good starting point. +.SS "Where can I get information on Perl?" +.IX Subsection "Where can I get information on Perl?" +.IP "\(bu" 4 + +.IP "\(bu" 4 + +.IP "\(bu" 4 + +.PP +The complete Perl documentation is available with the Perl distribution. +If you have Perl installed locally, you probably have the documentation +installed as well: type \f(CW\*(C`perldoc perl\*(C'\fR in a terminal or +view online . +.PP +(Some operating system distributions may ship the documentation in a different +package; for instance, on Debian, you need to install the \f(CW\*(C`perl\-doc\*(C'\fR package.) +.PP +Many good books have been written about Perl\*(--see the section later in +perlfaq2 for more details. +.SS "What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org?" +.IX Subsection "What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org?" +Perl.com used to be part of the O'Reilly +Network, a subsidiary of O'Reilly Media. Although it retains most of +the original content from its O'Reilly Network, it is now hosted by +The Perl Foundation . +.PP +The Perl Foundation is an advocacy organization for the Perl language +which maintains the web site as a general +advocacy site for the Perl language. It uses the domain to provide +general support services to the Perl community, including the hosting +of mailing lists, web sites, and other services. There are also many +other sub-domains for special topics like learning Perl and jobs in Perl, +such as: +.IP "\(bu" 4 + +.IP "\(bu" 4 + +.IP "\(bu" 4 + +.IP "\(bu" 4 + +.PP +Perl Mongers uses the pm.org domain for services +related to local Perl user groups, including the hosting of mailing lists +and web sites. See the Perl Mongers web site for more +information about joining, starting, or requesting services for a +Perl user group. +.PP +\&\s-1CPAN,\s0 or the Comprehensive Perl Archive Network , +is a replicated, worldwide repository of Perl software. +See What is \s-1CPAN\s0?. +.SS "Where can I post questions?" +.IX Subsection "Where can I post questions?" +There are many Perl mailing lists for various +topics, specifically the beginners list +may be of use. +.PP +Other places to ask questions are on the +PerlMonks site or +stackoverflow . +.SS "Perl Books" +.IX Subsection "Perl Books" +There are many good books on Perl . +.SS "Which magazines have Perl content?" +.IX Subsection "Which magazines have Perl content?" +There's also \fI\f(CI$foo\fI Magazin\fR, a German magazine dedicated to Perl, at +( ). The \fIPerl-Zeitung\fR is another +German-speaking magazine for Perl beginners (see + ). +.PP +Several Unix/Linux related magazines frequently include articles on Perl. +.SS "Which Perl blogs should I read?" +.IX Subsection "Which Perl blogs should I read?" +Perl News covers some of the major events in the Perl +world, Perl Weekly is a weekly e\-mail +(and \s-1RSS\s0 feed) of hand-picked Perl articles. +.PP + hosts many Perl blogs, there are also +several blog aggregators: Perlsphere and +IronMan are two of them. +.SS "What mailing lists are there for Perl?" +.IX Subsection "What mailing lists are there for Perl?" +A comprehensive list of Perl-related mailing lists can be found at + +.SS "Where can I buy a commercial version of Perl?" +.IX Subsection "Where can I buy a commercial version of Perl?" +Perl already \fIis\fR commercial software: it has a license +that you can grab and carefully read to your manager. It is distributed +in releases and comes in well-defined packages. There is a very large +and supportive user community and an extensive literature. +.PP +If you still need commercial support +ActiveState offers +this. +.SS "Where do I send bug reports?" +.IX Subsection "Where do I send bug reports?" +(contributed by brian d foy) +.PP +First, ensure that you've found an actual bug. Second, ensure you've +found an actual bug. +.PP +If you've found a bug with the perl interpreter or one of the modules +in the standard library (those that come with Perl), you can submit a +bug report to the GitHub issue tracker at +. +.PP +To determine if a module came with your version of Perl, you can +install and use the Module::CoreList module. It has the information +about the modules (with their versions) included with each release +of Perl. +.PP +Every \s-1CPAN\s0 module has a bug tracker set up in \s-1RT,\s0 . +You can submit bugs to \s-1RT\s0 either through its web interface or by +email. To email a bug report, send it to +bug\-@rt.cpan.org . For example, if you +wanted to report a bug in Business::ISBN, you could send a message to +bug\-Business\-ISBN@rt.cpan.org . +.PP +Some modules might have special reporting requirements, such as a +Github or Google Code tracking system, so you should check the +module documentation too. +.SH "AUTHOR AND COPYRIGHT" +.IX Header "AUTHOR AND COPYRIGHT" +Copyright (c) 1997\-2010 Tom Christiansen, Nathan Torkington, and +other authors as noted. All rights reserved. +.PP +This documentation is free; you can redistribute it and/or modify it +under the same terms as Perl itself. +.PP +Irrespective of its distribution, all code examples here are in the public +domain. You are permitted and encouraged to use this code and any +derivatives thereof in your own programs for fun or for profit as you +see fit. A simple comment in the code giving credit to the \s-1FAQ\s0 would +be courteous but is not required. diff --git a/data/miniconda3/man/man1/perlfaq3.1 b/data/miniconda3/man/man1/perlfaq3.1 new file mode 100644 index 0000000000000000000000000000000000000000..593785cacf4dacbd346b991cc3d4badb2f136b37 --- /dev/null +++ b/data/miniconda3/man/man1/perlfaq3.1 @@ -0,0 +1,1239 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLFAQ3 1" +.TH PERLFAQ3 1 "2020-12-18" "perl v5.32.1" "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" +perlfaq3 \- Programming Tools +.SH "VERSION" +.IX Header "VERSION" +version 5.20200523 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This section of the \s-1FAQ\s0 answers questions related to programmer tools +and programming support. +.SS "How do I do (anything)?" +.IX Subsection "How do I do (anything)?" +Have you looked at \s-1CPAN\s0 (see perlfaq2)? The chances are that +someone has already written a module that can solve your problem. +Have you read the appropriate manpages? Here's a brief index: +.IP "Basics" 4 +.IX Item "Basics" +.RS 4 +.PD 0 +.IP "perldata \- Perl data types" 4 +.IX Item "perldata - Perl data types" +.IP "perlvar \- Perl pre-defined variables" 4 +.IX Item "perlvar - Perl pre-defined variables" +.IP "perlsyn \- Perl syntax" 4 +.IX Item "perlsyn - Perl syntax" +.IP "perlop \- Perl operators and precedence" 4 +.IX Item "perlop - Perl operators and precedence" +.IP "perlsub \- Perl subroutines" 4 +.IX Item "perlsub - Perl subroutines" +.RE +.RS 4 +.RE +.IP "Execution" 4 +.IX Item "Execution" +.RS 4 +.IP "perlrun \- how to execute the Perl interpreter" 4 +.IX Item "perlrun - how to execute the Perl interpreter" +.IP "perldebug \- Perl debugging" 4 +.IX Item "perldebug - Perl debugging" +.RE +.RS 4 +.RE +.IP "Functions" 4 +.IX Item "Functions" +.RS 4 +.IP "perlfunc \- Perl builtin functions" 4 +.IX Item "perlfunc - Perl builtin functions" +.RE +.RS 4 +.RE +.IP "Objects" 4 +.IX Item "Objects" +.RS 4 +.IP "perlref \- Perl references and nested data structures" 4 +.IX Item "perlref - Perl references and nested data structures" +.IP "perlmod \- Perl modules (packages and symbol tables)" 4 +.IX Item "perlmod - Perl modules (packages and symbol tables)" +.IP "perlobj \- Perl objects" 4 +.IX Item "perlobj - Perl objects" +.IP "perltie \- how to hide an object class in a simple variable" 4 +.IX Item "perltie - how to hide an object class in a simple variable" +.RE +.RS 4 +.RE +.IP "Data Structures" 4 +.IX Item "Data Structures" +.RS 4 +.IP "perlref \- Perl references and nested data structures" 4 +.IX Item "perlref - Perl references and nested data structures" +.IP "perllol \- Manipulating arrays of arrays in Perl" 4 +.IX Item "perllol - Manipulating arrays of arrays in Perl" +.IP "perldsc \- Perl Data Structures Cookbook" 4 +.IX Item "perldsc - Perl Data Structures Cookbook" +.RE +.RS 4 +.RE +.IP "Modules" 4 +.IX Item "Modules" +.RS 4 +.IP "perlmod \- Perl modules (packages and symbol tables)" 4 +.IX Item "perlmod - Perl modules (packages and symbol tables)" +.IP "perlmodlib \- constructing new Perl modules and finding existing ones" 4 +.IX Item "perlmodlib - constructing new Perl modules and finding existing ones" +.RE +.RS 4 +.RE +.IP "Regexes" 4 +.IX Item "Regexes" +.RS 4 +.IP "perlre \- Perl regular expressions" 4 +.IX Item "perlre - Perl regular expressions" +.IP "perlfunc \- Perl builtin functions>" 4 +.IX Item "perlfunc - Perl builtin functions>" +.IP "perlop \- Perl operators and precedence" 4 +.IX Item "perlop - Perl operators and precedence" +.IP "perllocale \- Perl locale handling (internationalization and localization)" 4 +.IX Item "perllocale - Perl locale handling (internationalization and localization)" +.RE +.RS 4 +.RE +.IP "Moving to perl5" 4 +.IX Item "Moving to perl5" +.RS 4 +.IP "perltrap \- Perl traps for the unwary" 4 +.IX Item "perltrap - Perl traps for the unwary" +.IP "perl" 4 +.IX Item "perl" +.RE +.RS 4 +.RE +.IP "Linking with C" 4 +.IX Item "Linking with C" +.RS 4 +.IP "perlxstut \- Tutorial for writing XSUBs" 4 +.IX Item "perlxstut - Tutorial for writing XSUBs" +.IP "perlxs \- \s-1XS\s0 language reference manual" 4 +.IX Item "perlxs - XS language reference manual" +.IP "perlcall \- Perl calling conventions from C" 4 +.IX Item "perlcall - Perl calling conventions from C" +.IP "perlguts \- Introduction to the Perl \s-1API\s0" 4 +.IX Item "perlguts - Introduction to the Perl API" +.IP "perlembed \- how to embed perl in your C program" 4 +.IX Item "perlembed - how to embed perl in your C program" +.RE +.RS 4 +.RE +.IP "Various" 4 +.IX Item "Various" +.PD + +(not a man-page but still useful, a collection of various essays on +Perl techniques) +.PP +A crude table of contents for the Perl manpage set is found in perltoc. +.SS "How can I use Perl interactively?" +.IX Subsection "How can I use Perl interactively?" +The typical approach uses the Perl debugger, described in the +\&\fBperldebug\fR\|(1) manpage, on an \*(L"empty\*(R" program, like this: +.PP +.Vb 1 +\& perl \-de 42 +.Ve +.PP +Now just type in any legal Perl code, and it will be immediately +evaluated. You can also examine the symbol table, get stack +backtraces, check variable values, set breakpoints, and other +operations typically found in symbolic debuggers. +.PP +You can also use Devel::REPL which is an interactive shell for Perl, +commonly known as a \s-1REPL\s0 \- Read, Evaluate, Print, Loop. It provides +various handy features. +.SS "How do I find which modules are installed on my system?" +.IX Subsection "How do I find which modules are installed on my system?" +From the command line, you can use the \f(CW\*(C`cpan\*(C'\fR command's \f(CW\*(C`\-l\*(C'\fR switch: +.PP +.Vb 1 +\& $ cpan \-l +.Ve +.PP +You can also use \f(CW\*(C`cpan\*(C'\fR's \f(CW\*(C`\-a\*(C'\fR switch to create an autobundle file +that \f(CW\*(C`CPAN.pm\*(C'\fR understands and can use to re-install every module: +.PP +.Vb 1 +\& $ cpan \-a +.Ve +.PP +Inside a Perl program, you can use the ExtUtils::Installed module to +show all installed distributions, although it can take awhile to do +its magic. The standard library which comes with Perl just shows up +as \*(L"Perl\*(R" (although you can get those with Module::CoreList). +.PP +.Vb 1 +\& use ExtUtils::Installed; +\& +\& my $inst = ExtUtils::Installed\->new(); +\& my @modules = $inst\->modules(); +.Ve +.PP +If you want a list of all of the Perl module filenames, you +can use File::Find::Rule: +.PP +.Vb 1 +\& use File::Find::Rule; +\& +\& my @files = File::Find::Rule\-> +\& extras({follow => 1})\-> +\& file()\-> +\& name( \*(Aq*.pm\*(Aq )\-> +\& in( @INC ) +\& ; +.Ve +.PP +If you do not have that module, you can do the same thing +with File::Find which is part of the standard library: +.PP +.Vb 2 +\& use File::Find; +\& my @files; +\& +\& find( +\& { +\& wanted => sub { +\& push @files, $File::Find::fullname +\& if \-f $File::Find::fullname && /\e.pm$/ +\& }, +\& follow => 1, +\& follow_skip => 2, +\& }, +\& @INC +\& ); +\& +\& print join "\en", @files; +.Ve +.PP +If you simply need to check quickly to see if a module is +available, you can check for its documentation. If you can +read the documentation the module is most likely installed. +If you cannot read the documentation, the module might not +have any (in rare cases): +.PP +.Vb 1 +\& $ perldoc Module::Name +.Ve +.PP +You can also try to include the module in a one-liner to see if +perl finds it: +.PP +.Vb 1 +\& $ perl \-MModule::Name \-e1 +.Ve +.PP +(If you don't receive a \*(L"Can't locate ... in \f(CW@INC\fR\*(R" error message, then Perl +found the module name you asked for.) +.SS "How do I debug my Perl programs?" +.IX Subsection "How do I debug my Perl programs?" +(contributed by brian d foy) +.PP +Before you do anything else, you can help yourself by ensuring that +you let Perl tell you about problem areas in your code. By turning +on warnings and strictures, you can head off many problems before +they get too big. You can find out more about these in strict +and warnings. +.PP +.Vb 3 +\& #!/usr/bin/perl +\& use strict; +\& use warnings; +.Ve +.PP +Beyond that, the simplest debugger is the \f(CW\*(C`print\*(C'\fR function. Use it +to look at values as you run your program: +.PP +.Vb 1 +\& print STDERR "The value is [$value]\en"; +.Ve +.PP +The Data::Dumper module can pretty-print Perl data structures: +.PP +.Vb 2 +\& use Data::Dumper qw( Dumper ); +\& print STDERR "The hash is " . Dumper( \e%hash ) . "\en"; +.Ve +.PP +Perl comes with an interactive debugger, which you can start with the +\&\f(CW\*(C`\-d\*(C'\fR switch. It's fully explained in perldebug. +.PP +If you'd like a graphical user interface and you have Tk, you can use +\&\f(CW\*(C`ptkdb\*(C'\fR. It's on \s-1CPAN\s0 and available for free. +.PP +If you need something much more sophisticated and controllable, Leon +Brocard's Devel::ebug (which you can call with the \f(CW\*(C`\-D\*(C'\fR switch as \f(CW\*(C`\-Debug\*(C'\fR) +gives you the programmatic hooks into everything you need to write your +own (without too much pain and suffering). +.PP +You can also use a commercial debugger such as Affrus (Mac \s-1OS X\s0), Komodo +from Activestate (Windows and Mac \s-1OS X\s0), or \s-1EPIC\s0 (most platforms). +.SS "How do I profile my Perl programs?" +.IX Subsection "How do I profile my Perl programs?" +(contributed by brian d foy, updated Fri Jul 25 12:22:26 \s-1PDT 2008\s0) +.PP +The \f(CW\*(C`Devel\*(C'\fR namespace has several modules which you can use to +profile your Perl programs. +.PP +The Devel::NYTProf (New York Times Profiler) does both statement +and subroutine profiling. It's available from \s-1CPAN\s0 and you also invoke +it with the \f(CW\*(C`\-d\*(C'\fR switch: +.PP +.Vb 1 +\& perl \-d:NYTProf some_perl.pl +.Ve +.PP +It creates a database of the profile information that you can turn into +reports. The \f(CW\*(C`nytprofhtml\*(C'\fR command turns the data into an \s-1HTML\s0 report +similar to the Devel::Cover report: +.PP +.Vb 1 +\& nytprofhtml +.Ve +.PP +You might also be interested in using the Benchmark to +measure and compare code snippets. +.PP +You can read more about profiling in \fIProgramming Perl\fR, chapter 20, +or \fIMastering Perl\fR, chapter 5. +.PP +perldebguts documents creating a custom debugger if you need to +create a special sort of profiler. brian d foy describes the process +in \fIThe Perl Journal\fR, \*(L"Creating a Perl Debugger\*(R", + , and \*(L"Profiling in Perl\*(R" + . +.PP +Perl.com has two interesting articles on profiling: \*(L"Profiling Perl\*(R", +by Simon Cozens, +and \*(L"Debugging and Profiling mod_perl Applications\*(R", by Frank Wiles, + . +.PP +Randal L. Schwartz writes about profiling in \*(L"Speeding up Your Perl +Programs\*(R" for \fIUnix Review\fR, + , and \*(L"Profiling +in Template Toolkit via Overriding\*(R" for \fILinux Magazine\fR, + . +.SS "How do I cross-reference my Perl programs?" +.IX Subsection "How do I cross-reference my Perl programs?" +The B::Xref module can be used to generate cross-reference reports +for Perl programs. +.PP +.Vb 1 +\& perl \-MO=Xref[,OPTIONS] scriptname.plx +.Ve +.SS "Is there a pretty-printer (formatter) for Perl?" +.IX Subsection "Is there a pretty-printer (formatter) for Perl?" +Perl::Tidy comes with a perl script perltidy which indents and +reformats Perl scripts to make them easier to read by trying to follow +the rules of the perlstyle. If you write Perl, or spend much time reading +Perl, you will probably find it useful. +.PP +Of course, if you simply follow the guidelines in perlstyle, +you shouldn't need to reformat. The habit of formatting your code +as you write it will help prevent bugs. Your editor can and should +help you with this. The perl-mode or newer cperl-mode for emacs +can provide remarkable amounts of help with most (but not all) +code, and even less programmable editors can provide significant +assistance. Tom Christiansen and many other \s-1VI\s0 users swear by +the following settings in vi and its clones: +.PP +.Vb 2 +\& set ai sw=4 +\& map! ^O {^M}^[O^T +.Ve +.PP +Put that in your \fI.exrc\fR file (replacing the caret characters +with control characters) and away you go. In insert mode, ^T is +for indenting, ^D is for undenting, and ^O is for blockdenting\*(--as +it were. A more complete example, with comments, can be found at + +.SS "Is there an \s-1IDE\s0 or Windows Perl Editor?" +.IX Subsection "Is there an IDE or Windows Perl Editor?" +Perl programs are just plain text, so any editor will do. +.PP +If you're on Unix, you already have an IDE\*(--Unix itself. The Unix +philosophy is the philosophy of several small tools that each do one +thing and do it well. It's like a carpenter's toolbox. +.PP +If you want an \s-1IDE,\s0 check the following (in alphabetical order, not +order of preference): +.IP "Eclipse" 4 +.IX Item "Eclipse" + +.Sp +The Eclipse Perl Integration Project integrates Perl +editing/debugging with Eclipse. +.IP "Enginsite" 4 +.IX Item "Enginsite" + +.Sp +Perl Editor by EngInSite is a complete integrated development +environment (\s-1IDE\s0) for creating, testing, and debugging Perl scripts; +the tool runs on Windows 9x/NT/2000/XP or later. +.IP "IntelliJ \s-1IDEA\s0" 4 +.IX Item "IntelliJ IDEA" + +.Sp +Camelcade plugin provides Perl5 support in IntelliJ \s-1IDEA\s0 and other JetBrains IDEs. +.IP "Kephra" 4 +.IX Item "Kephra" + +.Sp +\&\s-1GUI\s0 editor written in Perl using wxWidgets and Scintilla with lots of smaller features. +Aims for a \s-1UI\s0 based on Perl principles like \s-1TIMTOWTDI\s0 and \*(L"easy things should be easy, +hard things should be possible\*(R". +.IP "Komodo" 4 +.IX Item "Komodo" + +.Sp +ActiveState's cross-platform (as of October 2004, that's Windows, Linux, +and Solaris), multi-language \s-1IDE\s0 has Perl support, including a regular expression +debugger and remote debugging. +.IP "Notepad++" 4 +.IX Item "Notepad++" + +.IP "Open Perl \s-1IDE\s0" 4 +.IX Item "Open Perl IDE" + +.Sp +Open Perl \s-1IDE\s0 is an integrated development environment for writing +and debugging Perl scripts with ActiveState's ActivePerl distribution +under Windows 95/98/NT/2000. +.IP "OptiPerl" 4 +.IX Item "OptiPerl" + +.Sp +OptiPerl is a Windows \s-1IDE\s0 with simulated \s-1CGI\s0 environment, including +debugger and syntax-highlighting editor. +.IP "Padre" 4 +.IX Item "Padre" + +.Sp +Padre is cross-platform \s-1IDE\s0 for Perl written in Perl using wxWidgets to provide +a native look and feel. It's open source under the Artistic License. It +is one of the newer Perl IDEs. +.IP "PerlBuilder" 4 +.IX Item "PerlBuilder" + +.Sp +PerlBuilder is an integrated development environment for Windows that +supports Perl development. +.IP "visiPerl+" 4 +.IX Item "visiPerl+" + +.Sp +From Help Consulting, for Windows. +.IP "Visual Perl" 4 +.IX Item "Visual Perl" + +.Sp +Visual Perl is a Visual Studio.NET plug-in from ActiveState. +.IP "Zeus" 4 +.IX Item "Zeus" + +.Sp +Zeus for Windows is another Win32 multi-language editor/IDE +that comes with support for Perl. +.PP +For editors: if you're on Unix you probably have vi or a vi clone +already, and possibly an emacs too, so you may not need to download +anything. In any emacs the cperl-mode (M\-x cperl-mode) gives you +perhaps the best available Perl editing mode in any editor. +.PP +If you are using Windows, you can use any editor that lets you work +with plain text, such as NotePad or WordPad. Word processors, such as +Microsoft Word or WordPerfect, typically do not work since they insert +all sorts of behind-the-scenes information, although some allow you to +save files as \*(L"Text Only\*(R". You can also download text editors designed +specifically for programming, such as Textpad ( + ) and UltraEdit ( ), +among others. +.PP +If you are using MacOS, the same concerns apply. MacPerl (for Classic +environments) comes with a simple editor. Popular external editors are +BBEdit ( ) or Alpha ( + ). MacOS X users can use +Unix editors as well. +.IP "\s-1GNU\s0 Emacs" 4 +.IX Item "GNU Emacs" + +.IP "MicroEMACS" 4 +.IX Item "MicroEMACS" + +.IP "XEmacs" 4 +.IX Item "XEmacs" + +.IP "Jed" 4 +.IX Item "Jed" + +.PP +or a vi clone such as +.IP "Vim" 4 +.IX Item "Vim" + +.IP "Vile" 4 +.IX Item "Vile" + +.PP +The following are Win32 multilanguage editor/IDEs that support Perl: +.IP "MultiEdit" 4 +.IX Item "MultiEdit" + +.IP "SlickEdit" 4 +.IX Item "SlickEdit" + +.IP "ConTEXT" 4 +.IX Item "ConTEXT" + +.PP +There is also a toyedit Text widget based editor written in Perl +that is distributed with the Tk module on \s-1CPAN.\s0 The ptkdb +( ) is a Perl/Tk\-based debugger that +acts as a development environment of sorts. Perl Composer +( ) is an \s-1IDE\s0 for Perl/Tk +\&\s-1GUI\s0 creation. +.PP +In addition to an editor/IDE you might be interested in a more +powerful shell environment for Win32. Your options include +.IP "bash" 4 +.IX Item "bash" +from the Cygwin package ( ) +.IP "zsh" 4 +.IX Item "zsh" + +.PP +Cygwin is covered by the \s-1GNU\s0 General Public +License (but that shouldn't matter for Perl use). Cygwin +contains (in addition to the shell) a comprehensive set +of standard Unix toolkit utilities. +.IP "BBEdit and TextWrangler" 4 +.IX Item "BBEdit and TextWrangler" +are text editors for \s-1OS X\s0 that have a Perl sensitivity mode +( ). +.SS "Where can I get Perl macros for vi?" +.IX Subsection "Where can I get Perl macros for vi?" +For a complete version of Tom Christiansen's vi configuration file, +see , +the standard benchmark file for vi emulators. The file runs best with nvi, +the current version of vi out of Berkeley, which incidentally can be built +with an embedded Perl interpreter\*(--see . +.SS "Where can I get perl-mode or cperl-mode for emacs?" +.IX Xref "emacs" +.IX Subsection "Where can I get perl-mode or cperl-mode for emacs?" +Since Emacs version 19 patchlevel 22 or so, there have been both a +perl\-mode.el and support for the Perl debugger built in. These should +come with the standard Emacs 19 distribution. +.PP +Note that the perl-mode of emacs will have fits with \f(CW"main\*(Aqfoo"\fR +(single quote), and mess up the indentation and highlighting. You +are probably using \f(CW"main::foo"\fR in new Perl code anyway, so this +shouldn't be an issue. +.PP +For CPerlMode, see +.SS "How can I use curses with Perl?" +.IX Subsection "How can I use curses with Perl?" +The Curses module from \s-1CPAN\s0 provides a dynamically loadable object +module interface to a curses library. A small demo can be found at the +directory ; +this program repeats a command and updates the screen as needed, rendering +\&\fBrep ps axu\fR similar to \fBtop\fR. +.SS "How can I write a \s-1GUI\s0 (X, Tk, Gtk, etc.) in Perl?" +.IX Xref "GUI Tk Wx WxWidgets Gtk Gtk2 CamelBones Qt" +.IX Subsection "How can I write a GUI (X, Tk, Gtk, etc.) in Perl?" +(contributed by Ben Morrow) +.PP +There are a number of modules which let you write GUIs in Perl. Most +\&\s-1GUI\s0 toolkits have a perl interface: an incomplete list follows. +.IP "Tk" 4 +.IX Item "Tk" +This works under Unix and Windows, and the current version doesn't +look half as bad under Windows as it used to. Some of the gui elements +still don't 'feel' quite right, though. The interface is very natural +and 'perlish', making it easy to use in small scripts that just need a +simple gui. It hasn't been updated in a while. +.IP "Wx" 4 +.IX Item "Wx" +This is a Perl binding for the cross-platform wxWidgets toolkit +( ). It works under Unix, Win32 and Mac \s-1OS X,\s0 +using native widgets (Gtk under Unix). The interface follows the \*(C+ +interface closely, but the documentation is a little sparse for someone +who doesn't know the library, mostly just referring you to the \*(C+ +documentation. +.IP "Gtk and Gtk2" 4 +.IX Item "Gtk and Gtk2" +These are Perl bindings for the Gtk toolkit ( ). The +interface changed significantly between versions 1 and 2 so they have +separate Perl modules. It runs under Unix, Win32 and Mac \s-1OS X\s0 (currently +it requires an X server on Mac \s-1OS,\s0 but a 'native' port is underway), and +the widgets look the same on every platform: i.e., they don't match the +native widgets. As with Wx, the Perl bindings follow the C \s-1API\s0 closely, +and the documentation requires you to read the C documentation to +understand it. +.IP "Win32::GUI" 4 +.IX Item "Win32::GUI" +This provides access to most of the Win32 \s-1GUI\s0 widgets from Perl. +Obviously, it only runs under Win32, and uses native widgets. The Perl +interface doesn't really follow the C interface: it's been made more +Perlish, and the documentation is pretty good. More advanced stuff may +require familiarity with the C Win32 APIs, or reference to \s-1MSDN.\s0 +.IP "CamelBones" 4 +.IX Item "CamelBones" +CamelBones ( ) is a Perl interface to +Mac \s-1OS X\s0's Cocoa \s-1GUI\s0 toolkit, and as such can be used to produce native +GUIs on Mac \s-1OS X.\s0 It's not on \s-1CPAN,\s0 as it requires frameworks that +\&\s-1CPAN\s0.pm doesn't know how to install, but installation is via the +standard \s-1OSX\s0 package installer. The Perl \s-1API\s0 is, again, very close to +the ObjC \s-1API\s0 it's wrapping, and the documentation just tells you how to +translate from one to the other. +.IP "Qt" 4 +.IX Item "Qt" +There is a Perl interface to TrollTech's Qt toolkit, but it does not +appear to be maintained. +.IP "Athena" 4 +.IX Item "Athena" +Sx is an interface to the Athena widget set which comes with X, but +again it appears not to be much used nowadays. +.SS "How can I make my Perl program run faster?" +.IX Subsection "How can I make my Perl program run faster?" +The best way to do this is to come up with a better algorithm. This +can often make a dramatic difference. Jon Bentley's book +\&\fIProgramming Pearls\fR (that's not a misspelling!) has some good tips +on optimization, too. Advice on benchmarking boils down to: benchmark +and profile to make sure you're optimizing the right part, look for +better algorithms instead of microtuning your code, and when all else +fails consider just buying faster hardware. You will probably want to +read the answer to the earlier question \*(L"How do I profile my Perl +programs?\*(R" if you haven't done so already. +.PP +A different approach is to autoload seldom-used Perl code. See the +AutoSplit and AutoLoader modules in the standard distribution for +that. Or you could locate the bottleneck and think about writing just +that part in C, the way we used to take bottlenecks in C code and +write them in assembler. Similar to rewriting in C, modules that have +critical sections can be written in C (for instance, the \s-1PDL\s0 module +from \s-1CPAN\s0). +.PP +If you're currently linking your perl executable to a shared +\&\fIlibc.so\fR, you can often gain a 10\-25% performance benefit by +rebuilding it to link with a static libc.a instead. This will make a +bigger perl executable, but your Perl programs (and programmers) may +thank you for it. See the \fI\s-1INSTALL\s0\fR file in the source distribution +for more information. +.PP +The undump program was an ancient attempt to speed up Perl program by +storing the already-compiled form to disk. This is no longer a viable +option, as it only worked on a few architectures, and wasn't a good +solution anyway. +.SS "How can I make my Perl program take less memory?" +.IX Subsection "How can I make my Perl program take less memory?" +When it comes to time-space tradeoffs, Perl nearly always prefers to +throw memory at a problem. Scalars in Perl use more memory than +strings in C, arrays take more than that, and hashes use even more. While +there's still a lot to be done, recent releases have been addressing +these issues. For example, as of 5.004, duplicate hash keys are +shared amongst all hashes using them, so require no reallocation. +.PP +In some cases, using \fBsubstr()\fR or \fBvec()\fR to simulate arrays can be +highly beneficial. For example, an array of a thousand booleans will +take at least 20,000 bytes of space, but it can be turned into one +125\-byte bit vector\*(--a considerable memory savings. The standard +Tie::SubstrHash module can also help for certain types of data +structure. If you're working with specialist data structures +(matrices, for instance) modules that implement these in C may use +less memory than equivalent Perl modules. +.PP +Another thing to try is learning whether your Perl was compiled with +the system malloc or with Perl's builtin malloc. Whichever one it +is, try using the other one and see whether this makes a difference. +Information about malloc is in the \fI\s-1INSTALL\s0\fR file in the source +distribution. You can find out whether you are using perl's malloc by +typing \f(CW\*(C`perl \-V:usemymalloc\*(C'\fR. +.PP +Of course, the best way to save memory is to not do anything to waste +it in the first place. Good programming practices can go a long way +toward this: +.IP "Don't slurp!" 4 +.IX Item "Don't slurp!" +Don't read an entire file into memory if you can process it line +by line. Or more concretely, use a loop like this: +.Sp +.Vb 6 +\& # +\& # Good Idea +\& # +\& while (my $line = <$file_handle>) { +\& # ... +\& } +.Ve +.Sp +instead of this: +.Sp +.Vb 7 +\& # +\& # Bad Idea +\& # +\& my @data = <$file_handle>; +\& foreach (@data) { +\& # ... +\& } +.Ve +.Sp +When the files you're processing are small, it doesn't much matter which +way you do it, but it makes a huge difference when they start getting +larger. +.IP "Use map and grep selectively" 4 +.IX Item "Use map and grep selectively" +Remember that both map and grep expect a \s-1LIST\s0 argument, so doing this: +.Sp +.Vb 1 +\& @wanted = grep {/pattern/} <$file_handle>; +.Ve +.Sp +will cause the entire file to be slurped. For large files, it's better +to loop: +.Sp +.Vb 3 +\& while (<$file_handle>) { +\& push(@wanted, $_) if /pattern/; +\& } +.Ve +.IP "Avoid unnecessary quotes and stringification" 4 +.IX Item "Avoid unnecessary quotes and stringification" +Don't quote large strings unless absolutely necessary: +.Sp +.Vb 1 +\& my $copy = "$large_string"; +.Ve +.Sp +makes 2 copies of \f(CW$large_string\fR (one for \f(CW$copy\fR and another for the +quotes), whereas +.Sp +.Vb 1 +\& my $copy = $large_string; +.Ve +.Sp +only makes one copy. +.Sp +Ditto for stringifying large arrays: +.Sp +.Vb 4 +\& { +\& local $, = "\en"; +\& print @big_array; +\& } +.Ve +.Sp +is much more memory-efficient than either +.Sp +.Vb 1 +\& print join "\en", @big_array; +.Ve +.Sp +or +.Sp +.Vb 4 +\& { +\& local $" = "\en"; +\& print "@big_array"; +\& } +.Ve +.IP "Pass by reference" 4 +.IX Item "Pass by reference" +Pass arrays and hashes by reference, not by value. For one thing, it's +the only way to pass multiple lists or hashes (or both) in a single +call/return. It also avoids creating a copy of all the contents. This +requires some judgement, however, because any changes will be propagated +back to the original data. If you really want to mangle (er, modify) a +copy, you'll have to sacrifice the memory needed to make one. +.IP "Tie large variables to disk" 4 +.IX Item "Tie large variables to disk" +For \*(L"big\*(R" data stores (i.e. ones that exceed available memory) consider +using one of the \s-1DB\s0 modules to store it on disk instead of in \s-1RAM.\s0 This +will incur a penalty in access time, but that's probably better than +causing your hard disk to thrash due to massive swapping. +.SS "Is it safe to return a reference to local or lexical data?" +.IX Subsection "Is it safe to return a reference to local or lexical data?" +Yes. Perl's garbage collection system takes care of this so +everything works out right. +.PP +.Vb 4 +\& sub makeone { +\& my @a = ( 1 .. 10 ); +\& return \e@a; +\& } +\& +\& for ( 1 .. 10 ) { +\& push @many, makeone(); +\& } +\& +\& print $many[4][5], "\en"; +\& +\& print "@many\en"; +.Ve +.SS "How can I free an array or hash so my program shrinks?" +.IX Subsection "How can I free an array or hash so my program shrinks?" +(contributed by Michael Carman) +.PP +You usually can't. Memory allocated to lexicals (i.e. \fBmy()\fR variables) +cannot be reclaimed or reused even if they go out of scope. It is +reserved in case the variables come back into scope. Memory allocated +to global variables can be reused (within your program) by using +\&\fBundef()\fR and/or \fBdelete()\fR. +.PP +On most operating systems, memory allocated to a program can never be +returned to the system. That's why long-running programs sometimes re\- +exec themselves. Some operating systems (notably, systems that use +\&\fBmmap\fR\|(2) for allocating large chunks of memory) can reclaim memory that +is no longer used, but on such systems, perl must be configured and +compiled to use the \s-1OS\s0's malloc, not perl's. +.PP +In general, memory allocation and de-allocation isn't something you can +or should be worrying about much in Perl. +.PP +See also \*(L"How can I make my Perl program take less memory?\*(R" +.SS "How can I make my \s-1CGI\s0 script more efficient?" +.IX Subsection "How can I make my CGI script more efficient?" +Beyond the normal measures described to make general Perl programs +faster or smaller, a \s-1CGI\s0 program has additional issues. It may be run +several times per second. Given that each time it runs it will need +to be re-compiled and will often allocate a megabyte or more of system +memory, this can be a killer. Compiling into C \fBisn't going to help +you\fR because the process start-up overhead is where the bottleneck is. +.PP +There are three popular ways to avoid this overhead. One solution +involves running the Apache \s-1HTTP\s0 server (available from + ) with either of the mod_perl or mod_fastcgi +plugin modules. +.PP +With mod_perl and the Apache::Registry module (distributed with +mod_perl), httpd will run with an embedded Perl interpreter which +pre-compiles your script and then executes it within the same address +space without forking. The Apache extension also gives Perl access to +the internal server \s-1API,\s0 so modules written in Perl can do just about +anything a module written in C can. For more on mod_perl, see + +.PP +With the \s-1FCGI\s0 module (from \s-1CPAN\s0) and the mod_fastcgi +module (available from ) each of your Perl +programs becomes a permanent \s-1CGI\s0 daemon process. +.PP +Finally, Plack is a Perl module and toolkit that contains \s-1PSGI\s0 middleware, +helpers and adapters to web servers, allowing you to easily deploy scripts which +can continue running, and provides flexibility with regards to which web server +you use. It can allow existing \s-1CGI\s0 scripts to enjoy this flexibility and +performance with minimal changes, or can be used along with modern Perl web +frameworks to make writing and deploying web services with Perl a breeze. +.PP +These solutions can have far-reaching effects on your system and on the way you +write your \s-1CGI\s0 programs, so investigate them with care. +.PP +See also + . +.SS "How can I hide the source for my Perl program?" +.IX Subsection "How can I hide the source for my Perl program?" +Delete it. :\-) Seriously, there are a number of (mostly +unsatisfactory) solutions with varying levels of \*(L"security\*(R". +.PP +First of all, however, you \fIcan't\fR take away read permission, because +the source code has to be readable in order to be compiled and +interpreted. (That doesn't mean that a \s-1CGI\s0 script's source is +readable by people on the web, though\*(--only by people with access to +the filesystem.) So you have to leave the permissions at the socially +friendly 0755 level. +.PP +Some people regard this as a security problem. If your program does +insecure things and relies on people not knowing how to exploit those +insecurities, it is not secure. It is often possible for someone to +determine the insecure things and exploit them without viewing the +source. Security through obscurity, the name for hiding your bugs +instead of fixing them, is little security indeed. +.PP +You can try using encryption via source filters (Starting from Perl +5.8 the Filter::Simple and Filter::Util::Call modules are included in +the standard distribution), but any decent programmer will be able to +decrypt it. You can try using the byte code compiler and interpreter +described later in perlfaq3, but the curious might still be able to +de-compile it. You can try using the native-code compiler described +later, but crackers might be able to disassemble it. These pose +varying degrees of difficulty to people wanting to get at your code, +but none can definitively conceal it (true of every language, not just +Perl). +.PP +It is very easy to recover the source of Perl programs. You simply +feed the program to the perl interpreter and use the modules in +the B:: hierarchy. The B::Deparse module should be able to +defeat most attempts to hide source. Again, this is not +unique to Perl. +.PP +If you're concerned about people profiting from your code, then the +bottom line is that nothing but a restrictive license will give you +legal security. License your software and pepper it with threatening +statements like \*(L"This is unpublished proprietary software of \s-1XYZ\s0 Corp. +Your access to it does not give you permission to use it blah blah +blah.\*(R" We are not lawyers, of course, so you should see a lawyer if +you want to be sure your license's wording will stand up in court. +.SS "How can I compile my Perl program into byte code or C?" +.IX Subsection "How can I compile my Perl program into byte code or C?" +(contributed by brian d foy) +.PP +In general, you can't do this. There are some things that may work +for your situation though. People usually ask this question +because they want to distribute their works without giving away +the source code, and most solutions trade disk space for convenience. +You probably won't see much of a speed increase either, since most +solutions simply bundle a Perl interpreter in the final product +(but see \*(L"How can I make my Perl program run faster?\*(R"). +.PP +The Perl Archive Toolkit is Perl's analog to Java's \s-1JAR.\s0 It's freely +available and on \s-1CPAN\s0 ( ). +.PP +There are also some commercial products that may work for you, although +you have to buy a license for them. +.PP +The Perl Dev Kit ( ) +from ActiveState can \*(L"Turn your Perl programs into ready-to-run +executables for HP-UX, Linux, Solaris and Windows.\*(R" +.PP +Perl2Exe ( ) is a command line +program for converting perl scripts to executable files. It targets both +Windows and Unix platforms. +.ie n .SS "How can I get ""#!perl"" to work on [\s-1MS\-DOS,NT,...\s0]?" +.el .SS "How can I get \f(CW#!perl\fP to work on [\s-1MS\-DOS,NT,...\s0]?" +.IX Subsection "How can I get #!perl to work on [MS-DOS,NT,...]?" +For \s-1OS/2\s0 just use +.PP +.Vb 1 +\& extproc perl \-S \-your_switches +.Ve +.PP +as 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 +\&\*(L"extproc\*(R" handling). For \s-1DOS\s0 one should first invent a corresponding +batch file and codify it in \f(CW\*(C`ALTERNATE_SHEBANG\*(C'\fR (see the +\&\fIdosish.h\fR file in the source distribution for more information). +.PP +The Win95/NT installation, when using the ActiveState port of Perl, +will modify the Registry to associate the \f(CW\*(C`.pl\*(C'\fR extension with the +perl interpreter. If you install another port, perhaps even building +your own Win95/NT Perl from the standard sources by using a Windows port +of gcc (e.g., with cygwin or mingw32), then you'll have to modify +the Registry yourself. In addition to associating \f(CW\*(C`.pl\*(C'\fR with the +interpreter, \s-1NT\s0 people can use: \f(CW\*(C`SET PATHEXT=%PATHEXT%;.PL\*(C'\fR to let them +run the program \f(CW\*(C`install\-linux.pl\*(C'\fR merely by typing \f(CW\*(C`install\-linux\*(C'\fR. +.PP +Under \*(L"Classic\*(R" MacOS, a perl program will have the appropriate Creator and +Type, so that double-clicking them will invoke the MacPerl application. +Under Mac \s-1OS X,\s0 clickable apps can be made from any \f(CW\*(C`#!\*(C'\fR script using Wil +Sanchez' DropScript utility: . +.PP +\&\fI\s-1IMPORTANT\s0!\fR: Whatever you do, \s-1PLEASE\s0 don't get frustrated, and just +throw the perl interpreter into your cgi-bin directory, in order to +get your programs working for a web server. This is an \s-1EXTREMELY\s0 big +security risk. Take the time to figure out how to do it correctly. +.SS "Can I write useful Perl programs on the command line?" +.IX Subsection "Can I write useful Perl programs on the command line?" +Yes. Read perlrun for more information. Some examples follow. +(These assume standard Unix shell quoting rules.) +.PP +.Vb 2 +\& # sum first and last fields +\& perl \-lane \*(Aqprint $F[0] + $F[\-1]\*(Aq * +\& +\& # identify text files +\& perl \-le \*(Aqfor(@ARGV) {print if \-f && \-T _}\*(Aq * +\& +\& # remove (most) comments from C program +\& perl \-0777 \-pe \*(Aqs{/\e*.*?\e*/}{}gs\*(Aq foo.c +\& +\& # make file a month younger than today, defeating reaper daemons +\& perl \-e \*(Aq$X=24*60*60; utime(time(),time() + 30 * $X,@ARGV)\*(Aq * +\& +\& # find first unused uid +\& perl \-le \*(Aq$i++ while getpwuid($i); print $i\*(Aq +\& +\& # display reasonable manpath +\& echo $PATH | perl \-nl \-072 \-e \*(Aq +\& s![^/+]*$!man!&&\-d&&!$s{$_}++&&push@m,$_;END{print"@m"}\*(Aq +.Ve +.PP +\&\s-1OK,\s0 the last one was actually an Obfuscated Perl Contest entry. :\-) +.SS "Why don't Perl one-liners work on my DOS/Mac/VMS system?" +.IX Subsection "Why don't Perl one-liners work on my DOS/Mac/VMS system?" +The problem is usually that the command interpreters on those systems +have rather different ideas about quoting than the Unix shells under +which the one-liners were created. On some systems, you may have to +change single-quotes to double ones, which you must \fI\s-1NOT\s0\fR do on Unix +or Plan9 systems. You might also have to change a single % to a %%. +.PP +For example: +.PP +.Vb 2 +\& # Unix (including Mac OS X) +\& perl \-e \*(Aqprint "Hello world\en"\*(Aq +\& +\& # DOS, etc. +\& perl \-e "print \e"Hello world\en\e"" +\& +\& # Mac Classic +\& print "Hello world\en" +\& (then Run "Myscript" or Shift\-Command\-R) +\& +\& # MPW +\& perl \-e \*(Aqprint "Hello world\en"\*(Aq +\& +\& # VMS +\& perl \-e "print ""Hello world\en""" +.Ve +.PP +The problem is that none of these examples are reliable: they depend on the +command interpreter. Under Unix, the first two often work. Under \s-1DOS,\s0 +it's entirely possible that neither works. If 4DOS was the command shell, +you'd probably have better luck like this: +.PP +.Vb 1 +\& perl \-e "print "Hello world\en"" +.Ve +.PP +Under the Mac, it depends which environment you are using. The MacPerl +shell, or \s-1MPW,\s0 is much like Unix shells in its support for several +quoting variants, except that it makes free use of the Mac's non-ASCII +characters as control characters. +.PP +Using \fBqq()\fR, q(), and \fBqx()\fR, instead of \*(L"double quotes\*(R", 'single +quotes', and `backticks`, may make one-liners easier to write. +.PP +There is no general solution to all of this. It is a mess. +.PP +[Some of this answer was contributed by Kenneth Albanowski.] +.SS "Where can I learn about \s-1CGI\s0 or Web programming in Perl?" +.IX Subsection "Where can I learn about CGI or Web programming in Perl?" +For modules, get the \s-1CGI\s0 or \s-1LWP\s0 modules from \s-1CPAN.\s0 For textbooks, +see the two especially dedicated to web stuff in the question on +books. For problems and questions related to the web, like \*(L"Why +do I get 500 Errors\*(R" or \*(L"Why doesn't it run from the browser right +when it runs fine on the command line\*(R", see the troubleshooting +guides and references in perlfaq9 or in the \s-1CGI\s0 MetaFAQ: +.PP +.Vb 1 +\& L +.Ve +.PP +Looking into and modern Perl web frameworks is highly recommended, +though; web programming in Perl has evolved a long way from the old days of +simple \s-1CGI\s0 scripts. +.SS "Where can I learn about object-oriented Perl programming?" +.IX Subsection "Where can I learn about object-oriented Perl programming?" +A good place to start is perlootut, and you can use perlobj for +reference. +.PP +A good book on \s-1OO\s0 on Perl is the \*(L"Object-Oriented Perl\*(R" +by Damian Conway from Manning Publications, or \*(L"Intermediate Perl\*(R" +by Randal Schwartz, brian d foy, and Tom Phoenix from O'Reilly Media. +.SS "Where can I learn about linking C with Perl?" +.IX Subsection "Where can I learn about linking C with Perl?" +If you want to call C from Perl, start with perlxstut, +moving on to perlxs, xsubpp, and perlguts. If you want to +call Perl from C, then read perlembed, perlcall, and +perlguts. Don't forget that you can learn a lot from looking at +how the authors of existing extension modules wrote their code and +solved their problems. +.PP +You might not need all the power of \s-1XS.\s0 The Inline::C module lets +you put C code directly in your Perl source. It handles all the +magic to make it work. You still have to learn at least some of +the perl \s-1API\s0 but you won't have to deal with the complexity of the +\&\s-1XS\s0 support files. +.SS "I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong?" +.IX Subsection "I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong?" +Download the ExtUtils::Embed kit from \s-1CPAN\s0 and run `make test'. If +the tests pass, read the pods again and again and again. If they +fail, submit a bug report to +with the output of +\&\f(CW\*(C`make test TEST_VERBOSE=1\*(C'\fR along with \f(CW\*(C`perl \-V\*(C'\fR. +.SS "When I tried to run my script, I got this message. What does it mean?" +.IX Subsection "When I tried to run my script, I got this message. What does it mean?" +A complete list of Perl's error messages and warnings with explanatory +text can be found in perldiag. You can also use the splain program +(distributed with Perl) to explain the error messages: +.PP +.Vb 2 +\& perl program 2>diag.out +\& splain [\-v] [\-p] diag.out +.Ve +.PP +or change your program to explain the messages for you: +.PP +.Vb 1 +\& use diagnostics; +.Ve +.PP +or +.PP +.Vb 1 +\& use diagnostics \-verbose; +.Ve +.SS "What's MakeMaker?" +.IX Subsection "What's MakeMaker?" +(contributed by brian d foy) +.PP +The ExtUtils::MakeMaker module, better known simply as \*(L"MakeMaker\*(R", +turns a Perl script, typically called \f(CW\*(C`Makefile.PL\*(C'\fR, into a Makefile. +The Unix tool \f(CW\*(C`make\*(C'\fR uses this file to manage dependencies and actions +to process and install a Perl distribution. +.SH "AUTHOR AND COPYRIGHT" +.IX Header "AUTHOR AND COPYRIGHT" +Copyright (c) 1997\-2010 Tom Christiansen, Nathan Torkington, and +other authors as noted. All rights reserved. +.PP +This documentation is free; you can redistribute it and/or modify it +under the same terms as Perl itself. +.PP +Irrespective of its distribution, all code examples here are in the public +domain. You are permitted and encouraged to use this code and any +derivatives thereof in your own programs for fun or for profit as you +see fit. A simple comment in the code giving credit to the \s-1FAQ\s0 would +be courteous but is not required. diff --git a/data/miniconda3/man/man1/perlfaq8.1 b/data/miniconda3/man/man1/perlfaq8.1 new file mode 100644 index 0000000000000000000000000000000000000000..b91d28b02644a35c49c86956d3b3c7f9ac5086e5 --- /dev/null +++ b/data/miniconda3/man/man1/perlfaq8.1 @@ -0,0 +1,1659 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLFAQ8 1" +.TH PERLFAQ8 1 "2020-12-18" "perl v5.32.1" "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" +perlfaq8 \- System Interaction +.SH "VERSION" +.IX Header "VERSION" +version 5.20200523 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This section of the Perl \s-1FAQ\s0 covers questions involving operating +system interaction. Topics include interprocess communication (\s-1IPC\s0), +control over the user-interface (keyboard, screen and pointing +devices), and most anything else not related to data manipulation. +.PP +Read the FAQs and documentation specific to the port of perl to your +operating system (eg, perlvms, perlplan9, ...). These should +contain more detailed information on the vagaries of your perl. +.SS "How do I find out which operating system I'm running under?" +.IX Subsection "How do I find out which operating system I'm running under?" +The \f(CW$^O\fR variable (\f(CW$OSNAME\fR if you use \f(CW\*(C`English\*(C'\fR) contains an +indication of the name of the operating system (not its release +number) that your perl binary was built for. +.SS "How come \fBexec()\fP doesn't return?" +.IX Xref "exec system fork open pipe" +.IX Subsection "How come exec() doesn't return?" +(contributed by brian d foy) +.PP +The \f(CW\*(C`exec\*(C'\fR function's job is to turn your process into another +command and never to return. If that's not what you want to do, don't +use \f(CW\*(C`exec\*(C'\fR. :) +.PP +If you want to run an external command and still keep your Perl process +going, look at a piped \f(CW\*(C`open\*(C'\fR, \f(CW\*(C`fork\*(C'\fR, or \f(CW\*(C`system\*(C'\fR. +.SS "How do I do fancy stuff with the keyboard/screen/mouse?" +.IX Subsection "How do I do fancy stuff with the keyboard/screen/mouse?" +How you access/control keyboards, screens, and pointing devices +(\*(L"mice\*(R") is system-dependent. Try the following modules: +.IP "Keyboard" 4 +.IX Item "Keyboard" +.Vb 5 +\& Term::Cap Standard perl distribution +\& Term::ReadKey CPAN +\& Term::ReadLine::Gnu CPAN +\& Term::ReadLine::Perl CPAN +\& Term::Screen CPAN +.Ve +.IP "Screen" 4 +.IX Item "Screen" +.Vb 3 +\& Term::Cap Standard perl distribution +\& Curses CPAN +\& Term::ANSIColor CPAN +.Ve +.IP "Mouse" 4 +.IX Item "Mouse" +.Vb 4 +\& Tk CPAN +\& Wx CPAN +\& Gtk2 CPAN +\& Qt4 kdebindings4 package +.Ve +.PP +Some of these specific cases are shown as examples in other answers +in this section of the perlfaq. +.SS "How do I print something out in color?" +.IX Subsection "How do I print something out in color?" +In general, you don't, because you don't know whether +the recipient has a color-aware display device. If you +know that they have an \s-1ANSI\s0 terminal that understands +color, you can use the Term::ANSIColor module from \s-1CPAN:\s0 +.PP +.Vb 3 +\& use Term::ANSIColor; +\& print color("red"), "Stop!\en", color("reset"); +\& print color("green"), "Go!\en", color("reset"); +.Ve +.PP +Or like this: +.PP +.Vb 3 +\& use Term::ANSIColor qw(:constants); +\& print RED, "Stop!\en", RESET; +\& print GREEN, "Go!\en", RESET; +.Ve +.SS "How do I read just one key without waiting for a return key?" +.IX Subsection "How do I read just one key without waiting for a return key?" +Controlling input buffering is a remarkably system-dependent matter. +On many systems, you can just use the \fBstty\fR command as shown in +\&\*(L"getc\*(R" in perlfunc, but as you see, that's already getting you into +portability snags. +.PP +.Vb 6 +\& open(TTY, "+/dev/tty 2>&1"; +\& $key = getc(TTY); # perhaps this works +\& # OR ELSE +\& sysread(TTY, $key, 1); # probably this does +\& system "stty \-cbreak /dev/tty 2>&1"; +.Ve +.PP +The Term::ReadKey module from \s-1CPAN\s0 offers an easy-to-use interface that +should be more efficient than shelling out to \fBstty\fR for each key. +It even includes limited support for Windows. +.PP +.Vb 4 +\& use Term::ReadKey; +\& ReadMode(\*(Aqcbreak\*(Aq); +\& $key = ReadKey(0); +\& ReadMode(\*(Aqnormal\*(Aq); +.Ve +.PP +However, using the code requires that you have a working C compiler +and can use it to build and install a \s-1CPAN\s0 module. Here's a solution +using the standard \s-1POSIX\s0 module, which is already on your system +(assuming your system supports \s-1POSIX\s0). +.PP +.Vb 2 +\& use HotKey; +\& $key = readkey(); +.Ve +.PP +And here's the \f(CW\*(C`HotKey\*(C'\fR module, which hides the somewhat mystifying calls +to manipulate the \s-1POSIX\s0 termios structures. +.PP +.Vb 2 +\& # HotKey.pm +\& package HotKey; +\& +\& use strict; +\& use warnings; +\& +\& use parent \*(AqExporter\*(Aq; +\& our @EXPORT = qw(cbreak cooked readkey); +\& +\& use POSIX qw(:termios_h); +\& my ($term, $oterm, $echo, $noecho, $fd_stdin); +\& +\& $fd_stdin = fileno(STDIN); +\& $term = POSIX::Termios\->new(); +\& $term\->getattr($fd_stdin); +\& $oterm = $term\->getlflag(); +\& +\& $echo = ECHO | ECHOK | ICANON; +\& $noecho = $oterm & ~$echo; +\& +\& sub cbreak { +\& $term\->setlflag($noecho); # ok, so i don\*(Aqt want echo either +\& $term\->setcc(VTIME, 1); +\& $term\->setattr($fd_stdin, TCSANOW); +\& } +\& +\& sub cooked { +\& $term\->setlflag($oterm); +\& $term\->setcc(VTIME, 0); +\& $term\->setattr($fd_stdin, TCSANOW); +\& } +\& +\& sub readkey { +\& my $key = \*(Aq\*(Aq; +\& cbreak(); +\& sysread(STDIN, $key, 1); +\& cooked(); +\& return $key; +\& } +\& +\& END { cooked() } +\& +\& 1; +.Ve +.SS "How do I check whether input is ready on the keyboard?" +.IX Subsection "How do I check whether input is ready on the keyboard?" +The easiest way to do this is to read a key in nonblocking mode with the +Term::ReadKey module from \s-1CPAN,\s0 passing it an argument of \-1 to indicate +not to block: +.PP +.Vb 1 +\& use Term::ReadKey; +\& +\& ReadMode(\*(Aqcbreak\*(Aq); +\& +\& if (defined (my $char = ReadKey(\-1)) ) { +\& # input was waiting and it was $char +\& } else { +\& # no input was waiting +\& } +\& +\& ReadMode(\*(Aqnormal\*(Aq); # restore normal tty settings +.Ve +.SS "How do I clear the screen?" +.IX Subsection "How do I clear the screen?" +(contributed by brian d foy) +.PP +To clear the screen, you just have to print the special sequence +that tells the terminal to clear the screen. Once you have that +sequence, output it when you want to clear the screen. +.PP +You can use the Term::ANSIScreen module to get the special +sequence. Import the \f(CW\*(C`cls\*(C'\fR function (or the \f(CW\*(C`:screen\*(C'\fR tag): +.PP +.Vb 2 +\& use Term::ANSIScreen qw(cls); +\& my $clear_screen = cls(); +\& +\& print $clear_screen; +.Ve +.PP +The Term::Cap module can also get the special sequence if you want +to deal with the low-level details of terminal control. The \f(CW\*(C`Tputs\*(C'\fR +method returns the string for the given capability: +.PP +.Vb 1 +\& use Term::Cap; +\& +\& my $terminal = Term::Cap\->Tgetent( { OSPEED => 9600 } ); +\& my $clear_screen = $terminal\->Tputs(\*(Aqcl\*(Aq); +\& +\& print $clear_screen; +.Ve +.PP +On Windows, you can use the Win32::Console module. After creating +an object for the output filehandle you want to affect, call the +\&\f(CW\*(C`Cls\*(C'\fR method: +.PP +.Vb 1 +\& Win32::Console; +\& +\& my $OUT = Win32::Console\->new(STD_OUTPUT_HANDLE); +\& my $clear_string = $OUT\->Cls; +\& +\& print $clear_screen; +.Ve +.PP +If you have a command-line program that does the job, you can call +it in backticks to capture whatever it outputs so you can use it +later: +.PP +.Vb 1 +\& my $clear_string = \`clear\`; +\& +\& print $clear_string; +.Ve +.SS "How do I get the screen size?" +.IX Subsection "How do I get the screen size?" +If you have Term::ReadKey module installed from \s-1CPAN,\s0 +you can use it to fetch the width and height in characters +and in pixels: +.PP +.Vb 2 +\& use Term::ReadKey; +\& my ($wchar, $hchar, $wpixels, $hpixels) = GetTerminalSize(); +.Ve +.PP +This is more portable than the raw \f(CW\*(C`ioctl\*(C'\fR, but not as +illustrative: +.PP +.Vb 10 +\& require \*(Aq./sys/ioctl.ph\*(Aq; +\& die "no TIOCGWINSZ " unless defined &TIOCGWINSZ; +\& open(my $tty_fh, "+autoflush(1); +.Ve +.Sp +As mentioned in the previous item, this still doesn't work when using +socket I/O between Unix and Macintosh. You'll need to hard code your +line terminators, in that case. +.IP "non-blocking input" 4 +.IX Item "non-blocking input" +If you are doing a blocking \f(CW\*(C`read()\*(C'\fR or \f(CW\*(C`sysread()\*(C'\fR, you'll have to +arrange for an alarm handler to provide a timeout (see +\&\*(L"alarm\*(R" in perlfunc). If you have a non-blocking open, you'll likely +have a non-blocking read, which means you may have to use a 4\-arg +\&\f(CW\*(C`select()\*(C'\fR to determine whether I/O is ready on that device (see +\&\*(L"select\*(R" in perlfunc. +.PP +While trying to read from his caller-id box, the notorious Jamie +Zawinski \f(CW\*(C`\*(C'\fR, after much gnashing of teeth and +fighting with \f(CW\*(C`sysread\*(C'\fR, \f(CW\*(C`sysopen\*(C'\fR, \s-1POSIX\s0's \f(CW\*(C`tcgetattr\*(C'\fR business, +and various other functions that go bump in the night, finally came up +with this: +.PP +.Vb 10 +\& sub open_modem { +\& use IPC::Open2; +\& my $stty = \`/bin/stty \-g\`; +\& open2( \e*MODEM_IN, \e*MODEM_OUT, "cu \-l$modem_device \-s2400 2>&1"); +\& # starting cu hoses /dev/tty\*(Aqs stty settings, even when it has +\& # been opened on a pipe... +\& system("/bin/stty $stty"); +\& $_ = ; +\& chomp; +\& if ( !m/^Connected/ ) { +\& print STDERR "$0: cu printed \`$_\*(Aq instead of \`Connected\*(Aq\en"; +\& } +\& } +.Ve +.SS "How do I decode encrypted password files?" +.IX Subsection "How do I decode encrypted password files?" +You spend lots and lots of money on dedicated hardware, but this is +bound to get you talked about. +.PP +Seriously, you can't if they are Unix password files\*(--the Unix +password system employs one-way encryption. It's more like hashing +than encryption. The best you can do is check whether something else +hashes to the same string. You can't turn a hash back into the +original string. Programs like Crack can forcibly (and intelligently) +try to guess passwords, but don't (can't) guarantee quick success. +.PP +If you're worried about users selecting bad passwords, you should +proactively check when they try to change their password (by modifying +\&\fBpasswd\fR\|(1), for example). +.SS "How do I start a process in the background?" +.IX Subsection "How do I start a process in the background?" +(contributed by brian d foy) +.PP +There's not a single way to run code in the background so you don't +have to wait for it to finish before your program moves on to other +tasks. Process management depends on your particular operating system, +and many of the techniques are covered in perlipc. +.PP +Several \s-1CPAN\s0 modules may be able to help, including IPC::Open2 or +IPC::Open3, IPC::Run, Parallel::Jobs, +Parallel::ForkManager, \s-1POE\s0, Proc::Background, and +Win32::Process. There are many other modules you might use, so +check those namespaces for other options too. +.PP +If you are on a Unix-like system, you might be able to get away with a +system call where you put an \f(CW\*(C`&\*(C'\fR on the end of the command: +.PP +.Vb 1 +\& system("cmd &") +.Ve +.PP +You can also try using \f(CW\*(C`fork\*(C'\fR, as described in perlfunc (although +this is the same thing that many of the modules will do for you). +.IP "\s-1STDIN, STDOUT,\s0 and \s-1STDERR\s0 are shared" 4 +.IX Item "STDIN, STDOUT, and STDERR are shared" +Both the main process and the backgrounded one (the \*(L"child\*(R" process) +share the same \s-1STDIN, STDOUT\s0 and \s-1STDERR\s0 filehandles. If both try to +access them at once, strange things can happen. You may want to close +or reopen these for the child. You can get around this with +\&\f(CW\*(C`open\*(C'\fRing a pipe (see \*(L"open\*(R" in perlfunc) but on some systems this +means that the child process cannot outlive the parent. +.IP "Signals" 4 +.IX Item "Signals" +You'll have to catch the \s-1SIGCHLD\s0 signal, and possibly \s-1SIGPIPE\s0 too. +\&\s-1SIGCHLD\s0 is sent when the backgrounded process finishes. \s-1SIGPIPE\s0 is +sent when you write to a filehandle whose child process has closed (an +untrapped \s-1SIGPIPE\s0 can cause your program to silently die). This is +not an issue with \f(CW\*(C`system("cmd&")\*(C'\fR. +.IP "Zombies" 4 +.IX Item "Zombies" +You have to be prepared to \*(L"reap\*(R" the child process when it finishes. +.Sp +.Vb 1 +\& $SIG{CHLD} = sub { wait }; +\& +\& $SIG{CHLD} = \*(AqIGNORE\*(Aq; +.Ve +.Sp +You can also use a double fork. You immediately \f(CW\*(C`wait()\*(C'\fR for your +first child, and the init daemon will \f(CW\*(C`wait()\*(C'\fR for your grandchild once +it exits. +.Sp +.Vb 8 +\& unless ($pid = fork) { +\& unless (fork) { +\& exec "what you really wanna do"; +\& die "exec failed!"; +\& } +\& exit 0; +\& } +\& waitpid($pid, 0); +.Ve +.Sp +See \*(L"Signals\*(R" in perlipc for other examples of code to do this. +Zombies are not an issue with \f(CW\*(C`system("prog &")\*(C'\fR. +.SS "How do I trap control characters/signals?" +.IX Subsection "How do I trap control characters/signals?" +You don't actually \*(L"trap\*(R" a control character. Instead, that character +generates a signal which is sent to your terminal's currently +foregrounded process group, which you then trap in your process. +Signals are documented in \*(L"Signals\*(R" in perlipc and the +section on \*(L"Signals\*(R" in the Camel. +.PP +You can set the values of the \f(CW%SIG\fR hash to be the functions you want +to handle the signal. After perl catches the signal, it looks in \f(CW%SIG\fR +for a key with the same name as the signal, then calls the subroutine +value for that key. +.PP +.Vb 1 +\& # as an anonymous subroutine +\& +\& $SIG{INT} = sub { syswrite(STDERR, "ouch\en", 5 ) }; +\& +\& # or a reference to a function +\& +\& $SIG{INT} = \e&ouch; +\& +\& # or the name of the function as a string +\& +\& $SIG{INT} = "ouch"; +.Ve +.PP +Perl versions before 5.8 had in its C source code signal handlers which +would catch the signal and possibly run a Perl function that you had set +in \f(CW%SIG\fR. This violated the rules of signal handling at that level +causing perl to dump core. Since version 5.8.0, perl looks at \f(CW%SIG\fR +\&\fBafter\fR the signal has been caught, rather than while it is being caught. +Previous versions of this answer were incorrect. +.SS "How do I modify the shadow password file on a Unix system?" +.IX Subsection "How do I modify the shadow password file on a Unix system?" +If perl was installed correctly and your shadow library was written +properly, the \f(CW\*(C`getpw*()\*(C'\fR functions described in perlfunc should in +theory provide (read-only) access to entries in the shadow password +file. To change the file, make a new shadow password file (the format +varies from system to system\*(--see \fBpasswd\fR\|(1) for specifics) and use +\&\f(CWpwd_mkdb(8)\fR to install it (see \fBpwd_mkdb\fR\|(8) for more details). +.SS "How do I set the time and date?" +.IX Subsection "How do I set the time and date?" +Assuming you're running under sufficient permissions, you should be +able to set the system-wide date and time by running the \f(CWdate(1)\fR +program. (There is no way to set the time and date on a per-process +basis.) This mechanism will work for Unix, MS-DOS, Windows, and \s-1NT\s0; +the \s-1VMS\s0 equivalent is \f(CW\*(C`set time\*(C'\fR. +.PP +However, if all you want to do is change your time zone, you can +probably get away with setting an environment variable: +.PP +.Vb 3 +\& $ENV{TZ} = "MST7MDT"; # Unixish +\& $ENV{\*(AqSYS$TIMEZONE_DIFFERENTIAL\*(Aq}="\-5" # vms +\& system(\*(Aqtrn\*(Aq, \*(Aqcomp.lang.perl.misc\*(Aq); +.Ve +.SS "How can I \fBsleep()\fP or \fBalarm()\fP for under a second?" +.IX Xref "Time::HiRes BSD::Itimer sleep select" +.IX Subsection "How can I sleep() or alarm() for under a second?" +If you want finer granularity than the 1 second that the \f(CW\*(C`sleep()\*(C'\fR +function provides, the easiest way is to use the \f(CW\*(C`select()\*(C'\fR function as +documented in \*(L"select\*(R" in perlfunc. Try the Time::HiRes and +the BSD::Itimer modules (available from \s-1CPAN,\s0 and starting from +Perl 5.8 Time::HiRes is part of the standard distribution). +.SS "How can I measure time under a second?" +.IX Xref "Time::HiRes BSD::Itimer sleep select" +.IX Subsection "How can I measure time under a second?" +(contributed by brian d foy) +.PP +The Time::HiRes module (part of the standard distribution as of +Perl 5.8) measures time with the \f(CW\*(C`gettimeofday()\*(C'\fR system call, which +returns the time in microseconds since the epoch. If you can't install +Time::HiRes for older Perls and you are on a Unixish system, you +may be able to call \f(CWgettimeofday(2)\fR directly. See +\&\*(L"syscall\*(R" in perlfunc. +.SS "How can I do an \fBatexit()\fP or \fBsetjmp()\fP/\fBlongjmp()\fP? (Exception handling)" +.IX Subsection "How can I do an atexit() or setjmp()/longjmp()? (Exception handling)" +You can use the \f(CW\*(C`END\*(C'\fR block to simulate \f(CW\*(C`atexit()\*(C'\fR. Each package's +\&\f(CW\*(C`END\*(C'\fR block is called when the program or thread ends. See the perlmod +manpage for more details about \f(CW\*(C`END\*(C'\fR blocks. +.PP +For example, you can use this to make sure your filter program managed +to finish its output without filling up the disk: +.PP +.Vb 3 +\& END { +\& close(STDOUT) || die "stdout close failed: $!"; +\& } +.Ve +.PP +The \f(CW\*(C`END\*(C'\fR block isn't called when untrapped signals kill the program, +though, so if you use \f(CW\*(C`END\*(C'\fR blocks you should also use +.PP +.Vb 1 +\& use sigtrap qw(die normal\-signals); +.Ve +.PP +Perl's exception-handling mechanism is its \f(CW\*(C`eval()\*(C'\fR operator. You +can use \f(CW\*(C`eval()\*(C'\fR as \f(CW\*(C`setjmp\*(C'\fR and \f(CW\*(C`die()\*(C'\fR as \f(CW\*(C`longjmp\*(C'\fR. For +details of this, see the section on signals, especially the time-out +handler for a blocking \f(CW\*(C`flock()\*(C'\fR in \*(L"Signals\*(R" in perlipc or the +section on \*(L"Signals\*(R" in \fIProgramming Perl\fR. +.PP +If exception handling is all you're interested in, use one of the +many \s-1CPAN\s0 modules that handle exceptions, such as Try::Tiny. +.PP +If you want the \f(CW\*(C`atexit()\*(C'\fR syntax (and an \f(CW\*(C`rmexit()\*(C'\fR as well), try the +\&\f(CW\*(C`AtExit\*(C'\fR module available from \s-1CPAN.\s0 +.ie n .SS "Why doesn't my sockets program work under System V (Solaris)? What does the error message ""Protocol not supported"" mean?" +.el .SS "Why doesn't my sockets program work under System V (Solaris)? What does the error message ``Protocol not supported'' mean?" +.IX Subsection "Why doesn't my sockets program work under System V (Solaris)? What does the error message Protocol not supported mean?" +Some Sys-V based systems, notably Solaris 2.X, redefined some of the +standard socket constants. Since these were constant across all +architectures, they were often hardwired into perl code. The proper +way to deal with this is to \*(L"use Socket\*(R" to get the correct values. +.PP +Note that even though SunOS and Solaris are binary compatible, these +values are different. Go figure. +.SS "How can I call my system's unique C functions from Perl?" +.IX Subsection "How can I call my system's unique C functions from Perl?" +In most cases, you write an external module to do it\*(--see the answer +to \*(L"Where can I learn about linking C with Perl? [h2xs, xsubpp]\*(R". +However, if the function is a system call, and your system supports +\&\f(CW\*(C`syscall()\*(C'\fR, you can use the \f(CW\*(C`syscall\*(C'\fR function (documented in +perlfunc). +.PP +Remember to check the modules that came with your distribution, and +\&\s-1CPAN\s0 as well\*(--someone may already have written a module to do it. On +Windows, try Win32::API. On Macs, try Mac::Carbon. If no module +has an interface to the C function, you can inline a bit of C in your +Perl source with Inline::C. +.SS "Where do I get the include files to do \fBioctl()\fP or \fBsyscall()\fP?" +.IX Subsection "Where do I get the include files to do ioctl() or syscall()?" +Historically, these would be generated by the h2ph tool, part of the +standard perl distribution. This program converts \f(CWcpp(1)\fR directives +in C header files to files containing subroutine definitions, like +\&\f(CW\*(C`SYS_getitimer()\*(C'\fR, which you can use as arguments to your functions. +It doesn't work perfectly, but it usually gets most of the job done. +Simple files like \fIerrno.h\fR, \fIsyscall.h\fR, and \fIsocket.h\fR were fine, +but the hard ones like \fIioctl.h\fR nearly always need to be hand-edited. +Here's how to install the *.ph files: +.PP +.Vb 3 +\& 1. Become the super\-user +\& 2. cd /usr/include +\& 3. h2ph *.h */*.h +.Ve +.PP +If your system supports dynamic loading, for reasons of portability and +sanity you probably ought to use h2xs (also part of the standard perl +distribution). This tool converts C header files to Perl extensions. +See perlxstut for how to get started with h2xs. +.PP +If your system doesn't support dynamic loading, you still probably +ought to use h2xs. See perlxstut and ExtUtils::MakeMaker for +more information (in brief, just use \fBmake perl\fR instead of a plain +\&\fBmake\fR to rebuild perl with a new static extension). +.SS "Why do setuid perl scripts complain about kernel problems?" +.IX Subsection "Why do setuid perl scripts complain about kernel problems?" +Some operating systems have bugs in the kernel that make setuid +scripts inherently insecure. Perl gives you a number of options +(described in perlsec) to work around such systems. +.SS "How can I open a pipe both to and from a command?" +.IX Subsection "How can I open a pipe both to and from a command?" +The IPC::Open2 module (part of the standard perl distribution) is +an easy-to-use approach that internally uses \f(CW\*(C`pipe()\*(C'\fR, \f(CW\*(C`fork()\*(C'\fR, and +\&\f(CW\*(C`exec()\*(C'\fR to do the job. Make sure you read the deadlock warnings in +its documentation, though (see IPC::Open2). See +\&\*(L"Bidirectional Communication with Another Process\*(R" in perlipc and +\&\*(L"Bidirectional Communication with Yourself\*(R" in perlipc +.PP +You may also use the IPC::Open3 module (part of the standard perl +distribution), but be warned that it has a different order of +arguments from IPC::Open2 (see IPC::Open3). +.SS "Why can't I get the output of a command with \fBsystem()\fP?" +.IX Subsection "Why can't I get the output of a command with system()?" +You're confusing the purpose of \f(CW\*(C`system()\*(C'\fR and backticks (``). \f(CW\*(C`system()\*(C'\fR +runs a command and returns exit status information (as a 16 bit value: +the low 7 bits are the signal the process died from, if any, and +the high 8 bits are the actual exit value). Backticks (``) run a +command and return what it sent to \s-1STDOUT.\s0 +.PP +.Vb 2 +\& my $exit_status = system("mail\-users"); +\& my $output_string = \`ls\`; +.Ve +.SS "How can I capture \s-1STDERR\s0 from an external command?" +.IX Subsection "How can I capture STDERR from an external command?" +There are three basic ways of running external commands: +.PP +.Vb 3 +\& system $cmd; # using system() +\& my $output = \`$cmd\`; # using backticks (\`\`) +\& open (my $pipe_fh, "$cmd |"); # using open() +.Ve +.PP +With \f(CW\*(C`system()\*(C'\fR, both \s-1STDOUT\s0 and \s-1STDERR\s0 will go the same place as the +script's \s-1STDOUT\s0 and \s-1STDERR,\s0 unless the \f(CW\*(C`system()\*(C'\fR command redirects them. +Backticks and \f(CW\*(C`open()\*(C'\fR read \fBonly\fR the \s-1STDOUT\s0 of your command. +.PP +You can also use the \f(CW\*(C`open3()\*(C'\fR function from IPC::Open3. Benjamin +Goldberg provides some sample code: +.PP +To capture a program's \s-1STDOUT,\s0 but discard its \s-1STDERR:\s0 +.PP +.Vb 7 +\& use IPC::Open3; +\& use File::Spec; +\& my $in = \*(Aq\*(Aq; +\& open(NULL, ">", File::Spec\->devnull); +\& my $pid = open3($in, \e*PH, ">&NULL", "cmd"); +\& while( ) { } +\& waitpid($pid, 0); +.Ve +.PP +To capture a program's \s-1STDERR,\s0 but discard its \s-1STDOUT:\s0 +.PP +.Vb 7 +\& use IPC::Open3; +\& use File::Spec; +\& my $in = \*(Aq\*(Aq; +\& open(NULL, ">", File::Spec\->devnull); +\& my $pid = open3($in, ">&NULL", \e*PH, "cmd"); +\& while( ) { } +\& waitpid($pid, 0); +.Ve +.PP +To capture a program's \s-1STDERR,\s0 and let its \s-1STDOUT\s0 go to our own \s-1STDERR:\s0 +.PP +.Vb 5 +\& use IPC::Open3; +\& my $in = \*(Aq\*(Aq; +\& my $pid = open3($in, ">&STDERR", \e*PH, "cmd"); +\& while( ) { } +\& waitpid($pid, 0); +.Ve +.PP +To read both a command's \s-1STDOUT\s0 and its \s-1STDERR\s0 separately, you can +redirect them to temp files, let the command run, then read the temp +files: +.PP +.Vb 10 +\& use IPC::Open3; +\& use IO::File; +\& my $in = \*(Aq\*(Aq; +\& local *CATCHOUT = IO::File\->new_tmpfile; +\& local *CATCHERR = IO::File\->new_tmpfile; +\& my $pid = open3($in, ">&CATCHOUT", ">&CATCHERR", "cmd"); +\& waitpid($pid, 0); +\& seek $_, 0, 0 for \e*CATCHOUT, \e*CATCHERR; +\& while( ) {} +\& while( ) {} +.Ve +.PP +But there's no real need for \fBboth\fR to be tempfiles... the following +should work just as well, without deadlocking: +.PP +.Vb 9 +\& use IPC::Open3; +\& my $in = \*(Aq\*(Aq; +\& use IO::File; +\& local *CATCHERR = IO::File\->new_tmpfile; +\& my $pid = open3($in, \e*CATCHOUT, ">&CATCHERR", "cmd"); +\& while( ) {} +\& waitpid($pid, 0); +\& seek CATCHERR, 0, 0; +\& while( ) {} +.Ve +.PP +And it'll be faster, too, since we can begin processing the program's +stdout immediately, rather than waiting for the program to finish. +.PP +With any of these, you can change file descriptors before the call: +.PP +.Vb 2 +\& open(STDOUT, ">logfile"); +\& system("ls"); +.Ve +.PP +or you can use Bourne shell file-descriptor redirection: +.PP +.Vb 2 +\& $output = \`$cmd 2>some_file\`; +\& open (PIPE, "cmd 2>some_file |"); +.Ve +.PP +You can also use file-descriptor redirection to make \s-1STDERR\s0 a +duplicate of \s-1STDOUT:\s0 +.PP +.Vb 2 +\& $output = \`$cmd 2>&1\`; +\& open (PIPE, "cmd 2>&1 |"); +.Ve +.PP +Note that you \fIcannot\fR simply open \s-1STDERR\s0 to be a dup of \s-1STDOUT\s0 +in your Perl program and avoid calling the shell to do the redirection. +This doesn't work: +.PP +.Vb 2 +\& open(STDERR, ">&STDOUT"); +\& $alloutput = \`cmd args\`; # stderr still escapes +.Ve +.PP +This fails because the \f(CW\*(C`open()\*(C'\fR makes \s-1STDERR\s0 go to where \s-1STDOUT\s0 was +going at the time of the \f(CW\*(C`open()\*(C'\fR. The backticks then make \s-1STDOUT\s0 go to +a string, but don't change \s-1STDERR\s0 (which still goes to the old +\&\s-1STDOUT\s0). +.PP +Note that you \fImust\fR use Bourne shell (\f(CWsh(1)\fR) redirection syntax in +backticks, not \f(CWcsh(1)\fR! Details on why Perl's \f(CW\*(C`system()\*(C'\fR and backtick +and pipe opens all use the Bourne shell are in the +\&\fIversus/csh.whynot\fR article in the \*(L"Far More Than You Ever Wanted To +Know\*(R" collection in . To +capture a command's \s-1STDERR\s0 and \s-1STDOUT\s0 together: +.PP +.Vb 3 +\& $output = \`cmd 2>&1\`; # either with backticks +\& $pid = open(PH, "cmd 2>&1 |"); # or with an open pipe +\& while () { } # plus a read +.Ve +.PP +To capture a command's \s-1STDOUT\s0 but discard its \s-1STDERR:\s0 +.PP +.Vb 3 +\& $output = \`cmd 2>/dev/null\`; # either with backticks +\& $pid = open(PH, "cmd 2>/dev/null |"); # or with an open pipe +\& while () { } # plus a read +.Ve +.PP +To capture a command's \s-1STDERR\s0 but discard its \s-1STDOUT:\s0 +.PP +.Vb 3 +\& $output = \`cmd 2>&1 1>/dev/null\`; # either with backticks +\& $pid = open(PH, "cmd 2>&1 1>/dev/null |"); # or with an open pipe +\& while () { } # plus a read +.Ve +.PP +To exchange a command's \s-1STDOUT\s0 and \s-1STDERR\s0 in order to capture the \s-1STDERR\s0 +but leave its \s-1STDOUT\s0 to come out our old \s-1STDERR:\s0 +.PP +.Vb 3 +\& $output = \`cmd 3>&1 1>&2 2>&3 3>&\-\`; # either with backticks +\& $pid = open(PH, "cmd 3>&1 1>&2 2>&3 3>&\-|");# or with an open pipe +\& while () { } # plus a read +.Ve +.PP +To read both a command's \s-1STDOUT\s0 and its \s-1STDERR\s0 separately, it's easiest +to redirect them separately to files, and then read from those files +when the program is done: +.PP +.Vb 1 +\& system("program args 1>program.stdout 2>program.stderr"); +.Ve +.PP +Ordering is important in all these examples. That's because the shell +processes file descriptor redirections in strictly left to right order. +.PP +.Vb 2 +\& system("prog args 1>tmpfile 2>&1"); +\& system("prog args 2>&1 1>tmpfile"); +.Ve +.PP +The first command sends both standard out and standard error to the +temporary file. The second command sends only the old standard output +there, and the old standard error shows up on the old standard out. +.SS "Why doesn't \fBopen()\fP return an error when a pipe open fails?" +.IX Subsection "Why doesn't open() return an error when a pipe open fails?" +If the second argument to a piped \f(CW\*(C`open()\*(C'\fR contains shell +metacharacters, perl \f(CW\*(C`fork()\*(C'\fRs, then \f(CW\*(C`exec()\*(C'\fRs a shell to decode the +metacharacters and eventually run the desired program. If the program +couldn't be run, it's the shell that gets the message, not Perl. All +your Perl program can find out is whether the shell itself could be +successfully started. You can still capture the shell's \s-1STDERR\s0 and +check it for error messages. See \*(L"How can I capture \s-1STDERR\s0 from an +external command?\*(R" elsewhere in this document, or use the +IPC::Open3 module. +.PP +If there are no shell metacharacters in the argument of \f(CW\*(C`open()\*(C'\fR, Perl +runs the command directly, without using the shell, and can correctly +report whether the command started. +.SS "What's wrong with using backticks in a void context?" +.IX Subsection "What's wrong with using backticks in a void context?" +Strictly speaking, nothing. Stylistically speaking, it's not a good +way to write maintainable code. Perl has several operators for +running external commands. Backticks are one; they collect the output +from the command for use in your program. The \f(CW\*(C`system\*(C'\fR function is +another; it doesn't do this. +.PP +Writing backticks in your program sends a clear message to the readers +of your code that you wanted to collect the output of the command. +Why send a clear message that isn't true? +.PP +Consider this line: +.PP +.Vb 1 +\& \`cat /etc/termcap\`; +.Ve +.PP +You forgot to check \f(CW$?\fR to see whether the program even ran +correctly. Even if you wrote +.PP +.Vb 1 +\& print \`cat /etc/termcap\`; +.Ve +.PP +this code could and probably should be written as +.PP +.Vb 2 +\& system("cat /etc/termcap") == 0 +\& or die "cat program failed!"; +.Ve +.PP +which will echo the cat command's output as it is generated, instead +of waiting until the program has completed to print it out. It also +checks the return value. +.PP +\&\f(CW\*(C`system\*(C'\fR also provides direct control over whether shell wildcard +processing may take place, whereas backticks do not. +.SS "How can I call backticks without shell processing?" +.IX Subsection "How can I call backticks without shell processing?" +This is a bit tricky. You can't simply write the command +like this: +.PP +.Vb 1 +\& @ok = \`grep @opts \*(Aq$search_string\*(Aq @filenames\`; +.Ve +.PP +As of Perl 5.8.0, you can use \f(CW\*(C`open()\*(C'\fR with multiple arguments. +Just like the list forms of \f(CW\*(C`system()\*(C'\fR and \f(CW\*(C`exec()\*(C'\fR, no shell +escapes happen. +.PP +.Vb 3 +\& open( GREP, "\-|", \*(Aqgrep\*(Aq, @opts, $search_string, @filenames ); +\& chomp(@ok = ); +\& close GREP; +.Ve +.PP +You can also: +.PP +.Vb 10 +\& my @ok = (); +\& if (open(GREP, "\-|")) { +\& while () { +\& chomp; +\& push(@ok, $_); +\& } +\& close GREP; +\& } else { +\& exec \*(Aqgrep\*(Aq, @opts, $search_string, @filenames; +\& } +.Ve +.PP +Just as with \f(CW\*(C`system()\*(C'\fR, no shell escapes happen when you \f(CW\*(C`exec()\*(C'\fR a +list. Further examples of this can be found in \*(L"Safe Pipe +Opens\*(R" in perlipc. +.PP +Note that if you're using Windows, no solution to this vexing issue is +even possible. Even though Perl emulates \f(CW\*(C`fork()\*(C'\fR, you'll still be +stuck, because Windows does not have an argc/argv\-style \s-1API.\s0 +.SS "Why can't my script read from \s-1STDIN\s0 after I gave it \s-1EOF\s0 (^D on Unix, ^Z on MS-DOS)?" +.IX Subsection "Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?" +This happens only if your perl is compiled to use stdio instead of +perlio, which is the default. Some (maybe all?) stdios set error and +eof flags that you may need to clear. The \s-1POSIX\s0 module defines +\&\f(CW\*(C`clearerr()\*(C'\fR that you can use. That is the technically correct way to +do it. Here are some less reliable workarounds: +.IP "1." 4 +Try keeping around the seekpointer and go there, like this: +.Sp +.Vb 2 +\& my $where = tell($log_fh); +\& seek($log_fh, $where, 0); +.Ve +.IP "2." 4 +If that doesn't work, try seeking to a different part of the file and +then back. +.IP "3." 4 +If that doesn't work, try seeking to a different part of +the file, reading something, and then seeking back. +.IP "4." 4 +If that doesn't work, give up on your stdio package and use sysread. +.SS "How can I convert my shell script to perl?" +.IX Subsection "How can I convert my shell script to perl?" +Learn Perl and rewrite it. Seriously, there's no simple converter. +Things that are awkward to do in the shell are easy to do in Perl, and +this very awkwardness is what would make a shell\->perl converter +nigh-on impossible to write. By rewriting it, you'll think about what +you're really trying to do, and hopefully will escape the shell's +pipeline datastream paradigm, which while convenient for some matters, +causes many inefficiencies. +.SS "Can I use perl to run a telnet or ftp session?" +.IX Subsection "Can I use perl to run a telnet or ftp session?" +Try the Net::FTP, TCP::Client, and Net::Telnet modules +(available from \s-1CPAN\s0). + will also help +for emulating the telnet protocol, but Net::Telnet is quite +probably easier to use. +.PP +If all you want to do is pretend to be telnet but don't need +the initial telnet handshaking, then the standard dual-process +approach will suffice: +.PP +.Vb 12 +\& use IO::Socket; # new in 5.004 +\& my $handle = IO::Socket::INET\->new(\*(Aqwww.perl.com:80\*(Aq) +\& or die "can\*(Aqt connect to port 80 on www.perl.com $!"; +\& $handle\->autoflush(1); +\& if (fork()) { # XXX: undef means failure +\& select($handle); +\& print while ; # everything from stdin to socket +\& } else { +\& print while <$handle>; # everything from socket to stdout +\& } +\& close $handle; +\& exit; +.Ve +.SS "How can I write expect in Perl?" +.IX Subsection "How can I write expect in Perl?" +Once upon a time, there was a library called \fIchat2.pl\fR (part of the +standard perl distribution), which never really got finished. If you +find it somewhere, \fIdon't use it\fR. These days, your best bet is to +look at the Expect module available from \s-1CPAN,\s0 which also requires two +other modules from \s-1CPAN,\s0 IO::Pty and IO::Stty. +.ie n .SS "Is there a way to hide perl's command line from programs such as ""ps""?" +.el .SS "Is there a way to hide perl's command line from programs such as ``ps''?" +.IX Subsection "Is there a way to hide perl's command line from programs such as ps?" +First of all note that if you're doing this for security reasons (to +avoid people seeing passwords, for example) then you should rewrite +your program so that critical information is never given as an +argument. Hiding the arguments won't make your program completely +secure. +.PP +To actually alter the visible command line, you can assign to the +variable \f(CW$0\fR as documented in perlvar. This won't work on all +operating systems, though. Daemon programs like sendmail place their +state there, as in: +.PP +.Vb 1 +\& $0 = "orcus [accepting connections]"; +.Ve +.SS "I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible?" +.IX Subsection "I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible?" +.IP "Unix" 4 +.IX Item "Unix" +In the strictest sense, it can't be done\*(--the script executes as a +different process from the shell it was started from. Changes to a +process are not reflected in its parent\*(--only in any children +created after the change. There is shell magic that may allow you to +fake it by \f(CW\*(C`eval()\*(C'\fRing the script's output in your shell; check out the +comp.unix.questions \s-1FAQ\s0 for details. +.SS "How do I close a process's filehandle without waiting for it to complete?" +.IX Subsection "How do I close a process's filehandle without waiting for it to complete?" +Assuming your system supports such things, just send an appropriate signal +to the process (see \*(L"kill\*(R" in perlfunc). It's common to first send a \s-1TERM\s0 +signal, wait a little bit, and then send a \s-1KILL\s0 signal to finish it off. +.SS "How do I fork a daemon process?" +.IX Subsection "How do I fork a daemon process?" +If by daemon process you mean one that's detached (disassociated from +its tty), then the following process is reported to work on most +Unixish systems. Non-Unix users should check their Your_OS::Process +module for other solutions. +.IP "\(bu" 4 +Open /dev/tty and use the \s-1TIOCNOTTY\s0 ioctl on it. See \fBtty\fR\|(1) +for details. Or better yet, you can just use the \f(CW\*(C`POSIX::setsid()\*(C'\fR +function, so you don't have to worry about process groups. +.IP "\(bu" 4 +Change directory to / +.IP "\(bu" 4 +Reopen \s-1STDIN, STDOUT,\s0 and \s-1STDERR\s0 so they're not connected to the old +tty. +.IP "\(bu" 4 +Background yourself like this: +.Sp +.Vb 1 +\& fork && exit; +.Ve +.PP +The Proc::Daemon module, available from \s-1CPAN,\s0 provides a function to +perform these actions for you. +.SS "How do I find out if I'm running interactively or not?" +.IX Subsection "How do I find out if I'm running interactively or not?" +(contributed by brian d foy) +.PP +This is a difficult question to answer, and the best answer is +only a guess. +.PP +What do you really want to know? If you merely want to know if one of +your filehandles is connected to a terminal, you can try the \f(CW\*(C`\-t\*(C'\fR +file test: +.PP +.Vb 3 +\& if( \-t STDOUT ) { +\& print "I\*(Aqm connected to a terminal!\en"; +\& } +.Ve +.PP +However, you might be out of luck if you expect that means there is a +real person on the other side. With the Expect module, another +program can pretend to be a person. The program might even come close +to passing the Turing test. +.PP +The IO::Interactive module does the best it can to give you an +answer. Its \f(CW\*(C`is_interactive\*(C'\fR function returns an output filehandle; +that filehandle points to standard output if the module thinks the +session is interactive. Otherwise, the filehandle is a null handle +that simply discards the output: +.PP +.Vb 1 +\& use IO::Interactive; +\& +\& print { is_interactive } "I might go to standard output!\en"; +.Ve +.PP +This still doesn't guarantee that a real person is answering your +prompts or reading your output. +.PP +If you want to know how to handle automated testing for your +distribution, you can check the environment. The \s-1CPAN\s0 +Testers, for instance, set the value of \f(CW\*(C`AUTOMATED_TESTING\*(C'\fR: +.PP +.Vb 3 +\& unless( $ENV{AUTOMATED_TESTING} ) { +\& print "Hello interactive tester!\en"; +\& } +.Ve +.SS "How do I timeout a slow event?" +.IX Subsection "How do I timeout a slow event?" +Use the \f(CW\*(C`alarm()\*(C'\fR function, probably in conjunction with a signal +handler, as documented in \*(L"Signals\*(R" in perlipc and the section on +\&\*(L"Signals\*(R" in the Camel. You may instead use the more flexible +Sys::AlarmCall module available from \s-1CPAN.\s0 +.PP +The \f(CW\*(C`alarm()\*(C'\fR function is not implemented on all versions of Windows. +Check the documentation for your specific version of Perl. +.SS "How do I set \s-1CPU\s0 limits?" +.IX Xref "BSD::Resource limit CPU" +.IX Subsection "How do I set CPU limits?" +(contributed by Xho) +.PP +Use the BSD::Resource module from \s-1CPAN.\s0 As an example: +.PP +.Vb 2 +\& use BSD::Resource; +\& setrlimit(RLIMIT_CPU,10,20) or die $!; +.Ve +.PP +This sets the soft and hard limits to 10 and 20 seconds, respectively. +After 10 seconds of time spent running on the \s-1CPU\s0 (not \*(L"wall\*(R" time), +the process will be sent a signal (\s-1XCPU\s0 on some systems) which, if not +trapped, will cause the process to terminate. If that signal is +trapped, then after 10 more seconds (20 seconds in total) the process +will be killed with a non-trappable signal. +.PP +See the BSD::Resource and your systems documentation for the gory +details. +.SS "How do I avoid zombies on a Unix system?" +.IX Subsection "How do I avoid zombies on a Unix system?" +Use the reaper code from \*(L"Signals\*(R" in perlipc to call \f(CW\*(C`wait()\*(C'\fR when a +\&\s-1SIGCHLD\s0 is received, or else use the double-fork technique described +in \*(L"How do I start a process in the background?\*(R" in perlfaq8. +.SS "How do I use an \s-1SQL\s0 database?" +.IX Subsection "How do I use an SQL database?" +The \s-1DBI\s0 module provides an abstract interface to most database +servers and types, including Oracle, \s-1DB2,\s0 Sybase, mysql, Postgresql, +\&\s-1ODBC,\s0 and flat files. The \s-1DBI\s0 module accesses each database type +through a database driver, or \s-1DBD.\s0 You can see a complete list of +available drivers on \s-1CPAN:\s0 . +You can read more about \s-1DBI\s0 on . +.PP +Other modules provide more specific access: Win32::ODBC, Alzabo, +\&\f(CW\*(C`iodbc\*(C'\fR, and others found on \s-1CPAN\s0 Search: . +.SS "How do I make a \fBsystem()\fP exit on control-C?" +.IX Subsection "How do I make a system() exit on control-C?" +You can't. You need to imitate the \f(CW\*(C`system()\*(C'\fR call (see perlipc for +sample code) and then have a signal handler for the \s-1INT\s0 signal that +passes the signal on to the subprocess. Or you can check for it: +.PP +.Vb 2 +\& $rc = system($cmd); +\& if ($rc & 127) { die "signal death" } +.Ve +.SS "How do I open a file without blocking?" +.IX Subsection "How do I open a file without blocking?" +If you're lucky enough to be using a system that supports +non-blocking reads (most Unixish systems do), you need only to use the +\&\f(CW\*(C`O_NDELAY\*(C'\fR or \f(CW\*(C`O_NONBLOCK\*(C'\fR flag from the \f(CW\*(C`Fcntl\*(C'\fR module in conjunction with +\&\f(CW\*(C`sysopen()\*(C'\fR: +.PP +.Vb 3 +\& use Fcntl; +\& sysopen(my $fh, "/foo/somefile", O_WRONLY|O_NDELAY|O_CREAT, 0644) +\& or die "can\*(Aqt open /foo/somefile: $!": +.Ve +.SS "How do I tell the difference between errors from the shell and perl?" +.IX Subsection "How do I tell the difference between errors from the shell and perl?" +(answer contributed by brian d foy) +.PP +When you run a Perl script, something else is running the script for you, +and that something else may output error messages. The script might +emit its own warnings and error messages. Most of the time you cannot +tell who said what. +.PP +You probably cannot fix the thing that runs perl, but you can change how +perl outputs its warnings by defining a custom warning and die functions. +.PP +Consider this script, which has an error you may not notice immediately. +.PP +.Vb 1 +\& #!/usr/locl/bin/perl +\& +\& print "Hello World\en"; +.Ve +.PP +I get an error when I run this from my shell (which happens to be +bash). That may look like perl forgot it has a \f(CW\*(C`print()\*(C'\fR function, +but my shebang line is not the path to perl, so the shell runs the +script, and I get the error. +.PP +.Vb 2 +\& $ ./test +\& ./test: line 3: print: command not found +.Ve +.PP +A quick and dirty fix involves a little bit of code, but this may be all +you need to figure out the problem. +.PP +.Vb 1 +\& #!/usr/bin/perl \-w +\& +\& BEGIN { +\& $SIG{_\|_WARN_\|_} = sub{ print STDERR "Perl: ", @_; }; +\& $SIG{_\|_DIE_\|_} = sub{ print STDERR "Perl: ", @_; exit 1}; +\& } +\& +\& $a = 1 + undef; +\& $x / 0; +\& _\|_END_\|_ +.Ve +.PP +The perl message comes out with \*(L"Perl\*(R" in front. The \f(CW\*(C`BEGIN\*(C'\fR block +works at compile time so all of the compilation errors and warnings +get the \*(L"Perl:\*(R" prefix too. +.PP +.Vb 7 +\& Perl: Useless use of division (/) in void context at ./test line 9. +\& Perl: Name "main::a" used only once: possible typo at ./test line 8. +\& Perl: Name "main::x" used only once: possible typo at ./test line 9. +\& Perl: Use of uninitialized value in addition (+) at ./test line 8. +\& Perl: Use of uninitialized value in division (/) at ./test line 9. +\& Perl: Illegal division by zero at ./test line 9. +\& Perl: Illegal division by zero at \-e line 3. +.Ve +.PP +If I don't see that \*(L"Perl:\*(R", it's not from perl. +.PP +You could also just know all the perl errors, and although there are +some people who may know all of them, you probably don't. However, they +all should be in the perldiag manpage. If you don't find the error in +there, it probably isn't a perl error. +.PP +Looking up every message is not the easiest way, so let perl to do it +for you. Use the diagnostics pragma with turns perl's normal messages +into longer discussions on the topic. +.PP +.Vb 1 +\& use diagnostics; +.Ve +.PP +If you don't get a paragraph or two of expanded discussion, it +might not be perl's message. +.SS "How do I install a module from \s-1CPAN\s0?" +.IX Subsection "How do I install a module from CPAN?" +(contributed by brian d foy) +.PP +The easiest way is to have a module also named \s-1CPAN\s0 do it for you by using +the \f(CW\*(C`cpan\*(C'\fR command that comes with Perl. You can give it a list of modules +to install: +.PP +.Vb 1 +\& $ cpan IO::Interactive Getopt::Whatever +.Ve +.PP +If you prefer \f(CW\*(C`CPANPLUS\*(C'\fR, it's just as easy: +.PP +.Vb 1 +\& $ cpanp i IO::Interactive Getopt::Whatever +.Ve +.PP +If you want to install a distribution from the current directory, you can +tell \f(CW\*(C`CPAN.pm\*(C'\fR to install \f(CW\*(C`.\*(C'\fR (the full stop): +.PP +.Vb 1 +\& $ cpan . +.Ve +.PP +See the documentation for either of those commands to see what else +you can do. +.PP +If you want to try to install a distribution by yourself, resolving +all dependencies on your own, you follow one of two possible build +paths. +.PP +For distributions that use \fIMakefile.PL\fR: +.PP +.Vb 2 +\& $ perl Makefile.PL +\& $ make test install +.Ve +.PP +For distributions that use \fIBuild.PL\fR: +.PP +.Vb 3 +\& $ perl Build.PL +\& $ ./Build test +\& $ ./Build install +.Ve +.PP +Some distributions may need to link to libraries or other third-party +code and their build and installation sequences may be more complicated. +Check any \fI\s-1README\s0\fR or \fI\s-1INSTALL\s0\fR files that you may find. +.SS "What's the difference between require and use?" +.IX Subsection "What's the difference between require and use?" +(contributed by brian d foy) +.PP +Perl runs \f(CW\*(C`require\*(C'\fR statement at run-time. Once Perl loads, compiles, +and runs the file, it doesn't do anything else. The \f(CW\*(C`use\*(C'\fR statement +is the same as a \f(CW\*(C`require\*(C'\fR run at compile-time, but Perl also calls the +\&\f(CW\*(C`import\*(C'\fR method for the loaded package. These two are the same: +.PP +.Vb 1 +\& use MODULE qw(import list); +\& +\& BEGIN { +\& require MODULE; +\& MODULE\->import(import list); +\& } +.Ve +.PP +However, you can suppress the \f(CW\*(C`import\*(C'\fR by using an explicit, empty +import list. Both of these still happen at compile-time: +.PP +.Vb 1 +\& use MODULE (); +\& +\& BEGIN { +\& require MODULE; +\& } +.Ve +.PP +Since \f(CW\*(C`use\*(C'\fR will also call the \f(CW\*(C`import\*(C'\fR method, the actual value +for \f(CW\*(C`MODULE\*(C'\fR must be a bareword. That is, \f(CW\*(C`use\*(C'\fR cannot load files +by name, although \f(CW\*(C`require\*(C'\fR can: +.PP +.Vb 1 +\& require "$ENV{HOME}/lib/Foo.pm"; # no @INC searching! +.Ve +.PP +See the entry for \f(CW\*(C`use\*(C'\fR in perlfunc for more details. +.SS "How do I keep my own module/library directory?" +.IX Subsection "How do I keep my own module/library directory?" +When you build modules, tell Perl where to install the modules. +.PP +If you want to install modules for your own use, the easiest way might +be local::lib, which you can download from \s-1CPAN.\s0 It sets various +installation settings for you, and uses those same settings within +your programs. +.PP +If you want more flexibility, you need to configure your \s-1CPAN\s0 client +for your particular situation. +.PP +For \f(CW\*(C`Makefile.PL\*(C'\fR\-based distributions, use the \s-1INSTALL_BASE\s0 option +when generating Makefiles: +.PP +.Vb 1 +\& perl Makefile.PL INSTALL_BASE=/mydir/perl +.Ve +.PP +You can set this in your \f(CW\*(C`CPAN.pm\*(C'\fR configuration so modules +automatically install in your private library directory when you use +the \s-1CPAN\s0.pm shell: +.PP +.Vb 3 +\& % cpan +\& cpan> o conf makepl_arg INSTALL_BASE=/mydir/perl +\& cpan> o conf commit +.Ve +.PP +For \f(CW\*(C`Build.PL\*(C'\fR\-based distributions, use the \-\-install_base option: +.PP +.Vb 1 +\& perl Build.PL \-\-install_base /mydir/perl +.Ve +.PP +You can configure \f(CW\*(C`CPAN.pm\*(C'\fR to automatically use this option too: +.PP +.Vb 3 +\& % cpan +\& cpan> o conf mbuild_arg "\-\-install_base /mydir/perl" +\& cpan> o conf commit +.Ve +.PP +\&\s-1INSTALL_BASE\s0 tells these tools to put your modules into +\&\fI/mydir/perl/lib/perl5\fR. See \*(L"How do I add a directory to my +include path (@INC) at runtime?\*(R" for details on how to run your newly +installed modules. +.PP +There is one caveat with \s-1INSTALL_BASE,\s0 though, since it acts +differently from the \s-1PREFIX\s0 and \s-1LIB\s0 settings that older versions of +ExtUtils::MakeMaker advocated. \s-1INSTALL_BASE\s0 does not support +installing modules for multiple versions of Perl or different +architectures under the same directory. You should consider whether you +really want that and, if you do, use the older \s-1PREFIX\s0 and \s-1LIB\s0 +settings. See the ExtUtils::Makemaker documentation for more details. +.SS "How do I add the directory my program lives in to the module/library search path?" +.IX Subsection "How do I add the directory my program lives in to the module/library search path?" +(contributed by brian d foy) +.PP +If you know the directory already, you can add it to \f(CW@INC\fR as you would +for any other directory. You might \f(CW\*(C`use lib\*(C'\fR if you know the directory +at compile time: +.PP +.Vb 1 +\& use lib $directory; +.Ve +.PP +The trick in this task is to find the directory. Before your script does +anything else (such as a \f(CW\*(C`chdir\*(C'\fR), you can get the current working +directory with the \f(CW\*(C`Cwd\*(C'\fR module, which comes with Perl: +.PP +.Vb 4 +\& BEGIN { +\& use Cwd; +\& our $directory = cwd; +\& } +\& +\& use lib $directory; +.Ve +.PP +You can do a similar thing with the value of \f(CW$0\fR, which holds the +script name. That might hold a relative path, but \f(CW\*(C`rel2abs\*(C'\fR can turn +it into an absolute path. Once you have the +.PP +.Vb 3 +\& BEGIN { +\& use File::Spec::Functions qw(rel2abs); +\& use File::Basename qw(dirname); +\& +\& my $path = rel2abs( $0 ); +\& our $directory = dirname( $path ); +\& } +\& +\& use lib $directory; +.Ve +.PP +The FindBin module, which comes with Perl, might work. It finds the +directory of the currently running script and puts it in \f(CW$Bin\fR, which +you can then use to construct the right library path: +.PP +.Vb 1 +\& use FindBin qw($Bin); +.Ve +.PP +You can also use local::lib to do much of the same thing. Install +modules using local::lib's settings then use the module in your +program: +.PP +.Vb 1 +\& use local::lib; # sets up a local lib at ~/perl5 +.Ve +.PP +See the local::lib documentation for more details. +.SS "How do I add a directory to my include path (@INC) at runtime?" +.IX Subsection "How do I add a directory to my include path (@INC) at runtime?" +Here are the suggested ways of modifying your include path, including +environment variables, run-time switches, and in-code statements: +.ie n .IP "the ""PERLLIB"" environment variable" 4 +.el .IP "the \f(CWPERLLIB\fR environment variable" 4 +.IX Item "the PERLLIB environment variable" +.Vb 2 +\& $ export PERLLIB=/path/to/my/dir +\& $ perl program.pl +.Ve +.ie n .IP "the ""PERL5LIB"" environment variable" 4 +.el .IP "the \f(CWPERL5LIB\fR environment variable" 4 +.IX Item "the PERL5LIB environment variable" +.Vb 2 +\& $ export PERL5LIB=/path/to/my/dir +\& $ perl program.pl +.Ve +.ie n .IP "the ""perl \-Idir"" command line flag" 4 +.el .IP "the \f(CWperl \-Idir\fR command line flag" 4 +.IX Item "the perl -Idir command line flag" +.Vb 1 +\& $ perl \-I/path/to/my/dir program.pl +.Ve +.ie n .IP "the ""lib"" pragma:" 4 +.el .IP "the \f(CWlib\fR pragma:" 4 +.IX Item "the lib pragma:" +.Vb 1 +\& use lib "$ENV{HOME}/myown_perllib"; +.Ve +.IP "the local::lib module:" 4 +.IX Item "the local::lib module:" +.Vb 1 +\& use local::lib; +\& +\& use local::lib "~/myown_perllib"; +.Ve +.SS "Where are modules installed?" +.IX Subsection "Where are modules installed?" +Modules are installed on a case-by-case basis (as provided by the methods +described in the previous section), and in the operating system. All of these +paths are stored in \f(CW@INC\fR, which you can display with the one-liner +.PP +.Vb 1 +\& perl \-e \*(Aqprint join("\en",@INC,"")\*(Aq +.Ve +.PP +The same information is displayed at the end of the output from the command +.PP +.Vb 1 +\& perl \-V +.Ve +.PP +To find out where a module's source code is located, use +.PP +.Vb 1 +\& perldoc \-l Encode +.Ve +.PP +to display the path to the module. In some cases (for example, the \f(CW\*(C`AutoLoader\*(C'\fR +module), this command will show the path to a separate \f(CW\*(C`pod\*(C'\fR file; the module +itself should be in the same directory, with a 'pm' file extension. +.SS "What is socket.ph and where do I get it?" +.IX Subsection "What is socket.ph and where do I get it?" +It's a Perl 4 style file defining values for system networking +constants. Sometimes it is built using h2ph when Perl is installed, +but other times it is not. Modern programs should use \f(CW\*(C`use Socket;\*(C'\fR +instead. +.SH "AUTHOR AND COPYRIGHT" +.IX Header "AUTHOR AND COPYRIGHT" +Copyright (c) 1997\-2010 Tom Christiansen, Nathan Torkington, and +other authors as noted. All rights reserved. +.PP +This documentation is free; you can redistribute it and/or modify it +under the same terms as Perl itself. +.PP +Irrespective of its distribution, all code examples in this file +are hereby placed into the public domain. You are permitted and +encouraged to use this code in your own programs for fun +or for profit as you see fit. A simple comment in the code giving +credit would be courteous but is not required. diff --git a/data/miniconda3/man/man1/perlfilter.1 b/data/miniconda3/man/man1/perlfilter.1 new file mode 100644 index 0000000000000000000000000000000000000000..1efc13bcf6db1a5c3ff2e9784275aafc9251ad2a --- /dev/null +++ b/data/miniconda3/man/man1/perlfilter.1 @@ -0,0 +1,777 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLFILTER 1" +.TH PERLFILTER 1 "2020-12-18" "perl v5.32.1" "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" +perlfilter \- Source Filters +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This article is about a little-known feature of Perl called +\&\fIsource filters\fR. Source filters alter the program text of a module +before Perl sees it, much as a C preprocessor alters the source text of +a C program before the compiler sees it. This article tells you more +about what source filters are, how they work, and how to write your +own. +.PP +The original purpose of source filters was to let you encrypt your +program source to prevent casual piracy. This isn't all they can do, as +you'll soon learn. But first, the basics. +.SH "CONCEPTS" +.IX Header "CONCEPTS" +Before the Perl interpreter can execute a Perl script, it must first +read it from a file into memory for parsing and compilation. If that +script itself includes other scripts with a \f(CW\*(C`use\*(C'\fR or \f(CW\*(C`require\*(C'\fR +statement, then each of those scripts will have to be read from their +respective files as well. +.PP +Now think of each logical connection between the Perl parser and an +individual file as a \fIsource stream\fR. A source stream is created when +the Perl parser opens a file, it continues to exist as the source code +is read into memory, and it is destroyed when Perl is finished parsing +the file. If the parser encounters a \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`use\*(C'\fR statement in +a source stream, a new and distinct stream is created just for that +file. +.PP +The diagram below represents a single source stream, with the flow of +source from a Perl script file on the left into the Perl parser on the +right. This is how Perl normally operates. +.PP +.Vb 1 +\& file \-\-\-\-\-\-\-> parser +.Ve +.PP +There are two important points to remember: +.IP "1." 5 +Although there can be any number of source streams in existence at any +given time, only one will be active. +.IP "2." 5 +Every source stream is associated with only one file. +.PP +A source filter is a special kind of Perl module that intercepts and +modifies a source stream before it reaches the parser. A source filter +changes our diagram like this: +.PP +.Vb 1 +\& file \-\-\-\-> filter \-\-\-\-> parser +.Ve +.PP +If that doesn't make much sense, consider the analogy of a command +pipeline. Say you have a shell script stored in the compressed file +\&\fItrial.gz\fR. The simple pipeline command below runs the script without +needing to create a temporary file to hold the uncompressed file. +.PP +.Vb 1 +\& gunzip \-c trial.gz | sh +.Ve +.PP +In this case, the data flow from the pipeline can be represented as follows: +.PP +.Vb 1 +\& trial.gz \-\-\-\-> gunzip \-\-\-\-> sh +.Ve +.PP +With source filters, you can store the text of your script compressed and use a source filter to uncompress it for Perl's parser: +.PP +.Vb 2 +\& compressed gunzip +\& Perl program \-\-\-> source filter \-\-\-> parser +.Ve +.SH "USING FILTERS" +.IX Header "USING FILTERS" +So how do you use a source filter in a Perl script? Above, I said that +a source filter is just a special kind of module. Like all Perl +modules, a source filter is invoked with a use statement. +.PP +Say you want to pass your Perl source through the C preprocessor before +execution. As it happens, the source filters distribution comes with a C +preprocessor filter module called Filter::cpp. +.PP +Below is an example program, \f(CW\*(C`cpp_test\*(C'\fR, which makes use of this filter. +Line numbers have been added to allow specific lines to be referenced +easily. +.PP +.Vb 4 +\& 1: use Filter::cpp; +\& 2: #define TRUE 1 +\& 3: $a = TRUE; +\& 4: print "a = $a\en"; +.Ve +.PP +When you execute this script, Perl creates a source stream for the +file. Before the parser processes any of the lines from the file, the +source stream looks like this: +.PP +.Vb 1 +\& cpp_test \-\-\-\-\-\-\-\-\-> parser +.Ve +.PP +Line 1, \f(CW\*(C`use Filter::cpp\*(C'\fR, includes and installs the \f(CW\*(C`cpp\*(C'\fR filter +module. All source filters work this way. The use statement is compiled +and executed at compile time, before any more of the file is read, and +it attaches the cpp filter to the source stream behind the scenes. Now +the data flow looks like this: +.PP +.Vb 1 +\& cpp_test \-\-\-\-> cpp filter \-\-\-\-> parser +.Ve +.PP +As the parser reads the second and subsequent lines from the source +stream, it feeds those lines through the \f(CW\*(C`cpp\*(C'\fR source filter before +processing them. The \f(CW\*(C`cpp\*(C'\fR filter simply passes each line through the +real C preprocessor. The output from the C preprocessor is then +inserted back into the source stream by the filter. +.PP +.Vb 5 +\& .\-> cpp \-\-. +\& | | +\& | | +\& | <\-\*(Aq +\& cpp_test \-\-\-\-> cpp filter \-\-\-\-> parser +.Ve +.PP +The parser then sees the following code: +.PP +.Vb 3 +\& use Filter::cpp; +\& $a = 1; +\& print "a = $a\en"; +.Ve +.PP +Let's consider what happens when the filtered code includes another +module with use: +.PP +.Vb 5 +\& 1: use Filter::cpp; +\& 2: #define TRUE 1 +\& 3: use Fred; +\& 4: $a = TRUE; +\& 5: print "a = $a\en"; +.Ve +.PP +The \f(CW\*(C`cpp\*(C'\fR filter does not apply to the text of the Fred module, only +to the text of the file that used it (\f(CW\*(C`cpp_test\*(C'\fR). Although the use +statement on line 3 will pass through the cpp filter, the module that +gets included (\f(CW\*(C`Fred\*(C'\fR) will not. The source streams look like this +after line 3 has been parsed and before line 4 is parsed: +.PP +.Vb 1 +\& cpp_test \-\-\-> cpp filter \-\-\-> parser (INACTIVE) +\& +\& Fred.pm \-\-\-\-> parser +.Ve +.PP +As you can see, a new stream has been created for reading the source +from \f(CW\*(C`Fred.pm\*(C'\fR. This stream will remain active until all of \f(CW\*(C`Fred.pm\*(C'\fR +has been parsed. The source stream for \f(CW\*(C`cpp_test\*(C'\fR will still exist, +but is inactive. Once the parser has finished reading Fred.pm, the +source stream associated with it will be destroyed. The source stream +for \f(CW\*(C`cpp_test\*(C'\fR then becomes active again and the parser reads line 4 +and subsequent lines from \f(CW\*(C`cpp_test\*(C'\fR. +.PP +You can use more than one source filter on a single file. Similarly, +you can reuse the same filter in as many files as you like. +.PP +For example, if you have a uuencoded and compressed source file, it is +possible to stack a uudecode filter and an uncompression filter like +this: +.PP +.Vb 4 +\& use Filter::uudecode; use Filter::uncompress; +\& M\*(AqXL(".H7/;1I;_>_I3=&E=%:F*I"T?22Q/ +\& M6]9* +\& ... +.Ve +.PP +Once the first line has been processed, the flow will look like this: +.PP +.Vb 2 +\& file \-\-\-> uudecode \-\-\-> uncompress \-\-\-> parser +\& filter filter +.Ve +.PP +Data flows through filters in the same order they appear in the source +file. The uudecode filter appeared before the uncompress filter, so the +source file will be uudecoded before it's uncompressed. +.SH "WRITING A SOURCE FILTER" +.IX Header "WRITING A SOURCE FILTER" +There are three ways to write your own source filter. You can write it +in C, use an external program as a filter, or write the filter in Perl. +I won't cover the first two in any great detail, so I'll get them out +of the way first. Writing the filter in Perl is most convenient, so +I'll devote the most space to it. +.SH "WRITING A SOURCE FILTER IN C" +.IX Header "WRITING A SOURCE FILTER IN C" +The first of the three available techniques is to write the filter +completely in C. The external module you create interfaces directly +with the source filter hooks provided by Perl. +.PP +The advantage of this technique is that you have complete control over +the implementation of your filter. The big disadvantage is the +increased complexity required to write the filter \- not only do you +need to understand the source filter hooks, but you also need a +reasonable knowledge of Perl guts. One of the few times it is worth +going to this trouble is when writing a source scrambler. The +\&\f(CW\*(C`decrypt\*(C'\fR filter (which unscrambles the source before Perl parses it) +included with the source filter distribution is an example of a C +source filter (see Decryption Filters, below). +.IP "\fBDecryption Filters\fR" 5 +.IX Item "Decryption Filters" +All decryption filters work on the principle of \*(L"security through +obscurity.\*(R" Regardless of how well you write a decryption filter and +how strong your encryption algorithm is, anyone determined enough can +retrieve the original source code. The reason is quite simple \- once +the decryption filter has decrypted the source back to its original +form, fragments of it will be stored in the computer's memory as Perl +parses it. The source might only be in memory for a short period of +time, but anyone possessing a debugger, skill, and lots of patience can +eventually reconstruct your program. +.Sp +That said, there are a number of steps that can be taken to make life +difficult for the potential cracker. The most important: Write your +decryption filter in C and statically link the decryption module into +the Perl binary. For further tips to make life difficult for the +potential cracker, see the file \fIdecrypt.pm\fR in the source filters +distribution. +.SH "CREATING A SOURCE FILTER AS A SEPARATE EXECUTABLE" +.IX Header "CREATING A SOURCE FILTER AS A SEPARATE EXECUTABLE" +An alternative to writing the filter in C is to create a separate +executable in the language of your choice. The separate executable +reads from standard input, does whatever processing is necessary, and +writes the filtered data to standard output. \f(CW\*(C`Filter::cpp\*(C'\fR is an +example of a source filter implemented as a separate executable \- the +executable is the C preprocessor bundled with your C compiler. +.PP +The source filter distribution includes two modules that simplify this +task: \f(CW\*(C`Filter::exec\*(C'\fR and \f(CW\*(C`Filter::sh\*(C'\fR. Both allow you to run any +external executable. Both use a coprocess to control the flow of data +into and out of the external executable. (For details on coprocesses, +see Stephens, W.R., \*(L"Advanced Programming in the \s-1UNIX\s0 Environment.\*(R" +Addison-Wesley, \s-1ISBN 0\-210\-56317\-7,\s0 pages 441\-445.) The difference +between them is that \f(CW\*(C`Filter::exec\*(C'\fR spawns the external command +directly, while \f(CW\*(C`Filter::sh\*(C'\fR spawns a shell to execute the external +command. (Unix uses the Bourne shell; \s-1NT\s0 uses the cmd shell.) Spawning +a shell allows you to make use of the shell metacharacters and +redirection facilities. +.PP +Here is an example script that uses \f(CW\*(C`Filter::sh\*(C'\fR: +.PP +.Vb 3 +\& use Filter::sh \*(Aqtr XYZ PQR\*(Aq; +\& $a = 1; +\& print "XYZ a = $a\en"; +.Ve +.PP +The output you'll get when the script is executed: +.PP +.Vb 1 +\& PQR a = 1 +.Ve +.PP +Writing a source filter as a separate executable works fine, but a +small performance penalty is incurred. For example, if you execute the +small example above, a separate subprocess will be created to run the +Unix \f(CW\*(C`tr\*(C'\fR command. Each use of the filter requires its own subprocess. +If creating subprocesses is expensive on your system, you might want to +consider one of the other options for creating source filters. +.SH "WRITING A SOURCE FILTER IN PERL" +.IX Header "WRITING A SOURCE FILTER IN PERL" +The easiest and most portable option available for creating your own +source filter is to write it completely in Perl. To distinguish this +from the previous two techniques, I'll call it a Perl source filter. +.PP +To help understand how to write a Perl source filter we need an example +to study. Here is a complete source filter that performs rot13 +decoding. (Rot13 is a very simple encryption scheme used in Usenet +postings to hide the contents of offensive posts. It moves every letter +forward thirteen places, so that A becomes N, B becomes O, and Z +becomes M.) +.PP +.Vb 1 +\& package Rot13; +\& +\& use Filter::Util::Call; +\& +\& sub import { +\& my ($type) = @_; +\& my ($ref) = []; +\& filter_add(bless $ref); +\& } +\& +\& sub filter { +\& my ($self) = @_; +\& my ($status); +\& +\& tr/n\-za\-mN\-ZA\-M/a\-zA\-Z/ +\& if ($status = filter_read()) > 0; +\& $status; +\& } +\& +\& 1; +.Ve +.PP +All Perl source filters are implemented as Perl classes and have the +same basic structure as the example above. +.PP +First, we include the \f(CW\*(C`Filter::Util::Call\*(C'\fR module, which exports a +number of functions into your filter's namespace. The filter shown +above uses two of these functions, \f(CW\*(C`filter_add()\*(C'\fR and +\&\f(CW\*(C`filter_read()\*(C'\fR. +.PP +Next, we create the filter object and associate it with the source +stream by defining the \f(CW\*(C`import\*(C'\fR function. If you know Perl well +enough, you know that \f(CW\*(C`import\*(C'\fR is called automatically every time a +module is included with a use statement. This makes \f(CW\*(C`import\*(C'\fR the ideal +place to both create and install a filter object. +.PP +In the example filter, the object (\f(CW$ref\fR) is blessed just like any +other Perl object. Our example uses an anonymous array, but this isn't +a requirement. Because this example doesn't need to store any context +information, we could have used a scalar or hash reference just as +well. The next section demonstrates context data. +.PP +The association between the filter object and the source stream is made +with the \f(CW\*(C`filter_add()\*(C'\fR function. This takes a filter object as a +parameter (\f(CW$ref\fR in this case) and installs it in the source stream. +.PP +Finally, there is the code that actually does the filtering. For this +type of Perl source filter, all the filtering is done in a method +called \f(CW\*(C`filter()\*(C'\fR. (It is also possible to write a Perl source filter +using a closure. See the \f(CW\*(C`Filter::Util::Call\*(C'\fR manual page for more +details.) It's called every time the Perl parser needs another line of +source to process. The \f(CW\*(C`filter()\*(C'\fR method, in turn, reads lines from +the source stream using the \f(CW\*(C`filter_read()\*(C'\fR function. +.PP +If a line was available from the source stream, \f(CW\*(C`filter_read()\*(C'\fR +returns a status value greater than zero and appends the line to \f(CW$_\fR. +A status value of zero indicates end-of-file, less than zero means an +error. The filter function itself is expected to return its status in +the same way, and put the filtered line it wants written to the source +stream in \f(CW$_\fR. The use of \f(CW$_\fR accounts for the brevity of most Perl +source filters. +.PP +In order to make use of the rot13 filter we need some way of encoding +the source file in rot13 format. The script below, \f(CW\*(C`mkrot13\*(C'\fR, does +just that. +.PP +.Vb 5 +\& die "usage mkrot13 filename\en" unless @ARGV; +\& my $in = $ARGV[0]; +\& my $out = "$in.tmp"; +\& open(IN, "<$in") or die "Cannot open file $in: $!\en"; +\& open(OUT, ">$out") or die "Cannot open file $out: $!\en"; +\& +\& print OUT "use Rot13;\en"; +\& while () { +\& tr/a\-zA\-Z/n\-za\-mN\-ZA\-M/; +\& print OUT; +\& } +\& +\& close IN; +\& close OUT; +\& unlink $in; +\& rename $out, $in; +.Ve +.PP +If we encrypt this with \f(CW\*(C`mkrot13\*(C'\fR: +.PP +.Vb 1 +\& print " hello fred \en"; +.Ve +.PP +the result will be this: +.PP +.Vb 2 +\& use Rot13; +\& cevag "uryyb serq\ea"; +.Ve +.PP +Running it produces this output: +.PP +.Vb 1 +\& hello fred +.Ve +.SH "USING CONTEXT: THE DEBUG FILTER" +.IX Header "USING CONTEXT: THE DEBUG FILTER" +The rot13 example was a trivial example. Here's another demonstration +that shows off a few more features. +.PP +Say you wanted to include a lot of debugging code in your Perl script +during development, but you didn't want it available in the released +product. Source filters offer a solution. In order to keep the example +simple, let's say you wanted the debugging output to be controlled by +an environment variable, \f(CW\*(C`DEBUG\*(C'\fR. Debugging code is enabled if the +variable exists, otherwise it is disabled. +.PP +Two special marker lines will bracket debugging code, like this: +.PP +.Vb 5 +\& ## DEBUG_BEGIN +\& if ($year > 1999) { +\& warn "Debug: millennium bug in year $year\en"; +\& } +\& ## DEBUG_END +.Ve +.PP +The filter ensures that Perl parses the code between the <\s-1DEBUG_BEGIN\s0> +and \f(CW\*(C`DEBUG_END\*(C'\fR markers only when the \f(CW\*(C`DEBUG\*(C'\fR environment variable +exists. That means that when \f(CW\*(C`DEBUG\*(C'\fR does exist, the code above +should be passed through the filter unchanged. The marker lines can +also be passed through as-is, because the Perl parser will see them as +comment lines. When \f(CW\*(C`DEBUG\*(C'\fR isn't set, we need a way to disable the +debug code. A simple way to achieve that is to convert the lines +between the two markers into comments: +.PP +.Vb 5 +\& ## DEBUG_BEGIN +\& #if ($year > 1999) { +\& # warn "Debug: millennium bug in year $year\en"; +\& #} +\& ## DEBUG_END +.Ve +.PP +Here is the complete Debug filter: +.PP +.Vb 1 +\& package Debug; +\& +\& use strict; +\& use warnings; +\& use Filter::Util::Call; +\& +\& use constant TRUE => 1; +\& use constant FALSE => 0; +\& +\& sub import { +\& my ($type) = @_; +\& my (%context) = ( +\& Enabled => defined $ENV{DEBUG}, +\& InTraceBlock => FALSE, +\& Filename => (caller)[1], +\& LineNo => 0, +\& LastBegin => 0, +\& ); +\& filter_add(bless \e%context); +\& } +\& +\& sub Die { +\& my ($self) = shift; +\& my ($message) = shift; +\& my ($line_no) = shift || $self\->{LastBegin}; +\& die "$message at $self\->{Filename} line $line_no.\en" +\& } +\& +\& sub filter { +\& my ($self) = @_; +\& my ($status); +\& $status = filter_read(); +\& ++ $self\->{LineNo}; +\& +\& # deal with EOF/error first +\& if ($status <= 0) { +\& $self\->Die("DEBUG_BEGIN has no DEBUG_END") +\& if $self\->{InTraceBlock}; +\& return $status; +\& } +\& +\& if ($self\->{InTraceBlock}) { +\& if (/^\es*##\es*DEBUG_BEGIN/ ) { +\& $self\->Die("Nested DEBUG_BEGIN", $self\->{LineNo}) +\& } elsif (/^\es*##\es*DEBUG_END/) { +\& $self\->{InTraceBlock} = FALSE; +\& } +\& +\& # comment out the debug lines when the filter is disabled +\& s/^/#/ if ! $self\->{Enabled}; +\& } elsif ( /^\es*##\es*DEBUG_BEGIN/ ) { +\& $self\->{InTraceBlock} = TRUE; +\& $self\->{LastBegin} = $self\->{LineNo}; +\& } elsif ( /^\es*##\es*DEBUG_END/ ) { +\& $self\->Die("DEBUG_END has no DEBUG_BEGIN", $self\->{LineNo}); +\& } +\& return $status; +\& } +\& +\& 1; +.Ve +.PP +The big difference between this filter and the previous example is the +use of context data in the filter object. The filter object is based on +a hash reference, and is used to keep various pieces of context +information between calls to the filter function. All but two of the +hash fields are used for error reporting. The first of those two, +Enabled, is used by the filter to determine whether the debugging code +should be given to the Perl parser. The second, InTraceBlock, is true +when the filter has encountered a \f(CW\*(C`DEBUG_BEGIN\*(C'\fR line, but has not yet +encountered the following \f(CW\*(C`DEBUG_END\*(C'\fR line. +.PP +If you ignore all the error checking that most of the code does, the +essence of the filter is as follows: +.PP +.Vb 4 +\& sub filter { +\& my ($self) = @_; +\& my ($status); +\& $status = filter_read(); +\& +\& # deal with EOF/error first +\& return $status if $status <= 0; +\& if ($self\->{InTraceBlock}) { +\& if (/^\es*##\es*DEBUG_END/) { +\& $self\->{InTraceBlock} = FALSE +\& } +\& +\& # comment out debug lines when the filter is disabled +\& s/^/#/ if ! $self\->{Enabled}; +\& } elsif ( /^\es*##\es*DEBUG_BEGIN/ ) { +\& $self\->{InTraceBlock} = TRUE; +\& } +\& return $status; +\& } +.Ve +.PP +Be warned: just as the C\-preprocessor doesn't know C, the Debug filter +doesn't know Perl. It can be fooled quite easily: +.PP +.Vb 3 +\& print < +.PP +Currently the content of the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR block is not filtered. +.PP +Currently internal buffer lengths are limited to 32\-bit only. +.SH "THINGS TO LOOK OUT FOR" +.IX Header "THINGS TO LOOK OUT FOR" +.ie n .IP "Some Filters Clobber the ""DATA"" Handle" 5 +.el .IP "Some Filters Clobber the \f(CWDATA\fR Handle" 5 +.IX Item "Some Filters Clobber the DATA Handle" +Some source filters use the \f(CW\*(C`DATA\*(C'\fR handle to read the calling program. +When using these source filters you cannot rely on this handle, nor expect +any particular kind of behavior when operating on it. Filters based on +Filter::Util::Call (and therefore Filter::Simple) do not alter the \f(CW\*(C`DATA\*(C'\fR +filehandle, but on the other hand totally ignore the text after \f(CW\*(C`_\|_DATA_\|_\*(C'\fR. +.SH "REQUIREMENTS" +.IX Header "REQUIREMENTS" +The Source Filters distribution is available on \s-1CPAN,\s0 in +.PP +.Vb 1 +\& CPAN/modules/by\-module/Filter +.Ve +.PP +Starting from Perl 5.8 Filter::Util::Call (the core part of the +Source Filters distribution) is part of the standard Perl distribution. +Also included is a friendlier interface called Filter::Simple, by +Damian Conway. +.SH "AUTHOR" +.IX Header "AUTHOR" +Paul Marquess +.PP +Reini Urban +.SH "Copyrights" +.IX Header "Copyrights" +The first version of this article originally appeared in The Perl +Journal #11, and is copyright 1998 The Perl Journal. It appears +courtesy of Jon Orwant and The Perl Journal. This document may be +distributed under the same terms as Perl itself. diff --git a/data/miniconda3/man/man1/perlform.1 b/data/miniconda3/man/man1/perlform.1 new file mode 100644 index 0000000000000000000000000000000000000000..4858e7b2ebb1244e67bdd6ef13db754d13b87ec8 --- /dev/null +++ b/data/miniconda3/man/man1/perlform.1 @@ -0,0 +1,592 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLFORM 1" +.TH PERLFORM 1 "2020-12-18" "perl v5.32.1" "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" +perlform \- Perl formats +.IX Xref "format report chart" +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Perl has a mechanism to help you generate simple reports and charts. To +facilitate this, Perl helps you code up your output page close to how it +will look when it's printed. It can keep track of things like how many +lines are on a page, what page you're on, when to print page headers, +etc. Keywords are borrowed from \s-1FORTRAN:\s0 \fBformat()\fR to declare and \fBwrite()\fR +to execute; see their entries in perlfunc. Fortunately, the layout is +much more legible, more like \s-1BASIC\s0's \s-1PRINT USING\s0 statement. Think of it +as a poor man's \fBnroff\fR\|(1). +.IX Xref "nroff" +.PP +Formats, like packages and subroutines, are declared rather than +executed, so they may occur at any point in your program. (Usually it's +best to keep them all together though.) They have their own namespace +apart from all the other \*(L"types\*(R" in Perl. This means that if you have a +function named \*(L"Foo\*(R", it is not the same thing as having a format named +\&\*(L"Foo\*(R". However, the default name for the format associated with a given +filehandle is the same as the name of the filehandle. Thus, the default +format for \s-1STDOUT\s0 is named \*(L"\s-1STDOUT\*(R",\s0 and the default format for filehandle +\&\s-1TEMP\s0 is named \*(L"\s-1TEMP\*(R".\s0 They just look the same. They aren't. +.PP +Output record formats are declared as follows: +.PP +.Vb 3 +\& format NAME = +\& FORMLIST +\& . +.Ve +.PP +If the name is omitted, format \*(L"\s-1STDOUT\*(R"\s0 is defined. A single \*(L".\*(R" in +column 1 is used to terminate a format. \s-1FORMLIST\s0 consists of a sequence +of lines, each of which may be one of three types: +.IP "1." 4 +A comment, indicated by putting a '#' in the first column. +.IP "2." 4 +A \*(L"picture\*(R" line giving the format for one output line. +.IP "3." 4 +An argument line supplying values to plug into the previous picture line. +.PP +Picture lines contain output field definitions, intermingled with +literal text. These lines do not undergo any kind of variable interpolation. +Field definitions are made up from a set of characters, for starting and +extending a field to its desired width. This is the complete set of +characters for field definitions: +.IX Xref "format, picture line @ ^ < | > # 0 . ... @* ^* ~ ~~" +.PP +.Vb 10 +\& @ start of regular field +\& ^ start of special field +\& < pad character for left justification +\& | pad character for centering +\& > pad character for right justification +\& # pad character for a right\-justified numeric field +\& 0 instead of first #: pad number with leading zeroes +\& . decimal point within a numeric field +\& ... terminate a text field, show "..." as truncation evidence +\& @* variable width field for a multi\-line value +\& ^* variable width field for next line of a multi\-line value +\& ~ suppress line with all fields empty +\& ~~ repeat line until all fields are exhausted +.Ve +.PP +Each field in a picture line starts with either \*(L"@\*(R" (at) or \*(L"^\*(R" (caret), +indicating what we'll call, respectively, a \*(L"regular\*(R" or \*(L"special\*(R" field. +The choice of pad characters determines whether a field is textual or +numeric. The tilde operators are not part of a field. Let's look at +the various possibilities in detail. +.SS "Text Fields" +.IX Xref "format, text field" +.IX Subsection "Text Fields" +The length of the field is supplied by padding out the field with multiple +\&\*(L"<\*(R", \*(L">\*(R", or \*(L"|\*(R" characters to specify a non-numeric field with, +respectively, left justification, right justification, or centering. +For a regular field, the value (up to the first newline) is taken and +printed according to the selected justification, truncating excess characters. +If you terminate a text field with \*(L"...\*(R", three dots will be shown if +the value is truncated. A special text field may be used to do rudimentary +multi-line text block filling; see \*(L"Using Fill Mode\*(R" for details. +.PP +.Vb 7 +\& Example: +\& format STDOUT = +\& @<<<<<< @|||||| @>>>>>> +\& "left", "middle", "right" +\& . +\& Output: +\& left middle right +.Ve +.SS "Numeric Fields" +.IX Xref "# format, numeric field" +.IX Subsection "Numeric Fields" +Using \*(L"#\*(R" as a padding character specifies a numeric field, with +right justification. An optional \*(L".\*(R" defines the position of the +decimal point. With a \*(L"0\*(R" (zero) instead of the first \*(L"#\*(R", the +formatted number will be padded with leading zeroes if necessary. +A special numeric field is blanked out if the value is undefined. +If the resulting value would exceed the width specified the field is +filled with \*(L"#\*(R" as overflow evidence. +.PP +.Vb 7 +\& Example: +\& format STDOUT = +\& @### @.### @##.### @### @### ^#### +\& 42, 3.1415, undef, 0, 10000, undef +\& . +\& Output: +\& 42 3.142 0.000 0 #### +.Ve +.SS "The Field @* for Variable-Width Multi-Line Text" +.IX Xref "@*" +.IX Subsection "The Field @* for Variable-Width Multi-Line Text" +The field \*(L"@*\*(R" can be used for printing multi-line, nontruncated +values; it should (but need not) appear by itself on a line. A final +line feed is chomped off, but all other characters are emitted verbatim. +.SS "The Field ^* for Variable-Width One-line-at-a-time Text" +.IX Xref "^*" +.IX Subsection "The Field ^* for Variable-Width One-line-at-a-time Text" +Like \*(L"@*\*(R", this is a variable-width field. The value supplied must be a +scalar variable. Perl puts the first line (up to the first \*(L"\en\*(R") of the +text into the field, and then chops off the front of the string so that +the next time the variable is referenced, more of the text can be printed. +The variable will \fInot\fR be restored. +.PP +.Vb 12 +\& Example: +\& $text = "line 1\enline 2\enline 3"; +\& format STDOUT = +\& Text: ^* +\& $text +\& ~~ ^* +\& $text +\& . +\& Output: +\& Text: line 1 +\& line 2 +\& line 3 +.Ve +.SS "Specifying Values" +.IX Xref "format, specifying values" +.IX Subsection "Specifying Values" +The values are specified on the following format line in the same order as +the picture fields. The expressions providing the values must be +separated by commas. They are all evaluated in a list context +before the line is processed, so a single list expression could produce +multiple list elements. The expressions may be spread out to more than +one line if enclosed in braces. If so, the opening brace must be the first +token on the first line. If an expression evaluates to a number with a +decimal part, and if the corresponding picture specifies that the decimal +part should appear in the output (that is, any picture except multiple \*(L"#\*(R" +characters \fBwithout\fR an embedded \*(L".\*(R"), the character used for the decimal +point is determined by the current \s-1LC_NUMERIC\s0 locale if \f(CW\*(C`use locale\*(C'\fR is in +effect. This means that, if, for example, the run-time environment happens +to specify a German locale, \*(L",\*(R" will be used instead of the default \*(L".\*(R". See +perllocale and \*(L"\s-1WARNINGS\*(R"\s0 for more information. +.SS "Using Fill Mode" +.IX Xref "format, fill mode" +.IX Subsection "Using Fill Mode" +On text fields the caret enables a kind of fill mode. Instead of an +arbitrary expression, the value supplied must be a scalar variable +that contains a text string. Perl puts the next portion of the text into +the field, and then chops off the front of the string so that the next time +the variable is referenced, more of the text can be printed. (Yes, this +means that the variable itself is altered during execution of the \fBwrite()\fR +call, and is not restored.) The next portion of text is determined by +a crude line-breaking algorithm. You may use the carriage return character +(\f(CW\*(C`\er\*(C'\fR) to force a line break. You can change which characters are legal +to break on by changing the variable \f(CW$:\fR (that's +\&\f(CW$FORMAT_LINE_BREAK_CHARACTERS\fR if you're using the English module) to a +list of the desired characters. +.PP +Normally you would use a sequence of fields in a vertical stack associated +with the same scalar variable to print out a block of text. You might wish +to end the final field with the text \*(L"...\*(R", which will appear in the output +if the text was too long to appear in its entirety. +.SS "Suppressing Lines Where All Fields Are Void" +.IX Xref "format, suppressing lines" +.IX Subsection "Suppressing Lines Where All Fields Are Void" +Using caret fields can produce lines where all fields are blank. You can +suppress such lines by putting a \*(L"~\*(R" (tilde) character anywhere in the +line. The tilde will be translated to a space upon output. +.SS "Repeating Format Lines" +.IX Xref "format, repeating lines" +.IX Subsection "Repeating Format Lines" +If you put two contiguous tilde characters \*(L"~~\*(R" anywhere into a line, +the line will be repeated until all the fields on the line are exhausted, +i.e. undefined. For special (caret) text fields this will occur sooner or +later, but if you use a text field of the at variety, the expression you +supply had better not give the same value every time forever! (\f(CW\*(C`shift(@f)\*(C'\fR +is a simple example that would work.) Don't use a regular (at) numeric +field in such lines, because it will never go blank. +.SS "Top of Form Processing" +.IX Xref "format, top of form top header" +.IX Subsection "Top of Form Processing" +Top-of-form processing is by default handled by a format with the +same name as the current filehandle with \*(L"_TOP\*(R" concatenated to it. +It's triggered at the top of each page. See \*(L"write\*(R" in perlfunc. +.PP +Examples: +.PP +.Vb 10 +\& # a report on the /etc/passwd file +\& format STDOUT_TOP = +\& Passwd File +\& Name Login Office Uid Gid Home +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& . +\& format STDOUT = +\& @<<<<<<<<<<<<<<<<<< @||||||| @<<<<<<@>>>> @>>>> @<<<<<<<<<<<<<<<<< +\& $name, $login, $office,$uid,$gid, $home +\& . +\& +\& +\& # a report from a bug report form +\& format STDOUT_TOP = +\& Bug Reports +\& @<<<<<<<<<<<<<<<<<<<<<<< @||| @>>>>>>>>>>>>>>>>>>>>>>> +\& $system, $%, $date +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& . +\& format STDOUT = +\& Subject: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $subject +\& Index: @<<<<<<<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $index, $description +\& Priority: @<<<<<<<<<< Date: @<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $priority, $date, $description +\& From: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $from, $description +\& Assigned to: @<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $programmer, $description +\& ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $description +\& ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $description +\& ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $description +\& ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $description +\& ~ ^<<<<<<<<<<<<<<<<<<<<<<<... +\& $description +\& . +.Ve +.PP +It is possible to intermix \fBprint()\fRs with \fBwrite()\fRs on the same output +channel, but you'll have to handle \f(CW\*(C`$\-\*(C'\fR (\f(CW$FORMAT_LINES_LEFT\fR) +yourself. +.SS "Format Variables" +.IX Xref "format variables format, variables" +.IX Subsection "Format Variables" +The current format name is stored in the variable \f(CW$~\fR (\f(CW$FORMAT_NAME\fR), +and the current top of form format name is in \f(CW$^\fR (\f(CW$FORMAT_TOP_NAME\fR). +The current output page number is stored in \f(CW$%\fR (\f(CW$FORMAT_PAGE_NUMBER\fR), +and the number of lines on the page is in \f(CW$=\fR (\f(CW$FORMAT_LINES_PER_PAGE\fR). +Whether to autoflush output on this handle is stored in \f(CW$|\fR +(\f(CW$OUTPUT_AUTOFLUSH\fR). The string output before each top of page (except +the first) is stored in \f(CW$^L\fR (\f(CW$FORMAT_FORMFEED\fR). These variables are +set on a per-filehandle basis, so you'll need to \fBselect()\fR into a different +one to affect them: +.PP +.Vb 4 +\& select((select(OUTF), +\& $~ = "My_Other_Format", +\& $^ = "My_Top_Format" +\& )[0]); +.Ve +.PP +Pretty ugly, eh? It's a common idiom though, so don't be too surprised +when you see it. You can at least use a temporary variable to hold +the previous filehandle: (this is a much better approach in general, +because not only does legibility improve, you now have an intermediary +stage in the expression to single-step the debugger through): +.PP +.Vb 4 +\& $ofh = select(OUTF); +\& $~ = "My_Other_Format"; +\& $^ = "My_Top_Format"; +\& select($ofh); +.Ve +.PP +If you use the English module, you can even read the variable names: +.PP +.Vb 5 +\& use English; +\& $ofh = select(OUTF); +\& $FORMAT_NAME = "My_Other_Format"; +\& $FORMAT_TOP_NAME = "My_Top_Format"; +\& select($ofh); +.Ve +.PP +But you still have those funny \fBselect()\fRs. So just use the FileHandle +module. Now, you can access these special variables using lowercase +method names instead: +.PP +.Vb 3 +\& use FileHandle; +\& format_name OUTF "My_Other_Format"; +\& format_top_name OUTF "My_Top_Format"; +.Ve +.PP +Much better! +.SH "NOTES" +.IX Header "NOTES" +Because the values line may contain arbitrary expressions (for at fields, +not caret fields), you can farm out more sophisticated processing +to other functions, like \fBsprintf()\fR or one of your own. For example: +.PP +.Vb 4 +\& format Ident = +\& @<<<<<<<<<<<<<<< +\& &commify($n) +\& . +.Ve +.PP +To get a real at or caret into the field, do this: +.PP +.Vb 4 +\& format Ident = +\& I have an @ here. +\& "@" +\& . +.Ve +.PP +To center a whole line of text, do something like this: +.PP +.Vb 4 +\& format Ident = +\& @||||||||||||||||||||||||||||||||||||||||||||||| +\& "Some text line" +\& . +.Ve +.PP +There is no builtin way to say \*(L"float this to the right hand side +of the page, however wide it is.\*(R" You have to specify where it goes. +The truly desperate can generate their own format on the fly, based +on the current number of columns, and then \fBeval()\fR it: +.PP +.Vb 9 +\& $format = "format STDOUT = \en" +\& . \*(Aq^\*(Aq . \*(Aq<\*(Aq x $cols . "\en" +\& . \*(Aq$entry\*(Aq . "\en" +\& . "\et^" . "<" x ($cols\-8) . "~~\en" +\& . \*(Aq$entry\*(Aq . "\en" +\& . ".\en"; +\& print $format if $Debugging; +\& eval $format; +\& die $@ if $@; +.Ve +.PP +Which would generate a format looking something like this: +.PP +.Vb 6 +\& format STDOUT = +\& ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +\& $entry +\& ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ +\& $entry +\& . +.Ve +.PP +Here's a little program that's somewhat like \fBfmt\fR\|(1): +.PP +.Vb 3 +\& format = +\& ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~ +\& $_ +\& +\& . +\& +\& $/ = \*(Aq\*(Aq; +\& while (<>) { +\& s/\es*\en\es*/ /g; +\& write; +\& } +.Ve +.SS "Footers" +.IX Xref "format, footer footer" +.IX Subsection "Footers" +While \f(CW$FORMAT_TOP_NAME\fR contains the name of the current header format, +there is no corresponding mechanism to automatically do the same thing +for a footer. Not knowing how big a format is going to be until you +evaluate it is one of the major problems. It's on the \s-1TODO\s0 list. +.PP +Here's one strategy: If you have a fixed-size footer, you can get footers +by checking \f(CW$FORMAT_LINES_LEFT\fR before each \fBwrite()\fR and print the footer +yourself if necessary. +.PP +Here's another strategy: Open a pipe to yourself, using \f(CW\*(C`open(MYSELF, "|\-")\*(C'\fR +(see \*(L"open\*(R" in perlfunc) and always \fBwrite()\fR to \s-1MYSELF\s0 instead of \s-1STDOUT.\s0 +Have your child process massage its \s-1STDIN\s0 to rearrange headers and footers +however you like. Not very convenient, but doable. +.SS "Accessing Formatting Internals" +.IX Xref "format, internals" +.IX Subsection "Accessing Formatting Internals" +For low-level access to the formatting mechanism, you may use \fBformline()\fR +and access \f(CW$^A\fR (the \f(CW$ACCUMULATOR\fR variable) directly. +.PP +For example: +.PP +.Vb 3 +\& $str = formline <<\*(AqEND\*(Aq, 1,2,3; +\& @<<< @||| @>>> +\& END +\& +\& print "Wow, I just stored \*(Aq$^A\*(Aq in the accumulator!\en"; +.Ve +.PP +Or to make an \fBswrite()\fR subroutine, which is to \fBwrite()\fR what \fBsprintf()\fR +is to \fBprintf()\fR, do this: +.PP +.Vb 8 +\& use Carp; +\& sub swrite { +\& croak "usage: swrite PICTURE ARGS" unless @_; +\& my $format = shift; +\& $^A = ""; +\& formline($format,@_); +\& return $^A; +\& } +\& +\& $string = swrite(<<\*(AqEND\*(Aq, 1, 2, 3); +\& Check me out +\& @<<< @||| @>>> +\& END +\& print $string; +.Ve +.SH "WARNINGS" +.IX Header "WARNINGS" +The lone dot that ends a format can also prematurely end a mail +message passing through a misconfigured Internet mailer (and based on +experience, such misconfiguration is the rule, not the exception). So +when sending format code through mail, you should indent it so that +the format-ending dot is not on the left margin; this will prevent +\&\s-1SMTP\s0 cutoff. +.PP +Lexical variables (declared with \*(L"my\*(R") are not visible within a +format unless the format is declared within the scope of the lexical +variable. +.PP +If a program's environment specifies an \s-1LC_NUMERIC\s0 locale and \f(CW\*(C`use +locale\*(C'\fR is in effect when the format is declared, the locale is used +to specify the decimal point character in formatted output. Formatted +output cannot be controlled by \f(CW\*(C`use locale\*(C'\fR at the time when \fBwrite()\fR +is called. See perllocale for further discussion of locale handling. +.PP +Within strings that are to be displayed in a fixed-length text field, +each control character is substituted by a space. (But remember the +special meaning of \f(CW\*(C`\er\*(C'\fR when using fill mode.) This is done to avoid +misalignment when control characters \*(L"disappear\*(R" on some output media. diff --git a/data/miniconda3/man/man1/perlfreebsd.1 b/data/miniconda3/man/man1/perlfreebsd.1 new file mode 100644 index 0000000000000000000000000000000000000000..e3f8451b2e479fdb94ffc99e71d432e371cf8d36 --- /dev/null +++ b/data/miniconda3/man/man1/perlfreebsd.1 @@ -0,0 +1,172 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLFREEBSD 1" +.TH PERLFREEBSD 1 "2020-12-18" "perl v5.32.1" "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" +perlfreebsd \- Perl version 5 on FreeBSD systems +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes various features of FreeBSD that will affect how Perl +version 5 (hereafter just Perl) is compiled and/or runs. +.SS "FreeBSD core dumps from readdir_r with ithreads" +.IX Subsection "FreeBSD core dumps from readdir_r with ithreads" +When perl is configured to use ithreads, it will use re-entrant library calls +in preference to non-re-entrant versions. There is a bug in FreeBSD's +\&\f(CW\*(C`readdir_r\*(C'\fR function in versions 4.5 and earlier that can cause a \s-1SEGV\s0 when +reading large directories. A patch for FreeBSD libc is available +(see ) +which has been integrated into FreeBSD 4.6. +.ie n .SS "$^X doesn't always contain a full path in FreeBSD" +.el .SS "\f(CW$^X\fP doesn't always contain a full path in FreeBSD" +.IX Subsection "$^X doesn't always contain a full path in FreeBSD" +perl sets \f(CW$^X\fR where possible to a full path by asking the operating +system. On FreeBSD the full path of the perl interpreter is found by using +\&\f(CW\*(C`sysctl\*(C'\fR with \f(CW\*(C`KERN_PROC_PATHNAME\*(C'\fR if that is supported, else by reading +the symlink \fI/proc/curproc/file\fR. FreeBSD 7 and earlier has a bug where +either approach sometimes returns an incorrect value +(see ). +In these cases perl will fall back to the old behaviour of using C's +\&\f(CW\*(C`argv[0]\*(C'\fR value for \f(CW$^X\fR. +.SH "AUTHOR" +.IX Header "AUTHOR" +Nicholas Clark , collating wisdom supplied by Slaven Rezic +and Tim Bunce. +.PP +Please report any errors, updates, or suggestions to +. diff --git a/data/miniconda3/man/man1/perlguts.1 b/data/miniconda3/man/man1/perlguts.1 new file mode 100644 index 0000000000000000000000000000000000000000..1d41bf6eb70a4bbe9411f9c40bd1f58c4c10f471 --- /dev/null +++ b/data/miniconda3/man/man1/perlguts.1 @@ -0,0 +1,4189 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLGUTS 1" +.TH PERLGUTS 1 "2020-12-18" "perl v5.32.1" "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" +perlguts \- Introduction to the Perl API +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document attempts to describe how to use the Perl \s-1API,\s0 as well as +to provide some info on the basic workings of the Perl core. It is far +from complete and probably contains many errors. Please refer any +questions or comments to the author below. +.SH "Variables" +.IX Header "Variables" +.SS "Datatypes" +.IX Subsection "Datatypes" +Perl has three typedefs that handle Perl's three main data types: +.PP +.Vb 3 +\& SV Scalar Value +\& AV Array Value +\& HV Hash Value +.Ve +.PP +Each typedef has specific routines that manipulate the various data types. +.ie n .SS "What is an ""\s-1IV""\s0?" +.el .SS "What is an ``\s-1IV''\s0?" +.IX Subsection "What is an IV?" +Perl uses a special typedef \s-1IV\s0 which is a simple signed integer type that is +guaranteed to be large enough to hold a pointer (as well as an integer). +Additionally, there is the \s-1UV,\s0 which is simply an unsigned \s-1IV.\s0 +.PP +Perl also uses two special typedefs, I32 and I16, which will always be at +least 32\-bits and 16\-bits long, respectively. (Again, there are U32 and U16, +as well.) They will usually be exactly 32 and 16 bits long, but on Crays +they will both be 64 bits. +.SS "Working with SVs" +.IX Subsection "Working with SVs" +An \s-1SV\s0 can be created and loaded with one command. There are five types of +values that can be loaded: an integer value (\s-1IV\s0), an unsigned integer +value (\s-1UV\s0), a double (\s-1NV\s0), a string (\s-1PV\s0), and another scalar (\s-1SV\s0). +(\*(L"\s-1PV\*(R"\s0 stands for \*(L"Pointer Value\*(R". You might think that it is misnamed +because it is described as pointing only to strings. However, it is +possible to have it point to other things. For example, it could point +to an array of UVs. But, +using it for non-strings requires care, as the underlying assumption of +much of the internals is that PVs are just for strings. Often, for +example, a trailing \f(CW\*(C`NUL\*(C'\fR is tacked on automatically. The non-string use +is documented only in this paragraph.) +.PP +The seven routines are: +.PP +.Vb 7 +\& SV* newSViv(IV); +\& SV* newSVuv(UV); +\& SV* newSVnv(double); +\& SV* newSVpv(const char*, STRLEN); +\& SV* newSVpvn(const char*, STRLEN); +\& SV* newSVpvf(const char*, ...); +\& SV* newSVsv(SV*); +.Ve +.PP +\&\f(CW\*(C`STRLEN\*(C'\fR is an integer type (\f(CW\*(C`Size_t\*(C'\fR, usually defined as \f(CW\*(C`size_t\*(C'\fR in +\&\fIconfig.h\fR) guaranteed to be large enough to represent the size of +any string that perl can handle. +.PP +In the unlikely case of a \s-1SV\s0 requiring more complex initialization, you +can create an empty \s-1SV\s0 with newSV(len). If \f(CW\*(C`len\*(C'\fR is 0 an empty \s-1SV\s0 of +type \s-1NULL\s0 is returned, else an \s-1SV\s0 of type \s-1PV\s0 is returned with len + 1 (for +the \f(CW\*(C`NUL\*(C'\fR) bytes of storage allocated, accessible via SvPVX. In both cases +the \s-1SV\s0 has the undef value. +.PP +.Vb 3 +\& SV *sv = newSV(0); /* no storage allocated */ +\& SV *sv = newSV(10); /* 10 (+1) bytes of uninitialised storage +\& * allocated */ +.Ve +.PP +To change the value of an \fIalready-existing\fR \s-1SV,\s0 there are eight routines: +.PP +.Vb 9 +\& void sv_setiv(SV*, IV); +\& void sv_setuv(SV*, UV); +\& void sv_setnv(SV*, double); +\& void sv_setpv(SV*, const char*); +\& void sv_setpvn(SV*, const char*, STRLEN) +\& void sv_setpvf(SV*, const char*, ...); +\& void sv_vsetpvfn(SV*, const char*, STRLEN, va_list *, +\& SV **, Size_t, bool *); +\& void sv_setsv(SV*, SV*); +.Ve +.PP +Notice that you can choose to specify the length of the string to be +assigned by using \f(CW\*(C`sv_setpvn\*(C'\fR, \f(CW\*(C`newSVpvn\*(C'\fR, or \f(CW\*(C`newSVpv\*(C'\fR, or you may +allow Perl to calculate the length by using \f(CW\*(C`sv_setpv\*(C'\fR or by specifying +0 as the second argument to \f(CW\*(C`newSVpv\*(C'\fR. Be warned, though, that Perl will +determine the string's length by using \f(CW\*(C`strlen\*(C'\fR, which depends on the +string terminating with a \f(CW\*(C`NUL\*(C'\fR character, and not otherwise containing +NULs. +.PP +The arguments of \f(CW\*(C`sv_setpvf\*(C'\fR are processed like \f(CW\*(C`sprintf\*(C'\fR, and the +formatted output becomes the value. +.PP +\&\f(CW\*(C`sv_vsetpvfn\*(C'\fR is an analogue of \f(CW\*(C`vsprintf\*(C'\fR, but it allows you to specify +either a pointer to a variable argument list or the address and length of +an array of SVs. The last argument points to a boolean; on return, if that +boolean is true, then locale-specific information has been used to format +the string, and the string's contents are therefore untrustworthy (see +perlsec). This pointer may be \s-1NULL\s0 if that information is not +important. Note that this function requires you to specify the length of +the format. +.PP +The \f(CW\*(C`sv_set*()\*(C'\fR functions are not generic enough to operate on values +that have \*(L"magic\*(R". See \*(L"Magic Virtual Tables\*(R" later in this document. +.PP +All SVs that contain strings should be terminated with a \f(CW\*(C`NUL\*(C'\fR character. +If it is not \f(CW\*(C`NUL\*(C'\fR\-terminated there is a risk of +core dumps and corruptions from code which passes the string to C +functions or system calls which expect a \f(CW\*(C`NUL\*(C'\fR\-terminated string. +Perl's own functions typically add a trailing \f(CW\*(C`NUL\*(C'\fR for this reason. +Nevertheless, you should be very careful when you pass a string stored +in an \s-1SV\s0 to a C function or system call. +.PP +To access the actual value that an \s-1SV\s0 points to, you can use the macros: +.PP +.Vb 5 +\& SvIV(SV*) +\& SvUV(SV*) +\& SvNV(SV*) +\& SvPV(SV*, STRLEN len) +\& SvPV_nolen(SV*) +.Ve +.PP +which will automatically coerce the actual scalar type into an \s-1IV, UV,\s0 double, +or string. +.PP +In the \f(CW\*(C`SvPV\*(C'\fR macro, the length of the string returned is placed into the +variable \f(CW\*(C`len\*(C'\fR (this is a macro, so you do \fInot\fR use \f(CW&len\fR). If you do +not care what the length of the data is, use the \f(CW\*(C`SvPV_nolen\*(C'\fR macro. +Historically the \f(CW\*(C`SvPV\*(C'\fR macro with the global variable \f(CW\*(C`PL_na\*(C'\fR has been +used in this case. But that can be quite inefficient because \f(CW\*(C`PL_na\*(C'\fR must +be accessed in thread-local storage in threaded Perl. In any case, remember +that Perl allows arbitrary strings of data that may both contain NULs and +might not be terminated by a \f(CW\*(C`NUL\*(C'\fR. +.PP +Also remember that C doesn't allow you to safely say \f(CW\*(C`foo(SvPV(s, len), +len);\*(C'\fR. It might work with your +compiler, but it won't work for everyone. +Break this sort of statement up into separate assignments: +.PP +.Vb 5 +\& SV *s; +\& STRLEN len; +\& char *ptr; +\& ptr = SvPV(s, len); +\& foo(ptr, len); +.Ve +.PP +If you want to know if the scalar value is \s-1TRUE,\s0 you can use: +.PP +.Vb 1 +\& SvTRUE(SV*) +.Ve +.PP +Although Perl will automatically grow strings for you, if you need to force +Perl to allocate more memory for your \s-1SV,\s0 you can use the macro +.PP +.Vb 1 +\& SvGROW(SV*, STRLEN newlen) +.Ve +.PP +which will determine if more memory needs to be allocated. If so, it will +call the function \f(CW\*(C`sv_grow\*(C'\fR. Note that \f(CW\*(C`SvGROW\*(C'\fR can only increase, not +decrease, the allocated memory of an \s-1SV\s0 and that it does not automatically +add space for the trailing \f(CW\*(C`NUL\*(C'\fR byte (perl's own string functions typically do +\&\f(CW\*(C`SvGROW(sv, len + 1)\*(C'\fR). +.PP +If you want to write to an existing \s-1SV\s0's buffer and set its value to a +string, use \fBSvPV_force()\fR or one of its variants to force the \s-1SV\s0 to be +a \s-1PV.\s0 This will remove any of various types of non-stringness from +the \s-1SV\s0 while preserving the content of the \s-1SV\s0 in the \s-1PV.\s0 This can be +used, for example, to append data from an \s-1API\s0 function to a buffer +without extra copying: +.PP +.Vb 11 +\& (void)SvPVbyte_force(sv, len); +\& s = SvGROW(sv, len + needlen + 1); +\& /* something that modifies up to needlen bytes at s+len, but +\& modifies newlen bytes +\& eg. newlen = read(fd, s + len, needlen); +\& ignoring errors for these examples +\& */ +\& s[len + newlen] = \*(Aq\e0\*(Aq; +\& SvCUR_set(sv, len + newlen); +\& SvUTF8_off(sv); +\& SvSETMAGIC(sv); +.Ve +.PP +If you already have the data in memory or if you want to keep your +code simple, you can use one of the sv_cat*() variants, such as +\&\fBsv_catpvn()\fR. If you want to insert anywhere in the string you can use +\&\fBsv_insert()\fR or \fBsv_insert_flags()\fR. +.PP +If you don't need the existing content of the \s-1SV,\s0 you can avoid some +copying with: +.PP +.Vb 10 +\& SvPVCLEAR(sv); +\& s = SvGROW(sv, needlen + 1); +\& /* something that modifies up to needlen bytes at s, but modifies +\& newlen bytes +\& eg. newlen = read(fd, s. needlen); +\& */ +\& s[newlen] = \*(Aq\e0\*(Aq; +\& SvCUR_set(sv, newlen); +\& SvPOK_only(sv); /* also clears SVf_UTF8 */ +\& SvSETMAGIC(sv); +.Ve +.PP +Again, if you already have the data in memory or want to avoid the +complexity of the above, you can use \fBsv_setpvn()\fR. +.PP +If you have a buffer allocated with \fBNewx()\fR and want to set that as the +\&\s-1SV\s0's value, you can use \fBsv_usepvn_flags()\fR. That has some requirements +if you want to avoid perl re-allocating the buffer to fit the trailing +\&\s-1NUL:\s0 +.PP +.Vb 5 +\& Newx(buf, somesize+1, char); +\& /* ... fill in buf ... */ +\& buf[somesize] = \*(Aq\e0\*(Aq; +\& sv_usepvn_flags(sv, buf, somesize, SV_SMAGIC | SV_HAS_TRAILING_NUL); +\& /* buf now belongs to perl, don\*(Aqt release it */ +.Ve +.PP +If you have an \s-1SV\s0 and want to know what kind of data Perl thinks is stored +in it, you can use the following macros to check the type of \s-1SV\s0 you have. +.PP +.Vb 3 +\& SvIOK(SV*) +\& SvNOK(SV*) +\& SvPOK(SV*) +.Ve +.PP +You can get and set the current length of the string stored in an \s-1SV\s0 with +the following macros: +.PP +.Vb 2 +\& SvCUR(SV*) +\& SvCUR_set(SV*, I32 val) +.Ve +.PP +You can also get a pointer to the end of the string stored in the \s-1SV\s0 +with the macro: +.PP +.Vb 1 +\& SvEND(SV*) +.Ve +.PP +But note that these last three macros are valid only if \f(CW\*(C`SvPOK()\*(C'\fR is true. +.PP +If you want to append something to the end of string stored in an \f(CW\*(C`SV*\*(C'\fR, +you can use the following functions: +.PP +.Vb 6 +\& void sv_catpv(SV*, const char*); +\& void sv_catpvn(SV*, const char*, STRLEN); +\& void sv_catpvf(SV*, const char*, ...); +\& void sv_vcatpvfn(SV*, const char*, STRLEN, va_list *, SV **, +\& I32, bool); +\& void sv_catsv(SV*, SV*); +.Ve +.PP +The first function calculates the length of the string to be appended by +using \f(CW\*(C`strlen\*(C'\fR. In the second, you specify the length of the string +yourself. The third function processes its arguments like \f(CW\*(C`sprintf\*(C'\fR and +appends the formatted output. The fourth function works like \f(CW\*(C`vsprintf\*(C'\fR. +You can specify the address and length of an array of SVs instead of the +va_list argument. The fifth function +extends the string stored in the first +\&\s-1SV\s0 with the string stored in the second \s-1SV.\s0 It also forces the second \s-1SV\s0 +to be interpreted as a string. +.PP +The \f(CW\*(C`sv_cat*()\*(C'\fR functions are not generic enough to operate on values that +have \*(L"magic\*(R". See \*(L"Magic Virtual Tables\*(R" later in this document. +.PP +If you know the name of a scalar variable, you can get a pointer to its \s-1SV\s0 +by using the following: +.PP +.Vb 1 +\& SV* get_sv("package::varname", 0); +.Ve +.PP +This returns \s-1NULL\s0 if the variable does not exist. +.PP +If you want to know if this variable (or any other \s-1SV\s0) is actually \f(CW\*(C`defined\*(C'\fR, +you can call: +.PP +.Vb 1 +\& SvOK(SV*) +.Ve +.PP +The scalar \f(CW\*(C`undef\*(C'\fR value is stored in an \s-1SV\s0 instance called \f(CW\*(C`PL_sv_undef\*(C'\fR. +.PP +Its address can be used whenever an \f(CW\*(C`SV*\*(C'\fR is needed. Make sure that +you don't try to compare a random sv with \f(CW&PL_sv_undef\fR. For example +when interfacing Perl code, it'll work correctly for: +.PP +.Vb 1 +\& foo(undef); +.Ve +.PP +But won't work when called as: +.PP +.Vb 2 +\& $x = undef; +\& foo($x); +.Ve +.PP +So to repeat always use \fBSvOK()\fR to check whether an sv is defined. +.PP +Also you have to be careful when using \f(CW&PL_sv_undef\fR as a value in +AVs or HVs (see \*(L"AVs, HVs and undefined values\*(R"). +.PP +There are also the two values \f(CW\*(C`PL_sv_yes\*(C'\fR and \f(CW\*(C`PL_sv_no\*(C'\fR, which contain +boolean \s-1TRUE\s0 and \s-1FALSE\s0 values, respectively. Like \f(CW\*(C`PL_sv_undef\*(C'\fR, their +addresses can be used whenever an \f(CW\*(C`SV*\*(C'\fR is needed. +.PP +Do not be fooled into thinking that \f(CW\*(C`(SV *) 0\*(C'\fR is the same as \f(CW&PL_sv_undef\fR. +Take this code: +.PP +.Vb 5 +\& SV* sv = (SV*) 0; +\& if (I\-am\-to\-return\-a\-real\-value) { +\& sv = sv_2mortal(newSViv(42)); +\& } +\& sv_setsv(ST(0), sv); +.Ve +.PP +This code tries to return a new \s-1SV\s0 (which contains the value 42) if it should +return a real value, or undef otherwise. Instead it has returned a \s-1NULL\s0 +pointer which, somewhere down the line, will cause a segmentation violation, +bus error, or just weird results. Change the zero to \f(CW&PL_sv_undef\fR in the +first line and all will be well. +.PP +To free an \s-1SV\s0 that you've created, call \f(CW\*(C`SvREFCNT_dec(SV*)\*(C'\fR. Normally this +call is not necessary (see \*(L"Reference Counts and Mortality\*(R"). +.SS "Offsets" +.IX Subsection "Offsets" +Perl provides the function \f(CW\*(C`sv_chop\*(C'\fR to efficiently remove characters +from the beginning of a string; you give it an \s-1SV\s0 and a pointer to +somewhere inside the \s-1PV,\s0 and it discards everything before the +pointer. The efficiency comes by means of a little hack: instead of +actually removing the characters, \f(CW\*(C`sv_chop\*(C'\fR sets the flag \f(CW\*(C`OOK\*(C'\fR +(offset \s-1OK\s0) to signal to other functions that the offset hack is in +effect, and it moves the \s-1PV\s0 pointer (called \f(CW\*(C`SvPVX\*(C'\fR) forward +by the number of bytes chopped off, and adjusts \f(CW\*(C`SvCUR\*(C'\fR and \f(CW\*(C`SvLEN\*(C'\fR +accordingly. (A portion of the space between the old and new \s-1PV\s0 +pointers is used to store the count of chopped bytes.) +.PP +Hence, at this point, the start of the buffer that we allocated lives +at \f(CW\*(C`SvPVX(sv) \- SvIV(sv)\*(C'\fR in memory and the \s-1PV\s0 pointer is pointing +into the middle of this allocated storage. +.PP +This is best demonstrated by example. Normally copy-on-write will prevent +the substitution from operator from using this hack, but if you can craft a +string for which copy-on-write is not possible, you can see it in play. In +the current implementation, the final byte of a string buffer is used as a +copy-on-write reference count. If the buffer is not big enough, then +copy-on-write is skipped. First have a look at an empty string: +.PP +.Vb 7 +\& % ./perl \-Ilib \-MDevel::Peek \-le \*(Aq$a=""; $a .= ""; Dump $a\*(Aq +\& SV = PV(0x7ffb7c008a70) at 0x7ffb7c030390 +\& REFCNT = 1 +\& FLAGS = (POK,pPOK) +\& PV = 0x7ffb7bc05b50 ""\e0 +\& CUR = 0 +\& LEN = 10 +.Ve +.PP +Notice here the \s-1LEN\s0 is 10. (It may differ on your platform.) Extend the +length of the string to one less than 10, and do a substitution: +.PP +.Vb 9 +\& % ./perl \-Ilib \-MDevel::Peek \-le \*(Aq$a=""; $a.="123456789"; $a=~s/.//; \e +\& Dump($a)\*(Aq +\& SV = PV(0x7ffa04008a70) at 0x7ffa04030390 +\& REFCNT = 1 +\& FLAGS = (POK,OOK,pPOK) +\& OFFSET = 1 +\& PV = 0x7ffa03c05b61 ( "\e1" . ) "23456789"\e0 +\& CUR = 8 +\& LEN = 9 +.Ve +.PP +Here the number of bytes chopped off (1) is shown next as the \s-1OFFSET.\s0 The +portion of the string between the \*(L"real\*(R" and the \*(L"fake\*(R" beginnings is +shown in parentheses, and the values of \f(CW\*(C`SvCUR\*(C'\fR and \f(CW\*(C`SvLEN\*(C'\fR reflect +the fake beginning, not the real one. (The first character of the string +buffer happens to have changed to \*(L"\e1\*(R" here, not \*(L"1\*(R", because the current +implementation stores the offset count in the string buffer. This is +subject to change.) +.PP +Something similar to the offset hack is performed on AVs to enable +efficient shifting and splicing off the beginning of the array; while +\&\f(CW\*(C`AvARRAY\*(C'\fR points to the first element in the array that is visible from +Perl, \f(CW\*(C`AvALLOC\*(C'\fR points to the real start of the C array. These are +usually the same, but a \f(CW\*(C`shift\*(C'\fR operation can be carried out by +increasing \f(CW\*(C`AvARRAY\*(C'\fR by one and decreasing \f(CW\*(C`AvFILL\*(C'\fR and \f(CW\*(C`AvMAX\*(C'\fR. +Again, the location of the real start of the C array only comes into +play when freeing the array. See \f(CW\*(C`av_shift\*(C'\fR in \fIav.c\fR. +.SS "What's Really Stored in an \s-1SV\s0?" +.IX Subsection "What's Really Stored in an SV?" +Recall that the usual method of determining the type of scalar you have is +to use \f(CW\*(C`Sv*OK\*(C'\fR macros. Because a scalar can be both a number and a string, +usually these macros will always return \s-1TRUE\s0 and calling the \f(CW\*(C`Sv*V\*(C'\fR +macros will do the appropriate conversion of string to integer/double or +integer/double to string. +.PP +If you \fIreally\fR need to know if you have an integer, double, or string +pointer in an \s-1SV,\s0 you can use the following three macros instead: +.PP +.Vb 3 +\& SvIOKp(SV*) +\& SvNOKp(SV*) +\& SvPOKp(SV*) +.Ve +.PP +These will tell you if you truly have an integer, double, or string pointer +stored in your \s-1SV.\s0 The \*(L"p\*(R" stands for private. +.PP +There are various ways in which the private and public flags may differ. +For example, in perl 5.16 and earlier a tied \s-1SV\s0 may have a valid +underlying value in the \s-1IV\s0 slot (so SvIOKp is true), but the data +should be accessed via the \s-1FETCH\s0 routine rather than directly, +so SvIOK is false. (In perl 5.18 onwards, tied scalars use +the flags the same way as untied scalars.) Another is when +numeric conversion has occurred and precision has been lost: only the +private flag is set on 'lossy' values. So when an \s-1NV\s0 is converted to an +\&\s-1IV\s0 with loss, SvIOKp, SvNOKp and SvNOK will be set, while SvIOK wont be. +.PP +In general, though, it's best to use the \f(CW\*(C`Sv*V\*(C'\fR macros. +.SS "Working with AVs" +.IX Subsection "Working with AVs" +There are two ways to create and load an \s-1AV.\s0 The first method creates an +empty \s-1AV:\s0 +.PP +.Vb 1 +\& AV* newAV(); +.Ve +.PP +The second method both creates the \s-1AV\s0 and initially populates it with SVs: +.PP +.Vb 1 +\& AV* av_make(SSize_t num, SV **ptr); +.Ve +.PP +The second argument points to an array containing \f(CW\*(C`num\*(C'\fR \f(CW\*(C`SV*\*(C'\fR's. Once the +\&\s-1AV\s0 has been created, the SVs can be destroyed, if so desired. +.PP +Once the \s-1AV\s0 has been created, the following operations are possible on it: +.PP +.Vb 4 +\& void av_push(AV*, SV*); +\& SV* av_pop(AV*); +\& SV* av_shift(AV*); +\& void av_unshift(AV*, SSize_t num); +.Ve +.PP +These should be familiar operations, with the exception of \f(CW\*(C`av_unshift\*(C'\fR. +This routine adds \f(CW\*(C`num\*(C'\fR elements at the front of the array with the \f(CW\*(C`undef\*(C'\fR +value. You must then use \f(CW\*(C`av_store\*(C'\fR (described below) to assign values +to these new elements. +.PP +Here are some other functions: +.PP +.Vb 3 +\& SSize_t av_top_index(AV*); +\& SV** av_fetch(AV*, SSize_t key, I32 lval); +\& SV** av_store(AV*, SSize_t key, SV* val); +.Ve +.PP +The \f(CW\*(C`av_top_index\*(C'\fR function returns the highest index value in an array (just +like $#array in Perl). If the array is empty, \-1 is returned. The +\&\f(CW\*(C`av_fetch\*(C'\fR function returns the value at index \f(CW\*(C`key\*(C'\fR, but if \f(CW\*(C`lval\*(C'\fR +is non-zero, then \f(CW\*(C`av_fetch\*(C'\fR will store an undef value at that index. +The \f(CW\*(C`av_store\*(C'\fR function stores the value \f(CW\*(C`val\*(C'\fR at index \f(CW\*(C`key\*(C'\fR, and does +not increment the reference count of \f(CW\*(C`val\*(C'\fR. Thus the caller is responsible +for taking care of that, and if \f(CW\*(C`av_store\*(C'\fR returns \s-1NULL,\s0 the caller will +have to decrement the reference count to avoid a memory leak. Note that +\&\f(CW\*(C`av_fetch\*(C'\fR and \f(CW\*(C`av_store\*(C'\fR both return \f(CW\*(C`SV**\*(C'\fR's, not \f(CW\*(C`SV*\*(C'\fR's as their +return value. +.PP +A few more: +.PP +.Vb 3 +\& void av_clear(AV*); +\& void av_undef(AV*); +\& void av_extend(AV*, SSize_t key); +.Ve +.PP +The \f(CW\*(C`av_clear\*(C'\fR function deletes all the elements in the AV* array, but +does not actually delete the array itself. The \f(CW\*(C`av_undef\*(C'\fR function will +delete all the elements in the array plus the array itself. The +\&\f(CW\*(C`av_extend\*(C'\fR function extends the array so that it contains at least \f(CW\*(C`key+1\*(C'\fR +elements. If \f(CW\*(C`key+1\*(C'\fR is less than the currently allocated length of the array, +then nothing is done. +.PP +If you know the name of an array variable, you can get a pointer to its \s-1AV\s0 +by using the following: +.PP +.Vb 1 +\& AV* get_av("package::varname", 0); +.Ve +.PP +This returns \s-1NULL\s0 if the variable does not exist. +.PP +See \*(L"Understanding the Magic of Tied Hashes and Arrays\*(R" for more +information on how to use the array access functions on tied arrays. +.SS "Working with HVs" +.IX Subsection "Working with HVs" +To create an \s-1HV,\s0 you use the following routine: +.PP +.Vb 1 +\& HV* newHV(); +.Ve +.PP +Once the \s-1HV\s0 has been created, the following operations are possible on it: +.PP +.Vb 2 +\& SV** hv_store(HV*, const char* key, U32 klen, SV* val, U32 hash); +\& SV** hv_fetch(HV*, const char* key, U32 klen, I32 lval); +.Ve +.PP +The \f(CW\*(C`klen\*(C'\fR parameter is the length of the key being passed in (Note that +you cannot pass 0 in as a value of \f(CW\*(C`klen\*(C'\fR to tell Perl to measure the +length of the key). The \f(CW\*(C`val\*(C'\fR argument contains the \s-1SV\s0 pointer to the +scalar being stored, and \f(CW\*(C`hash\*(C'\fR is the precomputed hash value (zero if +you want \f(CW\*(C`hv_store\*(C'\fR to calculate it for you). The \f(CW\*(C`lval\*(C'\fR parameter +indicates whether this fetch is actually a part of a store operation, in +which case a new undefined value will be added to the \s-1HV\s0 with the supplied +key and \f(CW\*(C`hv_fetch\*(C'\fR will return as if the value had already existed. +.PP +Remember that \f(CW\*(C`hv_store\*(C'\fR and \f(CW\*(C`hv_fetch\*(C'\fR return \f(CW\*(C`SV**\*(C'\fR's and not just +\&\f(CW\*(C`SV*\*(C'\fR. To access the scalar value, you must first dereference the return +value. However, you should check to make sure that the return value is +not \s-1NULL\s0 before dereferencing it. +.PP +The first of these two functions checks if a hash table entry exists, and the +second deletes it. +.PP +.Vb 2 +\& bool hv_exists(HV*, const char* key, U32 klen); +\& SV* hv_delete(HV*, const char* key, U32 klen, I32 flags); +.Ve +.PP +If \f(CW\*(C`flags\*(C'\fR does not include the \f(CW\*(C`G_DISCARD\*(C'\fR flag then \f(CW\*(C`hv_delete\*(C'\fR will +create and return a mortal copy of the deleted value. +.PP +And more miscellaneous functions: +.PP +.Vb 2 +\& void hv_clear(HV*); +\& void hv_undef(HV*); +.Ve +.PP +Like their \s-1AV\s0 counterparts, \f(CW\*(C`hv_clear\*(C'\fR deletes all the entries in the hash +table but does not actually delete the hash table. The \f(CW\*(C`hv_undef\*(C'\fR deletes +both the entries and the hash table itself. +.PP +Perl keeps the actual data in a linked list of structures with a typedef of \s-1HE.\s0 +These contain the actual key and value pointers (plus extra administrative +overhead). The key is a string pointer; the value is an \f(CW\*(C`SV*\*(C'\fR. However, +once you have an \f(CW\*(C`HE*\*(C'\fR, to get the actual key and value, use the routines +specified below. +.PP +.Vb 10 +\& I32 hv_iterinit(HV*); +\& /* Prepares starting point to traverse hash table */ +\& HE* hv_iternext(HV*); +\& /* Get the next entry, and return a pointer to a +\& structure that has both the key and value */ +\& char* hv_iterkey(HE* entry, I32* retlen); +\& /* Get the key from an HE structure and also return +\& the length of the key string */ +\& SV* hv_iterval(HV*, HE* entry); +\& /* Return an SV pointer to the value of the HE +\& structure */ +\& SV* hv_iternextsv(HV*, char** key, I32* retlen); +\& /* This convenience routine combines hv_iternext, +\& hv_iterkey, and hv_iterval. The key and retlen +\& arguments are return values for the key and its +\& length. The value is returned in the SV* argument */ +.Ve +.PP +If you know the name of a hash variable, you can get a pointer to its \s-1HV\s0 +by using the following: +.PP +.Vb 1 +\& HV* get_hv("package::varname", 0); +.Ve +.PP +This returns \s-1NULL\s0 if the variable does not exist. +.PP +The hash algorithm is defined in the \f(CW\*(C`PERL_HASH\*(C'\fR macro: +.PP +.Vb 1 +\& PERL_HASH(hash, key, klen) +.Ve +.PP +The exact implementation of this macro varies by architecture and version +of perl, and the return value may change per invocation, so the value +is only valid for the duration of a single perl process. +.PP +See \*(L"Understanding the Magic of Tied Hashes and Arrays\*(R" for more +information on how to use the hash access functions on tied hashes. +.SS "Hash \s-1API\s0 Extensions" +.IX Subsection "Hash API Extensions" +Beginning with version 5.004, the following functions are also supported: +.PP +.Vb 2 +\& HE* hv_fetch_ent (HV* tb, SV* key, I32 lval, U32 hash); +\& HE* hv_store_ent (HV* tb, SV* key, SV* val, U32 hash); +\& +\& bool hv_exists_ent (HV* tb, SV* key, U32 hash); +\& SV* hv_delete_ent (HV* tb, SV* key, I32 flags, U32 hash); +\& +\& SV* hv_iterkeysv (HE* entry); +.Ve +.PP +Note that these functions take \f(CW\*(C`SV*\*(C'\fR keys, which simplifies writing +of extension code that deals with hash structures. These functions +also allow passing of \f(CW\*(C`SV*\*(C'\fR keys to \f(CW\*(C`tie\*(C'\fR functions without forcing +you to stringify the keys (unlike the previous set of functions). +.PP +They also return and accept whole hash entries (\f(CW\*(C`HE*\*(C'\fR), making their +use more efficient (since the hash number for a particular string +doesn't have to be recomputed every time). See perlapi for detailed +descriptions. +.PP +The following macros must always be used to access the contents of hash +entries. Note that the arguments to these macros must be simple +variables, since they may get evaluated more than once. See +perlapi for detailed descriptions of these macros. +.PP +.Vb 6 +\& HePV(HE* he, STRLEN len) +\& HeVAL(HE* he) +\& HeHASH(HE* he) +\& HeSVKEY(HE* he) +\& HeSVKEY_force(HE* he) +\& HeSVKEY_set(HE* he, SV* sv) +.Ve +.PP +These two lower level macros are defined, but must only be used when +dealing with keys that are not \f(CW\*(C`SV*\*(C'\fRs: +.PP +.Vb 2 +\& HeKEY(HE* he) +\& HeKLEN(HE* he) +.Ve +.PP +Note that both \f(CW\*(C`hv_store\*(C'\fR and \f(CW\*(C`hv_store_ent\*(C'\fR do not increment the +reference count of the stored \f(CW\*(C`val\*(C'\fR, which is the caller's responsibility. +If these functions return a \s-1NULL\s0 value, the caller will usually have to +decrement the reference count of \f(CW\*(C`val\*(C'\fR to avoid a memory leak. +.SS "AVs, HVs and undefined values" +.IX Subsection "AVs, HVs and undefined values" +Sometimes you have to store undefined values in AVs or HVs. Although +this may be a rare case, it can be tricky. That's because you're +used to using \f(CW&PL_sv_undef\fR if you need an undefined \s-1SV.\s0 +.PP +For example, intuition tells you that this \s-1XS\s0 code: +.PP +.Vb 2 +\& AV *av = newAV(); +\& av_store( av, 0, &PL_sv_undef ); +.Ve +.PP +is equivalent to this Perl code: +.PP +.Vb 2 +\& my @av; +\& $av[0] = undef; +.Ve +.PP +Unfortunately, this isn't true. In perl 5.18 and earlier, AVs use \f(CW&PL_sv_undef\fR as a marker +for indicating that an array element has not yet been initialized. +Thus, \f(CW\*(C`exists $av[0]\*(C'\fR would be true for the above Perl code, but +false for the array generated by the \s-1XS\s0 code. In perl 5.20, storing +&PL_sv_undef will create a read-only element, because the scalar +&PL_sv_undef itself is stored, not a copy. +.PP +Similar problems can occur when storing \f(CW&PL_sv_undef\fR in HVs: +.PP +.Vb 1 +\& hv_store( hv, "key", 3, &PL_sv_undef, 0 ); +.Ve +.PP +This will indeed make the value \f(CW\*(C`undef\*(C'\fR, but if you try to modify +the value of \f(CW\*(C`key\*(C'\fR, you'll get the following error: +.PP +.Vb 1 +\& Modification of non\-creatable hash value attempted +.Ve +.PP +In perl 5.8.0, \f(CW&PL_sv_undef\fR was also used to mark placeholders +in restricted hashes. This caused such hash entries not to appear +when iterating over the hash or when checking for the keys +with the \f(CW\*(C`hv_exists\*(C'\fR function. +.PP +You can run into similar problems when you store \f(CW&PL_sv_yes\fR or +\&\f(CW&PL_sv_no\fR into AVs or HVs. Trying to modify such elements +will give you the following error: +.PP +.Vb 1 +\& Modification of a read\-only value attempted +.Ve +.PP +To make a long story short, you can use the special variables +\&\f(CW&PL_sv_undef\fR, \f(CW&PL_sv_yes\fR and \f(CW&PL_sv_no\fR with AVs and +HVs, but you have to make sure you know what you're doing. +.PP +Generally, if you want to store an undefined value in an \s-1AV\s0 +or \s-1HV,\s0 you should not use \f(CW&PL_sv_undef\fR, but rather create a +new undefined value using the \f(CW\*(C`newSV\*(C'\fR function, for example: +.PP +.Vb 2 +\& av_store( av, 42, newSV(0) ); +\& hv_store( hv, "foo", 3, newSV(0), 0 ); +.Ve +.SS "References" +.IX Subsection "References" +References are a special type of scalar that point to other data types +(including other references). +.PP +To create a reference, use either of the following functions: +.PP +.Vb 2 +\& SV* newRV_inc((SV*) thing); +\& SV* newRV_noinc((SV*) thing); +.Ve +.PP +The \f(CW\*(C`thing\*(C'\fR argument can be any of an \f(CW\*(C`SV*\*(C'\fR, \f(CW\*(C`AV*\*(C'\fR, or \f(CW\*(C`HV*\*(C'\fR. The +functions are identical except that \f(CW\*(C`newRV_inc\*(C'\fR increments the reference +count of the \f(CW\*(C`thing\*(C'\fR, while \f(CW\*(C`newRV_noinc\*(C'\fR does not. For historical +reasons, \f(CW\*(C`newRV\*(C'\fR is a synonym for \f(CW\*(C`newRV_inc\*(C'\fR. +.PP +Once you have a reference, you can use the following macro to dereference +the reference: +.PP +.Vb 1 +\& SvRV(SV*) +.Ve +.PP +then call the appropriate routines, casting the returned \f(CW\*(C`SV*\*(C'\fR to either an +\&\f(CW\*(C`AV*\*(C'\fR or \f(CW\*(C`HV*\*(C'\fR, if required. +.PP +To determine if an \s-1SV\s0 is a reference, you can use the following macro: +.PP +.Vb 1 +\& SvROK(SV*) +.Ve +.PP +To discover what type of value the reference refers to, use the following +macro and then check the return value. +.PP +.Vb 1 +\& SvTYPE(SvRV(SV*)) +.Ve +.PP +The most useful types that will be returned are: +.PP +.Vb 4 +\& SVt_PVAV Array +\& SVt_PVHV Hash +\& SVt_PVCV Code +\& SVt_PVGV Glob (possibly a file handle) +.Ve +.PP +Any numerical value returned which is less than SVt_PVAV will be a scalar +of some form. +.PP +See \*(L"svtype\*(R" in perlapi for more details. +.SS "Blessed References and Class Objects" +.IX Subsection "Blessed References and Class Objects" +References are also used to support object-oriented programming. In perl's +\&\s-1OO\s0 lexicon, an object is simply a reference that has been blessed into a +package (or class). Once blessed, the programmer may now use the reference +to access the various methods in the class. +.PP +A reference can be blessed into a package with the following function: +.PP +.Vb 1 +\& SV* sv_bless(SV* sv, HV* stash); +.Ve +.PP +The \f(CW\*(C`sv\*(C'\fR argument must be a reference value. The \f(CW\*(C`stash\*(C'\fR argument +specifies which class the reference will belong to. See +\&\*(L"Stashes and Globs\*(R" for information on converting class names into stashes. +.PP +/* Still under construction */ +.PP +The following function upgrades rv to reference if not already one. +Creates a new \s-1SV\s0 for rv to point to. If \f(CW\*(C`classname\*(C'\fR is non-null, the \s-1SV\s0 +is blessed into the specified class. \s-1SV\s0 is returned. +.PP +.Vb 1 +\& SV* newSVrv(SV* rv, const char* classname); +.Ve +.PP +The following three functions copy integer, unsigned integer or double +into an \s-1SV\s0 whose reference is \f(CW\*(C`rv\*(C'\fR. \s-1SV\s0 is blessed if \f(CW\*(C`classname\*(C'\fR is +non-null. +.PP +.Vb 3 +\& SV* sv_setref_iv(SV* rv, const char* classname, IV iv); +\& SV* sv_setref_uv(SV* rv, const char* classname, UV uv); +\& SV* sv_setref_nv(SV* rv, const char* classname, NV iv); +.Ve +.PP +The following function copies the pointer value (\fIthe address, not the +string!\fR) into an \s-1SV\s0 whose reference is rv. \s-1SV\s0 is blessed if \f(CW\*(C`classname\*(C'\fR +is non-null. +.PP +.Vb 1 +\& SV* sv_setref_pv(SV* rv, const char* classname, void* pv); +.Ve +.PP +The following function copies a string into an \s-1SV\s0 whose reference is \f(CW\*(C`rv\*(C'\fR. +Set length to 0 to let Perl calculate the string length. \s-1SV\s0 is blessed if +\&\f(CW\*(C`classname\*(C'\fR is non-null. +.PP +.Vb 2 +\& SV* sv_setref_pvn(SV* rv, const char* classname, char* pv, +\& STRLEN length); +.Ve +.PP +The following function tests whether the \s-1SV\s0 is blessed into the specified +class. It does not check inheritance relationships. +.PP +.Vb 1 +\& int sv_isa(SV* sv, const char* name); +.Ve +.PP +The following function tests whether the \s-1SV\s0 is a reference to a blessed object. +.PP +.Vb 1 +\& int sv_isobject(SV* sv); +.Ve +.PP +The following function tests whether the \s-1SV\s0 is derived from the specified +class. \s-1SV\s0 can be either a reference to a blessed object or a string +containing a class name. This is the function implementing the +\&\f(CW\*(C`UNIVERSAL::isa\*(C'\fR functionality. +.PP +.Vb 1 +\& bool sv_derived_from(SV* sv, const char* name); +.Ve +.PP +To check if you've got an object derived from a specific class you have +to write: +.PP +.Vb 1 +\& if (sv_isobject(sv) && sv_derived_from(sv, class)) { ... } +.Ve +.SS "Creating New Variables" +.IX Subsection "Creating New Variables" +To create a new Perl variable with an undef value which can be accessed from +your Perl script, use the following routines, depending on the variable type. +.PP +.Vb 3 +\& SV* get_sv("package::varname", GV_ADD); +\& AV* get_av("package::varname", GV_ADD); +\& HV* get_hv("package::varname", GV_ADD); +.Ve +.PP +Notice the use of \s-1GV_ADD\s0 as the second parameter. The new variable can now +be set, using the routines appropriate to the data type. +.PP +There are additional macros whose values may be bitwise \s-1OR\s0'ed with the +\&\f(CW\*(C`GV_ADD\*(C'\fR argument to enable certain extra features. Those bits are: +.IP "\s-1GV_ADDMULTI\s0" 4 +.IX Item "GV_ADDMULTI" +Marks the variable as multiply defined, thus preventing the: +.Sp +.Vb 1 +\& Name used only once: possible typo +.Ve +.Sp +warning. +.IP "\s-1GV_ADDWARN\s0" 4 +.IX Item "GV_ADDWARN" +Issues the warning: +.Sp +.Vb 1 +\& Had to create unexpectedly +.Ve +.Sp +if the variable did not exist before the function was called. +.PP +If you do not specify a package name, the variable is created in the current +package. +.SS "Reference Counts and Mortality" +.IX Subsection "Reference Counts and Mortality" +Perl uses a reference count-driven garbage collection mechanism. SVs, +AVs, or HVs (xV for short in the following) start their life with a +reference count of 1. If the reference count of an xV ever drops to 0, +then it will be destroyed and its memory made available for reuse. +At the most basic internal level, reference counts can be manipulated +with the following macros: +.PP +.Vb 3 +\& int SvREFCNT(SV* sv); +\& SV* SvREFCNT_inc(SV* sv); +\& void SvREFCNT_dec(SV* sv); +.Ve +.PP +(There are also suffixed versions of the increment and decrement macros, +for situations where the full generality of these basic macros can be +exchanged for some performance.) +.PP +However, the way a programmer should think about references is not so +much in terms of the bare reference count, but in terms of \fIownership\fR +of references. A reference to an xV can be owned by any of a variety +of entities: another xV, the Perl interpreter, an \s-1XS\s0 data structure, +a piece of running code, or a dynamic scope. An xV generally does not +know what entities own the references to it; it only knows how many +references there are, which is the reference count. +.PP +To correctly maintain reference counts, it is essential to keep track +of what references the \s-1XS\s0 code is manipulating. The programmer should +always know where a reference has come from and who owns it, and be +aware of any creation or destruction of references, and any transfers +of ownership. Because ownership isn't represented explicitly in the xV +data structures, only the reference count need be actually maintained +by the code, and that means that this understanding of ownership is not +actually evident in the code. For example, transferring ownership of a +reference from one owner to another doesn't change the reference count +at all, so may be achieved with no actual code. (The transferring code +doesn't touch the referenced object, but does need to ensure that the +former owner knows that it no longer owns the reference, and that the +new owner knows that it now does.) +.PP +An xV that is visible at the Perl level should not become unreferenced +and thus be destroyed. Normally, an object will only become unreferenced +when it is no longer visible, often by the same means that makes it +invisible. For example, a Perl reference value (\s-1RV\s0) owns a reference to +its referent, so if the \s-1RV\s0 is overwritten that reference gets destroyed, +and the no-longer-reachable referent may be destroyed as a result. +.PP +Many functions have some kind of reference manipulation as +part of their purpose. Sometimes this is documented in terms +of ownership of references, and sometimes it is (less helpfully) +documented in terms of changes to reference counts. For example, the +\&\fBnewRV_inc()\fR function is documented to create a new \s-1RV\s0 +(with reference count 1) and increment the reference count of the referent +that was supplied by the caller. This is best understood as creating +a new reference to the referent, which is owned by the created \s-1RV,\s0 +and returning to the caller ownership of the sole reference to the \s-1RV.\s0 +The \fBnewRV_noinc()\fR function instead does not +increment the reference count of the referent, but the \s-1RV\s0 nevertheless +ends up owning a reference to the referent. It is therefore implied +that the caller of \f(CW\*(C`newRV_noinc()\*(C'\fR is relinquishing a reference to the +referent, making this conceptually a more complicated operation even +though it does less to the data structures. +.PP +For example, imagine you want to return a reference from an \s-1XSUB\s0 +function. Inside the \s-1XSUB\s0 routine, you create an \s-1SV\s0 which initially +has just a single reference, owned by the \s-1XSUB\s0 routine. This reference +needs to be disposed of before the routine is complete, otherwise it +will leak, preventing the \s-1SV\s0 from ever being destroyed. So to create +an \s-1RV\s0 referencing the \s-1SV,\s0 it is most convenient to pass the \s-1SV\s0 to +\&\f(CW\*(C`newRV_noinc()\*(C'\fR, which consumes that reference. Now the \s-1XSUB\s0 routine +no longer owns a reference to the \s-1SV,\s0 but does own a reference to the \s-1RV,\s0 +which in turn owns a reference to the \s-1SV.\s0 The ownership of the reference +to the \s-1RV\s0 is then transferred by the process of returning the \s-1RV\s0 from +the \s-1XSUB.\s0 +.PP +There are some convenience functions available that can help with the +destruction of xVs. These functions introduce the concept of \*(L"mortality\*(R". +Much documentation speaks of an xV itself being mortal, but this is +misleading. It is really \fIa reference to\fR an xV that is mortal, and it +is possible for there to be more than one mortal reference to a single xV. +For a reference to be mortal means that it is owned by the temps stack, +one of perl's many internal stacks, which will destroy that reference +\&\*(L"a short time later\*(R". Usually the \*(L"short time later\*(R" is the end of +the current Perl statement. However, it gets more complicated around +dynamic scopes: there can be multiple sets of mortal references hanging +around at the same time, with different death dates. Internally, the +actual determinant for when mortal xV references are destroyed depends +on two macros, \s-1SAVETMPS\s0 and \s-1FREETMPS.\s0 See perlcall and perlxs +and \*(L"Temporaries Stack\*(R" below for more details on these macros. +.PP +Mortal references are mainly used for xVs that are placed on perl's +main stack. The stack is problematic for reference tracking, because it +contains a lot of xV references, but doesn't own those references: they +are not counted. Currently, there are many bugs resulting from xVs being +destroyed while referenced by the stack, because the stack's uncounted +references aren't enough to keep the xVs alive. So when putting an +(uncounted) reference on the stack, it is vitally important to ensure that +there will be a counted reference to the same xV that will last at least +as long as the uncounted reference. But it's also important that that +counted reference be cleaned up at an appropriate time, and not unduly +prolong the xV's life. For there to be a mortal reference is often the +best way to satisfy this requirement, especially if the xV was created +especially to be put on the stack and would otherwise be unreferenced. +.PP +To create a mortal reference, use the functions: +.PP +.Vb 3 +\& SV* sv_newmortal() +\& SV* sv_mortalcopy(SV*) +\& SV* sv_2mortal(SV*) +.Ve +.PP +\&\f(CW\*(C`sv_newmortal()\*(C'\fR creates an \s-1SV\s0 (with the undefined value) whose sole +reference is mortal. \f(CW\*(C`sv_mortalcopy()\*(C'\fR creates an xV whose value is a +copy of a supplied xV and whose sole reference is mortal. \f(CW\*(C`sv_2mortal()\*(C'\fR +mortalises an existing xV reference: it transfers ownership of a reference +from the caller to the temps stack. Because \f(CW\*(C`sv_newmortal\*(C'\fR gives the new +\&\s-1SV\s0 no value, it must normally be given one via \f(CW\*(C`sv_setpv\*(C'\fR, \f(CW\*(C`sv_setiv\*(C'\fR, +etc. : +.PP +.Vb 2 +\& SV *tmp = sv_newmortal(); +\& sv_setiv(tmp, an_integer); +.Ve +.PP +As that is multiple C statements it is quite common so see this idiom instead: +.PP +.Vb 1 +\& SV *tmp = sv_2mortal(newSViv(an_integer)); +.Ve +.PP +The mortal routines are not just for SVs; AVs and HVs can be +made mortal by passing their address (type-casted to \f(CW\*(C`SV*\*(C'\fR) to the +\&\f(CW\*(C`sv_2mortal\*(C'\fR or \f(CW\*(C`sv_mortalcopy\*(C'\fR routines. +.SS "Stashes and Globs" +.IX Subsection "Stashes and Globs" +A \fBstash\fR is a hash that contains all variables that are defined +within a package. Each key of the stash is a symbol +name (shared by all the different types of objects that have the same +name), and each value in the hash table is a \s-1GV\s0 (Glob Value). This \s-1GV\s0 +in turn contains references to the various objects of that name, +including (but not limited to) the following: +.PP +.Vb 6 +\& Scalar Value +\& Array Value +\& Hash Value +\& I/O Handle +\& Format +\& Subroutine +.Ve +.PP +There is a single stash called \f(CW\*(C`PL_defstash\*(C'\fR that holds the items that exist +in the \f(CW\*(C`main\*(C'\fR package. To get at the items in other packages, append the +string \*(L"::\*(R" to the package name. The items in the \f(CW\*(C`Foo\*(C'\fR package are in +the stash \f(CW\*(C`Foo::\*(C'\fR in PL_defstash. The items in the \f(CW\*(C`Bar::Baz\*(C'\fR package are +in the stash \f(CW\*(C`Baz::\*(C'\fR in \f(CW\*(C`Bar::\*(C'\fR's stash. +.PP +To get the stash pointer for a particular package, use the function: +.PP +.Vb 2 +\& HV* gv_stashpv(const char* name, I32 flags) +\& HV* gv_stashsv(SV*, I32 flags) +.Ve +.PP +The first function takes a literal string, the second uses the string stored +in the \s-1SV.\s0 Remember that a stash is just a hash table, so you get back an +\&\f(CW\*(C`HV*\*(C'\fR. The \f(CW\*(C`flags\*(C'\fR flag will create a new package if it is set to \s-1GV_ADD.\s0 +.PP +The name that \f(CW\*(C`gv_stash*v\*(C'\fR wants is the name of the package whose symbol table +you want. The default package is called \f(CW\*(C`main\*(C'\fR. If you have multiply nested +packages, pass their names to \f(CW\*(C`gv_stash*v\*(C'\fR, separated by \f(CW\*(C`::\*(C'\fR as in the Perl +language itself. +.PP +Alternately, if you have an \s-1SV\s0 that is a blessed reference, you can find +out the stash pointer by using: +.PP +.Vb 1 +\& HV* SvSTASH(SvRV(SV*)); +.Ve +.PP +then use the following to get the package name itself: +.PP +.Vb 1 +\& char* HvNAME(HV* stash); +.Ve +.PP +If you need to bless or re-bless an object you can use the following +function: +.PP +.Vb 1 +\& SV* sv_bless(SV*, HV* stash) +.Ve +.PP +where the first argument, an \f(CW\*(C`SV*\*(C'\fR, must be a reference, and the second +argument is a stash. The returned \f(CW\*(C`SV*\*(C'\fR can now be used in the same way +as any other \s-1SV.\s0 +.PP +For more information on references and blessings, consult perlref. +.SS "Double-Typed SVs" +.IX Subsection "Double-Typed SVs" +Scalar variables normally contain only one type of value, an integer, +double, pointer, or reference. Perl will automatically convert the +actual scalar data from the stored type into the requested type. +.PP +Some scalar variables contain more than one type of scalar data. For +example, the variable \f(CW$!\fR contains either the numeric value of \f(CW\*(C`errno\*(C'\fR +or its string equivalent from either \f(CW\*(C`strerror\*(C'\fR or \f(CW\*(C`sys_errlist[]\*(C'\fR. +.PP +To force multiple data values into an \s-1SV,\s0 you must do two things: use the +\&\f(CW\*(C`sv_set*v\*(C'\fR routines to add the additional scalar type, then set a flag +so that Perl will believe it contains more than one type of data. The +four macros to set the flags are: +.PP +.Vb 4 +\& SvIOK_on +\& SvNOK_on +\& SvPOK_on +\& SvROK_on +.Ve +.PP +The particular macro you must use depends on which \f(CW\*(C`sv_set*v\*(C'\fR routine +you called first. This is because every \f(CW\*(C`sv_set*v\*(C'\fR routine turns on +only the bit for the particular type of data being set, and turns off +all the rest. +.PP +For example, to create a new Perl variable called \*(L"dberror\*(R" that contains +both the numeric and descriptive string error values, you could use the +following code: +.PP +.Vb 2 +\& extern int dberror; +\& extern char *dberror_list; +\& +\& SV* sv = get_sv("dberror", GV_ADD); +\& sv_setiv(sv, (IV) dberror); +\& sv_setpv(sv, dberror_list[dberror]); +\& SvIOK_on(sv); +.Ve +.PP +If the order of \f(CW\*(C`sv_setiv\*(C'\fR and \f(CW\*(C`sv_setpv\*(C'\fR had been reversed, then the +macro \f(CW\*(C`SvPOK_on\*(C'\fR would need to be called instead of \f(CW\*(C`SvIOK_on\*(C'\fR. +.SS "Read-Only Values" +.IX Subsection "Read-Only Values" +In Perl 5.16 and earlier, copy-on-write (see the next section) shared a +flag bit with read-only scalars. So the only way to test whether +\&\f(CW\*(C`sv_setsv\*(C'\fR, etc., will raise a \*(L"Modification of a read-only value\*(R" error +in those versions is: +.PP +.Vb 1 +\& SvREADONLY(sv) && !SvIsCOW(sv) +.Ve +.PP +Under Perl 5.18 and later, SvREADONLY only applies to read-only variables, +and, under 5.20, copy-on-write scalars can also be read-only, so the above +check is incorrect. You just want: +.PP +.Vb 1 +\& SvREADONLY(sv) +.Ve +.PP +If you need to do this check often, define your own macro like this: +.PP +.Vb 5 +\& #if PERL_VERSION >= 18 +\& # define SvTRULYREADONLY(sv) SvREADONLY(sv) +\& #else +\& # define SvTRULYREADONLY(sv) (SvREADONLY(sv) && !SvIsCOW(sv)) +\& #endif +.Ve +.SS "Copy on Write" +.IX Subsection "Copy on Write" +Perl implements a copy-on-write (\s-1COW\s0) mechanism for scalars, in which +string copies are not immediately made when requested, but are deferred +until made necessary by one or the other scalar changing. This is mostly +transparent, but one must take care not to modify string buffers that are +shared by multiple SVs. +.PP +You can test whether an \s-1SV\s0 is using copy-on-write with \f(CW\*(C`SvIsCOW(sv)\*(C'\fR. +.PP +You can force an \s-1SV\s0 to make its own copy of its string buffer by calling \f(CW\*(C`sv_force_normal(sv)\*(C'\fR or SvPV_force_nolen(sv). +.PP +If you want to make the \s-1SV\s0 drop its string buffer, use +\&\f(CW\*(C`sv_force_normal_flags(sv, SV_COW_DROP_PV)\*(C'\fR or simply +\&\f(CW\*(C`sv_setsv(sv, NULL)\*(C'\fR. +.PP +All of these functions will croak on read-only scalars (see the previous +section for more on those). +.PP +To test that your code is behaving correctly and not modifying \s-1COW\s0 buffers, +on systems that support \fBmmap\fR\|(2) (i.e., Unix) you can configure perl with +\&\f(CW\*(C`\-Accflags=\-DPERL_DEBUG_READONLY_COW\*(C'\fR and it will turn buffer violations +into crashes. You will find it to be marvellously slow, so you may want to +skip perl's own tests. +.SS "Magic Variables" +.IX Subsection "Magic Variables" +[This section still under construction. Ignore everything here. Post no +bills. Everything not permitted is forbidden.] +.PP +Any \s-1SV\s0 may be magical, that is, it has special features that a normal +\&\s-1SV\s0 does not have. These features are stored in the \s-1SV\s0 structure in a +linked list of \f(CW\*(C`struct magic\*(C'\fR's, typedef'ed to \f(CW\*(C`MAGIC\*(C'\fR. +.PP +.Vb 10 +\& struct magic { +\& MAGIC* mg_moremagic; +\& MGVTBL* mg_virtual; +\& U16 mg_private; +\& char mg_type; +\& U8 mg_flags; +\& I32 mg_len; +\& SV* mg_obj; +\& char* mg_ptr; +\& }; +.Ve +.PP +Note this is current as of patchlevel 0, and could change at any time. +.SS "Assigning Magic" +.IX Subsection "Assigning Magic" +Perl adds magic to an \s-1SV\s0 using the sv_magic function: +.PP +.Vb 1 +\& void sv_magic(SV* sv, SV* obj, int how, const char* name, I32 namlen); +.Ve +.PP +The \f(CW\*(C`sv\*(C'\fR argument is a pointer to the \s-1SV\s0 that is to acquire a new magical +feature. +.PP +If \f(CW\*(C`sv\*(C'\fR is not already magical, Perl uses the \f(CW\*(C`SvUPGRADE\*(C'\fR macro to +convert \f(CW\*(C`sv\*(C'\fR to type \f(CW\*(C`SVt_PVMG\*(C'\fR. +Perl then continues by adding new magic +to the beginning of the linked list of magical features. Any prior entry +of the same type of magic is deleted. Note that this can be overridden, +and multiple instances of the same type of magic can be associated with an +\&\s-1SV.\s0 +.PP +The \f(CW\*(C`name\*(C'\fR and \f(CW\*(C`namlen\*(C'\fR arguments are used to associate a string with +the magic, typically the name of a variable. \f(CW\*(C`namlen\*(C'\fR is stored in the +\&\f(CW\*(C`mg_len\*(C'\fR field and if \f(CW\*(C`name\*(C'\fR is non-null then either a \f(CW\*(C`savepvn\*(C'\fR copy of +\&\f(CW\*(C`name\*(C'\fR or \f(CW\*(C`name\*(C'\fR itself is stored in the \f(CW\*(C`mg_ptr\*(C'\fR field, depending on +whether \f(CW\*(C`namlen\*(C'\fR is greater than zero or equal to zero respectively. As a +special case, if \f(CW\*(C`(name && namlen == HEf_SVKEY)\*(C'\fR then \f(CW\*(C`name\*(C'\fR is assumed +to contain an \f(CW\*(C`SV*\*(C'\fR and is stored as-is with its \s-1REFCNT\s0 incremented. +.PP +The sv_magic function uses \f(CW\*(C`how\*(C'\fR to determine which, if any, predefined +\&\*(L"Magic Virtual Table\*(R" should be assigned to the \f(CW\*(C`mg_virtual\*(C'\fR field. +See the \*(L"Magic Virtual Tables\*(R" section below. The \f(CW\*(C`how\*(C'\fR argument is also +stored in the \f(CW\*(C`mg_type\*(C'\fR field. The value of +\&\f(CW\*(C`how\*(C'\fR should be chosen from the set of macros +\&\f(CW\*(C`PERL_MAGIC_foo\*(C'\fR found in \fIperl.h\fR. Note that before +these macros were added, Perl internals used to directly use character +literals, so you may occasionally come across old code or documentation +referring to 'U' magic rather than \f(CW\*(C`PERL_MAGIC_uvar\*(C'\fR for example. +.PP +The \f(CW\*(C`obj\*(C'\fR argument is stored in the \f(CW\*(C`mg_obj\*(C'\fR field of the \f(CW\*(C`MAGIC\*(C'\fR +structure. If it is not the same as the \f(CW\*(C`sv\*(C'\fR argument, the reference +count of the \f(CW\*(C`obj\*(C'\fR object is incremented. If it is the same, or if +the \f(CW\*(C`how\*(C'\fR argument is \f(CW\*(C`PERL_MAGIC_arylen\*(C'\fR, \f(CW\*(C`PERL_MAGIC_regdatum\*(C'\fR, +\&\f(CW\*(C`PERL_MAGIC_regdata\*(C'\fR, or if it is a \s-1NULL\s0 pointer, then \f(CW\*(C`obj\*(C'\fR is merely +stored, without the reference count being incremented. +.PP +See also \f(CW\*(C`sv_magicext\*(C'\fR in perlapi for a more flexible way to add magic +to an \s-1SV.\s0 +.PP +There is also a function to add magic to an \f(CW\*(C`HV\*(C'\fR: +.PP +.Vb 1 +\& void hv_magic(HV *hv, GV *gv, int how); +.Ve +.PP +This simply calls \f(CW\*(C`sv_magic\*(C'\fR and coerces the \f(CW\*(C`gv\*(C'\fR argument into an \f(CW\*(C`SV\*(C'\fR. +.PP +To remove the magic from an \s-1SV,\s0 call the function sv_unmagic: +.PP +.Vb 1 +\& int sv_unmagic(SV *sv, int type); +.Ve +.PP +The \f(CW\*(C`type\*(C'\fR argument should be equal to the \f(CW\*(C`how\*(C'\fR value when the \f(CW\*(C`SV\*(C'\fR +was initially made magical. +.PP +However, note that \f(CW\*(C`sv_unmagic\*(C'\fR removes all magic of a certain \f(CW\*(C`type\*(C'\fR from the +\&\f(CW\*(C`SV\*(C'\fR. If you want to remove only certain +magic of a \f(CW\*(C`type\*(C'\fR based on the magic +virtual table, use \f(CW\*(C`sv_unmagicext\*(C'\fR instead: +.PP +.Vb 1 +\& int sv_unmagicext(SV *sv, int type, MGVTBL *vtbl); +.Ve +.SS "Magic Virtual Tables" +.IX Subsection "Magic Virtual Tables" +The \f(CW\*(C`mg_virtual\*(C'\fR field in the \f(CW\*(C`MAGIC\*(C'\fR structure is a pointer to an +\&\f(CW\*(C`MGVTBL\*(C'\fR, which is a structure of function pointers and stands for +\&\*(L"Magic Virtual Table\*(R" to handle the various operations that might be +applied to that variable. +.PP +The \f(CW\*(C`MGVTBL\*(C'\fR has five (or sometimes eight) pointers to the following +routine types: +.PP +.Vb 5 +\& int (*svt_get) (pTHX_ SV* sv, MAGIC* mg); +\& int (*svt_set) (pTHX_ SV* sv, MAGIC* mg); +\& U32 (*svt_len) (pTHX_ SV* sv, MAGIC* mg); +\& int (*svt_clear)(pTHX_ SV* sv, MAGIC* mg); +\& int (*svt_free) (pTHX_ SV* sv, MAGIC* mg); +\& +\& int (*svt_copy) (pTHX_ SV *sv, MAGIC* mg, SV *nsv, +\& const char *name, I32 namlen); +\& int (*svt_dup) (pTHX_ MAGIC *mg, CLONE_PARAMS *param); +\& int (*svt_local)(pTHX_ SV *nsv, MAGIC *mg); +.Ve +.PP +This \s-1MGVTBL\s0 structure is set at compile-time in \fIperl.h\fR and there are +currently 32 types. These different structures contain pointers to various +routines that perform additional actions depending on which function is +being called. +.PP +.Vb 8 +\& Function pointer Action taken +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\- +\& svt_get Do something before the value of the SV is +\& retrieved. +\& svt_set Do something after the SV is assigned a value. +\& svt_len Report on the SV\*(Aqs length. +\& svt_clear Clear something the SV represents. +\& svt_free Free any extra storage associated with the SV. +\& +\& svt_copy copy tied variable magic to a tied element +\& svt_dup duplicate a magic structure during thread cloning +\& svt_local copy magic to local value during \*(Aqlocal\*(Aq +.Ve +.PP +For instance, the \s-1MGVTBL\s0 structure called \f(CW\*(C`vtbl_sv\*(C'\fR (which corresponds +to an \f(CW\*(C`mg_type\*(C'\fR of \f(CW\*(C`PERL_MAGIC_sv\*(C'\fR) contains: +.PP +.Vb 1 +\& { magic_get, magic_set, magic_len, 0, 0 } +.Ve +.PP +Thus, when an \s-1SV\s0 is determined to be magical and of type \f(CW\*(C`PERL_MAGIC_sv\*(C'\fR, +if a get operation is being performed, the routine \f(CW\*(C`magic_get\*(C'\fR is +called. All the various routines for the various magical types begin +with \f(CW\*(C`magic_\*(C'\fR. \s-1NOTE:\s0 the magic routines are not considered part of +the Perl \s-1API,\s0 and may not be exported by the Perl library. +.PP +The last three slots are a recent addition, and for source code +compatibility they are only checked for if one of the three flags +MGf_COPY, MGf_DUP or MGf_LOCAL is set in mg_flags. +This means that most code can continue declaring +a vtable as a 5\-element value. These three are +currently used exclusively by the threading code, and are highly subject +to change. +.PP +The current kinds of Magic Virtual Tables are: +.PP +.Vb 10 +\& mg_type +\& (old\-style char and macro) MGVTBL Type of magic +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\- +\& \e0 PERL_MAGIC_sv vtbl_sv Special scalar variable +\& # PERL_MAGIC_arylen vtbl_arylen Array length ($#ary) +\& % PERL_MAGIC_rhash (none) Extra data for restricted +\& hashes +\& * PERL_MAGIC_debugvar vtbl_debugvar $DB::single, signal, trace +\& vars +\& . PERL_MAGIC_pos vtbl_pos pos() lvalue +\& : PERL_MAGIC_symtab (none) Extra data for symbol +\& tables +\& < PERL_MAGIC_backref vtbl_backref For weak ref data +\& @ PERL_MAGIC_arylen_p (none) To move arylen out of XPVAV +\& B PERL_MAGIC_bm vtbl_regexp Boyer\-Moore +\& (fast string search) +\& c PERL_MAGIC_overload_table vtbl_ovrld Holds overload table +\& (AMT) on stash +\& D PERL_MAGIC_regdata vtbl_regdata Regex match position data +\& (@+ and @\- vars) +\& d PERL_MAGIC_regdatum vtbl_regdatum Regex match position data +\& element +\& E PERL_MAGIC_env vtbl_env %ENV hash +\& e PERL_MAGIC_envelem vtbl_envelem %ENV hash element +\& f PERL_MAGIC_fm vtbl_regexp Formline +\& (\*(Aqcompiled\*(Aq format) +\& g PERL_MAGIC_regex_global vtbl_mglob m//g target +\& H PERL_MAGIC_hints vtbl_hints %^H hash +\& h PERL_MAGIC_hintselem vtbl_hintselem %^H hash element +\& I PERL_MAGIC_isa vtbl_isa @ISA array +\& i PERL_MAGIC_isaelem vtbl_isaelem @ISA array element +\& k PERL_MAGIC_nkeys vtbl_nkeys scalar(keys()) lvalue +\& L PERL_MAGIC_dbfile (none) Debugger %_mg_ptr; +\& ... +\& } +.Ve +.PP +Also note that the \f(CW\*(C`sv_set*()\*(C'\fR and \f(CW\*(C`sv_cat*()\*(C'\fR functions described +earlier do \fBnot\fR invoke 'set' magic on their targets. This must +be done by the user either by calling the \f(CW\*(C`SvSETMAGIC()\*(C'\fR macro after +calling these functions, or by using one of the \f(CW\*(C`sv_set*_mg()\*(C'\fR or +\&\f(CW\*(C`sv_cat*_mg()\*(C'\fR functions. Similarly, generic C code must call the +\&\f(CW\*(C`SvGETMAGIC()\*(C'\fR macro to invoke any 'get' magic if they use an \s-1SV\s0 +obtained from external sources in functions that don't handle magic. +See perlapi for a description of these functions. +For example, calls to the \f(CW\*(C`sv_cat*()\*(C'\fR functions typically need to be +followed by \f(CW\*(C`SvSETMAGIC()\*(C'\fR, but they don't need a prior \f(CW\*(C`SvGETMAGIC()\*(C'\fR +since their implementation handles 'get' magic. +.SS "Finding Magic" +.IX Subsection "Finding Magic" +.Vb 2 +\& MAGIC *mg_find(SV *sv, int type); /* Finds the magic pointer of that +\& * type */ +.Ve +.PP +This routine returns a pointer to a \f(CW\*(C`MAGIC\*(C'\fR structure stored in the \s-1SV.\s0 +If the \s-1SV\s0 does not have that magical +feature, \f(CW\*(C`NULL\*(C'\fR is returned. If the +\&\s-1SV\s0 has multiple instances of that magical feature, the first one will be +returned. \f(CW\*(C`mg_findext\*(C'\fR can be used +to find a \f(CW\*(C`MAGIC\*(C'\fR structure of an \s-1SV\s0 +based on both its magic type and its magic virtual table: +.PP +.Vb 1 +\& MAGIC *mg_findext(SV *sv, int type, MGVTBL *vtbl); +.Ve +.PP +Also, if the \s-1SV\s0 passed to \f(CW\*(C`mg_find\*(C'\fR or \f(CW\*(C`mg_findext\*(C'\fR is not of type +SVt_PVMG, Perl may core dump. +.PP +.Vb 1 +\& int mg_copy(SV* sv, SV* nsv, const char* key, STRLEN klen); +.Ve +.PP +This routine checks to see what types of magic \f(CW\*(C`sv\*(C'\fR has. If the mg_type +field is an uppercase letter, then the mg_obj is copied to \f(CW\*(C`nsv\*(C'\fR, but +the mg_type field is changed to be the lowercase letter. +.SS "Understanding the Magic of Tied Hashes and Arrays" +.IX Subsection "Understanding the Magic of Tied Hashes and Arrays" +Tied hashes and arrays are magical beasts of the \f(CW\*(C`PERL_MAGIC_tied\*(C'\fR +magic type. +.PP +\&\s-1WARNING:\s0 As of the 5.004 release, proper usage of the array and hash +access functions requires understanding a few caveats. Some +of these caveats are actually considered bugs in the \s-1API,\s0 to be fixed +in later releases, and are bracketed with [\s-1MAYCHANGE\s0] below. If +you find yourself actually applying such information in this section, be +aware that the behavior may change in the future, umm, without warning. +.PP +The perl tie function associates a variable with an object that implements +the various \s-1GET, SET,\s0 etc methods. To perform the equivalent of the perl +tie function from an \s-1XSUB,\s0 you must mimic this behaviour. The code below +carries out the necessary steps \*(-- firstly it creates a new hash, and then +creates a second hash which it blesses into the class which will implement +the tie methods. Lastly it ties the two hashes together, and returns a +reference to the new tied hash. Note that the code below does \s-1NOT\s0 call the +\&\s-1TIEHASH\s0 method in the MyTie class \- +see \*(L"Calling Perl Routines from within C Programs\*(R" for details on how +to do this. +.PP +.Vb 10 +\& SV* +\& mytie() +\& PREINIT: +\& HV *hash; +\& HV *stash; +\& SV *tie; +\& CODE: +\& hash = newHV(); +\& tie = newRV_noinc((SV*)newHV()); +\& stash = gv_stashpv("MyTie", GV_ADD); +\& sv_bless(tie, stash); +\& hv_magic(hash, (GV*)tie, PERL_MAGIC_tied); +\& RETVAL = newRV_noinc(hash); +\& OUTPUT: +\& RETVAL +.Ve +.PP +The \f(CW\*(C`av_store\*(C'\fR function, when given a tied array argument, merely +copies the magic of the array onto the value to be \*(L"stored\*(R", using +\&\f(CW\*(C`mg_copy\*(C'\fR. It may also return \s-1NULL,\s0 indicating that the value did not +actually need to be stored in the array. [\s-1MAYCHANGE\s0] After a call to +\&\f(CW\*(C`av_store\*(C'\fR on a tied array, the caller will usually need to call +\&\f(CW\*(C`mg_set(val)\*(C'\fR to actually invoke the perl level \*(L"\s-1STORE\*(R"\s0 method on the +\&\s-1TIEARRAY\s0 object. If \f(CW\*(C`av_store\*(C'\fR did return \s-1NULL,\s0 a call to +\&\f(CW\*(C`SvREFCNT_dec(val)\*(C'\fR will also be usually necessary to avoid a memory +leak. [/MAYCHANGE] +.PP +The previous paragraph is applicable verbatim to tied hash access using the +\&\f(CW\*(C`hv_store\*(C'\fR and \f(CW\*(C`hv_store_ent\*(C'\fR functions as well. +.PP +\&\f(CW\*(C`av_fetch\*(C'\fR and the corresponding hash functions \f(CW\*(C`hv_fetch\*(C'\fR and +\&\f(CW\*(C`hv_fetch_ent\*(C'\fR actually return an undefined mortal value whose magic +has been initialized using \f(CW\*(C`mg_copy\*(C'\fR. Note the value so returned does not +need to be deallocated, as it is already mortal. [\s-1MAYCHANGE\s0] But you will +need to call \f(CW\*(C`mg_get()\*(C'\fR on the returned value in order to actually invoke +the perl level \*(L"\s-1FETCH\*(R"\s0 method on the underlying \s-1TIE\s0 object. Similarly, +you may also call \f(CW\*(C`mg_set()\*(C'\fR on the return value after possibly assigning +a suitable value to it using \f(CW\*(C`sv_setsv\*(C'\fR, which will invoke the \*(L"\s-1STORE\*(R"\s0 +method on the \s-1TIE\s0 object. [/MAYCHANGE] +.PP +[\s-1MAYCHANGE\s0] +In other words, the array or hash fetch/store functions don't really +fetch and store actual values in the case of tied arrays and hashes. They +merely call \f(CW\*(C`mg_copy\*(C'\fR to attach magic to the values that were meant to be +\&\*(L"stored\*(R" or \*(L"fetched\*(R". Later calls to \f(CW\*(C`mg_get\*(C'\fR and \f(CW\*(C`mg_set\*(C'\fR actually +do the job of invoking the \s-1TIE\s0 methods on the underlying objects. Thus +the magic mechanism currently implements a kind of lazy access to arrays +and hashes. +.PP +Currently (as of perl version 5.004), use of the hash and array access +functions requires the user to be aware of whether they are operating on +\&\*(L"normal\*(R" hashes and arrays, or on their tied variants. The \s-1API\s0 may be +changed to provide more transparent access to both tied and normal data +types in future versions. +[/MAYCHANGE] +.PP +You would do well to understand that the \s-1TIEARRAY\s0 and \s-1TIEHASH\s0 interfaces +are mere sugar to invoke some perl method calls while using the uniform hash +and array syntax. The use of this sugar imposes some overhead (typically +about two to four extra opcodes per \s-1FETCH/STORE\s0 operation, in addition to +the creation of all the mortal variables required to invoke the methods). +This overhead will be comparatively small if the \s-1TIE\s0 methods are themselves +substantial, but if they are only a few statements long, the overhead +will not be insignificant. +.SS "Localizing changes" +.IX Subsection "Localizing changes" +Perl has a very handy construction +.PP +.Vb 4 +\& { +\& local $var = 2; +\& ... +\& } +.Ve +.PP +This construction is \fIapproximately\fR equivalent to +.PP +.Vb 6 +\& { +\& my $oldvar = $var; +\& $var = 2; +\& ... +\& $var = $oldvar; +\& } +.Ve +.PP +The biggest difference is that the first construction would +reinstate the initial value of \f(CW$var\fR, irrespective of how control exits +the block: \f(CW\*(C`goto\*(C'\fR, \f(CW\*(C`return\*(C'\fR, \f(CW\*(C`die\*(C'\fR/\f(CW\*(C`eval\*(C'\fR, etc. It is a little bit +more efficient as well. +.PP +There is a way to achieve a similar task from C via Perl \s-1API:\s0 create a +\&\fIpseudo-block\fR, and arrange for some changes to be automatically +undone at the end of it, either explicit, or via a non-local exit (via +\&\fBdie()\fR). A \fIblock\fR\-like construct is created by a pair of +\&\f(CW\*(C`ENTER\*(C'\fR/\f(CW\*(C`LEAVE\*(C'\fR macros (see \*(L"Returning a Scalar\*(R" in perlcall). +Such a construct may be created specially for some important localized +task, or an existing one (like boundaries of enclosing Perl +subroutine/block, or an existing pair for freeing TMPs) may be +used. (In the second case the overhead of additional localization must +be almost negligible.) Note that any \s-1XSUB\s0 is automatically enclosed in +an \f(CW\*(C`ENTER\*(C'\fR/\f(CW\*(C`LEAVE\*(C'\fR pair. +.PP +Inside such a \fIpseudo-block\fR the following service is available: +.ie n .IP """SAVEINT(int i)""" 4 +.el .IP "\f(CWSAVEINT(int i)\fR" 4 +.IX Item "SAVEINT(int i)" +.PD 0 +.ie n .IP """SAVEIV(IV i)""" 4 +.el .IP "\f(CWSAVEIV(IV i)\fR" 4 +.IX Item "SAVEIV(IV i)" +.ie n .IP """SAVEI32(I32 i)""" 4 +.el .IP "\f(CWSAVEI32(I32 i)\fR" 4 +.IX Item "SAVEI32(I32 i)" +.ie n .IP """SAVELONG(long i)""" 4 +.el .IP "\f(CWSAVELONG(long i)\fR" 4 +.IX Item "SAVELONG(long i)" +.PD +These macros arrange things to restore the value of integer variable +\&\f(CW\*(C`i\*(C'\fR at the end of enclosing \fIpseudo-block\fR. +.ie n .IP "SAVESPTR(s)" 4 +.el .IP "\f(CWSAVESPTR(s)\fR" 4 +.IX Item "SAVESPTR(s)" +.PD 0 +.ie n .IP "SAVEPPTR(p)" 4 +.el .IP "\f(CWSAVEPPTR(p)\fR" 4 +.IX Item "SAVEPPTR(p)" +.PD +These macros arrange things to restore the value of pointers \f(CW\*(C`s\*(C'\fR and +\&\f(CW\*(C`p\*(C'\fR. \f(CW\*(C`s\*(C'\fR must be a pointer of a type which survives conversion to +\&\f(CW\*(C`SV*\*(C'\fR and back, \f(CW\*(C`p\*(C'\fR should be able to survive conversion to \f(CW\*(C`char*\*(C'\fR +and back. +.ie n .IP """SAVEFREESV(SV *sv)""" 4 +.el .IP "\f(CWSAVEFREESV(SV *sv)\fR" 4 +.IX Item "SAVEFREESV(SV *sv)" +The refcount of \f(CW\*(C`sv\*(C'\fR will be decremented at the end of +\&\fIpseudo-block\fR. This is similar to \f(CW\*(C`sv_2mortal\*(C'\fR in that it is also a +mechanism for doing a delayed \f(CW\*(C`SvREFCNT_dec\*(C'\fR. However, while \f(CW\*(C`sv_2mortal\*(C'\fR +extends the lifetime of \f(CW\*(C`sv\*(C'\fR until the beginning of the next statement, +\&\f(CW\*(C`SAVEFREESV\*(C'\fR extends it until the end of the enclosing scope. These +lifetimes can be wildly different. +.Sp +Also compare \f(CW\*(C`SAVEMORTALIZESV\*(C'\fR. +.ie n .IP """SAVEMORTALIZESV(SV *sv)""" 4 +.el .IP "\f(CWSAVEMORTALIZESV(SV *sv)\fR" 4 +.IX Item "SAVEMORTALIZESV(SV *sv)" +Just like \f(CW\*(C`SAVEFREESV\*(C'\fR, but mortalizes \f(CW\*(C`sv\*(C'\fR at the end of the current +scope instead of decrementing its reference count. This usually has the +effect of keeping \f(CW\*(C`sv\*(C'\fR alive until the statement that called the currently +live scope has finished executing. +.ie n .IP """SAVEFREEOP(OP *op)""" 4 +.el .IP "\f(CWSAVEFREEOP(OP *op)\fR" 4 +.IX Item "SAVEFREEOP(OP *op)" +The \f(CW\*(C`OP *\*(C'\fR is \fBop_free()\fRed at the end of \fIpseudo-block\fR. +.ie n .IP "SAVEFREEPV(p)" 4 +.el .IP "\f(CWSAVEFREEPV(p)\fR" 4 +.IX Item "SAVEFREEPV(p)" +The chunk of memory which is pointed to by \f(CW\*(C`p\*(C'\fR is \fBSafefree()\fRed at the +end of \fIpseudo-block\fR. +.ie n .IP """SAVECLEARSV(SV *sv)""" 4 +.el .IP "\f(CWSAVECLEARSV(SV *sv)\fR" 4 +.IX Item "SAVECLEARSV(SV *sv)" +Clears a slot in the current scratchpad which corresponds to \f(CW\*(C`sv\*(C'\fR at +the end of \fIpseudo-block\fR. +.ie n .IP """SAVEDELETE(HV *hv, char *key, I32 length)""" 4 +.el .IP "\f(CWSAVEDELETE(HV *hv, char *key, I32 length)\fR" 4 +.IX Item "SAVEDELETE(HV *hv, char *key, I32 length)" +The key \f(CW\*(C`key\*(C'\fR of \f(CW\*(C`hv\*(C'\fR is deleted at the end of \fIpseudo-block\fR. The +string pointed to by \f(CW\*(C`key\*(C'\fR is \fBSafefree()\fRed. If one has a \fIkey\fR in +short-lived storage, the corresponding string may be reallocated like +this: +.Sp +.Vb 1 +\& SAVEDELETE(PL_defstash, savepv(tmpbuf), strlen(tmpbuf)); +.Ve +.ie n .IP """SAVEDESTRUCTOR(DESTRUCTORFUNC_NOCONTEXT_t f, void *p)""" 4 +.el .IP "\f(CWSAVEDESTRUCTOR(DESTRUCTORFUNC_NOCONTEXT_t f, void *p)\fR" 4 +.IX Item "SAVEDESTRUCTOR(DESTRUCTORFUNC_NOCONTEXT_t f, void *p)" +At the end of \fIpseudo-block\fR the function \f(CW\*(C`f\*(C'\fR is called with the +only argument \f(CW\*(C`p\*(C'\fR. +.ie n .IP """SAVEDESTRUCTOR_X(DESTRUCTORFUNC_t f, void *p)""" 4 +.el .IP "\f(CWSAVEDESTRUCTOR_X(DESTRUCTORFUNC_t f, void *p)\fR" 4 +.IX Item "SAVEDESTRUCTOR_X(DESTRUCTORFUNC_t f, void *p)" +At the end of \fIpseudo-block\fR the function \f(CW\*(C`f\*(C'\fR is called with the +implicit context argument (if any), and \f(CW\*(C`p\*(C'\fR. +.ie n .IP """SAVESTACK_POS()""" 4 +.el .IP "\f(CWSAVESTACK_POS()\fR" 4 +.IX Item "SAVESTACK_POS()" +The current offset on the Perl internal stack (cf. \f(CW\*(C`SP\*(C'\fR) is restored +at the end of \fIpseudo-block\fR. +.PP +The following \s-1API\s0 list contains functions, thus one needs to +provide pointers to the modifiable data explicitly (either C pointers, +or Perlish \f(CW\*(C`GV *\*(C'\fRs). Where the above macros take \f(CW\*(C`int\*(C'\fR, a similar +function takes \f(CW\*(C`int *\*(C'\fR. +.ie n .IP """SV* save_scalar(GV *gv)""" 4 +.el .IP "\f(CWSV* save_scalar(GV *gv)\fR" 4 +.IX Item "SV* save_scalar(GV *gv)" +Equivalent to Perl code \f(CW\*(C`local $gv\*(C'\fR. +.ie n .IP """AV* save_ary(GV *gv)""" 4 +.el .IP "\f(CWAV* save_ary(GV *gv)\fR" 4 +.IX Item "AV* save_ary(GV *gv)" +.PD 0 +.ie n .IP """HV* save_hash(GV *gv)""" 4 +.el .IP "\f(CWHV* save_hash(GV *gv)\fR" 4 +.IX Item "HV* save_hash(GV *gv)" +.PD +Similar to \f(CW\*(C`save_scalar\*(C'\fR, but localize \f(CW@gv\fR and \f(CW%gv\fR. +.ie n .IP """void save_item(SV *item)""" 4 +.el .IP "\f(CWvoid save_item(SV *item)\fR" 4 +.IX Item "void save_item(SV *item)" +Duplicates the current value of \f(CW\*(C`SV\*(C'\fR. On the exit from the current +\&\f(CW\*(C`ENTER\*(C'\fR/\f(CW\*(C`LEAVE\*(C'\fR \fIpseudo-block\fR the value of \f(CW\*(C`SV\*(C'\fR will be restored +using the stored value. It doesn't handle magic. Use \f(CW\*(C`save_scalar\*(C'\fR if +magic is affected. +.ie n .IP """void save_list(SV **sarg, I32 maxsarg)""" 4 +.el .IP "\f(CWvoid save_list(SV **sarg, I32 maxsarg)\fR" 4 +.IX Item "void save_list(SV **sarg, I32 maxsarg)" +A variant of \f(CW\*(C`save_item\*(C'\fR which takes multiple arguments via an array +\&\f(CW\*(C`sarg\*(C'\fR of \f(CW\*(C`SV*\*(C'\fR of length \f(CW\*(C`maxsarg\*(C'\fR. +.ie n .IP """SV* save_svref(SV **sptr)""" 4 +.el .IP "\f(CWSV* save_svref(SV **sptr)\fR" 4 +.IX Item "SV* save_svref(SV **sptr)" +Similar to \f(CW\*(C`save_scalar\*(C'\fR, but will reinstate an \f(CW\*(C`SV *\*(C'\fR. +.ie n .IP """void save_aptr(AV **aptr)""" 4 +.el .IP "\f(CWvoid save_aptr(AV **aptr)\fR" 4 +.IX Item "void save_aptr(AV **aptr)" +.PD 0 +.ie n .IP """void save_hptr(HV **hptr)""" 4 +.el .IP "\f(CWvoid save_hptr(HV **hptr)\fR" 4 +.IX Item "void save_hptr(HV **hptr)" +.PD +Similar to \f(CW\*(C`save_svref\*(C'\fR, but localize \f(CW\*(C`AV *\*(C'\fR and \f(CW\*(C`HV *\*(C'\fR. +.PP +The \f(CW\*(C`Alias\*(C'\fR module implements localization of the basic types within the +\&\fIcaller's scope\fR. People who are interested in how to localize things in +the containing scope should take a look there too. +.SH "Subroutines" +.IX Header "Subroutines" +.SS "XSUBs and the Argument Stack" +.IX Subsection "XSUBs and the Argument Stack" +The \s-1XSUB\s0 mechanism is a simple way for Perl programs to access C subroutines. +An \s-1XSUB\s0 routine will have a stack that contains the arguments from the Perl +program, and a way to map from the Perl data structures to a C equivalent. +.PP +The stack arguments are accessible through the \f(CWST(n)\fR macro, which returns +the \f(CW\*(C`n\*(C'\fR'th stack argument. Argument 0 is the first argument passed in the +Perl subroutine call. These arguments are \f(CW\*(C`SV*\*(C'\fR, and can be used anywhere +an \f(CW\*(C`SV*\*(C'\fR is used. +.PP +Most of the time, output from the C routine can be handled through use of +the \s-1RETVAL\s0 and \s-1OUTPUT\s0 directives. However, there are some cases where the +argument stack is not already long enough to handle all the return values. +An example is the \s-1POSIX\s0 \fBtzname()\fR call, which takes no arguments, but returns +two, the local time zone's standard and summer time abbreviations. +.PP +To handle this situation, the \s-1PPCODE\s0 directive is used and the stack is +extended using the macro: +.PP +.Vb 1 +\& EXTEND(SP, num); +.Ve +.PP +where \f(CW\*(C`SP\*(C'\fR is the macro that represents the local copy of the stack pointer, +and \f(CW\*(C`num\*(C'\fR is the number of elements the stack should be extended by. +.PP +Now that there is room on the stack, values can be pushed on it using \f(CW\*(C`PUSHs\*(C'\fR +macro. The pushed values will often need to be \*(L"mortal\*(R" (See +\&\*(L"Reference Counts and Mortality\*(R"): +.PP +.Vb 7 +\& PUSHs(sv_2mortal(newSViv(an_integer))) +\& PUSHs(sv_2mortal(newSVuv(an_unsigned_integer))) +\& PUSHs(sv_2mortal(newSVnv(a_double))) +\& PUSHs(sv_2mortal(newSVpv("Some String",0))) +\& /* Although the last example is better written as the more +\& * efficient: */ +\& PUSHs(newSVpvs_flags("Some String", SVs_TEMP)) +.Ve +.PP +And now the Perl program calling \f(CW\*(C`tzname\*(C'\fR, the two values will be assigned +as in: +.PP +.Vb 1 +\& ($standard_abbrev, $summer_abbrev) = POSIX::tzname; +.Ve +.PP +An alternate (and possibly simpler) method to pushing values on the stack is +to use the macro: +.PP +.Vb 1 +\& XPUSHs(SV*) +.Ve +.PP +This macro automatically adjusts the stack for you, if needed. Thus, you +do not need to call \f(CW\*(C`EXTEND\*(C'\fR to extend the stack. +.PP +Despite their suggestions in earlier versions of this document the macros +\&\f(CW\*(C`(X)PUSH[iunp]\*(C'\fR are \fInot\fR suited to XSUBs which return multiple results. +For that, either stick to the \f(CW\*(C`(X)PUSHs\*(C'\fR macros shown above, or use the new +\&\f(CW\*(C`m(X)PUSH[iunp]\*(C'\fR macros instead; see \*(L"Putting a C value on Perl stack\*(R". +.PP +For more information, consult perlxs and perlxstut. +.SS "Autoloading with XSUBs" +.IX Subsection "Autoloading with XSUBs" +If an \s-1AUTOLOAD\s0 routine is an \s-1XSUB,\s0 as with Perl subroutines, Perl puts the +fully-qualified name of the autoloaded subroutine in the \f(CW$AUTOLOAD\fR variable +of the \s-1XSUB\s0's package. +.PP +But it also puts the same information in certain fields of the \s-1XSUB\s0 itself: +.PP +.Vb 4 +\& HV *stash = CvSTASH(cv); +\& const char *subname = SvPVX(cv); +\& STRLEN name_length = SvCUR(cv); /* in bytes */ +\& U32 is_utf8 = SvUTF8(cv); +.Ve +.PP +\&\f(CW\*(C`SvPVX(cv)\*(C'\fR contains just the sub name itself, not including the package. +For an \s-1AUTOLOAD\s0 routine in \s-1UNIVERSAL\s0 or one of its superclasses, +\&\f(CW\*(C`CvSTASH(cv)\*(C'\fR returns \s-1NULL\s0 during a method call on a nonexistent package. +.PP +\&\fBNote\fR: Setting \f(CW$AUTOLOAD\fR stopped working in 5.6.1, which did not support +\&\s-1XS AUTOLOAD\s0 subs at all. Perl 5.8.0 introduced the use of fields in the +\&\s-1XSUB\s0 itself. Perl 5.16.0 restored the setting of \f(CW$AUTOLOAD\fR. If you need +to support 5.8\-5.14, use the \s-1XSUB\s0's fields. +.SS "Calling Perl Routines from within C Programs" +.IX Subsection "Calling Perl Routines from within C Programs" +There are four routines that can be used to call a Perl subroutine from +within a C program. These four are: +.PP +.Vb 4 +\& I32 call_sv(SV*, I32); +\& I32 call_pv(const char*, I32); +\& I32 call_method(const char*, I32); +\& I32 call_argv(const char*, I32, char**); +.Ve +.PP +The routine most often used is \f(CW\*(C`call_sv\*(C'\fR. The \f(CW\*(C`SV*\*(C'\fR argument +contains either the name of the Perl subroutine to be called, or a +reference to the subroutine. The second argument consists of flags +that control the context in which the subroutine is called, whether +or not the subroutine is being passed arguments, how errors should be +trapped, and how to treat return values. +.PP +All four routines return the number of arguments that the subroutine returned +on the Perl stack. +.PP +These routines used to be called \f(CW\*(C`perl_call_sv\*(C'\fR, etc., before Perl v5.6.0, +but those names are now deprecated; macros of the same name are provided for +compatibility. +.PP +When using any of these routines (except \f(CW\*(C`call_argv\*(C'\fR), the programmer +must manipulate the Perl stack. These include the following macros and +functions: +.PP +.Vb 11 +\& dSP +\& SP +\& PUSHMARK() +\& PUTBACK +\& SPAGAIN +\& ENTER +\& SAVETMPS +\& FREETMPS +\& LEAVE +\& XPUSH*() +\& POP*() +.Ve +.PP +For a detailed description of calling conventions from C to Perl, +consult perlcall. +.SS "Putting a C value on Perl stack" +.IX Subsection "Putting a C value on Perl stack" +A lot of opcodes (this is an elementary operation in the internal perl +stack machine) put an SV* on the stack. However, as an optimization +the corresponding \s-1SV\s0 is (usually) not recreated each time. The opcodes +reuse specially assigned SVs (\fItarget\fRs) which are (as a corollary) +not constantly freed/created. +.PP +Each of the targets is created only once (but see +\&\*(L"Scratchpads and recursion\*(R" below), and when an opcode needs to put +an integer, a double, or a string on stack, it just sets the +corresponding parts of its \fItarget\fR and puts the \fItarget\fR on stack. +.PP +The macro to put this target on stack is \f(CW\*(C`PUSHTARG\*(C'\fR, and it is +directly used in some opcodes, as well as indirectly in zillions of +others, which use it via \f(CW\*(C`(X)PUSH[iunp]\*(C'\fR. +.PP +Because the target is reused, you must be careful when pushing multiple +values on the stack. The following code will not do what you think: +.PP +.Vb 2 +\& XPUSHi(10); +\& XPUSHi(20); +.Ve +.PP +This translates as "set \f(CW\*(C`TARG\*(C'\fR to 10, push a pointer to \f(CW\*(C`TARG\*(C'\fR onto +the stack; set \f(CW\*(C`TARG\*(C'\fR to 20, push a pointer to \f(CW\*(C`TARG\*(C'\fR onto the stack". +At the end of the operation, the stack does not contain the values 10 +and 20, but actually contains two pointers to \f(CW\*(C`TARG\*(C'\fR, which we have set +to 20. +.PP +If you need to push multiple different values then you should either use +the \f(CW\*(C`(X)PUSHs\*(C'\fR macros, or else use the new \f(CW\*(C`m(X)PUSH[iunp]\*(C'\fR macros, +none of which make use of \f(CW\*(C`TARG\*(C'\fR. The \f(CW\*(C`(X)PUSHs\*(C'\fR macros simply push an +SV* on the stack, which, as noted under \*(L"XSUBs and the Argument Stack\*(R", +will often need to be \*(L"mortal\*(R". The new \f(CW\*(C`m(X)PUSH[iunp]\*(C'\fR macros make +this a little easier to achieve by creating a new mortal for you (via +\&\f(CW\*(C`(X)PUSHmortal\*(C'\fR), pushing that onto the stack (extending it if necessary +in the case of the \f(CW\*(C`mXPUSH[iunp]\*(C'\fR macros), and then setting its value. +Thus, instead of writing this to \*(L"fix\*(R" the example above: +.PP +.Vb 2 +\& XPUSHs(sv_2mortal(newSViv(10))) +\& XPUSHs(sv_2mortal(newSViv(20))) +.Ve +.PP +you can simply write: +.PP +.Vb 2 +\& mXPUSHi(10) +\& mXPUSHi(20) +.Ve +.PP +On a related note, if you do use \f(CW\*(C`(X)PUSH[iunp]\*(C'\fR, then you're going to +need a \f(CW\*(C`dTARG\*(C'\fR in your variable declarations so that the \f(CW\*(C`*PUSH*\*(C'\fR +macros can make use of the local variable \f(CW\*(C`TARG\*(C'\fR. See also \f(CW\*(C`dTARGET\*(C'\fR +and \f(CW\*(C`dXSTARG\*(C'\fR. +.SS "Scratchpads" +.IX Subsection "Scratchpads" +The question remains on when the SVs which are \fItarget\fRs for opcodes +are created. The answer is that they are created when the current +unit\*(--a subroutine or a file (for opcodes for statements outside of +subroutines)\-\-is compiled. During this time a special anonymous Perl +array is created, which is called a scratchpad for the current unit. +.PP +A scratchpad keeps SVs which are lexicals for the current unit and are +targets for opcodes. A previous version of this document +stated that one can deduce that an \s-1SV\s0 lives on a scratchpad +by looking on its flags: lexicals have \f(CW\*(C`SVs_PADMY\*(C'\fR set, and +\&\fItarget\fRs have \f(CW\*(C`SVs_PADTMP\*(C'\fR set. But this has never been fully true. +\&\f(CW\*(C`SVs_PADMY\*(C'\fR could be set on a variable that no longer resides in any pad. +While \fItarget\fRs do have \f(CW\*(C`SVs_PADTMP\*(C'\fR set, it can also be set on variables +that have never resided in a pad, but nonetheless act like \fItarget\fRs. As +of perl 5.21.5, the \f(CW\*(C`SVs_PADMY\*(C'\fR flag is no longer used and is defined as +0. \f(CW\*(C`SvPADMY()\*(C'\fR now returns true for anything without \f(CW\*(C`SVs_PADTMP\*(C'\fR. +.PP +The correspondence between OPs and \fItarget\fRs is not 1\-to\-1. Different +OPs in the compile tree of the unit can use the same target, if this +would not conflict with the expected life of the temporary. +.SS "Scratchpads and recursion" +.IX Subsection "Scratchpads and recursion" +In fact it is not 100% true that a compiled unit contains a pointer to +the scratchpad \s-1AV.\s0 In fact it contains a pointer to an \s-1AV\s0 of +(initially) one element, and this element is the scratchpad \s-1AV.\s0 Why do +we need an extra level of indirection? +.PP +The answer is \fBrecursion\fR, and maybe \fBthreads\fR. Both +these can create several execution pointers going into the same +subroutine. For the subroutine-child not write over the temporaries +for the subroutine-parent (lifespan of which covers the call to the +child), the parent and the child should have different +scratchpads. (\fIAnd\fR the lexicals should be separate anyway!) +.PP +So each subroutine is born with an array of scratchpads (of length 1). +On each entry to the subroutine it is checked that the current +depth of the recursion is not more than the length of this array, and +if it is, new scratchpad is created and pushed into the array. +.PP +The \fItarget\fRs on this scratchpad are \f(CW\*(C`undef\*(C'\fRs, but they are already +marked with correct flags. +.SH "Memory Allocation" +.IX Header "Memory Allocation" +.SS "Allocation" +.IX Subsection "Allocation" +All memory meant to be used with the Perl \s-1API\s0 functions should be manipulated +using the macros described in this section. The macros provide the necessary +transparency between differences in the actual malloc implementation that is +used within perl. +.PP +The following three macros are used to initially allocate memory : +.PP +.Vb 3 +\& Newx(pointer, number, type); +\& Newxc(pointer, number, type, cast); +\& Newxz(pointer, number, type); +.Ve +.PP +The first argument \f(CW\*(C`pointer\*(C'\fR should be the name of a variable that will +point to the newly allocated memory. +.PP +The second and third arguments \f(CW\*(C`number\*(C'\fR and \f(CW\*(C`type\*(C'\fR specify how many of +the specified type of data structure should be allocated. The argument +\&\f(CW\*(C`type\*(C'\fR is passed to \f(CW\*(C`sizeof\*(C'\fR. The final argument to \f(CW\*(C`Newxc\*(C'\fR, \f(CW\*(C`cast\*(C'\fR, +should be used if the \f(CW\*(C`pointer\*(C'\fR argument is different from the \f(CW\*(C`type\*(C'\fR +argument. +.PP +Unlike the \f(CW\*(C`Newx\*(C'\fR and \f(CW\*(C`Newxc\*(C'\fR macros, the \f(CW\*(C`Newxz\*(C'\fR macro calls \f(CW\*(C`memzero\*(C'\fR +to zero out all the newly allocated memory. +.SS "Reallocation" +.IX Subsection "Reallocation" +.Vb 3 +\& Renew(pointer, number, type); +\& Renewc(pointer, number, type, cast); +\& Safefree(pointer) +.Ve +.PP +These three macros are used to change a memory buffer size or to free a +piece of memory no longer needed. The arguments to \f(CW\*(C`Renew\*(C'\fR and \f(CW\*(C`Renewc\*(C'\fR +match those of \f(CW\*(C`New\*(C'\fR and \f(CW\*(C`Newc\*(C'\fR with the exception of not needing the +\&\*(L"magic cookie\*(R" argument. +.SS "Moving" +.IX Subsection "Moving" +.Vb 3 +\& Move(source, dest, number, type); +\& Copy(source, dest, number, type); +\& Zero(dest, number, type); +.Ve +.PP +These three macros are used to move, copy, or zero out previously allocated +memory. The \f(CW\*(C`source\*(C'\fR and \f(CW\*(C`dest\*(C'\fR arguments point to the source and +destination starting points. Perl will move, copy, or zero out \f(CW\*(C`number\*(C'\fR +instances of the size of the \f(CW\*(C`type\*(C'\fR data structure (using the \f(CW\*(C`sizeof\*(C'\fR +function). +.SH "PerlIO" +.IX Header "PerlIO" +The most recent development releases of Perl have been experimenting with +removing Perl's dependency on the \*(L"normal\*(R" standard I/O suite and allowing +other stdio implementations to be used. This involves creating a new +abstraction layer that then calls whichever implementation of stdio Perl +was compiled with. All XSUBs should now use the functions in the PerlIO +abstraction layer and not make any assumptions about what kind of stdio +is being used. +.PP +For a complete description of the PerlIO abstraction, consult perlapio. +.SH "Compiled code" +.IX Header "Compiled code" +.SS "Code tree" +.IX Subsection "Code tree" +Here we describe the internal form your code is converted to by +Perl. Start with a simple example: +.PP +.Vb 1 +\& $a = $b + $c; +.Ve +.PP +This is converted to a tree similar to this one: +.PP +.Vb 5 +\& assign\-to +\& / \e +\& + $a +\& / \e +\& $b $c +.Ve +.PP +(but slightly more complicated). This tree reflects the way Perl +parsed your code, but has nothing to do with the execution order. +There is an additional \*(L"thread\*(R" going through the nodes of the tree +which shows the order of execution of the nodes. In our simplified +example above it looks like: +.PP +.Vb 1 +\& $b \-\-\-> $c \-\-\-> + \-\-\-> $a \-\-\-> assign\-to +.Ve +.PP +But with the actual compile tree for \f(CW\*(C`$a = $b + $c\*(C'\fR it is different: +some nodes \fIoptimized away\fR. As a corollary, though the actual tree +contains more nodes than our simplified example, the execution order +is the same as in our example. +.SS "Examining the tree" +.IX Subsection "Examining the tree" +If you have your perl compiled for debugging (usually done with +\&\f(CW\*(C`\-DDEBUGGING\*(C'\fR on the \f(CW\*(C`Configure\*(C'\fR command line), you may examine the +compiled tree by specifying \f(CW\*(C`\-Dx\*(C'\fR on the Perl command line. The +output takes several lines per node, and for \f(CW\*(C`$b+$c\*(C'\fR it looks like +this: +.PP +.Vb 10 +\& 5 TYPE = add ===> 6 +\& TARG = 1 +\& FLAGS = (SCALAR,KIDS) +\& { +\& TYPE = null ===> (4) +\& (was rv2sv) +\& FLAGS = (SCALAR,KIDS) +\& { +\& 3 TYPE = gvsv ===> 4 +\& FLAGS = (SCALAR) +\& GV = main::b +\& } +\& } +\& { +\& TYPE = null ===> (5) +\& (was rv2sv) +\& FLAGS = (SCALAR,KIDS) +\& { +\& 4 TYPE = gvsv ===> 5 +\& FLAGS = (SCALAR) +\& GV = main::c +\& } +\& } +.Ve +.PP +This tree has 5 nodes (one per \f(CW\*(C`TYPE\*(C'\fR specifier), only 3 of them are +not optimized away (one per number in the left column). The immediate +children of the given node correspond to \f(CW\*(C`{}\*(C'\fR pairs on the same level +of indentation, thus this listing corresponds to the tree: +.PP +.Vb 5 +\& add +\& / \e +\& null null +\& | | +\& gvsv gvsv +.Ve +.PP +The execution order is indicated by \f(CW\*(C`===>\*(C'\fR marks, thus it is \f(CW\*(C`3 +4 5 6\*(C'\fR (node \f(CW6\fR is not included into above listing), i.e., +\&\f(CW\*(C`gvsv gvsv add whatever\*(C'\fR. +.PP +Each of these nodes represents an op, a fundamental operation inside the +Perl core. The code which implements each operation can be found in the +\&\fIpp*.c\fR files; the function which implements the op with type \f(CW\*(C`gvsv\*(C'\fR +is \f(CW\*(C`pp_gvsv\*(C'\fR, and so on. As the tree above shows, different ops have +different numbers of children: \f(CW\*(C`add\*(C'\fR is a binary operator, as one would +expect, and so has two children. To accommodate the various different +numbers of children, there are various types of op data structure, and +they link together in different ways. +.PP +The simplest type of op structure is \f(CW\*(C`OP\*(C'\fR: this has no children. Unary +operators, \f(CW\*(C`UNOP\*(C'\fRs, have one child, and this is pointed to by the +\&\f(CW\*(C`op_first\*(C'\fR field. Binary operators (\f(CW\*(C`BINOP\*(C'\fRs) have not only an +\&\f(CW\*(C`op_first\*(C'\fR field but also an \f(CW\*(C`op_last\*(C'\fR field. The most complex type of +op is a \f(CW\*(C`LISTOP\*(C'\fR, which has any number of children. In this case, the +first child is pointed to by \f(CW\*(C`op_first\*(C'\fR and the last child by +\&\f(CW\*(C`op_last\*(C'\fR. The children in between can be found by iteratively +following the \f(CW\*(C`OpSIBLING\*(C'\fR pointer from the first child to the last (but +see below). +.PP +There are also some other op types: a \f(CW\*(C`PMOP\*(C'\fR holds a regular expression, +and has no children, and a \f(CW\*(C`LOOP\*(C'\fR may or may not have children. If the +\&\f(CW\*(C`op_children\*(C'\fR field is non-zero, it behaves like a \f(CW\*(C`LISTOP\*(C'\fR. To +complicate matters, if a \f(CW\*(C`UNOP\*(C'\fR is actually a \f(CW\*(C`null\*(C'\fR op after +optimization (see \*(L"Compile pass 2: context propagation\*(R") it will still +have children in accordance with its former type. +.PP +Finally, there is a \f(CW\*(C`LOGOP\*(C'\fR, or logic op. Like a \f(CW\*(C`LISTOP\*(C'\fR, this has one +or more children, but it doesn't have an \f(CW\*(C`op_last\*(C'\fR field: so you have to +follow \f(CW\*(C`op_first\*(C'\fR and then the \f(CW\*(C`OpSIBLING\*(C'\fR chain itself to find the +last child. Instead it has an \f(CW\*(C`op_other\*(C'\fR field, which is comparable to +the \f(CW\*(C`op_next\*(C'\fR field described below, and represents an alternate +execution path. Operators like \f(CW\*(C`and\*(C'\fR, \f(CW\*(C`or\*(C'\fR and \f(CW\*(C`?\*(C'\fR are \f(CW\*(C`LOGOP\*(C'\fRs. Note +that in general, \f(CW\*(C`op_other\*(C'\fR may not point to any of the direct children +of the \f(CW\*(C`LOGOP\*(C'\fR. +.PP +Starting in version 5.21.2, perls built with the experimental +define \f(CW\*(C`\-DPERL_OP_PARENT\*(C'\fR add an extra boolean flag for each op, +\&\f(CW\*(C`op_moresib\*(C'\fR. When not set, this indicates that this is the last op in an +\&\f(CW\*(C`OpSIBLING\*(C'\fR chain. This frees up the \f(CW\*(C`op_sibling\*(C'\fR field on the last +sibling to point back to the parent op. Under this build, that field is +also renamed \f(CW\*(C`op_sibparent\*(C'\fR to reflect its joint role. The macro +\&\f(CWOpSIBLING(o)\fR wraps this special behaviour, and always returns \s-1NULL\s0 on +the last sibling. With this build the \f(CWop_parent(o)\fR function can be +used to find the parent of any op. Thus for forward compatibility, you +should always use the \f(CWOpSIBLING(o)\fR macro rather than accessing +\&\f(CW\*(C`op_sibling\*(C'\fR directly. +.PP +Another way to examine the tree is to use a compiler back-end module, such +as B::Concise. +.SS "Compile pass 1: check routines" +.IX Subsection "Compile pass 1: check routines" +The tree is created by the compiler while \fIyacc\fR code feeds it +the constructions it recognizes. Since \fIyacc\fR works bottom-up, so does +the first pass of perl compilation. +.PP +What makes this pass interesting for perl developers is that some +optimization may be performed on this pass. This is optimization by +so-called \*(L"check routines\*(R". The correspondence between node names +and corresponding check routines is described in \fIopcode.pl\fR (do not +forget to run \f(CW\*(C`make regen_headers\*(C'\fR if you modify this file). +.PP +A check routine is called when the node is fully constructed except +for the execution-order thread. Since at this time there are no +back-links to the currently constructed node, one can do most any +operation to the top-level node, including freeing it and/or creating +new nodes above/below it. +.PP +The check routine returns the node which should be inserted into the +tree (if the top-level node was not modified, check routine returns +its argument). +.PP +By convention, check routines have names \f(CW\*(C`ck_*\*(C'\fR. They are usually +called from \f(CW\*(C`new*OP\*(C'\fR subroutines (or \f(CW\*(C`convert\*(C'\fR) (which in turn are +called from \fIperly.y\fR). +.SS "Compile pass 1a: constant folding" +.IX Subsection "Compile pass 1a: constant folding" +Immediately after the check routine is called the returned node is +checked for being compile-time executable. If it is (the value is +judged to be constant) it is immediately executed, and a \fIconstant\fR +node with the \*(L"return value\*(R" of the corresponding subtree is +substituted instead. The subtree is deleted. +.PP +If constant folding was not performed, the execution-order thread is +created. +.SS "Compile pass 2: context propagation" +.IX Subsection "Compile pass 2: context propagation" +When a context for a part of compile tree is known, it is propagated +down through the tree. At this time the context can have 5 values +(instead of 2 for runtime context): void, boolean, scalar, list, and +lvalue. In contrast with the pass 1 this pass is processed from top +to bottom: a node's context determines the context for its children. +.PP +Additional context-dependent optimizations are performed at this time. +Since at this moment the compile tree contains back-references (via +\&\*(L"thread\*(R" pointers), nodes cannot be \fBfree()\fRd now. To allow +optimized-away nodes at this stage, such nodes are \fBnull()\fRified instead +of \fBfree()\fRing (i.e. their type is changed to \s-1OP_NULL\s0). +.SS "Compile pass 3: peephole optimization" +.IX Subsection "Compile pass 3: peephole optimization" +After the compile tree for a subroutine (or for an \f(CW\*(C`eval\*(C'\fR or a file) +is created, an additional pass over the code is performed. This pass +is neither top-down or bottom-up, but in the execution order (with +additional complications for conditionals). Optimizations performed +at this stage are subject to the same restrictions as in the pass 2. +.PP +Peephole optimizations are done by calling the function pointed to +by the global variable \f(CW\*(C`PL_peepp\*(C'\fR. By default, \f(CW\*(C`PL_peepp\*(C'\fR just +calls the function pointed to by the global variable \f(CW\*(C`PL_rpeepp\*(C'\fR. +By default, that performs some basic op fixups and optimisations along +the execution-order op chain, and recursively calls \f(CW\*(C`PL_rpeepp\*(C'\fR for +each side chain of ops (resulting from conditionals). Extensions may +provide additional optimisations or fixups, hooking into either the +per-subroutine or recursive stage, like this: +.PP +.Vb 10 +\& static peep_t prev_peepp; +\& static void my_peep(pTHX_ OP *o) +\& { +\& /* custom per\-subroutine optimisation goes here */ +\& prev_peepp(aTHX_ o); +\& /* custom per\-subroutine optimisation may also go here */ +\& } +\& BOOT: +\& prev_peepp = PL_peepp; +\& PL_peepp = my_peep; +\& +\& static peep_t prev_rpeepp; +\& static void my_rpeep(pTHX_ OP *o) +\& { +\& OP *orig_o = o; +\& for(; o; o = o\->op_next) { +\& /* custom per\-op optimisation goes here */ +\& } +\& prev_rpeepp(aTHX_ orig_o); +\& } +\& BOOT: +\& prev_rpeepp = PL_rpeepp; +\& PL_rpeepp = my_rpeep; +.Ve +.SS "Pluggable runops" +.IX Subsection "Pluggable runops" +The compile tree is executed in a runops function. There are two runops +functions, in \fIrun.c\fR and in \fIdump.c\fR. \f(CW\*(C`Perl_runops_debug\*(C'\fR is used +with \s-1DEBUGGING\s0 and \f(CW\*(C`Perl_runops_standard\*(C'\fR is used otherwise. For fine +control over the execution of the compile tree it is possible to provide +your own runops function. +.PP +It's probably best to copy one of the existing runops functions and +change it to suit your needs. Then, in the \s-1BOOT\s0 section of your \s-1XS\s0 +file, add the line: +.PP +.Vb 1 +\& PL_runops = my_runops; +.Ve +.PP +This function should be as efficient as possible to keep your programs +running as fast as possible. +.SS "Compile-time scope hooks" +.IX Subsection "Compile-time scope hooks" +As of perl 5.14 it is possible to hook into the compile-time lexical +scope mechanism using \f(CW\*(C`Perl_blockhook_register\*(C'\fR. This is used like +this: +.PP +.Vb 2 +\& STATIC void my_start_hook(pTHX_ int full); +\& STATIC BHK my_hooks; +\& +\& BOOT: +\& BhkENTRY_set(&my_hooks, bhk_start, my_start_hook); +\& Perl_blockhook_register(aTHX_ &my_hooks); +.Ve +.PP +This will arrange to have \f(CW\*(C`my_start_hook\*(C'\fR called at the start of +compiling every lexical scope. The available hooks are: +.ie n .IP """void bhk_start(pTHX_ int full)""" 4 +.el .IP "\f(CWvoid bhk_start(pTHX_ int full)\fR" 4 +.IX Item "void bhk_start(pTHX_ int full)" +This is called just after starting a new lexical scope. Note that Perl +code like +.Sp +.Vb 1 +\& if ($x) { ... } +.Ve +.Sp +creates two scopes: the first starts at the \f(CW\*(C`(\*(C'\fR and has \f(CW\*(C`full == 1\*(C'\fR, +the second starts at the \f(CW\*(C`{\*(C'\fR and has \f(CW\*(C`full == 0\*(C'\fR. Both end at the +\&\f(CW\*(C`}\*(C'\fR, so calls to \f(CW\*(C`start\*(C'\fR and \f(CW\*(C`pre\*(C'\fR/\f(CW\*(C`post_end\*(C'\fR will match. Anything +pushed onto the save stack by this hook will be popped just before the +scope ends (between the \f(CW\*(C`pre_\*(C'\fR and \f(CW\*(C`post_end\*(C'\fR hooks, in fact). +.ie n .IP """void bhk_pre_end(pTHX_ OP **o)""" 4 +.el .IP "\f(CWvoid bhk_pre_end(pTHX_ OP **o)\fR" 4 +.IX Item "void bhk_pre_end(pTHX_ OP **o)" +This is called at the end of a lexical scope, just before unwinding the +stack. \fIo\fR is the root of the optree representing the scope; it is a +double pointer so you can replace the \s-1OP\s0 if you need to. +.ie n .IP """void bhk_post_end(pTHX_ OP **o)""" 4 +.el .IP "\f(CWvoid bhk_post_end(pTHX_ OP **o)\fR" 4 +.IX Item "void bhk_post_end(pTHX_ OP **o)" +This is called at the end of a lexical scope, just after unwinding the +stack. \fIo\fR is as above. Note that it is possible for calls to \f(CW\*(C`pre_\*(C'\fR +and \f(CW\*(C`post_end\*(C'\fR to nest, if there is something on the save stack that +calls string eval. +.ie n .IP """void bhk_eval(pTHX_ OP *const o)""" 4 +.el .IP "\f(CWvoid bhk_eval(pTHX_ OP *const o)\fR" 4 +.IX Item "void bhk_eval(pTHX_ OP *const o)" +This is called just before starting to compile an \f(CW\*(C`eval STRING\*(C'\fR, \f(CW\*(C`do +FILE\*(C'\fR, \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`use\*(C'\fR, after the eval has been set up. \fIo\fR is the +\&\s-1OP\s0 that requested the eval, and will normally be an \f(CW\*(C`OP_ENTEREVAL\*(C'\fR, +\&\f(CW\*(C`OP_DOFILE\*(C'\fR or \f(CW\*(C`OP_REQUIRE\*(C'\fR. +.PP +Once you have your hook functions, you need a \f(CW\*(C`BHK\*(C'\fR structure to put +them in. It's best to allocate it statically, since there is no way to +free it once it's registered. The function pointers should be inserted +into this structure using the \f(CW\*(C`BhkENTRY_set\*(C'\fR macro, which will also set +flags indicating which entries are valid. If you do need to allocate +your \f(CW\*(C`BHK\*(C'\fR dynamically for some reason, be sure to zero it before you +start. +.PP +Once registered, there is no mechanism to switch these hooks off, so if +that is necessary you will need to do this yourself. An entry in \f(CW\*(C`%^H\*(C'\fR +is probably the best way, so the effect is lexically scoped; however it +is also possible to use the \f(CW\*(C`BhkDISABLE\*(C'\fR and \f(CW\*(C`BhkENABLE\*(C'\fR macros to +temporarily switch entries on and off. You should also be aware that +generally speaking at least one scope will have opened before your +extension is loaded, so you will see some \f(CW\*(C`pre\*(C'\fR/\f(CW\*(C`post_end\*(C'\fR pairs that +didn't have a matching \f(CW\*(C`start\*(C'\fR. +.ie n .SH "Examining internal data structures with the ""dump"" functions" +.el .SH "Examining internal data structures with the \f(CWdump\fP functions" +.IX Header "Examining internal data structures with the dump functions" +To aid debugging, the source file \fIdump.c\fR contains a number of +functions which produce formatted output of internal data structures. +.PP +The most commonly used of these functions is \f(CW\*(C`Perl_sv_dump\*(C'\fR; it's used +for dumping SVs, AVs, HVs, and CVs. The \f(CW\*(C`Devel::Peek\*(C'\fR module calls +\&\f(CW\*(C`sv_dump\*(C'\fR to produce debugging output from Perl-space, so users of that +module should already be familiar with its format. +.PP +\&\f(CW\*(C`Perl_op_dump\*(C'\fR can be used to dump an \f(CW\*(C`OP\*(C'\fR structure or any of its +derivatives, and produces output similar to \f(CW\*(C`perl \-Dx\*(C'\fR; in fact, +\&\f(CW\*(C`Perl_dump_eval\*(C'\fR will dump the main root of the code being evaluated, +exactly like \f(CW\*(C`\-Dx\*(C'\fR. +.PP +Other useful functions are \f(CW\*(C`Perl_dump_sub\*(C'\fR, which turns a \f(CW\*(C`GV\*(C'\fR into an +op tree, \f(CW\*(C`Perl_dump_packsubs\*(C'\fR which calls \f(CW\*(C`Perl_dump_sub\*(C'\fR on all the +subroutines in a package like so: (Thankfully, these are all xsubs, so +there is no op tree) +.PP +.Vb 1 +\& (gdb) print Perl_dump_packsubs(PL_defstash) +\& +\& SUB attributes::bootstrap = (xsub 0x811fedc 0) +\& +\& SUB UNIVERSAL::can = (xsub 0x811f50c 0) +\& +\& SUB UNIVERSAL::isa = (xsub 0x811f304 0) +\& +\& SUB UNIVERSAL::VERSION = (xsub 0x811f7ac 0) +\& +\& SUB DynaLoader::boot_DynaLoader = (xsub 0x805b188 0) +.Ve +.PP +and \f(CW\*(C`Perl_dump_all\*(C'\fR, which dumps all the subroutines in the stash and +the op tree of the main root. +.SH "How multiple interpreters and concurrency are supported" +.IX Header "How multiple interpreters and concurrency are supported" +.SS "Background and \s-1PERL_IMPLICIT_CONTEXT\s0" +.IX Subsection "Background and PERL_IMPLICIT_CONTEXT" +The Perl interpreter can be regarded as a closed box: it has an \s-1API\s0 +for feeding it code or otherwise making it do things, but it also has +functions for its own use. This smells a lot like an object, and +there are ways for you to build Perl so that you can have multiple +interpreters, with one interpreter represented either as a C structure, +or inside a thread-specific structure. These structures contain all +the context, the state of that interpreter. +.PP +One macro controls the major Perl build flavor: \s-1MULTIPLICITY.\s0 The +\&\s-1MULTIPLICITY\s0 build has a C structure that packages all the interpreter +state. With multiplicity-enabled perls, \s-1PERL_IMPLICIT_CONTEXT\s0 is also +normally defined, and enables the support for passing in a \*(L"hidden\*(R" first +argument that represents all three data structures. \s-1MULTIPLICITY\s0 makes +multi-threaded perls possible (with the ithreads threading model, related +to the macro \s-1USE_ITHREADS.\s0) +.PP +Two other \*(L"encapsulation\*(R" macros are the \s-1PERL_GLOBAL_STRUCT\s0 and +\&\s-1PERL_GLOBAL_STRUCT_PRIVATE\s0 (the latter turns on the former, and the +former turns on \s-1MULTIPLICITY.\s0) The \s-1PERL_GLOBAL_STRUCT\s0 causes all the +internal variables of Perl to be wrapped inside a single global struct, +struct perl_vars, accessible as (globals) &PL_Vars or PL_VarsPtr or +the function \fBPerl_GetVars()\fR. The \s-1PERL_GLOBAL_STRUCT_PRIVATE\s0 goes +one step further, there is still a single struct (allocated in \fBmain()\fR +either from heap or from stack) but there are no global data symbols +pointing to it. In either case the global struct should be initialized +as the very first thing in \fBmain()\fR using \fBPerl_init_global_struct()\fR and +correspondingly tear it down after \fBperl_free()\fR using \fBPerl_free_global_struct()\fR, +please see \fIminiperlmain.c\fR for usage details. You may also need +to use \f(CW\*(C`dVAR\*(C'\fR in your coding to \*(L"declare the global variables\*(R" +when you are using them. dTHX does this for you automatically. +.PP +To see whether you have non-const data you can use a \s-1BSD\s0 (or \s-1GNU\s0) +compatible \f(CW\*(C`nm\*(C'\fR: +.PP +.Vb 1 +\& nm libperl.a | grep \-v \*(Aq [TURtr] \*(Aq +.Ve +.PP +If this displays any \f(CW\*(C`D\*(C'\fR or \f(CW\*(C`d\*(C'\fR symbols (or possibly \f(CW\*(C`C\*(C'\fR or \f(CW\*(C`c\*(C'\fR), +you have non-const data. The symbols the \f(CW\*(C`grep\*(C'\fR removed are as follows: +\&\f(CW\*(C`Tt\*(C'\fR are \fItext\fR, or code, the \f(CW\*(C`Rr\*(C'\fR are \fIread-only\fR (const) data, +and the \f(CW\*(C`U\*(C'\fR is , external symbols referred to. +.PP +The test \fIt/porting/libperl.t\fR does this kind of symbol sanity +checking on \f(CW\*(C`libperl.a\*(C'\fR. +.PP +For backward compatibility reasons defining just \s-1PERL_GLOBAL_STRUCT\s0 +doesn't actually hide all symbols inside a big global struct: some +PerlIO_xxx vtables are left visible. The \s-1PERL_GLOBAL_STRUCT_PRIVATE\s0 +then hides everything (see how the \s-1PERLIO_FUNCS_DECL\s0 is used). +.PP +All this obviously requires a way for the Perl internal functions to be +either subroutines taking some kind of structure as the first +argument, or subroutines taking nothing as the first argument. To +enable these two very different ways of building the interpreter, +the Perl source (as it does in so many other situations) makes heavy +use of macros and subroutine naming conventions. +.PP +First problem: deciding which functions will be public \s-1API\s0 functions and +which will be private. All functions whose names begin \f(CW\*(C`S_\*(C'\fR are private +(think \*(L"S\*(R" for \*(L"secret\*(R" or \*(L"static\*(R"). All other functions begin with +\&\*(L"Perl_\*(R", but just because a function begins with \*(L"Perl_\*(R" does not mean it is +part of the \s-1API.\s0 (See \*(L"Internal +Functions\*(R".) The easiest way to be \fBsure\fR a +function is part of the \s-1API\s0 is to find its entry in perlapi. +If it exists in perlapi, it's part of the \s-1API.\s0 If it doesn't, and you +think it should be (i.e., you need it for your extension), submit an issue at + explaining why you think it should be. +.PP +Second problem: there must be a syntax so that the same subroutine +declarations and calls can pass a structure as their first argument, +or pass nothing. To solve this, the subroutines are named and +declared in a particular way. Here's a typical start of a static +function used within the Perl guts: +.PP +.Vb 2 +\& STATIC void +\& S_incline(pTHX_ char *s) +.Ve +.PP +\&\s-1STATIC\s0 becomes \*(L"static\*(R" in C, and may be #define'd to nothing in some +configurations in the future. +.PP +A public function (i.e. part of the internal \s-1API,\s0 but not necessarily +sanctioned for use in extensions) begins like this: +.PP +.Vb 2 +\& void +\& Perl_sv_setiv(pTHX_ SV* dsv, IV num) +.Ve +.PP +\&\f(CW\*(C`pTHX_\*(C'\fR is one of a number of macros (in \fIperl.h\fR) that hide the +details of the interpreter's context. \s-1THX\s0 stands for \*(L"thread\*(R", \*(L"this\*(R", +or \*(L"thingy\*(R", as the case may be. (And no, George Lucas is not involved. :\-) +The first character could be 'p' for a \fBp\fRrototype, 'a' for \fBa\fRrgument, +or 'd' for \fBd\fReclaration, so we have \f(CW\*(C`pTHX\*(C'\fR, \f(CW\*(C`aTHX\*(C'\fR and \f(CW\*(C`dTHX\*(C'\fR, and +their variants. +.PP +When Perl is built without options that set \s-1PERL_IMPLICIT_CONTEXT,\s0 there is no +first argument containing the interpreter's context. The trailing underscore +in the pTHX_ macro indicates that the macro expansion needs a comma +after the context argument because other arguments follow it. If +\&\s-1PERL_IMPLICIT_CONTEXT\s0 is not defined, pTHX_ will be ignored, and the +subroutine is not prototyped to take the extra argument. The form of the +macro without the trailing underscore is used when there are no additional +explicit arguments. +.PP +When a core function calls another, it must pass the context. This +is normally hidden via macros. Consider \f(CW\*(C`sv_setiv\*(C'\fR. It expands into +something like this: +.PP +.Vb 6 +\& #ifdef PERL_IMPLICIT_CONTEXT +\& #define sv_setiv(a,b) Perl_sv_setiv(aTHX_ a, b) +\& /* can\*(Aqt do this for vararg functions, see below */ +\& #else +\& #define sv_setiv Perl_sv_setiv +\& #endif +.Ve +.PP +This works well, and means that \s-1XS\s0 authors can gleefully write: +.PP +.Vb 1 +\& sv_setiv(foo, bar); +.Ve +.PP +and still have it work under all the modes Perl could have been +compiled with. +.PP +This doesn't work so cleanly for varargs functions, though, as macros +imply that the number of arguments is known in advance. Instead we +either need to spell them out fully, passing \f(CW\*(C`aTHX_\*(C'\fR as the first +argument (the Perl core tends to do this with functions like +Perl_warner), or use a context-free version. +.PP +The context-free version of Perl_warner is called +Perl_warner_nocontext, and does not take the extra argument. Instead +it does \f(CW\*(C`dTHX;\*(C'\fR to get the context from thread-local storage. We +\&\f(CW\*(C`#define warner Perl_warner_nocontext\*(C'\fR so that extensions get source +compatibility at the expense of performance. (Passing an arg is +cheaper than grabbing it from thread-local storage.) +.PP +You can ignore [pad]THXx when browsing the Perl headers/sources. +Those are strictly for use within the core. Extensions and embedders +need only be aware of [pad]THX. +.SS "So what happened to dTHR?" +.IX Subsection "So what happened to dTHR?" +\&\f(CW\*(C`dTHR\*(C'\fR was introduced in perl 5.005 to support the older thread model. +The older thread model now uses the \f(CW\*(C`THX\*(C'\fR mechanism to pass context +pointers around, so \f(CW\*(C`dTHR\*(C'\fR is not useful any more. Perl 5.6.0 and +later still have it for backward source compatibility, but it is defined +to be a no-op. +.SS "How do I use all this in extensions?" +.IX Subsection "How do I use all this in extensions?" +When Perl is built with \s-1PERL_IMPLICIT_CONTEXT,\s0 extensions that call +any functions in the Perl \s-1API\s0 will need to pass the initial context +argument somehow. The kicker is that you will need to write it in +such a way that the extension still compiles when Perl hasn't been +built with \s-1PERL_IMPLICIT_CONTEXT\s0 enabled. +.PP +There are three ways to do this. First, the easy but inefficient way, +which is also the default, in order to maintain source compatibility +with extensions: whenever \fI\s-1XSUB\s0.h\fR is #included, it redefines the aTHX +and aTHX_ macros to call a function that will return the context. +Thus, something like: +.PP +.Vb 1 +\& sv_setiv(sv, num); +.Ve +.PP +in your extension will translate to this when \s-1PERL_IMPLICIT_CONTEXT\s0 is +in effect: +.PP +.Vb 1 +\& Perl_sv_setiv(Perl_get_context(), sv, num); +.Ve +.PP +or to this otherwise: +.PP +.Vb 1 +\& Perl_sv_setiv(sv, num); +.Ve +.PP +You don't have to do anything new in your extension to get this; since +the Perl library provides \fBPerl_get_context()\fR, it will all just +work. +.PP +The second, more efficient way is to use the following template for +your Foo.xs: +.PP +.Vb 4 +\& #define PERL_NO_GET_CONTEXT /* we want efficiency */ +\& #include "EXTERN.h" +\& #include "perl.h" +\& #include "XSUB.h" +\& +\& STATIC void my_private_function(int arg1, int arg2); +\& +\& STATIC void +\& my_private_function(int arg1, int arg2) +\& { +\& dTHX; /* fetch context */ +\& ... call many Perl API functions ... +\& } +\& +\& [... etc ...] +\& +\& MODULE = Foo PACKAGE = Foo +\& +\& /* typical XSUB */ +\& +\& void +\& my_xsub(arg) +\& int arg +\& CODE: +\& my_private_function(arg, 10); +.Ve +.PP +Note that the only two changes from the normal way of writing an +extension is the addition of a \f(CW\*(C`#define PERL_NO_GET_CONTEXT\*(C'\fR before +including the Perl headers, followed by a \f(CW\*(C`dTHX;\*(C'\fR declaration at +the start of every function that will call the Perl \s-1API.\s0 (You'll +know which functions need this, because the C compiler will complain +that there's an undeclared identifier in those functions.) No changes +are needed for the XSUBs themselves, because the \s-1\fBXS\s0()\fR macro is +correctly defined to pass in the implicit context if needed. +.PP +The third, even more efficient way is to ape how it is done within +the Perl guts: +.PP +.Vb 4 +\& #define PERL_NO_GET_CONTEXT /* we want efficiency */ +\& #include "EXTERN.h" +\& #include "perl.h" +\& #include "XSUB.h" +\& +\& /* pTHX_ only needed for functions that call Perl API */ +\& STATIC void my_private_function(pTHX_ int arg1, int arg2); +\& +\& STATIC void +\& my_private_function(pTHX_ int arg1, int arg2) +\& { +\& /* dTHX; not needed here, because THX is an argument */ +\& ... call Perl API functions ... +\& } +\& +\& [... etc ...] +\& +\& MODULE = Foo PACKAGE = Foo +\& +\& /* typical XSUB */ +\& +\& void +\& my_xsub(arg) +\& int arg +\& CODE: +\& my_private_function(aTHX_ arg, 10); +.Ve +.PP +This implementation never has to fetch the context using a function +call, since it is always passed as an extra argument. Depending on +your needs for simplicity or efficiency, you may mix the previous +two approaches freely. +.PP +Never add a comma after \f(CW\*(C`pTHX\*(C'\fR yourself\*(--always use the form of the +macro with the underscore for functions that take explicit arguments, +or the form without the argument for functions with no explicit arguments. +.PP +If one is compiling Perl with the \f(CW\*(C`\-DPERL_GLOBAL_STRUCT\*(C'\fR the \f(CW\*(C`dVAR\*(C'\fR +definition is needed if the Perl global variables (see \fIperlvars.h\fR +or \fIglobvar.sym\fR) are accessed in the function and \f(CW\*(C`dTHX\*(C'\fR is not +used (the \f(CW\*(C`dTHX\*(C'\fR includes the \f(CW\*(C`dVAR\*(C'\fR if necessary). One notices +the need for \f(CW\*(C`dVAR\*(C'\fR only with the said compile-time define, because +otherwise the Perl global variables are visible as-is. +.SS "Should I do anything special if I call perl from multiple threads?" +.IX Subsection "Should I do anything special if I call perl from multiple threads?" +If you create interpreters in one thread and then proceed to call them in +another, you need to make sure perl's own Thread Local Storage (\s-1TLS\s0) slot is +initialized correctly in each of those threads. +.PP +The \f(CW\*(C`perl_alloc\*(C'\fR and \f(CW\*(C`perl_clone\*(C'\fR \s-1API\s0 functions will automatically set +the \s-1TLS\s0 slot to the interpreter they created, so that there is no need to do +anything special if the interpreter is always accessed in the same thread that +created it, and that thread did not create or call any other interpreters +afterwards. If that is not the case, you have to set the \s-1TLS\s0 slot of the +thread before calling any functions in the Perl \s-1API\s0 on that particular +interpreter. This is done by calling the \f(CW\*(C`PERL_SET_CONTEXT\*(C'\fR macro in that +thread as the first thing you do: +.PP +.Vb 2 +\& /* do this before doing anything else with some_perl */ +\& PERL_SET_CONTEXT(some_perl); +\& +\& ... other Perl API calls on some_perl go here ... +.Ve +.SS "Future Plans and \s-1PERL_IMPLICIT_SYS\s0" +.IX Subsection "Future Plans and PERL_IMPLICIT_SYS" +Just as \s-1PERL_IMPLICIT_CONTEXT\s0 provides a way to bundle up everything +that the interpreter knows about itself and pass it around, so too are +there plans to allow the interpreter to bundle up everything it knows +about the environment it's running on. This is enabled with the +\&\s-1PERL_IMPLICIT_SYS\s0 macro. Currently it only works with \s-1USE_ITHREADS\s0 on +Windows. +.PP +This allows the ability to provide an extra pointer (called the \*(L"host\*(R" +environment) for all the system calls. This makes it possible for +all the system stuff to maintain their own state, broken down into +seven C structures. These are thin wrappers around the usual system +calls (see \fIwin32/perllib.c\fR) for the default perl executable, but for a +more ambitious host (like the one that would do \fBfork()\fR emulation) all +the extra work needed to pretend that different interpreters are +actually different \*(L"processes\*(R", would be done here. +.PP +The Perl engine/interpreter and the host are orthogonal entities. +There could be one or more interpreters in a process, and one or +more \*(L"hosts\*(R", with free association between them. +.SH "Internal Functions" +.IX Header "Internal Functions" +All of Perl's internal functions which will be exposed to the outside +world are prefixed by \f(CW\*(C`Perl_\*(C'\fR so that they will not conflict with \s-1XS\s0 +functions or functions used in a program in which Perl is embedded. +Similarly, all global variables begin with \f(CW\*(C`PL_\*(C'\fR. (By convention, +static functions start with \f(CW\*(C`S_\*(C'\fR.) +.PP +Inside the Perl core (\f(CW\*(C`PERL_CORE\*(C'\fR defined), you can get at the functions +either with or without the \f(CW\*(C`Perl_\*(C'\fR prefix, thanks to a bunch of defines +that live in \fIembed.h\fR. Note that extension code should \fInot\fR set +\&\f(CW\*(C`PERL_CORE\*(C'\fR; this exposes the full perl internals, and is likely to cause +breakage of the \s-1XS\s0 in each new perl release. +.PP +The file \fIembed.h\fR is generated automatically from +\&\fIembed.pl\fR and \fIembed.fnc\fR. \fIembed.pl\fR also creates the prototyping +header files for the internal functions, generates the documentation +and a lot of other bits and pieces. It's important that when you add +a new function to the core or change an existing one, you change the +data in the table in \fIembed.fnc\fR as well. Here's a sample entry from +that table: +.PP +.Vb 1 +\& Apd |SV** |av_fetch |AV* ar|I32 key|I32 lval +.Ve +.PP +The first column is a set of flags, the second column the return type, +the third column the name. Columns after that are the arguments. +The flags are documented at the top of \fIembed.fnc\fR. +.PP +If you edit \fIembed.pl\fR or \fIembed.fnc\fR, you will need to run +\&\f(CW\*(C`make regen_headers\*(C'\fR to force a rebuild of \fIembed.h\fR and other +auto-generated files. +.SS "Formatted Printing of IVs, UVs, and NVs" +.IX Subsection "Formatted Printing of IVs, UVs, and NVs" +If you are printing IVs, UVs, or \s-1NVS\s0 instead of the \fBstdio\fR\|(3) style +formatting codes like \f(CW%d\fR, \f(CW%ld\fR, \f(CW%f\fR, you should use the +following macros for portability +.PP +.Vb 7 +\& IVdf IV in decimal +\& UVuf UV in decimal +\& UVof UV in octal +\& UVxf UV in hexadecimal +\& NVef NV %e\-like +\& NVff NV %f\-like +\& NVgf NV %g\-like +.Ve +.PP +These will take care of 64\-bit integers and long doubles. +For example: +.PP +.Vb 1 +\& printf("IV is %" IVdf "\en", iv); +.Ve +.PP +The \f(CW\*(C`IVdf\*(C'\fR will expand to whatever is the correct format for the IVs. +Note that the spaces are required around the format in case the code is +compiled with \*(C+, to maintain compliance with its standard. +.PP +Note that there are different \*(L"long doubles\*(R": Perl will use +whatever the compiler has. +.PP +If you are printing addresses of pointers, use \f(CW%p\fR or UVxf combined +with \s-1\fBPTR2UV\s0()\fR. +.SS "Formatted Printing of SVs" +.IX Subsection "Formatted Printing of SVs" +The contents of SVs may be printed using the \f(CW\*(C`SVf\*(C'\fR format, like so: +.PP +.Vb 1 +\& Perl_croak(aTHX_ "This croaked because: %" SVf "\en", SvfARG(err_msg)) +.Ve +.PP +where \f(CW\*(C`err_msg\*(C'\fR is an \s-1SV.\s0 +.PP +Not all scalar types are printable. Simple values certainly are: one of +\&\s-1IV, UV, NV,\s0 or \s-1PV.\s0 Also, if the \s-1SV\s0 is a reference to some value, +either it will be dereferenced and the value printed, or information +about the type of that value and its address are displayed. The results +of printing any other type of \s-1SV\s0 are undefined and likely to lead to an +interpreter crash. NVs are printed using a \f(CW%g\fR\-ish format. +.PP +Note that the spaces are required around the \f(CW\*(C`SVf\*(C'\fR in case the code is +compiled with \*(C+, to maintain compliance with its standard. +.PP +Note that any filehandle being printed to under \s-1UTF\-8\s0 must be expecting +\&\s-1UTF\-8\s0 in order to get good results and avoid Wide-character warnings. +One way to do this for typical filehandles is to invoke perl with the +\&\f(CW\*(C`\-C\*(C'\fR> parameter. (See \*(L"\-C [number/list]\*(R" in perlrun. +.PP +You can use this to concatenate two scalars: +.PP +.Vb 4 +\& SV *var1 = get_sv("var1", GV_ADD); +\& SV *var2 = get_sv("var2", GV_ADD); +\& SV *var3 = newSVpvf("var1=%" SVf " and var2=%" SVf, +\& SVfARG(var1), SVfARG(var2)); +.Ve +.SS "Formatted Printing of Strings" +.IX Subsection "Formatted Printing of Strings" +If you just want the bytes printed in a 7bit NUL-terminated string, you can +just use \f(CW%s\fR (assuming they are all really only 7bit). But if there is a +possibility the value will be encoded as \s-1UTF\-8\s0 or contains bytes above +\&\f(CW0x7F\fR (and therefore 8bit), you should instead use the \f(CW\*(C`UTF8f\*(C'\fR format. +And as its parameter, use the \f(CW\*(C`UTF8fARG()\*(C'\fR macro: +.PP +.Vb 1 +\& chr * msg; +\& +\& /* U+2018: \exE2\ex80\ex98 LEFT SINGLE QUOTATION MARK +\& U+2019: \exE2\ex80\ex99 RIGHT SINGLE QUOTATION MARK */ +\& if (can_utf8) +\& msg = "\exE2\ex80\ex98Uses fancy quotes\exE2\ex80\ex99"; +\& else +\& msg = "\*(AqUses simple quotes\*(Aq"; +\& +\& Perl_croak(aTHX_ "The message is: %" UTF8f "\en", +\& UTF8fARG(can_utf8, strlen(msg), msg)); +.Ve +.PP +The first parameter to \f(CW\*(C`UTF8fARG\*(C'\fR is a boolean: 1 if the string is in +\&\s-1UTF\-8\s0; 0 if string is in native byte encoding (Latin1). +The second parameter is the number of bytes in the string to print. +And the third and final parameter is a pointer to the first byte in the +string. +.PP +Note that any filehandle being printed to under \s-1UTF\-8\s0 must be expecting +\&\s-1UTF\-8\s0 in order to get good results and avoid Wide-character warnings. +One way to do this for typical filehandles is to invoke perl with the +\&\f(CW\*(C`\-C\*(C'\fR> parameter. (See \*(L"\-C [number/list]\*(R" in perlrun. +.ie n .SS "Formatted Printing of ""Size_t"" and ""SSize_t""" +.el .SS "Formatted Printing of \f(CWSize_t\fP and \f(CWSSize_t\fP" +.IX Subsection "Formatted Printing of Size_t and SSize_t" +The most general way to do this is to cast them to a \s-1UV\s0 or \s-1IV,\s0 and +print as in the +previous section. +.PP +But if you're using \f(CW\*(C`PerlIO_printf()\*(C'\fR, it's less typing and visual +clutter to use the \f(CW%z\fR length modifier (for \fIsiZe\fR): +.PP +.Vb 1 +\& PerlIO_printf("STRLEN is %zu\en", len); +.Ve +.PP +This modifier is not portable, so its use should be restricted to +\&\f(CW\*(C`PerlIO_printf()\*(C'\fR. +.SS "Pointer-To-Integer and Integer-To-Pointer" +.IX Subsection "Pointer-To-Integer and Integer-To-Pointer" +Because pointer size does not necessarily equal integer size, +use the follow macros to do it right. +.PP +.Vb 4 +\& PTR2UV(pointer) +\& PTR2IV(pointer) +\& PTR2NV(pointer) +\& INT2PTR(pointertotype, integer) +.Ve +.PP +For example: +.PP +.Vb 2 +\& IV iv = ...; +\& SV *sv = INT2PTR(SV*, iv); +.Ve +.PP +and +.PP +.Vb 2 +\& AV *av = ...; +\& UV uv = PTR2UV(av); +.Ve +.SS "Exception Handling" +.IX Subsection "Exception Handling" +There are a couple of macros to do very basic exception handling in \s-1XS\s0 +modules. You have to define \f(CW\*(C`NO_XSLOCKS\*(C'\fR before including \fI\s-1XSUB\s0.h\fR to +be able to use these macros: +.PP +.Vb 2 +\& #define NO_XSLOCKS +\& #include "XSUB.h" +.Ve +.PP +You can use these macros if you call code that may croak, but you need +to do some cleanup before giving control back to Perl. For example: +.PP +.Vb 1 +\& dXCPT; /* set up necessary variables */ +\& +\& XCPT_TRY_START { +\& code_that_may_croak(); +\& } XCPT_TRY_END +\& +\& XCPT_CATCH +\& { +\& /* do cleanup here */ +\& XCPT_RETHROW; +\& } +.Ve +.PP +Note that you always have to rethrow an exception that has been +caught. Using these macros, it is not possible to just catch the +exception and ignore it. If you have to ignore the exception, you +have to use the \f(CW\*(C`call_*\*(C'\fR function. +.PP +The advantage of using the above macros is that you don't have +to setup an extra function for \f(CW\*(C`call_*\*(C'\fR, and that using these +macros is faster than using \f(CW\*(C`call_*\*(C'\fR. +.SS "Source Documentation" +.IX Subsection "Source Documentation" +There's an effort going on to document the internal functions and +automatically produce reference manuals from them \*(-- perlapi is one +such manual which details all the functions which are available to \s-1XS\s0 +writers. perlintern is the autogenerated manual for the functions +which are not part of the \s-1API\s0 and are supposedly for internal use only. +.PP +Source documentation is created by putting \s-1POD\s0 comments into the C +source, like this: +.PP +.Vb 2 +\& /* +\& =for apidoc sv_setiv +\& +\& Copies an integer into the given SV. Does not handle \*(Aqset\*(Aq magic. See +\& L. +\& +\& =cut +\& */ +.Ve +.PP +Please try and supply some documentation if you add functions to the +Perl core. +.SS "Backwards compatibility" +.IX Subsection "Backwards compatibility" +The Perl \s-1API\s0 changes over time. New functions are +added or the interfaces of existing functions are +changed. The \f(CW\*(C`Devel::PPPort\*(C'\fR module tries to +provide compatibility code for some of these changes, so \s-1XS\s0 writers don't +have to code it themselves when supporting multiple versions of Perl. +.PP +\&\f(CW\*(C`Devel::PPPort\*(C'\fR generates a C header file \fIppport.h\fR that can also +be run as a Perl script. To generate \fIppport.h\fR, run: +.PP +.Vb 1 +\& perl \-MDevel::PPPort \-eDevel::PPPort::WriteFile +.Ve +.PP +Besides checking existing \s-1XS\s0 code, the script can also be used to retrieve +compatibility information for various \s-1API\s0 calls using the \f(CW\*(C`\-\-api\-info\*(C'\fR +command line switch. For example: +.PP +.Vb 1 +\& % perl ppport.h \-\-api\-info=sv_magicext +.Ve +.PP +For details, see \f(CW\*(C`perldoc ppport.h\*(C'\fR. +.SH "Unicode Support" +.IX Header "Unicode Support" +Perl 5.6.0 introduced Unicode support. It's important for porters and \s-1XS\s0 +writers to understand this support and make sure that the code they +write does not corrupt Unicode data. +.SS "What \fBis\fP Unicode, anyway?" +.IX Subsection "What is Unicode, anyway?" +In the olden, less enlightened times, we all used to use \s-1ASCII.\s0 Most of +us did, anyway. The big problem with \s-1ASCII\s0 is that it's American. Well, +no, that's not actually the problem; the problem is that it's not +particularly useful for people who don't use the Roman alphabet. What +used to happen was that particular languages would stick their own +alphabet in the upper range of the sequence, between 128 and 255. Of +course, we then ended up with plenty of variants that weren't quite +\&\s-1ASCII,\s0 and the whole point of it being a standard was lost. +.PP +Worse still, if you've got a language like Chinese or +Japanese that has hundreds or thousands of characters, then you really +can't fit them into a mere 256, so they had to forget about \s-1ASCII\s0 +altogether, and build their own systems using pairs of numbers to refer +to one character. +.PP +To fix this, some people formed Unicode, Inc. and +produced a new character set containing all the characters you can +possibly think of and more. There are several ways of representing these +characters, and the one Perl uses is called \s-1UTF\-8.\s0 \s-1UTF\-8\s0 uses +a variable number of bytes to represent a character. You can learn more +about Unicode and Perl's Unicode model in perlunicode. +.PP +(On \s-1EBCDIC\s0 platforms, Perl uses instead UTF-EBCDIC, which is a form of +\&\s-1UTF\-8\s0 adapted for \s-1EBCDIC\s0 platforms. Below, we just talk about \s-1UTF\-8.\s0 +UTF-EBCDIC is like \s-1UTF\-8,\s0 but the details are different. The macros +hide the differences from you, just remember that the particular numbers +and bit patterns presented below will differ in UTF-EBCDIC.) +.SS "How can I recognise a \s-1UTF\-8\s0 string?" +.IX Subsection "How can I recognise a UTF-8 string?" +You can't. This is because \s-1UTF\-8\s0 data is stored in bytes just like +non\-UTF\-8 data. The Unicode character 200, (\f(CW0xC8\fR for you hex types) +capital E with a grave accent, is represented by the two bytes +\&\f(CW\*(C`v196.172\*(C'\fR. Unfortunately, the non-Unicode string \f(CW\*(C`chr(196).chr(172)\*(C'\fR +has that byte sequence as well. So you can't tell just by looking \*(-- this +is what makes Unicode input an interesting problem. +.PP +In general, you either have to know what you're dealing with, or you +have to guess. The \s-1API\s0 function \f(CW\*(C`is_utf8_string\*(C'\fR can help; it'll tell +you if a string contains only valid \s-1UTF\-8\s0 characters, and the chances +of a non\-UTF\-8 string looking like valid \s-1UTF\-8\s0 become very small very +quickly with increasing string length. On a character-by-character +basis, \f(CW\*(C`isUTF8_CHAR\*(C'\fR +will tell you whether the current character in a string is valid \s-1UTF\-8.\s0 +.SS "How does \s-1UTF\-8\s0 represent Unicode characters?" +.IX Subsection "How does UTF-8 represent Unicode characters?" +As mentioned above, \s-1UTF\-8\s0 uses a variable number of bytes to store a +character. Characters with values 0...127 are stored in one +byte, just like good ol' \s-1ASCII.\s0 Character 128 is stored as +\&\f(CW\*(C`v194.128\*(C'\fR; this continues up to character 191, which is +\&\f(CW\*(C`v194.191\*(C'\fR. Now we've run out of bits (191 is binary +\&\f(CW10111111\fR) so we move on; character 192 is \f(CW\*(C`v195.128\*(C'\fR. And +so it goes on, moving to three bytes at character 2048. +\&\*(L"Unicode Encodings\*(R" in perlunicode has pictures of how this works. +.PP +Assuming you know you're dealing with a \s-1UTF\-8\s0 string, you can find out +how long the first character in it is with the \f(CW\*(C`UTF8SKIP\*(C'\fR macro: +.PP +.Vb 2 +\& char *utf = "\e305\e233\e340\e240\e201"; +\& I32 len; +\& +\& len = UTF8SKIP(utf); /* len is 2 here */ +\& utf += len; +\& len = UTF8SKIP(utf); /* len is 3 here */ +.Ve +.PP +Another way to skip over characters in a \s-1UTF\-8\s0 string is to use +\&\f(CW\*(C`utf8_hop\*(C'\fR, which takes a string and a number of characters to skip +over. You're on your own about bounds checking, though, so don't use it +lightly. +.PP +All bytes in a multi-byte \s-1UTF\-8\s0 character will have the high bit set, +so you can test if you need to do something special with this +character like this (the \f(CW\*(C`UTF8_IS_INVARIANT()\*(C'\fR is a macro that tests +whether the byte is encoded as a single byte even in \s-1UTF\-8\s0): +.PP +.Vb 7 +\& U8 *utf; /* Initialize this to point to the beginning of the +\& sequence to convert */ +\& U8 *utf_end; /* Initialize this to 1 beyond the end of the sequence +\& pointed to by \*(Aqutf\*(Aq */ +\& UV uv; /* Returned code point; note: a UV, not a U8, not a +\& char */ +\& STRLEN len; /* Returned length of character in bytes */ +\& +\& if (!UTF8_IS_INVARIANT(*utf)) +\& /* Must treat this as UTF\-8 */ +\& uv = utf8_to_uvchr_buf(utf, utf_end, &len); +\& else +\& /* OK to treat this character as a byte */ +\& uv = *utf; +.Ve +.PP +You can also see in that example that we use \f(CW\*(C`utf8_to_uvchr_buf\*(C'\fR to get the +value of the character; the inverse function \f(CW\*(C`uvchr_to_utf8\*(C'\fR is available +for putting a \s-1UV\s0 into \s-1UTF\-8:\s0 +.PP +.Vb 6 +\& if (!UVCHR_IS_INVARIANT(uv)) +\& /* Must treat this as UTF8 */ +\& utf8 = uvchr_to_utf8(utf8, uv); +\& else +\& /* OK to treat this character as a byte */ +\& *utf8++ = uv; +.Ve +.PP +You \fBmust\fR convert characters to UVs using the above functions if +you're ever in a situation where you have to match \s-1UTF\-8\s0 and non\-UTF\-8 +characters. You may not skip over \s-1UTF\-8\s0 characters in this case. If you +do this, you'll lose the ability to match hi-bit non\-UTF\-8 characters; +for instance, if your \s-1UTF\-8\s0 string contains \f(CW\*(C`v196.172\*(C'\fR, and you skip +that character, you can never match a \f(CW\*(C`chr(200)\*(C'\fR in a non\-UTF\-8 string. +So don't do that! +.PP +(Note that we don't have to test for invariant characters in the +examples above. The functions work on any well-formed \s-1UTF\-8\s0 input. +It's just that its faster to avoid the function overhead when it's not +needed.) +.SS "How does Perl store \s-1UTF\-8\s0 strings?" +.IX Subsection "How does Perl store UTF-8 strings?" +Currently, Perl deals with \s-1UTF\-8\s0 strings and non\-UTF\-8 strings +slightly differently. A flag in the \s-1SV,\s0 \f(CW\*(C`SVf_UTF8\*(C'\fR, indicates that the +string is internally encoded as \s-1UTF\-8.\s0 Without it, the byte value is the +codepoint number and vice versa. This flag is only meaningful if the \s-1SV\s0 +is \f(CW\*(C`SvPOK\*(C'\fR or immediately after stringification via \f(CW\*(C`SvPV\*(C'\fR or a +similar macro. You can check and manipulate this flag with the +following macros: +.PP +.Vb 3 +\& SvUTF8(sv) +\& SvUTF8_on(sv) +\& SvUTF8_off(sv) +.Ve +.PP +This flag has an important effect on Perl's treatment of the string: if +\&\s-1UTF\-8\s0 data is not properly distinguished, regular expressions, +\&\f(CW\*(C`length\*(C'\fR, \f(CW\*(C`substr\*(C'\fR and other string handling operations will have +undesirable (wrong) results. +.PP +The problem comes when you have, for instance, a string that isn't +flagged as \s-1UTF\-8,\s0 and contains a byte sequence that could be \s-1UTF\-8\s0 \*(-- +especially when combining non\-UTF\-8 and \s-1UTF\-8\s0 strings. +.PP +Never forget that the \f(CW\*(C`SVf_UTF8\*(C'\fR flag is separate from the \s-1PV\s0 value; you +need to be sure you don't accidentally knock it off while you're +manipulating SVs. More specifically, you cannot expect to do this: +.PP +.Vb 4 +\& SV *sv; +\& SV *nsv; +\& STRLEN len; +\& char *p; +\& +\& p = SvPV(sv, len); +\& frobnicate(p); +\& nsv = newSVpvn(p, len); +.Ve +.PP +The \f(CW\*(C`char*\*(C'\fR string does not tell you the whole story, and you can't +copy or reconstruct an \s-1SV\s0 just by copying the string value. Check if the +old \s-1SV\s0 has the \s-1UTF8\s0 flag set (\fIafter\fR the \f(CW\*(C`SvPV\*(C'\fR call), and act +accordingly: +.PP +.Vb 6 +\& p = SvPV(sv, len); +\& is_utf8 = SvUTF8(sv); +\& frobnicate(p, is_utf8); +\& nsv = newSVpvn(p, len); +\& if (is_utf8) +\& SvUTF8_on(nsv); +.Ve +.PP +In the above, your \f(CW\*(C`frobnicate\*(C'\fR function has been changed to be made +aware of whether or not it's dealing with \s-1UTF\-8\s0 data, so that it can +handle the string appropriately. +.PP +Since just passing an \s-1SV\s0 to an \s-1XS\s0 function and copying the data of +the \s-1SV\s0 is not enough to copy the \s-1UTF8\s0 flags, even less right is just +passing a \f(CW\*(C`char\ *\*(C'\fR to an \s-1XS\s0 function. +.PP +For full generality, use the \f(CW\*(C`DO_UTF8\*(C'\fR macro to see if the +string in an \s-1SV\s0 is to be \fItreated\fR as \s-1UTF\-8.\s0 This takes into account +if the call to the \s-1XS\s0 function is being made from within the scope of +\&\f(CW\*(C`use\ bytes\*(C'\fR. If so, the underlying bytes that comprise the +\&\s-1UTF\-8\s0 string are to be exposed, rather than the character they +represent. But this pragma should only really be used for debugging and +perhaps low-level testing at the byte level. Hence most \s-1XS\s0 code need +not concern itself with this, but various areas of the perl core do need +to support it. +.PP +And this isn't the whole story. Starting in Perl v5.12, strings that +aren't encoded in \s-1UTF\-8\s0 may also be treated as Unicode under various +conditions (see \*(L"\s-1ASCII\s0 Rules versus Unicode Rules\*(R" in perlunicode). +This is only really a problem for characters whose ordinals are between +128 and 255, and their behavior varies under \s-1ASCII\s0 versus Unicode rules +in ways that your code cares about (see \*(L"The \*(R"Unicode Bug"" in perlunicode). +There is no published \s-1API\s0 for dealing with this, as it is subject to +change, but you can look at the code for \f(CW\*(C`pp_lc\*(C'\fR in \fIpp.c\fR for an +example as to how it's currently done. +.SS "How do I convert a string to \s-1UTF\-8\s0?" +.IX Subsection "How do I convert a string to UTF-8?" +If you're mixing \s-1UTF\-8\s0 and non\-UTF\-8 strings, it is necessary to upgrade +the non\-UTF\-8 strings to \s-1UTF\-8.\s0 If you've got an \s-1SV,\s0 the easiest way to do +this is: +.PP +.Vb 1 +\& sv_utf8_upgrade(sv); +.Ve +.PP +However, you must not do this, for example: +.PP +.Vb 2 +\& if (!SvUTF8(left)) +\& sv_utf8_upgrade(left); +.Ve +.PP +If you do this in a binary operator, you will actually change one of the +strings that came into the operator, and, while it shouldn't be noticeable +by the end user, it can cause problems in deficient code. +.PP +Instead, \f(CW\*(C`bytes_to_utf8\*(C'\fR will give you a UTF\-8\-encoded \fBcopy\fR of its +string argument. This is useful for having the data available for +comparisons and so on, without harming the original \s-1SV.\s0 There's also +\&\f(CW\*(C`utf8_to_bytes\*(C'\fR to go the other way, but naturally, this will fail if +the string contains any characters above 255 that can't be represented +in a single byte. +.SS "How do I compare strings?" +.IX Subsection "How do I compare strings?" +\&\*(L"sv_cmp\*(R" in perlapi and \*(L"sv_cmp_flags\*(R" in perlapi do a lexigraphic +comparison of two \s-1SV\s0's, and handle UTF\-8ness properly. Note, however, +that Unicode specifies a much fancier mechanism for collation, available +via the Unicode::Collate module. +.PP +To just compare two strings for equality/non\-equality, you can just use +\&\f(CW\*(C`memEQ()\*(C'\fR and \f(CW\*(C`memNE()\*(C'\fR as usual, +except the strings must be both \s-1UTF\-8\s0 or not \s-1UTF\-8\s0 encoded. +.PP +To compare two strings case-insensitively, use +\&\f(CW\*(C`foldEQ_utf8()\*(C'\fR (the strings don't have to have +the same UTF\-8ness). +.SS "Is there anything else I need to know?" +.IX Subsection "Is there anything else I need to know?" +Not really. Just remember these things: +.IP "\(bu" 3 +There's no way to tell if a \f(CW\*(C`char\ *\*(C'\fR or \f(CW\*(C`U8\ *\*(C'\fR string is \s-1UTF\-8\s0 +or not. But you can tell if an \s-1SV\s0 is to be treated as \s-1UTF\-8\s0 by calling +\&\f(CW\*(C`DO_UTF8\*(C'\fR on it, after stringifying it with \f(CW\*(C`SvPV\*(C'\fR or a similar +macro. And, you can tell if \s-1SV\s0 is actually \s-1UTF\-8\s0 (even if it is not to +be treated as such) by looking at its \f(CW\*(C`SvUTF8\*(C'\fR flag (again after +stringifying it). Don't forget to set the flag if something should be +\&\s-1UTF\-8.\s0 +Treat the flag as part of the \s-1PV,\s0 even though it's not \*(-- if you pass on +the \s-1PV\s0 to somewhere, pass on the flag too. +.IP "\(bu" 3 +If a string is \s-1UTF\-8,\s0 \fBalways\fR use \f(CW\*(C`utf8_to_uvchr_buf\*(C'\fR to get at the value, +unless \f(CW\*(C`UTF8_IS_INVARIANT(*s)\*(C'\fR in which case you can use \f(CW*s\fR. +.IP "\(bu" 3 +When writing a character \s-1UV\s0 to a \s-1UTF\-8\s0 string, \fBalways\fR use +\&\f(CW\*(C`uvchr_to_utf8\*(C'\fR, unless \f(CW\*(C`UVCHR_IS_INVARIANT(uv))\*(C'\fR in which case +you can use \f(CW\*(C`*s = uv\*(C'\fR. +.IP "\(bu" 3 +Mixing \s-1UTF\-8\s0 and non\-UTF\-8 strings is +tricky. Use \f(CW\*(C`bytes_to_utf8\*(C'\fR to get +a new string which is \s-1UTF\-8\s0 encoded, and then combine them. +.SH "Custom Operators" +.IX Header "Custom Operators" +Custom operator support is an experimental feature that allows you to +define your own ops. This is primarily to allow the building of +interpreters for other languages in the Perl core, but it also allows +optimizations through the creation of \*(L"macro-ops\*(R" (ops which perform the +functions of multiple ops which are usually executed together, such as +\&\f(CW\*(C`gvsv, gvsv, add\*(C'\fR.) +.PP +This feature is implemented as a new op type, \f(CW\*(C`OP_CUSTOM\*(C'\fR. The Perl +core does not \*(L"know\*(R" anything special about this op type, and so it will +not be involved in any optimizations. This also means that you can +define your custom ops to be any op structure \*(-- unary, binary, list and +so on \*(-- you like. +.PP +It's important to know what custom operators won't do for you. They +won't let you add new syntax to Perl, directly. They won't even let you +add new keywords, directly. In fact, they won't change the way Perl +compiles a program at all. You have to do those changes yourself, after +Perl has compiled the program. You do this either by manipulating the op +tree using a \f(CW\*(C`CHECK\*(C'\fR block and the \f(CW\*(C`B::Generate\*(C'\fR module, or by adding +a custom peephole optimizer with the \f(CW\*(C`optimize\*(C'\fR module. +.PP +When you do this, you replace ordinary Perl ops with custom ops by +creating ops with the type \f(CW\*(C`OP_CUSTOM\*(C'\fR and the \f(CW\*(C`op_ppaddr\*(C'\fR of your own +\&\s-1PP\s0 function. This should be defined in \s-1XS\s0 code, and should look like +the \s-1PP\s0 ops in \f(CW\*(C`pp_*.c\*(C'\fR. You are responsible for ensuring that your op +takes the appropriate number of values from the stack, and you are +responsible for adding stack marks if necessary. +.PP +You should also \*(L"register\*(R" your op with the Perl interpreter so that it +can produce sensible error and warning messages. Since it is possible to +have multiple custom ops within the one \*(L"logical\*(R" op type \f(CW\*(C`OP_CUSTOM\*(C'\fR, +Perl uses the value of \f(CW\*(C`o\->op_ppaddr\*(C'\fR to determine which custom op +it is dealing with. You should create an \f(CW\*(C`XOP\*(C'\fR structure for each +ppaddr you use, set the properties of the custom op with +\&\f(CW\*(C`XopENTRY_set\*(C'\fR, and register the structure against the ppaddr using +\&\f(CW\*(C`Perl_custom_op_register\*(C'\fR. A trivial example might look like: +.PP +.Vb 2 +\& static XOP my_xop; +\& static OP *my_pp(pTHX); +\& +\& BOOT: +\& XopENTRY_set(&my_xop, xop_name, "myxop"); +\& XopENTRY_set(&my_xop, xop_desc, "Useless custom op"); +\& Perl_custom_op_register(aTHX_ my_pp, &my_xop); +.Ve +.PP +The available fields in the structure are: +.IP "xop_name" 4 +.IX Item "xop_name" +A short name for your op. This will be included in some error messages, +and will also be returned as \f(CW\*(C`$op\->name\*(C'\fR by the B module, so +it will appear in the output of module like B::Concise. +.IP "xop_desc" 4 +.IX Item "xop_desc" +A short description of the function of the op. +.IP "xop_class" 4 +.IX Item "xop_class" +Which of the various \f(CW*OP\fR structures this op uses. This should be one of +the \f(CW\*(C`OA_*\*(C'\fR constants from \fIop.h\fR, namely +.RS 4 +.IP "\s-1OA_BASEOP\s0" 4 +.IX Item "OA_BASEOP" +.PD 0 +.IP "\s-1OA_UNOP\s0" 4 +.IX Item "OA_UNOP" +.IP "\s-1OA_BINOP\s0" 4 +.IX Item "OA_BINOP" +.IP "\s-1OA_LOGOP\s0" 4 +.IX Item "OA_LOGOP" +.IP "\s-1OA_LISTOP\s0" 4 +.IX Item "OA_LISTOP" +.IP "\s-1OA_PMOP\s0" 4 +.IX Item "OA_PMOP" +.IP "\s-1OA_SVOP\s0" 4 +.IX Item "OA_SVOP" +.IP "\s-1OA_PADOP\s0" 4 +.IX Item "OA_PADOP" +.IP "\s-1OA_PVOP_OR_SVOP\s0" 4 +.IX Item "OA_PVOP_OR_SVOP" +.PD +This should be interpreted as '\f(CW\*(C`PVOP\*(C'\fR' only. The \f(CW\*(C`_OR_SVOP\*(C'\fR is because +the only core \f(CW\*(C`PVOP\*(C'\fR, \f(CW\*(C`OP_TRANS\*(C'\fR, can sometimes be a \f(CW\*(C`SVOP\*(C'\fR instead. +.IP "\s-1OA_LOOP\s0" 4 +.IX Item "OA_LOOP" +.PD 0 +.IP "\s-1OA_COP\s0" 4 +.IX Item "OA_COP" +.RE +.RS 4 +.PD +.Sp +The other \f(CW\*(C`OA_*\*(C'\fR constants should not be used. +.RE +.IP "xop_peep" 4 +.IX Item "xop_peep" +This member is of type \f(CW\*(C`Perl_cpeep_t\*(C'\fR, which expands to \f(CW\*(C`void +(*Perl_cpeep_t)(aTHX_ OP *o, OP *oldop)\*(C'\fR. If it is set, this function +will be called from \f(CW\*(C`Perl_rpeep\*(C'\fR when ops of this type are encountered +by the peephole optimizer. \fIo\fR is the \s-1OP\s0 that needs optimizing; +\&\fIoldop\fR is the previous \s-1OP\s0 optimized, whose \f(CW\*(C`op_next\*(C'\fR points to \fIo\fR. +.PP +\&\f(CW\*(C`B::Generate\*(C'\fR directly supports the creation of custom ops by name. +.SH "Stacks" +.IX Header "Stacks" +Descriptions above occasionally refer to \*(L"the stack\*(R", but there are in fact +many stack-like data structures within the perl interpreter. When otherwise +unqualified, \*(L"the stack\*(R" usually refers to the value stack. +.PP +The various stacks have different purposes, and operate in slightly different +ways. Their differences are noted below. +.SS "Value Stack" +.IX Subsection "Value Stack" +This stack stores the values that regular perl code is operating on, usually +intermediate values of expressions within a statement. The stack itself is +formed of an array of \s-1SV\s0 pointers. +.PP +The base of this stack is pointed to by the interpreter variable +\&\f(CW\*(C`PL_stack_base\*(C'\fR, of type \f(CW\*(C`SV **\*(C'\fR. +.PP +The head of the stack is \f(CW\*(C`PL_stack_sp\*(C'\fR, and points to the most +recently-pushed item. +.PP +Items are pushed to the stack by using the \f(CW\*(C`PUSHs()\*(C'\fR macro or its variants +described above; \f(CW\*(C`XPUSHs()\*(C'\fR, \f(CW\*(C`mPUSHs()\*(C'\fR, \f(CW\*(C`mXPUSHs()\*(C'\fR and the typed +versions. Note carefully that the non\-\f(CW\*(C`X\*(C'\fR versions of these macros do not +check the size of the stack and assume it to be big enough. These must be +paired with a suitable check of the stack's size, such as the \f(CW\*(C`EXTEND\*(C'\fR macro +to ensure it is large enough. For example +.PP +.Vb 5 +\& EXTEND(SP, 4); +\& mPUSHi(10); +\& mPUSHi(20); +\& mPUSHi(30); +\& mPUSHi(40); +.Ve +.PP +This is slightly more performant than making four separate checks in four +separate \f(CW\*(C`mXPUSHi()\*(C'\fR calls. +.PP +As a further performance optimisation, the various \f(CW\*(C`PUSH\*(C'\fR macros all operate +using a local variable \f(CW\*(C`SP\*(C'\fR, rather than the interpreter-global variable +\&\f(CW\*(C`PL_stack_sp\*(C'\fR. This variable is declared by the \f(CW\*(C`dSP\*(C'\fR macro \- though it is +normally implied by XSUBs and similar so it is rare you have to consider it +directly. Once declared, the \f(CW\*(C`PUSH\*(C'\fR macros will operate only on this local +variable, so before invoking any other perl core functions you must use the +\&\f(CW\*(C`PUTBACK\*(C'\fR macro to return the value from the local \f(CW\*(C`SP\*(C'\fR variable back to +the interpreter variable. Similarly, after calling a perl core function which +may have had reason to move the stack or push/pop values to it, you must use +the \f(CW\*(C`SPAGAIN\*(C'\fR macro which refreshes the local \f(CW\*(C`SP\*(C'\fR value back from the +interpreter one. +.PP +Items are popped from the stack by using the \f(CW\*(C`POPs\*(C'\fR macro or its typed +versions, There is also a macro \f(CW\*(C`TOPs\*(C'\fR that inspects the topmost item without +removing it. +.PP +Note specifically that \s-1SV\s0 pointers on the value stack do not contribute to the +overall reference count of the xVs being referred to. If newly-created xVs are +being pushed to the stack you must arrange for them to be destroyed at a +suitable time; usually by using one of the \f(CW\*(C`mPUSH*\*(C'\fR macros or \f(CW\*(C`sv_2mortal()\*(C'\fR +to mortalise the xV. +.SS "Mark Stack" +.IX Subsection "Mark Stack" +The value stack stores individual perl scalar values as temporaries between +expressions. Some perl expressions operate on entire lists; for that purpose +we need to know where on the stack each list begins. This is the purpose of the +mark stack. +.PP +The mark stack stores integers as I32 values, which are the height of the +value stack at the time before the list began; thus the mark itself actually +points to the value stack entry one before the list. The list itself starts at +\&\f(CW\*(C`mark + 1\*(C'\fR. +.PP +The base of this stack is pointed to by the interpreter variable +\&\f(CW\*(C`PL_markstack\*(C'\fR, of type \f(CW\*(C`I32 *\*(C'\fR. +.PP +The head of the stack is \f(CW\*(C`PL_markstack_ptr\*(C'\fR, and points to the most +recently-pushed item. +.PP +Items are pushed to the stack by using the \f(CW\*(C`PUSHMARK()\*(C'\fR macro. Even though +the stack itself stores (value) stack indices as integers, the \f(CW\*(C`PUSHMARK\*(C'\fR +macro should be given a stack pointer directly; it will calculate the index +offset by comparing to the \f(CW\*(C`PL_stack_sp\*(C'\fR variable. Thus almost always the +code to perform this is +.PP +.Vb 1 +\& PUSHMARK(SP); +.Ve +.PP +Items are popped from the stack by the \f(CW\*(C`POPMARK\*(C'\fR macro. There is also a macro +\&\f(CW\*(C`TOPMARK\*(C'\fR that inspects the topmost item without removing it. These macros +return I32 index values directly. There is also the \f(CW\*(C`dMARK\*(C'\fR macro which +declares a new \s-1SV\s0 double-pointer variable, called \f(CW\*(C`mark\*(C'\fR, which points at the +marked stack slot; this is the usual macro that C code will use when operating +on lists given on the stack. +.PP +As noted above, the \f(CW\*(C`mark\*(C'\fR variable itself will point at the most recently +pushed value on the value stack before the list begins, and so the list itself +starts at \f(CW\*(C`mark + 1\*(C'\fR. The values of the list may be iterated by code such as +.PP +.Vb 4 +\& for(SV **svp = mark + 1; svp <= PL_stack_sp; svp++) { +\& SV *item = *svp; +\& ... +\& } +.Ve +.PP +Note specifically in the case that the list is already empty, \f(CW\*(C`mark\*(C'\fR will +equal \f(CW\*(C`PL_stack_sp\*(C'\fR. +.PP +Because the \f(CW\*(C`mark\*(C'\fR variable is converted to a pointer on the value stack, +extra care must be taken if \f(CW\*(C`EXTEND\*(C'\fR or any of the \f(CW\*(C`XPUSH\*(C'\fR macros are +invoked within the function, because the stack may need to be moved to +extend it and so the existing pointer will now be invalid. If this may be a +problem, a possible solution is to track the mark offset as an integer and +track the mark itself later on after the stack had been moved. +.PP +.Vb 1 +\& I32 markoff = POPMARK; +\& +\& ... +\& +\& SP **mark = PL_stack_base + markoff; +.Ve +.SS "Temporaries Stack" +.IX Subsection "Temporaries Stack" +As noted above, xV references on the main value stack do not contribute to the +reference count of an xV, and so another mechanism is used to track when +temporary values which live on the stack must be released. This is the job of +the temporaries stack. +.PP +The temporaries stack stores pointers to xVs whose reference counts will be +decremented soon. +.PP +The base of this stack is pointed to by the interpreter variable +\&\f(CW\*(C`PL_tmps_stack\*(C'\fR, of type \f(CW\*(C`SV **\*(C'\fR. +.PP +The head of the stack is indexed by \f(CW\*(C`PL_tmps_ix\*(C'\fR, an integer which stores the +index in the array of the most recently-pushed item. +.PP +There is no public \s-1API\s0 to directly push items to the temporaries stack. Instead, +the \s-1API\s0 function \f(CW\*(C`sv_2mortal()\*(C'\fR is used to mortalize an xV, adding its +address to the temporaries stack. +.PP +Likewise, there is no public \s-1API\s0 to read values from the temporaries stack. +Instead. the macros \f(CW\*(C`SAVETMPS\*(C'\fR and \f(CW\*(C`FREETPMS\*(C'\fR are used. The \f(CW\*(C`SAVETMPS\*(C'\fR +macro establishes the base levels of the temporaries stack, by capturing the +current value of \f(CW\*(C`PL_tmps_ix\*(C'\fR into \f(CW\*(C`PL_tmps_floor\*(C'\fR and saving the previous +value to the save stack. Thereafter, whenever \f(CW\*(C`FREETMPS\*(C'\fR is invoked all of +the temporaries that have been pushed since that level are reclaimed. +.PP +While it is common to see these two macros in pairs within an \f(CW\*(C`ENTER\*(C'\fR/ +\&\f(CW\*(C`LEAVE\*(C'\fR pair, it is not necessary to match them. It is permitted to invoke +\&\f(CW\*(C`FREETMPS\*(C'\fR multiple times since the most recent \f(CW\*(C`SAVETMPS\*(C'\fR; for example in a +loop iterating over elements of a list. While you can invoke \f(CW\*(C`SAVETMPS\*(C'\fR +multiple times within a scope pair, it is unlikely to be useful. Subsequent +invocations will move the temporaries floor further up, thus effectively +trapping the existing temporaries to only be released at the end of the scope. +.SS "Save Stack" +.IX Subsection "Save Stack" +The save stack is used by perl to implement the \f(CW\*(C`local\*(C'\fR keyword and other +similar behaviours; any cleanup operations that need to be performed when +leaving the current scope. Items pushed to this stack generally capture the +current value of some internal variable or state, which will be restored when +the scope is unwound due to leaving, \f(CW\*(C`return\*(C'\fR, \f(CW\*(C`die\*(C'\fR, \f(CW\*(C`goto\*(C'\fR or other +reasons. +.PP +Whereas other perl internal stacks store individual items all of the same type +(usually \s-1SV\s0 pointers or integers), the items pushed to the save stack are +formed of many different types, having multiple fields to them. For example, +the \f(CW\*(C`SAVEt_INT\*(C'\fR type needs to store both the address of the \f(CW\*(C`int\*(C'\fR variable +to restore, and the value to restore it to. This information could have been +stored using fields of a \f(CW\*(C`struct\*(C'\fR, but would have to be large enough to store +three pointers in the largest case, which would waste a lot of space in most +of the smaller cases. +.PP +Instead, the stack stores information in a variable-length encoding of \f(CW\*(C`ANY\*(C'\fR +structures. The final value pushed is stored in the \f(CW\*(C`UV\*(C'\fR field which encodes +the kind of item held by the preceeding items; the count and types of which +will depend on what kind of item is being stored. The kind field is pushed +last because that will be the first field to be popped when unwinding items +from the stack. +.PP +The base of this stack is pointed to by the interpreter variable +\&\f(CW\*(C`PL_savestack\*(C'\fR, of type \f(CW\*(C`ANY *\*(C'\fR. +.PP +The head of the stack is indexed by \f(CW\*(C`PL_savestack_ix\*(C'\fR, an integer which +stores the index in the array at which the next item should be pushed. (Note +that this is different to most other stacks, which reference the most +recently-pushed item). +.PP +Items are pushed to the save stack by using the various \f(CW\*(C`SAVE...()\*(C'\fR macros. +Many of these macros take a variable and store both its address and current +value on the save stack, ensuring that value gets restored on scope exit. +.PP +.Vb 5 +\& SAVEI8(i8) +\& SAVEI16(i16) +\& SAVEI32(i32) +\& SAVEINT(i) +\& ... +.Ve +.PP +There are also a variety of other special-purpose macros which save particular +types or values of interest. \f(CW\*(C`SAVETMPS\*(C'\fR has already been mentioned above. +Others include \f(CW\*(C`SAVEFREEPV\*(C'\fR which arranges for a \s-1PV\s0 (i.e. a string buffer) to +be freed, or \f(CW\*(C`SAVEDESTRUCTOR\*(C'\fR which arranges for a given function pointer to +be invoked on scope exit. A full list of such macros can be found in +\&\fIscope.h\fR. +.PP +There is no public \s-1API\s0 for popping individual values or items from the save +stack. Instead, via the scope stack, the \f(CW\*(C`ENTER\*(C'\fR and \f(CW\*(C`LEAVE\*(C'\fR pair form a way +to start and stop nested scopes. Leaving a nested scope via \f(CW\*(C`LEAVE\*(C'\fR will +restore all of the saved values that had been pushed since the most recent +\&\f(CW\*(C`ENTER\*(C'\fR. +.SS "Scope Stack" +.IX Subsection "Scope Stack" +As with the mark stack to the value stack, the scope stack forms a pair with +the save stack. The scope stack stores the height of the save stack at which +nested scopes begin, and allows the save stack to be unwound back to that +point when the scope is left. +.PP +When perl is built with debugging enabled, there is a second part to this +stack storing human-readable string names describing the type of stack +context. Each push operation saves the name as well as the height of the save +stack, and each pop operation checks the topmost name with what is expected, +causing an assertion failure if the name does not match. +.PP +The base of this stack is pointed to by the interpreter variable +\&\f(CW\*(C`PL_scopestack\*(C'\fR, of type \f(CW\*(C`I32 *\*(C'\fR. If enabled, the scope stack names are +stored in a separate array pointed to by \f(CW\*(C`PL_scopestack_name\*(C'\fR, of type +\&\f(CW\*(C`const char **\*(C'\fR. +.PP +The head of the stack is indexed by \f(CW\*(C`PL_scopestack_ix\*(C'\fR, an integer which +stores the index of the array or arrays at which the next item should be +pushed. (Note that this is different to most other stacks, which reference the +most recently-pushed item). +.PP +Values are pushed to the scope stack using the \f(CW\*(C`ENTER\*(C'\fR macro, which begins a +new nested scope. Any items pushed to the save stack are then restored at the +next nested invocation of the \f(CW\*(C`LEAVE\*(C'\fR macro. +.SH "Dynamic Scope and the Context Stack" +.IX Header "Dynamic Scope and the Context Stack" +\&\fBNote:\fR this section describes a non-public internal \s-1API\s0 that is subject +to change without notice. +.SS "Introduction to the context stack" +.IX Subsection "Introduction to the context stack" +In Perl, dynamic scoping refers to the runtime nesting of things like +subroutine calls, evals etc, as well as the entering and exiting of block +scopes. For example, the restoring of a \f(CW\*(C`local\*(C'\fRised variable is +determined by the dynamic scope. +.PP +Perl tracks the dynamic scope by a data structure called the context +stack, which is an array of \f(CW\*(C`PERL_CONTEXT\*(C'\fR structures, and which is +itself a big union for all the types of context. Whenever a new scope is +entered (such as a block, a \f(CW\*(C`for\*(C'\fR loop, or a subroutine call), a new +context entry is pushed onto the stack. Similarly when leaving a block or +returning from a subroutine call etc. a context is popped. Since the +context stack represents the current dynamic scope, it can be searched. +For example, \f(CW\*(C`next LABEL\*(C'\fR searches back through the stack looking for a +loop context that matches the label; \f(CW\*(C`return\*(C'\fR pops contexts until it +finds a sub or eval context or similar; \f(CW\*(C`caller\*(C'\fR examines sub contexts on +the stack. +.PP +Each context entry is labelled with a context type, \f(CW\*(C`cx_type\*(C'\fR. Typical +context types are \f(CW\*(C`CXt_SUB\*(C'\fR, \f(CW\*(C`CXt_EVAL\*(C'\fR etc., as well as \f(CW\*(C`CXt_BLOCK\*(C'\fR +and \f(CW\*(C`CXt_NULL\*(C'\fR which represent a basic scope (as pushed by \f(CW\*(C`pp_enter\*(C'\fR) +and a sort block. The type determines which part of the context union are +valid. +.PP +The main division in the context struct is between a substitution scope +(\f(CW\*(C`CXt_SUBST\*(C'\fR) and block scopes, which are everything else. The former is +just used while executing \f(CW\*(C`s///e\*(C'\fR, and won't be discussed further +here. +.PP +All the block scope types share a common base, which corresponds to +\&\f(CW\*(C`CXt_BLOCK\*(C'\fR. This stores the old values of various scope-related +variables like \f(CW\*(C`PL_curpm\*(C'\fR, as well as information about the current +scope, such as \f(CW\*(C`gimme\*(C'\fR. On scope exit, the old variables are restored. +.PP +Particular block scope types store extra per-type information. For +example, \f(CW\*(C`CXt_SUB\*(C'\fR stores the currently executing \s-1CV,\s0 while the various +for loop types might hold the original loop variable \s-1SV.\s0 On scope exit, +the per-type data is processed; for example the \s-1CV\s0 has its reference count +decremented, and the original loop variable is restored. +.PP +The macro \f(CW\*(C`cxstack\*(C'\fR returns the base of the current context stack, while +\&\f(CW\*(C`cxstack_ix\*(C'\fR is the index of the current frame within that stack. +.PP +In fact, the context stack is actually part of a stack-of-stacks system; +whenever something unusual is done such as calling a \f(CW\*(C`DESTROY\*(C'\fR or tie +handler, a new stack is pushed, then popped at the end. +.PP +Note that the \s-1API\s0 described here changed considerably in perl 5.24; prior +to that, big macros like \f(CW\*(C`PUSHBLOCK\*(C'\fR and \f(CW\*(C`POPSUB\*(C'\fR were used; in 5.24 +they were replaced by the inline static functions described below. In +addition, the ordering and detail of how these macros/function work +changed in many ways, often subtly. In particular they didn't handle +saving the savestack and temps stack positions, and required additional +\&\f(CW\*(C`ENTER\*(C'\fR, \f(CW\*(C`SAVETMPS\*(C'\fR and \f(CW\*(C`LEAVE\*(C'\fR compared to the new functions. The +old-style macros will not be described further. +.SS "Pushing contexts" +.IX Subsection "Pushing contexts" +For pushing a new context, the two basic functions are +\&\f(CW\*(C`cx = cx_pushblock()\*(C'\fR, which pushes a new basic context block and returns +its address, and a family of similar functions with names like +\&\f(CW\*(C`cx_pushsub(cx)\*(C'\fR which populate the additional type-dependent fields in +the \f(CW\*(C`cx\*(C'\fR struct. Note that \f(CW\*(C`CXt_NULL\*(C'\fR and \f(CW\*(C`CXt_BLOCK\*(C'\fR don't have their +own push functions, as they don't store any data beyond that pushed by +\&\f(CW\*(C`cx_pushblock\*(C'\fR. +.PP +The fields of the context struct and the arguments to the \f(CW\*(C`cx_*\*(C'\fR +functions are subject to change between perl releases, representing +whatever is convenient or efficient for that release. +.PP +A typical context stack pushing can be found in \f(CW\*(C`pp_entersub\*(C'\fR; the +following shows a simplified and stripped-down example of a non-XS call, +along with comments showing roughly what each function does. +.PP +.Vb 6 +\& dMARK; +\& U8 gimme = GIMME_V; +\& bool hasargs = cBOOL(PL_op\->op_flags & OPf_STACKED); +\& OP *retop = PL_op\->op_next; +\& I32 old_ss_ix = PL_savestack_ix; +\& CV *cv = ....; +\& +\& /* ... make mortal copies of stack args which are PADTMPs here ... */ +\& +\& /* ... do any additional savestack pushes here ... */ +\& +\& /* Now push a new context entry of type \*(AqCXt_SUB\*(Aq; initially just +\& * doing the actions common to all block types: */ +\& +\& cx = cx_pushblock(CXt_SUB, gimme, MARK, old_ss_ix); +\& +\& /* this does (approximately): +\& CXINC; /* cxstack_ix++ (grow if necessary) */ +\& cx = CX_CUR(); /* and get the address of new frame */ +\& cx\->cx_type = CXt_SUB; +\& cx\->blk_gimme = gimme; +\& cx\->blk_oldsp = MARK \- PL_stack_base; +\& cx\->blk_oldsaveix = old_ss_ix; +\& cx\->blk_oldcop = PL_curcop; +\& cx\->blk_oldmarksp = PL_markstack_ptr \- PL_markstack; +\& cx\->blk_oldscopesp = PL_scopestack_ix; +\& cx\->blk_oldpm = PL_curpm; +\& cx\->blk_old_tmpsfloor = PL_tmps_floor; +\& +\& PL_tmps_floor = PL_tmps_ix; +\& */ +\& +\& +\& /* then update the new context frame with subroutine\-specific info, +\& * such as the CV about to be executed: */ +\& +\& cx_pushsub(cx, cv, retop, hasargs); +\& +\& /* this does (approximately): +\& cx\->blk_sub.cv = cv; +\& cx\->blk_sub.olddepth = CvDEPTH(cv); +\& cx\->blk_sub.prevcomppad = PL_comppad; +\& cx\->cx_type |= (hasargs) ? CXp_HASARGS : 0; +\& cx\->blk_sub.retop = retop; +\& SvREFCNT_inc_simple_void_NN(cv); +\& */ +.Ve +.PP +Note that \f(CW\*(C`cx_pushblock()\*(C'\fR sets two new floors: for the args stack (to +\&\f(CW\*(C`MARK\*(C'\fR) and the temps stack (to \f(CW\*(C`PL_tmps_ix\*(C'\fR). While executing at this +scope level, every \f(CW\*(C`nextstate\*(C'\fR (amongst others) will reset the args and +tmps stack levels to these floors. Note that since \f(CW\*(C`cx_pushblock\*(C'\fR uses +the current value of \f(CW\*(C`PL_tmps_ix\*(C'\fR rather than it being passed as an arg, +this dictates at what point \f(CW\*(C`cx_pushblock\*(C'\fR should be called. In +particular, any new mortals which should be freed only on scope exit +(rather than at the next \f(CW\*(C`nextstate\*(C'\fR) should be created first. +.PP +Most callers of \f(CW\*(C`cx_pushblock\*(C'\fR simply set the new args stack floor to the +top of the previous stack frame, but for \f(CW\*(C`CXt_LOOP_LIST\*(C'\fR it stores the +items being iterated over on the stack, and so sets \f(CW\*(C`blk_oldsp\*(C'\fR to the +top of these items instead. Note that, contrary to its name, \f(CW\*(C`blk_oldsp\*(C'\fR +doesn't always represent the value to restore \f(CW\*(C`PL_stack_sp\*(C'\fR to on scope +exit. +.PP +Note the early capture of \f(CW\*(C`PL_savestack_ix\*(C'\fR to \f(CW\*(C`old_ss_ix\*(C'\fR, which is +later passed as an arg to \f(CW\*(C`cx_pushblock\*(C'\fR. In the case of \f(CW\*(C`pp_entersub\*(C'\fR, +this is because, although most values needing saving are stored in fields +of the context struct, an extra value needs saving only when the debugger +is running, and it doesn't make sense to bloat the struct for this rare +case. So instead it is saved on the savestack. Since this value gets +calculated and saved before the context is pushed, it is necessary to pass +the old value of \f(CW\*(C`PL_savestack_ix\*(C'\fR to \f(CW\*(C`cx_pushblock\*(C'\fR, to ensure that the +saved value gets freed during scope exit. For most users of +\&\f(CW\*(C`cx_pushblock\*(C'\fR, where nothing needs pushing on the save stack, +\&\f(CW\*(C`PL_savestack_ix\*(C'\fR is just passed directly as an arg to \f(CW\*(C`cx_pushblock\*(C'\fR. +.PP +Note that where possible, values should be saved in the context struct +rather than on the save stack; it's much faster that way. +.PP +Normally \f(CW\*(C`cx_pushblock\*(C'\fR should be immediately followed by the appropriate +\&\f(CW\*(C`cx_pushfoo\*(C'\fR, with nothing between them; this is because if code +in-between could die (e.g. a warning upgraded to fatal), then the context +stack unwinding code in \f(CW\*(C`dounwind\*(C'\fR would see (in the example above) a +\&\f(CW\*(C`CXt_SUB\*(C'\fR context frame, but without all the subroutine-specific fields +set, and crashes would soon ensue. +.PP +Where the two must be separate, initially set the type to \f(CW\*(C`CXt_NULL\*(C'\fR or +\&\f(CW\*(C`CXt_BLOCK\*(C'\fR, and later change it to \f(CW\*(C`CXt_foo\*(C'\fR when doing the +\&\f(CW\*(C`cx_pushfoo\*(C'\fR. This is exactly what \f(CW\*(C`pp_enteriter\*(C'\fR does, once it's +determined which type of loop it's pushing. +.SS "Popping contexts" +.IX Subsection "Popping contexts" +Contexts are popped using \f(CW\*(C`cx_popsub()\*(C'\fR etc. and \f(CW\*(C`cx_popblock()\*(C'\fR. Note +however, that unlike \f(CW\*(C`cx_pushblock\*(C'\fR, neither of these functions actually +decrement the current context stack index; this is done separately using +\&\f(CW\*(C`CX_POP()\*(C'\fR. +.PP +There are two main ways that contexts are popped. During normal execution +as scopes are exited, functions like \f(CW\*(C`pp_leave\*(C'\fR, \f(CW\*(C`pp_leaveloop\*(C'\fR and +\&\f(CW\*(C`pp_leavesub\*(C'\fR process and pop just one context using \f(CW\*(C`cx_popfoo\*(C'\fR and +\&\f(CW\*(C`cx_popblock\*(C'\fR. On the other hand, things like \f(CW\*(C`pp_return\*(C'\fR and \f(CW\*(C`next\*(C'\fR +may have to pop back several scopes until a sub or loop context is found, +and exceptions (such as \f(CW\*(C`die\*(C'\fR) need to pop back contexts until an eval +context is found. Both of these are accomplished by \f(CW\*(C`dounwind()\*(C'\fR, which +is capable of processing and popping all contexts above the target one. +.PP +Here is a typical example of context popping, as found in \f(CW\*(C`pp_leavesub\*(C'\fR +(simplified slightly): +.PP +.Vb 4 +\& U8 gimme; +\& PERL_CONTEXT *cx; +\& SV **oldsp; +\& OP *retop; +\& +\& cx = CX_CUR(); +\& +\& gimme = cx\->blk_gimme; +\& oldsp = PL_stack_base + cx\->blk_oldsp; /* last arg of previous frame */ +\& +\& if (gimme == G_VOID) +\& PL_stack_sp = oldsp; +\& else +\& leave_adjust_stacks(oldsp, oldsp, gimme, 0); +\& +\& CX_LEAVE_SCOPE(cx); +\& cx_popsub(cx); +\& cx_popblock(cx); +\& retop = cx\->blk_sub.retop; +\& CX_POP(cx); +\& +\& return retop; +.Ve +.PP +The steps above are in a very specific order, designed to be the reverse +order of when the context was pushed. The first thing to do is to copy +and/or protect any return arguments and free any temps in the current +scope. Scope exits like an rvalue sub normally return a mortal copy of +their return args (as opposed to lvalue subs). It is important to make +this copy before the save stack is popped or variables are restored, or +bad things like the following can happen: +.PP +.Vb 2 +\& sub f { my $x =...; $x } # $x freed before we get to copy it +\& sub f { /(...)/; $1 } # PL_curpm restored before $1 copied +.Ve +.PP +Although we wish to free any temps at the same time, we have to be careful +not to free any temps which are keeping return args alive; nor to free the +temps we have just created while mortal copying return args. Fortunately, +\&\f(CW\*(C`leave_adjust_stacks()\*(C'\fR is capable of making mortal copies of return args, +shifting args down the stack, and only processing those entries on the +temps stack that are safe to do so. +.PP +In void context no args are returned, so it's more efficient to skip +calling \f(CW\*(C`leave_adjust_stacks()\*(C'\fR. Also in void context, a \f(CW\*(C`nextstate\*(C'\fR op +is likely to be imminently called which will do a \f(CW\*(C`FREETMPS\*(C'\fR, so there's +no need to do that either. +.PP +The next step is to pop savestack entries: \f(CW\*(C`CX_LEAVE_SCOPE(cx)\*(C'\fR is just +defined as \f(CW\*(C`LEAVE_SCOPE(cx\->blk_oldsaveix)\*(C'\fR. Note that during the +popping, it's possible for perl to call destructors, call \f(CW\*(C`STORE\*(C'\fR to undo +localisations of tied vars, and so on. Any of these can die or call +\&\f(CW\*(C`exit()\*(C'\fR. In this case, \f(CW\*(C`dounwind()\*(C'\fR will be called, and the current +context stack frame will be re-processed. Thus it is vital that all steps +in popping a context are done in such a way to support reentrancy. The +other alternative, of decrementing \f(CW\*(C`cxstack_ix\*(C'\fR \fIbefore\fR processing the +frame, would lead to leaks and the like if something died halfway through, +or overwriting of the current frame. +.PP +\&\f(CW\*(C`CX_LEAVE_SCOPE\*(C'\fR itself is safely re-entrant: if only half the savestack +items have been popped before dying and getting trapped by eval, then the +\&\f(CW\*(C`CX_LEAVE_SCOPE\*(C'\fRs in \f(CW\*(C`dounwind\*(C'\fR or \f(CW\*(C`pp_leaveeval\*(C'\fR will continue where +the first one left off. +.PP +The next step is the type-specific context processing; in this case +\&\f(CW\*(C`cx_popsub\*(C'\fR. In part, this looks like: +.PP +.Vb 4 +\& cv = cx\->blk_sub.cv; +\& CvDEPTH(cv) = cx\->blk_sub.olddepth; +\& cx\->blk_sub.cv = NULL; +\& SvREFCNT_dec(cv); +.Ve +.PP +where its processing the just-executed \s-1CV.\s0 Note that before it decrements +the \s-1CV\s0's reference count, it nulls the \f(CW\*(C`blk_sub.cv\*(C'\fR. This means that if +it re-enters, the \s-1CV\s0 won't be freed twice. It also means that you can't +rely on such type-specific fields having useful values after the return +from \f(CW\*(C`cx_popfoo\*(C'\fR. +.PP +Next, \f(CW\*(C`cx_popblock\*(C'\fR restores all the various interpreter vars to their +previous values or previous high water marks; it expands to: +.PP +.Vb 5 +\& PL_markstack_ptr = PL_markstack + cx\->blk_oldmarksp; +\& PL_scopestack_ix = cx\->blk_oldscopesp; +\& PL_curpm = cx\->blk_oldpm; +\& PL_curcop = cx\->blk_oldcop; +\& PL_tmps_floor = cx\->blk_old_tmpsfloor; +.Ve +.PP +Note that it \fIdoesn't\fR restore \f(CW\*(C`PL_stack_sp\*(C'\fR; as mentioned earlier, +which value to restore it to depends on the context type (specifically +\&\f(CW\*(C`for (list) {}\*(C'\fR), and what args (if any) it returns; and that will +already have been sorted out earlier by \f(CW\*(C`leave_adjust_stacks()\*(C'\fR. +.PP +Finally, the context stack pointer is actually decremented by \f(CW\*(C`CX_POP(cx)\*(C'\fR. +After this point, it's possible that that the current context frame could +be overwritten by other contexts being pushed. Although things like ties +and \f(CW\*(C`DESTROY\*(C'\fR are supposed to work within a new context stack, it's best +not to assume this. Indeed on debugging builds, \f(CW\*(C`CX_POP(cx)\*(C'\fR deliberately +sets \f(CW\*(C`cx\*(C'\fR to null to detect code that is still relying on the field +values in that context frame. Note in the \f(CW\*(C`pp_leavesub()\*(C'\fR example above, +we grab \f(CW\*(C`blk_sub.retop\*(C'\fR \fIbefore\fR calling \f(CW\*(C`CX_POP\*(C'\fR. +.SS "Redoing contexts" +.IX Subsection "Redoing contexts" +Finally, there is \f(CW\*(C`cx_topblock(cx)\*(C'\fR, which acts like a super\-\f(CW\*(C`nextstate\*(C'\fR +as regards to resetting various vars to their base values. It is used in +places like \f(CW\*(C`pp_next\*(C'\fR, \f(CW\*(C`pp_redo\*(C'\fR and \f(CW\*(C`pp_goto\*(C'\fR where rather than +exiting a scope, we want to re-initialise the scope. As well as resetting +\&\f(CW\*(C`PL_stack_sp\*(C'\fR like \f(CW\*(C`nextstate\*(C'\fR, it also resets \f(CW\*(C`PL_markstack_ptr\*(C'\fR, +\&\f(CW\*(C`PL_scopestack_ix\*(C'\fR and \f(CW\*(C`PL_curpm\*(C'\fR. Note that it doesn't do a +\&\f(CW\*(C`FREETMPS\*(C'\fR. +.SH "Slab-based operator allocation" +.IX Header "Slab-based operator allocation" +\&\fBNote:\fR this section describes a non-public internal \s-1API\s0 that is subject +to change without notice. +.PP +Perl's internal error-handling mechanisms implement \f(CW\*(C`die\*(C'\fR (and its internal +equivalents) using longjmp. If this occurs during lexing, parsing or +compilation, we must ensure that any ops allocated as part of the compilation +process are freed. (Older Perl versions did not adequately handle this +situation: when failing a parse, they would leak ops that were stored in +C \f(CW\*(C`auto\*(C'\fR variables and not linked anywhere else.) +.PP +To handle this situation, Perl uses \fIop slabs\fR that are attached to the +currently-compiling \s-1CV. A\s0 slab is a chunk of allocated memory. New ops are +allocated as regions of the slab. If the slab fills up, a new one is created +(and linked from the previous one). When an error occurs and the \s-1CV\s0 is freed, +any ops remaining are freed. +.PP +Each op is preceded by two pointers: one points to the next op in the slab, and +the other points to the slab that owns it. The next-op pointer is needed so +that Perl can iterate over a slab and free all its ops. (Op structures are of +different sizes, so the slab's ops can't merely be treated as a dense array.) +The slab pointer is needed for accessing a reference count on the slab: when +the last op on a slab is freed, the slab itself is freed. +.PP +The slab allocator puts the ops at the end of the slab first. This will tend to +allocate the leaves of the op tree first, and the layout will therefore +hopefully be cache-friendly. In addition, this means that there's no need to +store the size of the slab (see below on why slabs vary in size), because Perl +can follow pointers to find the last op. +.PP +It might seem possible eliminate slab reference counts altogether, by having +all ops implicitly attached to \f(CW\*(C`PL_compcv\*(C'\fR when allocated and freed when the +\&\s-1CV\s0 is freed. That would also allow \f(CW\*(C`op_free\*(C'\fR to skip \f(CW\*(C`FreeOp\*(C'\fR altogether, and +thus free ops faster. But that doesn't work in those cases where ops need to +survive beyond their CVs, such as re-evals. +.PP +The \s-1CV\s0 also has to have a reference count on the slab. Sometimes the first op +created is immediately freed. If the reference count of the slab reaches 0, +then it will be freed with the \s-1CV\s0 still pointing to it. +.PP +CVs use the \f(CW\*(C`CVf_SLABBED\*(C'\fR flag to indicate that the \s-1CV\s0 has a reference count +on the slab. When this flag is set, the slab is accessible via \f(CW\*(C`CvSTART\*(C'\fR when +\&\f(CW\*(C`CvROOT\*(C'\fR is not set, or by subtracting two pointers \f(CW\*(C`(2*sizeof(I32 *))\*(C'\fR from +\&\f(CW\*(C`CvROOT\*(C'\fR when it is set. The alternative to this approach of sneaking the slab +into \f(CW\*(C`CvSTART\*(C'\fR during compilation would be to enlarge the \f(CW\*(C`xpvcv\*(C'\fR struct by +another pointer. But that would make all CVs larger, even though slab-based op +freeing is typically of benefit only for programs that make significant use of +string eval. +.PP +When the \f(CW\*(C`CVf_SLABBED\*(C'\fR flag is set, the \s-1CV\s0 takes responsibility for freeing +the slab. If \f(CW\*(C`CvROOT\*(C'\fR is not set when the \s-1CV\s0 is freed or undeffed, it is +assumed that a compilation error has occurred, so the op slab is traversed and +all the ops are freed. +.PP +Under normal circumstances, the \s-1CV\s0 forgets about its slab (decrementing the +reference count) when the root is attached. So the slab reference counting that +happens when ops are freed takes care of freeing the slab. In some cases, the +\&\s-1CV\s0 is told to forget about the slab (\f(CW\*(C`cv_forget_slab\*(C'\fR) precisely so that the +ops can survive after the \s-1CV\s0 is done away with. +.PP +Forgetting the slab when the root is attached is not strictly necessary, but +avoids potential problems with \f(CW\*(C`CvROOT\*(C'\fR being written over. There is code all +over the place, both in core and on \s-1CPAN,\s0 that does things with \f(CW\*(C`CvROOT\*(C'\fR, so +forgetting the slab makes things more robust and avoids potential problems. +.PP +Since the \s-1CV\s0 takes ownership of its slab when flagged, that flag is never +copied when a \s-1CV\s0 is cloned, as one \s-1CV\s0 could free a slab that another \s-1CV\s0 still +points to, since forced freeing of ops ignores the reference count (but asserts +that it looks right). +.PP +To avoid slab fragmentation, freed ops are marked as freed and attached to the +slab's freed chain (an idea stolen from DBM::Deep). Those freed ops are reused +when possible. Not reusing freed ops would be simpler, but it would result in +significantly higher memory usage for programs with large \f(CW\*(C`if (DEBUG) {...}\*(C'\fR +blocks. +.PP +\&\f(CW\*(C`SAVEFREEOP\*(C'\fR is slightly problematic under this scheme. Sometimes it can cause +an op to be freed after its \s-1CV.\s0 If the \s-1CV\s0 has forcibly freed the ops on its +slab and the slab itself, then we will be fiddling with a freed slab. Making +\&\f(CW\*(C`SAVEFREEOP\*(C'\fR a no-op doesn't help, as sometimes an op can be savefreed when +there is no compilation error, so the op would never be freed. It holds +a reference count on the slab, so the whole slab would leak. So \f(CW\*(C`SAVEFREEOP\*(C'\fR +now sets a special flag on the op (\f(CW\*(C`\->op_savefree\*(C'\fR). The forced freeing of +ops after a compilation error won't free any ops thus marked. +.PP +Since many pieces of code create tiny subroutines consisting of only a few ops, +and since a huge slab would be quite a bit of baggage for those to carry +around, the first slab is always very small. To avoid allocating too many +slabs for a single \s-1CV,\s0 each subsequent slab is twice the size of the previous. +.PP +Smartmatch expects to be able to allocate an op at run time, run it, and then +throw it away. For that to work the op is simply malloced when PL_compcv hasn't +been set up. So all slab-allocated ops are marked as such (\f(CW\*(C`\->op_slabbed\*(C'\fR), +to distinguish them from malloced ops. +.SH "AUTHORS" +.IX Header "AUTHORS" +Until May 1997, this document was maintained by Jeff Okamoto +. It is now maintained as part of Perl +itself by the Perl 5 Porters . +.PP +With lots of help and suggestions from Dean Roehrich, Malcolm Beattie, +Andreas Koenig, Paul Hudson, Ilya Zakharevich, Paul Marquess, Neil +Bowers, Matthew Green, Tim Bunce, Spider Boardman, Ulrich Pfeifer, +Stephen McCamant, and Gurusamy Sarathy. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perlapi, perlintern, perlxs, perlembed diff --git a/data/miniconda3/man/man1/perlhack.1 b/data/miniconda3/man/man1/perlhack.1 new file mode 100644 index 0000000000000000000000000000000000000000..1ad6a1c8f38c9ec006971a78f8d7a95d6710699f --- /dev/null +++ b/data/miniconda3/man/man1/perlhack.1 @@ -0,0 +1,1298 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "2021-01-09" "perl v5.32.1" "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 on Perl +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document explains how Perl development works. It includes details +about the Perl 5 Porters email list, the Perl repository, the Perl +bug tracker, patch guidelines, and commentary on Perl development +philosophy. +.SH "SUPER QUICK PATCH GUIDE" +.IX Header "SUPER QUICK PATCH GUIDE" +If you just want to submit a single small patch like a pod fix, a test +for a bug, comment fixes, etc., it's easy! Here's how: +.IP "\(bu" 4 +Check out the source repository +.Sp +The perl source is in a git repository. You can clone the repository +with the following command: +.Sp +.Vb 1 +\& % git clone https://github.com/Perl/perl5.git perl +.Ve +.IP "\(bu" 4 +Ensure you're following the latest advice +.Sp +In case the advice in this guide has been updated recently, read the +latest version directly from the perl source: +.Sp +.Vb 1 +\& % perldoc pod/perlhack.pod +.Ve +.IP "\(bu" 4 +Create a branch for your change +.Sp +Create a branch based on blead to commit your change to, which will +later be used to send it to the Perl issue tracker. +.Sp +.Vb 1 +\& % git checkout \-b mychange +.Ve +.IP "\(bu" 4 +Make your change +.Sp +Hack, hack, hack. Keep in mind that Perl runs on many different +platforms, with different operating systems that have different +capabilities, different filesystem organizations, and even different +character sets. perlhacktips gives advice on this. +.IP "\(bu" 4 +Test your change +.Sp +You can run all the tests with the following commands: +.Sp +.Vb 2 +\& % ./Configure \-des \-Dusedevel +\& % make test +.Ve +.Sp +Keep hacking until the tests pass. +.IP "\(bu" 4 +Commit your change +.Sp +Committing your work will save the change \fIon your local system\fR: +.Sp +.Vb 1 +\& % git commit \-a \-m \*(AqCommit message goes here\*(Aq +.Ve +.Sp +Make sure the commit message describes your change in a single +sentence. For example, \*(L"Fixed spelling errors in perlhack.pod\*(R". +.IP "\(bu" 4 +Send your change to the Perl issue tracker +.Sp +The next step is to submit your patch to the Perl core ticket system. +.Sp +Create a GitHub fork of the perl5 repository and add it as a remote, +if you haven't already, as described in the GitHub documentation at +. +.Sp +.Vb 1 +\& % git remote add fork git@github.com:MyUser/perl5.git +.Ve +.Sp +Then, push your new branch to your fork. +.Sp +.Vb 1 +\& % git push \-u fork mychange +.Ve +.Sp +Finally, create a Pull Request on GitHub from your branch to blead as +described in the GitHub documentation at +. +.IP "\(bu" 4 +Thank you +.Sp +The porters appreciate the time you spent helping to make Perl better. +Thank you! +.IP "\(bu" 4 +Acknowledgement +.Sp +All contributors are credited (by name and email address) in the +\&\s-1AUTHORS\s0 file, which is part of the perl distribution, as well as the +Git commit history. +.Sp +If you donXt want to be included in the \s-1AUTHORS\s0 file, just let us +know. Otherwise we will take your submission of a patch as permission +to credit you in the \s-1AUTHORS\s0 file. +.IP "\(bu" 4 +Next time +.Sp +The next time you wish to make a patch, you need to start from the +latest perl in a pristine state. Check you don't have any local changes +or added files in your perl check-out which you wish to keep, then run +these commands: +.Sp +.Vb 4 +\& % git checkout blead +\& % git pull +\& % git reset \-\-hard origin/blead +\& % git clean \-dxf +.Ve +.SH "BUG REPORTING" +.IX Header "BUG REPORTING" +If you want to report a bug in Perl, or browse existing Perl bugs and +patches, use the GitHub issue tracker at +. +.PP +Please check the archive of the perl5\-porters list (see below) and/or +the bug tracking system before submitting a bug report. Often, you'll +find that the bug has been reported already. +.PP +You can log in to the bug tracking system and comment on existing bug +reports. If you have additional information regarding an existing bug, +please add it. This will help the porters fix the bug. +.SH "PERL 5 PORTERS" +.IX Header "PERL 5 PORTERS" +The perl5\-porters (p5p) mailing list is where the Perl standard +distribution is maintained and developed. The people who maintain Perl +are also referred to as the \*(L"Perl 5 Porters\*(R", \*(L"p5p\*(R" or just the +\&\*(L"porters\*(R". +.PP +A searchable archive of the list is available at +. There is also an archive at +. +.SS "perl-changes mailing list" +.IX Subsection "perl-changes mailing list" +The perl5\-changes mailing list receives a copy of each patch that gets +submitted to the maintenance and development branches of the perl +repository. See for +subscription and archive information. +.SS "#p5p on \s-1IRC\s0" +.IX Subsection "#p5p on IRC" +Many porters are also active on the channel. +Feel free to join the channel and ask questions about hacking on the +Perl core. +.SH "GETTING THE PERL SOURCE" +.IX Header "GETTING THE PERL SOURCE" +All of Perl's source code is kept centrally in a Git repository at +\&\fIgithub.com\fR. The repository contains many Perl revisions +from Perl 1 onwards and all the revisions from Perforce, the previous +version control system. +.PP +For much more detail on using git with the Perl repository, please see +perlgit. +.SS "Read access via Git" +.IX Subsection "Read access via Git" +You will need a copy of Git for your computer. You can fetch a copy of +the repository using the git protocol: +.PP +.Vb 1 +\& % git clone git://github.com/Perl/perl5.git perl +.Ve +.PP +This clones the repository and makes a local copy in the \fIperl\fR +directory. +.PP +If you cannot use the git protocol for firewall reasons, you can also +clone via http: +.PP +.Vb 1 +\& % git clone https://github.com/Perl/perl5.git perl +.Ve +.SS "Read access via the web" +.IX Subsection "Read access via the web" +You may access the repository over the web. This allows you to browse +the tree, see recent commits, subscribe to repository notifications, +search for particular commits and more. You may access it at +. +.SS "Read access via rsync" +.IX Subsection "Read access via rsync" +You can also choose to use rsync to get a copy of the current source +tree for the bleadperl branch and all maintenance branches: +.PP +.Vb 6 +\& % rsync \-avz rsync://perl5.git.perl.org/perl\-current . +\& % rsync \-avz rsync://perl5.git.perl.org/perl\-5.12.x . +\& % rsync \-avz rsync://perl5.git.perl.org/perl\-5.10.x . +\& % rsync \-avz rsync://perl5.git.perl.org/perl\-5.8.x . +\& % rsync \-avz rsync://perl5.git.perl.org/perl\-5.6.x . +\& % rsync \-avz rsync://perl5.git.perl.org/perl\-5.005xx . +.Ve +.PP +(Add the \f(CW\*(C`\-\-delete\*(C'\fR option to remove leftover files.) +.PP +To get a full list of the available sync points: +.PP +.Vb 1 +\& % rsync perl5.git.perl.org:: +.Ve +.SS "Write access via git" +.IX Subsection "Write access via git" +If you have a commit bit, please see perlgit for more details on +using git. +.SH "PATCHING PERL" +.IX Header "PATCHING PERL" +If you're planning to do more extensive work than a single small fix, +we encourage you to read the documentation below. This will help you +focus your work and make your patches easier to incorporate into the +Perl source. +.SS "Submitting patches" +.IX Subsection "Submitting patches" +If you have a small patch to submit, please submit it via the GitHub +Pull Request workflow. You may also send patches to the p5p list. +.PP +Patches are reviewed and discussed on GitHub or the p5p list. Simple, +uncontroversial patches will usually be applied without any discussion. +When the patch is applied, the ticket will be updated and you will +receive email. +.PP +In other cases, the patch will need more work or discussion. +You are encouraged to participate in the discussion and advocate for +your patch. Sometimes your patch may get lost in the shuffle. It's +appropriate to send a reminder email to p5p if no action has been taken +in a month. Please remember that the Perl 5 developers are all +volunteers, and be polite. +.PP +Changes are always applied directly to the main development branch, +called \*(L"blead\*(R". Some patches may be backported to a maintenance +branch. If you think your patch is appropriate for the maintenance +branch (see \*(L"\s-1MAINTENANCE BRANCHES\*(R"\s0 in perlpolicy), please explain why +when you submit it. +.SS "Getting your patch accepted" +.IX Subsection "Getting your patch accepted" +If you are submitting a code patch there are several things that you +can do to help the Perl 5 Porters accept your patch. +.PP +\fIPatch style\fR +.IX Subsection "Patch style" +.PP +Using the GitHub Pull Request workflow, your patch will automatically +be available in a suitable format. If you wish to submit a patch to +the p5p list for review, make sure to create it appropriately. +.PP +If you used git to check out the Perl source, then using \f(CW\*(C`git +format\-patch\*(C'\fR will produce a patch in a style suitable for Perl. The +\&\f(CW\*(C`format\-patch\*(C'\fR command produces one patch file for each commit you +made. If you prefer to send a single patch for all commits, you can +use \f(CW\*(C`git diff\*(C'\fR. +.PP +.Vb 3 +\& % git checkout blead +\& % git pull +\& % git diff blead my\-branch\-name +.Ve +.PP +This produces a patch based on the difference between blead and your +current branch. It's important to make sure that blead is up to date +before producing the diff, that's why we call \f(CW\*(C`git pull\*(C'\fR first. +.PP +We strongly recommend that you use git if possible. It will make your +life easier, and ours as well. +.PP +However, if you're not using git, you can still produce a suitable +patch. You'll need a pristine copy of the Perl source to diff against. +The porters prefer unified diffs. Using \s-1GNU\s0 \f(CW\*(C`diff\*(C'\fR, you can produce a +diff like this: +.PP +.Vb 1 +\& % diff \-Npurd perl.pristine perl.mine +.Ve +.PP +Make sure that you \f(CW\*(C`make realclean\*(C'\fR in your copy of Perl to remove any +build artifacts, or you may get a confusing result. +.PP +\fICommit message\fR +.IX Subsection "Commit message" +.PP +As you craft each patch you intend to submit to the Perl core, it's +important to write a good commit message. This is especially important +if your submission will consist of a series of commits. +.PP +The first line of the commit message should be a short description +without a period. It should be no longer than the subject line of an +email, 50 characters being a good rule of thumb. +.PP +A lot of Git tools (Gitweb, GitHub, git log \-\-pretty=oneline, ...) will +only display the first line (cut off at 50 characters) when presenting +commit summaries. +.PP +The commit message should include a description of the problem that the +patch corrects or new functionality that the patch adds. +.PP +As a general rule of thumb, your commit message should help a +programmer who knows the Perl core quickly understand what you were +trying to do, how you were trying to do it, and why the change matters +to Perl. +.IP "\(bu" 4 +Why +.Sp +Your commit message should describe why the change you are making is +important. When someone looks at your change in six months or six +years, your intent should be clear. +.Sp +If you're deprecating a feature with the intent of later simplifying +another bit of code, say so. If you're fixing a performance problem or +adding a new feature to support some other bit of the core, mention +that. +.IP "\(bu" 4 +What +.Sp +Your commit message should describe what part of the Perl core you're +changing and what you expect your patch to do. +.IP "\(bu" 4 +How +.Sp +While it's not necessary for documentation changes, new tests or +trivial patches, it's often worth explaining how your change works. +Even if it's clear to you today, it may not be clear to a porter next +month or next year. +.PP +A commit message isn't intended to take the place of comments in your +code. Commit messages should describe the change you made, while code +comments should describe the current state of the code. +.PP +If you've just implemented a new feature, complete with doc, tests and +well-commented code, a brief commit message will often suffice. If, +however, you've just changed a single character deep in the parser or +lexer, you might need to write a small novel to ensure that future +readers understand what you did and why you did it. +.PP +\fIComments, Comments, Comments\fR +.IX Subsection "Comments, Comments, Comments" +.PP +Be sure to adequately comment your code. While commenting every line +is unnecessary, anything that takes advantage of side effects of +operators, that creates changes that will be felt outside of the +function being patched, or that others may find confusing should be +documented. If you are going to err, it is better to err on the side +of adding too many comments than too few. +.PP +The best comments explain \fIwhy\fR the code does what it does, not \fIwhat +it does\fR. +.PP +\fIStyle\fR +.IX Subsection "Style" +.PP +In general, please follow the particular style of the code you are +patching. +.PP +In particular, follow these general guidelines for patching Perl +sources: +.IP "\(bu" 4 +4\-wide indents for code, 2\-wide indents for nested \s-1CPP\s0 \f(CW\*(C`#define\*(C'\fRs, +with 8\-wide tabstops. +.IP "\(bu" 4 +Use spaces for indentation, not tab characters. +.Sp +The codebase is a mixture of tabs and spaces for indentation, and we +are moving to spaces only. Converting lines you're patching from 8\-wide +tabs to spaces will help this migration. +.IP "\(bu" 4 +Try hard not to exceed 79\-columns +.IP "\(bu" 4 +\&\s-1ANSI C\s0 prototypes +.IP "\(bu" 4 +Uncuddled elses and \*(L"K&R\*(R" style for indenting control constructs +.IP "\(bu" 4 +No \*(C+ style (//) comments +.IP "\(bu" 4 +Mark places that need to be revisited with \s-1XXX\s0 (and revisit often!) +.IP "\(bu" 4 +Opening brace lines up with \*(L"if\*(R" when conditional spans multiple lines; +should be at end-of-line otherwise +.IP "\(bu" 4 +In function definitions, name starts in column 0 (return value-type is on +previous line) +.IP "\(bu" 4 +Single space after keywords that are followed by parens, no space +between function name and following paren +.IP "\(bu" 4 +Avoid assignments in conditionals, but if they're unavoidable, use +extra paren, e.g. \*(L"if (a && (b = c)) ...\*(R" +.IP "\(bu" 4 +\&\*(L"return foo;\*(R" rather than \*(L"return(foo);\*(R" +.IP "\(bu" 4 +\&\*(L"if (!foo) ...\*(R" rather than \*(L"if (foo == \s-1FALSE\s0) ...\*(R" etc. +.IP "\(bu" 4 +Do not declare variables using \*(L"register\*(R". It may be counterproductive +with modern compilers, and is deprecated in \*(C+, under which the Perl +source is regularly compiled. +.IP "\(bu" 4 +In-line functions that are in headers that are accessible to \s-1XS\s0 code +need to be able to compile without warnings with commonly used extra +compilation flags, such as gcc's \f(CW\*(C`\-Wswitch\-default\*(C'\fR which warns +whenever a switch statement does not have a \*(L"default\*(R" case. The use of +these extra flags is to catch potential problems in legal C code, and +is often used by Perl aggregators, such as Linux distributors. +.PP +\fITest suite\fR +.IX Subsection "Test suite" +.PP +If your patch changes code (rather than just changing documentation), +you should also include one or more test cases which illustrate the bug +you're fixing or validate the new functionality you're adding. In +general, you should update an existing test file rather than create a +new one. +.PP +Your test suite additions should generally follow these guidelines +(courtesy of Gurusamy Sarathy ): +.IP "\(bu" 4 +Know what you're testing. Read the docs, and the source. +.IP "\(bu" 4 +Tend to fail, not succeed. +.IP "\(bu" 4 +Interpret results strictly. +.IP "\(bu" 4 +Use unrelated features (this will flush out bizarre interactions). +.IP "\(bu" 4 +Use non-standard idioms (otherwise you are not testing \s-1TIMTOWTDI\s0). +.IP "\(bu" 4 +Avoid using hardcoded test numbers whenever possible (the \s-1EXPECTED/GOT\s0 +found in t/op/tie.t is much more maintainable, and gives better failure +reports). +.IP "\(bu" 4 +Give meaningful error messages when a test fails. +.IP "\(bu" 4 +Avoid using qx// and \fBsystem()\fR unless you are testing for them. If you +do use them, make sure that you cover _all_ perl platforms. +.IP "\(bu" 4 +Unlink any temporary files you create. +.IP "\(bu" 4 +Promote unforeseen warnings to errors with \f(CW$SIG\fR{_\|_WARN_\|_}. +.IP "\(bu" 4 +Be sure to use the libraries and modules shipped with the version being +tested, not those that were already installed. +.IP "\(bu" 4 +Add comments to the code explaining what you are testing for. +.IP "\(bu" 4 +Make updating the '1..42' string unnecessary. Or make sure that you +update it. +.IP "\(bu" 4 +Test _all_ behaviors of a given operator, library, or function. +.Sp +Test all optional arguments. +.Sp +Test return values in various contexts (boolean, scalar, list, lvalue). +.Sp +Use both global and lexical variables. +.Sp +Don't forget the exceptional, pathological cases. +.SS "Patching a core module" +.IX Subsection "Patching a core module" +This works just like patching anything else, with one extra +consideration. +.PP +Modules in the \fIcpan/\fR directory of the source tree are maintained +outside of the Perl core. When the author updates the module, the +updates are simply copied into the core. See that module's +documentation or its listing on for more +information on reporting bugs and submitting patches. +.PP +In most cases, patches to modules in \fIcpan/\fR should be sent upstream +and should not be applied to the Perl core individually. If a patch to +a file in \fIcpan/\fR absolutely cannot wait for the fix to be made +upstream, released to \s-1CPAN\s0 and copied to blead, you must add (or +update) a \f(CW\*(C`CUSTOMIZED\*(C'\fR entry in the \fI\*(L"Porting/Maintainers.pl\*(R"\fR file +to flag that a local modification has been made. See +\&\fI\*(L"Porting/Maintainers.pl\*(R"\fR for more details. +.PP +In contrast, modules in the \fIdist/\fR directory are maintained in the +core. +.SS "Updating perldelta" +.IX Subsection "Updating perldelta" +For changes significant enough to warrant a \fIpod/perldelta.pod\fR entry, +the porters will greatly appreciate it if you submit a delta entry +along with your actual change. Significant changes include, but are +not limited to: +.IP "\(bu" 4 +Adding, deprecating, or removing core features +.IP "\(bu" 4 +Adding, deprecating, removing, or upgrading core or dual-life modules +.IP "\(bu" 4 +Adding new core tests +.IP "\(bu" 4 +Fixing security issues and user-visible bugs in the core +.IP "\(bu" 4 +Changes that might break existing code, either on the perl or C level +.IP "\(bu" 4 +Significant performance improvements +.IP "\(bu" 4 +Adding, removing, or significantly changing documentation in the +\&\fIpod/\fR directory +.IP "\(bu" 4 +Important platform-specific changes +.PP +Please make sure you add the perldelta entry to the right section +within \fIpod/perldelta.pod\fR. More information on how to write good +perldelta entries is available in the \f(CW\*(C`Style\*(C'\fR section of +\&\fIPorting/how_to_write_a_perldelta.pod\fR. +.SS "What makes for a good patch?" +.IX Subsection "What makes for a good patch?" +New features and extensions to the language can be contentious. There +is no specific set of criteria which determine what features get added, +but here are some questions to consider when developing a patch: +.PP +\fIDoes the concept match the general goals of Perl?\fR +.IX Subsection "Does the concept match the general goals of Perl?" +.PP +Our goals include, but are not limited to: +.IP "1." 4 +Keep it fast, simple, and useful. +.IP "2." 4 +Keep features/concepts as orthogonal as possible. +.IP "3." 4 +No arbitrary limits (platforms, data sizes, cultures). +.IP "4." 4 +Keep it open and exciting to use/patch/advocate Perl everywhere. +.IP "5." 4 +Either assimilate new technologies, or build bridges to them. +.PP +\fIWhere is the implementation?\fR +.IX Subsection "Where is the implementation?" +.PP +All the talk in the world is useless without an implementation. In +almost every case, the person or people who argue for a new feature +will be expected to be the ones who implement it. Porters capable of +coding new features have their own agendas, and are not available to +implement your (possibly good) idea. +.PP +\fIBackwards compatibility\fR +.IX Subsection "Backwards compatibility" +.PP +It's a cardinal sin to break existing Perl programs. New warnings can +be contentious\*(--some say that a program that emits warnings is not +broken, while others say it is. Adding keywords has the potential to +break programs, changing the meaning of existing token sequences or +functions might break programs. +.PP +The Perl 5 core includes mechanisms to help porters make backwards +incompatible changes more compatible such as the feature and +deprecate modules. Please use them when appropriate. +.PP +\fICould it be a module instead?\fR +.IX Subsection "Could it be a module instead?" +.PP +Perl 5 has extension mechanisms, modules and \s-1XS,\s0 specifically to avoid +the need to keep changing the Perl interpreter. You can write modules +that export functions, you can give those functions prototypes so they +can be called like built-in functions, you can even write \s-1XS\s0 code to +mess with the runtime data structures of the Perl interpreter if you +want to implement really complicated things. +.PP +Whenever possible, new features should be prototyped in a \s-1CPAN\s0 module +before they will be considered for the core. +.PP +\fIIs the feature generic enough?\fR +.IX Subsection "Is the feature generic enough?" +.PP +Is this something that only the submitter wants added to the language, +or is it broadly useful? Sometimes, instead of adding a feature with a +tight focus, the porters might decide to wait until someone implements +the more generalized feature. +.PP +\fIDoes it potentially introduce new bugs?\fR +.IX Subsection "Does it potentially introduce new bugs?" +.PP +Radical rewrites of large chunks of the Perl interpreter have the +potential to introduce new bugs. +.PP +\fIHow big is it?\fR +.IX Subsection "How big is it?" +.PP +The smaller and more localized the change, the better. Similarly, a +series of small patches is greatly preferred over a single large patch. +.PP +\fIDoes it preclude other desirable features?\fR +.IX Subsection "Does it preclude other desirable features?" +.PP +A patch is likely to be rejected if it closes off future avenues of +development. For instance, a patch that placed a true and final +interpretation on prototypes is likely to be rejected because there are +still options for the future of prototypes that haven't been addressed. +.PP +\fIIs the implementation robust?\fR +.IX Subsection "Is the implementation robust?" +.PP +Good patches (tight code, complete, correct) stand more chance of going +in. Sloppy or incorrect patches might be placed on the back burner +until fixes can be made, or they might be discarded altogether +without further notice. +.PP +\fIIs the implementation generic enough to be portable?\fR +.IX Subsection "Is the implementation generic enough to be portable?" +.PP +The worst patches make use of system-specific features. It's highly +unlikely that non-portable additions to the Perl language will be +accepted. +.PP +\fIIs the implementation tested?\fR +.IX Subsection "Is the implementation tested?" +.PP +Patches which change behaviour (fixing bugs or introducing new +features) must include regression tests to verify that everything works +as expected. +.PP +Without tests provided by the original author, how can anyone else +changing perl in the future be sure that they haven't unwittingly +broken the behaviour the patch implements? And without tests, how can +the patch's author be confident that his/her hard work put into the +patch won't be accidentally thrown away by someone in the future? +.PP +\fIIs there enough documentation?\fR +.IX Subsection "Is there enough documentation?" +.PP +Patches without documentation are probably ill-thought out or +incomplete. No features can be added or changed without documentation, +so submitting a patch for the appropriate pod docs as well as the +source code is important. +.PP +\fIIs there another way to do it?\fR +.IX Subsection "Is there another way to do it?" +.PP +Larry said "Although the Perl Slogan is \fIThere's More Than One Way to +Do It\fR, I hesitate to make 10 ways to do something". This is a tricky +heuristic to navigate, though\*(--one man's essential addition is another +man's pointless cruft. +.PP +\fIDoes it create too much work?\fR +.IX Subsection "Does it create too much work?" +.PP +Work for the committers, work for Perl programmers, work for module +authors, ... Perl is supposed to be easy. +.PP +\fIPatches speak louder than words\fR +.IX Subsection "Patches speak louder than words" +.PP +Working code is always preferred to pie-in-the-sky ideas. A patch to +add a feature stands a much higher chance of making it to the language +than does a random feature request, no matter how fervently argued the +request might be. This ties into \*(L"Will it be useful?\*(R", as the fact +that someone took the time to make the patch demonstrates a strong +desire for the feature. +.SH "TESTING" +.IX Header "TESTING" +The core uses the same testing style as the rest of Perl, a simple +\&\*(L"ok/not ok\*(R" run through Test::Harness, but there are a few special +considerations. +.PP +There are three ways to write a test in the core: Test::More, +\&\fIt/test.pl\fR and ad hoc \f(CW\*(C`print $test ? "ok 42\en" : "not ok 42\en"\*(C'\fR. +The decision of which to use depends on what part of the test suite +you're working on. This is a measure to prevent a high-level failure +(such as Config.pm breaking) from causing basic functionality tests to +fail. +.PP +The \fIt/test.pl\fR library provides some of the features of +Test::More, but avoids loading most modules and uses as few core +features as possible. +.PP +If you write your own test, use the Test Anything +Protocol . +.IP "\(bu" 4 +\&\fIt/base\fR, \fIt/comp\fR and \fIt/opbasic\fR +.Sp +Since we don't know if \f(CW\*(C`require\*(C'\fR works, or even subroutines, use ad hoc +tests for these three. Step carefully to avoid using the feature being +tested. Tests in \fIt/opbasic\fR, for instance, have been placed there +rather than in \fIt/op\fR because they test functionality which +\&\fIt/test.pl\fR presumes has already been demonstrated to work. +.IP "\(bu" 4 +All other subdirectories of \fIt/\fR +.Sp +Now that basic \fBrequire()\fR and subroutines are tested, you can use the +\&\fIt/test.pl\fR library. +.Sp +You can also use certain libraries like Config conditionally, but be +sure to skip the test gracefully if it's not there. +.IP "\(bu" 4 +Test files not found under \fIt/\fR +.Sp +This category includes \fI.t\fR files underneath directories such as \fIdist\fR, +\&\fIext\fR and \fIlib\fR. Since the core of Perl has now been tested, Test::More +can and now should be used. You can also use the full suite of core modules +in the tests. (As noted in \*(L"Patching a core module\*(R" above, changes to +\&\fI.t\fR files found under \fIcpan/\fR should be submitted to the upstream +maintainers of those modules.) +.PP +When you say \*(L"make test\*(R", Perl uses the \fIt/TEST\fR program to run the +test suite (except under Win32 where it uses \fIt/harness\fR instead). +All tests are run from the \fIt/\fR directory, \fBnot\fR the directory which +contains the test. This causes some problems with the tests in +\&\fIlib/\fR, so here's some opportunity for some patching. +.PP +You must be triply conscious of cross-platform concerns. This usually +boils down to using File::Spec, avoiding things like \f(CW\*(C`fork()\*(C'\fR +and \f(CW\*(C`system()\*(C'\fR unless absolutely necessary, and not assuming that a +given character has a particular ordinal value (code point) or that its +\&\s-1UTF\-8\s0 representation is composed of particular bytes. +.PP +There are several functions available to specify characters and code +points portably in tests. The always-preloaded functions +\&\f(CW\*(C`utf8::unicode_to_native()\*(C'\fR and its inverse +\&\f(CW\*(C`utf8::native_to_unicode()\*(C'\fR take code points and translate +appropriately. The file \fIt/charset_tools.pl\fR has several functions +that can be useful. It has versions of the previous two functions +that take strings as inputs \*(-- not single numeric code points: +\&\f(CW\*(C`uni_to_native()\*(C'\fR and \f(CW\*(C`native_to_uni()\*(C'\fR. If you must look at the +individual bytes comprising a \s-1UTF\-8\s0 encoded string, +\&\f(CW\*(C`byte_utf8a_to_utf8n()\*(C'\fR takes as input a string of those bytes encoded +for an \s-1ASCII\s0 platform, and returns the equivalent string in the native +platform. For example, \f(CW\*(C`byte_utf8a_to_utf8n("\exC2\exA0")\*(C'\fR returns the +byte sequence on the current platform that form the \s-1UTF\-8\s0 for \f(CW\*(C`U+00A0\*(C'\fR, +since \f(CW"\exC2\exA0"\fR are the \s-1UTF\-8\s0 bytes on an \s-1ASCII\s0 platform for that +code point. This function returns \f(CW"\exC2\exA0"\fR on an \s-1ASCII\s0 platform, and +\&\f(CW"\ex80\ex41"\fR on an \s-1EBCDIC 1047\s0 one. +.PP +But easiest is, if the character is specifiable as a literal, like +\&\f(CW"A"\fR or \f(CW"%"\fR, to use that; if not so specificable, you can use +\&\f(CW\*(C`\eN{}\*(C'\fR , if the side effects aren't troublesome. Simply specify all +your characters in hex, using \f(CW\*(C`\eN{U+ZZ}\*(C'\fR instead of \f(CW\*(C`\exZZ\*(C'\fR. \f(CW\*(C`\eN{}\*(C'\fR +is the Unicode name, and so it +always gives you the Unicode character. \f(CW\*(C`\eN{U+41}\*(C'\fR is the character +whose Unicode code point is \f(CW0x41\fR, hence is \f(CW\*(AqA\*(Aq\fR on all platforms. +The side effects are: +.IP "\(bu" 4 +These select Unicode rules. That means that in double-quotish strings, +the string is always converted to \s-1UTF\-8\s0 to force a Unicode +interpretation (you can \f(CW\*(C`utf8::downgrade()\*(C'\fR afterwards to convert back +to non\-UTF8, if possible). In regular expression patterns, the +conversion isn't done, but if the character set modifier would +otherwise be \f(CW\*(C`/d\*(C'\fR, it is changed to \f(CW\*(C`/u\*(C'\fR. +.IP "\(bu" 4 +If you use the form \f(CW\*(C`\eN{\f(CIcharacter name\f(CW}\*(C'\fR, the charnames module +gets automatically loaded. This may not be suitable for the test level +you are doing. +.PP +If you are testing locales (see perllocale), there are helper +functions in \fIt/loc_tools.pl\fR to enable you to see what locales there +are on the current platform. +.ie n .SS "Special ""make test"" targets" +.el .SS "Special \f(CWmake test\fP targets" +.IX Subsection "Special make test targets" +There are various special make targets that can be used to test Perl +slightly differently than the standard \*(L"test\*(R" target. Not all them are +expected to give a 100% success rate. Many of them have several +aliases, and many of them are not available on certain operating +systems. +.IP "\(bu" 4 +test_porting +.Sp +This runs some basic sanity tests on the source tree and helps catch +basic errors before you submit a patch. +.IP "\(bu" 4 +minitest +.Sp +Run \fIminiperl\fR on \fIt/base\fR, \fIt/comp\fR, \fIt/cmd\fR, \fIt/run\fR, \fIt/io\fR, +\&\fIt/op\fR, \fIt/uni\fR and \fIt/mro\fR tests. +.Sp +\&\fIminiperl\fR is a minimalistic perl built to bootstrap building +extensions, utilties, documentation etc. It doesn't support dynamic +loading and depending on the point in the build process will only have +access to a limited set of core modules. \fIminiperl\fR is not intended +for day to day use. +.IP "\(bu" 4 +test.valgrind check.valgrind +.Sp +(Only in Linux) Run all the tests using the memory leak + naughty +memory access tool \*(L"valgrind\*(R". The log files will be named +\&\fItestname.valgrind\fR. +.IP "\(bu" 4 +test_harness +.Sp +Run the test suite with the \fIt/harness\fR controlling program, instead +of \fIt/TEST\fR. \fIt/harness\fR is more sophisticated, and uses the +Test::Harness module, thus using this test target supposes that perl +mostly works. The main advantage for our purposes is that it prints a +detailed summary of failed tests at the end. Also, unlike \fIt/TEST\fR, +it doesn't redirect stderr to stdout. +.Sp +Note that under Win32 \fIt/harness\fR is always used instead of \fIt/TEST\fR, +so there is no special \*(L"test_harness\*(R" target. +.Sp +Under Win32's \*(L"test\*(R" target you may use the \s-1TEST_SWITCHES\s0 and +\&\s-1TEST_FILES\s0 environment variables to control the behaviour of +\&\fIt/harness\fR. This means you can say +.Sp +.Vb 2 +\& nmake test TEST_FILES="op/*.t" +\& nmake test TEST_SWITCHES="\-torture" TEST_FILES="op/*.t" +.Ve +.IP "\(bu" 4 +test-notty test_notty +.Sp +Sets \s-1PERL_SKIP_TTY_TEST\s0 to true before running normal test. +.SS "Parallel tests" +.IX Subsection "Parallel tests" +The core distribution can now run its regression tests in parallel on +Unix-like platforms. Instead of running \f(CW\*(C`make test\*(C'\fR, set \f(CW\*(C`TEST_JOBS\*(C'\fR +in your environment to the number of tests to run in parallel, and run +\&\f(CW\*(C`make test_harness\*(C'\fR. On a Bourne-like shell, this can be done as +.PP +.Vb 1 +\& TEST_JOBS=3 make test_harness # Run 3 tests in parallel +.Ve +.PP +An environment variable is used, rather than parallel make itself, +because TAP::Harness needs to be able to schedule individual +non-conflicting test scripts itself, and there is no standard interface +to \f(CW\*(C`make\*(C'\fR utilities to interact with their job schedulers. +.PP +Note that currently some test scripts may fail when run in parallel +(most notably \fIdist/IO/t/io_dir.t\fR). If necessary, run just the +failing scripts again sequentially and see if the failures go away. +.SS "Running tests by hand" +.IX Subsection "Running tests by hand" +You can run part of the test suite by hand by using one of the +following commands from the \fIt/\fR directory: +.PP +.Vb 1 +\& ./perl \-I../lib TEST list\-of\-.t\-files +.Ve +.PP +or +.PP +.Vb 1 +\& ./perl \-I../lib harness list\-of\-.t\-files +.Ve +.PP +(If you don't specify test scripts, the whole test suite will be run.) +.SS "Using \fIt/harness\fP for testing" +.IX Subsection "Using t/harness for testing" +If you use \f(CW\*(C`harness\*(C'\fR for testing, you have several command line +options available to you. The arguments are as follows, and are in the +order that they must appear if used together. +.PP +.Vb 2 +\& harness \-v \-torture \-re=pattern LIST OF FILES TO TEST +\& harness \-v \-torture \-re LIST OF PATTERNS TO MATCH +.Ve +.PP +If \f(CW\*(C`LIST OF FILES TO TEST\*(C'\fR is omitted, the file list is obtained from +the manifest. The file list may include shell wildcards which will be +expanded out. +.IP "\(bu" 4 +\&\-v +.Sp +Run the tests under verbose mode so you can see what tests were run, +and debug output. +.IP "\(bu" 4 +\&\-torture +.Sp +Run the torture tests as well as the normal set. +.IP "\(bu" 4 +\&\-re=PATTERN +.Sp +Filter the file list so that all the test files run match \s-1PATTERN.\s0 +Note that this form is distinct from the \fB\-re \s-1LIST OF PATTERNS\s0\fR form +below in that it allows the file list to be provided as well. +.IP "\(bu" 4 +\&\-re \s-1LIST OF PATTERNS\s0 +.Sp +Filter the file list so that all the test files run match +/(LIST|OF|PATTERNS)/. Note that with this form the patterns are joined +by '|' and you cannot supply a list of files, instead the test files +are obtained from the \s-1MANIFEST.\s0 +.PP +You can run an individual test by a command similar to +.PP +.Vb 1 +\& ./perl \-I../lib path/to/foo.t +.Ve +.PP +except that the harnesses set up some environment variables that may +affect the execution of the test: +.IP "\(bu" 4 +PERL_CORE=1 +.Sp +indicates that we're running this test as part of the perl core test +suite. This is useful for modules that have a dual life on \s-1CPAN.\s0 +.IP "\(bu" 4 +PERL_DESTRUCT_LEVEL=2 +.Sp +is set to 2 if it isn't set already (see +\&\*(L"\s-1PERL_DESTRUCT_LEVEL\*(R"\s0 in perlhacktips). +.IP "\(bu" 4 +\&\s-1PERL\s0 +.Sp +(used only by \fIt/TEST\fR) if set, overrides the path to the perl +executable that should be used to run the tests (the default being +\&\fI./perl\fR). +.IP "\(bu" 4 +\&\s-1PERL_SKIP_TTY_TEST\s0 +.Sp +if set, tells to skip the tests that need a terminal. It's actually +set automatically by the Makefile, but can also be forced artificially +by running 'make test_notty'. +.PP +\fIOther environment variables that may influence tests\fR +.IX Subsection "Other environment variables that may influence tests" +.IP "\(bu" 4 +PERL_TEST_Net_Ping +.Sp +Setting this variable runs all the Net::Ping modules tests, otherwise +some tests that interact with the outside world are skipped. See +perl58delta. +.IP "\(bu" 4 +\&\s-1PERL_TEST_NOVREXX\s0 +.Sp +Setting this variable skips the vrexx.t tests for \s-1OS2::REXX.\s0 +.IP "\(bu" 4 +\&\s-1PERL_TEST_NUMCONVERTS\s0 +.Sp +This sets a variable in op/numconvert.t. +.IP "\(bu" 4 +\&\s-1PERL_TEST_MEMORY\s0 +.Sp +Setting this variable includes the tests in \fIt/bigmem/\fR. This should +be set to the number of gigabytes of memory available for testing, eg. +\&\f(CW\*(C`PERL_TEST_MEMORY=4\*(C'\fR indicates that tests that require 4GiB of +available memory can be run safely. +.PP +See also the documentation for the Test and Test::Harness modules, for +more environment variables that affect testing. +.SS "Performance testing" +.IX Subsection "Performance testing" +The file \fIt/perf/benchmarks\fR contains snippets of perl code which are +intended to be benchmarked across a range of perls by the +\&\fIPorting/bench.pl\fR tool. If you fix or enhance a performance issue, you +may want to add a representative code sample to the file, then run +\&\fIbench.pl\fR against the previous and current perls to see what difference +it has made, and whether anything else has slowed down as a consequence. +.PP +The file \fIt/perf/opcount.t\fR is designed to test whether a particular +code snippet has been compiled into an optree containing specified +numbers of particular op types. This is good for testing whether +optimisations which alter ops, such as converting an \f(CW\*(C`aelem\*(C'\fR op into an +\&\f(CW\*(C`aelemfast\*(C'\fR op, are really doing that. +.PP +The files \fIt/perf/speed.t\fR and \fIt/re/speed.t\fR are designed to test +things that run thousands of times slower if a particular optimisation +is broken (for example, the utf8 length cache on long utf8 strings). +Add a test that will take a fraction of a second normally, and minutes +otherwise, causing the test file to time out on failure. +.SS "Building perl at older commits" +.IX Subsection "Building perl at older commits" +In the course of hacking on the Perl core distribution, you may have occasion +to configure, build and test perl at an old commit. Sometimes \f(CW\*(C`make\*(C'\fR will +fail during this process. If that happens, you may be able to salvage the +situation by using the Devel::PatchPerl library from \s-1CPAN\s0 (not included in the +core) to bring the source code at that commit to a buildable state. +.PP +Here's a real world example, taken from work done to resolve +perl #10118 . +Use of \fIPorting/bisect.pl\fR had identified commit +\&\f(CW\*(C`ba77e4cc9d1ceebf472c9c5c18b2377ee47062e6\*(C'\fR as the commit in which a bug was +corrected. To confirm, a P5P developer wanted to configure and build perl at +commit \f(CW\*(C`ba77e4c^\*(C'\fR (presumably \*(L"bad\*(R") and then at \f(CW\*(C`ba77e4c\*(C'\fR (presumably +\&\*(L"good\*(R"). Normal configuration and build was attempted: +.PP +.Vb 2 +\& $ sh ./Configure \-des \-Dusedevel +\& $ make test_prep +.Ve +.PP +\&\f(CW\*(C`make\*(C'\fR, however, failed with output (excerpted) like this: +.PP +.Vb 10 +\& cc \-fstack\-protector \-L/usr/local/lib \-o miniperl \e +\& gv.o toke.o perly.o pad.o regcomp.o dump.o util.o \e +\& mg.o reentr.o mro.o hv.o av.o run.o pp_hot.o sv.o \e +\& pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o \e +\& utf8.o taint.o deb.o universal.o globals.o perlio.o \e +\& perlapi.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o \e +\& miniperlmain.o opmini.o perlmini.o +\& pp.o: In function \`Perl_pp_pow\*(Aq: +\& pp.c:(.text+0x2db9): undefined reference to \`pow\*(Aq +\& ... +\& collect2: error: ld returned 1 exit status +\& makefile:348: recipe for target \*(Aqminiperl\*(Aq failed +\& make: *** [miniperl] Error 1 +.Ve +.PP +Another P5P contributor recommended installation and use of Devel::PatchPerl +for this situation, first to determine the version of perl at the commit in +question, then to patch the source code at that point to facilitate a build. +.PP +.Vb 5 +\& $ perl \-MDevel::PatchPerl \-e \e +\& \*(Aqprint Devel::PatchPerl\->determine_version("/path/to/sourcecode"), "\en";\*(Aq +\& 5.11.1 +\& $ perl \-MDevel::PatchPerl \-e \e +\& \*(AqDevel::PatchPerl\->patch_source("5.11.1", "/path/to/sourcecode");\*(Aq +.Ve +.PP +Once the source was patched, \f(CW\*(C`./Configure\*(C'\fR and \f(CW\*(C`make test_prep\*(C'\fR were called +and completed successfully, enabling confirmation of the findings in \s-1RT\s0 +#72414. +.SH "MORE READING FOR GUTS HACKERS" +.IX Header "MORE READING FOR GUTS HACKERS" +To hack on the Perl guts, you'll need to read the following things: +.IP "\(bu" 4 +perlsource +.Sp +An overview of the Perl source tree. This will help you find the files +you're looking for. +.IP "\(bu" 4 +perlinterp +.Sp +An overview of the Perl interpreter source code and some details on how +Perl does what it does. +.IP "\(bu" 4 +perlhacktut +.Sp +This document walks through the creation of a small patch to Perl's C +code. If you're just getting started with Perl core hacking, this will +help you understand how it works. +.IP "\(bu" 4 +perlhacktips +.Sp +More details on hacking the Perl core. This document focuses on lower +level details such as how to write tests, compilation issues, +portability, debugging, etc. +.Sp +If you plan on doing serious C hacking, make sure to read this. +.IP "\(bu" 4 +perlguts +.Sp +This is of paramount importance, since it's the documentation of what +goes where in the Perl source. Read it over a couple of times and it +might start to make sense \- don't worry if it doesn't yet, because the +best way to study it is to read it in conjunction with poking at Perl +source, and we'll do that later on. +.Sp +Gisle Aas's \*(L"illustrated perlguts\*(R", also known as \fIillguts\fR, has very +helpful pictures: +.Sp + +.IP "\(bu" 4 +perlxstut and perlxs +.Sp +A working knowledge of \s-1XSUB\s0 programming is incredibly useful for core +hacking; XSUBs use techniques drawn from the \s-1PP\s0 code, the portion of +the guts that actually executes a Perl program. It's a lot gentler to +learn those techniques from simple examples and explanation than from +the core itself. +.IP "\(bu" 4 +perlapi +.Sp +The documentation for the Perl \s-1API\s0 explains what some of the internal +functions do, as well as the many macros used in the source. +.IP "\(bu" 4 +\&\fIPorting/pumpkin.pod\fR +.Sp +This is a collection of words of wisdom for a Perl porter; some of it +is only useful to the pumpkin holders, but most of it applies to anyone +wanting to go about Perl development. +.SH "CPAN TESTERS AND PERL SMOKERS" +.IX Header "CPAN TESTERS AND PERL SMOKERS" +The \s-1CPAN\s0 testers ( ) are a group of volunteers +who test \s-1CPAN\s0 modules on a variety of platforms. +.PP +Perl Smokers ( and + ) +automatically test Perl source releases on platforms with various +configurations. +.PP +Both efforts welcome volunteers. In order to get involved in smoke +testing of the perl itself visit +. In order to start smoke +testing \s-1CPAN\s0 modules visit + or + or +. +.SH "WHAT NEXT?" +.IX Header "WHAT NEXT?" +If you've read all the documentation in the document and the ones +listed above, you're more than ready to hack on Perl. +.PP +Here's some more recommendations +.IP "\(bu" 4 +Subscribe to perl5\-porters, follow the patches and try and understand +them; don't be afraid to ask if there's a portion you're not clear on \- +who knows, you may unearth a bug in the patch... +.IP "\(bu" 4 +Do read the \s-1README\s0 associated with your operating system, e.g. +\&\s-1README\s0.aix on the \s-1IBM AIX OS.\s0 Don't hesitate to supply patches to that +\&\s-1README\s0 if you find anything missing or changed over a new \s-1OS\s0 release. +.IP "\(bu" 4 +Find an area of Perl that seems interesting to you, and see if you can +work out how it works. Scan through the source, and step over it in +the debugger. Play, poke, investigate, fiddle! You'll probably get to +understand not just your chosen area but a much wider range of +\&\fIperl\fR's activity as well, and probably sooner than you'd think. +.ie n .SS """The Road goes ever on and on, down from the door where it began.""" +.el .SS "``The Road goes ever on and on, down from the door where it began.''" +.IX Subsection "The Road goes ever on and on, down from the door where it began." +If you can do these things, you've started on the long road to Perl +porting. Thanks for wanting to help make Perl better \- and happy +hacking! +.SS "Metaphoric Quotations" +.IX Subsection "Metaphoric Quotations" +If you recognized the quote about the Road above, you're in luck. +.PP +Most software projects begin each file with a literal description of +each file's purpose. Perl instead begins each with a literary allusion +to that file's purpose. +.PP +Like chapters in many books, all top-level Perl source files (along +with a few others here and there) begin with an epigrammatic +inscription that alludes, indirectly and metaphorically, to the +material you're about to read. +.PP +Quotations are taken from writings of J.R.R. Tolkien pertaining to his +Legendarium, almost always from \fIThe Lord of the Rings\fR. Chapters and +page numbers are given using the following editions: +.IP "\(bu" 4 +\&\fIThe Hobbit\fR, by J.R.R. Tolkien. The hardcover, 70th\-anniversary +edition of 2007 was used, published in the \s-1UK\s0 by Harper Collins +Publishers and in the \s-1US\s0 by the Houghton Mifflin Company. +.IP "\(bu" 4 +\&\fIThe Lord of the Rings\fR, by J.R.R. Tolkien. The hardcover, +50th\-anniversary edition of 2004 was used, published in the \s-1UK\s0 by +Harper Collins Publishers and in the \s-1US\s0 by the Houghton Mifflin +Company. +.IP "\(bu" 4 +\&\fIThe Lays of Beleriand\fR, by J.R.R. Tolkien and published posthumously +by his son and literary executor, C.J.R. Tolkien, being the 3rd of the +12 volumes in Christopher's mammoth \fIHistory of Middle Earth\fR. Page +numbers derive from the hardcover edition, first published in 1983 by +George Allen & Unwin; no page numbers changed for the special 3\-volume +omnibus edition of 2002 or the various trade-paper editions, all again +now by Harper Collins or Houghton Mifflin. +.PP +Other \s-1JRRT\s0 books fair game for quotes would thus include \fIThe +Adventures of Tom Bombadil\fR, \fIThe Silmarillion\fR, \fIUnfinished Tales\fR, +and \fIThe Tale of the Children of Hurin\fR, all but the first +posthumously assembled by \s-1CJRT.\s0 But \fIThe Lord of the Rings\fR itself is +perfectly fine and probably best to quote from, provided you can find a +suitable quote there. +.PP +So if you were to supply a new, complete, top-level source file to add +to Perl, you should conform to this peculiar practice by yourself +selecting an appropriate quotation from Tolkien, retaining the original +spelling and punctuation and using the same format the rest of the +quotes are in. Indirect and oblique is just fine; remember, it's a +metaphor, so being meta is, after all, what it's for. +.SH "AUTHOR" +.IX Header "AUTHOR" +This document was originally written by Nathan Torkington, and is +maintained by the perl5\-porters mailing list. diff --git a/data/miniconda3/man/man1/perlhacktips.1 b/data/miniconda3/man/man1/perlhacktips.1 new file mode 100644 index 0000000000000000000000000000000000000000..22f1df00cf5eda5ac0c1426d80d21d330dadab95 --- /dev/null +++ b/data/miniconda3/man/man1/perlhacktips.1 @@ -0,0 +1,1797 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLHACKTIPS 1" +.TH PERLHACKTIPS 1 "2020-12-18" "perl v5.32.1" "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" +perlhacktips \- Tips for Perl core C code hacking +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document will help you learn the best way to go about hacking on +the Perl core C code. It covers common problems, debugging, profiling, +and more. +.PP +If you haven't read perlhack and perlhacktut yet, you might want +to do that first. +.SH "COMMON PROBLEMS" +.IX Header "COMMON PROBLEMS" +Perl source plays by \s-1ANSI C89\s0 rules: no C99 (or \*(C+) extensions. +You don't care about some particular platform having broken Perl? I +hear there is still a strong demand for J2EE programmers. +.SS "Perl environment problems" +.IX Subsection "Perl environment problems" +.IP "\(bu" 4 +Not compiling with threading +.Sp +Compiling with threading (\-Duseithreads) completely rewrites the +function prototypes of Perl. You better try your changes with that. +Related to this is the difference between \*(L"Perl_\-less\*(R" and \*(L"Perl_\-ly\*(R" +APIs, for example: +.Sp +.Vb 2 +\& Perl_sv_setiv(aTHX_ ...); +\& sv_setiv(...); +.Ve +.Sp +The first one explicitly passes in the context, which is needed for +e.g. threaded builds. The second one does that implicitly; do not get +them mixed. If you are not passing in a aTHX_, you will need to do a +dTHX (or a dVAR) as the first thing in the function. +.Sp +See \*(L"How multiple interpreters and concurrency are +supported\*(R" in perlguts for further discussion about context. +.IP "\(bu" 4 +Not compiling with \-DDEBUGGING +.Sp +The \s-1DEBUGGING\s0 define exposes more code to the compiler, therefore more +ways for things to go wrong. You should try it. +.IP "\(bu" 4 +Introducing (non-read-only) globals +.Sp +Do not introduce any modifiable globals, truly global or file static. +They are bad form and complicate multithreading and other forms of +concurrency. The right way is to introduce them as new interpreter +variables, see \fIintrpvar.h\fR (at the very end for binary +compatibility). +.Sp +Introducing read-only (const) globals is okay, as long as you verify +with e.g. \f(CW\*(C`nm libperl.a|egrep \-v \*(Aq [TURtr] \*(Aq\*(C'\fR (if your \f(CW\*(C`nm\*(C'\fR has +BSD-style output) that the data you added really is read-only. (If it +is, it shouldn't show up in the output of that command.) +.Sp +If you want to have static strings, make them constant: +.Sp +.Vb 1 +\& static const char etc[] = "..."; +.Ve +.Sp +If you want to have arrays of constant strings, note carefully the +right combination of \f(CW\*(C`const\*(C'\fRs: +.Sp +.Vb 2 +\& static const char * const yippee[] = +\& {"hi", "ho", "silver"}; +.Ve +.Sp +There is a way to completely hide any modifiable globals (they are all +moved to heap), the compilation setting +\&\f(CW\*(C`\-DPERL_GLOBAL_STRUCT_PRIVATE\*(C'\fR. It is not normally used, but can be +used for testing, read more about it in \*(L"Background and +\&\s-1PERL_IMPLICIT_CONTEXT\*(R"\s0 in perlguts. +.IP "\(bu" 4 +Not exporting your new function +.Sp +Some platforms (Win32, \s-1AIX, VMS, OS/2,\s0 to name a few) require any +function that is part of the public \s-1API\s0 (the shared Perl library) to be +explicitly marked as exported. See the discussion about \fIembed.pl\fR in +perlguts. +.IP "\(bu" 4 +Exporting your new function +.Sp +The new shiny result of either genuine new functionality or your +arduous refactoring is now ready and correctly exported. So what could +possibly go wrong? +.Sp +Maybe simply that your function did not need to be exported in the +first place. Perl has a long and not so glorious history of exporting +functions that it should not have. +.Sp +If the function is used only inside one source code file, make it +static. See the discussion about \fIembed.pl\fR in perlguts. +.Sp +If the function is used across several files, but intended only for +Perl's internal use (and this should be the common case), do not export +it to the public \s-1API.\s0 See the discussion about \fIembed.pl\fR in +perlguts. +.SS "Portability problems" +.IX Subsection "Portability problems" +The following are common causes of compilation and/or execution +failures, not common to Perl as such. The C \s-1FAQ\s0 is good bedtime +reading. Please test your changes with as many C compilers and +platforms as possible; we will, anyway, and it's nice to save oneself +from public embarrassment. +.PP +If using gcc, you can add the \f(CW\*(C`\-std=c89\*(C'\fR option which will hopefully +catch most of these unportabilities. (However it might also catch +incompatibilities in your system's header files.) +.PP +Use the Configure \f(CW\*(C`\-Dgccansipedantic\*(C'\fR flag to enable the gcc \f(CW\*(C`\-ansi +\&\-pedantic\*(C'\fR flags which enforce stricter \s-1ANSI\s0 rules. +.PP +If using the \f(CW\*(C`gcc \-Wall\*(C'\fR note that not all the possible warnings (like +\&\f(CW\*(C`\-Wuninitialized\*(C'\fR) are given unless you also compile with \f(CW\*(C`\-O\*(C'\fR. +.PP +Note that if using gcc, starting from Perl 5.9.5 the Perl core source +code files (the ones at the top level of the source code distribution, +but not e.g. the extensions under ext/) are automatically compiled with +as many as possible of the \f(CW\*(C`\-std=c89\*(C'\fR, \f(CW\*(C`\-ansi\*(C'\fR, \f(CW\*(C`\-pedantic\*(C'\fR, and a +selection of \f(CW\*(C`\-W\*(C'\fR flags (see cflags.SH). +.PP +Also study perlport carefully to avoid any bad assumptions about the +operating system, filesystems, character set, and so forth. +.PP +You may once in a while try a \*(L"make microperl\*(R" to see whether we can +still compile Perl with just the bare minimum of interfaces. (See +\&\s-1README\s0.micro.) +.PP +Do not assume an operating system indicates a certain compiler. +.IP "\(bu" 4 +Casting pointers to integers or casting integers to pointers +.Sp +.Vb 3 +\& void castaway(U8* p) +\& { +\& IV i = p; +.Ve +.Sp +or +.Sp +.Vb 3 +\& void castaway(U8* p) +\& { +\& IV i = (IV)p; +.Ve +.Sp +Both are bad, and broken, and unportable. Use the \s-1\fBPTR2IV\s0()\fR macro that +does it right. (Likewise, there are \s-1\fBPTR2UV\s0()\fR, \s-1\fBPTR2NV\s0()\fR, \s-1\fBINT2PTR\s0()\fR, and +\&\s-1\fBNUM2PTR\s0()\fR.) +.IP "\(bu" 4 +Casting between function pointers and data pointers +.Sp +Technically speaking casting between function pointers and data +pointers is unportable and undefined, but practically speaking it seems +to work, but you should use the \s-1\fBFPTR2DPTR\s0()\fR and \s-1\fBDPTR2FPTR\s0()\fR macros. +Sometimes you can also play games with unions. +.IP "\(bu" 4 +Assuming sizeof(int) == sizeof(long) +.Sp +There are platforms where longs are 64 bits, and platforms where ints +are 64 bits, and while we are out to shock you, even platforms where +shorts are 64 bits. This is all legal according to the C standard. (In +other words, \*(L"long long\*(R" is not a portable way to specify 64 bits, and +\&\*(L"long long\*(R" is not even guaranteed to be any wider than \*(L"long\*(R".) +.Sp +Instead, use the definitions \s-1IV, UV, IVSIZE, I32SIZE,\s0 and so forth. +Avoid things like I32 because they are \fBnot\fR guaranteed to be +\&\fIexactly\fR 32 bits, they are \fIat least\fR 32 bits, nor are they +guaranteed to be \fBint\fR or \fBlong\fR. If you really explicitly need +64\-bit variables, use I64 and U64, but only if guarded by \s-1HAS_QUAD.\s0 +.IP "\(bu" 4 +Assuming one can dereference any type of pointer for any type of data +.Sp +.Vb 2 +\& char *p = ...; +\& long pony = *(long *)p; /* BAD */ +.Ve +.Sp +Many platforms, quite rightly so, will give you a core dump instead of +a pony if the p happens not to be correctly aligned. +.IP "\(bu" 4 +Lvalue casts +.Sp +.Vb 1 +\& (int)*p = ...; /* BAD */ +.Ve +.Sp +Simply not portable. Get your lvalue to be of the right type, or maybe +use temporary variables, or dirty tricks with unions. +.IP "\(bu" 4 +Assume \fBanything\fR about structs (especially the ones you don't +control, like the ones coming from the system headers) +.RS 4 +.IP "\(bu" 8 +That a certain field exists in a struct +.IP "\(bu" 8 +That no other fields exist besides the ones you know of +.IP "\(bu" 8 +That a field is of certain signedness, sizeof, or type +.IP "\(bu" 8 +That the fields are in a certain order +.RS 8 +.IP "\(bu" 8 +While C guarantees the ordering specified in the struct definition, +between different platforms the definitions might differ +.RE +.RS 8 +.RE +.IP "\(bu" 8 +That the sizeof(struct) or the alignments are the same everywhere +.RS 8 +.IP "\(bu" 8 +There might be padding bytes between the fields to align the fields \- +the bytes can be anything +.IP "\(bu" 8 +Structs are required to be aligned to the maximum alignment required by +the fields \- which for native types is for usually equivalent to +\&\fBsizeof()\fR of the field +.RE +.RS 8 +.RE +.RE +.RS 4 +.RE +.IP "\(bu" 4 +Assuming the character set is ASCIIish +.Sp +Perl can compile and run under \s-1EBCDIC\s0 platforms. See perlebcdic. +This is transparent for the most part, but because the character sets +differ, you shouldn't use numeric (decimal, octal, nor hex) constants +to refer to characters. You can safely say \f(CW\*(AqA\*(Aq\fR, but not \f(CW0x41\fR. +You can safely say \f(CW\*(Aq\en\*(Aq\fR, but not \f(CW\*(C`\e012\*(C'\fR. However, you can use +macros defined in \fIutf8.h\fR to specify any code point portably. +\&\f(CW\*(C`LATIN1_TO_NATIVE(0xDF)\*(C'\fR is going to be the code point that means +\&\s-1LATIN SMALL LETTER SHARP S\s0 on whatever platform you are running on (on +\&\s-1ASCII\s0 platforms it compiles without adding any extra code, so there is +zero performance hit on those). The acceptable inputs to +\&\f(CW\*(C`LATIN1_TO_NATIVE\*(C'\fR are from \f(CW0x00\fR through \f(CW0xFF\fR. If your input +isn't guaranteed to be in that range, use \f(CW\*(C`UNICODE_TO_NATIVE\*(C'\fR instead. +\&\f(CW\*(C`NATIVE_TO_LATIN1\*(C'\fR and \f(CW\*(C`NATIVE_TO_UNICODE\*(C'\fR translate the opposite +direction. +.Sp +If you need the string representation of a character that doesn't have a +mnemonic name in C, you should add it to the list in +\&\fIregen/unicode_constants.pl\fR, and have Perl create \f(CW\*(C`#define\*(C'\fR's for you, +based on the current platform. +.Sp +Note that the \f(CW\*(C`is\f(CIFOO\f(CW\*(C'\fR and \f(CW\*(C`to\f(CIFOO\f(CW\*(C'\fR macros in \fIhandy.h\fR work +properly on native code points and strings. +.Sp +Also, the range 'A' \- 'Z' in \s-1ASCII\s0 is an unbroken sequence of 26 upper +case alphabetic characters. That is not true in \s-1EBCDIC.\s0 Nor for 'a' to +\&'z'. But '0' \- '9' is an unbroken range in both systems. Don't assume +anything about other ranges. (Note that special handling of ranges in +regular expression patterns and transliterations makes it appear to Perl +code that the aforementioned ranges are all unbroken.) +.Sp +Many of the comments in the existing code ignore the possibility of +\&\s-1EBCDIC,\s0 and may be wrong therefore, even if the code works. This is +actually a tribute to the successful transparent insertion of being +able to handle \s-1EBCDIC\s0 without having to change pre-existing code. +.Sp +\&\s-1UTF\-8\s0 and UTF-EBCDIC are two different encodings used to represent +Unicode code points as sequences of bytes. Macros with the same names +(but different definitions) in \fIutf8.h\fR and \fIutfebcdic.h\fR are used to +allow the calling code to think that there is only one such encoding. +This is almost always referred to as \f(CW\*(C`utf8\*(C'\fR, but it means the \s-1EBCDIC\s0 +version as well. Again, comments in the code may well be wrong even if +the code itself is right. For example, the concept of \s-1UTF\-8\s0 \f(CW\*(C`invariant +characters\*(C'\fR differs between \s-1ASCII\s0 and \s-1EBCDIC.\s0 On \s-1ASCII\s0 platforms, only +characters that do not have the high-order bit set (i.e. whose ordinals +are strict \s-1ASCII, 0\s0 \- 127) are invariant, and the documentation and +comments in the code may assume that, often referring to something +like, say, \f(CW\*(C`hibit\*(C'\fR. The situation differs and is not so simple on +\&\s-1EBCDIC\s0 machines, but as long as the code itself uses the +\&\f(CW\*(C`NATIVE_IS_INVARIANT()\*(C'\fR macro appropriately, it works, even if the +comments are wrong. +.Sp +As noted in \*(L"\s-1TESTING\*(R"\s0 in perlhack, when writing test scripts, the file +\&\fIt/charset_tools.pl\fR contains some helpful functions for writing tests +valid on both \s-1ASCII\s0 and \s-1EBCDIC\s0 platforms. Sometimes, though, a test +can't use a function and it's inconvenient to have different test +versions depending on the platform. There are 20 code points that are +the same in all 4 character sets currently recognized by Perl (the 3 +\&\s-1EBCDIC\s0 code pages plus \s-1ISO 8859\-1\s0 (ASCII/Latin1)). These can be used in +such tests, though there is a small possibility that Perl will become +available in yet another character set, breaking your test. All but one +of these code points are C0 control characters. The most significant +controls that are the same are \f(CW\*(C`\e0\*(C'\fR, \f(CW\*(C`\er\*(C'\fR, and \f(CW\*(C`\eN{VT}\*(C'\fR (also +specifiable as \f(CW\*(C`\ecK\*(C'\fR, \f(CW\*(C`\ex0B\*(C'\fR, \f(CW\*(C`\eN{U+0B}\*(C'\fR, or \f(CW\*(C`\e013\*(C'\fR). The single +non-control is U+00B6 \s-1PILCROW SIGN.\s0 The controls that are the same have +the same bit pattern in all 4 character sets, regardless of the UTF8ness +of the string containing them. The bit pattern for U+B6 is the same in +all 4 for non\-UTF8 strings, but differs in each when its containing +string is \s-1UTF\-8\s0 encoded. The only other code points that have some sort +of sameness across all 4 character sets are the pair 0xDC and 0xFC. +Together these represent upper\- and lowercase \s-1LATIN LETTER U WITH +DIAERESIS,\s0 but which is upper and which is lower may be reversed: 0xDC +is the capital in Latin1 and 0xFC is the small letter, while 0xFC is the +capital in \s-1EBCDIC\s0 and 0xDC is the small one. This factoid may be +exploited in writing case insensitive tests that are the same across all +4 character sets. +.IP "\(bu" 4 +Assuming the character set is just \s-1ASCII\s0 +.Sp +\&\s-1ASCII\s0 is a 7 bit encoding, but bytes have 8 bits in them. The 128 extra +characters have different meanings depending on the locale. Absent a +locale, currently these extra characters are generally considered to be +unassigned, and this has presented some problems. This has being +changed starting in 5.12 so that these characters can be considered to +be Latin\-1 (\s-1ISO\-8859\-1\s0). +.IP "\(bu" 4 +Mixing #define and #ifdef +.Sp +.Vb 6 +\& #define BURGLE(x) ... \e +\& #ifdef BURGLE_OLD_STYLE /* BAD */ +\& ... do it the old way ... \e +\& #else +\& ... do it the new way ... \e +\& #endif +.Ve +.Sp +You cannot portably \*(L"stack\*(R" cpp directives. For example in the above +you need two separate \s-1\fBBURGLE\s0()\fR #defines, one for each #ifdef branch. +.IP "\(bu" 4 +Adding non-comment stuff after #endif or #else +.Sp +.Vb 5 +\& #ifdef SNOSH +\& ... +\& #else !SNOSH /* BAD */ +\& ... +\& #endif SNOSH /* BAD */ +.Ve +.Sp +The #endif and #else cannot portably have anything non-comment after +them. If you want to document what is going (which is a good idea +especially if the branches are long), use (C) comments: +.Sp +.Vb 5 +\& #ifdef SNOSH +\& ... +\& #else /* !SNOSH */ +\& ... +\& #endif /* SNOSH */ +.Ve +.Sp +The gcc option \f(CW\*(C`\-Wendif\-labels\*(C'\fR warns about the bad variant (by +default on starting from Perl 5.9.4). +.IP "\(bu" 4 +Having a comma after the last element of an enum list +.Sp +.Vb 5 +\& enum color { +\& CERULEAN, +\& CHARTREUSE, +\& CINNABAR, /* BAD */ +\& }; +.Ve +.Sp +is not portable. Leave out the last comma. +.Sp +Also note that whether enums are implicitly morphable to ints varies +between compilers, you might need to (int). +.IP "\(bu" 4 +Using //\-comments +.Sp +.Vb 1 +\& // This function bamfoodles the zorklator. /* BAD */ +.Ve +.Sp +That is C99 or \*(C+. Perl is C89. Using the //\-comments is silently +allowed by many C compilers but cranking up the \s-1ANSI C89\s0 strictness +(which we like to do) causes the compilation to fail. +.IP "\(bu" 4 +Mixing declarations and code +.Sp +.Vb 5 +\& void zorklator() +\& { +\& int n = 3; +\& set_zorkmids(n); /* BAD */ +\& int q = 4; +.Ve +.Sp +That is C99 or \*(C+. Some C compilers allow that, but you shouldn't. +.Sp +The gcc option \f(CW\*(C`\-Wdeclaration\-after\-statement\*(C'\fR scans for such +problems (by default on starting from Perl 5.9.4). +.IP "\(bu" 4 +Introducing variables inside \fBfor()\fR +.Sp +.Vb 1 +\& for(int i = ...; ...; ...) { /* BAD */ +.Ve +.Sp +That is C99 or \*(C+. While it would indeed be awfully nice to have that +also in C89, to limit the scope of the loop variable, alas, we cannot. +.IP "\(bu" 4 +Mixing signed char pointers with unsigned char pointers +.Sp +.Vb 4 +\& int foo(char *s) { ... } +\& ... +\& unsigned char *t = ...; /* Or U8* t = ... */ +\& foo(t); /* BAD */ +.Ve +.Sp +While this is legal practice, it is certainly dubious, and downright +fatal in at least one platform: for example \s-1VMS\s0 cc considers this a +fatal error. One cause for people often making this mistake is that a +\&\*(L"naked char\*(R" and therefore dereferencing a \*(L"naked char pointer\*(R" have an +undefined signedness: it depends on the compiler and the flags of the +compiler and the underlying platform whether the result is signed or +unsigned. For this very same reason using a 'char' as an array index is +bad. +.IP "\(bu" 4 +Macros that have string constants and their arguments as substrings of +the string constants +.Sp +.Vb 2 +\& #define FOO(n) printf("number = %d\en", n) /* BAD */ +\& FOO(10); +.Ve +.Sp +Pre-ANSI semantics for that was equivalent to +.Sp +.Vb 1 +\& printf("10umber = %d\e10"); +.Ve +.Sp +which is probably not what you were expecting. Unfortunately at least +one reasonably common and modern C compiler does \*(L"real backward +compatibility\*(R" here, in \s-1AIX\s0 that is what still happens even though the +rest of the \s-1AIX\s0 compiler is very happily C89. +.IP "\(bu" 4 +Using printf formats for non-basic C types +.Sp +.Vb 2 +\& IV i = ...; +\& printf("i = %d\en", i); /* BAD */ +.Ve +.Sp +While this might by accident work in some platform (where \s-1IV\s0 happens to +be an \f(CW\*(C`int\*(C'\fR), in general it cannot. \s-1IV\s0 might be something larger. Even +worse the situation is with more specific types (defined by Perl's +configuration step in \fIconfig.h\fR): +.Sp +.Vb 2 +\& Uid_t who = ...; +\& printf("who = %d\en", who); /* BAD */ +.Ve +.Sp +The problem here is that Uid_t might be not only not \f(CW\*(C`int\*(C'\fR\-wide but it +might also be unsigned, in which case large uids would be printed as +negative values. +.Sp +There is no simple solution to this because of \fBprintf()\fR's limited +intelligence, but for many types the right format is available as with +either 'f' or '_f' suffix, for example: +.Sp +.Vb 2 +\& IVdf /* IV in decimal */ +\& UVxf /* UV is hexadecimal */ +\& +\& printf("i = %"IVdf"\en", i); /* The IVdf is a string constant. */ +\& +\& Uid_t_f /* Uid_t in decimal */ +\& +\& printf("who = %"Uid_t_f"\en", who); +.Ve +.Sp +Or you can try casting to a \*(L"wide enough\*(R" type: +.Sp +.Vb 1 +\& printf("i = %"IVdf"\en", (IV)something_very_small_and_signed); +.Ve +.Sp +See \*(L"Formatted Printing of Size_t and SSize_t\*(R" in perlguts for how to +print those. +.Sp +Also remember that the \f(CW%p\fR format really does require a void pointer: +.Sp +.Vb 2 +\& U8* p = ...; +\& printf("p = %p\en", (void*)p); +.Ve +.Sp +The gcc option \f(CW\*(C`\-Wformat\*(C'\fR scans for such problems. +.IP "\(bu" 4 +Blindly using variadic macros +.Sp +gcc has had them for a while with its own syntax, and C99 brought them +with a standardized syntax. Don't use the former, and use the latter +only if the \s-1HAS_C99_VARIADIC_MACROS\s0 is defined. +.IP "\(bu" 4 +Blindly passing va_list +.Sp +Not all platforms support passing va_list to further varargs (stdarg) +functions. The right thing to do is to copy the va_list using the +\&\fBPerl_va_copy()\fR if the \s-1NEED_VA_COPY\s0 is defined. +.IP "\(bu" 4 +Using gcc statement expressions +.Sp +.Vb 1 +\& val = ({...;...;...}); /* BAD */ +.Ve +.Sp +While a nice extension, it's not portable. The Perl code does +admittedly use them if available to gain some extra speed (essentially +as a funky form of inlining), but you shouldn't. +.IP "\(bu" 4 +Binding together several statements in a macro +.Sp +Use the macros \s-1STMT_START\s0 and \s-1STMT_END.\s0 +.Sp +.Vb 3 +\& STMT_START { +\& ... +\& } STMT_END +.Ve +.IP "\(bu" 4 +Testing for operating systems or versions when should be testing for +features +.Sp +.Vb 3 +\& #ifdef _\|_FOONIX_\|_ /* BAD */ +\& foo = quux(); +\& #endif +.Ve +.Sp +Unless you know with 100% certainty that \fBquux()\fR is only ever available +for the \*(L"Foonix\*(R" operating system \fBand\fR that is available \fBand\fR +correctly working for \fBall\fR past, present, \fBand\fR future versions of +\&\*(L"Foonix\*(R", the above is very wrong. This is more correct (though still +not perfect, because the below is a compile-time check): +.Sp +.Vb 3 +\& #ifdef HAS_QUUX +\& foo = quux(); +\& #endif +.Ve +.Sp +How does the \s-1HAS_QUUX\s0 become defined where it needs to be? Well, if +Foonix happens to be Unixy enough to be able to run the Configure +script, and Configure has been taught about detecting and testing +\&\fBquux()\fR, the \s-1HAS_QUUX\s0 will be correctly defined. In other platforms, the +corresponding configuration step will hopefully do the same. +.Sp +In a pinch, if you cannot wait for Configure to be educated, or if you +have a good hunch of where \fBquux()\fR might be available, you can +temporarily try the following: +.Sp +.Vb 3 +\& #if (defined(_\|_FOONIX_\|_) || defined(_\|_BARNIX_\|_)) +\& # define HAS_QUUX +\& #endif +\& +\& ... +\& +\& #ifdef HAS_QUUX +\& foo = quux(); +\& #endif +.Ve +.Sp +But in any case, try to keep the features and operating systems +separate. +.Sp +A good resource on the predefined macros for various operating +systems, compilers, and so forth is + +.IP "\(bu" 4 +Assuming the contents of static memory pointed to by the return values +of Perl wrappers for C library functions doesn't change. Many C library +functions return pointers to static storage that can be overwritten by +subsequent calls to the same or related functions. Perl has +light-weight wrappers for some of these functions, and which don't make +copies of the static memory. A good example is the interface to the +environment variables that are in effect for the program. Perl has +\&\f(CW\*(C`PerlEnv_getenv\*(C'\fR to get values from the environment. But the return is +a pointer to static memory in the C library. If you are using the value +to immediately test for something, that's fine, but if you save the +value and expect it to be unchanged by later processing, you would be +wrong, but perhaps you wouldn't know it because different C library +implementations behave differently, and the one on the platform you're +testing on might work for your situation. But on some platforms, a +subsequent call to \f(CW\*(C`PerlEnv_getenv\*(C'\fR or related function \s-1WILL\s0 overwrite +the memory that your first call points to. This has led to some +hard-to-debug problems. Do a \*(L"savepv\*(R" in perlapi to make a copy, thus +avoiding these problems. You will have to free the copy when you're +done to avoid memory leaks. If you don't have control over when it gets +freed, you'll need to make the copy in a mortal scalar, like so: +.Sp +.Vb 6 +\& if ((s = PerlEnv_getenv("foo") == NULL) { +\& ... /* handle NULL case */ +\& } +\& else { +\& s = SvPVX(sv_2mortal(newSVpv(s, 0))); +\& } +.Ve +.Sp +The above example works only if \f(CW"s"\fR is \f(CW\*(C`NUL\*(C'\fR\-terminated; otherwise +you have to pass its length to \f(CW\*(C`newSVpv\*(C'\fR. +.SS "Problematic System Interfaces" +.IX Subsection "Problematic System Interfaces" +.IP "\(bu" 4 +Perl strings are \s-1NOT\s0 the same as C strings: They may contain \f(CW\*(C`NUL\*(C'\fR +characters, whereas a C string is terminated by the first \f(CW\*(C`NUL\*(C'\fR. +That is why Perl \s-1API\s0 functions that deal with strings generally take a +pointer to the first byte and either a length or a pointer to the byte +just beyond the final one. +.Sp +And this is the reason that many of the C library string handling +functions should not be used. They don't cope with the full generality +of Perl strings. It may be that your test cases don't have embedded +\&\f(CW\*(C`NUL\*(C'\fRs, and so the tests pass, whereas there may well eventually arise +real-world cases where they fail. A lesson here is to include \f(CW\*(C`NUL\*(C'\fRs +in your tests. Now it's fairly rare in most real world cases to get +\&\f(CW\*(C`NUL\*(C'\fRs, so your code may seem to work, until one day a \f(CW\*(C`NUL\*(C'\fR comes +along. +.Sp +Here's an example. It used to be a common paradigm, for decades, in the +perl core to use \f(CW\*(C`strchr("list",\ c)\*(C'\fR to see if the character \f(CW\*(C`c\*(C'\fR is +any of the ones given in \f(CW"list"\fR, a double-quote-enclosed string of +the set of characters that we are seeing if \f(CW\*(C`c\*(C'\fR is one of. As long as +\&\f(CW\*(C`c\*(C'\fR isn't a \f(CW\*(C`NUL\*(C'\fR, it works. But when \f(CW\*(C`c\*(C'\fR is a \f(CW\*(C`NUL\*(C'\fR, \f(CW\*(C`strchr\*(C'\fR +returns a pointer to the terminating \f(CW\*(C`NUL\*(C'\fR in \f(CW"list"\fR. This likely +will result in a segfault or a security issue when the caller uses that +end pointer as the starting point to read from. +.Sp +A solution to this and many similar issues is to use the \f(CW\*(C`mem\*(C'\fR\fI\-foo\fR C +library functions instead. In this case \f(CW\*(C`memchr\*(C'\fR can be used to see if +\&\f(CW\*(C`c\*(C'\fR is in \f(CW"list"\fR and works even if \f(CW\*(C`c\*(C'\fR is \f(CW\*(C`NUL\*(C'\fR. These functions +need an additional parameter to give the string length. +In the case of literal string parameters, perl has defined macros that +calculate the length for you. See \*(L"Miscellaneous Functions\*(R" in perlapi. +.IP "\(bu" 4 +\&\fBmalloc\fR\|(0), \fBrealloc\fR\|(0), calloc(0, 0) are non-portable. To be portable +allocate at least one byte. (In general you should rarely need to work +at this low level, but instead use the various malloc wrappers.) +.IP "\(bu" 4 +\&\fBsnprintf()\fR \- the return type is unportable. Use \fBmy_snprintf()\fR instead. +.SS "Security problems" +.IX Subsection "Security problems" +Last but not least, here are various tips for safer coding. +See also perlclib for libc/stdio replacements one should use. +.IP "\(bu" 4 +Do not use \fBgets()\fR +.Sp +Or we will publicly ridicule you. Seriously. +.IP "\(bu" 4 +Do not use \fBtmpfile()\fR +.Sp +Use \fBmkstemp()\fR instead. +.IP "\(bu" 4 +Do not use \fBstrcpy()\fR or \fBstrcat()\fR or \fBstrncpy()\fR or \fBstrncat()\fR +.Sp +Use \fBmy_strlcpy()\fR and \fBmy_strlcat()\fR instead: they either use the native +implementation, or Perl's own implementation (borrowed from the public +domain implementation of \s-1INN\s0). +.IP "\(bu" 4 +Do not use \fBsprintf()\fR or \fBvsprintf()\fR +.Sp +If you really want just plain byte strings, use \fBmy_snprintf()\fR and +\&\fBmy_vsnprintf()\fR instead, which will try to use \fBsnprintf()\fR and +\&\fBvsnprintf()\fR if those safer APIs are available. If you want something +fancier than a plain byte string, use +\&\f(CW\*(C`Perl_form\*(C'\fR() or SVs and +\&\f(CW\*(C`Perl_sv_catpvf()\*(C'\fR. +.Sp +Note that glibc \f(CW\*(C`printf()\*(C'\fR, \f(CW\*(C`sprintf()\*(C'\fR, etc. are buggy before glibc +version 2.17. They won't allow a \f(CW\*(C`%.s\*(C'\fR format with a precision to +create a string that isn't valid \s-1UTF\-8\s0 if the current underlying locale +of the program is \s-1UTF\-8.\s0 What happens is that the \f(CW%s\fR and its operand are +simply skipped without any notice. +. +.IP "\(bu" 4 +Do not use \fBatoi()\fR +.Sp +Use \fBgrok_atoUV()\fR instead. \fBatoi()\fR has ill-defined behavior on overflows, +and cannot be used for incremental parsing. It is also affected by locale, +which is bad. +.IP "\(bu" 4 +Do not use \fBstrtol()\fR or \fBstrtoul()\fR +.Sp +Use \fBgrok_atoUV()\fR instead. \fBstrtol()\fR or \fBstrtoul()\fR (or their IV/UV\-friendly +macro disguises, \fBStrtol()\fR and \fBStrtoul()\fR, or \fBAtol()\fR and \fBAtoul()\fR are +affected by locale, which is bad. +.SH "DEBUGGING" +.IX Header "DEBUGGING" +You can compile a special debugging version of Perl, which allows you +to use the \f(CW\*(C`\-D\*(C'\fR option of Perl to tell more about what Perl is doing. +But sometimes there is no alternative than to dive in with a debugger, +either to see the stack trace of a core dump (very useful in a bug +report), or trying to figure out what went wrong before the core dump +happened, or how did we end up having wrong or unexpected results. +.SS "Poking at Perl" +.IX Subsection "Poking at Perl" +To really poke around with Perl, you'll probably want to build Perl for +debugging, like this: +.PP +.Vb 2 +\& ./Configure \-d \-DDEBUGGING +\& make +.Ve +.PP +\&\f(CW\*(C`\-DDEBUGGING\*(C'\fR turns on the C compiler's \f(CW\*(C`\-g\*(C'\fR flag to have it produce +debugging information which will allow us to step through a running +program, and to see in which C function we are at (without the debugging +information we might see only the numerical addresses of the functions, +which is not very helpful). It will also turn on the \f(CW\*(C`DEBUGGING\*(C'\fR +compilation symbol which enables all the internal debugging code in Perl. +There are a whole bunch of things you can debug with this: +perlrun lists them all, and the best way to find out +about them is to play about with them. The most useful options are +probably +.PP +.Vb 5 +\& l Context (loop) stack processing +\& s Stack snapshots (with v, displays all stacks) +\& t Trace execution +\& o Method and overloading resolution +\& c String/numeric conversions +.Ve +.PP +For example +.PP +.Vb 8 +\& $ perl \-Dst \-e \*(Aq$a + 1\*(Aq +\& .... +\& (\-e:1) gvsv(main::a) +\& => UNDEF +\& (\-e:1) const(IV(1)) +\& => UNDEF IV(1) +\& (\-e:1) add +\& => NV(1) +.Ve +.PP +Some of the functionality of the debugging code can be achieved with a +non-debugging perl by using \s-1XS\s0 modules: +.PP +.Vb 2 +\& \-Dr => use re \*(Aqdebug\*(Aq +\& \-Dx => use O \*(AqDebug\*(Aq +.Ve +.SS "Using a source-level debugger" +.IX Subsection "Using a source-level debugger" +If the debugging output of \f(CW\*(C`\-D\*(C'\fR doesn't help you, it's time to step +through perl's execution with a source-level debugger. +.IP "\(bu" 3 +We'll use \f(CW\*(C`gdb\*(C'\fR for our examples here; the principles will apply to +any debugger (many vendors call their debugger \f(CW\*(C`dbx\*(C'\fR), but check the +manual of the one you're using. +.PP +To fire up the debugger, type +.PP +.Vb 1 +\& gdb ./perl +.Ve +.PP +Or if you have a core dump: +.PP +.Vb 1 +\& gdb ./perl core +.Ve +.PP +You'll want to do that in your Perl source tree so the debugger can +read the source code. You should see the copyright message, followed by +the prompt. +.PP +.Vb 1 +\& (gdb) +.Ve +.PP +\&\f(CW\*(C`help\*(C'\fR will get you into the documentation, but here are the most +useful commands: +.IP "\(bu" 3 +run [args] +.Sp +Run the program with the given arguments. +.IP "\(bu" 3 +break function_name +.IP "\(bu" 3 +break source.c:xxx +.Sp +Tells the debugger that we'll want to pause execution when we reach +either the named function (but see \*(L"Internal Functions\*(R" in perlguts!) or +the given line in the named source file. +.IP "\(bu" 3 +step +.Sp +Steps through the program a line at a time. +.IP "\(bu" 3 +next +.Sp +Steps through the program a line at a time, without descending into +functions. +.IP "\(bu" 3 +continue +.Sp +Run until the next breakpoint. +.IP "\(bu" 3 +finish +.Sp +Run until the end of the current function, then stop again. +.IP "\(bu" 3 +\&'enter' +.Sp +Just pressing Enter will do the most recent operation again \- it's a +blessing when stepping through miles of source code. +.IP "\(bu" 3 +ptype +.Sp +Prints the C definition of the argument given. +.Sp +.Vb 10 +\& (gdb) ptype PL_op +\& type = struct op { +\& OP *op_next; +\& OP *op_sibparent; +\& OP *(*op_ppaddr)(void); +\& PADOFFSET op_targ; +\& unsigned int op_type : 9; +\& unsigned int op_opt : 1; +\& unsigned int op_slabbed : 1; +\& unsigned int op_savefree : 1; +\& unsigned int op_static : 1; +\& unsigned int op_folded : 1; +\& unsigned int op_spare : 2; +\& U8 op_flags; +\& U8 op_private; +\& } * +.Ve +.IP "\(bu" 3 +print +.Sp +Execute the given C code and print its results. \fB\s-1WARNING\s0\fR: Perl makes +heavy use of macros, and \fIgdb\fR does not necessarily support macros +(see later \*(L"gdb macro support\*(R"). You'll have to substitute them +yourself, or to invoke cpp on the source code files (see \*(L"The .i +Targets\*(R") So, for instance, you can't say +.Sp +.Vb 1 +\& print SvPV_nolen(sv) +.Ve +.Sp +but you have to say +.Sp +.Vb 1 +\& print Perl_sv_2pv_nolen(sv) +.Ve +.PP +You may find it helpful to have a \*(L"macro dictionary\*(R", which you can +produce by saying \f(CW\*(C`cpp \-dM perl.c | sort\*(C'\fR. Even then, \fIcpp\fR won't +recursively apply those macros for you. +.SS "gdb macro support" +.IX Subsection "gdb macro support" +Recent versions of \fIgdb\fR have fairly good macro support, but in order +to use it you'll need to compile perl with macro definitions included +in the debugging information. Using \fIgcc\fR version 3.1, this means +configuring with \f(CW\*(C`\-Doptimize=\-g3\*(C'\fR. Other compilers might use a +different switch (if they support debugging macros at all). +.SS "Dumping Perl Data Structures" +.IX Subsection "Dumping Perl Data Structures" +One way to get around this macro hell is to use the dumping functions +in \fIdump.c\fR; these work a little like an internal +Devel::Peek, but they also cover OPs and other +structures that you can't get at from Perl. Let's take an example. +We'll use the \f(CW\*(C`$a = $b + $c\*(C'\fR we used before, but give it a bit of +context: \f(CW\*(C`$b = "6XXXX"; $c = 2.3;\*(C'\fR. Where's a good place to stop and +poke around? +.PP +What about \f(CW\*(C`pp_add\*(C'\fR, the function we examined earlier to implement the +\&\f(CW\*(C`+\*(C'\fR operator: +.PP +.Vb 2 +\& (gdb) break Perl_pp_add +\& Breakpoint 1 at 0x46249f: file pp_hot.c, line 309. +.Ve +.PP +Notice we use \f(CW\*(C`Perl_pp_add\*(C'\fR and not \f(CW\*(C`pp_add\*(C'\fR \- see +\&\*(L"Internal Functions\*(R" in perlguts. With the breakpoint in place, we can +run our program: +.PP +.Vb 1 +\& (gdb) run \-e \*(Aq$b = "6XXXX"; $c = 2.3; $a = $b + $c\*(Aq +.Ve +.PP +Lots of junk will go past as gdb reads in the relevant source files and +libraries, and then: +.PP +.Vb 5 +\& Breakpoint 1, Perl_pp_add () at pp_hot.c:309 +\& 1396 dSP; dATARGET; bool useleft; SV *svl, *svr; +\& (gdb) step +\& 311 dPOPTOPnnrl_ul; +\& (gdb) +.Ve +.PP +We looked at this bit of code before, and we said that +\&\f(CW\*(C`dPOPTOPnnrl_ul\*(C'\fR arranges for two \f(CW\*(C`NV\*(C'\fRs to be placed into \f(CW\*(C`left\*(C'\fR and +\&\f(CW\*(C`right\*(C'\fR \- let's slightly expand it: +.PP +.Vb 3 +\& #define dPOPTOPnnrl_ul NV right = POPn; \e +\& SV *leftsv = TOPs; \e +\& NV left = USE_LEFT(leftsv) ? SvNV(leftsv) : 0.0 +.Ve +.PP +\&\f(CW\*(C`POPn\*(C'\fR takes the \s-1SV\s0 from the top of the stack and obtains its \s-1NV\s0 +either directly (if \f(CW\*(C`SvNOK\*(C'\fR is set) or by calling the \f(CW\*(C`sv_2nv\*(C'\fR +function. \f(CW\*(C`TOPs\*(C'\fR takes the next \s-1SV\s0 from the top of the stack \- yes, +\&\f(CW\*(C`POPn\*(C'\fR uses \f(CW\*(C`TOPs\*(C'\fR \- but doesn't remove it. We then use \f(CW\*(C`SvNV\*(C'\fR to +get the \s-1NV\s0 from \f(CW\*(C`leftsv\*(C'\fR in the same way as before \- yes, \f(CW\*(C`POPn\*(C'\fR uses +\&\f(CW\*(C`SvNV\*(C'\fR. +.PP +Since we don't have an \s-1NV\s0 for \f(CW$b\fR, we'll have to use \f(CW\*(C`sv_2nv\*(C'\fR to +convert it. If we step again, we'll find ourselves there: +.PP +.Vb 4 +\& (gdb) step +\& Perl_sv_2nv (sv=0xa0675d0) at sv.c:1669 +\& 1669 if (!sv) +\& (gdb) +.Ve +.PP +We can now use \f(CW\*(C`Perl_sv_dump\*(C'\fR to investigate the \s-1SV:\s0 +.PP +.Vb 8 +\& (gdb) print Perl_sv_dump(sv) +\& SV = PV(0xa057cc0) at 0xa0675d0 +\& REFCNT = 1 +\& FLAGS = (POK,pPOK) +\& PV = 0xa06a510 "6XXXX"\e0 +\& CUR = 5 +\& LEN = 6 +\& $1 = void +.Ve +.PP +We know we're going to get \f(CW6\fR from this, so let's finish the +subroutine: +.PP +.Vb 4 +\& (gdb) finish +\& Run till exit from #0 Perl_sv_2nv (sv=0xa0675d0) at sv.c:1671 +\& 0x462669 in Perl_pp_add () at pp_hot.c:311 +\& 311 dPOPTOPnnrl_ul; +.Ve +.PP +We can also dump out this op: the current op is always stored in +\&\f(CW\*(C`PL_op\*(C'\fR, and we can dump it with \f(CW\*(C`Perl_op_dump\*(C'\fR. This'll give us +similar output to \s-1CPAN\s0 module B::Debug. +.PP +.Vb 10 +\& (gdb) print Perl_op_dump(PL_op) +\& { +\& 13 TYPE = add ===> 14 +\& TARG = 1 +\& FLAGS = (SCALAR,KIDS) +\& { +\& TYPE = null ===> (12) +\& (was rv2sv) +\& FLAGS = (SCALAR,KIDS) +\& { +\& 11 TYPE = gvsv ===> 12 +\& FLAGS = (SCALAR) +\& GV = main::b +\& } +\& } +.Ve +.PP +# finish this later # +.SS "Using gdb to look at specific parts of a program" +.IX Subsection "Using gdb to look at specific parts of a program" +With the example above, you knew to look for \f(CW\*(C`Perl_pp_add\*(C'\fR, but what if +there were multiple calls to it all over the place, or you didn't know what +the op was you were looking for? +.PP +One way to do this is to inject a rare call somewhere near what you're looking +for. For example, you could add \f(CW\*(C`study\*(C'\fR before your method: +.PP +.Vb 1 +\& study; +.Ve +.PP +And in gdb do: +.PP +.Vb 1 +\& (gdb) break Perl_pp_study +.Ve +.PP +And then step until you hit what you're +looking for. This works well in a loop +if you want to only break at certain iterations: +.PP +.Vb 3 +\& for my $c (1..100) { +\& study if $c == 50; +\& } +.Ve +.SS "Using gdb to look at what the parser/lexer are doing" +.IX Subsection "Using gdb to look at what the parser/lexer are doing" +If you want to see what perl is doing when parsing/lexing your code, you can +use \f(CW\*(C`BEGIN {}\*(C'\fR: +.PP +.Vb 3 +\& print "Before\en"; +\& BEGIN { study; } +\& print "After\en"; +.Ve +.PP +And in gdb: +.PP +.Vb 1 +\& (gdb) break Perl_pp_study +.Ve +.PP +If you want to see what the parser/lexer is doing inside of \f(CW\*(C`if\*(C'\fR blocks and +the like you need to be a little trickier: +.PP +.Vb 1 +\& if ($a && $b && do { BEGIN { study } 1 } && $c) { ... } +.Ve +.SH "SOURCE CODE STATIC ANALYSIS" +.IX Header "SOURCE CODE STATIC ANALYSIS" +Various tools exist for analysing C source code \fBstatically\fR, as +opposed to \fBdynamically\fR, that is, without executing the code. It is +possible to detect resource leaks, undefined behaviour, type +mismatches, portability problems, code paths that would cause illegal +memory accesses, and other similar problems by just parsing the C code +and looking at the resulting graph, what does it tell about the +execution and data flows. As a matter of fact, this is exactly how C +compilers know to give warnings about dubious code. +.SS "lint" +.IX Subsection "lint" +The good old C code quality inspector, \f(CW\*(C`lint\*(C'\fR, is available in several +platforms, but please be aware that there are several different +implementations of it by different vendors, which means that the flags +are not identical across different platforms. +.PP +There is a \f(CW\*(C`lint\*(C'\fR target in Makefile, but you may have to +diddle with the flags (see above). +.SS "Coverity" +.IX Subsection "Coverity" +Coverity () is a product similar to lint and as +a testbed for their product they periodically check several open source +projects, and they give out accounts to open source developers to the +defect databases. +.PP +There is Coverity setup for the perl5 project: + +.SS "HP-UX cadvise (Code Advisor)" +.IX Subsection "HP-UX cadvise (Code Advisor)" +\&\s-1HP\s0 has a C/\*(C+ static analyzer product for HP-UX caller Code Advisor. +(Link not given here because the \s-1URL\s0 is horribly long and seems horribly +unstable; use the search engine of your choice to find it.) The use of +the \f(CW\*(C`cadvise_cc\*(C'\fR recipe with \f(CW\*(C`Configure ... \-Dcc=./cadvise_cc\*(C'\fR +(see cadvise \*(L"User Guide\*(R") is recommended; as is the use of \f(CW\*(C`+wall\*(C'\fR. +.SS "cpd (cut-and-paste detector)" +.IX Subsection "cpd (cut-and-paste detector)" +The cpd tool detects cut-and-paste coding. If one instance of the +cut-and-pasted code changes, all the other spots should probably be +changed, too. Therefore such code should probably be turned into a +subroutine or a macro. +.PP +cpd () is part of the pmd project +(). pmd was originally written for static +analysis of Java code, but later the cpd part of it was extended to +parse also C and \*(C+. +.PP +Download the pmd\-bin\-X.Y.zip () from the SourceForge site, extract the +pmd\-X.Y.jar from it, and then run that on source code thusly: +.PP +.Vb 2 +\& java \-cp pmd\-X.Y.jar net.sourceforge.pmd.cpd.CPD \e +\& \-\-minimum\-tokens 100 \-\-files /some/where/src \-\-language c > cpd.txt +.Ve +.PP +You may run into memory limits, in which case you should use the \-Xmx +option: +.PP +.Vb 1 +\& java \-Xmx512M ... +.Ve +.SS "gcc warnings" +.IX Subsection "gcc warnings" +Though much can be written about the inconsistency and coverage +problems of gcc warnings (like \f(CW\*(C`\-Wall\*(C'\fR not meaning \*(L"all the warnings\*(R", +or some common portability problems not being covered by \f(CW\*(C`\-Wall\*(C'\fR, or +\&\f(CW\*(C`\-ansi\*(C'\fR and \f(CW\*(C`\-pedantic\*(C'\fR both being a poorly defined collection of +warnings, and so forth), gcc is still a useful tool in keeping our +coding nose clean. +.PP +The \f(CW\*(C`\-Wall\*(C'\fR is by default on. +.PP +The \f(CW\*(C`\-ansi\*(C'\fR (and its sidekick, \f(CW\*(C`\-pedantic\*(C'\fR) would be nice to be on +always, but unfortunately they are not safe on all platforms, they can +for example cause fatal conflicts with the system headers (Solaris +being a prime example). If Configure \f(CW\*(C`\-Dgccansipedantic\*(C'\fR is used, the +\&\f(CW\*(C`cflags\*(C'\fR frontend selects \f(CW\*(C`\-ansi \-pedantic\*(C'\fR for the platforms where +they are known to be safe. +.PP +The following extra flags are added: +.IP "\(bu" 4 +\&\f(CW\*(C`\-Wendif\-labels\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`\-Wextra\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`\-Wc++\-compat\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`\-Wwrite\-strings\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`\-Werror=declaration\-after\-statement\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`\-Werror=pointer\-arith\*(C'\fR +.PP +The following flags would be nice to have but they would first need +their own Augean stablemaster: +.IP "\(bu" 4 +\&\f(CW\*(C`\-Wshadow\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`\-Wstrict\-prototypes\*(C'\fR +.PP +The \f(CW\*(C`\-Wtraditional\*(C'\fR is another example of the annoying tendency of gcc +to bundle a lot of warnings under one switch (it would be impossible to +deploy in practice because it would complain a lot) but it does contain +some warnings that would be beneficial to have available on their own, +such as the warning about string constants inside macros containing the +macro arguments: this behaved differently pre-ANSI than it does in +\&\s-1ANSI,\s0 and some C compilers are still in transition, \s-1AIX\s0 being an +example. +.SS "Warnings of other C compilers" +.IX Subsection "Warnings of other C compilers" +Other C compilers (yes, there \fBare\fR other C compilers than gcc) often +have their \*(L"strict \s-1ANSI\*(R"\s0 or \*(L"strict \s-1ANSI\s0 with some portability +extensions\*(R" modes on, like for example the Sun Workshop has its \f(CW\*(C`\-Xa\*(C'\fR +mode on (though implicitly), or the \s-1DEC\s0 (these days, \s-1HP...\s0) has its +\&\f(CW\*(C`\-std1\*(C'\fR mode on. +.SH "MEMORY DEBUGGERS" +.IX Header "MEMORY DEBUGGERS" +\&\fB\s-1NOTE 1\s0\fR: Running under older memory debuggers such as Purify, +valgrind or Third Degree greatly slows down the execution: seconds +become minutes, minutes become hours. For example as of Perl 5.8.1, the +ext/Encode/t/Unicode.t takes extraordinarily long to complete under +e.g. Purify, Third Degree, and valgrind. Under valgrind it takes more +than six hours, even on a snappy computer. The said test must be doing +something that is quite unfriendly for memory debuggers. If you don't +feel like waiting, that you can simply kill away the perl process. +Roughly valgrind slows down execution by factor 10, AddressSanitizer by +factor 2. +.PP +\&\fB\s-1NOTE 2\s0\fR: To minimize the number of memory leak false alarms (see +\&\*(L"\s-1PERL_DESTRUCT_LEVEL\*(R"\s0 for more information), you have to set the +environment variable \s-1PERL_DESTRUCT_LEVEL\s0 to 2. For example, like this: +.PP +.Vb 1 +\& env PERL_DESTRUCT_LEVEL=2 valgrind ./perl \-Ilib ... +.Ve +.PP +\&\fB\s-1NOTE 3\s0\fR: There are known memory leaks when there are compile-time +errors within eval or require, seeing \f(CW\*(C`S_doeval\*(C'\fR in the call stack is +a good sign of these. Fixing these leaks is non-trivial, unfortunately, +but they must be fixed eventually. +.PP +\&\fB\s-1NOTE 4\s0\fR: DynaLoader will not clean up after itself completely +unless Perl is built with the Configure option +\&\f(CW\*(C`\-Accflags=\-DDL_UNLOAD_ALL_AT_EXIT\*(C'\fR. +.SS "valgrind" +.IX Subsection "valgrind" +The valgrind tool can be used to find out both memory leaks and illegal +heap memory accesses. As of version 3.3.0, Valgrind only supports Linux +on x86, x86\-64 and PowerPC and Darwin (\s-1OS X\s0) on x86 and x86\-64. The +special \*(L"test.valgrind\*(R" target can be used to run the tests under +valgrind. Found errors and memory leaks are logged in files named +\&\fItestfile.valgrind\fR and by default output is displayed inline. +.PP +Example usage: +.PP +.Vb 1 +\& make test.valgrind +.Ve +.PP +Since valgrind adds significant overhead, tests will take much longer to +run. The valgrind tests support being run in parallel to help with this: +.PP +.Vb 1 +\& TEST_JOBS=9 make test.valgrind +.Ve +.PP +Note that the above two invocations will be very verbose as reachable +memory and leak-checking is enabled by default. If you want to just see +pure errors, try: +.PP +.Vb 2 +\& VG_OPTS=\*(Aq\-q \-\-leak\-check=no \-\-show\-reachable=no\*(Aq TEST_JOBS=9 \e +\& make test.valgrind +.Ve +.PP +Valgrind also provides a cachegrind tool, invoked on perl as: +.PP +.Vb 1 +\& VG_OPTS=\-\-tool=cachegrind make test.valgrind +.Ve +.PP +As system libraries (most notably glibc) are also triggering errors, +valgrind allows to suppress such errors using suppression files. The +default suppression file that comes with valgrind already catches a lot +of them. Some additional suppressions are defined in \fIt/perl.supp\fR. +.PP +To get valgrind and for more information see +.PP +.Vb 1 +\& http://valgrind.org/ +.Ve +.SS "AddressSanitizer" +.IX Subsection "AddressSanitizer" +AddressSanitizer (\*(L"ASan\*(R") consists of a compiler instrumentation module +and a run-time \f(CW\*(C`malloc\*(C'\fR library. ASan is available for a variety of +architectures, operating systems, and compilers (see project link below). +It checks for unsafe memory usage, such as use after free and buffer +overflow conditions, and is fast enough that you can easily compile your +debugging or optimized perl with it. Modern versions of ASan check for +memory leaks by default on most platforms, otherwise (e.g. x86_64 \s-1OS X\s0) +this feature can be enabled via \f(CW\*(C`ASAN_OPTIONS=detect_leaks=1\*(C'\fR. +.PP +To build perl with AddressSanitizer, your Configure invocation should +look like: +.PP +.Vb 4 +\& sh Configure \-des \-Dcc=clang \e +\& \-Accflags=\-fsanitize=address \-Aldflags=\-fsanitize=address \e +\& \-Alddlflags=\-shared\e \-fsanitize=address \e +\& \-fsanitize\-blacklist=\`pwd\`/asan_ignore +.Ve +.PP +where these arguments mean: +.IP "\(bu" 4 +\&\-Dcc=clang +.Sp +This should be replaced by the full path to your clang executable if it +is not in your path. +.IP "\(bu" 4 +\&\-Accflags=\-fsanitize=address +.Sp +Compile perl and extensions sources with AddressSanitizer. +.IP "\(bu" 4 +\&\-Aldflags=\-fsanitize=address +.Sp +Link the perl executable with AddressSanitizer. +.IP "\(bu" 4 +\&\-Alddlflags=\-shared\e \-fsanitize=address +.Sp +Link dynamic extensions with AddressSanitizer. You must manually +specify \f(CW\*(C`\-shared\*(C'\fR because using \f(CW\*(C`\-Alddlflags=\-shared\*(C'\fR will prevent +Configure from setting a default value for \f(CW\*(C`lddlflags\*(C'\fR, which usually +contains \f(CW\*(C`\-shared\*(C'\fR (at least on Linux). +.IP "\(bu" 4 +\&\-fsanitize\-blacklist=`pwd`/asan_ignore +.Sp +AddressSanitizer will ignore functions listed in the \f(CW\*(C`asan_ignore\*(C'\fR +file. (This file should contain a short explanation of why each of +the functions is listed.) +.PP +See also +. +.SH "PROFILING" +.IX Header "PROFILING" +Depending on your platform there are various ways of profiling Perl. +.PP +There are two commonly used techniques of profiling executables: +\&\fIstatistical time-sampling\fR and \fIbasic-block counting\fR. +.PP +The first method takes periodically samples of the \s-1CPU\s0 program counter, +and since the program counter can be correlated with the code generated +for functions, we get a statistical view of in which functions the +program is spending its time. The caveats are that very small/fast +functions have lower probability of showing up in the profile, and that +periodically interrupting the program (this is usually done rather +frequently, in the scale of milliseconds) imposes an additional +overhead that may skew the results. The first problem can be alleviated +by running the code for longer (in general this is a good idea for +profiling), the second problem is usually kept in guard by the +profiling tools themselves. +.PP +The second method divides up the generated code into \fIbasic blocks\fR. +Basic blocks are sections of code that are entered only in the +beginning and exited only at the end. For example, a conditional jump +starts a basic block. Basic block profiling usually works by +\&\fIinstrumenting\fR the code by adding \fIenter basic block #nnnn\fR +book-keeping code to the generated code. During the execution of the +code the basic block counters are then updated appropriately. The +caveat is that the added extra code can skew the results: again, the +profiling tools usually try to factor their own effects out of the +results. +.SS "Gprof Profiling" +.IX Subsection "Gprof Profiling" +\&\fIgprof\fR is a profiling tool available in many Unix platforms which +uses \fIstatistical time-sampling\fR. You can build a profiled version of +\&\fIperl\fR by compiling using gcc with the flag \f(CW\*(C`\-pg\*(C'\fR. Either edit +\&\fIconfig.sh\fR or re-run \fIConfigure\fR. Running the profiled version of +Perl will create an output file called \fIgmon.out\fR which contains the +profiling data collected during the execution. +.PP +quick hint: +.PP +.Vb 6 +\& $ sh Configure \-des \-Dusedevel \-Accflags=\*(Aq\-pg\*(Aq \e +\& \-Aldflags=\*(Aq\-pg\*(Aq \-Alddlflags=\*(Aq\-pg \-shared\*(Aq \e +\& && make perl +\& $ ./perl ... # creates gmon.out in current directory +\& $ gprof ./perl > out +\& $ less out +.Ve +.PP +(you probably need to add \f(CW\*(C`\-shared\*(C'\fR to the <\-Alddlflags> line until \s-1RT\s0 +#118199 is resolved) +.PP +The \fIgprof\fR tool can then display the collected data in various ways. +Usually \fIgprof\fR understands the following options: +.IP "\(bu" 4 +\&\-a +.Sp +Suppress statically defined functions from the profile. +.IP "\(bu" 4 +\&\-b +.Sp +Suppress the verbose descriptions in the profile. +.IP "\(bu" 4 +\&\-e routine +.Sp +Exclude the given routine and its descendants from the profile. +.IP "\(bu" 4 +\&\-f routine +.Sp +Display only the given routine and its descendants in the profile. +.IP "\(bu" 4 +\&\-s +.Sp +Generate a summary file called \fIgmon.sum\fR which then may be given to +subsequent gprof runs to accumulate data over several runs. +.IP "\(bu" 4 +\&\-z +.Sp +Display routines that have zero usage. +.PP +For more detailed explanation of the available commands and output +formats, see your own local documentation of \fIgprof\fR. +.SS "\s-1GCC\s0 gcov Profiling" +.IX Subsection "GCC gcov Profiling" +\&\fIbasic block profiling\fR is officially available in gcc 3.0 and later. +You can build a profiled version of \fIperl\fR by compiling using gcc with +the flags \f(CW\*(C`\-fprofile\-arcs \-ftest\-coverage\*(C'\fR. Either edit \fIconfig.sh\fR +or re-run \fIConfigure\fR. +.PP +quick hint: +.PP +.Vb 9 +\& $ sh Configure \-des \-Dusedevel \-Doptimize=\*(Aq\-g\*(Aq \e +\& \-Accflags=\*(Aq\-fprofile\-arcs \-ftest\-coverage\*(Aq \e +\& \-Aldflags=\*(Aq\-fprofile\-arcs \-ftest\-coverage\*(Aq \e +\& \-Alddlflags=\*(Aq\-fprofile\-arcs \-ftest\-coverage \-shared\*(Aq \e +\& && make perl +\& $ rm \-f regexec.c.gcov regexec.gcda +\& $ ./perl ... +\& $ gcov regexec.c +\& $ less regexec.c.gcov +.Ve +.PP +(you probably need to add \f(CW\*(C`\-shared\*(C'\fR to the <\-Alddlflags> line until \s-1RT\s0 +#118199 is resolved) +.PP +Running the profiled version of Perl will cause profile output to be +generated. For each source file an accompanying \fI.gcda\fR file will be +created. +.PP +To display the results you use the \fIgcov\fR utility (which should be +installed if you have gcc 3.0 or newer installed). \fIgcov\fR is run on +source code files, like this +.PP +.Vb 1 +\& gcov sv.c +.Ve +.PP +which will cause \fIsv.c.gcov\fR to be created. The \fI.gcov\fR files contain +the source code annotated with relative frequencies of execution +indicated by \*(L"#\*(R" markers. If you want to generate \fI.gcov\fR files for +all profiled object files, you can run something like this: +.PP +.Vb 3 +\& for file in \`find . \-name \e*.gcno\` +\& do sh \-c "cd \`dirname $file\` && gcov \`basename $file .gcno\`" +\& done +.Ve +.PP +Useful options of \fIgcov\fR include \f(CW\*(C`\-b\*(C'\fR which will summarise the basic +block, branch, and function call coverage, and \f(CW\*(C`\-c\*(C'\fR which instead of +relative frequencies will use the actual counts. For more information +on the use of \fIgcov\fR and basic block profiling with gcc, see the +latest \s-1GNU CC\s0 manual. As of gcc 4.8, this is at + +.SH "MISCELLANEOUS TRICKS" +.IX Header "MISCELLANEOUS TRICKS" +.SS "\s-1PERL_DESTRUCT_LEVEL\s0" +.IX Subsection "PERL_DESTRUCT_LEVEL" +If you want to run any of the tests yourself manually using e.g. +valgrind, please note that by default perl \fBdoes not\fR explicitly +cleanup all the memory it has allocated (such as global memory arenas) +but instead lets the \fBexit()\fR of the whole program \*(L"take care\*(R" of such +allocations, also known as \*(L"global destruction of objects\*(R". +.PP +There is a way to tell perl to do complete cleanup: set the environment +variable \s-1PERL_DESTRUCT_LEVEL\s0 to a non-zero value. The t/TEST wrapper +does set this to 2, and this is what you need to do too, if you don't +want to see the \*(L"global leaks\*(R": For example, for running under valgrind +.PP +.Vb 1 +\& env PERL_DESTRUCT_LEVEL=2 valgrind ./perl \-Ilib t/foo/bar.t +.Ve +.PP +(Note: the mod_perl apache module uses also this environment variable +for its own purposes and extended its semantics. Refer to the mod_perl +documentation for more information. Also, spawned threads do the +equivalent of setting this variable to the value 1.) +.PP +If, at the end of a run you get the message \fIN scalars leaked\fR, you +can recompile with \f(CW\*(C`\-DDEBUG_LEAKING_SCALARS\*(C'\fR, +(\f(CW\*(C`Configure \-Accflags=\-DDEBUG_LEAKING_SCALARS\*(C'\fR), which will cause the +addresses of all those leaked SVs to be dumped along with details as to +where each \s-1SV\s0 was originally allocated. This information is also +displayed by Devel::Peek. Note that the extra details recorded with +each \s-1SV\s0 increases memory usage, so it shouldn't be used in production +environments. It also converts \f(CW\*(C`new_SV()\*(C'\fR from a macro into a real +function, so you can use your favourite debugger to discover where +those pesky SVs were allocated. +.PP +If you see that you're leaking memory at runtime, but neither valgrind +nor \f(CW\*(C`\-DDEBUG_LEAKING_SCALARS\*(C'\fR will find anything, you're probably +leaking SVs that are still reachable and will be properly cleaned up +during destruction of the interpreter. In such cases, using the \f(CW\*(C`\-Dm\*(C'\fR +switch can point you to the source of the leak. If the executable was +built with \f(CW\*(C`\-DDEBUG_LEAKING_SCALARS\*(C'\fR, \f(CW\*(C`\-Dm\*(C'\fR will output \s-1SV\s0 +allocations in addition to memory allocations. Each \s-1SV\s0 allocation has a +distinct serial number that will be written on creation and destruction +of the \s-1SV.\s0 So if you're executing the leaking code in a loop, you need +to look for SVs that are created, but never destroyed between each +cycle. If such an \s-1SV\s0 is found, set a conditional breakpoint within +\&\f(CW\*(C`new_SV()\*(C'\fR and make it break only when \f(CW\*(C`PL_sv_serial\*(C'\fR is equal to the +serial number of the leaking \s-1SV.\s0 Then you will catch the interpreter in +exactly the state where the leaking \s-1SV\s0 is allocated, which is +sufficient in many cases to find the source of the leak. +.PP +As \f(CW\*(C`\-Dm\*(C'\fR is using the PerlIO layer for output, it will by itself +allocate quite a bunch of SVs, which are hidden to avoid recursion. You +can bypass the PerlIO layer if you use the \s-1SV\s0 logging provided by +\&\f(CW\*(C`\-DPERL_MEM_LOG\*(C'\fR instead. +.SS "\s-1PERL_MEM_LOG\s0" +.IX Subsection "PERL_MEM_LOG" +If compiled with \f(CW\*(C`\-DPERL_MEM_LOG\*(C'\fR (\f(CW\*(C`\-Accflags=\-DPERL_MEM_LOG\*(C'\fR), both +memory and \s-1SV\s0 allocations go through logging functions, which is +handy for breakpoint setting. +.PP +Unless \f(CW\*(C`\-DPERL_MEM_LOG_NOIMPL\*(C'\fR (\f(CW\*(C`\-Accflags=\-DPERL_MEM_LOG_NOIMPL\*(C'\fR) is +also compiled, the logging functions read \f(CW$ENV\fR{\s-1PERL_MEM_LOG\s0} to +determine whether to log the event, and if so how: +.PP +.Vb 4 +\& $ENV{PERL_MEM_LOG} =~ /m/ Log all memory ops +\& $ENV{PERL_MEM_LOG} =~ /s/ Log all SV ops +\& $ENV{PERL_MEM_LOG} =~ /t/ include timestamp in Log +\& $ENV{PERL_MEM_LOG} =~ /^(\ed+)/ write to FD given (default is 2) +.Ve +.PP +Memory logging is somewhat similar to \f(CW\*(C`\-Dm\*(C'\fR but is independent of +\&\f(CW\*(C`\-DDEBUGGING\*(C'\fR, and at a higher level; all uses of \fBNewx()\fR, \fBRenew()\fR, and +\&\fBSafefree()\fR are logged with the caller's source code file and line +number (and C function name, if supported by the C compiler). In +contrast, \f(CW\*(C`\-Dm\*(C'\fR is directly at the point of \f(CW\*(C`malloc()\*(C'\fR. \s-1SV\s0 logging is +similar. +.PP +Since the logging doesn't use PerlIO, all \s-1SV\s0 allocations are logged and +no extra \s-1SV\s0 allocations are introduced by enabling the logging. If +compiled with \f(CW\*(C`\-DDEBUG_LEAKING_SCALARS\*(C'\fR, the serial number for each \s-1SV\s0 +allocation is also logged. +.SS "\s-1DDD\s0 over gdb" +.IX Subsection "DDD over gdb" +Those debugging perl with the \s-1DDD\s0 frontend over gdb may find the +following useful: +.PP +You can extend the data conversion shortcuts menu, so for example you +can display an \s-1SV\s0's \s-1IV\s0 value with one click, without doing any typing. +To do that simply edit ~/.ddd/init file and add after: +.PP +.Vb 6 +\& ! Display shortcuts. +\& Ddd*gdbDisplayShortcuts: \e +\& /t () // Convert to Bin\en\e +\& /d () // Convert to Dec\en\e +\& /x () // Convert to Hex\en\e +\& /o () // Convert to Oct(\en\e +.Ve +.PP +the following two lines: +.PP +.Vb 2 +\& ((XPV*) (())\->sv_any )\->xpv_pv // 2pvx\en\e +\& ((XPVIV*) (())\->sv_any )\->xiv_iv // 2ivx +.Ve +.PP +so now you can do ivx and pvx lookups or you can plug there the sv_peek +\&\*(L"conversion\*(R": +.PP +.Vb 1 +\& Perl_sv_peek(my_perl, (SV*)()) // sv_peek +.Ve +.PP +(The my_perl is for threaded builds.) Just remember that every line, +but the last one, should end with \en\e +.PP +Alternatively edit the init file interactively via: 3rd mouse button \-> +New Display \-> Edit Menu +.PP +Note: you can define up to 20 conversion shortcuts in the gdb section. +.SS "C backtrace" +.IX Subsection "C backtrace" +On some platforms Perl supports retrieving the C level backtrace +(similar to what symbolic debuggers like gdb do). +.PP +The backtrace returns the stack trace of the C call frames, +with the symbol names (function names), the object names (like \*(L"perl\*(R"), +and if it can, also the source code locations (file:line). +.PP +The supported platforms are Linux, and \s-1OS X\s0 (some *BSD might +work at least partly, but they have not yet been tested). +.PP +This feature hasn't been tested with multiple threads, but it will +only show the backtrace of the thread doing the backtracing. +.PP +The feature needs to be enabled with \f(CW\*(C`Configure \-Dusecbacktrace\*(C'\fR. +.PP +The \f(CW\*(C`\-Dusecbacktrace\*(C'\fR also enables keeping the debug information when +compiling/linking (often: \f(CW\*(C`\-g\*(C'\fR). Many compilers/linkers do support +having both optimization and keeping the debug information. The debug +information is needed for the symbol names and the source locations. +.PP +Static functions might not be visible for the backtrace. +.PP +Source code locations, even if available, can often be missing or +misleading if the compiler has e.g. inlined code. Optimizer can +make matching the source code and the object code quite challenging. +.IP "Linux" 4 +.IX Item "Linux" +You \fBmust\fR have the \s-1BFD\s0 (\-lbfd) library installed, otherwise \f(CW\*(C`perl\*(C'\fR will +fail to link. The \s-1BFD\s0 is usually distributed as part of the \s-1GNU\s0 binutils. +.Sp +Summary: \f(CW\*(C`Configure ... \-Dusecbacktrace\*(C'\fR +and you need \f(CW\*(C`\-lbfd\*(C'\fR. +.IP "\s-1OS X\s0" 4 +.IX Item "OS X" +The source code locations are supported \fBonly\fR if you have +the Developer Tools installed. (\s-1BFD\s0 is \fBnot\fR needed.) +.Sp +Summary: \f(CW\*(C`Configure ... \-Dusecbacktrace\*(C'\fR +and installing the Developer Tools would be good. +.PP +Optionally, for trying out the feature, you may want to enable +automatic dumping of the backtrace just before a warning or croak (die) +message is emitted, by adding \f(CW\*(C`\-Accflags=\-DUSE_C_BACKTRACE_ON_ERROR\*(C'\fR +for Configure. +.PP +Unless the above additional feature is enabled, nothing about the +backtrace functionality is visible, except for the Perl/XS level. +.PP +Furthermore, even if you have enabled this feature to be compiled, +you need to enable it in runtime with an environment variable: +\&\f(CW\*(C`PERL_C_BACKTRACE_ON_ERROR=10\*(C'\fR. It must be an integer higher +than zero, telling the desired frame count. +.PP +Retrieving the backtrace from Perl level (using for example an \s-1XS\s0 +extension) would be much less exciting than one would hope: normally +you would see \f(CW\*(C`runops\*(C'\fR, \f(CW\*(C`entersub\*(C'\fR, and not much else. This \s-1API\s0 is +intended to be called \fBfrom within\fR the Perl implementation, not from +Perl level execution. +.PP +The C \s-1API\s0 for the backtrace is as follows: +.IP "get_c_backtrace" 4 +.IX Item "get_c_backtrace" +.PD 0 +.IP "free_c_backtrace" 4 +.IX Item "free_c_backtrace" +.IP "get_c_backtrace_dump" 4 +.IX Item "get_c_backtrace_dump" +.IP "dump_c_backtrace" 4 +.IX Item "dump_c_backtrace" +.PD +.SS "Poison" +.IX Subsection "Poison" +If you see in a debugger a memory area mysteriously full of 0xABABABAB +or 0xEFEFEFEF, you may be seeing the effect of the \fBPoison()\fR macros, see +perlclib. +.SS "Read-only optrees" +.IX Subsection "Read-only optrees" +Under ithreads the optree is read only. If you want to enforce this, to +check for write accesses from buggy code, compile with +\&\f(CW\*(C`\-Accflags=\-DPERL_DEBUG_READONLY_OPS\*(C'\fR +to enable code that allocates op memory +via \f(CW\*(C`mmap\*(C'\fR, and sets it read-only when it is attached to a subroutine. +Any write access to an op results in a \f(CW\*(C`SIGBUS\*(C'\fR and abort. +.PP +This code is intended for development only, and may not be portable +even to all Unix variants. Also, it is an 80% solution, in that it +isn't able to make all ops read only. Specifically it does not apply to +op slabs belonging to \f(CW\*(C`BEGIN\*(C'\fR blocks. +.PP +However, as an 80% solution it is still effective, as it has caught +bugs in the past. +.SS "When is a bool not a bool?" +.IX Subsection "When is a bool not a bool?" +On pre\-C99 compilers, \f(CW\*(C`bool\*(C'\fR is defined as equivalent to \f(CW\*(C`char\*(C'\fR. +Consequently assignment of any larger type to a \f(CW\*(C`bool\*(C'\fR is unsafe and may be +truncated. The \f(CW\*(C`cBOOL\*(C'\fR macro exists to cast it correctly; you may also find +that using it is shorter and clearer than writing out the equivalent +conditional expression longhand. +.PP +On those platforms and compilers where \f(CW\*(C`bool\*(C'\fR really is a boolean (\*(C+, +C99), it is easy to forget the cast. You can force \f(CW\*(C`bool\*(C'\fR to be a \f(CW\*(C`char\*(C'\fR +by compiling with \f(CW\*(C`\-Accflags=\-DPERL_BOOL_AS_CHAR\*(C'\fR. You may also wish to +run \f(CW\*(C`Configure\*(C'\fR with something like +.PP +.Vb 1 +\& \-Accflags=\*(Aq\-Wconversion \-Wno\-sign\-conversion \-Wno\-shorten\-64\-to\-32\*(Aq +.Ve +.PP +or your compiler's equivalent to make it easier to spot any unsafe truncations +that show up. +.PP +The \f(CW\*(C`TRUE\*(C'\fR and \f(CW\*(C`FALSE\*(C'\fR macros are available for situations where using them +would clarify intent. (But they always just mean the same as the integers 1 and +0 regardless, so using them isn't compulsory.) +.SS "The .i Targets" +.IX Subsection "The .i Targets" +You can expand the macros in a \fIfoo.c\fR file by saying +.PP +.Vb 1 +\& make foo.i +.Ve +.PP +which will expand the macros using cpp. Don't be scared by the +results. +.SH "AUTHOR" +.IX Header "AUTHOR" +This document was originally written by Nathan Torkington, and is +maintained by the perl5\-porters mailing list. diff --git a/data/miniconda3/man/man1/perlhist.1 b/data/miniconda3/man/man1/perlhist.1 new file mode 100644 index 0000000000000000000000000000000000000000..89d06690dbbba44fbe7d3c9f1a0e8b41440f6f81 --- /dev/null +++ b/data/miniconda3/man/man1/perlhist.1 @@ -0,0 +1,1411 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLHIST 1" +.TH PERLHIST 1 "2021-01-23" "perl v5.32.1" "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" +perlhist \- the Perl history records +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document aims to record the Perl source code releases. +.SH "INTRODUCTION" +.IX Header "INTRODUCTION" +Perl history in brief, by Larry Wall: +.PP +.Vb 9 +\& Perl 0 introduced Perl to my officemates. +\& Perl 1 introduced Perl to the world, and changed /\e(...\e|...\e)/ to +\& /(...|...)/. \e(Dan Faigin still hasn\*(Aqt forgiven me. :\-\e) +\& Perl 2 introduced Henry Spencer\*(Aqs regular expression package. +\& Perl 3 introduced the ability to handle binary data (embedded nulls). +\& Perl 4 introduced the first Camel book. Really. We mostly just +\& switched version numbers so the book could refer to 4.000. +\& Perl 5 introduced everything else, including the ability to +\& introduce everything else. +.Ve +.SH "THE KEEPERS OF THE PUMPKIN" +.IX Header "THE KEEPERS OF THE PUMPKIN" +Larry Wall, Andy Dougherty, Tom Christiansen, Charles Bailey, Nick +Ing-Simmons, Chip Salzenberg, Tim Bunce, Malcolm Beattie, Gurusamy +Sarathy, Graham Barr, Jarkko Hietaniemi, Hugo van der Sanden, +Michael Schwern, Rafael Garcia-Suarez, Nicholas Clark, Richard Clamp, +Leon Brocard, Dave Mitchell, Jesse Vincent, Ricardo Signes, Steve Hay, +Matt S Trout, David Golden, Florian Ragwitz, Tatsuhiko Miyagawa, +Chris \f(CW\*(C`BinGOs\*(C'\fR Williams, Zefram, \*(Aevar Arnfjo\*:r\*(d- Bjarmason, Stevan +Little, Dave Rolsky, Max Maischein, Abigail, Jesse Luehrs, Tony Cook, +Dominic Hargreaves, Aaron Crane, Aristotle Pagaltzis, Matthew Horsfall, +Peter Martini, Sawyer X, Chad 'Exodist' Granum, Renee Ba\*:cker, Eric Herman, +John \s-1SJ\s0 Anderson, Karen Etheridge, Zak B. Elep, Tom Hukins, and Richard +Leach. +.SS "\s-1PUMPKIN\s0?" +.IX Subsection "PUMPKIN?" +[from Porting/pumpkin.pod in the Perl source code distribution] +.PP +Chip Salzenberg gets credit for that, with a nod to his cow orker, +David Croy. We had passed around various names (baton, token, hot +potato) but none caught on. Then, Chip asked: +.PP +[begin quote] +.PP +.Vb 1 +\& Who has the patch pumpkin? +.Ve +.PP +To explain: David Croy once told me that at a previous job, +there was one tape drive and multiple systems that used it for backups. +But instead of some high-tech exclusion software, they used a low-tech +method to prevent multiple simultaneous backups: a stuffed pumpkin. +No one was allowed to make backups unless they had the \*(L"backup pumpkin\*(R". +.PP +[end quote] +.PP +The name has stuck. The holder of the pumpkin is sometimes called +the pumpking (keeping the source afloat?) or the pumpkineer (pulling +the strings?). +.SH "THE RECORDS" +.IX Header "THE RECORDS" +.Vb 6 +\& Pump\- Release Date Notes +\& kin (by no means +\& Holder comprehensive, +\& see Changes* +\& for details) +\& ====================================================================== +\& +\& Larry 0 Classified. Don\*(Aqt ask. +\& +\& Larry 1.000 1987\-Dec\-18 +\& +\& 1.001..10 1988\-Jan\-30 +\& 1.011..14 1988\-Feb\-02 +\& Schwern 1.0.15 2002\-Dec\-18 Modernization +\& Richard 1.0_16 2003\-Dec\-18 +\& +\& Larry 2.000 1988\-Jun\-05 +\& +\& 2.001 1988\-Jun\-28 +\& +\& Larry 3.000 1989\-Oct\-18 +\& +\& 3.001 1989\-Oct\-26 +\& 3.002..4 1989\-Nov\-11 +\& 3.005 1989\-Nov\-18 +\& 3.006..8 1989\-Dec\-22 +\& 3.009..13 1990\-Mar\-02 +\& 3.014 1990\-Mar\-13 +\& 3.015 1990\-Mar\-14 +\& 3.016..18 1990\-Mar\-28 +\& 3.019..27 1990\-Aug\-10 User subs. +\& 3.028 1990\-Aug\-14 +\& 3.029..36 1990\-Oct\-17 +\& 3.037 1990\-Oct\-20 +\& 3.040 1990\-Nov\-10 +\& 3.041 1990\-Nov\-13 +\& 3.042..43 1991\-Jan\-?? +\& 3.044 1991\-Jan\-12 +\& +\& Larry 4.000 1991\-Mar\-21 +\& +\& 4.001..3 1991\-Apr\-12 +\& 4.004..9 1991\-Jun\-07 +\& 4.010 1991\-Jun\-10 +\& 4.011..18 1991\-Nov\-05 +\& 4.019 1991\-Nov\-11 Stable. +\& 4.020..33 1992\-Jun\-08 +\& 4.034 1992\-Jun\-11 +\& 4.035 1992\-Jun\-23 +\& Larry 4.036 1993\-Feb\-05 Very stable. +\& +\& 5.000alpha1 1993\-Jul\-31 +\& 5.000alpha2 1993\-Aug\-16 +\& 5.000alpha3 1993\-Oct\-10 +\& 5.000alpha4 1993\-???\-?? +\& 5.000alpha5 1993\-???\-?? +\& 5.000alpha6 1994\-Mar\-18 +\& 5.000alpha7 1994\-Mar\-25 +\& Andy 5.000alpha8 1994\-Apr\-04 +\& Larry 5.000alpha9 1994\-May\-05 ext appears. +\& 5.000alpha10 1994\-Jun\-11 +\& 5.000alpha11 1994\-Jul\-01 +\& Andy 5.000a11a 1994\-Jul\-07 To fit 14. +\& 5.000a11b 1994\-Jul\-14 +\& 5.000a11c 1994\-Jul\-19 +\& 5.000a11d 1994\-Jul\-22 +\& Larry 5.000alpha12 1994\-Aug\-04 +\& Andy 5.000a12a 1994\-Aug\-08 +\& 5.000a12b 1994\-Aug\-15 +\& 5.000a12c 1994\-Aug\-22 +\& 5.000a12d 1994\-Aug\-22 +\& 5.000a12e 1994\-Aug\-22 +\& 5.000a12f 1994\-Aug\-24 +\& 5.000a12g 1994\-Aug\-24 +\& 5.000a12h 1994\-Aug\-24 +\& Larry 5.000beta1 1994\-Aug\-30 +\& Andy 5.000b1a 1994\-Sep\-06 +\& Larry 5.000beta2 1994\-Sep\-14 Core slushified. +\& Andy 5.000b2a 1994\-Sep\-14 +\& 5.000b2b 1994\-Sep\-17 +\& 5.000b2c 1994\-Sep\-17 +\& Larry 5.000beta3 1994\-Sep\-?? +\& Andy 5.000b3a 1994\-Sep\-18 +\& 5.000b3b 1994\-Sep\-22 +\& 5.000b3c 1994\-Sep\-23 +\& 5.000b3d 1994\-Sep\-27 +\& 5.000b3e 1994\-Sep\-28 +\& 5.000b3f 1994\-Sep\-30 +\& 5.000b3g 1994\-Oct\-04 +\& Andy 5.000b3h 1994\-Oct\-07 +\& Larry? 5.000gamma 1994\-Oct\-13? +\& +\& Larry 5.000 1994\-Oct\-17 +\& +\& Andy 5.000a 1994\-Dec\-19 +\& 5.000b 1995\-Jan\-18 +\& 5.000c 1995\-Jan\-18 +\& 5.000d 1995\-Jan\-18 +\& 5.000e 1995\-Jan\-18 +\& 5.000f 1995\-Jan\-18 +\& 5.000g 1995\-Jan\-18 +\& 5.000h 1995\-Jan\-18 +\& 5.000i 1995\-Jan\-26 +\& 5.000j 1995\-Feb\-07 +\& 5.000k 1995\-Feb\-11 +\& 5.000l 1995\-Feb\-21 +\& 5.000m 1995\-Feb\-28 +\& 5.000n 1995\-Mar\-07 +\& 5.000o 1995\-Mar\-13? +\& +\& Larry 5.001 1995\-Mar\-13 +\& +\& Andy 5.001a 1995\-Mar\-15 +\& 5.001b 1995\-Mar\-31 +\& 5.001c 1995\-Apr\-07 +\& 5.001d 1995\-Apr\-14 +\& 5.001e 1995\-Apr\-18 Stable. +\& 5.001f 1995\-May\-31 +\& 5.001g 1995\-May\-25 +\& 5.001h 1995\-May\-25 +\& 5.001i 1995\-May\-30 +\& 5.001j 1995\-Jun\-05 +\& 5.001k 1995\-Jun\-06 +\& 5.001l 1995\-Jun\-06 Stable. +\& 5.001m 1995\-Jul\-02 Very stable. +\& 5.001n 1995\-Oct\-31 Very unstable. +\& 5.002beta1 1995\-Nov\-21 +\& 5.002b1a 1995\-Dec\-04 +\& 5.002b1b 1995\-Dec\-04 +\& 5.002b1c 1995\-Dec\-04 +\& 5.002b1d 1995\-Dec\-04 +\& 5.002b1e 1995\-Dec\-08 +\& 5.002b1f 1995\-Dec\-08 +\& Tom 5.002b1g 1995\-Dec\-21 Doc release. +\& Andy 5.002b1h 1996\-Jan\-05 +\& 5.002b2 1996\-Jan\-14 +\& Larry 5.002b3 1996\-Feb\-02 +\& Andy 5.002gamma 1996\-Feb\-11 +\& Larry 5.002delta 1996\-Feb\-27 +\& +\& Larry 5.002 1996\-Feb\-29 Prototypes. +\& +\& Charles 5.002_01 1996\-Mar\-25 +\& +\& 5.003 1996\-Jun\-25 Security release. +\& +\& 5.003_01 1996\-Jul\-31 +\& Nick 5.003_02 1996\-Aug\-10 +\& Andy 5.003_03 1996\-Aug\-28 +\& 5.003_04 1996\-Sep\-02 +\& 5.003_05 1996\-Sep\-12 +\& 5.003_06 1996\-Oct\-07 +\& 5.003_07 1996\-Oct\-10 +\& Chip 5.003_08 1996\-Nov\-19 +\& 5.003_09 1996\-Nov\-26 +\& 5.003_10 1996\-Nov\-29 +\& 5.003_11 1996\-Dec\-06 +\& 5.003_12 1996\-Dec\-19 +\& 5.003_13 1996\-Dec\-20 +\& 5.003_14 1996\-Dec\-23 +\& 5.003_15 1996\-Dec\-23 +\& 5.003_16 1996\-Dec\-24 +\& 5.003_17 1996\-Dec\-27 +\& 5.003_18 1996\-Dec\-31 +\& 5.003_19 1997\-Jan\-04 +\& 5.003_20 1997\-Jan\-07 +\& 5.003_21 1997\-Jan\-15 +\& 5.003_22 1997\-Jan\-16 +\& 5.003_23 1997\-Jan\-25 +\& 5.003_24 1997\-Jan\-29 +\& 5.003_25 1997\-Feb\-04 +\& 5.003_26 1997\-Feb\-10 +\& 5.003_27 1997\-Feb\-18 +\& 5.003_28 1997\-Feb\-21 +\& 5.003_90 1997\-Feb\-25 Ramping up to the 5.004 release. +\& 5.003_91 1997\-Mar\-01 +\& 5.003_92 1997\-Mar\-06 +\& 5.003_93 1997\-Mar\-10 +\& 5.003_94 1997\-Mar\-22 +\& 5.003_95 1997\-Mar\-25 +\& 5.003_96 1997\-Apr\-01 +\& 5.003_97 1997\-Apr\-03 Fairly widely used. +\& 5.003_97a 1997\-Apr\-05 +\& 5.003_97b 1997\-Apr\-08 +\& 5.003_97c 1997\-Apr\-10 +\& 5.003_97d 1997\-Apr\-13 +\& 5.003_97e 1997\-Apr\-15 +\& 5.003_97f 1997\-Apr\-17 +\& 5.003_97g 1997\-Apr\-18 +\& 5.003_97h 1997\-Apr\-24 +\& 5.003_97i 1997\-Apr\-25 +\& 5.003_97j 1997\-Apr\-28 +\& 5.003_98 1997\-Apr\-30 +\& 5.003_99 1997\-May\-01 +\& 5.003_99a 1997\-May\-09 +\& p54rc1 1997\-May\-12 Release Candidates. +\& p54rc2 1997\-May\-14 +\& +\& Chip 5.004 1997\-May\-15 A major maintenance release. +\& +\& Tim 5.004_01\-t1 1997\-???\-?? The 5.004 maintenance track. +\& 5.004_01\-t2 1997\-Jun\-11 aka perl5.004m1t2 +\& 5.004_01 1997\-Jun\-13 +\& 5.004_01_01 1997\-Jul\-29 aka perl5.004m2t1 +\& 5.004_01_02 1997\-Aug\-01 aka perl5.004m2t2 +\& 5.004_01_03 1997\-Aug\-05 aka perl5.004m2t3 +\& 5.004_02 1997\-Aug\-07 +\& 5.004_02_01 1997\-Aug\-12 aka perl5.004m3t1 +\& 5.004_03\-t2 1997\-Aug\-13 aka perl5.004m3t2 +\& 5.004_03 1997\-Sep\-05 +\& 5.004_04\-t1 1997\-Sep\-19 aka perl5.004m4t1 +\& 5.004_04\-t2 1997\-Sep\-23 aka perl5.004m4t2 +\& 5.004_04\-t3 1997\-Oct\-10 aka perl5.004m4t3 +\& 5.004_04\-t4 1997\-Oct\-14 aka perl5.004m4t4 +\& 5.004_04 1997\-Oct\-15 +\& 5.004_04\-m1 1998\-Mar\-04 (5.004m5t1) Maint. trials for 5.004_05. +\& 5.004_04\-m2 1998\-May\-01 +\& 5.004_04\-m3 1998\-May\-15 +\& 5.004_04\-m4 1998\-May\-19 +\& 5.004_05\-MT5 1998\-Jul\-21 +\& 5.004_05\-MT6 1998\-Oct\-09 +\& 5.004_05\-MT7 1998\-Nov\-22 +\& 5.004_05\-MT8 1998\-Dec\-03 +\& Chip 5.004_05\-MT9 1999\-Apr\-26 +\& 5.004_05 1999\-Apr\-29 +\& +\& Malcolm 5.004_50 1997\-Sep\-09 The 5.005 development track. +\& 5.004_51 1997\-Oct\-02 +\& 5.004_52 1997\-Oct\-15 +\& 5.004_53 1997\-Oct\-16 +\& 5.004_54 1997\-Nov\-14 +\& 5.004_55 1997\-Nov\-25 +\& 5.004_56 1997\-Dec\-18 +\& 5.004_57 1998\-Feb\-03 +\& 5.004_58 1998\-Feb\-06 +\& 5.004_59 1998\-Feb\-13 +\& 5.004_60 1998\-Feb\-20 +\& 5.004_61 1998\-Feb\-27 +\& 5.004_62 1998\-Mar\-06 +\& 5.004_63 1998\-Mar\-17 +\& 5.004_64 1998\-Apr\-03 +\& 5.004_65 1998\-May\-15 +\& 5.004_66 1998\-May\-29 +\& Sarathy 5.004_67 1998\-Jun\-15 +\& 5.004_68 1998\-Jun\-23 +\& 5.004_69 1998\-Jun\-29 +\& 5.004_70 1998\-Jul\-06 +\& 5.004_71 1998\-Jul\-09 +\& 5.004_72 1998\-Jul\-12 +\& 5.004_73 1998\-Jul\-13 +\& 5.004_74 1998\-Jul\-14 5.005 beta candidate. +\& 5.004_75 1998\-Jul\-15 5.005 beta1. +\& 5.004_76 1998\-Jul\-21 5.005 beta2. +\& +\& Sarathy 5.005 1998\-Jul\-22 Oneperl. +\& +\& Sarathy 5.005_01 1998\-Jul\-27 The 5.005 maintenance track. +\& 5.005_02\-T1 1998\-Aug\-02 +\& 5.005_02\-T2 1998\-Aug\-05 +\& 5.005_02 1998\-Aug\-08 +\& Graham 5.005_03\-MT1 1998\-Nov\-30 +\& 5.005_03\-MT2 1999\-Jan\-04 +\& 5.005_03\-MT3 1999\-Jan\-17 +\& 5.005_03\-MT4 1999\-Jan\-26 +\& 5.005_03\-MT5 1999\-Jan\-28 +\& 5.005_03\-MT6 1999\-Mar\-05 +\& 5.005_03 1999\-Mar\-28 +\& Leon 5.005_04\-RC1 2004\-Feb\-05 +\& 5.005_04\-RC2 2004\-Feb\-18 +\& 5.005_04 2004\-Feb\-23 +\& 5.005_05\-RC1 2009\-Feb\-16 +\& +\& Sarathy 5.005_50 1998\-Jul\-26 The 5.6 development track. +\& 5.005_51 1998\-Aug\-10 +\& 5.005_52 1998\-Sep\-25 +\& 5.005_53 1998\-Oct\-31 +\& 5.005_54 1998\-Nov\-30 +\& 5.005_55 1999\-Feb\-16 +\& 5.005_56 1999\-Mar\-01 +\& 5.005_57 1999\-May\-25 +\& 5.005_58 1999\-Jul\-27 +\& 5.005_59 1999\-Aug\-02 +\& 5.005_60 1999\-Aug\-02 +\& 5.005_61 1999\-Aug\-20 +\& 5.005_62 1999\-Oct\-15 +\& 5.005_63 1999\-Dec\-09 +\& 5.5.640 2000\-Feb\-02 +\& 5.5.650 2000\-Feb\-08 beta1 +\& 5.5.660 2000\-Feb\-22 beta2 +\& 5.5.670 2000\-Feb\-29 beta3 +\& 5.6.0\-RC1 2000\-Mar\-09 Release candidate 1. +\& 5.6.0\-RC2 2000\-Mar\-14 Release candidate 2. +\& 5.6.0\-RC3 2000\-Mar\-21 Release candidate 3. +\& +\& Sarathy 5.6.0 2000\-Mar\-22 +\& +\& Sarathy 5.6.1\-TRIAL1 2000\-Dec\-18 The 5.6 maintenance track. +\& 5.6.1\-TRIAL2 2001\-Jan\-31 +\& 5.6.1\-TRIAL3 2001\-Mar\-19 +\& 5.6.1\-foolish 2001\-Apr\-01 The "fools\-gold" release. +\& 5.6.1 2001\-Apr\-08 +\& Rafael 5.6.2\-RC1 2003\-Nov\-08 +\& 5.6.2 2003\-Nov\-15 Fix new build issues +\& +\& Jarkko 5.7.0 2000\-Sep\-02 The 5.7 track: Development. +\& 5.7.1 2001\-Apr\-09 +\& 5.7.2 2001\-Jul\-13 Virtual release candidate 0. +\& 5.7.3 2002\-Mar\-05 +\& 5.8.0\-RC1 2002\-Jun\-01 +\& 5.8.0\-RC2 2002\-Jun\-21 +\& 5.8.0\-RC3 2002\-Jul\-13 +\& +\& Jarkko 5.8.0 2002\-Jul\-18 +\& +\& Jarkko 5.8.1\-RC1 2003\-Jul\-10 The 5.8 maintenance track +\& 5.8.1\-RC2 2003\-Jul\-11 +\& 5.8.1\-RC3 2003\-Jul\-30 +\& 5.8.1\-RC4 2003\-Aug\-01 +\& 5.8.1\-RC5 2003\-Sep\-22 +\& 5.8.1 2003\-Sep\-25 +\& Nicholas 5.8.2\-RC1 2003\-Oct\-27 +\& 5.8.2\-RC2 2003\-Nov\-03 +\& 5.8.2 2003\-Nov\-05 +\& 5.8.3\-RC1 2004\-Jan\-07 +\& 5.8.3 2004\-Jan\-14 +\& 5.8.4\-RC1 2004\-Apr\-05 +\& 5.8.4\-RC2 2004\-Apr\-15 +\& 5.8.4 2004\-Apr\-21 +\& 5.8.5\-RC1 2004\-Jul\-06 +\& 5.8.5\-RC2 2004\-Jul\-08 +\& 5.8.5 2004\-Jul\-19 +\& 5.8.6\-RC1 2004\-Nov\-11 +\& 5.8.6 2004\-Nov\-27 +\& 5.8.7\-RC1 2005\-May\-18 +\& 5.8.7 2005\-May\-30 +\& 5.8.8\-RC1 2006\-Jan\-20 +\& 5.8.8 2006\-Jan\-31 +\& 5.8.9\-RC1 2008\-Nov\-10 +\& 5.8.9\-RC2 2008\-Dec\-06 +\& 5.8.9 2008\-Dec\-14 +\& +\& Hugo 5.9.0 2003\-Oct\-27 The 5.9 development track +\& Rafael 5.9.1 2004\-Mar\-16 +\& 5.9.2 2005\-Apr\-01 +\& 5.9.3 2006\-Jan\-28 +\& 5.9.4 2006\-Aug\-15 +\& 5.9.5 2007\-Jul\-07 +\& 5.10.0\-RC1 2007\-Nov\-17 +\& 5.10.0\-RC2 2007\-Nov\-25 +\& +\& Rafael 5.10.0 2007\-Dec\-18 +\& +\& David M 5.10.1\-RC1 2009\-Aug\-06 The 5.10 maintenance track +\& 5.10.1\-RC2 2009\-Aug\-18 +\& 5.10.1 2009\-Aug\-22 +\& +\& Jesse 5.11.0 2009\-Oct\-02 The 5.11 development track +\& 5.11.1 2009\-Oct\-20 +\& Leon 5.11.2 2009\-Nov\-20 +\& Jesse 5.11.3 2009\-Dec\-20 +\& Ricardo 5.11.4 2010\-Jan\-20 +\& Steve 5.11.5 2010\-Feb\-20 +\& Jesse 5.12.0\-RC0 2010\-Mar\-21 +\& 5.12.0\-RC1 2010\-Mar\-29 +\& 5.12.0\-RC2 2010\-Apr\-01 +\& 5.12.0\-RC3 2010\-Apr\-02 +\& 5.12.0\-RC4 2010\-Apr\-06 +\& 5.12.0\-RC5 2010\-Apr\-09 +\& +\& Jesse 5.12.0 2010\-Apr\-12 +\& +\& Jesse 5.12.1\-RC2 2010\-May\-13 The 5.12 maintenance track +\& 5.12.1\-RC1 2010\-May\-09 +\& 5.12.1 2010\-May\-16 +\& 5.12.2\-RC2 2010\-Aug\-31 +\& 5.12.2 2010\-Sep\-06 +\& Ricardo 5.12.3\-RC1 2011\-Jan\-09 +\& Ricardo 5.12.3\-RC2 2011\-Jan\-14 +\& Ricardo 5.12.3\-RC3 2011\-Jan\-17 +\& Ricardo 5.12.3 2011\-Jan\-21 +\& Leon 5.12.4\-RC1 2011\-Jun\-08 +\& Leon 5.12.4 2011\-Jun\-20 +\& Dominic 5.12.5 2012\-Nov\-10 +\& +\& Leon 5.13.0 2010\-Apr\-20 The 5.13 development track +\& Ricardo 5.13.1 2010\-May\-20 +\& Matt 5.13.2 2010\-Jun\-22 +\& David G 5.13.3 2010\-Jul\-20 +\& Florian 5.13.4 2010\-Aug\-20 +\& Steve 5.13.5 2010\-Sep\-19 +\& Miyagawa 5.13.6 2010\-Oct\-20 +\& BinGOs 5.13.7 2010\-Nov\-20 +\& Zefram 5.13.8 2010\-Dec\-20 +\& Jesse 5.13.9 2011\-Jan\-20 +\& \*(Aevar 5.13.10 2011\-Feb\-20 +\& Florian 5.13.11 2011\-Mar\-20 +\& Jesse 5.14.0RC1 2011\-Apr\-20 +\& Jesse 5.14.0RC2 2011\-May\-04 +\& Jesse 5.14.0RC3 2011\-May\-11 +\& +\& Jesse 5.14.0 2011\-May\-14 The 5.14 maintenance track +\& Jesse 5.14.1 2011\-Jun\-16 +\& Florian 5.14.2\-RC1 2011\-Sep\-19 +\& 5.14.2 2011\-Sep\-26 +\& Dominic 5.14.3 2012\-Oct\-12 +\& David M 5.14.4\-RC1 2013\-Mar\-05 +\& David M 5.14.4\-RC2 2013\-Mar\-07 +\& David M 5.14.4 2013\-Mar\-10 +\& +\& David G 5.15.0 2011\-Jun\-20 The 5.15 development track +\& Zefram 5.15.1 2011\-Jul\-20 +\& Ricardo 5.15.2 2011\-Aug\-20 +\& Stevan 5.15.3 2011\-Sep\-20 +\& Florian 5.15.4 2011\-Oct\-20 +\& Steve 5.15.5 2011\-Nov\-20 +\& Dave R 5.15.6 2011\-Dec\-20 +\& BinGOs 5.15.7 2012\-Jan\-20 +\& Max M 5.15.8 2012\-Feb\-20 +\& Abigail 5.15.9 2012\-Mar\-20 +\& Ricardo 5.16.0\-RC0 2012\-May\-10 +\& Ricardo 5.16.0\-RC1 2012\-May\-14 +\& Ricardo 5.16.0\-RC2 2012\-May\-15 +\& +\& Ricardo 5.16.0 2012\-May\-20 The 5.16 maintenance track +\& Ricardo 5.16.1 2012\-Aug\-08 +\& Ricardo 5.16.2 2012\-Nov\-01 +\& Ricardo 5.16.3\-RC1 2013\-Mar\-06 +\& Ricardo 5.16.3 2013\-Mar\-11 +\& +\& Zefram 5.17.0 2012\-May\-26 The 5.17 development track +\& Jesse L 5.17.1 2012\-Jun\-20 +\& TonyC 5.17.2 2012\-Jul\-20 +\& Steve 5.17.3 2012\-Aug\-20 +\& Florian 5.17.4 2012\-Sep\-20 +\& Florian 5.17.5 2012\-Oct\-20 +\& Ricardo 5.17.6 2012\-Nov\-20 +\& Dave R 5.17.7 2012\-Dec\-18 +\& Aaron 5.17.8 2013\-Jan\-20 +\& BinGOs 5.17.9 2013\-Feb\-20 +\& Max M 5.17.10 2013\-Mar\-21 +\& Ricardo 5.17.11 2013\-Apr\-20 +\& +\& Ricardo 5.18.0\-RC1 2013\-May\-11 The 5.18 maintenance track +\& Ricardo 5.18.0\-RC2 2013\-May\-12 +\& Ricardo 5.18.0\-RC3 2013\-May\-13 +\& Ricardo 5.18.0\-RC4 2013\-May\-15 +\& Ricardo 5.18.0 2013\-May\-18 +\& Ricardo 5.18.1\-RC1 2013\-Aug\-01 +\& Ricardo 5.18.1\-RC2 2013\-Aug\-03 +\& Ricardo 5.18.1\-RC3 2013\-Aug\-08 +\& Ricardo 5.18.1 2013\-Aug\-12 +\& Ricardo 5.18.2 2014\-Jan\-06 +\& Ricardo 5.18.3\-RC1 2014\-Sep\-17 +\& Ricardo 5.18.3\-RC2 2014\-Sep\-27 +\& Ricardo 5.18.3 2014\-Oct\-01 +\& Ricardo 5.18.4 2014\-Oct\-01 +\& +\& Ricardo 5.19.0 2013\-May\-20 The 5.19 development track +\& David G 5.19.1 2013\-Jun\-21 +\& Aristotle 5.19.2 2013\-Jul\-22 +\& Steve 5.19.3 2013\-Aug\-20 +\& Steve 5.19.4 2013\-Sep\-20 +\& Steve 5.19.5 2013\-Oct\-20 +\& BinGOs 5.19.6 2013\-Nov\-20 +\& Abigail 5.19.7 2013\-Dec\-20 +\& Ricardo 5.19.8 2014\-Jan\-20 +\& TonyC 5.19.9 2014\-Feb\-20 +\& Aaron 5.19.10 2014\-Mar\-20 +\& Steve 5.19.11 2014\-Apr\-20 +\& +\& Ricardo 5.20.0\-RC1 2014\-May\-16 The 5.20 maintenance track +\& Ricardo 5.20.0 2014\-May\-27 +\& Steve 5.20.1\-RC1 2014\-Aug\-25 +\& Steve 5.20.1\-RC2 2014\-Sep\-07 +\& Steve 5.20.1 2014\-Sep\-14 +\& Steve 5.20.2\-RC1 2015\-Jan\-31 +\& Steve 5.20.2 2015\-Feb\-14 +\& Steve 5.20.3\-RC1 2015\-Aug\-22 +\& Steve 5.20.3\-RC2 2015\-Aug\-29 +\& Steve 5.20.3 2015\-Sep\-12 +\& +\& Ricardo 5.21.0 2014\-May\-27 The 5.21 development track +\& Matthew H 5.21.1 2014\-Jun\-20 +\& Abigail 5.21.2 2014\-Jul\-20 +\& Peter 5.21.3 2014\-Aug\-20 +\& Steve 5.21.4 2014\-Sep\-20 +\& Abigail 5.21.5 2014\-Oct\-20 +\& BinGOs 5.21.6 2014\-Nov\-20 +\& Max M 5.21.7 2014\-Dec\-20 +\& Matthew H 5.21.8 2015\-Jan\-20 +\& Sawyer X 5.21.9 2015\-Feb\-20 +\& Steve 5.21.10 2015\-Mar\-20 +\& Steve 5.21.11 2015\-Apr\-20 +\& +\& Ricardo 5.22.0\-RC1 2015\-May\-19 The 5.22 maintenance track +\& Ricardo 5.22.0\-RC2 2015\-May\-21 +\& Ricardo 5.22.0 2015\-Jun\-01 +\& Steve 5.22.1\-RC1 2015\-Oct\-31 +\& Steve 5.22.1\-RC2 2015\-Nov\-15 +\& Steve 5.22.1\-RC3 2015\-Dec\-02 +\& Steve 5.22.1\-RC4 2015\-Dec\-08 +\& Steve 5.22.1 2015\-Dec\-13 +\& Steve 5.22.2\-RC1 2016\-Apr\-10 +\& Steve 5.22.2 2016\-Apr\-29 +\& Steve 5.22.3\-RC1 2016\-Jul\-17 +\& Steve 5.22.3\-RC2 2016\-Jul\-25 +\& Steve 5.22.3\-RC3 2016\-Aug\-11 +\& Steve 5.22.3\-RC4 2016\-Oct\-12 +\& Steve 5.22.3\-RC5 2017\-Jan\-02 +\& Steve 5.22.3 2017\-Jan\-14 +\& Steve 5.22.4\-RC1 2017\-Jul\-01 +\& Steve 5.22.4 2017\-Jul\-15 +\& +\& Ricardo 5.23.0 2015\-Jun\-20 The 5.23 development track +\& Matthew H 5.23.1 2015\-Jul\-20 +\& Matthew H 5.23.2 2015\-Aug\-20 +\& Peter 5.23.3 2015\-Sep\-20 +\& Steve 5.23.4 2015\-Oct\-20 +\& Abigail 5.23.5 2015\-Nov\-20 +\& David G 5.23.6 2015\-Dec\-21 +\& Stevan 5.23.7 2016\-Jan\-20 +\& Sawyer X 5.23.8 2016\-Feb\-20 +\& Abigail 5.23.9 2016\-Mar\-20 +\& +\& Ricardo 5.24.0\-RC1 2016\-Apr\-13 The 5.24 maintenance track +\& Ricardo 5.24.0\-RC2 2016\-Apr\-23 +\& Ricardo 5.24.0\-RC3 2016\-Apr\-26 +\& Ricardo 5.24.0\-RC4 2016\-May\-02 +\& Ricardo 5.24.0\-RC5 2016\-May\-04 +\& Ricardo 5.24.0 2016\-May\-09 +\& Steve 5.24.1\-RC1 2016\-Jul\-17 +\& Steve 5.24.1\-RC2 2016\-Jul\-25 +\& Steve 5.24.1\-RC3 2016\-Aug\-11 +\& Steve 5.24.1\-RC4 2016\-Oct\-12 +\& Steve 5.24.1\-RC5 2017\-Jan\-02 +\& Steve 5.24.1 2017\-Jan\-14 +\& Steve 5.24.2\-RC1 2017\-Jul\-01 +\& Steve 5.24.2 2017\-Jul\-15 +\& Steve 5.24.3\-RC1 2017\-Sep\-10 +\& Steve 5.24.3 2017\-Sep\-22 +\& Steve 5.24.4\-RC1 2018\-Mar\-24 +\& Steve 5.24.4 2018\-Apr\-14 +\& +\& Ricardo 5.25.0 2016\-May\-09 The 5.25 development track +\& Sawyer X 5.25.1 2016\-May\-20 +\& Matthew H 5.25.2 2016\-Jun\-20 +\& Steve 5.25.3 2016\-Jul\-20 +\& BinGOs 5.25.4 2016\-Aug\-20 +\& Stevan 5.25.5 2016\-Sep\-20 +\& Aaron 5.25.6 2016\-Oct\-20 +\& Chad 5.25.7 2016\-Nov\-20 +\& Sawyer X 5.25.8 2016\-Dec\-20 +\& Abigail 5.25.9 2017\-Jan\-20 +\& Renee 5.25.10 2017\-Feb\-20 +\& Sawyer X 5.25.11 2017\-Mar\-20 +\& Sawyer X 5.25.12 2017\-Apr\-20 +\& +\& Sawyer X 5.26.0\-RC1 2017\-May\-11 The 5.26 maintenance track +\& Sawyer X 5.26.0\-RC2 2017\-May\-23 +\& Sawyer X 5.26.0 2017\-May\-30 +\& Steve 5.26.1\-RC1 2017\-Sep\-10 +\& Steve 5.26.1 2017\-Sep\-22 +\& Steve 5.26.2\-RC1 2018\-Mar\-24 +\& Steve 5.26.2 2018\-Apr\-14 +\& Steve 5.26.3\-RC1 2018\-Nov\-08 +\& Steve 5.26.3 2018\-Nov\-29 +\& +\& Sawyer X 5.27.0 2017\-May\-31 The 5.27 development track +\& Eric 5.27.1 2017\-Jun\-20 +\& Aaron 5.27.2 2017\-Jul\-20 +\& Matthew H 5.27.3 2017\-Aug\-21 +\& John 5.27.4 2017\-Sep\-20 +\& Steve 5.27.5 2017\-Oct\-20 +\& Ether 5.27.6 2017\-Nov\-20 +\& BinGOs 5.27.7 2017\-Dec\-20 +\& Abigail 5.27.8 2018\-Jan\-20 +\& Renee 5.27.9 2018\-Feb\-20 +\& Todd 5.27.10 2018\-Mar\-20 +\& Sawyer X 5.27.11 2018\-Apr\-20 +\& +\& Sawyer X 5.28.0\-RC1 2018\-May\-21 The 5.28 maintenance track +\& Sawyer X 5.28.0\-RC2 2018\-Jun\-06 +\& Sawyer X 5.28.0\-RC3 2018\-Jun\-18 +\& Sawyer X 5.28.0\-RC4 2018\-Jun\-19 +\& Sawyer X 5.28.0 2018\-Jun\-22 +\& Steve 5.28.1\-RC1 2018\-Nov\-08 +\& Steve 5.28.1 2018\-Nov\-29 +\& Steve 5.28.2\-RC1 2019\-Apr\-05 +\& Steve 5.28.2 2019\-Apr\-19 +\& Steve 5.28.3\-RC1 2020\-May\-18 +\& Steve 5.28.3 2020\-Jun\-01 +\& +\& Sawyer X 5.29.0 2018\-Jun\-26 The 5.29 development track +\& Steve 5.29.1 2018\-Jul\-20 +\& BinGOs 5.29.2 2018\-Aug\-20 +\& John 5.29.3 2018\-Sep\-20 +\& Aaron 5.29.4 2018\-Oct\-20 +\& Ether 5.29.5 2018\-Nov\-20 +\& Abigail 5.29.6 2018\-Dec\-18 +\& Abigail 5.29.7 2019\-Jan\-20 +\& Nicolas R 5.29.8 2019\-Feb\-20 +\& Zak Elep 5.29.9 2019\-Mar\-20 +\& Sawyer X 5.29.10 2019\-Apr\-20 +\& +\& Sawyer X 5.30.0\-RC1 2019\-May\-11 The 5.30 maintenance track +\& Sawyer X 5.30.0\-RC2 2019\-May\-17 +\& Sawyer X 5.30.0 2019\-May\-22 +\& Steve 5.30.1\-RC1 2019\-Oct\-27 +\& Steve 5.30.1 2019\-Nov\-10 +\& Steve 5.30.2\-RC1 2020\-Feb\-29 +\& Steve 5.30.2 2020\-Mar\-14 +\& Steve 5.30.3\-RC1 2020\-May\-18 +\& Steve 5.30.3 2020\-Jun\-01 +\& +\& Sawyer X 5.31.0 2019\-May\-24 The 5.31 development track +\& Ether 5.31.1 2019\-Jun\-20 +\& Steve 5.31.2 2019\-Jul\-20 +\& Tom H 5.31.3 2019\-Aug\-20 +\& Max M 5.31.4 2019\-Sep\-20 +\& Steve 5.31.5 2019\-Oct\-20 +\& BinGOs 5.31.6 2019\-Nov\-20 +\& Nicolas R 5.31.7 2019\-Dec\-20 +\& Matthew H 5.31.8 2020\-Jan\-20 +\& Renee 5.31.9 2020\-Feb\-20 +\& Sawyer X 5.31.10 2020\-Mar\-20 +\& Sawyer X 5.31.11 2020\-Apr\-28 +\& +\& Sawyer X 5.32.0\-RC0 2020\-May\-30 The 5.32 maintenance track +\& Sawyer X 5.32.0\-RC1 2020\-Jun\-07 +\& Sawyer X 5.32.0 2020\-Jun\-20 +\& Steve 5.32.1\-RC1 2021\-Jan\-09 +\& Steve 5.32.1 2021\-Jan\-23 +\& +\& Sawyer X 5.33.0 2020\-Jul\-17 The 5.33 development track +\& Ether 5.33.1 2020\-Aug\-20 +\& Sawyer X 5.33.2 2020\-Sep\-20 +\& Steve 5.33.3 2020\-Oct\-20 +\& Tom H 5.33.4 2020\-Nov\-20 +\& Max M 5.33.5 2020\-Dec\-20 +\& Richard L 5.33.6 2021\-Jan\-20 +.Ve +.SS "\s-1SELECTED RELEASE SIZES\s0" +.IX Subsection "SELECTED RELEASE SIZES" +For example the notation \*(L"core: 212 29\*(R" in the release 1.000 means that +it had in the core 212 kilobytes, in 29 files. The \*(L"core\*(R"..\*(L"doc\*(R" are +explained below. +.PP +.Vb 2 +\& release core lib ext t doc +\& ====================================================================== +\& +\& 1.000 212 29 \- \- \- \- 38 51 62 3 +\& 1.014 219 29 \- \- \- \- 39 52 68 4 +\& 2.000 309 31 2 3 \- \- 55 57 92 4 +\& 2.001 312 31 2 3 \- \- 55 57 94 4 +\& 3.000 508 36 24 11 \- \- 79 73 156 5 +\& 3.044 645 37 61 20 \- \- 90 74 190 6 +\& 4.000 635 37 59 20 \- \- 91 75 198 4 +\& 4.019 680 37 85 29 \- \- 98 76 199 4 +\& 4.036 709 37 89 30 \- \- 98 76 208 5 +\& 5.000alpha2 785 50 114 32 \- \- 112 86 209 5 +\& 5.000alpha3 801 50 117 33 \- \- 121 87 209 5 +\& 5.000alpha9 1022 56 149 43 116 29 125 90 217 6 +\& 5.000a12h 978 49 140 49 205 46 152 97 228 9 +\& 5.000b3h 1035 53 232 70 216 38 162 94 218 21 +\& 5.000 1038 53 250 76 216 38 154 92 536 62 +\& 5.001m 1071 54 388 82 240 38 159 95 544 29 +\& 5.002 1121 54 661 101 287 43 155 94 847 35 +\& 5.003 1129 54 680 102 291 43 166 100 853 35 +\& 5.003_07 1231 60 748 106 396 53 213 137 976 39 +\& 5.004 1351 60 1230 136 408 51 355 161 1587 55 +\& 5.004_01 1356 60 1258 138 410 51 358 161 1587 55 +\& 5.004_04 1375 60 1294 139 413 51 394 162 1629 55 +\& 5.004_05 1463 60 1435 150 394 50 445 175 1855 59 +\& 5.004_51 1401 61 1260 140 413 53 358 162 1594 56 +\& 5.004_53 1422 62 1295 141 438 70 394 162 1637 56 +\& 5.004_56 1501 66 1301 140 447 74 408 165 1648 57 +\& 5.004_59 1555 72 1317 142 448 74 424 171 1678 58 +\& 5.004_62 1602 77 1327 144 629 92 428 173 1674 58 +\& 5.004_65 1626 77 1358 146 615 92 446 179 1698 60 +\& 5.004_68 1856 74 1382 152 619 92 463 187 1784 60 +\& 5.004_70 1863 75 1456 154 675 92 494 194 1809 60 +\& 5.004_73 1874 76 1467 152 762 102 506 196 1883 61 +\& 5.004_75 1877 76 1467 152 770 103 508 196 1896 62 +\& 5.005 1896 76 1469 152 795 103 509 197 1945 63 +\& 5.005_03 1936 77 1541 153 813 104 551 201 2176 72 +\& 5.005_50 1969 78 1842 301 795 103 514 198 1948 63 +\& 5.005_53 1999 79 1885 303 806 104 602 224 2002 67 +\& 5.005_56 2086 79 1970 307 866 113 672 238 2221 75 +\& 5.6.0 2820 79 2626 364 1096 129 863 280 2840 93 +\& 5.6.1 2946 78 2921 430 1171 132 1024 304 3330 102 +\& 5.6.2 2947 78 3143 451 1247 127 1303 387 3406 102 +\& 5.7.0 2977 80 2801 425 1250 132 975 307 3206 100 +\& 5.7.1 3351 84 3442 455 1944 167 1334 357 3698 124 +\& 5.7.2 3491 87 4858 618 3290 298 1598 449 3910 139 +\& 5.7.3 3299 85 4295 537 2196 300 2176 626 4171 120 +\& 5.8.0 3489 87 4533 585 2437 331 2588 726 4368 125 +\& 5.8.1 3674 90 5104 623 2604 353 2983 836 4625 134 +\& 5.8.2 3633 90 5111 623 2623 357 3019 848 4634 135 +\& 5.8.3 3625 90 5141 624 2660 363 3083 869 4669 136 +\& 5.8.4 3653 90 5170 634 2684 368 3148 885 4689 137 +\& 5.8.5 3664 90 4260 303 2707 369 3208 898 4689 138 +\& 5.8.6 3690 90 4271 303 3141 396 3411 925 4709 139 +\& 5.8.7 3788 90 4322 307 3297 401 3485 964 4744 141 +\& 5.8.8 3895 90 4357 314 3409 431 3622 1017 4979 144 +\& 5.8.9 4132 93 5508 330 3826 529 4364 1234 5348 152 +\& 5.9.0 3657 90 4951 626 2603 354 3011 841 4609 135 +\& 5.9.1 3580 90 5196 634 2665 367 3186 889 4725 138 +\& 5.9.2 3863 90 4654 312 3283 403 3551 973 4800 142 +\& 5.9.3 4096 91 5318 381 4806 597 4272 1214 5139 147 +\& 5.9.4 4393 94 5718 415 4578 642 4646 1310 5335 153 +\& 5.9.5 4681 96 6849 479 4827 671 5155 1490 5572 159 +\& 5.10.0 4710 97 7050 486 4899 673 5275 1503 5673 160 +\& 5.10.1 4858 98 7440 519 6195 921 6147 1751 5151 163 +\& 5.12.0 4999 100 1146 121 15227 2176 6400 1843 5342 168 +\& 5.12.1 5000 100 1146 121 15283 2178 6407 1846 5354 169 +\& 5.12.2 5003 100 1146 121 15404 2178 6413 1846 5376 170 +\& 5.12.3 5004 100 1146 121 15529 2180 6417 1848 5391 171 +\& 5.14.0 5328 104 1100 114 17779 2479 7697 2130 5871 188 +\& 5.16.0 5562 109 1077 80 20504 2702 8750 2375 4815 152 +\& 5.18.0 5892 113 1088 79 20077 2760 9365 2439 4943 154 +\& 5.20.0 6243 115 1187 75 19499 2701 9620 2457 5145 159 +\& 5.22.0 7819 115 1284 77 19121 2635 9772 2434 5615 176 +\& 5.24.0 7922 113 1287 77 19535 2677 9994 2465 5702 177 +\& 5.26.0 9140 121 24925 1200 40643 3017 10514 2614 7854 211 +\& 5.28.0 13056 128 27267 1230 41745 3130 10952 2715 8185 218 +\& 5.30.0 13535 128 26294 1237 39643 3080 11083 2711 8252 222 +\& 5.32.0 14147 127 25562 1255 40869 3098 11334 2734 8407 225 +.Ve +.PP +The \*(L"core\*(R"...\*(L"doc\*(R" mean the following files from the Perl source code +distribution. The glob notation ** means recursively, (.) means +regular files. +.PP +.Vb 6 +\& core *.[hcy] +\& lib lib/**/*.p[ml] +\& ext ext/**/*.{[hcyt],xs,pm} (for \-5.10.1) or +\& {dist,ext,cpan}/**/*.{[hcyt],xs,pm} (for 5.12.0\-) +\& t t/**/*(.) (for 1\-5.005_56) or **/*.t (for 5.6.0\-5.7.3) +\& doc {README*,INSTALL,*[_.]man{,.?},pod/**/*.pod} +.Ve +.PP +Here are some statistics for the other subdirectories and one file in +the Perl source distribution for somewhat more selected releases. +.PP +.Vb 2 +\& ====================================================================== +\& Legend: kB # +\& +\& 1.014 2.001 3.044 +\& +\& Configure 31 1 37 1 62 1 +\& eg \- \- 34 28 47 39 +\& h2pl \- \- \- \- 12 12 +\& msdos \- \- \- \- 41 13 +\& os2 \- \- \- \- 63 22 +\& usub \- \- \- \- 21 16 +\& x2p 103 17 104 17 137 17 +\& +\& ====================================================================== +\& +\& 4.000 4.019 4.036 +\& +\& atarist \- \- \- \- 113 31 +\& Configure 73 1 83 1 86 1 +\& eg 47 39 47 39 47 39 +\& emacs 67 4 67 4 67 4 +\& h2pl 12 12 12 12 12 12 +\& hints \- \- 5 42 11 56 +\& msdos 57 15 58 15 60 15 +\& os2 81 29 81 29 113 31 +\& usub 25 7 43 8 43 8 +\& x2p 147 18 152 19 154 19 +\& +\& ====================================================================== +\& +\& 5.000a2 5.000a12h 5.000b3h 5.000 5.001m +\& +\& apollo 8 3 8 3 8 3 8 3 8 3 +\& atarist 113 31 113 31 \- \- \- \- \- \- +\& bench \- \- 0 1 \- \- \- \- \- \- +\& Bugs 2 5 26 1 \- \- \- \- \- \- +\& dlperl 40 5 \- \- \- \- \- \- \- \- +\& do 127 71 \- \- \- \- \- \- \- \- +\& Configure \- \- 153 1 159 1 160 1 180 1 +\& Doc \- \- 26 1 75 7 11 1 11 1 +\& eg 79 58 53 44 51 43 54 44 54 44 +\& emacs 67 4 104 6 104 6 104 1 104 6 +\& h2pl 12 12 12 12 12 12 12 12 12 12 +\& hints 11 56 12 46 18 48 18 48 44 56 +\& msdos 60 15 60 15 \- \- \- \- \- \- +\& os2 113 31 113 31 \- \- \- \- \- \- +\& U \- \- 62 8 112 42 \- \- \- \- +\& usub 43 8 \- \- \- \- \- \- \- \- +\& vms \- \- 80 7 123 9 184 15 304 20 +\& x2p 171 22 171 21 162 20 162 20 279 20 +\& +\& ====================================================================== +\& +\& 5.002 5.003 5.003_07 +\& +\& Configure 201 1 201 1 217 1 +\& eg 54 44 54 44 54 44 +\& emacs 108 1 108 1 143 1 +\& h2pl 12 12 12 12 12 12 +\& hints 73 59 77 60 90 62 +\& os2 84 17 56 10 117 42 +\& plan9 \- \- \- \- 79 15 +\& Porting \- \- \- \- 51 1 +\& utils 87 7 88 7 97 7 +\& vms 500 24 475 26 505 27 +\& x2p 280 20 280 20 280 19 +\& +\& ====================================================================== +\& +\& 5.004 5.004_04 5.004_62 5.004_65 5.004_68 +\& +\& beos \- \- \- \- \- \- 1 1 1 1 +\& Configure 225 1 225 1 240 1 248 1 256 1 +\& cygwin32 23 5 23 5 23 5 24 5 24 5 +\& djgpp \- \- \- \- 14 5 14 5 14 5 +\& eg 81 62 81 62 81 62 81 62 81 62 +\& emacs 194 1 204 1 212 2 212 2 212 2 +\& h2pl 12 12 12 12 12 12 12 12 12 12 +\& hints 129 69 132 71 144 72 151 74 155 74 +\& os2 121 42 127 42 127 44 129 44 129 44 +\& plan9 82 15 82 15 82 15 82 15 82 15 +\& Porting 94 2 109 4 203 6 234 8 241 9 +\& qnx 1 2 1 2 1 2 1 2 1 2 +\& utils 112 8 118 8 124 8 156 9 159 9 +\& vms 518 34 524 34 538 34 569 34 569 34 +\& win32 285 33 378 36 470 39 493 39 575 41 +\& x2p 281 19 281 19 281 19 282 19 281 19 +\& +\& ====================================================================== +\& +\& 5.004_70 5.004_73 5.004_75 5.005 5.005_03 +\& +\& apollo \- \- \- \- \- \- \- \- 0 1 +\& beos 1 1 1 1 1 1 1 1 1 1 +\& Configure 256 1 256 1 264 1 264 1 270 1 +\& cygwin32 24 5 24 5 24 5 24 5 24 5 +\& djgpp 14 5 14 5 14 5 14 5 15 5 +\& eg 86 65 86 65 86 65 86 65 86 65 +\& emacs 262 2 262 2 262 2 262 2 274 2 +\& h2pl 12 12 12 12 12 12 12 12 12 12 +\& hints 157 74 157 74 159 74 160 74 179 77 +\& mint \- \- \- \- \- \- \- \- 4 7 +\& mpeix \- \- \- \- 5 3 5 3 5 3 +\& os2 129 44 139 44 142 44 143 44 148 44 +\& plan9 82 15 82 15 82 15 82 15 82 15 +\& Porting 241 9 253 9 259 10 264 12 272 13 +\& qnx 1 2 1 2 1 2 1 2 1 2 +\& utils 160 9 160 9 160 9 160 9 164 9 +\& vms 570 34 572 34 573 34 575 34 583 34 +\& vos \- \- \- \- \- \- \- \- 156 10 +\& win32 577 41 585 41 585 41 587 41 600 42 +\& x2p 281 19 281 19 281 19 281 19 281 19 +\& +\& ====================================================================== +\& +\& 5.6.0 5.6.1 5.6.2 5.7.3 +\& +\& apollo 8 3 8 3 8 3 8 3 +\& beos 5 2 5 2 5 2 6 4 +\& Configure 346 1 361 1 363 1 394 1 +\& Cross \- \- \- \- \- \- 4 2 +\& djgpp 19 6 19 6 19 6 21 7 +\& eg 112 71 112 71 112 71 \- \- +\& emacs 303 4 319 4 319 4 319 4 +\& epoc 29 8 35 8 35 8 36 8 +\& h2pl 24 15 24 15 24 15 24 15 +\& hints 242 83 250 84 321 89 272 87 +\& mint 11 9 11 9 11 9 11 9 +\& mpeix 9 4 9 4 9 4 9 4 +\& NetWare \- \- \- \- \- \- 423 57 +\& os2 214 59 224 60 224 60 357 66 +\& plan9 92 17 92 17 92 17 85 15 +\& Porting 361 15 390 16 390 16 425 21 +\& qnx 5 3 5 3 5 3 5 3 +\& utils 228 12 221 11 222 11 267 13 +\& uts \- \- \- \- \- \- 12 3 +\& vmesa 25 4 25 4 25 4 25 4 +\& vms 686 38 627 38 627 38 649 36 +\& vos 227 12 249 15 248 15 281 17 +\& win32 755 41 782 42 801 42 1006 50 +\& x2p 307 20 307 20 307 20 345 20 +\& +\& ====================================================================== +\& +\& 5.8.0 5.8.1 5.8.2 5.8.3 5.8.4 +\& +\& apollo 8 3 8 3 8 3 8 3 8 3 +\& beos 6 4 6 4 6 4 6 4 6 4 +\& Configure 472 1 493 1 493 1 493 1 494 1 +\& Cross 4 2 45 10 45 10 45 10 45 10 +\& djgpp 21 7 21 7 21 7 21 7 21 7 +\& emacs 319 4 329 4 329 4 329 4 329 4 +\& epoc 33 8 33 8 33 8 33 8 33 8 +\& h2pl 24 15 24 15 24 15 24 15 24 15 +\& hints 294 88 321 89 321 89 321 89 348 91 +\& mint 11 9 11 9 11 9 11 9 11 9 +\& mpeix 24 5 25 5 25 5 25 5 25 5 +\& NetWare 488 61 490 61 490 61 490 61 488 61 +\& os2 361 66 445 67 450 67 488 67 488 67 +\& plan9 85 15 325 17 325 17 325 17 321 17 +\& Porting 479 22 537 32 538 32 539 32 538 33 +\& qnx 5 3 5 3 5 3 5 3 5 3 +\& utils 275 15 258 16 258 16 263 19 263 19 +\& uts 12 3 12 3 12 3 12 3 12 3 +\& vmesa 25 4 25 4 25 4 25 4 25 4 +\& vms 648 36 654 36 654 36 656 36 656 36 +\& vos 330 20 335 20 335 20 335 20 335 20 +\& win32 1062 49 1125 49 1127 49 1126 49 1181 56 +\& x2p 347 20 348 20 348 20 348 20 348 20 +\& +\& ====================================================================== +\& +\& 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9 +\& +\& apollo 8 3 8 3 8 3 8 3 8 3 +\& beos 6 4 6 4 8 4 8 4 8 4 +\& Configure 494 1 494 1 495 1 506 1 520 1 +\& Cross 45 10 45 10 45 10 45 10 46 10 +\& djgpp 21 7 21 7 21 7 21 7 21 7 +\& emacs 329 4 329 4 329 4 329 4 406 4 +\& epoc 33 8 33 8 33 8 34 8 35 8 +\& h2pl 24 15 24 15 24 15 24 15 24 15 +\& hints 350 91 352 91 355 94 360 94 387 99 +\& mint 11 9 11 9 11 9 11 9 11 9 +\& mpeix 25 5 25 5 25 5 49 6 49 6 +\& NetWare 488 61 488 61 488 61 490 61 491 61 +\& os2 488 67 488 67 488 67 488 67 552 70 +\& plan9 321 17 321 17 321 17 322 17 324 17 +\& Porting 538 34 548 35 549 35 564 37 625 41 +\& qnx 5 3 5 3 5 3 5 3 5 3 +\& utils 265 19 265 19 266 19 267 19 281 21 +\& uts 12 3 12 3 12 3 12 3 12 3 +\& vmesa 25 4 25 4 25 4 25 4 25 4 +\& vms 657 36 658 36 662 36 664 36 716 35 +\& vos 335 20 335 20 335 20 336 21 345 22 +\& win32 1183 56 1190 56 1199 56 1219 56 1484 68 +\& x2p 349 20 349 20 349 20 349 19 350 19 +\& +\& ====================================================================== +\& +\& 5.9.0 5.9.1 5.9.2 5.9.3 5.9.4 +\& +\& apollo 8 3 8 3 8 3 8 3 8 3 +\& beos 6 4 6 4 8 4 8 4 8 4 +\& Configure 493 1 493 1 495 1 508 1 512 1 +\& Cross 45 10 45 10 45 10 45 10 46 10 +\& djgpp 21 7 21 7 21 7 21 7 21 7 +\& emacs 329 4 329 4 329 4 329 4 329 4 +\& epoc 33 8 33 8 33 8 34 8 34 8 +\& h2pl 24 15 24 15 24 15 24 15 24 15 +\& hints 321 89 346 91 355 94 359 94 366 96 +\& mad \- \- \- \- \- \- \- \- 174 6 +\& mint 11 9 11 9 11 9 11 9 11 9 +\& mpeix 25 5 25 5 25 5 49 6 49 6 +\& NetWare 489 61 487 61 487 61 489 61 489 61 +\& os2 444 67 488 67 488 67 488 67 488 67 +\& plan9 325 17 321 17 321 17 322 17 323 17 +\& Porting 537 32 536 33 549 36 564 38 576 38 +\& qnx 5 3 5 3 5 3 5 3 5 3 +\& symbian \- \- \- \- \- \- 293 53 293 53 +\& utils 258 16 263 19 268 20 273 23 275 24 +\& uts 12 3 12 3 12 3 12 3 12 3 +\& vmesa 25 4 25 4 25 4 25 4 25 4 +\& vms 660 36 547 33 553 33 661 33 696 33 +\& vos 11 7 11 7 11 7 11 7 11 7 +\& win32 1120 49 1124 51 1191 56 1209 56 1719 90 +\& x2p 348 20 348 20 349 20 349 19 349 19 +\& +\& ====================================================================== +\& +\& 5.9.5 5.10.0 5.10.1 5.12.0 5.12.1 +\& +\& apollo 8 3 8 3 0 3 0 3 0 3 +\& beos 8 4 8 4 4 4 4 4 4 4 +\& Configure 518 1 518 1 533 1 536 1 536 1 +\& Cross 122 15 122 15 119 15 118 15 118 15 +\& djgpp 21 7 21 7 17 7 17 7 17 7 +\& emacs 329 4 406 4 402 4 402 4 402 4 +\& epoc 34 8 35 8 31 8 31 8 31 8 +\& h2pl 24 15 24 15 12 15 12 15 12 15 +\& hints 377 98 381 98 385 100 368 97 368 97 +\& mad 182 8 182 8 174 8 174 8 174 8 +\& mint 11 9 11 9 3 9 \- \- \- \- +\& mpeix 49 6 49 6 45 6 45 6 45 6 +\& NetWare 489 61 489 61 465 61 466 61 466 61 +\& os2 552 70 552 70 507 70 507 70 507 70 +\& plan9 324 17 324 17 316 17 316 17 316 17 +\& Porting 627 40 632 40 933 53 749 54 749 54 +\& qnx 5 3 5 4 1 4 1 4 1 4 +\& symbian 300 54 300 54 290 54 288 54 288 54 +\& utils 260 26 264 27 268 27 269 27 269 27 +\& uts 12 3 12 3 8 3 8 3 8 3 +\& vmesa 25 4 25 4 21 4 21 4 21 4 +\& vms 690 32 722 32 693 30 645 18 645 18 +\& vos 19 8 19 8 16 8 16 8 16 8 +\& win32 1482 68 1485 68 1497 70 1841 73 1841 73 +\& x2p 349 19 349 19 345 19 345 19 345 19 +\& +\& ====================================================================== +\& +\& 5.12.2 5.12.3 5.14.0 5.16.0 5.18.0 +\& +\& apollo 0 3 0 3 \- \- \- \- \- \- +\& beos 4 4 4 4 5 4 5 4 \- \- +\& Configure 536 1 536 1 539 1 547 1 550 1 +\& Cross 118 15 118 15 118 15 118 15 118 15 +\& djgpp 17 7 17 7 18 7 18 7 18 7 +\& emacs 402 4 402 4 \- \- \- \- \- \- +\& epoc 31 8 31 8 32 8 30 8 \- \- +\& h2pl 12 15 12 15 15 15 15 15 13 15 +\& hints 368 97 368 97 370 96 371 96 354 91 +\& mad 174 8 174 8 176 8 176 8 174 8 +\& mpeix 45 6 45 6 46 6 46 6 \- \- +\& NetWare 466 61 466 61 473 61 472 61 469 61 +\& os2 507 70 507 70 518 70 519 70 510 70 +\& plan9 316 17 316 17 319 17 319 17 318 17 +\& Porting 750 54 750 54 855 60 1093 69 1149 70 +\& qnx 1 4 1 4 2 4 2 4 1 4 +\& symbian 288 54 288 54 292 54 292 54 290 54 +\& utils 269 27 269 27 249 29 245 30 246 31 +\& uts 8 3 8 3 9 3 9 3 \- \- +\& vmesa 21 4 21 4 22 4 22 4 \- \- +\& vms 646 18 644 18 639 17 571 15 564 15 +\& vos 16 8 16 8 17 8 9 7 8 7 +\& win32 1841 73 1841 73 1833 72 1655 67 1157 62 +\& x2p 345 19 345 19 346 19 345 19 344 20 +\& +\& ====================================================================== +\& +\& 5.20.0 5.22.0 5.24.0 +\& +\& Configure 552 1 570 1 586 1 +\& Cross 118 15 118 15 118 15 +\& djgpp 18 7 17 7 17 7 +\& h2pl 13 15 13 15 13 15 +\& hints 355 90 356 87 362 87 +\& mad 174 8 \- \- \- \- +\& NetWare 467 61 466 61 467 61 +\& os2 510 70 510 70 510 70 +\& plan9 316 17 317 17 314 17 +\& Porting 1204 68 1393 71 1321 71 +\& qnx 1 4 1 4 1 4 +\& symbian 290 54 291 54 292 54 +\& utils 241 27 242 27 679 53 +\& vms 538 12 532 12 524 12 +\& vos 8 7 8 7 8 7 +\& win32 1183 64 1201 64 1268 65 +\& x2p 341 19 \- \- \- \- +\& +\& ====================================================================== +\& +\& 5.26.0 5.28.0 5.30.0 +\& +\& Configure 593 1 580 1 587 1 +\& Cross 122 15 125 15 126 15 +\& djgpp 21 7 21 7 21 7 +\& h2pl 24 15 24 15 24 15 +\& hints 376 87 364 85 372 86 +\& mad \- \- \- \- \- \- +\& NetWare 499 61 493 61 493 61 +\& os2 552 70 552 70 552 70 +\& plan9 322 17 309 17 308 17 +\& Porting 1380 73 1462 75 1460 74 +\& qnx 5 4 5 4 5 4 +\& symbian 315 54 315 54 315 54 +\& utils 578 50 584 50 587 50 +\& vms 527 12 526 12 526 12 +\& vos 12 7 12 7 12 7 +\& win32 1313 65 1326 65 1331 65 +\& x2p \- \- \- \- \- \- +\& +\& 5.32.0 +\& +\& Configure: 588 1 +\& Cross : 126 15 +\& djgpp : 21 7 +\& h2pl : 24 15 +\& hints : 363 86 +\& NetWare : 484 61 +\& os2 : 552 70 +\& plan9 : 308 17 +\& Porting : 1482 75 +\& qnx : 5 4 +\& symbian : 307 54 +\& utils : 583 52 +\& vms : 527 12 +\& vos : 12 7 +\& win32 : 1011 47 +.Ve +.SS "\s-1SELECTED PATCH SIZES\s0" +.IX Subsection "SELECTED PATCH SIZES" +The \*(L"diff lines kB\*(R" means that for example the patch 5.003_08, to be +applied on top of the 5.003_07 (or whatever was before the 5.003_08) +added lines for 110 kilobytes, it removed lines for 19 kilobytes, and +changed lines for 424 kilobytes. Just the lines themselves are +counted, not their context. The \*(L"+ \- !\*(R" become from the \fBdiff\fR\|(1) +context diff output format. +.PP +.Vb 4 +\& Pump\- Release Date diff lines kB +\& king \-\-\-\-\-\-\-\-\-\-\-\-\- +\& + \- ! +\& ====================================================================== +\& +\& Chip 5.003_08 1996\-Nov\-19 110 19 424 +\& 5.003_09 1996\-Nov\-26 38 9 248 +\& 5.003_10 1996\-Nov\-29 29 2 27 +\& 5.003_11 1996\-Dec\-06 73 12 165 +\& 5.003_12 1996\-Dec\-19 275 6 436 +\& 5.003_13 1996\-Dec\-20 95 1 56 +\& 5.003_14 1996\-Dec\-23 23 7 333 +\& 5.003_15 1996\-Dec\-23 0 0 1 +\& 5.003_16 1996\-Dec\-24 12 3 50 +\& 5.003_17 1996\-Dec\-27 19 1 14 +\& 5.003_18 1996\-Dec\-31 21 1 32 +\& 5.003_19 1997\-Jan\-04 80 3 85 +\& 5.003_20 1997\-Jan\-07 18 1 146 +\& 5.003_21 1997\-Jan\-15 38 10 221 +\& 5.003_22 1997\-Jan\-16 4 0 18 +\& 5.003_23 1997\-Jan\-25 71 15 119 +\& 5.003_24 1997\-Jan\-29 426 1 20 +\& 5.003_25 1997\-Feb\-04 21 8 169 +\& 5.003_26 1997\-Feb\-10 16 1 15 +\& 5.003_27 1997\-Feb\-18 32 10 38 +\& 5.003_28 1997\-Feb\-21 58 4 66 +\& 5.003_90 1997\-Feb\-25 22 2 34 +\& 5.003_91 1997\-Mar\-01 37 1 39 +\& 5.003_92 1997\-Mar\-06 16 3 69 +\& 5.003_93 1997\-Mar\-10 12 3 15 +\& 5.003_94 1997\-Mar\-22 407 7 200 +\& 5.003_95 1997\-Mar\-25 41 1 37 +\& 5.003_96 1997\-Apr\-01 283 5 261 +\& 5.003_97 1997\-Apr\-03 13 2 34 +\& 5.003_97a 1997\-Apr\-05 57 1 27 +\& 5.003_97b 1997\-Apr\-08 14 1 20 +\& 5.003_97c 1997\-Apr\-10 20 1 16 +\& 5.003_97d 1997\-Apr\-13 8 0 16 +\& 5.003_97e 1997\-Apr\-15 15 4 46 +\& 5.003_97f 1997\-Apr\-17 7 1 33 +\& 5.003_97g 1997\-Apr\-18 6 1 42 +\& 5.003_97h 1997\-Apr\-24 23 3 68 +\& 5.003_97i 1997\-Apr\-25 23 1 31 +\& 5.003_97j 1997\-Apr\-28 36 1 49 +\& 5.003_98 1997\-Apr\-30 171 12 539 +\& 5.003_99 1997\-May\-01 6 0 7 +\& 5.003_99a 1997\-May\-09 36 2 61 +\& p54rc1 1997\-May\-12 8 1 11 +\& p54rc2 1997\-May\-14 6 0 40 +\& +\& 5.004 1997\-May\-15 4 0 4 +\& +\& Tim 5.004_01 1997\-Jun\-13 222 14 57 +\& 5.004_02 1997\-Aug\-07 112 16 119 +\& 5.004_03 1997\-Sep\-05 109 0 17 +\& 5.004_04 1997\-Oct\-15 66 8 173 +.Ve +.PP +\fIThe patch-free era\fR +.IX Subsection "The patch-free era" +.PP +In more modern times, named releases don't come as often, and as progress +can be followed (nearly) instantly (with rsync, and since late 2008, git) +patches between versions are no longer provided. However, that doesn't +keep us from calculating how large a patch could have been. Which is +shown in the table below. Unless noted otherwise, the size mentioned is +the patch to bring version x.y.z to x.y.z+1. +.PP +.Vb 2 +\& Sarathy 5.6.1 2001\-Apr\-08 531 44 651 +\& Rafael 5.6.2 2003\-Nov\-15 20 11 1819 +\& +\& Jarkko 5.8.0 2002\-Jul\-18 1205 31 471 From 5.7.3 +\& +\& 5.8.1 2003\-Sep\-25 243 102 6162 +\& Nicholas 5.8.2 2003\-Nov\-05 10 50 788 +\& 5.8.3 2004\-Jan\-14 31 13 360 +\& 5.8.4 2004\-Apr\-21 33 8 299 +\& 5.8.5 2004\-Jul\-19 11 19 255 +\& 5.8.6 2004\-Nov\-27 35 3 192 +\& 5.8.7 2005\-May\-30 75 34 778 +\& 5.8.8 2006\-Jan\-31 131 42 1251 +\& 5.8.9 2008\-Dec\-14 340 132 12988 +\& +\& Hugo 5.9.0 2003\-Oct\-27 281 168 7132 From 5.8.0 +\& Rafael 5.9.1 2004\-Mar\-16 57 250 2107 +\& 5.9.2 2005\-Apr\-01 720 57 858 +\& 5.9.3 2006\-Jan\-28 1124 102 1906 +\& 5.9.4 2006\-Aug\-15 896 60 862 +\& 5.9.5 2007\-Jul\-07 1149 128 1062 +\& +\& 5.10.0 2007\-Dec\-18 50 31 13111 From 5.9.5 +.Ve +.SH "THE KEEPERS OF THE RECORDS" +.IX Header "THE KEEPERS OF THE RECORDS" +Jarkko Hietaniemi <\fIjhi@iki.fi\fR>. +.PP +Thanks to the collective memory of the Perlfolk. In addition to the +Keepers of the Pumpkin also Alan Champion, Mark Dominus, +Andreas Ko\*:nig, John Macdonald, Matthias Neeracher, Jeff Okamoto, +Michael Peppler, Randal Schwartz, and Paul D. Smith sent corrections +and additions. Abigail added file and patch size data for the 5.6.0 \- 5.10 +era. diff --git a/data/miniconda3/man/man1/perlhpux.1 b/data/miniconda3/man/man1/perlhpux.1 new file mode 100644 index 0000000000000000000000000000000000000000..d44e161f93e6d94f4a109884b6662e4406a3e0dc --- /dev/null +++ b/data/miniconda3/man/man1/perlhpux.1 @@ -0,0 +1,864 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLHPUX 1" +.TH PERLHPUX 1 "2020-12-18" "perl v5.32.1" "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" +perlhpux \- Perl version 5 on Hewlett\-Packard Unix (HP\-UX) systems +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes various features of \s-1HP\s0's Unix operating system +(HP-UX) that will affect how Perl version 5 (hereafter just Perl) is +compiled and/or runs. +.SS "Using perl as shipped with HP-UX" +.IX Subsection "Using perl as shipped with HP-UX" +Application release September 2001, HP-UX 11.00 is the first to ship +with Perl. By the time it was perl\-5.6.1 in /opt/perl. The first +occurrence is on \s-1CD 5012\-7954\s0 and can be installed using +.PP +.Vb 1 +\& swinstall \-s /cdrom perl +.Ve +.PP +assuming you have mounted that \s-1CD\s0 on /cdrom. +.PP +That build was a portable hppa\-1.1 multithread build that supports large +files compiled with gcc\-2.9\-hppa\-991112. +.PP +If you perform a new installation, then (a newer) Perl will be installed +automatically. Pre-installed HP-UX systems now have more recent versions +of Perl and the updated modules. +.PP +The official (threaded) builds from \s-1HP,\s0 as they are shipped on the +Application \s-1DVD/CD\s0's are available on + +for both PA-RISC and \s-1IPF\s0 (Itanium Processor Family). They are built +with the \s-1HP\s0 ANSI-C compiler. Up till 5.8.8 that was done by ActiveState. +.PP +To see what version is included on the \s-1DVD\s0 (assumed here to be mounted +on /cdrom), issue this command: +.PP +.Vb 6 +\& # swlist \-s /cdrom perl +\& # perl D.5.8.8.B 5.8.8 Perl Programming Language +\& perl.Perl5\-32 D.5.8.8.B 32\-bit 5.8.8 Perl Programming Language +\& with Extensions +\& perl.Perl5\-64 D.5.8.8.B 64\-bit 5.8.8 Perl Programming Language +\& with Extensions +.Ve +.PP +To see what is installed on your system: +.PP +.Vb 10 +\& # swlist \-R perl +\& # perl E.5.8.8.J Perl Programming Language +\& # perl.Perl5\-32 E.5.8.8.J 32\-bit Perl Programming Language +\& with Extensions +\& perl.Perl5\-32.PERL\-MAN E.5.8.8.J 32\-bit Perl Man Pages for IA +\& perl.Perl5\-32.PERL\-RUN E.5.8.8.J 32\-bit Perl Binaries for IA +\& # perl.Perl5\-64 E.5.8.8.J 64\-bit Perl Programming Language +\& with Extensions +\& perl.Perl5\-64.PERL\-MAN E.5.8.8.J 64\-bit Perl Man Pages for IA +\& perl.Perl5\-64.PERL\-RUN E.5.8.8.J 64\-bit Perl Binaries for IA +.Ve +.SS "Using perl from \s-1HP\s0's porting centre" +.IX Subsection "Using perl from HP's porting centre" +\&\s-1HP\s0 porting centre tries to keep up with customer demand and release +updates from the Open Source community. Having precompiled Perl binaries +available is obvious, though \*(L"up-to-date\*(R" is something relative. At the +moment of writing perl\-5.10.1 and 5.28.0 were available. +.PP +The \s-1HP\s0 porting centres are limited in what systems they are allowed +to port to and they usually choose the two most recent \s-1OS\s0 versions +available. +.PP +\&\s-1HP\s0 has asked the porting centre to move Open Source binaries +from /opt to /usr/local, so binaries produced since the start +of July 2002 are located in /usr/local. +.PP +One of \s-1HP\s0 porting centres \s-1URL\s0's is +The port currently available is built with \s-1GNU\s0 gcc. As porting modern +\&\s-1GNU\s0 gcc is extremely hard on HP-UX, they are stuck at version gcc\-4.2.3. +.SS "Other prebuilt perl binaries" +.IX Subsection "Other prebuilt perl binaries" +To get more perl depots for the whole range of HP-UX, visit +H.Merijn Brand's site at . +Carefully read the notes to see if the available versions suit your needs. +.SS "Compiling Perl 5 on HP-UX" +.IX Subsection "Compiling Perl 5 on HP-UX" +When compiling Perl, you must use an \s-1ANSI C\s0 compiler. The C compiler +that ships with all HP-UX systems is a K&R compiler that should only be +used to build new kernels. +.PP +Perl can be compiled with either \s-1HP\s0's \s-1ANSI C\s0 compiler or with gcc. The +former is recommended, as not only can it compile Perl with no +difficulty, but also can take advantage of features listed later that +require the use of \s-1HP\s0 compiler-specific command-line flags. +.PP +If you decide to use gcc, make sure your installation is recent and +complete, and be sure to read the Perl \s-1INSTALL\s0 file for more gcc-specific +details. +.SS "PA-RISC" +.IX Subsection "PA-RISC" +The last and final version of PA-RISC is 2.0, \s-1HP\s0 no longer sells any +system with these \s-1CPU\s0's. +.PP +\&\s-1HP\s0's \s-1HP9000\s0 Unix systems run on \s-1HP\s0's own Precision Architecture +(PA-RISC) chip. HP-UX used to run on the Motorola \s-1MC68000\s0 family of +chips, but any machine with this chip in it is quite obsolete and this +document will not attempt to address issues for compiling Perl on the +Motorola chipset. Even though PA-RISC hardware is not sold anymore, a +lot of machines still running on these \s-1CPU\s0's can be found in the wild. +.PP +The last order date for \s-1HP 9000\s0 systems was December 31, 2008. +.PP +\&\s-1HP\s0 PA-RISC systems are usually referred to with model description \*(L"\s-1HP 9000\*(R".\s0 +The last \s-1CPU\s0 in this series is the \s-1PA\-8900.\s0 Support for PA-RISC +architectured machines officially ended as shown in the following table: +.PP +.Vb 10 +\& PA\-RISC End\-of\-Life Roadmap +\& +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\& | HP9000 | Superdome | PA\-8700 | Spring 2011 | +\& | 4\-128 | | PA\-8800/sx1000 | Summer 2012 | +\& | cores | | PA\-8900/sx1000 | 2014 | +\& | | | PA\-8900/sx2000 | 2015 | +\& +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\& | HP9000 | rp7410, rp8400 | PA\-8700 | Spring 2011 | +\& | 2\-32 | rp7420, rp8420 | PA\-8800/sx1000 | 2012 | +\& | cores | rp7440, rp8440 | PA\-8900/sx1000 | Autumn 2013 | +\& | | | PA\-8900/sx2000 | 2015 | +\& +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\& | HP9000 | rp44x0 | PA\-8700 | Spring 2011 | +\& | 1\-8 | | PA\-8800/rp44x0 | 2012 | +\& | cores | | PA\-8900/rp44x0 | 2014 | +\& +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\& | HP9000 | rp34x0 | PA\-8700 | Spring 2011 | +\& | 1\-4 | | PA\-8800/rp34x0 | 2012 | +\& | cores | | PA\-8900/rp34x0 | 2014 | +\& +\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +.Ve +.PP +A complete list of models at the time the \s-1OS\s0 was built is in the file +/usr/sam/lib/mo/sched.models. The first column corresponds to the last +part of the output of the \*(L"model\*(R" command. The second column is the +PA-RISC version and the third column is the exact chip type used. +(Start browsing at the bottom to prevent confusion ;\-) +.PP +.Vb 4 +\& # model +\& 9000/800/L1000\-44 +\& # grep L1000\-44 /usr/sam/lib/mo/sched.models +\& L1000\-44 2.0 PA8500 +.Ve +.SS "PA-RISC 1.0" +.IX Subsection "PA-RISC 1.0" +The original version of PA-RISC, \s-1HP\s0 no longer sells any system with this chip. +.PP +The following systems contained PA-RISC 1.0 chips: +.PP +.Vb 2 +\& 600, 635, 645, 808, 815, 822, 825, 832, 834, 835, 840, 842, 845, 850, +\& 852, 855, 860, 865, 870, 890 +.Ve +.SS "PA-RISC 1.1" +.IX Subsection "PA-RISC 1.1" +An upgrade to the PA-RISC design, it shipped for many years in many different +system. +.PP +The following systems contain with PA-RISC 1.1 chips: +.PP +.Vb 10 +\& 705, 710, 712, 715, 720, 722, 725, 728, 730, 735, 742, 743, 744, 745, +\& 747, 750, 755, 770, 777, 778, 779, 800, 801, 803, 806, 807, 809, 811, +\& 813, 816, 817, 819, 821, 826, 827, 829, 831, 837, 839, 841, 847, 849, +\& 851, 856, 857, 859, 867, 869, 877, 887, 891, 892, 897, A180, A180C, +\& B115, B120, B132L, B132L+, B160L, B180L, C100, C110, C115, C120, +\& C160L, D200, D210, D220, D230, D250, D260, D310, D320, D330, D350, +\& D360, D410, DX0, DX5, DXO, E25, E35, E45, E55, F10, F20, F30, G30, +\& G40, G50, G60, G70, H20, H30, H40, H50, H60, H70, I30, I40, I50, I60, +\& I70, J200, J210, J210XC, K100, K200, K210, K220, K230, K400, K410, +\& K420, S700i, S715, S744, S760, T500, T520 +.Ve +.SS "PA-RISC 2.0" +.IX Subsection "PA-RISC 2.0" +The most recent upgrade to the PA-RISC design, it added support for +64\-bit integer data. +.PP +As of the date of this document's last update, the following systems +contain PA-RISC 2.0 chips: +.PP +.Vb 8 +\& 700, 780, 781, 782, 783, 785, 802, 804, 810, 820, 861, 871, 879, 889, +\& 893, 895, 896, 898, 899, A400, A500, B1000, B2000, C130, C140, C160, +\& C180, C180+, C180\-XP, C200+, C400+, C3000, C360, C3600, CB260, D270, +\& D280, D370, D380, D390, D650, J220, J2240, J280, J282, J400, J410, +\& J5000, J5500XM, J5600, J7000, J7600, K250, K260, K260\-EG, K270, K360, +\& K370, K380, K450, K460, K460\-EG, K460\-XP, K470, K570, K580, L1000, +\& L2000, L3000, N4000, R380, R390, SD16000, SD32000, SD64000, T540, +\& T600, V2000, V2200, V2250, V2500, V2600 +.Ve +.PP +Just before \s-1HP\s0 took over Compaq, some systems were renamed. the link +that contained the explanation is dead, so here's a short summary: +.PP +.Vb 3 +\& HP 9000 A\-Class servers, now renamed HP Server rp2400 series. +\& HP 9000 L\-Class servers, now renamed HP Server rp5400 series. +\& HP 9000 N\-Class servers, now renamed HP Server rp7400. +\& +\& rp2400, rp2405, rp2430, rp2450, rp2470, rp3410, rp3440, rp4410, +\& rp4440, rp5400, rp5405, rp5430, rp5450, rp5470, rp7400, rp7405, +\& rp7410, rp7420, rp7440, rp8400, rp8420, rp8440, Superdome +.Ve +.PP +The current naming convention is: +.PP +.Vb 10 +\& aadddd +\& ||||\`+\- 00 \- 99 relative capacity & newness (upgrades, etc.) +\& |||\`\-\-\- unique number for each architecture to ensure different +\& ||| systems do not have the same numbering across +\& ||| architectures +\& ||\`\-\-\-\- 1 \- 9 identifies family and/or relative positioning +\& || +\& |\`\-\-\-\-\- c = ia32 (cisc) +\& | p = pa\-risc +\& | x = ia\-64 (Itanium & Itanium 2) +\& | h = housing +\& \`\-\-\-\-\-\- t = tower +\& r = rack optimized +\& s = super scalable +\& b = blade +\& sa = appliance +.Ve +.SS "Portability Between PA-RISC Versions" +.IX Subsection "Portability Between PA-RISC Versions" +An executable compiled on a PA-RISC 2.0 platform will not execute on a +PA-RISC 1.1 platform, even if they are running the same version of +HP-UX. If you are building Perl on a PA-RISC 2.0 platform and want that +Perl to also run on a PA-RISC 1.1, the compiler flags +DAportable and ++DS32 should be used. +.PP +It is no longer possible to compile PA-RISC 1.0 executables on either +the PA-RISC 1.1 or 2.0 platforms. The command-line flags are accepted, +but the resulting executable will not run when transferred to a PA-RISC +1.0 system. +.SS "Itanium Processor Family (\s-1IPF\s0) and HP-UX" +.IX Subsection "Itanium Processor Family (IPF) and HP-UX" +HP-UX also runs on the newer Itanium processor. This requires the use +of HP-UX version 11.23 (11i v2) or 11.31 (11i v3), and with the exception +of a few differences detailed below and in later sections, Perl should +compile with no problems. +.PP +Although PA-RISC binaries can run on Itanium systems, you should not +attempt to use a PA-RISC version of Perl on an Itanium system. This is +because shared libraries created on an Itanium system cannot be loaded +while running a PA-RISC executable. +.PP +\&\s-1HP\s0 Itanium 2 systems are usually referred to with model description +\&\*(L"\s-1HP\s0 Integrity\*(R". +.SS "Itanium, Itanium 2 & Madison 6" +.IX Subsection "Itanium, Itanium 2 & Madison 6" +\&\s-1HP\s0 also ships servers with the 128\-bit Itanium processor(s). The cx26x0 +is told to have Madison 6. As of the date of this document's last update, +the following systems contain Itanium or Itanium 2 chips (this is likely +to be out of date): +.PP +.Vb 4 +\& BL60p, BL860c, BL870c, BL890c, cx2600, cx2620, rx1600, rx1620, rx2600, +\& rx2600hptc, rx2620, rx2660, rx2800, rx3600, rx4610, rx4640, rx5670, +\& rx6600, rx7420, rx7620, rx7640, rx8420, rx8620, rx8640, rx9610, +\& sx1000, sx2000 +.Ve +.PP +To see all about your machine, type +.PP +.Vb 3 +\& # model +\& ia64 hp server rx2600 +\& # /usr/contrib/bin/machinfo +.Ve +.SS "HP-UX versions" +.IX Subsection "HP-UX versions" +Not all architectures (\s-1PA\s0 = PA-RISC, \s-1IPF\s0 = Itanium Processor Family) +support all versions of HP-UX, here is a short list +.PP +.Vb 8 +\& HP\-UX version Kernel Architecture End\-of\-factory support +\& \-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& 10.20 32 bit PA 30\-Jun\-2003 +\& 11.00 32/64 PA 31\-Dec\-2006 +\& 11.11 11i v1 32/64 PA 31\-Dec\-2015 +\& 11.22 11i v2 64 IPF 30\-Apr\-2004 +\& 11.23 11i v2 64 PA & IPF 31\-Dec\-2015 +\& 11.31 11i v3 64 PA & IPF 31\-Dec\-2020 (PA) 31\-Dec\-2025 (IPF) +.Ve +.PP +See for the full list of hardware/OS support and expected end-of-life + +.SS "Building Dynamic Extensions on HP-UX" +.IX Subsection "Building Dynamic Extensions on HP-UX" +HP-UX supports dynamically loadable libraries (shared libraries). +Shared libraries end with the suffix .sl. On Itanium systems, +they end with the suffix .so. +.PP +Shared libraries created on a platform using a particular PA-RISC +version are not usable on platforms using an earlier PA-RISC version by +default. However, this backwards compatibility may be enabled using the +same +DAportable compiler flag (with the same PA-RISC 1.0 caveat +mentioned above). +.PP +Shared libraries created on an Itanium platform cannot be loaded on +a PA-RISC platform. Shared libraries created on a PA-RISC platform +can only be loaded on an Itanium platform if it is a PA-RISC executable +that is attempting to load the PA-RISC library. A PA-RISC shared +library cannot be loaded into an Itanium executable nor vice-versa. +.PP +To create a shared library, the following steps must be performed: +.PP +.Vb 4 +\& 1. Compile source modules with +z or +Z flag to create a .o module +\& which contains Position\-Independent Code (PIC). The linker will +\& tell you in the next step if +Z was needed. +\& (For gcc, the appropriate flag is \-fpic or \-fPIC.) +\& +\& 2. Link the shared library using the \-b flag. If the code calls +\& any functions in other system libraries (e.g., libm), it must +\& be included on this line. +.Ve +.PP +(Note that these steps are usually handled automatically by the extension's +Makefile). +.PP +If these dependent libraries are not listed at shared library creation +time, you will get fatal \*(L"Unresolved symbol\*(R" errors at run time when the +library is loaded. +.PP +You may create a shared library that refers to another library, which +may be either an archive library or a shared library. If this second +library is a shared library, this is called a \*(L"dependent library\*(R". The +dependent library's name is recorded in the main shared library, but it +is not linked into the shared library. Instead, it is loaded when the +main shared library is loaded. This can cause problems if you build an +extension on one system and move it to another system where the +libraries may not be located in the same place as on the first system. +.PP +If the referred library is an archive library, then it is treated as a +simple collection of .o modules (all of which must contain \s-1PIC\s0). These +modules are then linked into the shared library. +.PP +Note that it is okay to create a library which contains a dependent +library that is already linked into perl. +.PP +Some extensions, like DB_File and Compress::Zlib use/require prebuilt +libraries for the perl extensions/modules to work. If these libraries +are built using the default configuration, it might happen that you +run into an error like \*(L"invalid loader fixup\*(R" during load phase. +\&\s-1HP\s0 is aware of this problem. Search the HP-UX cxx-dev forums for +discussions about the subject. The short answer is that \fBeverything\fR +(all libraries, everything) must be compiled with \f(CW\*(C`+z\*(C'\fR or \f(CW\*(C`+Z\*(C'\fR to be +\&\s-1PIC\s0 (position independent code). (For gcc, that would be +\&\f(CW\*(C`\-fpic\*(C'\fR or \f(CW\*(C`\-fPIC\*(C'\fR). In HP-UX 11.00 or newer the linker +error message should tell the name of the offending object file. +.PP +A more general approach is to intervene manually, as with an example for +the DB_File module, which requires SleepyCat's libdb.sl: +.PP +.Vb 7 +\& # cd .../db\-3.2.9/build_unix +\& # vi Makefile +\& ... add +Z to all cflags to create shared objects +\& CFLAGS= \-c $(CPPFLAGS) +Z \-Ae +O2 +Onolimit \e +\& \-I/usr/local/include \-I/usr/include/X11R6 +\& CXXFLAGS= \-c $(CPPFLAGS) +Z \-Ae +O2 +Onolimit \e +\& \-I/usr/local/include \-I/usr/include/X11R6 +\& +\& # make clean +\& # make +\& # mkdir tmp +\& # cd tmp +\& # ar x ../libdb.a +\& # ld \-b \-o libdb\-3.2.sl *.o +\& # mv libdb\-3.2.sl /usr/local/lib +\& # rm *.o +\& # cd /usr/local/lib +\& # rm \-f libdb.sl +\& # ln \-s libdb\-3.2.sl libdb.sl +\& +\& # cd .../DB_File\-1.76 +\& # make distclean +\& # perl Makefile.PL +\& # make +\& # make test +\& # make install +.Ve +.PP +As of db\-4.2.x it is no longer needed to do this by hand. Sleepycat +has changed the configuration process to add +z on HP-UX automatically. +.PP +.Vb 2 +\& # cd .../db\-4.2.25/build_unix +\& # env CFLAGS=+DD64 LDFLAGS=+DD64 ../dist/configure +.Ve +.PP +should work to generate 64bit shared libraries for HP-UX 11.00 and 11i. +.PP +It is no longer possible to link PA-RISC 1.0 shared libraries (even +though the command-line flags are still present). +.PP +PA-RISC and Itanium object files are not interchangeable. Although +you may be able to use ar to create an archive library of PA-RISC +object files on an Itanium system, you cannot link against it using +an Itanium link editor. +.SS "The \s-1HP ANSI C\s0 Compiler" +.IX Subsection "The HP ANSI C Compiler" +When using this compiler to build Perl, you should make sure that the +flag \-Aa is added to the cpprun and cppstdin variables in the config.sh +file (though see the section on 64\-bit perl below). If you are using a +recent version of the Perl distribution, these flags are set automatically. +.PP +Even though HP-UX 10.20 and 11.00 are not actively maintained by \s-1HP\s0 +anymore, updates for the \s-1HP ANSI C\s0 compiler are still available from +time to time, and it might be advisable to see if updates are applicable. +At the moment of writing, the latests available patches for 11.00 that +should be applied are \s-1PHSS_35098, PHSS_35175, PHSS_35100, PHSS_33036,\s0 +and \s-1PHSS_33902\s0). If you have a \s-1SUM\s0 account, you can use it to search +for updates/patches. Enter \*(L"\s-1ANSI\*(R"\s0 as keyword. +.SS "The \s-1GNU C\s0 Compiler" +.IX Subsection "The GNU C Compiler" +When you are going to use the \s-1GNU C\s0 compiler (gcc), and you don't have +gcc yet, you can either build it yourself (if you feel masochistic enough) +from the sources (available from e.g. ) +or fetch a prebuilt binary from the \s-1HP\s0 porting center at + +or from the \s-1DSPP\s0 (you need to be a member) at + +(Browse through the list, because there are often multiple versions of +the same package available). +.PP +Most mentioned distributions are depots. H.Merijn Brand has made prebuilt +gcc binaries available on and/or + for HP-UX 10.20 (only 32bit), HP-UX 11.00, +HP-UX 11.11 (HP-UX 11i v1), and HP-UX 11.23 (HP-UX 11i v2 PA-RISC) in both +32\- and 64\-bit versions. For HP-UX 11.23 \s-1IPF\s0 and HP-UX 11.31 \s-1IPF\s0 depots are +available too. The \s-1IPF\s0 versions do not need two versions of \s-1GNU\s0 gcc. +.PP +On PA-RISC you need a different compiler for 32\-bit applications and for +64\-bit applications. On PA-RISC, 32\-bit objects and 64\-bit objects do +not mix. Period. There is no different behaviour for \s-1HP\s0 C\-ANSI-C or \s-1GNU\s0 +gcc. So if you require your perl binary to use 64\-bit libraries, like +Oracle\-64bit, you \s-1MUST\s0 build a 64\-bit perl. +.PP +Building a 64\-bit capable gcc on PA-RISC from source is possible only when +you have the \s-1HP C\-ANSI C\s0 compiler or an already working 64\-bit binary of +gcc available. Best performance for perl is achieved with \s-1HP\s0's native +compiler. +.SS "Using Large Files with Perl on HP-UX" +.IX Subsection "Using Large Files with Perl on HP-UX" +Beginning with HP-UX version 10.20, files larger than 2GB (2^31 bytes) +may be created and manipulated. Three separate methods of doing this +are available. Of these methods, the best method for Perl is to compile +using the \-Duselargefiles flag to Configure. This causes Perl to be +compiled using structures and functions in which these are 64 bits wide, +rather than 32 bits wide. (Note that this will only work with \s-1HP\s0's \s-1ANSI +C\s0 compiler. If you want to compile Perl using gcc, you will have to get +a version of the compiler that supports 64\-bit operations. See above for +where to find it.) +.PP +There are some drawbacks to this approach. One is that any extension +which calls any file-manipulating C function will need to be recompiled +(just follow the usual \*(L"perl Makefile.PL; make; make test; make install\*(R" +procedure). +.PP +The list of functions that will need to recompiled is: + creat, fgetpos, fopen, + freopen, fsetpos, fstat, + fstatvfs, fstatvfsdev, ftruncate, + ftw, lockf, lseek, + lstat, mmap, nftw, + open, prealloc, stat, + statvfs, statvfsdev, tmpfile, + truncate, getrlimit, setrlimit +.PP +Another drawback is only valid for Perl versions before 5.6.0. This +drawback is that the seek and tell functions (both the builtin version +and \s-1POSIX\s0 module version) will not perform correctly. +.PP +It is strongly recommended that you use this flag when you run +Configure. If you do not do this, but later answer the question about +large files when Configure asks you, you may get a configuration that +cannot be compiled, or that does not function as expected. +.SS "Threaded Perl on HP-UX" +.IX Subsection "Threaded Perl on HP-UX" +It is possible to compile a version of threaded Perl on any version of +HP-UX before 10.30, but it is strongly suggested that you be running on +HP-UX 11.00 at least. +.PP +To compile Perl with threads, add \-Dusethreads to the arguments of +Configure. Verify that the \-D_POSIX_C_SOURCE=199506L compiler flag is +automatically added to the list of flags. Also make sure that \-lpthread +is listed before \-lc in the list of libraries to link Perl with. The +hints provided for HP-UX during Configure will try very hard to get +this right for you. +.PP +HP-UX versions before 10.30 require a separate installation of a \s-1POSIX\s0 +threads library package. Two examples are the \s-1HP DCE\s0 package, available +on \*(L"HP-UX Hardware Extensions 3.0, Install and Core \s-1OS,\s0 Release 10.20, +April 1999 (B3920\-13941)\*(R" or the Freely available \s-1PTH\s0 package, available +on H.Merijn's site (). The use of \s-1PTH\s0 +will be unsupported in perl\-5.12 and up and is rather buggy in 5.11.x. +.PP +If you are going to use the \s-1HP DCE\s0 package, the library used for threading +is /usr/lib/libcma.sl, but there have been multiple updates of that +library over time. Perl will build with the first version, but it +will not pass the test suite. Older Oracle versions might be a compelling +reason not to update that library, otherwise please find a newer version +in one of the following patches: \s-1PHSS_19739, PHSS_20608,\s0 or \s-1PHSS_23672\s0 +.PP +reformatted output: +.PP +.Vb 10 +\& d3:/usr/lib 106 > what libcma\-*.1 +\& libcma\-00000.1: +\& HP DCE/9000 1.5 Module: libcma.sl (Export) +\& Date: Apr 29 1996 22:11:24 +\& libcma\-19739.1: +\& HP DCE/9000 1.5 PHSS_19739\-40 Module: libcma.sl (Export) +\& Date: Sep 4 1999 01:59:07 +\& libcma\-20608.1: +\& HP DCE/9000 1.5 PHSS_20608 Module: libcma.1 (Export) +\& Date: Dec 8 1999 18:41:23 +\& libcma\-23672.1: +\& HP DCE/9000 1.5 PHSS_23672 Module: libcma.1 (Export) +\& Date: Apr 9 2001 10:01:06 +\& d3:/usr/lib 107 > +.Ve +.PP +If you choose for the \s-1PTH\s0 package, use swinstall to install pth in +the default location (/opt/pth), and then make symbolic links to the +libraries from /usr/lib +.PP +.Vb 2 +\& # cd /usr/lib +\& # ln \-s /opt/pth/lib/libpth* . +.Ve +.PP +For building perl to support Oracle, it needs to be linked with libcl +and libpthread. So even if your perl is an unthreaded build, these +libraries might be required. See \*(L"Oracle on HP-UX\*(R" below. +.SS "64\-bit Perl on HP-UX" +.IX Subsection "64-bit Perl on HP-UX" +Beginning with HP-UX 11.00, programs compiled under HP-UX can take +advantage of the \s-1LP64\s0 programming environment (\s-1LP64\s0 means Longs and +Pointers are 64 bits wide), in which scalar variables will be able +to hold numbers larger than 2^32 with complete precision. Perl has +proven to be consistent and reliable in 64bit mode since 5.8.1 on +all HP-UX 11.xx. +.PP +As of the date of this document, Perl is fully 64\-bit compliant on +HP-UX 11.00 and up for both cc\- and gcc builds. If you are about to +build a 64\-bit perl with \s-1GNU\s0 gcc, please read the gcc section carefully. +.PP +Should a user have the need for compiling Perl in the \s-1LP64\s0 environment, +use the \-Duse64bitall flag to Configure. This will force Perl to be +compiled in a pure \s-1LP64\s0 environment (with the +DD64 flag for \s-1HP\s0 C\-ANSI-C, +with no additional options for \s-1GNU\s0 gcc 64\-bit on PA-RISC, and with +\&\-mlp64 for \s-1GNU\s0 gcc on Itanium). +If you want to compile Perl using gcc, you will have to get a version of +the compiler that supports 64\-bit operations.) +.PP +You can also use the \-Duse64bitint flag to Configure. Although there +are some minor differences between compiling Perl with this flag versus +the \-Duse64bitall flag, they should not be noticeable from a Perl user's +perspective. When configuring \-Duse64bitint using a 64bit gcc on a +pa-risc architecture, \-Duse64bitint is silently promoted to \-Duse64bitall. +.PP +In both cases, it is strongly recommended that you use these flags when +you run Configure. If you do not use do this, but later answer the +questions about 64\-bit numbers when Configure asks you, you may get a +configuration that cannot be compiled, or that does not function as +expected. +.SS "Oracle on HP-UX" +.IX Subsection "Oracle on HP-UX" +Using perl to connect to Oracle databases through \s-1DBI\s0 and DBD::Oracle +has caused a lot of people many headaches. Read \s-1README\s0.hpux in the +DBD::Oracle for much more information. The reason to mention it here +is that Oracle requires a perl built with libcl and libpthread, the +latter even when perl is build without threads. Building perl using +all defaults, but still enabling to build DBD::Oracle later on can be +achieved using +.PP +.Vb 1 +\& Configure \-A prepend:libswanted=\*(Aqcl pthread \*(Aq ... +.Ve +.PP +Do not forget the space before the trailing quote. +.PP +Also note that this does not (yet) work with all configurations, +it is known to fail with 64\-bit versions of \s-1GCC.\s0 +.SS "\s-1GDBM\s0 and Threads on HP-UX" +.IX Subsection "GDBM and Threads on HP-UX" +If you attempt to compile Perl with (\s-1POSIX\s0) threads on an 11.X system +and also link in the \s-1GDBM\s0 library, then Perl will immediately core dump +when it starts up. The only workaround at this point is to relink the +\&\s-1GDBM\s0 library under 11.X, then relink it into Perl. +.PP +the error might show something like: +.PP +Pthread internal error: message: _\|\fB_libc_reinit()\fR failed, file: ../pthreads/pthread.c, line: 1096 +Return Pointer is 0xc082bf33 +sh: 5345 Quit(coredump) +.PP +and Configure will give up. +.SS "\s-1NFS\s0 filesystems and \fButime\fP\|(2) on HP-UX" +.IX Subsection "NFS filesystems and utime on HP-UX" +If you are compiling Perl on a remotely-mounted \s-1NFS\s0 filesystem, the test +io/fs.t may fail on test #18. This appears to be a bug in HP-UX and no +fix is currently available. +.SS "HP-UX Kernel Parameters (maxdsiz) for Compiling Perl" +.IX Subsection "HP-UX Kernel Parameters (maxdsiz) for Compiling Perl" +By default, HP-UX comes configured with a maximum data segment size of +64MB. This is too small to correctly compile Perl with the maximum +optimization levels. You can increase the size of the maxdsiz kernel +parameter through the use of \s-1SAM.\s0 +.PP +When using the \s-1GUI\s0 version of \s-1SAM,\s0 click on the Kernel Configuration +icon, then the Configurable Parameters icon. Scroll down and select +the maxdsiz line. From the Actions menu, select the Modify Configurable +Parameter item. Insert the new formula into the Formula/Value box. +Then follow the instructions to rebuild your kernel and reboot your +system. +.PP +In general, a value of 256MB (or \*(L"256*1024*1024\*(R") is sufficient for +Perl to compile at maximum optimization. +.SH "nss_delete core dump from op/pwent or op/grent" +.IX Header "nss_delete core dump from op/pwent or op/grent" +You may get a bus error core dump from the op/pwent or op/grent +tests. If compiled with \-g you will see a stack trace much like +the following: +.PP +.Vb 10 +\& #0 0xc004216c in () from /usr/lib/libc.2 +\& #1 0xc00d7550 in _\|_nss_src_state_destr () from /usr/lib/libc.2 +\& #2 0xc00d7768 in _\|_nss_src_state_destr () from /usr/lib/libc.2 +\& #3 0xc00d78a8 in nss_delete () from /usr/lib/libc.2 +\& #4 0xc01126d8 in endpwent () from /usr/lib/libc.2 +\& #5 0xd1950 in Perl_pp_epwent () from ./perl +\& #6 0x94d3c in Perl_runops_standard () from ./perl +\& #7 0x23728 in S_run_body () from ./perl +\& #8 0x23428 in perl_run () from ./perl +\& #9 0x2005c in main () from ./perl +.Ve +.PP +The key here is the \f(CW\*(C`nss_delete\*(C'\fR call. One workaround for this +bug seems to be to create add to the file \fI/etc/nsswitch.conf\fR +(at least) the following lines +.PP +.Vb 2 +\& group: files +\& passwd: files +.Ve +.PP +Whether you are using \s-1NIS\s0 does not matter. Amazingly enough, +the same bug also affects Solaris. +.ie n .SH "error: pasting "")"" and ""l"" does not give a valid preprocessing token" +.el .SH "error: pasting ``)'' and ``l'' does not give a valid preprocessing token" +.IX Header "error: pasting ) and l does not give a valid preprocessing token" +There seems to be a broken system header file in HP-UX 11.00 that +breaks perl building in 32bit mode with \s-1GNU\s0 gcc\-4.x causing this +error. The same file for HP-UX 11.11 (even though the file is older) +does not show this failure, and has the correct definition, so the +best fix is to patch the header to match: +.PP +.Vb 9 +\& \-\-\- /usr/include/inttypes.h 2001\-04\-20 18:42:14 +0200 +\& +++ /usr/include/inttypes.h 2000\-11\-14 09:00:00 +0200 +\& @@ \-72,7 +72,7 @@ +\& #define UINT32_C(_\|_c) _\|_CONCAT_U_\|_(_\|_c) +\& #else /* _\|_LP64 */ +\& #define INT32_C(_\|_c) _\|_CONCAT_\|_(_\|_c,l) +\& \-#define UINT32_C(_\|_c) _\|_CONCAT_\|_(_\|_CONCAT_U_\|_(_\|_c),l) +\& +#define UINT32_C(_\|_c) _\|_CONCAT_\|_(_\|_c,ul) +\& #endif /* _\|_LP64 */ +\& +\& #define INT64_C(_\|_c) _\|_CONCAT_L_\|_(_\|_c,l) +.Ve +.ie n .SH "Redeclaration of ""sendpath"" with a different storage class specifier" +.el .SH "Redeclaration of ``sendpath'' with a different storage class specifier" +.IX Header "Redeclaration of sendpath with a different storage class specifier" +The following compilation warnings may happen in HP-UX releases +earlier than 11.31 but are harmless: +.PP +.Vb 6 +\& cc: "/usr/include/sys/socket.h", line 535: warning 562: +\& Redeclaration of "sendfile" with a different storage class +\& specifier: "sendfile" will have internal linkage. +\& cc: "/usr/include/sys/socket.h", line 536: warning 562: +\& Redeclaration of "sendpath" with a different storage class +\& specifier: "sendpath" will have internal linkage. +.Ve +.PP +They seem to be caused by broken system header files, and also other +open source projects are seeing them. The following HP-UX patches +should make the warnings go away: +.PP +.Vb 2 +\& CR JAGae12001: PHNE_27063 +\& Warning 562 on sys/socket.h due to redeclaration of prototypes +\& +\& CR JAGae16787: +\& Warning 562 from socket.h sendpath/sendfile \-D_FILEFFSET_BITS=64 +\& +\& CR JAGae73470 (11.23) +\& ER: Compiling socket.h with cc \-D_FILEFFSET_BITS=64 warning 267/562 +.Ve +.SH "Miscellaneous" +.IX Header "Miscellaneous" +HP-UX 11 Y2K patch \*(L"Y2K\-1100 B.11.00.B0125 HP-UX Core \s-1OS\s0 Year 2000 +Patch Bundle\*(R" has been reported to break the io/fs test #18 which +tests whether \fButime()\fR can change timestamps. The Y2K patch seems to +break \fButime()\fR so that over \s-1NFS\s0 the timestamps do not get changed +(on local filesystems \fButime()\fR still works). This has probably been +fixed on your system by now. +.SH "AUTHOR" +.IX Header "AUTHOR" +H.Merijn Brand +Jeff Okamoto +.PP +With much assistance regarding shared libraries from Marc Sabatella. diff --git a/data/miniconda3/man/man1/perlintern.1 b/data/miniconda3/man/man1/perlintern.1 new file mode 100644 index 0000000000000000000000000000000000000000..b01f4e8f871e144341ca9fd774b720016c23af16 --- /dev/null +++ b/data/miniconda3/man/man1/perlintern.1 @@ -0,0 +1,3461 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLINTERN 1" +.TH PERLINTERN 1 "2023-12-23" "perl v5.32.1" "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" +perlintern \- autogenerated documentation of purely internal +Perl functions +.SH "DESCRIPTION" +.IX Xref "internal Perl functions interpreter functions" +.IX Header "DESCRIPTION" +This file is the autogenerated documentation of functions in the +Perl interpreter that are documented using Perl's internal documentation +format but are not marked as part of the Perl \s-1API.\s0 In other words, +\&\fBthey are not for use in extensions\fR! +.SH "Array Manipulation Functions" +.IX Header "Array Manipulation Functions" +.IP "AvFILLp" 8 +.IX Xref "AvFILLp" +.IX Item "AvFILLp" +.Vb 1 +\& int AvFILLp(AV* av) +.Ve +.SH "Compile-time scope hooks" +.IX Header "Compile-time scope hooks" +.IP "BhkENTRY" 8 +.IX Xref "BhkENTRY" +.IX Item "BhkENTRY" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Return an entry from the \s-1BHK\s0 structure. \f(CW\*(C`which\*(C'\fR is a preprocessor token +indicating which entry to return. If the appropriate flag is not set +this will return \f(CW\*(C`NULL\*(C'\fR. The type of the return value depends on which +entry you ask for. +.Sp +.Vb 1 +\& void * BhkENTRY(BHK *hk, which) +.Ve +.IP "BhkFLAGS" 8 +.IX Xref "BhkFLAGS" +.IX Item "BhkFLAGS" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Return the \s-1BHK\s0's flags. +.Sp +.Vb 1 +\& U32 BhkFLAGS(BHK *hk) +.Ve +.IP "\s-1CALL_BLOCK_HOOKS\s0" 8 +.IX Xref "CALL_BLOCK_HOOKS" +.IX Item "CALL_BLOCK_HOOKS" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Call all the registered block hooks for type \f(CW\*(C`which\*(C'\fR. \f(CW\*(C`which\*(C'\fR is a +preprocessing token; the type of \f(CW\*(C`arg\*(C'\fR depends on \f(CW\*(C`which\*(C'\fR. +.Sp +.Vb 1 +\& void CALL_BLOCK_HOOKS(which, arg) +.Ve +.SH "Custom Operators" +.IX Header "Custom Operators" +.IP "core_prototype" 8 +.IX Xref "core_prototype" +.IX Item "core_prototype" +This function assigns the prototype of the named core function to \f(CW\*(C`sv\*(C'\fR, or +to a new mortal \s-1SV\s0 if \f(CW\*(C`sv\*(C'\fR is \f(CW\*(C`NULL\*(C'\fR. It returns the modified \f(CW\*(C`sv\*(C'\fR, or +\&\f(CW\*(C`NULL\*(C'\fR if the core function has no prototype. \f(CW\*(C`code\*(C'\fR is a code as returned +by \f(CW\*(C`keyword()\*(C'\fR. It must not be equal to 0. +.Sp +.Vb 3 +\& SV * core_prototype(SV *sv, const char *name, +\& const int code, +\& int * const opnum) +.Ve +.SH "CV Manipulation Functions" +.IX Header "CV Manipulation Functions" +.IP "docatch" 8 +.IX Xref "docatch" +.IX Item "docatch" +Check for the cases 0 or 3 of cur_env.je_ret, only used inside an eval context. +.Sp +0 is used as continue inside eval, +.Sp +3 is used for a die caught by an inner eval \- continue inner loop +.Sp +See \fIcop.h\fR: je_mustcatch, when set at any runlevel to \s-1TRUE,\s0 means eval ops must +establish a local jmpenv to handle exception traps. +.Sp +.Vb 1 +\& OP* docatch(Perl_ppaddr_t firstpp) +.Ve +.SH "CV reference counts and CvOUTSIDE" +.IX Header "CV reference counts and CvOUTSIDE" +.IP "CvWEAKOUTSIDE" 8 +.IX Xref "CvWEAKOUTSIDE" +.IX Item "CvWEAKOUTSIDE" +Each \s-1CV\s0 has a pointer, \f(CW\*(C`CvOUTSIDE()\*(C'\fR, to its lexically enclosing +\&\s-1CV\s0 (if any). Because pointers to anonymous sub prototypes are +stored in \f(CW\*(C`&\*(C'\fR pad slots, it is a possible to get a circular reference, +with the parent pointing to the child and vice-versa. To avoid the +ensuing memory leak, we do not increment the reference count of the \s-1CV\s0 +pointed to by \f(CW\*(C`CvOUTSIDE\*(C'\fR in the \fIone specific instance\fR that the parent +has a \f(CW\*(C`&\*(C'\fR pad slot pointing back to us. In this case, we set the +\&\f(CW\*(C`CvWEAKOUTSIDE\*(C'\fR flag in the child. This allows us to determine under what +circumstances we should decrement the refcount of the parent when freeing +the child. +.Sp +There is a further complication with non-closure anonymous subs (i.e. those +that do not refer to any lexicals outside that sub). In this case, the +anonymous prototype is shared rather than being cloned. This has the +consequence that the parent may be freed while there are still active +children, \fIe.g.\fR, +.Sp +.Vb 1 +\& BEGIN { $a = sub { eval \*(Aq$x\*(Aq } } +.Ve +.Sp +In this case, the \s-1BEGIN\s0 is freed immediately after execution since there +are no active references to it: the anon sub prototype has +\&\f(CW\*(C`CvWEAKOUTSIDE\*(C'\fR set since it's not a closure, and \f(CW$a\fR points to the same +\&\s-1CV,\s0 so it doesn't contribute to \s-1BEGIN\s0's refcount either. When \f(CW$a\fR is +executed, the \f(CW\*(C`eval \*(Aq$x\*(Aq\*(C'\fR causes the chain of \f(CW\*(C`CvOUTSIDE\*(C'\fRs to be followed, +and the freed \s-1BEGIN\s0 is accessed. +.Sp +To avoid this, whenever a \s-1CV\s0 and its associated pad is freed, any +\&\f(CW\*(C`&\*(C'\fR entries in the pad are explicitly removed from the pad, and if the +refcount of the pointed-to anon sub is still positive, then that +child's \f(CW\*(C`CvOUTSIDE\*(C'\fR is set to point to its grandparent. This will only +occur in the single specific case of a non-closure anon prototype +having one or more active references (such as \f(CW$a\fR above). +.Sp +One other thing to consider is that a \s-1CV\s0 may be merely undefined +rather than freed, eg \f(CW\*(C`undef &foo\*(C'\fR. In this case, its refcount may +not have reached zero, but we still delete its pad and its \f(CW\*(C`CvROOT\*(C'\fR etc. +Since various children may still have their \f(CW\*(C`CvOUTSIDE\*(C'\fR pointing at this +undefined \s-1CV,\s0 we keep its own \f(CW\*(C`CvOUTSIDE\*(C'\fR for the time being, so that +the chain of lexical scopes is unbroken. For example, the following +should print 123: +.Sp +.Vb 5 +\& my $x = 123; +\& sub tmp { sub { eval \*(Aq$x\*(Aq } } +\& my $a = tmp(); +\& undef &tmp; +\& print $a\->(); +\& +\& bool CvWEAKOUTSIDE(CV *cv) +.Ve +.SH "Embedding Functions" +.IX Header "Embedding Functions" +.IP "cv_dump" 8 +.IX Xref "cv_dump" +.IX Item "cv_dump" +dump the contents of a \s-1CV\s0 +.Sp +.Vb 1 +\& void cv_dump(const CV *cv, const char *title) +.Ve +.IP "cv_forget_slab" 8 +.IX Xref "cv_forget_slab" +.IX Item "cv_forget_slab" +When a \s-1CV\s0 has a reference count on its slab (\f(CW\*(C`CvSLABBED\*(C'\fR), it is responsible +for making sure it is freed. (Hence, no two CVs should ever have a +reference count on the same slab.) The \s-1CV\s0 only needs to reference the slab +during compilation. Once it is compiled and \f(CW\*(C`CvROOT\*(C'\fR attached, it has +finished its job, so it can forget the slab. +.Sp +.Vb 1 +\& void cv_forget_slab(CV *cv) +.Ve +.IP "do_dump_pad" 8 +.IX Xref "do_dump_pad" +.IX Item "do_dump_pad" +Dump the contents of a padlist +.Sp +.Vb 2 +\& void do_dump_pad(I32 level, PerlIO *file, +\& PADLIST *padlist, int full) +.Ve +.IP "pad_alloc_name" 8 +.IX Xref "pad_alloc_name" +.IX Item "pad_alloc_name" +Allocates a place in the currently-compiling +pad (via \*(L"pad_alloc\*(R" in perlapi) and +then stores a name for that entry. \f(CW\*(C`name\*(C'\fR is adopted and +becomes the name entry; it must already contain the name +string. \f(CW\*(C`typestash\*(C'\fR and \f(CW\*(C`ourstash\*(C'\fR and the \f(CW\*(C`padadd_STATE\*(C'\fR +flag get added to \f(CW\*(C`name\*(C'\fR. None of the other +processing of \*(L"pad_add_name_pvn\*(R" in perlapi +is done. Returns the offset of the allocated pad slot. +.Sp +.Vb 2 +\& PADOFFSET pad_alloc_name(PADNAME *name, U32 flags, +\& HV *typestash, HV *ourstash) +.Ve +.IP "pad_block_start" 8 +.IX Xref "pad_block_start" +.IX Item "pad_block_start" +Update the pad compilation state variables on entry to a new block. +.Sp +.Vb 1 +\& void pad_block_start(int full) +.Ve +.IP "pad_check_dup" 8 +.IX Xref "pad_check_dup" +.IX Item "pad_check_dup" +Check for duplicate declarations: report any of: +.Sp +.Vb 3 +\& * a \*(Aqmy\*(Aq in the current scope with the same name; +\& * an \*(Aqour\*(Aq (anywhere in the pad) with the same name and the +\& same stash as \*(Aqourstash\*(Aq +.Ve +.Sp +\&\f(CW\*(C`is_our\*(C'\fR indicates that the name to check is an \f(CW"our"\fR declaration. +.Sp +.Vb 2 +\& void pad_check_dup(PADNAME *name, U32 flags, +\& const HV *ourstash) +.Ve +.IP "pad_findlex" 8 +.IX Xref "pad_findlex" +.IX Item "pad_findlex" +Find a named lexical anywhere in a chain of nested pads. Add fake entries +in the inner pads if it's found in an outer one. +.Sp +Returns the offset in the bottom pad of the lex or the fake lex. +\&\f(CW\*(C`cv\*(C'\fR is the \s-1CV\s0 in which to start the search, and seq is the current \f(CW\*(C`cop_seq\*(C'\fR +to match against. If \f(CW\*(C`warn\*(C'\fR is true, print appropriate warnings. The \f(CW\*(C`out_\*(C'\fR* +vars return values, and so are pointers to where the returned values +should be stored. \f(CW\*(C`out_capture\*(C'\fR, if non-null, requests that the innermost +instance of the lexical is captured; \f(CW\*(C`out_name\*(C'\fR is set to the innermost +matched pad name or fake pad name; \f(CW\*(C`out_flags\*(C'\fR returns the flags normally +associated with the \f(CW\*(C`PARENT_FAKELEX_FLAGS\*(C'\fR field of a fake pad name. +.Sp +Note that \f(CW\*(C`pad_findlex()\*(C'\fR is recursive; it recurses up the chain of CVs, +then comes back down, adding fake entries +as it goes. It has to be this way +because fake names in anon protoypes have to store in \f(CW\*(C`xpadn_low\*(C'\fR the +index into the parent pad. +.Sp +.Vb 6 +\& PADOFFSET pad_findlex(const char *namepv, +\& STRLEN namelen, U32 flags, +\& const CV* cv, U32 seq, int warn, +\& SV** out_capture, +\& PADNAME** out_name, +\& int *out_flags) +.Ve +.IP "pad_fixup_inner_anons" 8 +.IX Xref "pad_fixup_inner_anons" +.IX Item "pad_fixup_inner_anons" +For any anon CVs in the pad, change \f(CW\*(C`CvOUTSIDE\*(C'\fR of that \s-1CV\s0 from +\&\f(CW\*(C`old_cv\*(C'\fR to \f(CW\*(C`new_cv\*(C'\fR if necessary. Needed when a newly-compiled \s-1CV\s0 has to be +moved to a pre-existing \s-1CV\s0 struct. +.Sp +.Vb 2 +\& void pad_fixup_inner_anons(PADLIST *padlist, +\& CV *old_cv, CV *new_cv) +.Ve +.IP "pad_free" 8 +.IX Xref "pad_free" +.IX Item "pad_free" +Free the \s-1SV\s0 at offset po in the current pad. +.Sp +.Vb 1 +\& void pad_free(PADOFFSET po) +.Ve +.IP "pad_leavemy" 8 +.IX Xref "pad_leavemy" +.IX Item "pad_leavemy" +Cleanup at end of scope during compilation: set the max seq number for +lexicals in this scope and warn of any lexicals that never got introduced. +.Sp +.Vb 1 +\& OP * pad_leavemy() +.Ve +.IP "padlist_dup" 8 +.IX Xref "padlist_dup" +.IX Item "padlist_dup" +Duplicates a pad. +.Sp +.Vb 2 +\& PADLIST * padlist_dup(PADLIST *srcpad, +\& CLONE_PARAMS *param) +.Ve +.IP "padname_dup" 8 +.IX Xref "padname_dup" +.IX Item "padname_dup" +Duplicates a pad name. +.Sp +.Vb 1 +\& PADNAME * padname_dup(PADNAME *src, CLONE_PARAMS *param) +.Ve +.IP "padnamelist_dup" 8 +.IX Xref "padnamelist_dup" +.IX Item "padnamelist_dup" +Duplicates a pad name list. +.Sp +.Vb 2 +\& PADNAMELIST * padnamelist_dup(PADNAMELIST *srcpad, +\& CLONE_PARAMS *param) +.Ve +.IP "pad_push" 8 +.IX Xref "pad_push" +.IX Item "pad_push" +Push a new pad frame onto the padlist, unless there's already a pad at +this depth, in which case don't bother creating a new one. Then give +the new pad an \f(CW@_\fR in slot zero. +.Sp +.Vb 1 +\& void pad_push(PADLIST *padlist, int depth) +.Ve +.IP "pad_reset" 8 +.IX Xref "pad_reset" +.IX Item "pad_reset" +Mark all the current temporaries for reuse +.Sp +.Vb 1 +\& void pad_reset() +.Ve +.IP "pad_swipe" 8 +.IX Xref "pad_swipe" +.IX Item "pad_swipe" +Abandon the tmp in the current pad at offset \f(CW\*(C`po\*(C'\fR and replace with a +new one. +.Sp +.Vb 1 +\& void pad_swipe(PADOFFSET po, bool refadjust) +.Ve +.SH "Errno" +.IX Header "Errno" +.IP "dSAVEDERRNO" 8 +.IX Xref "dSAVEDERRNO" +.IX Item "dSAVEDERRNO" +Declare variables needed to save \f(CW\*(C`errno\*(C'\fR and any operating system +specific error number. +.Sp +.Vb 1 +\& void dSAVEDERRNO +.Ve +.IP "dSAVE_ERRNO" 8 +.IX Xref "dSAVE_ERRNO" +.IX Item "dSAVE_ERRNO" +Declare variables needed to save \f(CW\*(C`errno\*(C'\fR and any operating system +specific error number, and save them for optional later restoration +by \f(CW\*(C`RESTORE_ERRNO\*(C'\fR. +.Sp +.Vb 1 +\& void dSAVE_ERRNO +.Ve +.IP "\s-1RESTORE_ERRNO\s0" 8 +.IX Xref "RESTORE_ERRNO" +.IX Item "RESTORE_ERRNO" +Restore \f(CW\*(C`errno\*(C'\fR and any operating system specific error number that +was saved by \f(CW\*(C`dSAVE_ERRNO\*(C'\fR or \f(CW\*(C`RESTORE_ERRNO\*(C'\fR. +.Sp +.Vb 1 +\& void RESTORE_ERRNO +.Ve +.IP "\s-1SAVE_ERRNO\s0" 8 +.IX Xref "SAVE_ERRNO" +.IX Item "SAVE_ERRNO" +Save \f(CW\*(C`errno\*(C'\fR and any operating system specific error number for +optional later restoration by \f(CW\*(C`RESTORE_ERRNO\*(C'\fR. Requires +\&\f(CW\*(C`dSAVEDERRNO\*(C'\fR or \f(CW\*(C`dSAVE_ERRNO\*(C'\fR in scope. +.Sp +.Vb 1 +\& void SAVE_ERRNO +.Ve +.IP "\s-1SETERRNO\s0" 8 +.IX Xref "SETERRNO" +.IX Item "SETERRNO" +Set \f(CW\*(C`errno\*(C'\fR, and on \s-1VMS\s0 set \f(CW\*(C`vaxc$errno\*(C'\fR. +.Sp +.Vb 1 +\& void SETERRNO(int errcode, int vmserrcode) +.Ve +.SH "GV Functions" +.IX Header "GV Functions" +.IP "gv_try_downgrade" 8 +.IX Xref "gv_try_downgrade" +.IX Item "gv_try_downgrade" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +If the typeglob \f(CW\*(C`gv\*(C'\fR can be expressed more succinctly, by having +something other than a real \s-1GV\s0 in its place in the stash, replace it +with the optimised form. Basic requirements for this are that \f(CW\*(C`gv\*(C'\fR +is a real typeglob, is sufficiently ordinary, and is only referenced +from its package. This function is meant to be used when a \s-1GV\s0 has been +looked up in part to see what was there, causing upgrading, but based +on what was found it turns out that the real \s-1GV\s0 isn't required after all. +.Sp +If \f(CW\*(C`gv\*(C'\fR is a completely empty typeglob, it is deleted from the stash. +.Sp +If \f(CW\*(C`gv\*(C'\fR is a typeglob containing only a sufficiently-ordinary constant +sub, the typeglob is replaced with a scalar-reference placeholder that +more compactly represents the same thing. +.Sp +.Vb 1 +\& void gv_try_downgrade(GV* gv) +.Ve +.SH "Hash Manipulation Functions" +.IX Header "Hash Manipulation Functions" +.IP "hv_ename_add" 8 +.IX Xref "hv_ename_add" +.IX Item "hv_ename_add" +Adds a name to a stash's internal list of effective names. See +\&\f(CW"hv_ename_delete"\fR. +.Sp +This is called when a stash is assigned to a new location in the symbol +table. +.Sp +.Vb 2 +\& void hv_ename_add(HV *hv, const char *name, U32 len, +\& U32 flags) +.Ve +.IP "hv_ename_delete" 8 +.IX Xref "hv_ename_delete" +.IX Item "hv_ename_delete" +Removes a name from a stash's internal list of effective names. If this is +the name returned by \f(CW\*(C`HvENAME\*(C'\fR, then another name in the list will take +its place (\f(CW\*(C`HvENAME\*(C'\fR will use it). +.Sp +This is called when a stash is deleted from the symbol table. +.Sp +.Vb 2 +\& void hv_ename_delete(HV *hv, const char *name, +\& U32 len, U32 flags) +.Ve +.IP "refcounted_he_chain_2hv" 8 +.IX Xref "refcounted_he_chain_2hv" +.IX Item "refcounted_he_chain_2hv" +Generates and returns a \f(CW\*(C`HV *\*(C'\fR representing the content of a +\&\f(CW\*(C`refcounted_he\*(C'\fR chain. +\&\f(CW\*(C`flags\*(C'\fR is currently unused and must be zero. +.Sp +.Vb 3 +\& HV * refcounted_he_chain_2hv( +\& const struct refcounted_he *c, U32 flags +\& ) +.Ve +.IP "refcounted_he_fetch_pv" 8 +.IX Xref "refcounted_he_fetch_pv" +.IX Item "refcounted_he_fetch_pv" +Like \*(L"refcounted_he_fetch_pvn\*(R", but takes a nul-terminated string +instead of a string/length pair. +.Sp +.Vb 4 +\& SV * refcounted_he_fetch_pv( +\& const struct refcounted_he *chain, +\& const char *key, U32 hash, U32 flags +\& ) +.Ve +.IP "refcounted_he_fetch_pvn" 8 +.IX Xref "refcounted_he_fetch_pvn" +.IX Item "refcounted_he_fetch_pvn" +Search along a \f(CW\*(C`refcounted_he\*(C'\fR chain for an entry with the key specified +by \f(CW\*(C`keypv\*(C'\fR and \f(CW\*(C`keylen\*(C'\fR. If \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`REFCOUNTED_HE_KEY_UTF8\*(C'\fR +bit set, the key octets are interpreted as \s-1UTF\-8,\s0 otherwise they +are interpreted as Latin\-1. \f(CW\*(C`hash\*(C'\fR is a precomputed hash of the key +string, or zero if it has not been precomputed. Returns a mortal scalar +representing the value associated with the key, or \f(CW&PL_sv_placeholder\fR +if there is no value associated with the key. +.Sp +.Vb 5 +\& SV * refcounted_he_fetch_pvn( +\& const struct refcounted_he *chain, +\& const char *keypv, STRLEN keylen, U32 hash, +\& U32 flags +\& ) +.Ve +.IP "refcounted_he_fetch_pvs" 8 +.IX Xref "refcounted_he_fetch_pvs" +.IX Item "refcounted_he_fetch_pvs" +Like \*(L"refcounted_he_fetch_pvn\*(R", but takes a literal string +instead of a string/length pair, and no precomputed hash. +.Sp +.Vb 4 +\& SV * refcounted_he_fetch_pvs( +\& const struct refcounted_he *chain, "key", +\& U32 flags +\& ) +.Ve +.IP "refcounted_he_fetch_sv" 8 +.IX Xref "refcounted_he_fetch_sv" +.IX Item "refcounted_he_fetch_sv" +Like \*(L"refcounted_he_fetch_pvn\*(R", but takes a Perl scalar instead of a +string/length pair. +.Sp +.Vb 4 +\& SV * refcounted_he_fetch_sv( +\& const struct refcounted_he *chain, SV *key, +\& U32 hash, U32 flags +\& ) +.Ve +.IP "refcounted_he_free" 8 +.IX Xref "refcounted_he_free" +.IX Item "refcounted_he_free" +Decrements the reference count of a \f(CW\*(C`refcounted_he\*(C'\fR by one. If the +reference count reaches zero the structure's memory is freed, which +(recursively) causes a reduction of its parent \f(CW\*(C`refcounted_he\*(C'\fR's +reference count. It is safe to pass a null pointer to this function: +no action occurs in this case. +.Sp +.Vb 1 +\& void refcounted_he_free(struct refcounted_he *he) +.Ve +.IP "refcounted_he_inc" 8 +.IX Xref "refcounted_he_inc" +.IX Item "refcounted_he_inc" +Increment the reference count of a \f(CW\*(C`refcounted_he\*(C'\fR. The pointer to the +\&\f(CW\*(C`refcounted_he\*(C'\fR is also returned. It is safe to pass a null pointer +to this function: no action occurs and a null pointer is returned. +.Sp +.Vb 3 +\& struct refcounted_he * refcounted_he_inc( +\& struct refcounted_he *he +\& ) +.Ve +.IP "refcounted_he_new_pv" 8 +.IX Xref "refcounted_he_new_pv" +.IX Item "refcounted_he_new_pv" +Like \*(L"refcounted_he_new_pvn\*(R", but takes a nul-terminated string instead +of a string/length pair. +.Sp +.Vb 5 +\& struct refcounted_he * refcounted_he_new_pv( +\& struct refcounted_he *parent, +\& const char *key, U32 hash, +\& SV *value, U32 flags +\& ) +.Ve +.IP "refcounted_he_new_pvn" 8 +.IX Xref "refcounted_he_new_pvn" +.IX Item "refcounted_he_new_pvn" +Creates a new \f(CW\*(C`refcounted_he\*(C'\fR. This consists of a single key/value +pair and a reference to an existing \f(CW\*(C`refcounted_he\*(C'\fR chain (which may +be empty), and thus forms a longer chain. When using the longer chain, +the new key/value pair takes precedence over any entry for the same key +further along the chain. +.Sp +The new key is specified by \f(CW\*(C`keypv\*(C'\fR and \f(CW\*(C`keylen\*(C'\fR. If \f(CW\*(C`flags\*(C'\fR has +the \f(CW\*(C`REFCOUNTED_HE_KEY_UTF8\*(C'\fR bit set, the key octets are interpreted +as \s-1UTF\-8,\s0 otherwise they are interpreted as Latin\-1. \f(CW\*(C`hash\*(C'\fR is +a precomputed hash of the key string, or zero if it has not been +precomputed. +.Sp +\&\f(CW\*(C`value\*(C'\fR is the scalar value to store for this key. \f(CW\*(C`value\*(C'\fR is copied +by this function, which thus does not take ownership of any reference +to it, and later changes to the scalar will not be reflected in the +value visible in the \f(CW\*(C`refcounted_he\*(C'\fR. Complex types of scalar will not +be stored with referential integrity, but will be coerced to strings. +\&\f(CW\*(C`value\*(C'\fR may be either null or \f(CW&PL_sv_placeholder\fR to indicate that no +value is to be associated with the key; this, as with any non-null value, +takes precedence over the existence of a value for the key further along +the chain. +.Sp +\&\f(CW\*(C`parent\*(C'\fR points to the rest of the \f(CW\*(C`refcounted_he\*(C'\fR chain to be +attached to the new \f(CW\*(C`refcounted_he\*(C'\fR. This function takes ownership +of one reference to \f(CW\*(C`parent\*(C'\fR, and returns one reference to the new +\&\f(CW\*(C`refcounted_he\*(C'\fR. +.Sp +.Vb 6 +\& struct refcounted_he * refcounted_he_new_pvn( +\& struct refcounted_he *parent, +\& const char *keypv, +\& STRLEN keylen, U32 hash, +\& SV *value, U32 flags +\& ) +.Ve +.IP "refcounted_he_new_pvs" 8 +.IX Xref "refcounted_he_new_pvs" +.IX Item "refcounted_he_new_pvs" +Like \*(L"refcounted_he_new_pvn\*(R", but takes a literal string +instead of a string/length pair, and no precomputed hash. +.Sp +.Vb 4 +\& struct refcounted_he * refcounted_he_new_pvs( +\& struct refcounted_he *parent, +\& "key", SV *value, U32 flags +\& ) +.Ve +.IP "refcounted_he_new_sv" 8 +.IX Xref "refcounted_he_new_sv" +.IX Item "refcounted_he_new_sv" +Like \*(L"refcounted_he_new_pvn\*(R", but takes a Perl scalar instead of a +string/length pair. +.Sp +.Vb 5 +\& struct refcounted_he * refcounted_he_new_sv( +\& struct refcounted_he *parent, +\& SV *key, U32 hash, SV *value, +\& U32 flags +\& ) +.Ve +.SH "IO Functions" +.IX Header "IO Functions" +.IP "start_glob" 8 +.IX Xref "start_glob" +.IX Item "start_glob" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Function called by \f(CW\*(C`do_readline\*(C'\fR to spawn a glob (or do the glob inside +perl on \s-1VMS\s0). This code used to be inline, but now perl uses \f(CW\*(C`File::Glob\*(C'\fR +this glob starter is only used by miniperl during the build process, +or when \s-1PERL_EXTERNAL_GLOB\s0 is defined. +Moving it away shrinks \fIpp_hot.c\fR; shrinking \fIpp_hot.c\fR helps speed perl up. +.Sp +\&\s-1NOTE:\s0 this function must be explicitly called as Perl_start_glob with an aTHX_ parameter. +.Sp +.Vb 1 +\& PerlIO* Perl_start_glob(pTHX_ SV *tmpglob, IO *io) +.Ve +.SH "Lexer interface" +.IX Header "Lexer interface" +.IP "validate_proto" 8 +.IX Xref "validate_proto" +.IX Item "validate_proto" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +This function performs syntax checking on a prototype, \f(CW\*(C`proto\*(C'\fR. +If \f(CW\*(C`warn\*(C'\fR is true, any illegal characters or mismatched brackets +will trigger illegalproto warnings, declaring that they were +detected in the prototype for \f(CW\*(C`name\*(C'\fR. +.Sp +The return value is \f(CW\*(C`true\*(C'\fR if this is a valid prototype, and +\&\f(CW\*(C`false\*(C'\fR if it is not, regardless of whether \f(CW\*(C`warn\*(C'\fR was \f(CW\*(C`true\*(C'\fR or +\&\f(CW\*(C`false\*(C'\fR. +.Sp +Note that \f(CW\*(C`NULL\*(C'\fR is a valid \f(CW\*(C`proto\*(C'\fR and will always return \f(CW\*(C`true\*(C'\fR. +.Sp +.Vb 2 +\& bool validate_proto(SV *name, SV *proto, bool warn, +\& bool curstash) +.Ve +.SH "Magical Functions" +.IX Header "Magical Functions" +.IP "magic_clearhint" 8 +.IX Xref "magic_clearhint" +.IX Item "magic_clearhint" +Triggered by a delete from \f(CW\*(C`%^H\*(C'\fR, records the key to +\&\f(CW\*(C`PL_compiling.cop_hints_hash\*(C'\fR. +.Sp +.Vb 1 +\& int magic_clearhint(SV* sv, MAGIC* mg) +.Ve +.IP "magic_clearhints" 8 +.IX Xref "magic_clearhints" +.IX Item "magic_clearhints" +Triggered by clearing \f(CW\*(C`%^H\*(C'\fR, resets \f(CW\*(C`PL_compiling.cop_hints_hash\*(C'\fR. +.Sp +.Vb 1 +\& int magic_clearhints(SV* sv, MAGIC* mg) +.Ve +.IP "magic_methcall" 8 +.IX Xref "magic_methcall" +.IX Item "magic_methcall" +Invoke a magic method (like \s-1FETCH\s0). +.Sp +\&\f(CW\*(C`sv\*(C'\fR and \f(CW\*(C`mg\*(C'\fR are the tied thingy and the tie magic. +.Sp +\&\f(CW\*(C`meth\*(C'\fR is the name of the method to call. +.Sp +\&\f(CW\*(C`argc\*(C'\fR is the number of args (in addition to \f(CW$self\fR) to pass to the method. +.Sp +The \f(CW\*(C`flags\*(C'\fR can be: +.Sp +.Vb 4 +\& G_DISCARD invoke method with G_DISCARD flag and don\*(Aqt +\& return a value +\& G_UNDEF_FILL fill the stack with argc pointers to +\& PL_sv_undef +.Ve +.Sp +The arguments themselves are any values following the \f(CW\*(C`flags\*(C'\fR argument. +.Sp +Returns the \s-1SV\s0 (if any) returned by the method, or \f(CW\*(C`NULL\*(C'\fR on failure. +.Sp +\&\s-1NOTE:\s0 this function must be explicitly called as Perl_magic_methcall with an aTHX_ parameter. +.Sp +.Vb 3 +\& SV* Perl_magic_methcall(pTHX_ SV *sv, +\& const MAGIC *mg, SV *meth, +\& U32 flags, U32 argc, ...) +.Ve +.IP "magic_sethint" 8 +.IX Xref "magic_sethint" +.IX Item "magic_sethint" +Triggered by a store to \f(CW\*(C`%^H\*(C'\fR, records the key/value pair to +\&\f(CW\*(C`PL_compiling.cop_hints_hash\*(C'\fR. It is assumed that hints aren't storing +anything that would need a deep copy. Maybe we should warn if we find a +reference. +.Sp +.Vb 1 +\& int magic_sethint(SV* sv, MAGIC* mg) +.Ve +.IP "mg_localize" 8 +.IX Xref "mg_localize" +.IX Item "mg_localize" +Copy some of the magic from an existing \s-1SV\s0 to new localized version of that +\&\s-1SV.\s0 Container magic (\fIe.g.\fR, \f(CW%ENV\fR, \f(CW$1\fR, \f(CW\*(C`tie\*(C'\fR) +gets copied, value magic doesn't (\fIe.g.\fR, +\&\f(CW\*(C`taint\*(C'\fR, \f(CW\*(C`pos\*(C'\fR). +.Sp +If \f(CW\*(C`setmagic\*(C'\fR is false then no set magic will be called on the new (empty) \s-1SV.\s0 +This typically means that assignment will soon follow (e.g. \f(CW\*(Aqlocal\ $x\ =\ $y\*(Aq\fR), +and that will handle the magic. +.Sp +.Vb 1 +\& void mg_localize(SV* sv, SV* nsv, bool setmagic) +.Ve +.SH "Miscellaneous Functions" +.IX Header "Miscellaneous Functions" +.IP "free_c_backtrace" 8 +.IX Xref "free_c_backtrace" +.IX Item "free_c_backtrace" +Deallocates a backtrace received from get_c_bracktrace. +.Sp +.Vb 1 +\& void free_c_backtrace(Perl_c_backtrace* bt) +.Ve +.IP "get_c_backtrace" 8 +.IX Xref "get_c_backtrace" +.IX Item "get_c_backtrace" +Collects the backtrace (aka \*(L"stacktrace\*(R") into a single linear +malloced buffer, which the caller \fBmust\fR \f(CW\*(C`Perl_free_c_backtrace()\*(C'\fR. +.Sp +Scans the frames back by \f(CW\*(C`depth\ +\ skip\*(C'\fR, then drops the \f(CW\*(C`skip\*(C'\fR innermost, +returning at most \f(CW\*(C`depth\*(C'\fR frames. +.Sp +.Vb 2 +\& Perl_c_backtrace* get_c_backtrace(int max_depth, +\& int skip) +.Ve +.IP "quadmath_format_needed" 8 +.IX Xref "quadmath_format_needed" +.IX Item "quadmath_format_needed" +\&\f(CW\*(C`quadmath_format_needed()\*(C'\fR returns true if the \f(CW\*(C`format\*(C'\fR string seems to +contain at least one non-Q-prefixed \f(CW\*(C`%[efgaEFGA]\*(C'\fR format specifier, +or returns false otherwise. +.Sp +The format specifier detection is not complete printf-syntax detection, +but it should catch most common cases. +.Sp +If true is returned, those arguments \fBshould\fR in theory be processed +with \f(CW\*(C`quadmath_snprintf()\*(C'\fR, but in case there is more than one such +format specifier (see \*(L"quadmath_format_valid\*(R"), and if there is +anything else beyond that one (even just a single byte), they +\&\fBcannot\fR be processed because \f(CW\*(C`quadmath_snprintf()\*(C'\fR is very strict, +accepting only one format spec, and nothing else. +In this case, the code should probably fail. +.Sp +.Vb 1 +\& bool quadmath_format_needed(const char* format) +.Ve +.IP "quadmath_format_valid" 8 +.IX Xref "quadmath_format_valid" +.IX Item "quadmath_format_valid" +\&\f(CW\*(C`quadmath_snprintf()\*(C'\fR is very strict about its \f(CW\*(C`format\*(C'\fR string and will +fail, returning \-1, if the format is invalid. It accepts exactly +one format spec. +.Sp +\&\f(CW\*(C`quadmath_format_valid()\*(C'\fR checks that the intended single spec looks +sane: begins with \f(CW\*(C`%\*(C'\fR, has only one \f(CW\*(C`%\*(C'\fR, ends with \f(CW\*(C`[efgaEFGA]\*(C'\fR, +and has \f(CW\*(C`Q\*(C'\fR before it. This is not a full \*(L"printf syntax check\*(R", +just the basics. +.Sp +Returns true if it is valid, false if not. +.Sp +See also \*(L"quadmath_format_needed\*(R". +.Sp +.Vb 1 +\& bool quadmath_format_valid(const char* format) +.Ve +.SH "MRO Functions" +.IX Header "MRO Functions" +.IP "mro_get_linear_isa_dfs" 8 +.IX Xref "mro_get_linear_isa_dfs" +.IX Item "mro_get_linear_isa_dfs" +Returns the Depth-First Search linearization of \f(CW@ISA\fR +the given stash. The return value is a read-only AV*. +\&\f(CW\*(C`level\*(C'\fR should be 0 (it is used internally in this +function's recursion). +.Sp +You are responsible for \f(CW\*(C`SvREFCNT_inc()\*(C'\fR on the +return value if you plan to store it anywhere +semi-permanently (otherwise it might be deleted +out from under you the next time the cache is +invalidated). +.Sp +.Vb 1 +\& AV* mro_get_linear_isa_dfs(HV* stash, U32 level) +.Ve +.IP "mro_isa_changed_in" 8 +.IX Xref "mro_isa_changed_in" +.IX Item "mro_isa_changed_in" +Takes the necessary steps (cache invalidations, mostly) +when the \f(CW@ISA\fR of the given package has changed. Invoked +by the \f(CW\*(C`setisa\*(C'\fR magic, should not need to invoke directly. +.Sp +.Vb 1 +\& void mro_isa_changed_in(HV* stash) +.Ve +.IP "mro_package_moved" 8 +.IX Xref "mro_package_moved" +.IX Item "mro_package_moved" +Call this function to signal to a stash that it has been assigned to +another spot in the stash hierarchy. \f(CW\*(C`stash\*(C'\fR is the stash that has been +assigned. \f(CW\*(C`oldstash\*(C'\fR is the stash it replaces, if any. \f(CW\*(C`gv\*(C'\fR is the glob +that is actually being assigned to. +.Sp +This can also be called with a null first argument to +indicate that \f(CW\*(C`oldstash\*(C'\fR has been deleted. +.Sp +This function invalidates isa caches on the old stash, on all subpackages +nested inside it, and on the subclasses of all those, including +non-existent packages that have corresponding entries in \f(CW\*(C`stash\*(C'\fR. +.Sp +It also sets the effective names (\f(CW\*(C`HvENAME\*(C'\fR) on all the stashes as +appropriate. +.Sp +If the \f(CW\*(C`gv\*(C'\fR is present and is not in the symbol table, then this function +simply returns. This checked will be skipped if \f(CW\*(C`flags & 1\*(C'\fR. +.Sp +.Vb 4 +\& void mro_package_moved(HV * const stash, +\& HV * const oldstash, +\& const GV * const gv, +\& U32 flags) +.Ve +.SH "Numeric functions" +.IX Header "Numeric functions" +.IP "grok_atoUV" 8 +.IX Xref "grok_atoUV" +.IX Item "grok_atoUV" +parse a string, looking for a decimal unsigned integer. +.Sp +On entry, \f(CW\*(C`pv\*(C'\fR points to the beginning of the string; +\&\f(CW\*(C`valptr\*(C'\fR points to a \s-1UV\s0 that will receive the converted value, if found; +\&\f(CW\*(C`endptr\*(C'\fR is either \s-1NULL\s0 or points to a variable that points to one byte +beyond the point in \f(CW\*(C`pv\*(C'\fR that this routine should examine. +If \f(CW\*(C`endptr\*(C'\fR is \s-1NULL,\s0 \f(CW\*(C`pv\*(C'\fR is assumed to be NUL-terminated. +.Sp +Returns \s-1FALSE\s0 if \f(CW\*(C`pv\*(C'\fR doesn't represent a valid unsigned integer value (with +no leading zeros). Otherwise it returns \s-1TRUE,\s0 and sets \f(CW*valptr\fR to that +value. +.Sp +If you constrain the portion of \f(CW\*(C`pv\*(C'\fR that is looked at by this function (by +passing a non-NULL \f(CW\*(C`endptr\*(C'\fR), and if the intial bytes of that portion form a +valid value, it will return \s-1TRUE,\s0 setting \f(CW*endptr\fR to the byte following the +final digit of the value. But if there is no constraint at what's looked at, +all of \f(CW\*(C`pv\*(C'\fR must be valid in order for \s-1TRUE\s0 to be returned. \f(CW*endptr\fR is +unchanged from its value on input if \s-1FALSE\s0 is returned; +.Sp +The only characters this accepts are the decimal digits '0'..'9'. +.Sp +As opposed to \fBatoi\fR\|(3) or \fBstrtol\fR\|(3), \f(CW\*(C`grok_atoUV\*(C'\fR does \s-1NOT\s0 allow optional +leading whitespace, nor negative inputs. If such features are required, the +calling code needs to explicitly implement those. +.Sp +Note that this function returns \s-1FALSE\s0 for inputs that would overflow a \s-1UV,\s0 +or have leading zeros. Thus a single \f(CW0\fR is accepted, but not \f(CW00\fR nor +\&\f(CW01\fR, \f(CW002\fR, \fIetc\fR. +.Sp +Background: \f(CW\*(C`atoi\*(C'\fR has severe problems with illegal inputs, it cannot be +used for incremental parsing, and therefore should be avoided +\&\f(CW\*(C`atoi\*(C'\fR and \f(CW\*(C`strtol\*(C'\fR are also affected by locale settings, which can also be +seen as a bug (global state controlled by user environment). +.Sp +.Vb 2 +\& bool grok_atoUV(const char* pv, UV* valptr, +\& const char** endptr) +.Ve +.IP "isinfnansv" 8 +.IX Xref "isinfnansv" +.IX Item "isinfnansv" +Checks whether the argument would be either an infinity or \f(CW\*(C`NaN\*(C'\fR when used +as a number, but is careful not to trigger non-numeric or uninitialized +warnings. it assumes the caller has done \f(CW\*(C`SvGETMAGIC(sv)\*(C'\fR already. +.Sp +.Vb 1 +\& bool isinfnansv(SV *sv) +.Ve +.SH "Obsolete backwards compatibility functions" +.IX Header "Obsolete backwards compatibility functions" +.IP "utf8n_to_uvuni" 8 +.IX Xref "utf8n_to_uvuni" +.IX Item "utf8n_to_uvuni" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Instead use \*(L"utf8_to_uvchr_buf\*(R" in perlapi, or rarely, \*(L"utf8n_to_uvchr\*(R" in perlapi. +.Sp +This function was useful for code that wanted to handle both \s-1EBCDIC\s0 and +\&\s-1ASCII\s0 platforms with Unicode properties, but starting in Perl v5.20, the +distinctions between the platforms have mostly been made invisible to most +code, so this function is quite unlikely to be what you want. If you do need +this precise functionality, use instead +\&\f(CW\*(C`NATIVE_TO_UNI(utf8_to_uvchr_buf(...))\*(C'\fR +or \f(CW\*(C`NATIVE_TO_UNI(utf8n_to_uvchr(...))\*(C'\fR. +.Sp +.Vb 2 +\& UV utf8n_to_uvuni(const U8 *s, STRLEN curlen, +\& STRLEN *retlen, U32 flags) +.Ve +.IP "utf8_to_uvuni" 8 +.IX Xref "utf8_to_uvuni" +.IX Item "utf8_to_uvuni" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Returns the Unicode code point of the first character in the string \f(CW\*(C`s\*(C'\fR +which is assumed to be in \s-1UTF\-8\s0 encoding; \f(CW\*(C`retlen\*(C'\fR will be set to the +length, in bytes, of that character. +.Sp +Some, but not all, \s-1UTF\-8\s0 malformations are detected, and in fact, some +malformed input could cause reading beyond the end of the input buffer, which +is one reason why this function is deprecated. The other is that only in +extremely limited circumstances should the Unicode versus native code point be +of any interest to you. See \*(L"utf8_to_uvuni_buf\*(R" for alternatives. +.Sp +If \f(CW\*(C`s\*(C'\fR points to one of the detected malformations, and \s-1UTF8\s0 warnings are +enabled, zero is returned and \f(CW*retlen\fR is set (if \f(CW\*(C`retlen\*(C'\fR doesn't point to +\&\s-1NULL\s0) to \-1. If those warnings are off, the computed value if well-defined (or +the Unicode \s-1REPLACEMENT CHARACTER,\s0 if not) is silently returned, and \f(CW*retlen\fR +is set (if \f(CW\*(C`retlen\*(C'\fR isn't \s-1NULL\s0) so that (\f(CW\*(C`s\*(C'\fR\ +\ \f(CW*retlen\fR) is the +next possible position in \f(CW\*(C`s\*(C'\fR that could begin a non-malformed character. +See \*(L"utf8n_to_uvchr\*(R" in perlapi for details on when the \s-1REPLACEMENT CHARACTER\s0 is returned. +.Sp +.Vb 1 +\& UV utf8_to_uvuni(const U8 *s, STRLEN *retlen) +.Ve +.IP "uvuni_to_utf8_flags" 8 +.IX Xref "uvuni_to_utf8_flags" +.IX Item "uvuni_to_utf8_flags" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Instead you almost certainly want to use \*(L"uvchr_to_utf8\*(R" in perlapi or +\&\*(L"uvchr_to_utf8_flags\*(R" in perlapi. +.Sp +This function is a deprecated synonym for \*(L"uvoffuni_to_utf8_flags\*(R", +which itself, while not deprecated, should be used only in isolated +circumstances. These functions were useful for code that wanted to handle +both \s-1EBCDIC\s0 and \s-1ASCII\s0 platforms with Unicode properties, but starting in Perl +v5.20, the distinctions between the platforms have mostly been made invisible +to most code, so this function is quite unlikely to be what you want. +.Sp +.Vb 1 +\& U8* uvuni_to_utf8_flags(U8 *d, UV uv, UV flags) +.Ve +.SH "Optree Manipulation Functions" +.IX Header "Optree Manipulation Functions" +.IP "finalize_optree" 8 +.IX Xref "finalize_optree" +.IX Item "finalize_optree" +This function finalizes the optree. Should be called directly after +the complete optree is built. It does some additional +checking which can't be done in the normal \f(CW\*(C`ck_\*(C'\fRxxx functions and makes +the tree thread-safe. +.Sp +.Vb 1 +\& void finalize_optree(OP* o) +.Ve +.IP "newATTRSUB_x" 8 +.IX Xref "newATTRSUB_x" +.IX Item "newATTRSUB_x" +Construct a Perl subroutine, also performing some surrounding jobs. +.Sp +This function is expected to be called in a Perl compilation context, +and some aspects of the subroutine are taken from global variables +associated with compilation. In particular, \f(CW\*(C`PL_compcv\*(C'\fR represents +the subroutine that is currently being compiled. It must be non-null +when this function is called, and some aspects of the subroutine being +constructed are taken from it. The constructed subroutine may actually +be a reuse of the \f(CW\*(C`PL_compcv\*(C'\fR object, but will not necessarily be so. +.Sp +If \f(CW\*(C`block\*(C'\fR is null then the subroutine will have no body, and for the +time being it will be an error to call it. This represents a forward +subroutine declaration such as \f(CW\*(C`sub\ foo\ ($$);\*(C'\fR. If \f(CW\*(C`block\*(C'\fR is +non-null then it provides the Perl code of the subroutine body, which +will be executed when the subroutine is called. This body includes +any argument unwrapping code resulting from a subroutine signature or +similar. The pad use of the code must correspond to the pad attached +to \f(CW\*(C`PL_compcv\*(C'\fR. The code is not expected to include a \f(CW\*(C`leavesub\*(C'\fR or +\&\f(CW\*(C`leavesublv\*(C'\fR op; this function will add such an op. \f(CW\*(C`block\*(C'\fR is consumed +by this function and will become part of the constructed subroutine. +.Sp +\&\f(CW\*(C`proto\*(C'\fR specifies the subroutine's prototype, unless one is supplied +as an attribute (see below). If \f(CW\*(C`proto\*(C'\fR is null, then the subroutine +will not have a prototype. If \f(CW\*(C`proto\*(C'\fR is non-null, it must point to a +\&\f(CW\*(C`const\*(C'\fR op whose value is a string, and the subroutine will have that +string as its prototype. If a prototype is supplied as an attribute, the +attribute takes precedence over \f(CW\*(C`proto\*(C'\fR, but in that case \f(CW\*(C`proto\*(C'\fR should +preferably be null. In any case, \f(CW\*(C`proto\*(C'\fR is consumed by this function. +.Sp +\&\f(CW\*(C`attrs\*(C'\fR supplies attributes to be applied the subroutine. A handful of +attributes take effect by built-in means, being applied to \f(CW\*(C`PL_compcv\*(C'\fR +immediately when seen. Other attributes are collected up and attached +to the subroutine by this route. \f(CW\*(C`attrs\*(C'\fR may be null to supply no +attributes, or point to a \f(CW\*(C`const\*(C'\fR op for a single attribute, or point +to a \f(CW\*(C`list\*(C'\fR op whose children apart from the \f(CW\*(C`pushmark\*(C'\fR are \f(CW\*(C`const\*(C'\fR +ops for one or more attributes. Each \f(CW\*(C`const\*(C'\fR op must be a string, +giving the attribute name optionally followed by parenthesised arguments, +in the manner in which attributes appear in Perl source. The attributes +will be applied to the sub by this function. \f(CW\*(C`attrs\*(C'\fR is consumed by +this function. +.Sp +If \f(CW\*(C`o_is_gv\*(C'\fR is false and \f(CW\*(C`o\*(C'\fR is null, then the subroutine will +be anonymous. If \f(CW\*(C`o_is_gv\*(C'\fR is false and \f(CW\*(C`o\*(C'\fR is non-null, then \f(CW\*(C`o\*(C'\fR +must point to a \f(CW\*(C`const\*(C'\fR op, which will be consumed by this function, +and its string value supplies a name for the subroutine. The name may +be qualified or unqualified, and if it is unqualified then a default +stash will be selected in some manner. If \f(CW\*(C`o_is_gv\*(C'\fR is true, then \f(CW\*(C`o\*(C'\fR +doesn't point to an \f(CW\*(C`OP\*(C'\fR at all, but is instead a cast pointer to a \f(CW\*(C`GV\*(C'\fR +by which the subroutine will be named. +.Sp +If there is already a subroutine of the specified name, then the new +sub will either replace the existing one in the glob or be merged with +the existing one. A warning may be generated about redefinition. +.Sp +If the subroutine has one of a few special names, such as \f(CW\*(C`BEGIN\*(C'\fR or +\&\f(CW\*(C`END\*(C'\fR, then it will be claimed by the appropriate queue for automatic +running of phase-related subroutines. In this case the relevant glob will +be left not containing any subroutine, even if it did contain one before. +In the case of \f(CW\*(C`BEGIN\*(C'\fR, the subroutine will be executed and the reference +to it disposed of before this function returns. +.Sp +The function returns a pointer to the constructed subroutine. If the sub +is anonymous then ownership of one counted reference to the subroutine +is transferred to the caller. If the sub is named then the caller does +not get ownership of a reference. In most such cases, where the sub +has a non-phase name, the sub will be alive at the point it is returned +by virtue of being contained in the glob that names it. A phase-named +subroutine will usually be alive by virtue of the reference owned by the +phase's automatic run queue. But a \f(CW\*(C`BEGIN\*(C'\fR subroutine, having already +been executed, will quite likely have been destroyed already by the +time this function returns, making it erroneous for the caller to make +any use of the returned pointer. It is the caller's responsibility to +ensure that it knows which of these situations applies. +.Sp +.Vb 2 +\& CV* newATTRSUB_x(I32 floor, OP *o, OP *proto, +\& OP *attrs, OP *block, bool o_is_gv) +.Ve +.IP "newXS_len_flags" 8 +.IX Xref "newXS_len_flags" +.IX Item "newXS_len_flags" +Construct an \s-1XS\s0 subroutine, also performing some surrounding jobs. +.Sp +The subroutine will have the entry point \f(CW\*(C`subaddr\*(C'\fR. It will have +the prototype specified by the nul-terminated string \f(CW\*(C`proto\*(C'\fR, or +no prototype if \f(CW\*(C`proto\*(C'\fR is null. The prototype string is copied; +the caller can mutate the supplied string afterwards. If \f(CW\*(C`filename\*(C'\fR +is non-null, it must be a nul-terminated filename, and the subroutine +will have its \f(CW\*(C`CvFILE\*(C'\fR set accordingly. By default \f(CW\*(C`CvFILE\*(C'\fR is set to +point directly to the supplied string, which must be static. If \f(CW\*(C`flags\*(C'\fR +has the \f(CW\*(C`XS_DYNAMIC_FILENAME\*(C'\fR bit set, then a copy of the string will +be taken instead. +.Sp +Other aspects of the subroutine will be left in their default state. +If anything else needs to be done to the subroutine for it to function +correctly, it is the caller's responsibility to do that after this +function has constructed it. However, beware of the subroutine +potentially being destroyed before this function returns, as described +below. +.Sp +If \f(CW\*(C`name\*(C'\fR is null then the subroutine will be anonymous, with its +\&\f(CW\*(C`CvGV\*(C'\fR referring to an \f(CW\*(C`_\|_ANON_\|_\*(C'\fR glob. If \f(CW\*(C`name\*(C'\fR is non-null then the +subroutine will be named accordingly, referenced by the appropriate glob. +\&\f(CW\*(C`name\*(C'\fR is a string of length \f(CW\*(C`len\*(C'\fR bytes giving a sigilless symbol name, +in \s-1UTF\-8\s0 if \f(CW\*(C`flags\*(C'\fR has the \f(CW\*(C`SVf_UTF8\*(C'\fR bit set and in Latin\-1 otherwise. +The name may be either qualified or unqualified, with the stash defaulting +in the same manner as for \f(CW\*(C`gv_fetchpvn_flags\*(C'\fR. \f(CW\*(C`flags\*(C'\fR may contain +flag bits understood by \f(CW\*(C`gv_fetchpvn_flags\*(C'\fR with the same meaning as +they have there, such as \f(CW\*(C`GV_ADDWARN\*(C'\fR. The symbol is always added to +the stash if necessary, with \f(CW\*(C`GV_ADDMULTI\*(C'\fR semantics. +.Sp +If there is already a subroutine of the specified name, then the new sub +will replace the existing one in the glob. A warning may be generated +about the redefinition. If the old subroutine was \f(CW\*(C`CvCONST\*(C'\fR then the +decision about whether to warn is influenced by an expectation about +whether the new subroutine will become a constant of similar value. +That expectation is determined by \f(CW\*(C`const_svp\*(C'\fR. (Note that the call to +this function doesn't make the new subroutine \f(CW\*(C`CvCONST\*(C'\fR in any case; +that is left to the caller.) If \f(CW\*(C`const_svp\*(C'\fR is null then it indicates +that the new subroutine will not become a constant. If \f(CW\*(C`const_svp\*(C'\fR +is non-null then it indicates that the new subroutine will become a +constant, and it points to an \f(CW\*(C`SV*\*(C'\fR that provides the constant value +that the subroutine will have. +.Sp +If the subroutine has one of a few special names, such as \f(CW\*(C`BEGIN\*(C'\fR or +\&\f(CW\*(C`END\*(C'\fR, then it will be claimed by the appropriate queue for automatic +running of phase-related subroutines. In this case the relevant glob will +be left not containing any subroutine, even if it did contain one before. +In the case of \f(CW\*(C`BEGIN\*(C'\fR, the subroutine will be executed and the reference +to it disposed of before this function returns, and also before its +prototype is set. If a \f(CW\*(C`BEGIN\*(C'\fR subroutine would not be sufficiently +constructed by this function to be ready for execution then the caller +must prevent this happening by giving the subroutine a different name. +.Sp +The function returns a pointer to the constructed subroutine. If the sub +is anonymous then ownership of one counted reference to the subroutine +is transferred to the caller. If the sub is named then the caller does +not get ownership of a reference. In most such cases, where the sub +has a non-phase name, the sub will be alive at the point it is returned +by virtue of being contained in the glob that names it. A phase-named +subroutine will usually be alive by virtue of the reference owned by the +phase's automatic run queue. But a \f(CW\*(C`BEGIN\*(C'\fR subroutine, having already +been executed, will quite likely have been destroyed already by the +time this function returns, making it erroneous for the caller to make +any use of the returned pointer. It is the caller's responsibility to +ensure that it knows which of these situations applies. +.Sp +.Vb 5 +\& CV * newXS_len_flags(const char *name, STRLEN len, +\& XSUBADDR_t subaddr, +\& const char *const filename, +\& const char *const proto, +\& SV **const_svp, U32 flags) +.Ve +.IP "optimize_optree" 8 +.IX Xref "optimize_optree" +.IX Item "optimize_optree" +This function applies some optimisations to the optree in top-down order. +It is called before the peephole optimizer, which processes ops in +execution order. Note that \fBfinalize_optree()\fR also does a top-down scan, +but is called *after* the peephole optimizer. +.Sp +.Vb 1 +\& void optimize_optree(OP* o) +.Ve +.IP "traverse_op_tree" 8 +.IX Xref "traverse_op_tree" +.IX Item "traverse_op_tree" +Return the next op in a depth-first traversal of the op tree, +returning \s-1NULL\s0 when the traversal is complete. +.Sp +The initial call must supply the root of the tree as both top and o. +.Sp +For now it's static, but it may be exposed to the \s-1API\s0 in the future. +.Sp +.Vb 1 +\& OP* traverse_op_tree(OP* top, OP* o) +.Ve +.SH "Pad Data Structures" +.IX Header "Pad Data Structures" +.IP "\s-1CX_CURPAD_SAVE\s0" 8 +.IX Xref "CX_CURPAD_SAVE" +.IX Item "CX_CURPAD_SAVE" +Save the current pad in the given context block structure. +.Sp +.Vb 1 +\& void CX_CURPAD_SAVE(struct context) +.Ve +.IP "\s-1CX_CURPAD_SV\s0" 8 +.IX Xref "CX_CURPAD_SV" +.IX Item "CX_CURPAD_SV" +Access the \s-1SV\s0 at offset \f(CW\*(C`po\*(C'\fR in the saved current pad in the given +context block structure (can be used as an lvalue). +.Sp +.Vb 1 +\& SV * CX_CURPAD_SV(struct context, PADOFFSET po) +.Ve +.IP "\s-1PAD_BASE_SV\s0" 8 +.IX Xref "PAD_BASE_SV" +.IX Item "PAD_BASE_SV" +Get the value from slot \f(CW\*(C`po\*(C'\fR in the base (DEPTH=1) pad of a padlist +.Sp +.Vb 1 +\& SV * PAD_BASE_SV(PADLIST padlist, PADOFFSET po) +.Ve +.IP "\s-1PAD_CLONE_VARS\s0" 8 +.IX Xref "PAD_CLONE_VARS" +.IX Item "PAD_CLONE_VARS" +Clone the state variables associated with running and compiling pads. +.Sp +.Vb 2 +\& void PAD_CLONE_VARS(PerlInterpreter *proto_perl, +\& CLONE_PARAMS* param) +.Ve +.IP "\s-1PAD_COMPNAME_FLAGS\s0" 8 +.IX Xref "PAD_COMPNAME_FLAGS" +.IX Item "PAD_COMPNAME_FLAGS" +Return the flags for the current compiling pad name +at offset \f(CW\*(C`po\*(C'\fR. Assumes a valid slot entry. +.Sp +.Vb 1 +\& U32 PAD_COMPNAME_FLAGS(PADOFFSET po) +.Ve +.IP "\s-1PAD_COMPNAME_GEN\s0" 8 +.IX Xref "PAD_COMPNAME_GEN" +.IX Item "PAD_COMPNAME_GEN" +The generation number of the name at offset \f(CW\*(C`po\*(C'\fR in the current +compiling pad (lvalue). +.Sp +.Vb 1 +\& STRLEN PAD_COMPNAME_GEN(PADOFFSET po) +.Ve +.IP "PAD_COMPNAME_GEN_set" 8 +.IX Xref "PAD_COMPNAME_GEN_set" +.IX Item "PAD_COMPNAME_GEN_set" +Sets the generation number of the name at offset \f(CW\*(C`po\*(C'\fR in the current +ling pad (lvalue) to \f(CW\*(C`gen\*(C'\fR. + \s-1STRLEN\s0 PAD_COMPNAME_GEN_set(\s-1PADOFFSET\s0 po, int gen) +.IP "\s-1PAD_COMPNAME_OURSTASH\s0" 8 +.IX Xref "PAD_COMPNAME_OURSTASH" +.IX Item "PAD_COMPNAME_OURSTASH" +Return the stash associated with an \f(CW\*(C`our\*(C'\fR variable. +Assumes the slot entry is a valid \f(CW\*(C`our\*(C'\fR lexical. +.Sp +.Vb 1 +\& HV * PAD_COMPNAME_OURSTASH(PADOFFSET po) +.Ve +.IP "\s-1PAD_COMPNAME_PV\s0" 8 +.IX Xref "PAD_COMPNAME_PV" +.IX Item "PAD_COMPNAME_PV" +Return the name of the current compiling pad name +at offset \f(CW\*(C`po\*(C'\fR. Assumes a valid slot entry. +.Sp +.Vb 1 +\& char * PAD_COMPNAME_PV(PADOFFSET po) +.Ve +.IP "\s-1PAD_COMPNAME_TYPE\s0" 8 +.IX Xref "PAD_COMPNAME_TYPE" +.IX Item "PAD_COMPNAME_TYPE" +Return the type (stash) of the current compiling pad name at offset +\&\f(CW\*(C`po\*(C'\fR. Must be a valid name. Returns null if not typed. +.Sp +.Vb 1 +\& HV * PAD_COMPNAME_TYPE(PADOFFSET po) +.Ve +.IP "PadnameIsOUR" 8 +.IX Xref "PadnameIsOUR" +.IX Item "PadnameIsOUR" +Whether this is an \*(L"our\*(R" variable. +.Sp +.Vb 1 +\& bool PadnameIsOUR(PADNAME * pn) +.Ve +.IP "PadnameIsSTATE" 8 +.IX Xref "PadnameIsSTATE" +.IX Item "PadnameIsSTATE" +Whether this is a \*(L"state\*(R" variable. +.Sp +.Vb 1 +\& bool PadnameIsSTATE(PADNAME * pn) +.Ve +.IP "PadnameOURSTASH" 8 +.IX Xref "PadnameOURSTASH" +.IX Item "PadnameOURSTASH" +The stash in which this \*(L"our\*(R" variable was declared. +.Sp +.Vb 1 +\& HV * PadnameOURSTASH() +.Ve +.IP "PadnameOUTER" 8 +.IX Xref "PadnameOUTER" +.IX Item "PadnameOUTER" +Whether this entry belongs to an outer pad. Entries for which this is true +are often referred to as 'fake'. +.Sp +.Vb 1 +\& bool PadnameOUTER(PADNAME * pn) +.Ve +.IP "PadnameTYPE" 8 +.IX Xref "PadnameTYPE" +.IX Item "PadnameTYPE" +The stash associated with a typed lexical. This returns the \f(CW%Foo::\fR hash +for \f(CW\*(C`my Foo $bar\*(C'\fR. +.Sp +.Vb 1 +\& HV * PadnameTYPE(PADNAME * pn) +.Ve +.IP "\s-1PAD_RESTORE_LOCAL\s0" 8 +.IX Xref "PAD_RESTORE_LOCAL" +.IX Item "PAD_RESTORE_LOCAL" +Restore the old pad saved into the local variable \f(CW\*(C`opad\*(C'\fR by \f(CW\*(C`PAD_SAVE_LOCAL()\*(C'\fR +.Sp +.Vb 1 +\& void PAD_RESTORE_LOCAL(PAD *opad) +.Ve +.IP "\s-1PAD_SAVE_LOCAL\s0" 8 +.IX Xref "PAD_SAVE_LOCAL" +.IX Item "PAD_SAVE_LOCAL" +Save the current pad to the local variable \f(CW\*(C`opad\*(C'\fR, then make the +current pad equal to \f(CW\*(C`npad\*(C'\fR +.Sp +.Vb 1 +\& void PAD_SAVE_LOCAL(PAD *opad, PAD *npad) +.Ve +.IP "\s-1PAD_SAVE_SETNULLPAD\s0" 8 +.IX Xref "PAD_SAVE_SETNULLPAD" +.IX Item "PAD_SAVE_SETNULLPAD" +Save the current pad then set it to null. +.Sp +.Vb 1 +\& void PAD_SAVE_SETNULLPAD() +.Ve +.IP "\s-1PAD_SETSV\s0" 8 +.IX Xref "PAD_SETSV" +.IX Item "PAD_SETSV" +Set the slot at offset \f(CW\*(C`po\*(C'\fR in the current pad to \f(CW\*(C`sv\*(C'\fR +.Sp +.Vb 1 +\& SV * PAD_SETSV(PADOFFSET po, SV* sv) +.Ve +.IP "\s-1PAD_SET_CUR\s0" 8 +.IX Xref "PAD_SET_CUR" +.IX Item "PAD_SET_CUR" +Set the current pad to be pad \f(CW\*(C`n\*(C'\fR in the padlist, saving +the previous current pad. \s-1NB\s0 currently this macro expands to a string too +long for some compilers, so it's best to replace it with +.Sp +.Vb 2 +\& SAVECOMPPAD(); +\& PAD_SET_CUR_NOSAVE(padlist,n); +\& +\& +\& void PAD_SET_CUR(PADLIST padlist, I32 n) +.Ve +.IP "\s-1PAD_SET_CUR_NOSAVE\s0" 8 +.IX Xref "PAD_SET_CUR_NOSAVE" +.IX Item "PAD_SET_CUR_NOSAVE" +like \s-1PAD_SET_CUR,\s0 but without the save +.Sp +.Vb 1 +\& void PAD_SET_CUR_NOSAVE(PADLIST padlist, I32 n) +.Ve +.IP "\s-1PAD_SV\s0" 8 +.IX Xref "PAD_SV" +.IX Item "PAD_SV" +Get the value at offset \f(CW\*(C`po\*(C'\fR in the current pad +.Sp +.Vb 1 +\& SV * PAD_SV(PADOFFSET po) +.Ve +.IP "PAD_SVl" 8 +.IX Xref "PAD_SVl" +.IX Item "PAD_SVl" +Lightweight and lvalue version of \f(CW\*(C`PAD_SV\*(C'\fR. +Get or set the value at offset \f(CW\*(C`po\*(C'\fR in the current pad. +Unlike \f(CW\*(C`PAD_SV\*(C'\fR, does not print diagnostics with \-DX. +For internal use only. +.Sp +.Vb 1 +\& SV * PAD_SVl(PADOFFSET po) +.Ve +.IP "\s-1SAVECLEARSV\s0" 8 +.IX Xref "SAVECLEARSV" +.IX Item "SAVECLEARSV" +Clear the pointed to pad value on scope exit. (i.e. the runtime action of +\&\f(CW\*(C`my\*(C'\fR) +.Sp +.Vb 1 +\& void SAVECLEARSV(SV **svp) +.Ve +.IP "\s-1SAVECOMPPAD\s0" 8 +.IX Xref "SAVECOMPPAD" +.IX Item "SAVECOMPPAD" +save \f(CW\*(C`PL_comppad\*(C'\fR and \f(CW\*(C`PL_curpad\*(C'\fR +.Sp +.Vb 1 +\& void SAVECOMPPAD() +.Ve +.IP "\s-1SAVEPADSV\s0" 8 +.IX Xref "SAVEPADSV" +.IX Item "SAVEPADSV" +Save a pad slot (used to restore after an iteration) +.Sp +\&\s-1XXX DAPM\s0 it would make more sense to make the arg a \s-1PADOFFSET\s0 + void \s-1SAVEPADSV\s0(\s-1PADOFFSET\s0 po) +.SH "Per-Interpreter Variables" +.IX Header "Per-Interpreter Variables" +.IP "PL_DBsingle" 8 +.IX Xref "PL_DBsingle" +.IX Item "PL_DBsingle" +When Perl is run in debugging mode, with the \fB\-d\fR switch, this \s-1SV\s0 is a +boolean which indicates whether subs are being single-stepped. +Single-stepping is automatically turned on after every step. This is the C +variable which corresponds to Perl's \f(CW$DB::single\fR variable. See +\&\f(CW"PL_DBsub"\fR. +.Sp +.Vb 1 +\& SV * PL_DBsingle +.Ve +.IP "PL_DBsub" 8 +.IX Xref "PL_DBsub" +.IX Item "PL_DBsub" +When Perl is run in debugging mode, with the \fB\-d\fR switch, this \s-1GV\s0 contains +the \s-1SV\s0 which holds the name of the sub being debugged. This is the C +variable which corresponds to Perl's \f(CW$DB::sub\fR variable. See +\&\f(CW"PL_DBsingle"\fR. +.Sp +.Vb 1 +\& GV * PL_DBsub +.Ve +.IP "PL_DBtrace" 8 +.IX Xref "PL_DBtrace" +.IX Item "PL_DBtrace" +Trace variable used when Perl is run in debugging mode, with the \fB\-d\fR +switch. This is the C variable which corresponds to Perl's \f(CW$DB::trace\fR +variable. See \f(CW"PL_DBsingle"\fR. +.Sp +.Vb 1 +\& SV * PL_DBtrace +.Ve +.IP "PL_dowarn" 8 +.IX Xref "PL_dowarn" +.IX Item "PL_dowarn" +The C variable that roughly corresponds to Perl's \f(CW$^W\fR warning variable. +However, \f(CW$^W\fR is treated as a boolean, whereas \f(CW\*(C`PL_dowarn\*(C'\fR is a +collection of flag bits. +.Sp +.Vb 1 +\& U8 PL_dowarn +.Ve +.IP "PL_last_in_gv" 8 +.IX Xref "PL_last_in_gv" +.IX Item "PL_last_in_gv" +The \s-1GV\s0 which was last used for a filehandle input operation. (\f(CW\*(C`\*(C'\fR) +.Sp +.Vb 1 +\& GV* PL_last_in_gv +.Ve +.IP "PL_ofsgv" 8 +.IX Xref "PL_ofsgv" +.IX Item "PL_ofsgv" +The glob containing the output field separator \- \f(CW\*(C`*,\*(C'\fR in Perl space. +.Sp +.Vb 1 +\& GV* PL_ofsgv +.Ve +.IP "PL_rs" 8 +.IX Xref "PL_rs" +.IX Item "PL_rs" +The input record separator \- \f(CW$/\fR in Perl space. +.Sp +.Vb 1 +\& SV* PL_rs +.Ve +.SH "Stack Manipulation Macros" +.IX Header "Stack Manipulation Macros" +.IP "djSP" 8 +.IX Xref "djSP" +.IX Item "djSP" +Declare Just \f(CW\*(C`SP\*(C'\fR. This is actually identical to \f(CW\*(C`dSP\*(C'\fR, and declares +a local copy of perl's stack pointer, available via the \f(CW\*(C`SP\*(C'\fR macro. +See \f(CW\*(C`"SP" in perlapi\*(C'\fR. (Available for backward source code compatibility with +the old (Perl 5.005) thread model.) +.Sp +.Vb 1 +\& djSP(); +.Ve +.IP "\s-1LVRET\s0" 8 +.IX Xref "LVRET" +.IX Item "LVRET" +True if this op will be the return value of an lvalue subroutine +.SH "SV Flags" +.IX Header "SV Flags" +.IP "SVt_INVLIST" 8 +.IX Xref "SVt_INVLIST" +.IX Item "SVt_INVLIST" +Type flag for scalars. See \*(L"svtype\*(R" in perlapi. +.SH "SV Manipulation Functions" +.IX Header "SV Manipulation Functions" +An \s-1SV\s0 (or \s-1AV, HV,\s0 etc.) is allocated in two parts: the head (struct +sv, av, hv...) contains type and reference count information, and for +many types, a pointer to the body (struct xrv, xpv, xpviv...), which +contains fields specific to each type. Some types store all they need +in the head, so don't have a body. +.PP +In all but the most memory-paranoid configurations (ex: \s-1PURIFY\s0), heads +and bodies are allocated out of arenas, which by default are +approximately 4K chunks of memory parcelled up into N heads or bodies. +Sv-bodies are allocated by their sv-type, guaranteeing size +consistency needed to allocate safely from arrays. +.PP +For SV-heads, the first slot in each arena is reserved, and holds a +link to the next arena, some flags, and a note of the number of slots. +Snaked through each arena chain is a linked list of free items; when +this becomes empty, an extra arena is allocated and divided up into N +items which are threaded into the free list. +.PP +SV-bodies are similar, but they use arena-sets by default, which +separate the link and info from the arena itself, and reclaim the 1st +slot in the arena. SV-bodies are further described later. +.PP +The following global variables are associated with arenas: +.PP +.Vb 2 +\& PL_sv_arenaroot pointer to list of SV arenas +\& PL_sv_root pointer to list of free SV structures +\& +\& PL_body_arenas head of linked\-list of body arenas +\& PL_body_roots[] array of pointers to list of free bodies of svtype +\& arrays are indexed by the svtype needed +.Ve +.PP +A few special \s-1SV\s0 heads are not allocated from an arena, but are +instead directly created in the interpreter structure, eg PL_sv_undef. +The size of arenas can be changed from the default by setting +\&\s-1PERL_ARENA_SIZE\s0 appropriately at compile time. +.PP +The \s-1SV\s0 arena serves the secondary purpose of allowing still-live SVs +to be located and destroyed during final cleanup. +.PP +At the lowest level, the macros \fBnew_SV()\fR and \fBdel_SV()\fR grab and free +an \s-1SV\s0 head. (If debugging with \-DD, \fBdel_SV()\fR calls the function \fBS_del_sv()\fR +to return the \s-1SV\s0 to the free list with error checking.) \fBnew_SV()\fR calls +\&\fBmore_sv()\fR / \fBsv_add_arena()\fR to add an extra arena if the free list is empty. +SVs in the free list have their SvTYPE field set to all ones. +.PP +At the time of very final cleanup, \fBsv_free_arenas()\fR is called from +\&\fBperl_destruct()\fR to physically free all the arenas allocated since the +start of the interpreter. +.PP +The function \fBvisit()\fR scans the \s-1SV\s0 arenas list, and calls a specified +function for each \s-1SV\s0 it finds which is still live \- ie which has an SvTYPE +other than all 1's, and a non-zero SvREFCNT. \fBvisit()\fR is used by the +following functions (specified as [function that calls \fBvisit()\fR] / [function +called by \fBvisit()\fR for each \s-1SV\s0]): +.PP +.Vb 2 +\& sv_report_used() / do_report_used() +\& dump all remaining SVs (debugging aid) +\& +\& sv_clean_objs() / do_clean_objs(),do_clean_named_objs(), +\& do_clean_named_io_objs(),do_curse() +\& Attempt to free all objects pointed to by RVs, +\& try to do the same for all objects indir\- +\& ectly referenced by typeglobs too, and +\& then do a final sweep, cursing any +\& objects that remain. Called once from +\& perl_destruct(), prior to calling sv_clean_all() +\& below. +\& +\& sv_clean_all() / do_clean_all() +\& SvREFCNT_dec(sv) each remaining SV, possibly +\& triggering an sv_free(). It also sets the +\& SVf_BREAK flag on the SV to indicate that the +\& refcnt has been artificially lowered, and thus +\& stopping sv_free() from giving spurious warnings +\& about SVs which unexpectedly have a refcnt +\& of zero. called repeatedly from perl_destruct() +\& until there are no SVs left. +.Ve +.IP "sv_2num" 8 +.IX Xref "sv_2num" +.IX Item "sv_2num" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Return an \s-1SV\s0 with the numeric value of the source \s-1SV,\s0 doing any necessary +reference or overload conversion. The caller is expected to have handled +get-magic already. +.Sp +.Vb 1 +\& SV* sv_2num(SV *const sv) +.Ve +.IP "sv_add_arena" 8 +.IX Xref "sv_add_arena" +.IX Item "sv_add_arena" +Given a chunk of memory, link it to the head of the list of arenas, +and split it into a list of free SVs. +.Sp +.Vb 2 +\& void sv_add_arena(char *const ptr, const U32 size, +\& const U32 flags) +.Ve +.IP "sv_clean_all" 8 +.IX Xref "sv_clean_all" +.IX Item "sv_clean_all" +Decrement the refcnt of each remaining \s-1SV,\s0 possibly triggering a +cleanup. This function may have to be called multiple times to free +SVs which are in complex self-referential hierarchies. +.Sp +.Vb 1 +\& I32 sv_clean_all() +.Ve +.IP "sv_clean_objs" 8 +.IX Xref "sv_clean_objs" +.IX Item "sv_clean_objs" +Attempt to destroy all objects not yet freed. +.Sp +.Vb 1 +\& void sv_clean_objs() +.Ve +.IP "sv_free_arenas" 8 +.IX Xref "sv_free_arenas" +.IX Item "sv_free_arenas" +Deallocate the memory used by all arenas. Note that all the individual \s-1SV\s0 +heads and bodies within the arenas must already have been freed. +.Sp +.Vb 1 +\& void sv_free_arenas() +.Ve +.IP "SvTHINKFIRST" 8 +.IX Xref "SvTHINKFIRST" +.IX Item "SvTHINKFIRST" +A quick flag check to see whether an \f(CW\*(C`sv\*(C'\fR should be passed to \f(CW\*(C`sv_force_normal\*(C'\fR +to be \*(L"downgraded\*(R" before \f(CW\*(C`SvIVX\*(C'\fR or \f(CW\*(C`SvPVX\*(C'\fR can be modified directly. +.Sp +For example, if your scalar is a reference and you want to modify the \f(CW\*(C`SvIVX\*(C'\fR +slot, you can't just do \f(CW\*(C`SvROK_off\*(C'\fR, as that will leak the referent. +.Sp +This is used internally by various sv-modifying functions, such as +\&\f(CW\*(C`sv_setsv\*(C'\fR, \f(CW\*(C`sv_setiv\*(C'\fR and \f(CW\*(C`sv_pvn_force\*(C'\fR. +.Sp +One case that this does not handle is a gv without SvFAKE set. After +.Sp +.Vb 1 +\& if (SvTHINKFIRST(gv)) sv_force_normal(gv); +.Ve +.Sp +it will still be a gv. +.Sp +\&\f(CW\*(C`SvTHINKFIRST\*(C'\fR sometimes produces false positives. In those cases +\&\f(CW\*(C`sv_force_normal\*(C'\fR does nothing. +.Sp +.Vb 1 +\& U32 SvTHINKFIRST(SV *sv) +.Ve +.SH "Unicode Support" +.IX Header "Unicode Support" +These are various utility functions for manipulating UTF8\-encoded +strings. For the uninitiated, this is a method of representing arbitrary +Unicode characters as a variable number of bytes, in such a way that +characters in the \s-1ASCII\s0 range are unmodified, and a zero byte never appears +within non-zero characters. +.IP "find_uninit_var" 8 +.IX Xref "find_uninit_var" +.IX Item "find_uninit_var" +\&\s-1NOTE:\s0 this function is experimental and may change or be +removed without notice. +.Sp +Find the name of the undefined variable (if any) that caused the operator +to issue a \*(L"Use of uninitialized value\*(R" warning. +If match is true, only return a name if its value matches \f(CW\*(C`uninit_sv\*(C'\fR. +So roughly speaking, if a unary operator (such as \f(CW\*(C`OP_COS\*(C'\fR) generates a +warning, then following the direct child of the op may yield an +\&\f(CW\*(C`OP_PADSV\*(C'\fR or \f(CW\*(C`OP_GV\*(C'\fR that gives the name of the undefined variable. On the +other hand, with \f(CW\*(C`OP_ADD\*(C'\fR there are two branches to follow, so we only print +the variable name if we get an exact match. +\&\f(CW\*(C`desc_p\*(C'\fR points to a string pointer holding the description of the op. +This may be updated if needed. +.Sp +The name is returned as a mortal \s-1SV.\s0 +.Sp +Assumes that \f(CW\*(C`PL_op\*(C'\fR is the \s-1OP\s0 that originally triggered the error, and that +\&\f(CW\*(C`PL_comppad\*(C'\fR/\f(CW\*(C`PL_curpad\*(C'\fR points to the currently executing pad. +.Sp +.Vb 3 +\& SV* find_uninit_var(const OP *const obase, +\& const SV *const uninit_sv, +\& bool match, const char **desc_p) +.Ve +.IP "isSCRIPT_RUN" 8 +.IX Xref "isSCRIPT_RUN" +.IX Item "isSCRIPT_RUN" +Returns a bool as to whether or not the sequence of bytes from \f(CW\*(C`s\*(C'\fR up to but +not including \f(CW\*(C`send\*(C'\fR form a \*(L"script run\*(R". \f(CW\*(C`utf8_target\*(C'\fR is \s-1TRUE\s0 iff the +sequence starting at \f(CW\*(C`s\*(C'\fR is to be treated as \s-1UTF\-8.\s0 To be precise, except for +two degenerate cases given below, this function returns \s-1TRUE\s0 iff all code +points in it come from any combination of three \*(L"scripts\*(R" given by the Unicode +\&\*(L"Script Extensions\*(R" property: Common, Inherited, and possibly one other. +Additionally all decimal digits must come from the same consecutive sequence of +10. +.Sp +For example, if all the characters in the sequence are Greek, or Common, or +Inherited, this function will return \s-1TRUE,\s0 provided any decimal digits in it +are from the same block of digits in Common. (These are the \s-1ASCII\s0 digits +\&\*(L"0\*(R"..\*(L"9\*(R" and additionally a block for full width forms of these, and several +others used in mathematical notation.) For scripts (unlike Greek) that have +their own digits defined this will accept either digits from that set or from +one of the Common digit sets, but not a combination of the two. Some scripts, +such as Arabic, have more than one set of digits. All digits must come from +the same set for this function to return \s-1TRUE.\s0 +.Sp +\&\f(CW*ret_script\fR, if \f(CW\*(C`ret_script\*(C'\fR is not \s-1NULL,\s0 will on return of \s-1TRUE\s0 +contain the script found, using the \f(CW\*(C`SCX_enum\*(C'\fR typedef. Its value will be +\&\f(CW\*(C`SCX_INVALID\*(C'\fR if the function returns \s-1FALSE.\s0 +.Sp +If the sequence is empty, \s-1TRUE\s0 is returned, but \f(CW*ret_script\fR (if asked for) +will be \f(CW\*(C`SCX_INVALID\*(C'\fR. +.Sp +If the sequence contains a single code point which is unassigned to a character +in the version of Unicode being used, the function will return \s-1TRUE,\s0 and the +script will be \f(CW\*(C`SCX_Unknown\*(C'\fR. Any other combination of unassigned code points +in the input sequence will result in the function treating the input as not +being a script run. +.Sp +The returned script will be \f(CW\*(C`SCX_Inherited\*(C'\fR iff all the code points in it are +from the Inherited script. +.Sp +Otherwise, the returned script will be \f(CW\*(C`SCX_Common\*(C'\fR iff all the code points in +it are from the Inherited or Common scripts. +.Sp +.Vb 2 +\& bool isSCRIPT_RUN(const U8 *s, const U8 *send, +\& const bool utf8_target) +.Ve +.IP "is_utf8_non_invariant_string" 8 +.IX Xref "is_utf8_non_invariant_string" +.IX Item "is_utf8_non_invariant_string" +Returns \s-1TRUE\s0 if \*(L"is_utf8_invariant_string\*(R" in perlapi returns \s-1FALSE\s0 for the first +\&\f(CW\*(C`len\*(C'\fR bytes of the string \f(CW\*(C`s\*(C'\fR, but they are, nonetheless, legal Perl-extended +\&\s-1UTF\-8\s0; otherwise returns \s-1FALSE.\s0 +.Sp +A \s-1TRUE\s0 return means that at least one code point represented by the sequence +either is a wide character not representable as a single byte, or the +representation differs depending on whether the sequence is encoded in \s-1UTF\-8\s0 or +not. +.Sp +See also +\&\f(CW\*(C`"is_utf8_invariant_string" in perlapi\*(C'\fR, +\&\f(CW\*(C`"is_utf8_string" in perlapi\*(C'\fR +.Sp +.Vb 2 +\& bool is_utf8_non_invariant_string(const U8* const s, +\& STRLEN len) +.Ve +.IP "report_uninit" 8 +.IX Xref "report_uninit" +.IX Item "report_uninit" +Print appropriate \*(L"Use of uninitialized variable\*(R" warning. +.Sp +.Vb 1 +\& void report_uninit(const SV *uninit_sv) +.Ve +.IP "utf8_to_uvuni_buf" 8 +.IX Xref "utf8_to_uvuni_buf" +.IX Item "utf8_to_uvuni_buf" +\&\s-1DEPRECATED\s0! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code. +.Sp +Only in very rare circumstances should code need to be dealing in Unicode +(as opposed to native) code points. In those few cases, use +\&\f(CW\*(C`NATIVE_TO_UNI(utf8_to_uvchr_buf(...))\*(C'\fR instead. +If you are not absolutely sure this is one of those cases, then assume it isn't +and use plain \f(CW\*(C`utf8_to_uvchr_buf\*(C'\fR instead. +.Sp +Returns the Unicode (not-native) code point of the first character in the +string \f(CW\*(C`s\*(C'\fR which +is assumed to be in \s-1UTF\-8\s0 encoding; \f(CW\*(C`send\*(C'\fR points to 1 beyond the end of \f(CW\*(C`s\*(C'\fR. +\&\f(CW\*(C`retlen\*(C'\fR will be set to the length, in bytes, of that character. +.Sp +If \f(CW\*(C`s\*(C'\fR does not point to a well-formed \s-1UTF\-8\s0 character and \s-1UTF8\s0 warnings are +enabled, zero is returned and \f(CW*retlen\fR is set (if \f(CW\*(C`retlen\*(C'\fR isn't +\&\s-1NULL\s0) to \-1. If those warnings are off, the computed value if well-defined (or +the Unicode \s-1REPLACEMENT CHARACTER,\s0 if not) is silently returned, and \f(CW*retlen\fR +is set (if \f(CW\*(C`retlen\*(C'\fR isn't \s-1NULL\s0) so that (\f(CW\*(C`s\*(C'\fR\ +\ \f(CW*retlen\fR) is the +next possible position in \f(CW\*(C`s\*(C'\fR that could begin a non-malformed character. +See \*(L"utf8n_to_uvchr\*(R" in perlapi for details on when the \s-1REPLACEMENT CHARACTER\s0 is +returned. +.Sp +.Vb 2 +\& UV utf8_to_uvuni_buf(const U8 *s, const U8 *send, +\& STRLEN *retlen) +.Ve +.IP "uvoffuni_to_utf8_flags" 8 +.IX Xref "uvoffuni_to_utf8_flags" +.IX Item "uvoffuni_to_utf8_flags" +\&\s-1THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES.\s0 +Instead, \fBAlmost all code should use \*(L"uvchr_to_utf8\*(R" in perlapi or +\&\*(L"uvchr_to_utf8_flags\*(R" in perlapi\fR. +.Sp +This function is like them, but the input is a strict Unicode +(as opposed to native) code point. Only in very rare circumstances should code +not be using the native code point. +.Sp +For details, see the description for \*(L"uvchr_to_utf8_flags\*(R" in perlapi. +.Sp +.Vb 2 +\& U8* uvoffuni_to_utf8_flags(U8 *d, UV uv, +\& const UV flags) +.Ve +.IP "valid_utf8_to_uvchr" 8 +.IX Xref "valid_utf8_to_uvchr" +.IX Item "valid_utf8_to_uvchr" +Like \f(CW\*(C`"utf8_to_uvchr_buf" in perlapi\*(C'\fR, but should only be called when it is +known that the next character in the input \s-1UTF\-8\s0 string \f(CW\*(C`s\*(C'\fR is well-formed +(\fIe.g.\fR, it passes \f(CW\*(C`"isUTF8_CHAR" in perlapi\*(C'\fR. Surrogates, non-character code +points, and non-Unicode code points are allowed. +.Sp +.Vb 1 +\& UV valid_utf8_to_uvchr(const U8 *s, STRLEN *retlen) +.Ve +.IP "variant_under_utf8_count" 8 +.IX Xref "variant_under_utf8_count" +.IX Item "variant_under_utf8_count" +This function looks at the sequence of bytes between \f(CW\*(C`s\*(C'\fR and \f(CW\*(C`e\*(C'\fR, which are +assumed to be encoded in ASCII/Latin1, and returns how many of them would +change should the string be translated into \s-1UTF\-8.\s0 Due to the nature of \s-1UTF\-8,\s0 +each of these would occupy two bytes instead of the single one in the input +string. Thus, this function returns the precise number of bytes the string +would expand by when translated to \s-1UTF\-8.\s0 +.Sp +Unlike most of the other functions that have \f(CW\*(C`utf8\*(C'\fR in their name, the input +to this function is \s-1NOT\s0 a UTF\-8\-encoded string. The function name is slightly +\&\fIodd\fR to emphasize this. +.Sp +This function is internal to Perl because khw thinks that any \s-1XS\s0 code that +would want this is probably operating too close to the internals. Presenting a +valid use case could change that. +.Sp +See also +\&\f(CW\*(C`"is_utf8_invariant_string" in perlapi\*(C'\fR +and +\&\f(CW\*(C`"is_utf8_invariant_string_loc" in perlapi\*(C'\fR, +.Sp +.Vb 2 +\& Size_t variant_under_utf8_count(const U8* const s, +\& const U8* const e) +.Ve +.SH "Undocumented functions" +.IX Header "Undocumented functions" +The following functions are currently undocumented. If you use one of +them, you may wish to consider creating and submitting documentation for +it. +.IP "\s-1ASCII_TO_NEED\s0" 4 +.IX Xref "ASCII_TO_NEED" +.IX Item "ASCII_TO_NEED" +.PD 0 +.IP "\s-1NATIVE_TO_NEED\s0" 4 +.IX Xref "NATIVE_TO_NEED" +.IX Item "NATIVE_TO_NEED" +.IP "\s-1POPMARK\s0" 4 +.IX Xref "POPMARK" +.IX Item "POPMARK" +.IP "PadnameIN_SCOPE" 4 +.IX Xref "PadnameIN_SCOPE" +.IX Item "PadnameIN_SCOPE" +.IP "PerlIO_restore_errno" 4 +.IX Xref "PerlIO_restore_errno" +.IX Item "PerlIO_restore_errno" +.IP "PerlIO_save_errno" 4 +.IX Xref "PerlIO_save_errno" +.IX Item "PerlIO_save_errno" +.IP "PerlLIO_dup2_cloexec" 4 +.IX Xref "PerlLIO_dup2_cloexec" +.IX Item "PerlLIO_dup2_cloexec" +.IP "PerlLIO_dup_cloexec" 4 +.IX Xref "PerlLIO_dup_cloexec" +.IX Item "PerlLIO_dup_cloexec" +.IP "PerlLIO_open3_cloexec" 4 +.IX Xref "PerlLIO_open3_cloexec" +.IX Item "PerlLIO_open3_cloexec" +.IP "PerlLIO_open_cloexec" 4 +.IX Xref "PerlLIO_open_cloexec" +.IX Item "PerlLIO_open_cloexec" +.IP "PerlProc_pipe_cloexec" 4 +.IX Xref "PerlProc_pipe_cloexec" +.IX Item "PerlProc_pipe_cloexec" +.IP "PerlSock_accept_cloexec" 4 +.IX Xref "PerlSock_accept_cloexec" +.IX Item "PerlSock_accept_cloexec" +.IP "PerlSock_socket_cloexec" 4 +.IX Xref "PerlSock_socket_cloexec" +.IX Item "PerlSock_socket_cloexec" +.IP "PerlSock_socketpair_cloexec" 4 +.IX Xref "PerlSock_socketpair_cloexec" +.IX Item "PerlSock_socketpair_cloexec" +.IP "ReANY" 4 +.IX Xref "ReANY" +.IX Item "ReANY" +.IP "Slab_Alloc" 4 +.IX Xref "Slab_Alloc" +.IX Item "Slab_Alloc" +.IP "Slab_Free" 4 +.IX Xref "Slab_Free" +.IX Item "Slab_Free" +.IP "Slab_to_ro" 4 +.IX Xref "Slab_to_ro" +.IX Item "Slab_to_ro" +.IP "Slab_to_rw" 4 +.IX Xref "Slab_to_rw" +.IX Item "Slab_to_rw" +.IP "\s-1TOPMARK\s0" 4 +.IX Xref "TOPMARK" +.IX Item "TOPMARK" +.IP "_add_range_to_invlist" 4 +.IX Xref "_add_range_to_invlist" +.IX Item "_add_range_to_invlist" +.IP "_byte_dump_string" 4 +.IX Xref "_byte_dump_string" +.IX Item "_byte_dump_string" +.IP "_force_out_malformed_utf8_message" 4 +.IX Xref "_force_out_malformed_utf8_message" +.IX Item "_force_out_malformed_utf8_message" +.IP "_inverse_folds" 4 +.IX Xref "_inverse_folds" +.IX Item "_inverse_folds" +.IP "_invlistEQ" 4 +.IX Xref "_invlistEQ" +.IX Item "_invlistEQ" +.IP "_invlist_array_init" 4 +.IX Xref "_invlist_array_init" +.IX Item "_invlist_array_init" +.IP "_invlist_contains_cp" 4 +.IX Xref "_invlist_contains_cp" +.IX Item "_invlist_contains_cp" +.IP "_invlist_dump" 4 +.IX Xref "_invlist_dump" +.IX Item "_invlist_dump" +.IP "_invlist_intersection" 4 +.IX Xref "_invlist_intersection" +.IX Item "_invlist_intersection" +.IP "_invlist_intersection_maybe_complement_2nd" 4 +.IX Xref "_invlist_intersection_maybe_complement_2nd" +.IX Item "_invlist_intersection_maybe_complement_2nd" +.IP "_invlist_invert" 4 +.IX Xref "_invlist_invert" +.IX Item "_invlist_invert" +.IP "_invlist_len" 4 +.IX Xref "_invlist_len" +.IX Item "_invlist_len" +.IP "_invlist_search" 4 +.IX Xref "_invlist_search" +.IX Item "_invlist_search" +.IP "_invlist_subtract" 4 +.IX Xref "_invlist_subtract" +.IX Item "_invlist_subtract" +.IP "_invlist_union" 4 +.IX Xref "_invlist_union" +.IX Item "_invlist_union" +.IP "_invlist_union_maybe_complement_2nd" 4 +.IX Xref "_invlist_union_maybe_complement_2nd" +.IX Item "_invlist_union_maybe_complement_2nd" +.IP "_is_cur_LC_category_utf8" 4 +.IX Xref "_is_cur_LC_category_utf8" +.IX Item "_is_cur_LC_category_utf8" +.IP "_is_in_locale_category" 4 +.IX Xref "_is_in_locale_category" +.IX Item "_is_in_locale_category" +.IP "_is_uni_FOO" 4 +.IX Xref "_is_uni_FOO" +.IX Item "_is_uni_FOO" +.IP "_is_uni_perl_idcont" 4 +.IX Xref "_is_uni_perl_idcont" +.IX Item "_is_uni_perl_idcont" +.IP "_is_uni_perl_idstart" 4 +.IX Xref "_is_uni_perl_idstart" +.IX Item "_is_uni_perl_idstart" +.IP "_is_utf8_FOO" 4 +.IX Xref "_is_utf8_FOO" +.IX Item "_is_utf8_FOO" +.IP "_is_utf8_perl_idcont" 4 +.IX Xref "_is_utf8_perl_idcont" +.IX Item "_is_utf8_perl_idcont" +.IP "_is_utf8_perl_idstart" 4 +.IX Xref "_is_utf8_perl_idstart" +.IX Item "_is_utf8_perl_idstart" +.IP "_mem_collxfrm" 4 +.IX Xref "_mem_collxfrm" +.IX Item "_mem_collxfrm" +.IP "_new_invlist" 4 +.IX Xref "_new_invlist" +.IX Item "_new_invlist" +.IP "_new_invlist_C_array" 4 +.IX Xref "_new_invlist_C_array" +.IX Item "_new_invlist_C_array" +.IP "_setup_canned_invlist" 4 +.IX Xref "_setup_canned_invlist" +.IX Item "_setup_canned_invlist" +.IP "_to_fold_latin1" 4 +.IX Xref "_to_fold_latin1" +.IX Item "_to_fold_latin1" +.IP "_to_uni_fold_flags" 4 +.IX Xref "_to_uni_fold_flags" +.IX Item "_to_uni_fold_flags" +.IP "_to_upper_title_latin1" 4 +.IX Xref "_to_upper_title_latin1" +.IX Item "_to_upper_title_latin1" +.IP "_to_utf8_fold_flags" 4 +.IX Xref "_to_utf8_fold_flags" +.IX Item "_to_utf8_fold_flags" +.IP "_to_utf8_lower_flags" 4 +.IX Xref "_to_utf8_lower_flags" +.IX Item "_to_utf8_lower_flags" +.IP "_to_utf8_title_flags" 4 +.IX Xref "_to_utf8_title_flags" +.IX Item "_to_utf8_title_flags" +.IP "_to_utf8_upper_flags" 4 +.IX Xref "_to_utf8_upper_flags" +.IX Item "_to_utf8_upper_flags" +.IP "_utf8n_to_uvchr_msgs_helper" 4 +.IX Xref "_utf8n_to_uvchr_msgs_helper" +.IX Item "_utf8n_to_uvchr_msgs_helper" +.IP "_warn_problematic_locale" 4 +.IX Xref "_warn_problematic_locale" +.IX Item "_warn_problematic_locale" +.IP "abort_execution" 4 +.IX Xref "abort_execution" +.IX Item "abort_execution" +.IP "add_cp_to_invlist" 4 +.IX Xref "add_cp_to_invlist" +.IX Item "add_cp_to_invlist" +.IP "alloc_LOGOP" 4 +.IX Xref "alloc_LOGOP" +.IX Item "alloc_LOGOP" +.IP "allocmy" 4 +.IX Xref "allocmy" +.IX Item "allocmy" +.IP "amagic_cmp" 4 +.IX Xref "amagic_cmp" +.IX Item "amagic_cmp" +.IP "amagic_cmp_desc" 4 +.IX Xref "amagic_cmp_desc" +.IX Item "amagic_cmp_desc" +.IP "amagic_cmp_locale" 4 +.IX Xref "amagic_cmp_locale" +.IX Item "amagic_cmp_locale" +.IP "amagic_cmp_locale_desc" 4 +.IX Xref "amagic_cmp_locale_desc" +.IX Item "amagic_cmp_locale_desc" +.IP "amagic_i_ncmp" 4 +.IX Xref "amagic_i_ncmp" +.IX Item "amagic_i_ncmp" +.IP "amagic_i_ncmp_desc" 4 +.IX Xref "amagic_i_ncmp_desc" +.IX Item "amagic_i_ncmp_desc" +.IP "amagic_is_enabled" 4 +.IX Xref "amagic_is_enabled" +.IX Item "amagic_is_enabled" +.IP "amagic_ncmp" 4 +.IX Xref "amagic_ncmp" +.IX Item "amagic_ncmp" +.IP "amagic_ncmp_desc" 4 +.IX Xref "amagic_ncmp_desc" +.IX Item "amagic_ncmp_desc" +.IP "append_utf8_from_native_byte" 4 +.IX Xref "append_utf8_from_native_byte" +.IX Item "append_utf8_from_native_byte" +.IP "apply" 4 +.IX Xref "apply" +.IX Item "apply" +.IP "av_extend_guts" 4 +.IX Xref "av_extend_guts" +.IX Item "av_extend_guts" +.IP "av_nonelem" 4 +.IX Xref "av_nonelem" +.IX Item "av_nonelem" +.IP "av_reify" 4 +.IX Xref "av_reify" +.IX Item "av_reify" +.IP "bind_match" 4 +.IX Xref "bind_match" +.IX Item "bind_match" +.IP "boot_core_PerlIO" 4 +.IX Xref "boot_core_PerlIO" +.IX Item "boot_core_PerlIO" +.IP "boot_core_UNIVERSAL" 4 +.IX Xref "boot_core_UNIVERSAL" +.IX Item "boot_core_UNIVERSAL" +.IP "boot_core_mro" 4 +.IX Xref "boot_core_mro" +.IX Item "boot_core_mro" +.IP "cando" 4 +.IX Xref "cando" +.IX Item "cando" +.IP "check_utf8_print" 4 +.IX Xref "check_utf8_print" +.IX Item "check_utf8_print" +.IP "ck_anoncode" 4 +.IX Xref "ck_anoncode" +.IX Item "ck_anoncode" +.IP "ck_backtick" 4 +.IX Xref "ck_backtick" +.IX Item "ck_backtick" +.IP "ck_bitop" 4 +.IX Xref "ck_bitop" +.IX Item "ck_bitop" +.IP "ck_cmp" 4 +.IX Xref "ck_cmp" +.IX Item "ck_cmp" +.IP "ck_concat" 4 +.IX Xref "ck_concat" +.IX Item "ck_concat" +.IP "ck_defined" 4 +.IX Xref "ck_defined" +.IX Item "ck_defined" +.IP "ck_delete" 4 +.IX Xref "ck_delete" +.IX Item "ck_delete" +.IP "ck_each" 4 +.IX Xref "ck_each" +.IX Item "ck_each" +.IP "ck_entersub_args_core" 4 +.IX Xref "ck_entersub_args_core" +.IX Item "ck_entersub_args_core" +.IP "ck_eof" 4 +.IX Xref "ck_eof" +.IX Item "ck_eof" +.IP "ck_eval" 4 +.IX Xref "ck_eval" +.IX Item "ck_eval" +.IP "ck_exec" 4 +.IX Xref "ck_exec" +.IX Item "ck_exec" +.IP "ck_exists" 4 +.IX Xref "ck_exists" +.IX Item "ck_exists" +.IP "ck_ftst" 4 +.IX Xref "ck_ftst" +.IX Item "ck_ftst" +.IP "ck_fun" 4 +.IX Xref "ck_fun" +.IX Item "ck_fun" +.IP "ck_glob" 4 +.IX Xref "ck_glob" +.IX Item "ck_glob" +.IP "ck_grep" 4 +.IX Xref "ck_grep" +.IX Item "ck_grep" +.IP "ck_index" 4 +.IX Xref "ck_index" +.IX Item "ck_index" +.IP "ck_isa" 4 +.IX Xref "ck_isa" +.IX Item "ck_isa" +.IP "ck_join" 4 +.IX Xref "ck_join" +.IX Item "ck_join" +.IP "ck_length" 4 +.IX Xref "ck_length" +.IX Item "ck_length" +.IP "ck_lfun" 4 +.IX Xref "ck_lfun" +.IX Item "ck_lfun" +.IP "ck_listiob" 4 +.IX Xref "ck_listiob" +.IX Item "ck_listiob" +.IP "ck_match" 4 +.IX Xref "ck_match" +.IX Item "ck_match" +.IP "ck_method" 4 +.IX Xref "ck_method" +.IX Item "ck_method" +.IP "ck_null" 4 +.IX Xref "ck_null" +.IX Item "ck_null" +.IP "ck_open" 4 +.IX Xref "ck_open" +.IX Item "ck_open" +.IP "ck_prototype" 4 +.IX Xref "ck_prototype" +.IX Item "ck_prototype" +.IP "ck_readline" 4 +.IX Xref "ck_readline" +.IX Item "ck_readline" +.IP "ck_refassign" 4 +.IX Xref "ck_refassign" +.IX Item "ck_refassign" +.IP "ck_repeat" 4 +.IX Xref "ck_repeat" +.IX Item "ck_repeat" +.IP "ck_require" 4 +.IX Xref "ck_require" +.IX Item "ck_require" +.IP "ck_return" 4 +.IX Xref "ck_return" +.IX Item "ck_return" +.IP "ck_rfun" 4 +.IX Xref "ck_rfun" +.IX Item "ck_rfun" +.IP "ck_rvconst" 4 +.IX Xref "ck_rvconst" +.IX Item "ck_rvconst" +.IP "ck_sassign" 4 +.IX Xref "ck_sassign" +.IX Item "ck_sassign" +.IP "ck_select" 4 +.IX Xref "ck_select" +.IX Item "ck_select" +.IP "ck_shift" 4 +.IX Xref "ck_shift" +.IX Item "ck_shift" +.IP "ck_smartmatch" 4 +.IX Xref "ck_smartmatch" +.IX Item "ck_smartmatch" +.IP "ck_sort" 4 +.IX Xref "ck_sort" +.IX Item "ck_sort" +.IP "ck_spair" 4 +.IX Xref "ck_spair" +.IX Item "ck_spair" +.IP "ck_split" 4 +.IX Xref "ck_split" +.IX Item "ck_split" +.IP "ck_stringify" 4 +.IX Xref "ck_stringify" +.IX Item "ck_stringify" +.IP "ck_subr" 4 +.IX Xref "ck_subr" +.IX Item "ck_subr" +.IP "ck_substr" 4 +.IX Xref "ck_substr" +.IX Item "ck_substr" +.IP "ck_svconst" 4 +.IX Xref "ck_svconst" +.IX Item "ck_svconst" +.IP "ck_tell" 4 +.IX Xref "ck_tell" +.IX Item "ck_tell" +.IP "ck_trunc" 4 +.IX Xref "ck_trunc" +.IX Item "ck_trunc" +.IP "closest_cop" 4 +.IX Xref "closest_cop" +.IX Item "closest_cop" +.IP "cmp_desc" 4 +.IX Xref "cmp_desc" +.IX Item "cmp_desc" +.IP "cmp_locale_desc" 4 +.IX Xref "cmp_locale_desc" +.IX Item "cmp_locale_desc" +.IP "cmpchain_extend" 4 +.IX Xref "cmpchain_extend" +.IX Item "cmpchain_extend" +.IP "cmpchain_finish" 4 +.IX Xref "cmpchain_finish" +.IX Item "cmpchain_finish" +.IP "cmpchain_start" 4 +.IX Xref "cmpchain_start" +.IX Item "cmpchain_start" +.IP "cntrl_to_mnemonic" 4 +.IX Xref "cntrl_to_mnemonic" +.IX Item "cntrl_to_mnemonic" +.IP "coresub_op" 4 +.IX Xref "coresub_op" +.IX Item "coresub_op" +.IP "create_eval_scope" 4 +.IX Xref "create_eval_scope" +.IX Item "create_eval_scope" +.IP "croak_caller" 4 +.IX Xref "croak_caller" +.IX Item "croak_caller" +.IP "croak_memory_wrap" 4 +.IX Xref "croak_memory_wrap" +.IX Item "croak_memory_wrap" +.IP "croak_no_mem" 4 +.IX Xref "croak_no_mem" +.IX Item "croak_no_mem" +.IP "croak_popstack" 4 +.IX Xref "croak_popstack" +.IX Item "croak_popstack" +.IP "current_re_engine" 4 +.IX Xref "current_re_engine" +.IX Item "current_re_engine" +.IP "custom_op_get_field" 4 +.IX Xref "custom_op_get_field" +.IX Item "custom_op_get_field" +.IP "cv_ckproto_len_flags" 4 +.IX Xref "cv_ckproto_len_flags" +.IX Item "cv_ckproto_len_flags" +.IP "cv_clone_into" 4 +.IX Xref "cv_clone_into" +.IX Item "cv_clone_into" +.IP "cv_const_sv_or_av" 4 +.IX Xref "cv_const_sv_or_av" +.IX Item "cv_const_sv_or_av" +.IP "cv_undef_flags" 4 +.IX Xref "cv_undef_flags" +.IX Item "cv_undef_flags" +.IP "cvgv_from_hek" 4 +.IX Xref "cvgv_from_hek" +.IX Item "cvgv_from_hek" +.IP "cvgv_set" 4 +.IX Xref "cvgv_set" +.IX Item "cvgv_set" +.IP "cvstash_set" 4 +.IX Xref "cvstash_set" +.IX Item "cvstash_set" +.IP "deb_stack_all" 4 +.IX Xref "deb_stack_all" +.IX Item "deb_stack_all" +.IP "defelem_target" 4 +.IX Xref "defelem_target" +.IX Item "defelem_target" +.IP "delete_eval_scope" 4 +.IX Xref "delete_eval_scope" +.IX Item "delete_eval_scope" +.IP "delimcpy_no_escape" 4 +.IX Xref "delimcpy_no_escape" +.IX Item "delimcpy_no_escape" +.IP "die_unwind" 4 +.IX Xref "die_unwind" +.IX Item "die_unwind" +.IP "do_aexec" 4 +.IX Xref "do_aexec" +.IX Item "do_aexec" +.IP "do_aexec5" 4 +.IX Xref "do_aexec5" +.IX Item "do_aexec5" +.IP "do_eof" 4 +.IX Xref "do_eof" +.IX Item "do_eof" +.IP "do_exec" 4 +.IX Xref "do_exec" +.IX Item "do_exec" +.IP "do_exec3" 4 +.IX Xref "do_exec3" +.IX Item "do_exec3" +.IP "do_ipcctl" 4 +.IX Xref "do_ipcctl" +.IX Item "do_ipcctl" +.IP "do_ipcget" 4 +.IX Xref "do_ipcget" +.IX Item "do_ipcget" +.IP "do_msgrcv" 4 +.IX Xref "do_msgrcv" +.IX Item "do_msgrcv" +.IP "do_msgsnd" 4 +.IX Xref "do_msgsnd" +.IX Item "do_msgsnd" +.IP "do_ncmp" 4 +.IX Xref "do_ncmp" +.IX Item "do_ncmp" +.IP "do_open6" 4 +.IX Xref "do_open6" +.IX Item "do_open6" +.IP "do_open_raw" 4 +.IX Xref "do_open_raw" +.IX Item "do_open_raw" +.IP "do_print" 4 +.IX Xref "do_print" +.IX Item "do_print" +.IP "do_readline" 4 +.IX Xref "do_readline" +.IX Item "do_readline" +.IP "do_seek" 4 +.IX Xref "do_seek" +.IX Item "do_seek" +.IP "do_semop" 4 +.IX Xref "do_semop" +.IX Item "do_semop" +.IP "do_shmio" 4 +.IX Xref "do_shmio" +.IX Item "do_shmio" +.IP "do_sysseek" 4 +.IX Xref "do_sysseek" +.IX Item "do_sysseek" +.IP "do_tell" 4 +.IX Xref "do_tell" +.IX Item "do_tell" +.IP "do_trans" 4 +.IX Xref "do_trans" +.IX Item "do_trans" +.IP "do_uniprop_match" 4 +.IX Xref "do_uniprop_match" +.IX Item "do_uniprop_match" +.IP "do_vecget" 4 +.IX Xref "do_vecget" +.IX Item "do_vecget" +.IP "do_vecset" 4 +.IX Xref "do_vecset" +.IX Item "do_vecset" +.IP "do_vop" 4 +.IX Xref "do_vop" +.IX Item "do_vop" +.IP "does_utf8_overflow" 4 +.IX Xref "does_utf8_overflow" +.IX Item "does_utf8_overflow" +.IP "dofile" 4 +.IX Xref "dofile" +.IX Item "dofile" +.IP "drand48_init_r" 4 +.IX Xref "drand48_init_r" +.IX Item "drand48_init_r" +.IP "drand48_r" 4 +.IX Xref "drand48_r" +.IX Item "drand48_r" +.IP "dtrace_probe_call" 4 +.IX Xref "dtrace_probe_call" +.IX Item "dtrace_probe_call" +.IP "dtrace_probe_load" 4 +.IX Xref "dtrace_probe_load" +.IX Item "dtrace_probe_load" +.IP "dtrace_probe_op" 4 +.IX Xref "dtrace_probe_op" +.IX Item "dtrace_probe_op" +.IP "dtrace_probe_phase" 4 +.IX Xref "dtrace_probe_phase" +.IX Item "dtrace_probe_phase" +.IP "dump_all_perl" 4 +.IX Xref "dump_all_perl" +.IX Item "dump_all_perl" +.IP "dump_packsubs_perl" 4 +.IX Xref "dump_packsubs_perl" +.IX Item "dump_packsubs_perl" +.IP "dump_sub_perl" 4 +.IX Xref "dump_sub_perl" +.IX Item "dump_sub_perl" +.IP "dump_sv_child" 4 +.IX Xref "dump_sv_child" +.IX Item "dump_sv_child" +.IP "dup_warnings" 4 +.IX Xref "dup_warnings" +.IX Item "dup_warnings" +.IP "emulate_cop_io" 4 +.IX Xref "emulate_cop_io" +.IX Item "emulate_cop_io" +.IP "find_first_differing_byte_pos" 4 +.IX Xref "find_first_differing_byte_pos" +.IX Item "find_first_differing_byte_pos" +.IP "find_lexical_cv" 4 +.IX Xref "find_lexical_cv" +.IX Item "find_lexical_cv" +.IP "find_runcv_where" 4 +.IX Xref "find_runcv_where" +.IX Item "find_runcv_where" +.IP "find_script" 4 +.IX Xref "find_script" +.IX Item "find_script" +.IP "foldEQ_latin1_s2_folded" 4 +.IX Xref "foldEQ_latin1_s2_folded" +.IX Item "foldEQ_latin1_s2_folded" +.IP "foldEQ_utf8_flags" 4 +.IX Xref "foldEQ_utf8_flags" +.IX Item "foldEQ_utf8_flags" +.IP "form_alien_digit_msg" 4 +.IX Xref "form_alien_digit_msg" +.IX Item "form_alien_digit_msg" +.IP "form_cp_too_large_msg" 4 +.IX Xref "form_cp_too_large_msg" +.IX Item "form_cp_too_large_msg" +.IP "free_tied_hv_pool" 4 +.IX Xref "free_tied_hv_pool" +.IX Item "free_tied_hv_pool" +.IP "get_and_check_backslash_N_name" 4 +.IX Xref "get_and_check_backslash_N_name" +.IX Item "get_and_check_backslash_N_name" +.IP "get_db_sub" 4 +.IX Xref "get_db_sub" +.IX Item "get_db_sub" +.IP "get_debug_opts" 4 +.IX Xref "get_debug_opts" +.IX Item "get_debug_opts" +.IP "get_deprecated_property_msg" 4 +.IX Xref "get_deprecated_property_msg" +.IX Item "get_deprecated_property_msg" +.IP "get_hash_seed" 4 +.IX Xref "get_hash_seed" +.IX Item "get_hash_seed" +.IP "get_invlist_iter_addr" 4 +.IX Xref "get_invlist_iter_addr" +.IX Item "get_invlist_iter_addr" +.IP "get_invlist_offset_addr" 4 +.IX Xref "get_invlist_offset_addr" +.IX Item "get_invlist_offset_addr" +.IP "get_invlist_previous_index_addr" 4 +.IX Xref "get_invlist_previous_index_addr" +.IX Item "get_invlist_previous_index_addr" +.IP "get_no_modify" 4 +.IX Xref "get_no_modify" +.IX Item "get_no_modify" +.IP "get_opargs" 4 +.IX Xref "get_opargs" +.IX Item "get_opargs" +.IP "get_prop_definition" 4 +.IX Xref "get_prop_definition" +.IX Item "get_prop_definition" +.IP "get_prop_values" 4 +.IX Xref "get_prop_values" +.IX Item "get_prop_values" +.IP "get_re_arg" 4 +.IX Xref "get_re_arg" +.IX Item "get_re_arg" +.IP "get_re_gclass_nonbitmap_data" 4 +.IX Xref "get_re_gclass_nonbitmap_data" +.IX Item "get_re_gclass_nonbitmap_data" +.IP "get_regclass_nonbitmap_data" 4 +.IX Xref "get_regclass_nonbitmap_data" +.IX Item "get_regclass_nonbitmap_data" +.IP "get_regex_charset_name" 4 +.IX Xref "get_regex_charset_name" +.IX Item "get_regex_charset_name" +.IP "getenv_len" 4 +.IX Xref "getenv_len" +.IX Item "getenv_len" +.IP "grok_bin_oct_hex" 4 +.IX Xref "grok_bin_oct_hex" +.IX Item "grok_bin_oct_hex" +.IP "grok_bslash_c" 4 +.IX Xref "grok_bslash_c" +.IX Item "grok_bslash_c" +.IP "grok_bslash_o" 4 +.IX Xref "grok_bslash_o" +.IX Item "grok_bslash_o" +.IP "grok_bslash_x" 4 +.IX Xref "grok_bslash_x" +.IX Item "grok_bslash_x" +.IP "gv_fetchmeth_internal" 4 +.IX Xref "gv_fetchmeth_internal" +.IX Item "gv_fetchmeth_internal" +.IP "gv_override" 4 +.IX Xref "gv_override" +.IX Item "gv_override" +.IP "gv_setref" 4 +.IX Xref "gv_setref" +.IX Item "gv_setref" +.IP "gv_stashpvn_internal" 4 +.IX Xref "gv_stashpvn_internal" +.IX Item "gv_stashpvn_internal" +.IP "gv_stashsvpvn_cached" 4 +.IX Xref "gv_stashsvpvn_cached" +.IX Item "gv_stashsvpvn_cached" +.IP "hfree_next_entry" 4 +.IX Xref "hfree_next_entry" +.IX Item "hfree_next_entry" +.IP "hv_backreferences_p" 4 +.IX Xref "hv_backreferences_p" +.IX Item "hv_backreferences_p" +.IP "hv_kill_backrefs" 4 +.IX Xref "hv_kill_backrefs" +.IX Item "hv_kill_backrefs" +.IP "hv_placeholders_p" 4 +.IX Xref "hv_placeholders_p" +.IX Item "hv_placeholders_p" +.IP "hv_pushkv" 4 +.IX Xref "hv_pushkv" +.IX Item "hv_pushkv" +.IP "hv_undef_flags" 4 +.IX Xref "hv_undef_flags" +.IX Item "hv_undef_flags" +.IP "init_argv_symbols" 4 +.IX Xref "init_argv_symbols" +.IX Item "init_argv_symbols" +.IP "init_constants" 4 +.IX Xref "init_constants" +.IX Item "init_constants" +.IP "init_dbargs" 4 +.IX Xref "init_dbargs" +.IX Item "init_dbargs" +.IP "init_debugger" 4 +.IX Xref "init_debugger" +.IX Item "init_debugger" +.IP "init_i18nl10n" 4 +.IX Xref "init_i18nl10n" +.IX Item "init_i18nl10n" +.IP "init_i18nl14n" 4 +.IX Xref "init_i18nl14n" +.IX Item "init_i18nl14n" +.IP "init_named_cv" 4 +.IX Xref "init_named_cv" +.IX Item "init_named_cv" +.IP "init_uniprops" 4 +.IX Xref "init_uniprops" +.IX Item "init_uniprops" +.IP "invert" 4 +.IX Xref "invert" +.IX Item "invert" +.IP "invlist_array" 4 +.IX Xref "invlist_array" +.IX Item "invlist_array" +.IP "invlist_clear" 4 +.IX Xref "invlist_clear" +.IX Item "invlist_clear" +.IP "invlist_clone" 4 +.IX Xref "invlist_clone" +.IX Item "invlist_clone" +.IP "invlist_contents" 4 +.IX Xref "invlist_contents" +.IX Item "invlist_contents" +.IP "invlist_extend" 4 +.IX Xref "invlist_extend" +.IX Item "invlist_extend" +.IP "invlist_highest" 4 +.IX Xref "invlist_highest" +.IX Item "invlist_highest" +.IP "invlist_is_iterating" 4 +.IX Xref "invlist_is_iterating" +.IX Item "invlist_is_iterating" +.IP "invlist_iterfinish" 4 +.IX Xref "invlist_iterfinish" +.IX Item "invlist_iterfinish" +.IP "invlist_iterinit" 4 +.IX Xref "invlist_iterinit" +.IX Item "invlist_iterinit" +.IP "invlist_iternext" 4 +.IX Xref "invlist_iternext" +.IX Item "invlist_iternext" +.IP "invlist_lowest" 4 +.IX Xref "invlist_lowest" +.IX Item "invlist_lowest" +.IP "invlist_max" 4 +.IX Xref "invlist_max" +.IX Item "invlist_max" +.IP "invlist_previous_index" 4 +.IX Xref "invlist_previous_index" +.IX Item "invlist_previous_index" +.IP "invlist_set_len" 4 +.IX Xref "invlist_set_len" +.IX Item "invlist_set_len" +.IP "invlist_set_previous_index" 4 +.IX Xref "invlist_set_previous_index" +.IX Item "invlist_set_previous_index" +.IP "invlist_trim" 4 +.IX Xref "invlist_trim" +.IX Item "invlist_trim" +.IP "invmap_dump" 4 +.IX Xref "invmap_dump" +.IX Item "invmap_dump" +.IP "io_close" 4 +.IX Xref "io_close" +.IX Item "io_close" +.IP "isFF_OVERLONG" 4 +.IX Xref "isFF_OVERLONG" +.IX Item "isFF_OVERLONG" +.IP "isFOO_lc" 4 +.IX Xref "isFOO_lc" +.IX Item "isFOO_lc" +.IP "is_grapheme" 4 +.IX Xref "is_grapheme" +.IX Item "is_grapheme" +.IP "is_invlist" 4 +.IX Xref "is_invlist" +.IX Item "is_invlist" +.IP "is_utf8_char_helper" 4 +.IX Xref "is_utf8_char_helper" +.IX Item "is_utf8_char_helper" +.IP "is_utf8_common" 4 +.IX Xref "is_utf8_common" +.IX Item "is_utf8_common" +.IP "is_utf8_overlong_given_start_byte_ok" 4 +.IX Xref "is_utf8_overlong_given_start_byte_ok" +.IX Item "is_utf8_overlong_given_start_byte_ok" +.IP "jmaybe" 4 +.IX Xref "jmaybe" +.IX Item "jmaybe" +.IP "keyword" 4 +.IX Xref "keyword" +.IX Item "keyword" +.IP "keyword_plugin_standard" 4 +.IX Xref "keyword_plugin_standard" +.IX Item "keyword_plugin_standard" +.IP "list" 4 +.IX Xref "list" +.IX Item "list" +.IP "load_charnames" 4 +.IX Xref "load_charnames" +.IX Item "load_charnames" +.IP "localize" 4 +.IX Xref "localize" +.IX Item "localize" +.IP "lossless_NV_to_IV" 4 +.IX Xref "lossless_NV_to_IV" +.IX Item "lossless_NV_to_IV" +.IP "magic_clear_all_env" 4 +.IX Xref "magic_clear_all_env" +.IX Item "magic_clear_all_env" +.IP "magic_cleararylen_p" 4 +.IX Xref "magic_cleararylen_p" +.IX Item "magic_cleararylen_p" +.IP "magic_clearenv" 4 +.IX Xref "magic_clearenv" +.IX Item "magic_clearenv" +.IP "magic_clearisa" 4 +.IX Xref "magic_clearisa" +.IX Item "magic_clearisa" +.IP "magic_clearpack" 4 +.IX Xref "magic_clearpack" +.IX Item "magic_clearpack" +.IP "magic_clearsig" 4 +.IX Xref "magic_clearsig" +.IX Item "magic_clearsig" +.IP "magic_copycallchecker" 4 +.IX Xref "magic_copycallchecker" +.IX Item "magic_copycallchecker" +.IP "magic_existspack" 4 +.IX Xref "magic_existspack" +.IX Item "magic_existspack" +.IP "magic_freearylen_p" 4 +.IX Xref "magic_freearylen_p" +.IX Item "magic_freearylen_p" +.IP "magic_freeovrld" 4 +.IX Xref "magic_freeovrld" +.IX Item "magic_freeovrld" +.IP "magic_get" 4 +.IX Xref "magic_get" +.IX Item "magic_get" +.IP "magic_getarylen" 4 +.IX Xref "magic_getarylen" +.IX Item "magic_getarylen" +.IP "magic_getdebugvar" 4 +.IX Xref "magic_getdebugvar" +.IX Item "magic_getdebugvar" +.IP "magic_getdefelem" 4 +.IX Xref "magic_getdefelem" +.IX Item "magic_getdefelem" +.IP "magic_getnkeys" 4 +.IX Xref "magic_getnkeys" +.IX Item "magic_getnkeys" +.IP "magic_getpack" 4 +.IX Xref "magic_getpack" +.IX Item "magic_getpack" +.IP "magic_getpos" 4 +.IX Xref "magic_getpos" +.IX Item "magic_getpos" +.IP "magic_getsig" 4 +.IX Xref "magic_getsig" +.IX Item "magic_getsig" +.IP "magic_getsubstr" 4 +.IX Xref "magic_getsubstr" +.IX Item "magic_getsubstr" +.IP "magic_gettaint" 4 +.IX Xref "magic_gettaint" +.IX Item "magic_gettaint" +.IP "magic_getuvar" 4 +.IX Xref "magic_getuvar" +.IX Item "magic_getuvar" +.IP "magic_getvec" 4 +.IX Xref "magic_getvec" +.IX Item "magic_getvec" +.IP "magic_killbackrefs" 4 +.IX Xref "magic_killbackrefs" +.IX Item "magic_killbackrefs" +.IP "magic_nextpack" 4 +.IX Xref "magic_nextpack" +.IX Item "magic_nextpack" +.IP "magic_regdata_cnt" 4 +.IX Xref "magic_regdata_cnt" +.IX Item "magic_regdata_cnt" +.IP "magic_regdatum_get" 4 +.IX Xref "magic_regdatum_get" +.IX Item "magic_regdatum_get" +.IP "magic_regdatum_set" 4 +.IX Xref "magic_regdatum_set" +.IX Item "magic_regdatum_set" +.IP "magic_scalarpack" 4 +.IX Xref "magic_scalarpack" +.IX Item "magic_scalarpack" +.IP "magic_set" 4 +.IX Xref "magic_set" +.IX Item "magic_set" +.IP "magic_set_all_env" 4 +.IX Xref "magic_set_all_env" +.IX Item "magic_set_all_env" +.IP "magic_setarylen" 4 +.IX Xref "magic_setarylen" +.IX Item "magic_setarylen" +.IP "magic_setcollxfrm" 4 +.IX Xref "magic_setcollxfrm" +.IX Item "magic_setcollxfrm" +.IP "magic_setdbline" 4 +.IX Xref "magic_setdbline" +.IX Item "magic_setdbline" +.IP "magic_setdebugvar" 4 +.IX Xref "magic_setdebugvar" +.IX Item "magic_setdebugvar" +.IP "magic_setdefelem" 4 +.IX Xref "magic_setdefelem" +.IX Item "magic_setdefelem" +.IP "magic_setenv" 4 +.IX Xref "magic_setenv" +.IX Item "magic_setenv" +.IP "magic_setisa" 4 +.IX Xref "magic_setisa" +.IX Item "magic_setisa" +.IP "magic_setlvref" 4 +.IX Xref "magic_setlvref" +.IX Item "magic_setlvref" +.IP "magic_setmglob" 4 +.IX Xref "magic_setmglob" +.IX Item "magic_setmglob" +.IP "magic_setnkeys" 4 +.IX Xref "magic_setnkeys" +.IX Item "magic_setnkeys" +.IP "magic_setnonelem" 4 +.IX Xref "magic_setnonelem" +.IX Item "magic_setnonelem" +.IP "magic_setpack" 4 +.IX Xref "magic_setpack" +.IX Item "magic_setpack" +.IP "magic_setpos" 4 +.IX Xref "magic_setpos" +.IX Item "magic_setpos" +.IP "magic_setregexp" 4 +.IX Xref "magic_setregexp" +.IX Item "magic_setregexp" +.IP "magic_setsig" 4 +.IX Xref "magic_setsig" +.IX Item "magic_setsig" +.IP "magic_setsubstr" 4 +.IX Xref "magic_setsubstr" +.IX Item "magic_setsubstr" +.IP "magic_settaint" 4 +.IX Xref "magic_settaint" +.IX Item "magic_settaint" +.IP "magic_setutf8" 4 +.IX Xref "magic_setutf8" +.IX Item "magic_setutf8" +.IP "magic_setuvar" 4 +.IX Xref "magic_setuvar" +.IX Item "magic_setuvar" +.IP "magic_setvec" 4 +.IX Xref "magic_setvec" +.IX Item "magic_setvec" +.IP "magic_sizepack" 4 +.IX Xref "magic_sizepack" +.IX Item "magic_sizepack" +.IP "magic_wipepack" 4 +.IX Xref "magic_wipepack" +.IX Item "magic_wipepack" +.IP "malloc_good_size" 4 +.IX Xref "malloc_good_size" +.IX Item "malloc_good_size" +.IP "malloced_size" 4 +.IX Xref "malloced_size" +.IX Item "malloced_size" +.IP "mem_collxfrm" 4 +.IX Xref "mem_collxfrm" +.IX Item "mem_collxfrm" +.IP "mem_log_alloc" 4 +.IX Xref "mem_log_alloc" +.IX Item "mem_log_alloc" +.IP "mem_log_free" 4 +.IX Xref "mem_log_free" +.IX Item "mem_log_free" +.IP "mem_log_realloc" 4 +.IX Xref "mem_log_realloc" +.IX Item "mem_log_realloc" +.IP "mg_find_mglob" 4 +.IX Xref "mg_find_mglob" +.IX Item "mg_find_mglob" +.IP "mode_from_discipline" 4 +.IX Xref "mode_from_discipline" +.IX Item "mode_from_discipline" +.IP "more_bodies" 4 +.IX Xref "more_bodies" +.IX Item "more_bodies" +.IP "mortal_getenv" 4 +.IX Xref "mortal_getenv" +.IX Item "mortal_getenv" +.IP "mro_meta_dup" 4 +.IX Xref "mro_meta_dup" +.IX Item "mro_meta_dup" +.IP "mro_meta_init" 4 +.IX Xref "mro_meta_init" +.IX Item "mro_meta_init" +.IP "multiconcat_stringify" 4 +.IX Xref "multiconcat_stringify" +.IX Item "multiconcat_stringify" +.IP "multideref_stringify" 4 +.IX Xref "multideref_stringify" +.IX Item "multideref_stringify" +.IP "my_atof2" 4 +.IX Xref "my_atof2" +.IX Item "my_atof2" +.IP "my_atof3" 4 +.IX Xref "my_atof3" +.IX Item "my_atof3" +.IP "my_attrs" 4 +.IX Xref "my_attrs" +.IX Item "my_attrs" +.IP "my_clearenv" 4 +.IX Xref "my_clearenv" +.IX Item "my_clearenv" +.IP "my_lstat_flags" 4 +.IX Xref "my_lstat_flags" +.IX Item "my_lstat_flags" +.IP "my_memrchr" 4 +.IX Xref "my_memrchr" +.IX Item "my_memrchr" +.IP "my_mkostemp" 4 +.IX Xref "my_mkostemp" +.IX Item "my_mkostemp" +.IP "my_mkostemp_cloexec" 4 +.IX Xref "my_mkostemp_cloexec" +.IX Item "my_mkostemp_cloexec" +.IP "my_mkstemp" 4 +.IX Xref "my_mkstemp" +.IX Item "my_mkstemp" +.IP "my_mkstemp_cloexec" 4 +.IX Xref "my_mkstemp_cloexec" +.IX Item "my_mkstemp_cloexec" +.IP "my_stat_flags" 4 +.IX Xref "my_stat_flags" +.IX Item "my_stat_flags" +.IP "my_strerror" 4 +.IX Xref "my_strerror" +.IX Item "my_strerror" +.IP "my_unexec" 4 +.IX Xref "my_unexec" +.IX Item "my_unexec" +.IP "newGP" 4 +.IX Xref "newGP" +.IX Item "newGP" +.IP "newMETHOP_internal" 4 +.IX Xref "newMETHOP_internal" +.IX Item "newMETHOP_internal" +.IP "newSTUB" 4 +.IX Xref "newSTUB" +.IX Item "newSTUB" +.IP "newSVavdefelem" 4 +.IX Xref "newSVavdefelem" +.IX Item "newSVavdefelem" +.IP "newXS_deffile" 4 +.IX Xref "newXS_deffile" +.IX Item "newXS_deffile" +.IP "new_warnings_bitfield" 4 +.IX Xref "new_warnings_bitfield" +.IX Item "new_warnings_bitfield" +.IP "nextargv" 4 +.IX Xref "nextargv" +.IX Item "nextargv" +.IP "noperl_die" 4 +.IX Xref "noperl_die" +.IX Item "noperl_die" +.IP "notify_parser_that_changed_to_utf8" 4 +.IX Xref "notify_parser_that_changed_to_utf8" +.IX Item "notify_parser_that_changed_to_utf8" +.IP "oopsAV" 4 +.IX Xref "oopsAV" +.IX Item "oopsAV" +.IP "oopsHV" 4 +.IX Xref "oopsHV" +.IX Item "oopsHV" +.IP "op_clear" 4 +.IX Xref "op_clear" +.IX Item "op_clear" +.IP "op_integerize" 4 +.IX Xref "op_integerize" +.IX Item "op_integerize" +.IP "op_lvalue_flags" 4 +.IX Xref "op_lvalue_flags" +.IX Item "op_lvalue_flags" +.IP "op_refcnt_dec" 4 +.IX Xref "op_refcnt_dec" +.IX Item "op_refcnt_dec" +.IP "op_refcnt_inc" 4 +.IX Xref "op_refcnt_inc" +.IX Item "op_refcnt_inc" +.IP "op_relocate_sv" 4 +.IX Xref "op_relocate_sv" +.IX Item "op_relocate_sv" +.IP "op_std_init" 4 +.IX Xref "op_std_init" +.IX Item "op_std_init" +.IP "op_unscope" 4 +.IX Xref "op_unscope" +.IX Item "op_unscope" +.IP "opmethod_stash" 4 +.IX Xref "opmethod_stash" +.IX Item "opmethod_stash" +.IP "opslab_force_free" 4 +.IX Xref "opslab_force_free" +.IX Item "opslab_force_free" +.IP "opslab_free" 4 +.IX Xref "opslab_free" +.IX Item "opslab_free" +.IP "opslab_free_nopad" 4 +.IX Xref "opslab_free_nopad" +.IX Item "opslab_free_nopad" +.IP "package" 4 +.IX Xref "package" +.IX Item "package" +.IP "package_version" 4 +.IX Xref "package_version" +.IX Item "package_version" +.IP "pad_add_weakref" 4 +.IX Xref "pad_add_weakref" +.IX Item "pad_add_weakref" +.IP "padlist_store" 4 +.IX Xref "padlist_store" +.IX Item "padlist_store" +.IP "padname_free" 4 +.IX Xref "padname_free" +.IX Item "padname_free" +.IP "padnamelist_free" 4 +.IX Xref "padnamelist_free" +.IX Item "padnamelist_free" +.IP "parse_unicode_opts" 4 +.IX Xref "parse_unicode_opts" +.IX Item "parse_unicode_opts" +.IP "parser_free" 4 +.IX Xref "parser_free" +.IX Item "parser_free" +.IP "parser_free_nexttoke_ops" 4 +.IX Xref "parser_free_nexttoke_ops" +.IX Item "parser_free_nexttoke_ops" +.IP "path_is_searchable" 4 +.IX Xref "path_is_searchable" +.IX Item "path_is_searchable" +.IP "peep" 4 +.IX Xref "peep" +.IX Item "peep" +.IP "pmruntime" 4 +.IX Xref "pmruntime" +.IX Item "pmruntime" +.IP "populate_isa" 4 +.IX Xref "populate_isa" +.IX Item "populate_isa" +.IP "ptr_hash" 4 +.IX Xref "ptr_hash" +.IX Item "ptr_hash" +.IP "qerror" 4 +.IX Xref "qerror" +.IX Item "qerror" +.IP "re_exec_indentf" 4 +.IX Xref "re_exec_indentf" +.IX Item "re_exec_indentf" +.IP "re_indentf" 4 +.IX Xref "re_indentf" +.IX Item "re_indentf" +.IP "re_intuit_start" 4 +.IX Xref "re_intuit_start" +.IX Item "re_intuit_start" +.IP "re_intuit_string" 4 +.IX Xref "re_intuit_string" +.IX Item "re_intuit_string" +.IP "re_op_compile" 4 +.IX Xref "re_op_compile" +.IX Item "re_op_compile" +.IP "re_printf" 4 +.IX Xref "re_printf" +.IX Item "re_printf" +.IP "reg_named_buff" 4 +.IX Xref "reg_named_buff" +.IX Item "reg_named_buff" +.IP "reg_named_buff_iter" 4 +.IX Xref "reg_named_buff_iter" +.IX Item "reg_named_buff_iter" +.IP "reg_numbered_buff_fetch" 4 +.IX Xref "reg_numbered_buff_fetch" +.IX Item "reg_numbered_buff_fetch" +.IP "reg_numbered_buff_length" 4 +.IX Xref "reg_numbered_buff_length" +.IX Item "reg_numbered_buff_length" +.IP "reg_numbered_buff_store" 4 +.IX Xref "reg_numbered_buff_store" +.IX Item "reg_numbered_buff_store" +.IP "reg_qr_package" 4 +.IX Xref "reg_qr_package" +.IX Item "reg_qr_package" +.IP "reg_skipcomment" 4 +.IX Xref "reg_skipcomment" +.IX Item "reg_skipcomment" +.IP "reg_temp_copy" 4 +.IX Xref "reg_temp_copy" +.IX Item "reg_temp_copy" +.IP "regcurly" 4 +.IX Xref "regcurly" +.IX Item "regcurly" +.IP "regprop" 4 +.IX Xref "regprop" +.IX Item "regprop" +.IP "report_evil_fh" 4 +.IX Xref "report_evil_fh" +.IX Item "report_evil_fh" +.IP "report_redefined_cv" 4 +.IX Xref "report_redefined_cv" +.IX Item "report_redefined_cv" +.IP "report_wrongway_fh" 4 +.IX Xref "report_wrongway_fh" +.IX Item "report_wrongway_fh" +.IP "rpeep" 4 +.IX Xref "rpeep" +.IX Item "rpeep" +.IP "rsignal_restore" 4 +.IX Xref "rsignal_restore" +.IX Item "rsignal_restore" +.IP "rsignal_save" 4 +.IX Xref "rsignal_save" +.IX Item "rsignal_save" +.IP "rxres_save" 4 +.IX Xref "rxres_save" +.IX Item "rxres_save" +.IP "same_dirent" 4 +.IX Xref "same_dirent" +.IX Item "same_dirent" +.IP "save_strlen" 4 +.IX Xref "save_strlen" +.IX Item "save_strlen" +.IP "save_to_buffer" 4 +.IX Xref "save_to_buffer" +.IX Item "save_to_buffer" +.IP "sawparens" 4 +.IX Xref "sawparens" +.IX Item "sawparens" +.IP "scalar" 4 +.IX Xref "scalar" +.IX Item "scalar" +.IP "scalarvoid" 4 +.IX Xref "scalarvoid" +.IX Item "scalarvoid" +.IP "scan_str" 4 +.IX Xref "scan_str" +.IX Item "scan_str" +.IP "scan_word" 4 +.IX Xref "scan_word" +.IX Item "scan_word" +.IP "set_caret_X" 4 +.IX Xref "set_caret_X" +.IX Item "set_caret_X" +.IP "set_numeric_standard" 4 +.IX Xref "set_numeric_standard" +.IX Item "set_numeric_standard" +.IP "set_numeric_underlying" 4 +.IX Xref "set_numeric_underlying" +.IX Item "set_numeric_underlying" +.IP "set_padlist" 4 +.IX Xref "set_padlist" +.IX Item "set_padlist" +.IP "setfd_cloexec" 4 +.IX Xref "setfd_cloexec" +.IX Item "setfd_cloexec" +.IP "setfd_cloexec_for_nonsysfd" 4 +.IX Xref "setfd_cloexec_for_nonsysfd" +.IX Item "setfd_cloexec_for_nonsysfd" +.IP "setfd_cloexec_or_inhexec_by_sysfdness" 4 +.IX Xref "setfd_cloexec_or_inhexec_by_sysfdness" +.IX Item "setfd_cloexec_or_inhexec_by_sysfdness" +.IP "setfd_inhexec" 4 +.IX Xref "setfd_inhexec" +.IX Item "setfd_inhexec" +.IP "setfd_inhexec_for_sysfd" 4 +.IX Xref "setfd_inhexec_for_sysfd" +.IX Item "setfd_inhexec_for_sysfd" +.IP "should_warn_nl" 4 +.IX Xref "should_warn_nl" +.IX Item "should_warn_nl" +.IP "should_we_output_Debug_r" 4 +.IX Xref "should_we_output_Debug_r" +.IX Item "should_we_output_Debug_r" +.IP "sighandler" 4 +.IX Xref "sighandler" +.IX Item "sighandler" +.IP "sighandler1" 4 +.IX Xref "sighandler1" +.IX Item "sighandler1" +.IP "sighandler3" 4 +.IX Xref "sighandler3" +.IX Item "sighandler3" +.IP "skipspace_flags" 4 +.IX Xref "skipspace_flags" +.IX Item "skipspace_flags" +.IP "softref2xv" 4 +.IX Xref "softref2xv" +.IX Item "softref2xv" +.IP "sortsv_flags_impl" 4 +.IX Xref "sortsv_flags_impl" +.IX Item "sortsv_flags_impl" +.IP "sub_crush_depth" 4 +.IX Xref "sub_crush_depth" +.IX Item "sub_crush_depth" +.IP "sv_add_backref" 4 +.IX Xref "sv_add_backref" +.IX Item "sv_add_backref" +.IP "sv_buf_to_ro" 4 +.IX Xref "sv_buf_to_ro" +.IX Item "sv_buf_to_ro" +.IP "sv_del_backref" 4 +.IX Xref "sv_del_backref" +.IX Item "sv_del_backref" +.IP "sv_free2" 4 +.IX Xref "sv_free2" +.IX Item "sv_free2" +.IP "sv_i_ncmp" 4 +.IX Xref "sv_i_ncmp" +.IX Item "sv_i_ncmp" +.IP "sv_i_ncmp_desc" 4 +.IX Xref "sv_i_ncmp_desc" +.IX Item "sv_i_ncmp_desc" +.IP "sv_kill_backrefs" 4 +.IX Xref "sv_kill_backrefs" +.IX Item "sv_kill_backrefs" +.IP "sv_len_utf8_nomg" 4 +.IX Xref "sv_len_utf8_nomg" +.IX Item "sv_len_utf8_nomg" +.IP "sv_magicext_mglob" 4 +.IX Xref "sv_magicext_mglob" +.IX Item "sv_magicext_mglob" +.IP "sv_ncmp" 4 +.IX Xref "sv_ncmp" +.IX Item "sv_ncmp" +.IP "sv_ncmp_desc" 4 +.IX Xref "sv_ncmp_desc" +.IX Item "sv_ncmp_desc" +.IP "sv_only_taint_gmagic" 4 +.IX Xref "sv_only_taint_gmagic" +.IX Item "sv_only_taint_gmagic" +.IP "sv_or_pv_pos_u2b" 4 +.IX Xref "sv_or_pv_pos_u2b" +.IX Item "sv_or_pv_pos_u2b" +.IP "sv_resetpvn" 4 +.IX Xref "sv_resetpvn" +.IX Item "sv_resetpvn" +.IP "sv_sethek" 4 +.IX Xref "sv_sethek" +.IX Item "sv_sethek" +.IP "sv_setsv_cow" 4 +.IX Xref "sv_setsv_cow" +.IX Item "sv_setsv_cow" +.IP "sv_unglob" 4 +.IX Xref "sv_unglob" +.IX Item "sv_unglob" +.IP "tied_method" 4 +.IX Xref "tied_method" +.IX Item "tied_method" +.IP "tmps_grow_p" 4 +.IX Xref "tmps_grow_p" +.IX Item "tmps_grow_p" +.IP "to_uni_fold" 4 +.IX Xref "to_uni_fold" +.IX Item "to_uni_fold" +.IP "to_uni_lower" 4 +.IX Xref "to_uni_lower" +.IX Item "to_uni_lower" +.IP "to_uni_title" 4 +.IX Xref "to_uni_title" +.IX Item "to_uni_title" +.IP "to_uni_upper" 4 +.IX Xref "to_uni_upper" +.IX Item "to_uni_upper" +.IP "translate_substr_offsets" 4 +.IX Xref "translate_substr_offsets" +.IX Item "translate_substr_offsets" +.IP "try_amagic_bin" 4 +.IX Xref "try_amagic_bin" +.IX Item "try_amagic_bin" +.IP "try_amagic_un" 4 +.IX Xref "try_amagic_un" +.IX Item "try_amagic_un" +.IP "uiv_2buf" 4 +.IX Xref "uiv_2buf" +.IX Item "uiv_2buf" +.IP "unshare_hek" 4 +.IX Xref "unshare_hek" +.IX Item "unshare_hek" +.IP "utf16_to_utf8" 4 +.IX Xref "utf16_to_utf8" +.IX Item "utf16_to_utf8" +.IP "utf16_to_utf8_reversed" 4 +.IX Xref "utf16_to_utf8_reversed" +.IX Item "utf16_to_utf8_reversed" +.IP "utf8_to_uvchr_buf_helper" 4 +.IX Xref "utf8_to_uvchr_buf_helper" +.IX Item "utf8_to_uvchr_buf_helper" +.IP "utilize" 4 +.IX Xref "utilize" +.IX Item "utilize" +.IP "uvoffuni_to_utf8_flags_msgs" 4 +.IX Xref "uvoffuni_to_utf8_flags_msgs" +.IX Item "uvoffuni_to_utf8_flags_msgs" +.IP "uvuni_to_utf8" 4 +.IX Xref "uvuni_to_utf8" +.IX Item "uvuni_to_utf8" +.IP "valid_utf8_to_uvuni" 4 +.IX Xref "valid_utf8_to_uvuni" +.IX Item "valid_utf8_to_uvuni" +.IP "variant_byte_number" 4 +.IX Xref "variant_byte_number" +.IX Item "variant_byte_number" +.IP "varname" 4 +.IX Xref "varname" +.IX Item "varname" +.IP "vivify_defelem" 4 +.IX Xref "vivify_defelem" +.IX Item "vivify_defelem" +.IP "vivify_ref" 4 +.IX Xref "vivify_ref" +.IX Item "vivify_ref" +.IP "wait4pid" 4 +.IX Xref "wait4pid" +.IX Item "wait4pid" +.IP "was_lvalue_sub" 4 +.IX Xref "was_lvalue_sub" +.IX Item "was_lvalue_sub" +.IP "watch" 4 +.IX Xref "watch" +.IX Item "watch" +.IP "win32_croak_not_implemented" 4 +.IX Xref "win32_croak_not_implemented" +.IX Item "win32_croak_not_implemented" +.IP "write_to_stderr" 4 +.IX Xref "write_to_stderr" +.IX Item "write_to_stderr" +.IP "xs_boot_epilog" 4 +.IX Xref "xs_boot_epilog" +.IX Item "xs_boot_epilog" +.IP "xs_handshake" 4 +.IX Xref "xs_handshake" +.IX Item "xs_handshake" +.IP "yyerror" 4 +.IX Xref "yyerror" +.IX Item "yyerror" +.IP "yyerror_pv" 4 +.IX Xref "yyerror_pv" +.IX Item "yyerror_pv" +.IP "yyerror_pvn" 4 +.IX Xref "yyerror_pvn" +.IX Item "yyerror_pvn" +.IP "yylex" 4 +.IX Xref "yylex" +.IX Item "yylex" +.IP "yyparse" 4 +.IX Xref "yyparse" +.IX Item "yyparse" +.IP "yyquit" 4 +.IX Xref "yyquit" +.IX Item "yyquit" +.IP "yyunlex" 4 +.IX Xref "yyunlex" +.IX Item "yyunlex" +.PD +.SH "AUTHORS" +.IX Header "AUTHORS" +The autodocumentation system was originally added to the Perl core by +Benjamin Stuhl. Documentation is by whoever was kind enough to +document their functions. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\fIconfig.h\fR perlapi perlapio perlcall perlclib perlfilter perlguts perlmroapi perlxs perlxstut warnings diff --git a/data/miniconda3/man/man1/perlintro.1 b/data/miniconda3/man/man1/perlintro.1 new file mode 100644 index 0000000000000000000000000000000000000000..c3ccaeb94a717533d54e6cbe3432e6fbde9cd599 --- /dev/null +++ b/data/miniconda3/man/man1/perlintro.1 @@ -0,0 +1,911 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLINTRO 1" +.TH PERLINTRO 1 "2020-12-18" "perl v5.32.1" "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" +perlintro \-\- a brief introduction and overview of Perl +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document is intended to give you a quick overview of the Perl +programming language, along with pointers to further documentation. It +is intended as a \*(L"bootstrap\*(R" guide for those who are new to the +language, and provides just enough information for you to be able to +read other peoples' Perl and understand roughly what it's doing, or +write your own simple scripts. +.PP +This introductory document does not aim to be complete. It does not +even aim to be entirely accurate. In some cases perfection has been +sacrificed in the goal of getting the general idea across. You are +\&\fIstrongly\fR advised to follow this introduction with more information +from the full Perl manual, the table of contents to which can be found +in perltoc. +.PP +Throughout this document you'll see references to other parts of the +Perl documentation. You can read that documentation using the \f(CW\*(C`perldoc\*(C'\fR +command or whatever method you're using to read this document. +.PP +Throughout Perl's documentation, you'll find numerous examples intended +to help explain the discussed features. Please keep in mind that many +of them are code fragments rather than complete programs. +.PP +These examples often reflect the style and preference of the author of +that piece of the documentation, and may be briefer than a corresponding +line of code in a real program. Except where otherwise noted, you +should assume that \f(CW\*(C`use strict\*(C'\fR and \f(CW\*(C`use warnings\*(C'\fR statements +appear earlier in the \*(L"program\*(R", and that any variables used have +already been declared, even if those declarations have been omitted +to make the example easier to read. +.PP +Do note that the examples have been written by many different authors over +a period of several decades. Styles and techniques will therefore differ, +although some effort has been made to not vary styles too widely in the +same sections. Do not consider one style to be better than others \- \*(L"There's +More Than One Way To Do It\*(R" is one of Perl's mottos. After all, in your +journey as a programmer, you are likely to encounter different styles. +.SS "What is Perl?" +.IX Subsection "What is Perl?" +Perl is a general-purpose programming language originally developed for +text manipulation and now used for a wide range of tasks including +system administration, web development, network programming, \s-1GUI\s0 +development, and more. +.PP +The language is intended to be practical (easy to use, efficient, +complete) rather than beautiful (tiny, elegant, minimal). Its major +features are that it's easy to use, supports both procedural and +object-oriented (\s-1OO\s0) programming, has powerful built-in support for text +processing, and has one of the world's most impressive collections of +third-party modules. +.PP +Different definitions of Perl are given in perl, perlfaq1 and +no doubt other places. From this we can determine that Perl is different +things to different people, but that lots of people think it's at least +worth writing about. +.SS "Running Perl programs" +.IX Subsection "Running Perl programs" +To run a Perl program from the Unix command line: +.PP +.Vb 1 +\& perl progname.pl +.Ve +.PP +Alternatively, put this as the first line of your script: +.PP +.Vb 1 +\& #!/usr/bin/env perl +.Ve +.PP +\&... and run the script as \fI/path/to/script.pl\fR. Of course, it'll need +to be executable first, so \f(CW\*(C`chmod 755 script.pl\*(C'\fR (under Unix). +.PP +(This start line assumes you have the \fBenv\fR program. You can also put +directly the path to your perl executable, like in \f(CW\*(C`#!/usr/bin/perl\*(C'\fR). +.PP +For more information, including instructions for other platforms such as +Windows and Mac \s-1OS,\s0 read perlrun. +.SS "Safety net" +.IX Subsection "Safety net" +Perl by default is very forgiving. In order to make it more robust +it is recommended to start every program with the following lines: +.PP +.Vb 3 +\& #!/usr/bin/perl +\& use strict; +\& use warnings; +.Ve +.PP +The two additional lines request from perl to catch various common +problems in your code. They check different things so you need both. A +potential problem caught by \f(CW\*(C`use strict;\*(C'\fR will cause your code to stop +immediately when it is encountered, while \f(CW\*(C`use warnings;\*(C'\fR will merely +give a warning (like the command-line switch \fB\-w\fR) and let your code run. +To read more about them check their respective manual pages at strict +and warnings. +.SS "Basic syntax overview" +.IX Subsection "Basic syntax overview" +A Perl script or program consists of one or more statements. These +statements are simply written in the script in a straightforward +fashion. There is no need to have a \f(CW\*(C`main()\*(C'\fR function or anything of +that kind. +.PP +Perl statements end in a semi-colon: +.PP +.Vb 1 +\& print "Hello, world"; +.Ve +.PP +Comments start with a hash symbol and run to the end of the line +.PP +.Vb 1 +\& # This is a comment +.Ve +.PP +Whitespace is irrelevant: +.PP +.Vb 3 +\& print +\& "Hello, world" +\& ; +.Ve +.PP +\&... except inside quoted strings: +.PP +.Vb 3 +\& # this would print with a linebreak in the middle +\& print "Hello +\& world"; +.Ve +.PP +Double quotes or single quotes may be used around literal strings: +.PP +.Vb 2 +\& print "Hello, world"; +\& print \*(AqHello, world\*(Aq; +.Ve +.PP +However, only double quotes \*(L"interpolate\*(R" variables and special +characters such as newlines (\f(CW\*(C`\en\*(C'\fR): +.PP +.Vb 2 +\& print "Hello, $name\en"; # works fine +\& print \*(AqHello, $name\en\*(Aq; # prints $name\en literally +.Ve +.PP +Numbers don't need quotes around them: +.PP +.Vb 1 +\& print 42; +.Ve +.PP +You can use parentheses for functions' arguments or omit them +according to your personal taste. They are only required +occasionally to clarify issues of precedence. +.PP +.Vb 2 +\& print("Hello, world\en"); +\& print "Hello, world\en"; +.Ve +.PP +More detailed information about Perl syntax can be found in perlsyn. +.SS "Perl variable types" +.IX Subsection "Perl variable types" +Perl has three main variable types: scalars, arrays, and hashes. +.IP "Scalars" 4 +.IX Item "Scalars" +A scalar represents a single value: +.Sp +.Vb 2 +\& my $animal = "camel"; +\& my $answer = 42; +.Ve +.Sp +Scalar values can be strings, integers or floating point numbers, and Perl +will automatically convert between them as required. There is no need +to pre-declare your variable types, but you have to declare them using +the \f(CW\*(C`my\*(C'\fR keyword the first time you use them. (This is one of the +requirements of \f(CW\*(C`use strict;\*(C'\fR.) +.Sp +Scalar values can be used in various ways: +.Sp +.Vb 3 +\& print $animal; +\& print "The animal is $animal\en"; +\& print "The square of $answer is ", $answer * $answer, "\en"; +.Ve +.Sp +There are a number of \*(L"magic\*(R" scalars with names that look like +punctuation or line noise. These special variables are used for all +kinds of purposes, and are documented in perlvar. The only one you +need to know about for now is \f(CW$_\fR which is the \*(L"default variable\*(R". +It's used as the default argument to a number of functions in Perl, and +it's set implicitly by certain looping constructs. +.Sp +.Vb 1 +\& print; # prints contents of $_ by default +.Ve +.IP "Arrays" 4 +.IX Item "Arrays" +An array represents a list of values: +.Sp +.Vb 3 +\& my @animals = ("camel", "llama", "owl"); +\& my @numbers = (23, 42, 69); +\& my @mixed = ("camel", 42, 1.23); +.Ve +.Sp +Arrays are zero-indexed. Here's how you get at elements in an array: +.Sp +.Vb 2 +\& print $animals[0]; # prints "camel" +\& print $animals[1]; # prints "llama" +.Ve +.Sp +The special variable \f(CW$#array\fR tells you the index of the last element +of an array: +.Sp +.Vb 1 +\& print $mixed[$#mixed]; # last element, prints 1.23 +.Ve +.Sp +You might be tempted to use \f(CW\*(C`$#array + 1\*(C'\fR to tell you how many items there +are in an array. Don't bother. As it happens, using \f(CW@array\fR where Perl +expects to find a scalar value (\*(L"in scalar context\*(R") will give you the number +of elements in the array: +.Sp +.Vb 1 +\& if (@animals < 5) { ... } +.Ve +.Sp +The elements we're getting from the array start with a \f(CW\*(C`$\*(C'\fR because +we're getting just a single value out of the array; you ask for a scalar, +you get a scalar. +.Sp +To get multiple values from an array: +.Sp +.Vb 3 +\& @animals[0,1]; # gives ("camel", "llama"); +\& @animals[0..2]; # gives ("camel", "llama", "owl"); +\& @animals[1..$#animals]; # gives all except the first element +.Ve +.Sp +This is called an \*(L"array slice\*(R". +.Sp +You can do various useful things to lists: +.Sp +.Vb 2 +\& my @sorted = sort @animals; +\& my @backwards = reverse @numbers; +.Ve +.Sp +There are a couple of special arrays too, such as \f(CW@ARGV\fR (the command +line arguments to your script) and \f(CW@_\fR (the arguments passed to a +subroutine). These are documented in perlvar. +.IP "Hashes" 4 +.IX Item "Hashes" +A hash represents a set of key/value pairs: +.Sp +.Vb 1 +\& my %fruit_color = ("apple", "red", "banana", "yellow"); +.Ve +.Sp +You can use whitespace and the \f(CW\*(C`=>\*(C'\fR operator to lay them out more +nicely: +.Sp +.Vb 4 +\& my %fruit_color = ( +\& apple => "red", +\& banana => "yellow", +\& ); +.Ve +.Sp +To get at hash elements: +.Sp +.Vb 1 +\& $fruit_color{"apple"}; # gives "red" +.Ve +.Sp +You can get at lists of keys and values with \f(CW\*(C`keys()\*(C'\fR and +\&\f(CW\*(C`values()\*(C'\fR. +.Sp +.Vb 2 +\& my @fruits = keys %fruit_color; +\& my @colors = values %fruit_color; +.Ve +.Sp +Hashes have no particular internal order, though you can sort the keys +and loop through them. +.Sp +Just like special scalars and arrays, there are also special hashes. +The most well known of these is \f(CW%ENV\fR which contains environment +variables. Read all about it (and other special variables) in +perlvar. +.PP +Scalars, arrays and hashes are documented more fully in perldata. +.PP +More complex data types can be constructed using references, which allow +you to build lists and hashes within lists and hashes. +.PP +A reference is a scalar value and can refer to any other Perl data +type. So by storing a reference as the value of an array or hash +element, you can easily create lists and hashes within lists and +hashes. The following example shows a 2 level hash of hash +structure using anonymous hash references. +.PP +.Vb 10 +\& my $variables = { +\& scalar => { +\& description => "single item", +\& sigil => \*(Aq$\*(Aq, +\& }, +\& array => { +\& description => "ordered list of items", +\& sigil => \*(Aq@\*(Aq, +\& }, +\& hash => { +\& description => "key/value pairs", +\& sigil => \*(Aq%\*(Aq, +\& }, +\& }; +\& +\& print "Scalars begin with a $variables\->{\*(Aqscalar\*(Aq}\->{\*(Aqsigil\*(Aq}\en"; +.Ve +.PP +Exhaustive information on the topic of references can be found in +perlreftut, perllol, perlref and perldsc. +.SS "Variable scoping" +.IX Subsection "Variable scoping" +Throughout the previous section all the examples have used the syntax: +.PP +.Vb 1 +\& my $var = "value"; +.Ve +.PP +The \f(CW\*(C`my\*(C'\fR is actually not required; you could just use: +.PP +.Vb 1 +\& $var = "value"; +.Ve +.PP +However, the above usage will create global variables throughout your +program, which is bad programming practice. \f(CW\*(C`my\*(C'\fR creates lexically +scoped variables instead. The variables are scoped to the block +(i.e. a bunch of statements surrounded by curly-braces) in which they +are defined. +.PP +.Vb 9 +\& my $x = "foo"; +\& my $some_condition = 1; +\& if ($some_condition) { +\& my $y = "bar"; +\& print $x; # prints "foo" +\& print $y; # prints "bar" +\& } +\& print $x; # prints "foo" +\& print $y; # prints nothing; $y has fallen out of scope +.Ve +.PP +Using \f(CW\*(C`my\*(C'\fR in combination with a \f(CW\*(C`use strict;\*(C'\fR at the top of +your Perl scripts means that the interpreter will pick up certain common +programming errors. For instance, in the example above, the final +\&\f(CW\*(C`print $y\*(C'\fR would cause a compile-time error and prevent you from +running the program. Using \f(CW\*(C`strict\*(C'\fR is highly recommended. +.SS "Conditional and looping constructs" +.IX Subsection "Conditional and looping constructs" +Perl has most of the usual conditional and looping constructs. As of Perl +5.10, it even has a case/switch statement (spelled \f(CW\*(C`given\*(C'\fR/\f(CW\*(C`when\*(C'\fR). See +\&\*(L"Switch Statements\*(R" in perlsyn for more details. +.PP +The conditions can be any Perl expression. See the list of operators in +the next section for information on comparison and boolean logic operators, +which are commonly used in conditional statements. +.IP "if" 4 +.IX Item "if" +.Vb 7 +\& if ( condition ) { +\& ... +\& } elsif ( other condition ) { +\& ... +\& } else { +\& ... +\& } +.Ve +.Sp +There's also a negated version of it: +.Sp +.Vb 3 +\& unless ( condition ) { +\& ... +\& } +.Ve +.Sp +This is provided as a more readable version of \f(CW\*(C`if (!\f(CIcondition\f(CW)\*(C'\fR. +.Sp +Note that the braces are required in Perl, even if you've only got one +line in the block. However, there is a clever way of making your one-line +conditional blocks more English like: +.Sp +.Vb 4 +\& # the traditional way +\& if ($zippy) { +\& print "Yow!"; +\& } +\& +\& # the Perlish post\-condition way +\& print "Yow!" if $zippy; +\& print "We have no bananas" unless $bananas; +.Ve +.IP "while" 4 +.IX Item "while" +.Vb 3 +\& while ( condition ) { +\& ... +\& } +.Ve +.Sp +There's also a negated version, for the same reason we have \f(CW\*(C`unless\*(C'\fR: +.Sp +.Vb 3 +\& until ( condition ) { +\& ... +\& } +.Ve +.Sp +You can also use \f(CW\*(C`while\*(C'\fR in a post-condition: +.Sp +.Vb 1 +\& print "LA LA LA\en" while 1; # loops forever +.Ve +.IP "for" 4 +.IX Item "for" +Exactly like C: +.Sp +.Vb 3 +\& for ($i = 0; $i <= $max; $i++) { +\& ... +\& } +.Ve +.Sp +The C style for loop is rarely needed in Perl since Perl provides +the more friendly list scanning \f(CW\*(C`foreach\*(C'\fR loop. +.IP "foreach" 4 +.IX Item "foreach" +.Vb 3 +\& foreach (@array) { +\& print "This element is $_\en"; +\& } +\& +\& print $list[$_] foreach 0 .. $max; +\& +\& # you don\*(Aqt have to use the default $_ either... +\& foreach my $key (keys %hash) { +\& print "The value of $key is $hash{$key}\en"; +\& } +.Ve +.Sp +The \f(CW\*(C`foreach\*(C'\fR keyword is actually a synonym for the \f(CW\*(C`for\*(C'\fR +keyword. See \f(CW\*(C`"Foreach Loops" in perlsyn\*(C'\fR. +.PP +For more detail on looping constructs (and some that weren't mentioned in +this overview) see perlsyn. +.SS "Builtin operators and functions" +.IX Subsection "Builtin operators and functions" +Perl comes with a wide selection of builtin functions. Some of the ones +we've already seen include \f(CW\*(C`print\*(C'\fR, \f(CW\*(C`sort\*(C'\fR and \f(CW\*(C`reverse\*(C'\fR. A list of +them is given at the start of perlfunc and you can easily read +about any given function by using \f(CW\*(C`perldoc \-f \f(CIfunctionname\f(CW\*(C'\fR. +.PP +Perl operators are documented in full in perlop, but here are a few +of the most common ones: +.IP "Arithmetic" 4 +.IX Item "Arithmetic" +.Vb 4 +\& + addition +\& \- subtraction +\& * multiplication +\& / division +.Ve +.IP "Numeric comparison" 4 +.IX Item "Numeric comparison" +.Vb 6 +\& == equality +\& != inequality +\& < less than +\& > greater than +\& <= less than or equal +\& >= greater than or equal +.Ve +.IP "String comparison" 4 +.IX Item "String comparison" +.Vb 6 +\& eq equality +\& ne inequality +\& lt less than +\& gt greater than +\& le less than or equal +\& ge greater than or equal +.Ve +.Sp +(Why do we have separate numeric and string comparisons? Because we don't +have special variable types, and Perl needs to know whether to sort +numerically (where 99 is less than 100) or alphabetically (where 100 comes +before 99). +.IP "Boolean logic" 4 +.IX Item "Boolean logic" +.Vb 3 +\& && and +\& || or +\& ! not +.Ve +.Sp +(\f(CW\*(C`and\*(C'\fR, \f(CW\*(C`or\*(C'\fR and \f(CW\*(C`not\*(C'\fR aren't just in the above table as descriptions +of the operators. They're also supported as operators in their own +right. They're more readable than the C\-style operators, but have +different precedence to \f(CW\*(C`&&\*(C'\fR and friends. Check perlop for more +detail.) +.IP "Miscellaneous" 4 +.IX Item "Miscellaneous" +.Vb 4 +\& = assignment +\& . string concatenation +\& x string multiplication (repeats strings) +\& .. range operator (creates a list of numbers or strings) +.Ve +.PP +Many operators can be combined with a \f(CW\*(C`=\*(C'\fR as follows: +.PP +.Vb 3 +\& $a += 1; # same as $a = $a + 1 +\& $a \-= 1; # same as $a = $a \- 1 +\& $a .= "\en"; # same as $a = $a . "\en"; +.Ve +.SS "Files and I/O" +.IX Subsection "Files and I/O" +You can open a file for input or output using the \f(CW\*(C`open()\*(C'\fR function. +It's documented in extravagant detail in perlfunc and perlopentut, +but in short: +.PP +.Vb 3 +\& open(my $in, "<", "input.txt") or die "Can\*(Aqt open input.txt: $!"; +\& open(my $out, ">", "output.txt") or die "Can\*(Aqt open output.txt: $!"; +\& open(my $log, ">>", "my.log") or die "Can\*(Aqt open my.log: $!"; +.Ve +.PP +You can read from an open filehandle using the \f(CW\*(C`<>\*(C'\fR operator. In +scalar context it reads a single line from the filehandle, and in list +context it reads the whole file in, assigning each line to an element of +the list: +.PP +.Vb 2 +\& my $line = <$in>; +\& my @lines = <$in>; +.Ve +.PP +Reading in the whole file at one time is called slurping. It can +be useful but it may be a memory hog. Most text file processing +can be done a line at a time with Perl's looping constructs. +.PP +The \f(CW\*(C`<>\*(C'\fR operator is most often seen in a \f(CW\*(C`while\*(C'\fR loop: +.PP +.Vb 3 +\& while (<$in>) { # assigns each line in turn to $_ +\& print "Just read in this line: $_"; +\& } +.Ve +.PP +We've already seen how to print to standard output using \f(CW\*(C`print()\*(C'\fR. +However, \f(CW\*(C`print()\*(C'\fR can also take an optional first argument specifying +which filehandle to print to: +.PP +.Vb 3 +\& print STDERR "This is your final warning.\en"; +\& print $out $record; +\& print $log $logmessage; +.Ve +.PP +When you're done with your filehandles, you should \f(CW\*(C`close()\*(C'\fR them +(though to be honest, Perl will clean up after you if you forget): +.PP +.Vb 1 +\& close $in or die "$in: $!"; +.Ve +.SS "Regular expressions" +.IX Subsection "Regular expressions" +Perl's regular expression support is both broad and deep, and is the +subject of lengthy documentation in perlrequick, perlretut, and +elsewhere. However, in short: +.IP "Simple matching" 4 +.IX Item "Simple matching" +.Vb 2 +\& if (/foo/) { ... } # true if $_ contains "foo" +\& if ($a =~ /foo/) { ... } # true if $a contains "foo" +.Ve +.Sp +The \f(CW\*(C`//\*(C'\fR matching operator is documented in perlop. It operates on +\&\f(CW$_\fR by default, or can be bound to another variable using the \f(CW\*(C`=~\*(C'\fR +binding operator (also documented in perlop). +.IP "Simple substitution" 4 +.IX Item "Simple substitution" +.Vb 4 +\& s/foo/bar/; # replaces foo with bar in $_ +\& $a =~ s/foo/bar/; # replaces foo with bar in $a +\& $a =~ s/foo/bar/g; # replaces ALL INSTANCES of foo with bar +\& # in $a +.Ve +.Sp +The \f(CW\*(C`s///\*(C'\fR substitution operator is documented in perlop. +.IP "More complex regular expressions" 4 +.IX Item "More complex regular expressions" +You don't just have to match on fixed strings. In fact, you can match +on just about anything you could dream of by using more complex regular +expressions. These are documented at great length in perlre, but for +the meantime, here's a quick cheat sheet: +.Sp +.Vb 12 +\& . a single character +\& \es a whitespace character (space, tab, newline, +\& ...) +\& \eS non\-whitespace character +\& \ed a digit (0\-9) +\& \eD a non\-digit +\& \ew a word character (a\-z, A\-Z, 0\-9, _) +\& \eW a non\-word character +\& [aeiou] matches a single character in the given set +\& [^aeiou] matches a single character outside the given +\& set +\& (foo|bar|baz) matches any of the alternatives specified +\& +\& ^ start of string +\& $ end of string +.Ve +.Sp +Quantifiers can be used to specify how many of the previous thing you +want to match on, where \*(L"thing\*(R" means either a literal character, one +of the metacharacters listed above, or a group of characters or +metacharacters in parentheses. +.Sp +.Vb 6 +\& * zero or more of the previous thing +\& + one or more of the previous thing +\& ? zero or one of the previous thing +\& {3} matches exactly 3 of the previous thing +\& {3,6} matches between 3 and 6 of the previous thing +\& {3,} matches 3 or more of the previous thing +.Ve +.Sp +Some brief examples: +.Sp +.Vb 7 +\& /^\ed+/ string starts with one or more digits +\& /^$/ nothing in the string (start and end are +\& adjacent) +\& /(\ed\es){3}/ three digits, each followed by a whitespace +\& character (eg "3 4 5 ") +\& /(a.)+/ matches a string in which every odd\-numbered +\& letter is a (eg "abacadaf") +\& +\& # This loop reads from STDIN, and prints non\-blank lines: +\& while (<>) { +\& next if /^$/; +\& print; +\& } +.Ve +.IP "Parentheses for capturing" 4 +.IX Item "Parentheses for capturing" +As well as grouping, parentheses serve a second purpose. They can be +used to capture the results of parts of the regexp match for later use. +The results end up in \f(CW$1\fR, \f(CW$2\fR and so on. +.Sp +.Vb 1 +\& # a cheap and nasty way to break an email address up into parts +\& +\& if ($email =~ /([^@]+)@(.+)/) { +\& print "Username is $1\en"; +\& print "Hostname is $2\en"; +\& } +.Ve +.IP "Other regexp features" 4 +.IX Item "Other regexp features" +Perl regexps also support backreferences, lookaheads, and all kinds of +other complex details. Read all about them in perlrequick, +perlretut, and perlre. +.SS "Writing subroutines" +.IX Subsection "Writing subroutines" +Writing subroutines is easy: +.PP +.Vb 5 +\& sub logger { +\& my $logmessage = shift; +\& open my $logfile, ">>", "my.log" or die "Could not open my.log: $!"; +\& print $logfile $logmessage; +\& } +.Ve +.PP +Now we can use the subroutine just as any other built-in function: +.PP +.Vb 1 +\& logger("We have a logger subroutine!"); +.Ve +.PP +What's that \f(CW\*(C`shift\*(C'\fR? Well, the arguments to a subroutine are available +to us as a special array called \f(CW@_\fR (see perlvar for more on that). +The default argument to the \f(CW\*(C`shift\*(C'\fR function just happens to be \f(CW@_\fR. +So \f(CW\*(C`my $logmessage = shift;\*(C'\fR shifts the first item off the list of +arguments and assigns it to \f(CW$logmessage\fR. +.PP +We can manipulate \f(CW@_\fR in other ways too: +.PP +.Vb 2 +\& my ($logmessage, $priority) = @_; # common +\& my $logmessage = $_[0]; # uncommon, and ugly +.Ve +.PP +Subroutines can also return values: +.PP +.Vb 5 +\& sub square { +\& my $num = shift; +\& my $result = $num * $num; +\& return $result; +\& } +.Ve +.PP +Then use it like: +.PP +.Vb 1 +\& $sq = square(8); +.Ve +.PP +For more information on writing subroutines, see perlsub. +.SS "\s-1OO\s0 Perl" +.IX Subsection "OO Perl" +\&\s-1OO\s0 Perl is relatively simple and is implemented using references which +know what sort of object they are based on Perl's concept of packages. +However, \s-1OO\s0 Perl is largely beyond the scope of this document. +Read perlootut and perlobj. +.PP +As a beginning Perl programmer, your most common use of \s-1OO\s0 Perl will be +in using third-party modules, which are documented below. +.SS "Using Perl modules" +.IX Subsection "Using Perl modules" +Perl modules provide a range of features to help you avoid reinventing +the wheel, and can be downloaded from \s-1CPAN\s0 ( ). A +number of popular modules are included with the Perl distribution +itself. +.PP +Categories of modules range from text manipulation to network protocols +to database integration to graphics. A categorized list of modules is +also available from \s-1CPAN.\s0 +.PP +To learn how to install modules you download from \s-1CPAN,\s0 read +perlmodinstall. +.PP +To learn how to use a particular module, use \f(CW\*(C`perldoc \f(CIModule::Name\f(CW\*(C'\fR. +Typically you will want to \f(CW\*(C`use \f(CIModule::Name\f(CW\*(C'\fR, which will then give +you access to exported functions or an \s-1OO\s0 interface to the module. +.PP +perlfaq contains questions and answers related to many common +tasks, and often provides suggestions for good \s-1CPAN\s0 modules to use. +.PP +perlmod describes Perl modules in general. perlmodlib lists the +modules which came with your Perl installation. +.PP +If you feel the urge to write Perl modules, perlnewmod will give you +good advice. +.SH "AUTHOR" +.IX Header "AUTHOR" +Kirrily \*(L"Skud\*(R" Robert diff --git a/data/miniconda3/man/man1/perlipc.1 b/data/miniconda3/man/man1/perlipc.1 new file mode 100644 index 0000000000000000000000000000000000000000..779b9c3194c298d961809124cf6c6686ebe3f1a8 --- /dev/null +++ b/data/miniconda3/man/man1/perlipc.1 @@ -0,0 +1,2042 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLIPC 1" +.TH PERLIPC 1 "2020-12-18" "perl v5.32.1" "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" +perlipc \- Perl interprocess communication (signals, fifos, pipes, safe subprocesses, sockets, and semaphores) +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The basic \s-1IPC\s0 facilities of Perl are built out of the good old Unix +signals, named pipes, pipe opens, the Berkeley socket routines, and SysV +\&\s-1IPC\s0 calls. Each is used in slightly different situations. +.SH "Signals" +.IX Header "Signals" +Perl uses a simple signal handling model: the \f(CW%SIG\fR hash contains names +or references of user-installed signal handlers. These handlers will +be called with an argument which is the name of the signal that +triggered it. A signal may be generated intentionally from a +particular keyboard sequence like control-C or control-Z, sent to you +from another process, or triggered automatically by the kernel when +special events transpire, like a child process exiting, your own process +running out of stack space, or hitting a process file-size limit. +.PP +For example, to trap an interrupt signal, set up a handler like this: +.PP +.Vb 1 +\& our $shucks; +\& +\& sub catch_zap { +\& my $signame = shift; +\& $shucks++; +\& die "Somebody sent me a SIG$signame"; +\& } +\& $SIG{INT} = _\|_PACKAGE_\|_ . "::catch_zap"; +\& $SIG{INT} = \e&catch_zap; # best strategy +.Ve +.PP +Prior to Perl 5.8.0 it was necessary to do as little as you possibly +could in your handler; notice how all we do is set a global variable +and then raise an exception. That's because on most systems, +libraries are not re-entrant; particularly, memory allocation and I/O +routines are not. That meant that doing nearly \fIanything\fR in your +handler could in theory trigger a memory fault and subsequent core +dump \- see \*(L"Deferred Signals (Safe Signals)\*(R" below. +.PP +The names of the signals are the ones listed out by \f(CW\*(C`kill \-l\*(C'\fR on your +system, or you can retrieve them using the \s-1CPAN\s0 module IPC::Signal. +.PP +You may also choose to assign the strings \f(CW"IGNORE"\fR or \f(CW"DEFAULT"\fR as +the handler, in which case Perl will try to discard the signal or do the +default thing. +.PP +On most Unix platforms, the \f(CW\*(C`CHLD\*(C'\fR (sometimes also known as \f(CW\*(C`CLD\*(C'\fR) signal +has special behavior with respect to a value of \f(CW"IGNORE"\fR. +Setting \f(CW$SIG{CHLD}\fR to \f(CW"IGNORE"\fR on such a platform has the effect of +not creating zombie processes when the parent process fails to \f(CW\*(C`wait()\*(C'\fR +on its child processes (i.e., child processes are automatically reaped). +Calling \f(CW\*(C`wait()\*(C'\fR with \f(CW$SIG{CHLD}\fR set to \f(CW"IGNORE"\fR usually returns +\&\f(CW\*(C`\-1\*(C'\fR on such platforms. +.PP +Some signals can be neither trapped nor ignored, such as the \s-1KILL\s0 and \s-1STOP\s0 +(but not the \s-1TSTP\s0) signals. Note that ignoring signals makes them disappear. +If you only want them blocked temporarily without them getting lost you'll +have to use the \f(CW\*(C`POSIX\*(C'\fR module's sigprocmask. +.PP +Sending a signal to a negative process \s-1ID\s0 means that you send the signal +to the entire Unix process group. This code sends a hang-up signal to all +processes in the current process group, and also sets \f(CW$SIG\fR{\s-1HUP\s0} to \f(CW"IGNORE"\fR +so it doesn't kill itself: +.PP +.Vb 6 +\& # block scope for local +\& { +\& local $SIG{HUP} = "IGNORE"; +\& kill HUP => \-getpgrp(); +\& # snazzy writing of: kill("HUP", \-getpgrp()) +\& } +.Ve +.PP +Another interesting signal to send is signal number zero. This doesn't +actually affect a child process, but instead checks whether it's alive +or has changed its UIDs. +.PP +.Vb 3 +\& unless (kill 0 => $kid_pid) { +\& warn "something wicked happened to $kid_pid"; +\& } +.Ve +.PP +Signal number zero may fail because you lack permission to send the +signal when directed at a process whose real or saved \s-1UID\s0 is not +identical to the real or effective \s-1UID\s0 of the sending process, even +though the process is alive. You may be able to determine the cause of +failure using \f(CW$!\fR or \f(CW\*(C`%!\*(C'\fR. +.PP +.Vb 3 +\& unless (kill(0 => $pid) || $!{EPERM}) { +\& warn "$pid looks dead"; +\& } +.Ve +.PP +You might also want to employ anonymous functions for simple signal +handlers: +.PP +.Vb 1 +\& $SIG{INT} = sub { die "\enOutta here!\en" }; +.Ve +.PP +\&\s-1SIGCHLD\s0 handlers require some special care. If a second child dies +while in the signal handler caused by the first death, we won't get +another signal. So must loop here else we will leave the unreaped child +as a zombie. And the next time two children die we get another zombie. +And so on. +.PP +.Vb 7 +\& use POSIX ":sys_wait_h"; +\& $SIG{CHLD} = sub { +\& while ((my $child = waitpid(\-1, WNOHANG)) > 0) { +\& $Kid_Status{$child} = $?; +\& } +\& }; +\& # do something that forks... +.Ve +.PP +Be careful: \fBqx()\fR, \fBsystem()\fR, and some modules for calling external commands +do a \fBfork()\fR, then \fBwait()\fR for the result. Thus, your signal handler +will be called. Because \fBwait()\fR was already called by \fBsystem()\fR or \fBqx()\fR, +the \fBwait()\fR in the signal handler will see no more zombies and will +therefore block. +.PP +The best way to prevent this issue is to use \fBwaitpid()\fR, as in the following +example: +.PP +.Vb 1 +\& use POSIX ":sys_wait_h"; # for nonblocking read +\& +\& my %children; +\& +\& $SIG{CHLD} = sub { +\& # don\*(Aqt change $! and $? outside handler +\& local ($!, $?); +\& while ( (my $pid = waitpid(\-1, WNOHANG)) > 0 ) { +\& delete $children{$pid}; +\& cleanup_child($pid, $?); +\& } +\& }; +\& +\& while (1) { +\& my $pid = fork(); +\& die "cannot fork" unless defined $pid; +\& if ($pid == 0) { +\& # ... +\& exit 0; +\& } else { +\& $children{$pid}=1; +\& # ... +\& system($command); +\& # ... +\& } +\& } +.Ve +.PP +Signal handling is also used for timeouts in Unix. While safely +protected within an \f(CW\*(C`eval{}\*(C'\fR block, you set a signal handler to trap +alarm signals and then schedule to have one delivered to you in some +number of seconds. Then try your blocking operation, clearing the alarm +when it's done but not before you've exited your \f(CW\*(C`eval{}\*(C'\fR block. If it +goes off, you'll use \fBdie()\fR to jump out of the block. +.PP +Here's an example: +.PP +.Vb 9 +\& my $ALARM_EXCEPTION = "alarm clock restart"; +\& eval { +\& local $SIG{ALRM} = sub { die $ALARM_EXCEPTION }; +\& alarm 10; +\& flock($fh, 2) # blocking write lock +\& || die "cannot flock: $!"; +\& alarm 0; +\& }; +\& if ($@ && $@ !~ quotemeta($ALARM_EXCEPTION)) { die } +.Ve +.PP +If the operation being timed out is \fBsystem()\fR or \fBqx()\fR, this technique +is liable to generate zombies. If this matters to you, you'll +need to do your own \fBfork()\fR and \fBexec()\fR, and kill the errant child process. +.PP +For more complex signal handling, you might see the standard \s-1POSIX\s0 +module. Lamentably, this is almost entirely undocumented, but the +\&\fIext/POSIX/t/sigaction.t\fR file from the Perl source distribution has +some examples in it. +.SS "Handling the \s-1SIGHUP\s0 Signal in Daemons" +.IX Subsection "Handling the SIGHUP Signal in Daemons" +A process that usually starts when the system boots and shuts down +when the system is shut down is called a daemon (Disk And Execution +MONitor). If a daemon process has a configuration file which is +modified after the process has been started, there should be a way to +tell that process to reread its configuration file without stopping +the process. Many daemons provide this mechanism using a \f(CW\*(C`SIGHUP\*(C'\fR +signal handler. When you want to tell the daemon to reread the file, +simply send it the \f(CW\*(C`SIGHUP\*(C'\fR signal. +.PP +The following example implements a simple daemon, which restarts +itself every time the \f(CW\*(C`SIGHUP\*(C'\fR signal is received. The actual code is +located in the subroutine \f(CW\*(C`code()\*(C'\fR, which just prints some debugging +info to show that it works; it should be replaced with the real code. +.PP +.Vb 1 +\& #!/usr/bin/perl +\& +\& use strict; +\& use warnings; +\& +\& use POSIX (); +\& use FindBin (); +\& use File::Basename (); +\& use File::Spec::Functions qw(catfile); +\& +\& $| = 1; +\& +\& # make the daemon cross\-platform, so exec always calls the script +\& # itself with the right path, no matter how the script was invoked. +\& my $script = File::Basename::basename($0); +\& my $SELF = catfile($FindBin::Bin, $script); +\& +\& # POSIX unmasks the sigprocmask properly +\& $SIG{HUP} = sub { +\& print "got SIGHUP\en"; +\& exec($SELF, @ARGV) || die "$0: couldn\*(Aqt restart: $!"; +\& }; +\& +\& code(); +\& +\& sub code { +\& print "PID: $$\en"; +\& print "ARGV: @ARGV\en"; +\& my $count = 0; +\& while (1) { +\& sleep 2; +\& print ++$count, "\en"; +\& } +\& } +.Ve +.SS "Deferred Signals (Safe Signals)" +.IX Subsection "Deferred Signals (Safe Signals)" +Before Perl 5.8.0, installing Perl code to deal with signals exposed you to +danger from two things. First, few system library functions are +re-entrant. If the signal interrupts while Perl is executing one function +(like \fBmalloc\fR\|(3) or \fBprintf\fR\|(3)), and your signal handler then calls the same +function again, you could get unpredictable behavior\*(--often, a core dump. +Second, Perl isn't itself re-entrant at the lowest levels. If the signal +interrupts Perl while Perl is changing its own internal data structures, +similarly unpredictable behavior may result. +.PP +There were two things you could do, knowing this: be paranoid or be +pragmatic. The paranoid approach was to do as little as possible in your +signal handler. Set an existing integer variable that already has a +value, and return. This doesn't help you if you're in a slow system call, +which will just restart. That means you have to \f(CW\*(C`die\*(C'\fR to \fBlongjmp\fR\|(3) out +of the handler. Even this is a little cavalier for the true paranoiac, +who avoids \f(CW\*(C`die\*(C'\fR in a handler because the system \fIis\fR out to get you. +The pragmatic approach was to say \*(L"I know the risks, but prefer the +convenience\*(R", and to do anything you wanted in your signal handler, +and be prepared to clean up core dumps now and again. +.PP +Perl 5.8.0 and later avoid these problems by \*(L"deferring\*(R" signals. That is, +when the signal is delivered to the process by the system (to the C code +that implements Perl) a flag is set, and the handler returns immediately. +Then at strategic \*(L"safe\*(R" points in the Perl interpreter (e.g. when it is +about to execute a new opcode) the flags are checked and the Perl level +handler from \f(CW%SIG\fR is executed. The \*(L"deferred\*(R" scheme allows much more +flexibility in the coding of signal handlers as we know the Perl +interpreter is in a safe state, and that we are not in a system library +function when the handler is called. However the implementation does +differ from previous Perls in the following ways: +.IP "Long-running opcodes" 4 +.IX Item "Long-running opcodes" +As the Perl interpreter looks at signal flags only when it is about +to execute a new opcode, a signal that arrives during a long-running +opcode (e.g. a regular expression operation on a very large string) will +not be seen until the current opcode completes. +.Sp +If a signal of any given type fires multiple times during an opcode +(such as from a fine-grained timer), the handler for that signal will +be called only once, after the opcode completes; all other +instances will be discarded. Furthermore, if your system's signal queue +gets flooded to the point that there are signals that have been raised +but not yet caught (and thus not deferred) at the time an opcode +completes, those signals may well be caught and deferred during +subsequent opcodes, with sometimes surprising results. For example, you +may see alarms delivered even after calling \f(CWalarm(0)\fR as the latter +stops the raising of alarms but does not cancel the delivery of alarms +raised but not yet caught. Do not depend on the behaviors described in +this paragraph as they are side effects of the current implementation and +may change in future versions of Perl. +.IP "Interrupting \s-1IO\s0" 4 +.IX Item "Interrupting IO" +When a signal is delivered (e.g., \s-1SIGINT\s0 from a control-C) the operating +system breaks into \s-1IO\s0 operations like \fIread\fR(2), which is used to +implement Perl's \fBreadline()\fR function, the \f(CW\*(C`<>\*(C'\fR operator. On older +Perls the handler was called immediately (and as \f(CW\*(C`read\*(C'\fR is not \*(L"unsafe\*(R", +this worked well). With the \*(L"deferred\*(R" scheme the handler is \fInot\fR called +immediately, and if Perl is using the system's \f(CW\*(C`stdio\*(C'\fR library that +library may restart the \f(CW\*(C`read\*(C'\fR without returning to Perl to give it a +chance to call the \f(CW%SIG\fR handler. If this happens on your system the +solution is to use the \f(CW\*(C`:perlio\*(C'\fR layer to do IO\*(--at least on those handles +that you want to be able to break into with signals. (The \f(CW\*(C`:perlio\*(C'\fR layer +checks the signal flags and calls \f(CW%SIG\fR handlers before resuming \s-1IO\s0 +operation.) +.Sp +The default in Perl 5.8.0 and later is to automatically use +the \f(CW\*(C`:perlio\*(C'\fR layer. +.Sp +Note that it is not advisable to access a file handle within a signal +handler where that signal has interrupted an I/O operation on that same +handle. While perl will at least try hard not to crash, there are no +guarantees of data integrity; for example, some data might get dropped or +written twice. +.Sp +Some networking library functions like \fBgethostbyname()\fR are known to have +their own implementations of timeouts which may conflict with your +timeouts. If you have problems with such functions, try using the \s-1POSIX\s0 +\&\fBsigaction()\fR function, which bypasses Perl safe signals. Be warned that +this does subject you to possible memory corruption, as described above. +.Sp +Instead of setting \f(CW$SIG{ALRM}\fR: +.Sp +.Vb 1 +\& local $SIG{ALRM} = sub { die "alarm" }; +.Ve +.Sp +try something like the following: +.Sp +.Vb 4 +\& use POSIX qw(SIGALRM); +\& POSIX::sigaction(SIGALRM, +\& POSIX::SigAction\->new(sub { die "alarm" })) +\& || die "Error setting SIGALRM handler: $!\en"; +.Ve +.Sp +Another way to disable the safe signal behavior locally is to use +the \f(CW\*(C`Perl::Unsafe::Signals\*(C'\fR module from \s-1CPAN,\s0 which affects +all signals. +.IP "Restartable system calls" 4 +.IX Item "Restartable system calls" +On systems that supported it, older versions of Perl used the +\&\s-1SA_RESTART\s0 flag when installing \f(CW%SIG\fR handlers. This meant that +restartable system calls would continue rather than returning when +a signal arrived. In order to deliver deferred signals promptly, +Perl 5.8.0 and later do \fInot\fR use \s-1SA_RESTART.\s0 Consequently, +restartable system calls can fail (with $! set to \f(CW\*(C`EINTR\*(C'\fR) in places +where they previously would have succeeded. +.Sp +The default \f(CW\*(C`:perlio\*(C'\fR layer retries \f(CW\*(C`read\*(C'\fR, \f(CW\*(C`write\*(C'\fR +and \f(CW\*(C`close\*(C'\fR as described above; interrupted \f(CW\*(C`wait\*(C'\fR and +\&\f(CW\*(C`waitpid\*(C'\fR calls will always be retried. +.ie n .IP "Signals as ""faults""" 4 +.el .IP "Signals as ``faults''" 4 +.IX Item "Signals as faults" +Certain signals like \s-1SEGV, ILL,\s0 and \s-1BUS\s0 are generated by virtual memory +addressing errors and similar \*(L"faults\*(R". These are normally fatal: there is +little a Perl-level handler can do with them. So Perl delivers them +immediately rather than attempting to defer them. +.IP "Signals triggered by operating system state" 4 +.IX Item "Signals triggered by operating system state" +On some operating systems certain signal handlers are supposed to \*(L"do +something\*(R" before returning. One example can be \s-1CHLD\s0 or \s-1CLD,\s0 which +indicates a child process has completed. On some operating systems the +signal handler is expected to \f(CW\*(C`wait\*(C'\fR for the completed child +process. On such systems the deferred signal scheme will not work for +those signals: it does not do the \f(CW\*(C`wait\*(C'\fR. Again the failure will +look like a loop as the operating system will reissue the signal because +there are completed child processes that have not yet been \f(CW\*(C`wait\*(C'\fRed for. +.PP +If you want the old signal behavior back despite possible +memory corruption, set the environment variable \f(CW\*(C`PERL_SIGNALS\*(C'\fR to +\&\f(CW"unsafe"\fR. This feature first appeared in Perl 5.8.1. +.SH "Named Pipes" +.IX Header "Named Pipes" +A named pipe (often referred to as a \s-1FIFO\s0) is an old Unix \s-1IPC\s0 +mechanism for processes communicating on the same machine. It works +just like regular anonymous pipes, except that the +processes rendezvous using a filename and need not be related. +.PP +To create a named pipe, use the \f(CW\*(C`POSIX::mkfifo()\*(C'\fR function. +.PP +.Vb 2 +\& use POSIX qw(mkfifo); +\& mkfifo($path, 0700) || die "mkfifo $path failed: $!"; +.Ve +.PP +You can also use the Unix command \fBmknod\fR\|(1), or on some +systems, \fBmkfifo\fR\|(1). These may not be in your normal path, though. +.PP +.Vb 8 +\& # system return val is backwards, so && not || +\& # +\& $ENV{PATH} .= ":/etc:/usr/etc"; +\& if ( system("mknod", $path, "p") +\& && system("mkfifo", $path) ) +\& { +\& die "mk{nod,fifo} $path failed"; +\& } +.Ve +.PP +A fifo is convenient when you want to connect a process to an unrelated +one. When you open a fifo, the program will block until there's something +on the other end. +.PP +For example, let's say you'd like to have your \fI.signature\fR file be a +named pipe that has a Perl program on the other end. Now every time any +program (like a mailer, news reader, finger program, etc.) tries to read +from that file, the reading program will read the new signature from your +program. We'll use the pipe-checking file-test operator, \fB\-p\fR, to find +out whether anyone (or anything) has accidentally removed our fifo. +.PP +.Vb 2 +\& chdir(); # go home +\& my $FIFO = ".signature"; +\& +\& while (1) { +\& unless (\-p $FIFO) { +\& unlink $FIFO; # discard any failure, will catch later +\& require POSIX; # delayed loading of heavy module +\& POSIX::mkfifo($FIFO, 0700) +\& || die "can\*(Aqt mkfifo $FIFO: $!"; +\& } +\& +\& # next line blocks till there\*(Aqs a reader +\& open (my $fh, ">", $FIFO) || die "can\*(Aqt open $FIFO: $!"; +\& print $fh "John Smith (smith\e@host.org)\en", \`fortune \-s\`; +\& close($fh) || die "can\*(Aqt close $FIFO: $!"; +\& sleep 2; # to avoid dup signals +\& } +.Ve +.SH "Using \fBopen()\fP for IPC" +.IX Header "Using open() for IPC" +Perl's basic \fBopen()\fR statement can also be used for unidirectional +interprocess communication by specifying the open mode as \f(CW\*(C`|\-\*(C'\fR or \f(CW\*(C`\-|\*(C'\fR. +Here's how to start +something up in a child process you intend to write to: +.PP +.Vb 5 +\& open(my $spooler, "|\-", "cat \-v | lpr \-h 2>/dev/null") +\& || die "can\*(Aqt fork: $!"; +\& local $SIG{PIPE} = sub { die "spooler pipe broke" }; +\& print $spooler "stuff\en"; +\& close $spooler || die "bad spool: $! $?"; +.Ve +.PP +And here's how to start up a child process you intend to read from: +.PP +.Vb 7 +\& open(my $status, "\-|", "netstat \-an 2>&1") +\& || die "can\*(Aqt fork: $!"; +\& while (<$status>) { +\& next if /^(tcp|udp)/; +\& print; +\& } +\& close $status || die "bad netstat: $! $?"; +.Ve +.PP +Be aware that these operations are full Unix forks, which means they may +not be correctly implemented on all alien systems. See \*(L"open\*(R" in perlport +for portability details. +.PP +In the two-argument form of \fBopen()\fR, a pipe open can be achieved by +either appending or prepending a pipe symbol to the second argument: +.PP +.Vb 4 +\& open(my $spooler, "| cat \-v | lpr \-h 2>/dev/null") +\& || die "can\*(Aqt fork: $!"; +\& open(my $status, "netstat \-an 2>&1 |") +\& || die "can\*(Aqt fork: $!"; +.Ve +.PP +This can be used even on systems that do not support forking, but this +possibly allows code intended to read files to unexpectedly execute +programs. If one can be sure that a particular program is a Perl script +expecting filenames in \f(CW@ARGV\fR using the two-argument form of \fBopen()\fR or the +\&\f(CW\*(C`<>\*(C'\fR operator, the clever programmer can write something like this: +.PP +.Vb 1 +\& % program f1 "cmd1|" \- f2 "cmd2|" f3 < tmpfile +.Ve +.PP +and no matter which sort of shell it's called from, the Perl program will +read from the file \fIf1\fR, the process \fIcmd1\fR, standard input (\fItmpfile\fR +in this case), the \fIf2\fR file, the \fIcmd2\fR command, and finally the \fIf3\fR +file. Pretty nifty, eh? +.PP +You might notice that you could use backticks for much the +same effect as opening a pipe for reading: +.PP +.Vb 2 +\& print grep { !/^(tcp|udp)/ } \`netstat \-an 2>&1\`; +\& die "bad netstatus ($?)" if $?; +.Ve +.PP +While this is true on the surface, it's much more efficient to process the +file one line or record at a time because then you don't have to read the +whole thing into memory at once. It also gives you finer control of the +whole process, letting you kill off the child process early if you'd like. +.PP +Be careful to check the return values from both \fBopen()\fR and \fBclose()\fR. If +you're \fIwriting\fR to a pipe, you should also trap \s-1SIGPIPE.\s0 Otherwise, +think of what happens when you start up a pipe to a command that doesn't +exist: the \fBopen()\fR will in all likelihood succeed (it only reflects the +\&\fBfork()\fR's success), but then your output will fail\*(--spectacularly. Perl +can't know whether the command worked, because your command is actually +running in a separate process whose \fBexec()\fR might have failed. Therefore, +while readers of bogus commands return just a quick \s-1EOF,\s0 writers +to bogus commands will get hit with a signal, which they'd best be prepared +to handle. Consider: +.PP +.Vb 4 +\& open(my $fh, "|\-", "bogus") || die "can\*(Aqt fork: $!"; +\& print $fh "bang\en"; # neither necessary nor sufficient +\& # to check print retval! +\& close($fh) || die "can\*(Aqt close: $!"; +.Ve +.PP +The reason for not checking the return value from \fBprint()\fR is because of +pipe buffering; physical writes are delayed. That won't blow up until the +close, and it will blow up with a \s-1SIGPIPE.\s0 To catch it, you could use +this: +.PP +.Vb 4 +\& $SIG{PIPE} = "IGNORE"; +\& open(my $fh, "|\-", "bogus") || die "can\*(Aqt fork: $!"; +\& print $fh "bang\en"; +\& close($fh) || die "can\*(Aqt close: status=$?"; +.Ve +.SS "Filehandles" +.IX Subsection "Filehandles" +Both the main process and any child processes it forks share the same +\&\s-1STDIN, STDOUT,\s0 and \s-1STDERR\s0 filehandles. If both processes try to access +them at once, strange things can happen. You may also want to close +or reopen the filehandles for the child. You can get around this by +opening your pipe with \fBopen()\fR, but on some systems this means that the +child process cannot outlive the parent. +.SS "Background Processes" +.IX Subsection "Background Processes" +You can run a command in the background with: +.PP +.Vb 1 +\& system("cmd &"); +.Ve +.PP +The command's \s-1STDOUT\s0 and \s-1STDERR\s0 (and possibly \s-1STDIN,\s0 depending on your +shell) will be the same as the parent's. You won't need to catch +\&\s-1SIGCHLD\s0 because of the double-fork taking place; see below for details. +.SS "Complete Dissociation of Child from Parent" +.IX Subsection "Complete Dissociation of Child from Parent" +In some cases (starting server processes, for instance) you'll want to +completely dissociate the child process from the parent. This is +often called daemonization. A well-behaved daemon will also \fBchdir()\fR +to the root directory so it doesn't prevent unmounting the filesystem +containing the directory from which it was launched, and redirect its +standard file descriptors from and to \fI/dev/null\fR so that random +output doesn't wind up on the user's terminal. +.PP +.Vb 1 +\& use POSIX "setsid"; +\& +\& sub daemonize { +\& chdir("/") || die "can\*(Aqt chdir to /: $!"; +\& open(STDIN, "<", "/dev/null") || die "can\*(Aqt read /dev/null: $!"; +\& open(STDOUT, ">", "/dev/null") || die "can\*(Aqt write /dev/null: $!"; +\& defined(my $pid = fork()) || die "can\*(Aqt fork: $!"; +\& exit if $pid; # non\-zero now means I am the parent +\& (setsid() != \-1) || die "Can\*(Aqt start a new session: $!"; +\& open(STDERR, ">&", STDOUT) || die "can\*(Aqt dup stdout: $!"; +\& } +.Ve +.PP +The \fBfork()\fR has to come before the \fBsetsid()\fR to ensure you aren't a +process group leader; the \fBsetsid()\fR will fail if you are. If your +system doesn't have the \fBsetsid()\fR function, open \fI/dev/tty\fR and use the +\&\f(CW\*(C`TIOCNOTTY\*(C'\fR \fBioctl()\fR on it instead. See \fBtty\fR\|(4) for details. +.PP +Non-Unix users should check their \f(CW\*(C`\f(CIYour_OS\f(CW::Process\*(C'\fR module for +other possible solutions. +.SS "Safe Pipe Opens" +.IX Subsection "Safe Pipe Opens" +Another interesting approach to \s-1IPC\s0 is making your single program go +multiprocess and communicate between\*(--or even amongst\*(--yourselves. The +two-argument form of the +\&\fBopen()\fR function will accept a file argument of either \f(CW"\-|"\fR or \f(CW"|\-"\fR +to do a very interesting thing: it forks a child connected to the +filehandle you've opened. The child is running the same program as the +parent. This is useful for safely opening a file when running under an +assumed \s-1UID\s0 or \s-1GID,\s0 for example. If you open a pipe \fIto\fR minus, you can +write to the filehandle you opened and your kid will find it in \fIhis\fR +\&\s-1STDIN.\s0 If you open a pipe \fIfrom\fR minus, you can read from the filehandle +you opened whatever your kid writes to \fIhis\fR \s-1STDOUT.\s0 +.PP +.Vb 4 +\& my $PRECIOUS = "/path/to/some/safe/file"; +\& my $sleep_count; +\& my $pid; +\& my $kid_to_write; +\& +\& do { +\& $pid = open($kid_to_write, "|\-"); +\& unless (defined $pid) { +\& warn "cannot fork: $!"; +\& die "bailing out" if $sleep_count++ > 6; +\& sleep 10; +\& } +\& } until defined $pid; +\& +\& if ($pid) { # I am the parent +\& print $kid_to_write @some_data; +\& close($kid_to_write) || warn "kid exited $?"; +\& } else { # I am the child +\& # drop permissions in setuid and/or setgid programs: +\& ($>, $)) = ($<, $(); +\& open (my $outfile, ">", $PRECIOUS) +\& || die "can\*(Aqt open $PRECIOUS: $!"; +\& while () { +\& print $outfile; # child STDIN is parent $kid_to_write +\& } +\& close($outfile) || die "can\*(Aqt close $PRECIOUS: $!"; +\& exit(0); # don\*(Aqt forget this!! +\& } +.Ve +.PP +Another common use for this construct is when you need to execute +something without the shell's interference. With \fBsystem()\fR, it's +straightforward, but you can't use a pipe open or backticks safely. +That's because there's no way to stop the shell from getting its hands on +your arguments. Instead, use lower-level control to call \fBexec()\fR directly. +.PP +Here's a safe backtick or pipe open for read: +.PP +.Vb 2 +\& my $pid = open(my $kid_to_read, "\-|"); +\& defined($pid) || die "can\*(Aqt fork: $!"; +\& +\& if ($pid) { # parent +\& while (<$kid_to_read>) { +\& # do something interesting +\& } +\& close($kid_to_read) || warn "kid exited $?"; +\& +\& } else { # child +\& ($>, $)) = ($<, $(); # suid only +\& exec($program, @options, @args) +\& || die "can\*(Aqt exec program: $!"; +\& # NOTREACHED +\& } +.Ve +.PP +And here's a safe pipe open for writing: +.PP +.Vb 2 +\& my $pid = open(my $kid_to_write, "|\-"); +\& defined($pid) || die "can\*(Aqt fork: $!"; +\& +\& $SIG{PIPE} = sub { die "whoops, $program pipe broke" }; +\& +\& if ($pid) { # parent +\& print $kid_to_write @data; +\& close($kid_to_write) || warn "kid exited $?"; +\& +\& } else { # child +\& ($>, $)) = ($<, $(); +\& exec($program, @options, @args) +\& || die "can\*(Aqt exec program: $!"; +\& # NOTREACHED +\& } +.Ve +.PP +It is very easy to dead-lock a process using this form of \fBopen()\fR, or +indeed with any use of \fBpipe()\fR with multiple subprocesses. The +example above is \*(L"safe\*(R" because it is simple and calls \fBexec()\fR. See +\&\*(L"Avoiding Pipe Deadlocks\*(R" for general safety principles, but there +are extra gotchas with Safe Pipe Opens. +.PP +In particular, if you opened the pipe using \f(CW\*(C`open $fh, "|\-"\*(C'\fR, then you +cannot simply use \fBclose()\fR in the parent process to close an unwanted +writer. Consider this code: +.PP +.Vb 10 +\& my $pid = open(my $writer, "|\-"); # fork open a kid +\& defined($pid) || die "first fork failed: $!"; +\& if ($pid) { +\& if (my $sub_pid = fork()) { +\& defined($sub_pid) || die "second fork failed: $!"; +\& close($writer) || die "couldn\*(Aqt close writer: $!"; +\& # now do something else... +\& } +\& else { +\& # first write to $writer +\& # ... +\& # then when finished +\& close($writer) || die "couldn\*(Aqt close writer: $!"; +\& exit(0); +\& } +\& } +\& else { +\& # first do something with STDIN, then +\& exit(0); +\& } +.Ve +.PP +In the example above, the true parent does not want to write to the \f(CW$writer\fR +filehandle, so it closes it. However, because \f(CW$writer\fR was opened using +\&\f(CW\*(C`open $fh, "|\-"\*(C'\fR, it has a special behavior: closing it calls +\&\fBwaitpid()\fR (see \*(L"waitpid\*(R" in perlfunc), which waits for the subprocess +to exit. If the child process ends up waiting for something happening +in the section marked \*(L"do something else\*(R", you have deadlock. +.PP +This can also be a problem with intermediate subprocesses in more +complicated code, which will call \fBwaitpid()\fR on all open filehandles +during global destruction\*(--in no predictable order. +.PP +To solve this, you must manually use \fBpipe()\fR, \fBfork()\fR, and the form of +\&\fBopen()\fR which sets one file descriptor to another, as shown below: +.PP +.Vb 10 +\& pipe(my $reader, my $writer) || die "pipe failed: $!"; +\& my $pid = fork(); +\& defined($pid) || die "first fork failed: $!"; +\& if ($pid) { +\& close $reader; +\& if (my $sub_pid = fork()) { +\& defined($sub_pid) || die "first fork failed: $!"; +\& close($writer) || die "can\*(Aqt close writer: $!"; +\& } +\& else { +\& # write to $writer... +\& # ... +\& # then when finished +\& close($writer) || die "can\*(Aqt close writer: $!"; +\& exit(0); +\& } +\& # write to $writer... +\& } +\& else { +\& open(STDIN, "<&", $reader) || die "can\*(Aqt reopen STDIN: $!"; +\& close($writer) || die "can\*(Aqt close writer: $!"; +\& # do something... +\& exit(0); +\& } +.Ve +.PP +Since Perl 5.8.0, you can also use the list form of \f(CW\*(C`open\*(C'\fR for pipes. +This is preferred when you wish to avoid having the shell interpret +metacharacters that may be in your command string. +.PP +So for example, instead of using: +.PP +.Vb 1 +\& open(my $ps_pipe, "\-|", "ps aux") || die "can\*(Aqt open ps pipe: $!"; +.Ve +.PP +One would use either of these: +.PP +.Vb 2 +\& open(my $ps_pipe, "\-|", "ps", "aux") +\& || die "can\*(Aqt open ps pipe: $!"; +\& +\& my @ps_args = qw[ ps aux ]; +\& open(my $ps_pipe, "\-|", @ps_args) +\& || die "can\*(Aqt open @ps_args|: $!"; +.Ve +.PP +Because there are more than three arguments to \fBopen()\fR, it forks the \fBps\fR\|(1) +command \fIwithout\fR spawning a shell, and reads its standard output via the +\&\f(CW$ps_pipe\fR filehandle. The corresponding syntax to \fIwrite\fR to command +pipes is to use \f(CW"|\-"\fR in place of \f(CW"\-|"\fR. +.PP +This was admittedly a rather silly example, because you're using string +literals whose content is perfectly safe. There is therefore no cause to +resort to the harder-to-read, multi-argument form of pipe \fBopen()\fR. However, +whenever you cannot be assured that the program arguments are free of shell +metacharacters, the fancier form of \fBopen()\fR should be used. For example: +.PP +.Vb 3 +\& my @grep_args = ("egrep", "\-i", $some_pattern, @many_files); +\& open(my $grep_pipe, "\-|", @grep_args) +\& || die "can\*(Aqt open @grep_args|: $!"; +.Ve +.PP +Here the multi-argument form of pipe \fBopen()\fR is preferred because the +pattern and indeed even the filenames themselves might hold metacharacters. +.SS "Avoiding Pipe Deadlocks" +.IX Subsection "Avoiding Pipe Deadlocks" +Whenever you have more than one subprocess, you must be careful that each +closes whichever half of any pipes created for interprocess communication +it is not using. This is because any child process reading from the pipe +and expecting an \s-1EOF\s0 will never receive it, and therefore never exit. A +single process closing a pipe is not enough to close it; the last process +with the pipe open must close it for it to read \s-1EOF.\s0 +.PP +Certain built-in Unix features help prevent this most of the time. For +instance, filehandles have a \*(L"close on exec\*(R" flag, which is set \fIen masse\fR +under control of the \f(CW$^F\fR variable. This is so any filehandles you +didn't explicitly route to the \s-1STDIN, STDOUT\s0 or \s-1STDERR\s0 of a child +\&\fIprogram\fR will be automatically closed. +.PP +Always explicitly and immediately call \fBclose()\fR on the writable end of any +pipe, unless that process is actually writing to it. Even if you don't +explicitly call \fBclose()\fR, Perl will still \fBclose()\fR all filehandles during +global destruction. As previously discussed, if those filehandles have +been opened with Safe Pipe Open, this will result in calling \fBwaitpid()\fR, +which may again deadlock. +.SS "Bidirectional Communication with Another Process" +.IX Subsection "Bidirectional Communication with Another Process" +While this works reasonably well for unidirectional communication, what +about bidirectional communication? The most obvious approach doesn't work: +.PP +.Vb 2 +\& # THIS DOES NOT WORK!! +\& open(my $prog_for_reading_and_writing, "| some program |") +.Ve +.PP +If you forget to \f(CW\*(C`use warnings\*(C'\fR, you'll miss out entirely on the +helpful diagnostic message: +.PP +.Vb 1 +\& Can\*(Aqt do bidirectional pipe at \-e line 1. +.Ve +.PP +If you really want to, you can use the standard \fBopen2()\fR from the +IPC::Open2 module to catch both ends. There's also an \fBopen3()\fR in +IPC::Open3 for tridirectional I/O so you can also catch your child's +\&\s-1STDERR,\s0 but doing so would then require an awkward \fBselect()\fR loop and +wouldn't allow you to use normal Perl input operations. +.PP +If you look at its source, you'll see that \fBopen2()\fR uses low-level +primitives like the \fBpipe()\fR and \fBexec()\fR syscalls to create all the +connections. Although it might have been more efficient by using +\&\fBsocketpair()\fR, this would have been even less portable than it already +is. The \fBopen2()\fR and \fBopen3()\fR functions are unlikely to work anywhere +except on a Unix system, or at least one purporting \s-1POSIX\s0 compliance. +.PP +Here's an example of using \fBopen2()\fR: +.PP +.Vb 5 +\& use IPC::Open2; +\& my $pid = open2(my $reader, my $writer, "cat \-un"); +\& print $writer "stuff\en"; +\& my $got = <$reader>; +\& waitpid $pid, 0; +.Ve +.PP +The problem with this is that buffering is really going to ruin your +day. Even though your \f(CW$writer\fR filehandle is auto-flushed so the process +on the other end gets your data in a timely manner, you can't usually do +anything to force that process to give its data to you in a similarly quick +fashion. In this special case, we could actually so, because we gave +\&\fIcat\fR a \fB\-u\fR flag to make it unbuffered. But very few commands are +designed to operate over pipes, so this seldom works unless you yourself +wrote the program on the other end of the double-ended pipe. +.PP +A solution to this is to use a library which uses pseudottys to make your +program behave more reasonably. This way you don't have to have control +over the source code of the program you're using. The \f(CW\*(C`Expect\*(C'\fR module +from \s-1CPAN\s0 also addresses this kind of thing. This module requires two +other modules from \s-1CPAN,\s0 \f(CW\*(C`IO::Pty\*(C'\fR and \f(CW\*(C`IO::Stty\*(C'\fR. It sets up a pseudo +terminal to interact with programs that insist on talking to the terminal +device driver. If your system is supported, this may be your best bet. +.SS "Bidirectional Communication with Yourself" +.IX Subsection "Bidirectional Communication with Yourself" +If you want, you may make low-level \fBpipe()\fR and \fBfork()\fR syscalls to stitch +this together by hand. This example only talks to itself, but you could +reopen the appropriate handles to \s-1STDIN\s0 and \s-1STDOUT\s0 and call other processes. +(The following example lacks proper error checking.) +.PP +.Vb 10 +\& #!/usr/bin/perl +\& # pipe1 \- bidirectional communication using two pipe pairs +\& # designed for the socketpair\-challenged +\& use strict; +\& use warnings; +\& use IO::Handle; # enable autoflush method before Perl 5.14 +\& pipe(my $parent_rdr, my $child_wtr); # XXX: check failure? +\& pipe(my $child_rdr, my $parent_wtr); # XXX: check failure? +\& $child_wtr\->autoflush(1); +\& $parent_wtr\->autoflush(1); +\& +\& if ($pid = fork()) { +\& close $parent_rdr; +\& close $parent_wtr; +\& print $child_wtr "Parent Pid $$ is sending this\en"; +\& chomp(my $line = <$child_rdr>); +\& print "Parent Pid $$ just read this: \*(Aq$line\*(Aq\en"; +\& close $child_rdr; close $child_wtr; +\& waitpid($pid, 0); +\& } else { +\& die "cannot fork: $!" unless defined $pid; +\& close $child_rdr; +\& close $child_wtr; +\& chomp(my $line = <$parent_rdr>); +\& print "Child Pid $$ just read this: \*(Aq$line\*(Aq\en"; +\& print $parent_wtr "Child Pid $$ is sending this\en"; +\& close $parent_rdr; +\& close $parent_wtr; +\& exit(0); +\& } +.Ve +.PP +But you don't actually have to make two pipe calls. If you +have the \fBsocketpair()\fR system call, it will do this all for you. +.PP +.Vb 3 +\& #!/usr/bin/perl +\& # pipe2 \- bidirectional communication using socketpair +\& # "the best ones always go both ways" +\& +\& use strict; +\& use warnings; +\& use Socket; +\& use IO::Handle; # enable autoflush method before Perl 5.14 +\& +\& # We say AF_UNIX because although *_LOCAL is the +\& # POSIX 1003.1g form of the constant, many machines +\& # still don\*(Aqt have it. +\& socketpair(my $child, my $parent, AF_UNIX, SOCK_STREAM, PF_UNSPEC) +\& || die "socketpair: $!"; +\& +\& $child\->autoflush(1); +\& $parent\->autoflush(1); +\& +\& if ($pid = fork()) { +\& close $parent; +\& print $child "Parent Pid $$ is sending this\en"; +\& chomp(my $line = <$child>); +\& print "Parent Pid $$ just read this: \*(Aq$line\*(Aq\en"; +\& close $child; +\& waitpid($pid, 0); +\& } else { +\& die "cannot fork: $!" unless defined $pid; +\& close $child; +\& chomp(my $line = <$parent>); +\& print "Child Pid $$ just read this: \*(Aq$line\*(Aq\en"; +\& print $parent "Child Pid $$ is sending this\en"; +\& close $parent; +\& exit(0); +\& } +.Ve +.SH "Sockets: Client/Server Communication" +.IX Header "Sockets: Client/Server Communication" +While not entirely limited to Unix-derived operating systems (e.g., WinSock +on PCs provides socket support, as do some \s-1VMS\s0 libraries), you might not have +sockets on your system, in which case this section probably isn't going to +do you much good. With sockets, you can do both virtual circuits like \s-1TCP\s0 +streams and datagrams like \s-1UDP\s0 packets. You may be able to do even more +depending on your system. +.PP +The Perl functions for dealing with sockets have the same names as +the corresponding system calls in C, but their arguments tend to differ +for two reasons. First, Perl filehandles work differently than C file +descriptors. Second, Perl already knows the length of its strings, so you +don't need to pass that information. +.PP +One of the major problems with ancient, antemillennial socket code in Perl +was that it used hard-coded values for some of the constants, which +severely hurt portability. If you ever see code that does anything like +explicitly setting \f(CW\*(C`$AF_INET = 2\*(C'\fR, you know you're in for big trouble. +An immeasurably superior approach is to use the Socket module, which more +reliably grants access to the various constants and functions you'll need. +.PP +If you're not writing a server/client for an existing protocol like +\&\s-1NNTP\s0 or \s-1SMTP,\s0 you should give some thought to how your server will +know when the client has finished talking, and vice-versa. Most +protocols are based on one-line messages and responses (so one party +knows the other has finished when a \*(L"\en\*(R" is received) or multi-line +messages and responses that end with a period on an empty line +(\*(L"\en.\en\*(R" terminates a message/response). +.SS "Internet Line Terminators" +.IX Subsection "Internet Line Terminators" +The Internet line terminator is \*(L"\e015\e012\*(R". Under \s-1ASCII\s0 variants of +Unix, that could usually be written as \*(L"\er\en\*(R", but under other systems, +\&\*(L"\er\en\*(R" might at times be \*(L"\e015\e015\e012\*(R", \*(L"\e012\e012\e015\*(R", or something +completely different. The standards specify writing \*(L"\e015\e012\*(R" to be +conformant (be strict in what you provide), but they also recommend +accepting a lone \*(L"\e012\*(R" on input (be lenient in what you require). +We haven't always been very good about that in the code in this manpage, +but unless you're on a Mac from way back in its pre-Unix dark ages, you'll +probably be ok. +.SS "Internet \s-1TCP\s0 Clients and Servers" +.IX Subsection "Internet TCP Clients and Servers" +Use Internet-domain sockets when you want to do client-server +communication that might extend to machines outside of your own system. +.PP +Here's a sample \s-1TCP\s0 client using Internet-domain sockets: +.PP +.Vb 4 +\& #!/usr/bin/perl +\& use strict; +\& use warnings; +\& use Socket; +\& +\& my $remote = shift || "localhost"; +\& my $port = shift || 2345; # random port +\& if ($port =~ /\eD/) { $port = getservbyname($port, "tcp") } +\& die "No port" unless $port; +\& my $iaddr = inet_aton($remote) || die "no host: $remote"; +\& my $paddr = sockaddr_in($port, $iaddr); +\& +\& my $proto = getprotobyname("tcp"); +\& socket(my $sock, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; +\& connect($sock, $paddr) || die "connect: $!"; +\& while (my $line = <$sock>) { +\& print $line; +\& } +\& +\& close ($sock) || die "close: $!"; +\& exit(0); +.Ve +.PP +And here's a corresponding server to go along with it. We'll +leave the address as \f(CW\*(C`INADDR_ANY\*(C'\fR so that the kernel can choose +the appropriate interface on multihomed hosts. If you want sit +on a particular interface (like the external side of a gateway +or firewall machine), fill this in with your real address instead. +.PP +.Vb 7 +\& #!/usr/bin/perl \-T +\& use strict; +\& use warnings; +\& BEGIN { $ENV{PATH} = "/usr/bin:/bin" } +\& use Socket; +\& use Carp; +\& my $EOL = "\e015\e012"; +\& +\& sub logmsg { print "$0 $$: @_ at ", scalar localtime(), "\en" } +\& +\& my $port = shift || 2345; +\& die "invalid port" unless $port =~ /^ \ed+ $/x; +\& +\& my $proto = getprotobyname("tcp"); +\& +\& socket(my $server, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; +\& setsockopt($server, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) +\& || die "setsockopt: $!"; +\& bind($server, sockaddr_in($port, INADDR_ANY)) || die "bind: $!"; +\& listen($server, SOMAXCONN) || die "listen: $!"; +\& +\& logmsg "server started on port $port"; +\& +\& for (my $paddr; $paddr = accept(my $client, $server); close $client) { +\& my($port, $iaddr) = sockaddr_in($paddr); +\& my $name = gethostbyaddr($iaddr, AF_INET); +\& +\& logmsg "connection from $name [", +\& inet_ntoa($iaddr), "] +\& at port $port"; +\& +\& print $client "Hello there, $name, it\*(Aqs now ", +\& scalar localtime(), $EOL; +\& } +.Ve +.PP +And here's a multitasking version. It's multitasked in that +like most typical servers, it spawns (\fBfork()\fRs) a slave server to +handle the client request so that the master server can quickly +go back to service a new client. +.PP +.Vb 7 +\& #!/usr/bin/perl \-T +\& use strict; +\& use warnings; +\& BEGIN { $ENV{PATH} = "/usr/bin:/bin" } +\& use Socket; +\& use Carp; +\& my $EOL = "\e015\e012"; +\& +\& sub spawn; # forward declaration +\& sub logmsg { print "$0 $$: @_ at ", scalar localtime(), "\en" } +\& +\& my $port = shift || 2345; +\& die "invalid port" unless $port =~ /^ \ed+ $/x; +\& +\& my $proto = getprotobyname("tcp"); +\& +\& socket(my $server, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; +\& setsockopt($server, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) +\& || die "setsockopt: $!"; +\& bind($server, sockaddr_in($port, INADDR_ANY)) || die "bind: $!"; +\& listen($server, SOMAXCONN) || die "listen: $!"; +\& +\& logmsg "server started on port $port"; +\& +\& my $waitedpid = 0; +\& +\& use POSIX ":sys_wait_h"; +\& use Errno; +\& +\& sub REAPER { +\& local $!; # don\*(Aqt let waitpid() overwrite current error +\& while ((my $pid = waitpid(\-1, WNOHANG)) > 0 && WIFEXITED($?)) { +\& logmsg "reaped $waitedpid" . ($? ? " with exit $?" : ""); +\& } +\& $SIG{CHLD} = \e&REAPER; # loathe SysV +\& } +\& +\& $SIG{CHLD} = \e&REAPER; +\& +\& while (1) { +\& my $paddr = accept(my $client, $server) || do { +\& # try again if accept() returned because got a signal +\& next if $!{EINTR}; +\& die "accept: $!"; +\& }; +\& my ($port, $iaddr) = sockaddr_in($paddr); +\& my $name = gethostbyaddr($iaddr, AF_INET); +\& +\& logmsg "connection from $name [", +\& inet_ntoa($iaddr), +\& "] at port $port"; +\& +\& spawn $client, sub { +\& $| = 1; +\& print "Hello there, $name, it\*(Aqs now ", +\& scalar localtime(), +\& $EOL; +\& exec "/usr/games/fortune" # XXX: "wrong" line terminators +\& or confess "can\*(Aqt exec fortune: $!"; +\& }; +\& close $client; +\& } +\& +\& sub spawn { +\& my $client = shift; +\& my $coderef = shift; +\& +\& unless (@_ == 0 && $coderef && ref($coderef) eq "CODE") { +\& confess "usage: spawn CLIENT CODEREF"; +\& } +\& +\& my $pid; +\& unless (defined($pid = fork())) { +\& logmsg "cannot fork: $!"; +\& return; +\& } +\& elsif ($pid) { +\& logmsg "begat $pid"; +\& return; # I\*(Aqm the parent +\& } +\& # else I\*(Aqm the child \-\- go spawn +\& +\& open(STDIN, "<&", $client) || die "can\*(Aqt dup client to stdin"; +\& open(STDOUT, ">&", $client) || die "can\*(Aqt dup client to stdout"; +\& ## open(STDERR, ">&", STDOUT) || die "can\*(Aqt dup stdout to stderr"; +\& exit($coderef\->()); +\& } +.Ve +.PP +This server takes the trouble to clone off a child version via \fBfork()\fR +for each incoming request. That way it can handle many requests at +once, which you might not always want. Even if you don't \fBfork()\fR, the +\&\fBlisten()\fR will allow that many pending connections. Forking servers +have to be particularly careful about cleaning up their dead children +(called \*(L"zombies\*(R" in Unix parlance), because otherwise you'll quickly +fill up your process table. The \s-1REAPER\s0 subroutine is used here to +call \fBwaitpid()\fR for any child processes that have finished, thereby +ensuring that they terminate cleanly and don't join the ranks of the +living dead. +.PP +Within the while loop we call \fBaccept()\fR and check to see if it returns +a false value. This would normally indicate a system error needs +to be reported. However, the introduction of safe signals (see +\&\*(L"Deferred Signals (Safe Signals)\*(R" above) in Perl 5.8.0 means that +\&\fBaccept()\fR might also be interrupted when the process receives a signal. +This typically happens when one of the forked subprocesses exits and +notifies the parent process with a \s-1CHLD\s0 signal. +.PP +If \fBaccept()\fR is interrupted by a signal, $! will be set to \s-1EINTR.\s0 +If this happens, we can safely continue to the next iteration of +the loop and another call to \fBaccept()\fR. It is important that your +signal handling code not modify the value of $!, or else this test +will likely fail. In the \s-1REAPER\s0 subroutine we create a local version +of $! before calling \fBwaitpid()\fR. When \fBwaitpid()\fR sets $! to \s-1ECHILD\s0 as +it inevitably does when it has no more children waiting, it +updates the local copy and leaves the original unchanged. +.PP +You should use the \fB\-T\fR flag to enable taint checking (see perlsec) +even if we aren't running setuid or setgid. This is always a good idea +for servers or any program run on behalf of someone else (like \s-1CGI\s0 +scripts), because it lessens the chances that people from the outside will +be able to compromise your system. +.PP +Let's look at another \s-1TCP\s0 client. This one connects to the \s-1TCP\s0 \*(L"time\*(R" +service on a number of different machines and shows how far their clocks +differ from the system on which it's being run: +.PP +.Vb 4 +\& #!/usr/bin/perl +\& use strict; +\& use warnings; +\& use Socket; +\& +\& my $SECS_OF_70_YEARS = 2208988800; +\& sub ctime { scalar localtime(shift() || time()) } +\& +\& my $iaddr = gethostbyname("localhost"); +\& my $proto = getprotobyname("tcp"); +\& my $port = getservbyname("time", "tcp"); +\& my $paddr = sockaddr_in(0, $iaddr); +\& +\& $| = 1; +\& printf "%\-24s %8s %s\en", "localhost", 0, ctime(); +\& +\& foreach my $host (@ARGV) { +\& printf "%\-24s ", $host; +\& my $hisiaddr = inet_aton($host) || die "unknown host"; +\& my $hispaddr = sockaddr_in($port, $hisiaddr); +\& socket(my $socket, PF_INET, SOCK_STREAM, $proto) +\& || die "socket: $!"; +\& connect($socket, $hispaddr) || die "connect: $!"; +\& my $rtime = pack("C4", ()); +\& read($socket, $rtime, 4); +\& close($socket); +\& my $histime = unpack("N", $rtime) \- $SECS_OF_70_YEARS; +\& printf "%8d %s\en", $histime \- time(), ctime($histime); +\& } +.Ve +.SS "Unix-Domain \s-1TCP\s0 Clients and Servers" +.IX Subsection "Unix-Domain TCP Clients and Servers" +That's fine for Internet-domain clients and servers, but what about local +communications? While you can use the same setup, sometimes you don't +want to. Unix-domain sockets are local to the current host, and are often +used internally to implement pipes. Unlike Internet domain sockets, Unix +domain sockets can show up in the file system with an \fBls\fR\|(1) listing. +.PP +.Vb 2 +\& % ls \-l /dev/log +\& srw\-rw\-rw\- 1 root 0 Oct 31 07:23 /dev/log +.Ve +.PP +You can test for these with Perl's \fB\-S\fR file test: +.PP +.Vb 3 +\& unless (\-S "/dev/log") { +\& die "something\*(Aqs wicked with the log system"; +\& } +.Ve +.PP +Here's a sample Unix-domain client: +.PP +.Vb 4 +\& #!/usr/bin/perl +\& use Socket; +\& use strict; +\& use warnings; +\& +\& my $rendezvous = shift || "catsock"; +\& socket(my $sock, PF_UNIX, SOCK_STREAM, 0) || die "socket: $!"; +\& connect($sock, sockaddr_un($rendezvous)) || die "connect: $!"; +\& while (defined(my $line = <$sock>)) { +\& print $line; +\& } +\& exit(0); +.Ve +.PP +And here's a corresponding server. You don't have to worry about silly +network terminators here because Unix domain sockets are guaranteed +to be on the localhost, and thus everything works right. +.PP +.Vb 5 +\& #!/usr/bin/perl \-T +\& use strict; +\& use warnings; +\& use Socket; +\& use Carp; +\& +\& BEGIN { $ENV{PATH} = "/usr/bin:/bin" } +\& sub spawn; # forward declaration +\& sub logmsg { print "$0 $$: @_ at ", scalar localtime(), "\en" } +\& +\& my $NAME = "catsock"; +\& my $uaddr = sockaddr_un($NAME); +\& my $proto = getprotobyname("tcp"); +\& +\& socket(my $server, PF_UNIX, SOCK_STREAM, 0) || die "socket: $!"; +\& unlink($NAME); +\& bind ($server, $uaddr) || die "bind: $!"; +\& listen($server, SOMAXCONN) || die "listen: $!"; +\& +\& logmsg "server started on $NAME"; +\& +\& my $waitedpid; +\& +\& use POSIX ":sys_wait_h"; +\& sub REAPER { +\& my $child; +\& while (($waitedpid = waitpid(\-1, WNOHANG)) > 0) { +\& logmsg "reaped $waitedpid" . ($? ? " with exit $?" : ""); +\& } +\& $SIG{CHLD} = \e&REAPER; # loathe SysV +\& } +\& +\& $SIG{CHLD} = \e&REAPER; +\& +\& +\& for ( $waitedpid = 0; +\& accept(my $client, $server) || $waitedpid; +\& $waitedpid = 0, close $client) +\& { +\& next if $waitedpid; +\& logmsg "connection on $NAME"; +\& spawn $client, sub { +\& print "Hello there, it\*(Aqs now ", scalar localtime(), "\en"; +\& exec("/usr/games/fortune") || die "can\*(Aqt exec fortune: $!"; +\& }; +\& } +\& +\& sub spawn { +\& my $client = shift(); +\& my $coderef = shift(); +\& +\& unless (@_ == 0 && $coderef && ref($coderef) eq "CODE") { +\& confess "usage: spawn CLIENT CODEREF"; +\& } +\& +\& my $pid; +\& unless (defined($pid = fork())) { +\& logmsg "cannot fork: $!"; +\& return; +\& } +\& elsif ($pid) { +\& logmsg "begat $pid"; +\& return; # I\*(Aqm the parent +\& } +\& else { +\& # I\*(Aqm the child \-\- go spawn +\& } +\& +\& open(STDIN, "<&", $client) +\& || die "can\*(Aqt dup client to stdin"; +\& open(STDOUT, ">&", $client) +\& || die "can\*(Aqt dup client to stdout"; +\& ## open(STDERR, ">&", STDOUT) +\& ## || die "can\*(Aqt dup stdout to stderr"; +\& exit($coderef\->()); +\& } +.Ve +.PP +As you see, it's remarkably similar to the Internet domain \s-1TCP\s0 server, so +much so, in fact, that we've omitted several duplicate functions\*(--\fBspawn()\fR, +\&\fBlogmsg()\fR, \fBctime()\fR, and \s-1\fBREAPER\s0()\fR\-\-which are the same as in the other server. +.PP +So why would you ever want to use a Unix domain socket instead of a +simpler named pipe? Because a named pipe doesn't give you sessions. You +can't tell one process's data from another's. With socket programming, +you get a separate session for each client; that's why \fBaccept()\fR takes two +arguments. +.PP +For example, let's say that you have a long-running database server daemon +that you want folks to be able to access from the Web, but only +if they go through a \s-1CGI\s0 interface. You'd have a small, simple \s-1CGI\s0 +program that does whatever checks and logging you feel like, and then acts +as a Unix-domain client and connects to your private server. +.SH "TCP Clients with IO::Socket" +.IX Header "TCP Clients with IO::Socket" +For those preferring a higher-level interface to socket programming, the +IO::Socket module provides an object-oriented approach. If for some reason +you lack this module, you can just fetch IO::Socket from \s-1CPAN,\s0 where you'll also +find modules providing easy interfaces to the following systems: \s-1DNS, FTP,\s0 +Ident (\s-1RFC 931\s0), \s-1NIS\s0 and NISPlus, \s-1NNTP,\s0 Ping, \s-1POP3, SMTP, SNMP,\s0 SSLeay, +Telnet, and Time\*(--to name just a few. +.SS "A Simple Client" +.IX Subsection "A Simple Client" +Here's a client that creates a \s-1TCP\s0 connection to the \*(L"daytime\*(R" +service at port 13 of the host name \*(L"localhost\*(R" and prints out everything +that the server there cares to provide. +.PP +.Vb 11 +\& #!/usr/bin/perl +\& use strict; +\& use warnings; +\& use IO::Socket; +\& my $remote = IO::Socket::INET\->new( +\& Proto => "tcp", +\& PeerAddr => "localhost", +\& PeerPort => "daytime(13)", +\& ) +\& || die "can\*(Aqt connect to daytime service on localhost"; +\& while (<$remote>) { print } +.Ve +.PP +When you run this program, you should get something back that +looks like this: +.PP +.Vb 1 +\& Wed May 14 08:40:46 MDT 1997 +.Ve +.PP +Here are what those parameters to the \fBnew()\fR constructor mean: +.ie n .IP """Proto""" 4 +.el .IP "\f(CWProto\fR" 4 +.IX Item "Proto" +This is which protocol to use. In this case, the socket handle returned +will be connected to a \s-1TCP\s0 socket, because we want a stream-oriented +connection, that is, one that acts pretty much like a plain old file. +Not all sockets are this of this type. For example, the \s-1UDP\s0 protocol +can be used to make a datagram socket, used for message-passing. +.ie n .IP """PeerAddr""" 4 +.el .IP "\f(CWPeerAddr\fR" 4 +.IX Item "PeerAddr" +This is the name or Internet address of the remote host the server is +running on. We could have specified a longer name like \f(CW"www.perl.com"\fR, +or an address like \f(CW"207.171.7.72"\fR. For demonstration purposes, we've +used the special hostname \f(CW"localhost"\fR, which should always mean the +current machine you're running on. The corresponding Internet address +for localhost is \f(CW"127.0.0.1"\fR, if you'd rather use that. +.ie n .IP """PeerPort""" 4 +.el .IP "\f(CWPeerPort\fR" 4 +.IX Item "PeerPort" +This is the service name or port number we'd like to connect to. +We could have gotten away with using just \f(CW"daytime"\fR on systems with a +well-configured system services file,[\s-1FOOTNOTE:\s0 The system services file +is found in \fI/etc/services\fR under Unixy systems.] but here we've specified the +port number (13) in parentheses. Using just the number would have also +worked, but numeric literals make careful programmers nervous. +.SS "A Webget Client" +.IX Subsection "A Webget Client" +Here's a simple client that takes a remote host to fetch a document +from, and then a list of files to get from that host. This is a +more interesting client than the previous one because it first sends +something to the server before fetching the server's response. +.PP +.Vb 10 +\& #!/usr/bin/perl +\& use strict; +\& use warnings; +\& use IO::Socket; +\& unless (@ARGV > 1) { die "usage: $0 host url ..." } +\& my $host = shift(@ARGV); +\& my $EOL = "\e015\e012"; +\& my $BLANK = $EOL x 2; +\& for my $document (@ARGV) { +\& my $remote = IO::Socket::INET\->new( Proto => "tcp", +\& PeerAddr => $host, +\& PeerPort => "http(80)", +\& ) || die "cannot connect to httpd on $host"; +\& $remote\->autoflush(1); +\& print $remote "GET $document HTTP/1.0" . $BLANK; +\& while ( <$remote> ) { print } +\& close $remote; +\& } +.Ve +.PP +The web server handling the \s-1HTTP\s0 service is assumed to be at +its standard port, number 80. If the server you're trying to +connect to is at a different port, like 1080 or 8080, you should specify it +as the named-parameter pair, \f(CW\*(C`PeerPort => 8080\*(C'\fR. The \f(CW\*(C`autoflush\*(C'\fR +method is used on the socket because otherwise the system would buffer +up the output we sent it. (If you're on a prehistoric Mac, you'll also +need to change every \f(CW"\en"\fR in your code that sends data over the network +to be a \f(CW"\e015\e012"\fR instead.) +.PP +Connecting to the server is only the first part of the process: once you +have the connection, you have to use the server's language. Each server +on the network has its own little command language that it expects as +input. The string that we send to the server starting with \*(L"\s-1GET\*(R"\s0 is in +\&\s-1HTTP\s0 syntax. In this case, we simply request each specified document. +Yes, we really are making a new connection for each document, even though +it's the same host. That's the way you always used to have to speak \s-1HTTP.\s0 +Recent versions of web browsers may request that the remote server leave +the connection open a little while, but the server doesn't have to honor +such a request. +.PP +Here's an example of running that program, which we'll call \fIwebget\fR: +.PP +.Vb 6 +\& % webget www.perl.com /guanaco.html +\& HTTP/1.1 404 File Not Found +\& Date: Thu, 08 May 1997 18:02:32 GMT +\& Server: Apache/1.2b6 +\& Connection: close +\& Content\-type: text/html +\& +\& 404 File Not Found +\&

File Not Found

+\& The requested URL /guanaco.html was not found on this server.

+\& +.Ve +.PP +Ok, so that's not very interesting, because it didn't find that +particular document. But a long response wouldn't have fit on this page. +.PP +For a more featureful version of this program, you should look to +the \fIlwp-request\fR program included with the \s-1LWP\s0 modules from \s-1CPAN.\s0 +.SS "Interactive Client with IO::Socket" +.IX Subsection "Interactive Client with IO::Socket" +Well, that's all fine if you want to send one command and get one answer, +but what about setting up something fully interactive, somewhat like +the way \fItelnet\fR works? That way you can type a line, get the answer, +type a line, get the answer, etc. +.PP +This client is more complicated than the two we've done so far, but if +you're on a system that supports the powerful \f(CW\*(C`fork\*(C'\fR call, the solution +isn't that rough. Once you've made the connection to whatever service +you'd like to chat with, call \f(CW\*(C`fork\*(C'\fR to clone your process. Each of +these two identical process has a very simple job to do: the parent +copies everything from the socket to standard output, while the child +simultaneously copies everything from standard input to the socket. +To accomplish the same thing using just one process would be \fImuch\fR +harder, because it's easier to code two processes to do one thing than it +is to code one process to do two things. (This keep-it-simple principle +a cornerstones of the Unix philosophy, and good software engineering as +well, which is probably why it's spread to other systems.) +.PP +Here's the code: +.PP +.Vb 4 +\& #!/usr/bin/perl +\& use strict; +\& use warnings; +\& use IO::Socket; +\& +\& unless (@ARGV == 2) { die "usage: $0 host port" } +\& my ($host, $port) = @ARGV; +\& +\& # create a tcp connection to the specified host and port +\& my $handle = IO::Socket::INET\->new(Proto => "tcp", +\& PeerAddr => $host, +\& PeerPort => $port) +\& || die "can\*(Aqt connect to port $port on $host: $!"; +\& +\& $handle\->autoflush(1); # so output gets there right away +\& print STDERR "[Connected to $host:$port]\en"; +\& +\& # split the program into two processes, identical twins +\& die "can\*(Aqt fork: $!" unless defined(my $kidpid = fork()); +\& +\& # the if{} block runs only in the parent process +\& if ($kidpid) { +\& # copy the socket to standard output +\& while (defined (my $line = <$handle>)) { +\& print STDOUT $line; +\& } +\& kill("TERM", $kidpid); # send SIGTERM to child +\& } +\& # the else{} block runs only in the child process +\& else { +\& # copy standard input to the socket +\& while (defined (my $line = )) { +\& print $handle $line; +\& } +\& exit(0); # just in case +\& } +.Ve +.PP +The \f(CW\*(C`kill\*(C'\fR function in the parent's \f(CW\*(C`if\*(C'\fR block is there to send a +signal to our child process, currently running in the \f(CW\*(C`else\*(C'\fR block, +as soon as the remote server has closed its end of the connection. +.PP +If the remote server sends data a byte at time, and you need that +data immediately without waiting for a newline (which might not happen), +you may wish to replace the \f(CW\*(C`while\*(C'\fR loop in the parent with the +following: +.PP +.Vb 4 +\& my $byte; +\& while (sysread($handle, $byte, 1) == 1) { +\& print STDOUT $byte; +\& } +.Ve +.PP +Making a system call for each byte you want to read is not very efficient +(to put it mildly) but is the simplest to explain and works reasonably +well. +.SH "TCP Servers with IO::Socket" +.IX Header "TCP Servers with IO::Socket" +As always, setting up a server is little bit more involved than running a client. +The model is that the server creates a special kind of socket that +does nothing but listen on a particular port for incoming connections. +It does this by calling the \f(CW\*(C`IO::Socket::INET\->new()\*(C'\fR method with +slightly different arguments than the client did. +.IP "Proto" 4 +.IX Item "Proto" +This is which protocol to use. Like our clients, we'll +still specify \f(CW"tcp"\fR here. +.IP "LocalPort" 4 +.IX Item "LocalPort" +We specify a local +port in the \f(CW\*(C`LocalPort\*(C'\fR argument, which we didn't do for the client. +This is service name or port number for which you want to be the +server. (Under Unix, ports under 1024 are restricted to the +superuser.) In our sample, we'll use port 9000, but you can use +any port that's not currently in use on your system. If you try +to use one already in used, you'll get an \*(L"Address already in use\*(R" +message. Under Unix, the \f(CW\*(C`netstat \-a\*(C'\fR command will show +which services current have servers. +.IP "Listen" 4 +.IX Item "Listen" +The \f(CW\*(C`Listen\*(C'\fR parameter is set to the maximum number of +pending connections we can accept until we turn away incoming clients. +Think of it as a call-waiting queue for your telephone. +The low-level Socket module has a special symbol for the system maximum, which +is \s-1SOMAXCONN.\s0 +.IP "Reuse" 4 +.IX Item "Reuse" +The \f(CW\*(C`Reuse\*(C'\fR parameter is needed so that we restart our server +manually without waiting a few minutes to allow system buffers to +clear out. +.PP +Once the generic server socket has been created using the parameters +listed above, the server then waits for a new client to connect +to it. The server blocks in the \f(CW\*(C`accept\*(C'\fR method, which eventually accepts a +bidirectional connection from the remote client. (Make sure to autoflush +this handle to circumvent buffering.) +.PP +To add to user-friendliness, our server prompts the user for commands. +Most servers don't do this. Because of the prompt without a newline, +you'll have to use the \f(CW\*(C`sysread\*(C'\fR variant of the interactive client above. +.PP +This server accepts one of five different commands, sending output back to +the client. Unlike most network servers, this one handles only one +incoming client at a time. Multitasking servers are covered in +Chapter 16 of the Camel. +.PP +Here's the code. +.PP +.Vb 5 +\& #!/usr/bin/perl +\& use strict; +\& use warnings; +\& use IO::Socket; +\& use Net::hostent; # for OOish version of gethostbyaddr +\& +\& my $PORT = 9000; # pick something not in use +\& +\& my $server = IO::Socket::INET\->new( Proto => "tcp", +\& LocalPort => $PORT, +\& Listen => SOMAXCONN, +\& Reuse => 1); +\& +\& die "can\*(Aqt setup server" unless $server; +\& print "[Server $0 accepting clients]\en"; +\& +\& while (my $client = $server\->accept()) { +\& $client\->autoflush(1); +\& print $client "Welcome to $0; type help for command list.\en"; +\& my $hostinfo = gethostbyaddr($client\->peeraddr); +\& printf "[Connect from %s]\en", +\& $hostinfo ? $hostinfo\->name : $client\->peerhost; +\& print $client "Command? "; +\& while ( <$client>) { +\& next unless /\eS/; # blank line +\& if (/quit|exit/i) { last } +\& elsif (/date|time/i) { printf $client "%s\en", scalar localtime() } +\& elsif (/who/i ) { print $client \`who 2>&1\` } +\& elsif (/cookie/i ) { print $client \`/usr/games/fortune 2>&1\` } +\& elsif (/motd/i ) { print $client \`cat /etc/motd 2>&1\` } +\& else { +\& print $client "Commands: quit date who cookie motd\en"; +\& } +\& } continue { +\& print $client "Command? "; +\& } +\& close $client; +\& } +.Ve +.SH "UDP: Message Passing" +.IX Header "UDP: Message Passing" +Another kind of client-server setup is one that uses not connections, but +messages. \s-1UDP\s0 communications involve much lower overhead but also provide +less reliability, as there are no promises that messages will arrive at +all, let alone in order and unmangled. Still, \s-1UDP\s0 offers some advantages +over \s-1TCP,\s0 including being able to \*(L"broadcast\*(R" or \*(L"multicast\*(R" to a whole +bunch of destination hosts at once (usually on your local subnet). If you +find yourself overly concerned about reliability and start building checks +into your message system, then you probably should use just \s-1TCP\s0 to start +with. +.PP +\&\s-1UDP\s0 datagrams are \fInot\fR a bytestream and should not be treated as such. +This makes using I/O mechanisms with internal buffering like stdio (i.e. +\&\fBprint()\fR and friends) especially cumbersome. Use \fBsyswrite()\fR, or better +\&\fBsend()\fR, like in the example below. +.PP +Here's a \s-1UDP\s0 program similar to the sample Internet \s-1TCP\s0 client given +earlier. However, instead of checking one host at a time, the \s-1UDP\s0 version +will check many of them asynchronously by simulating a multicast and then +using \fBselect()\fR to do a timed-out wait for I/O. To do something similar +with \s-1TCP,\s0 you'd have to use a different socket handle for each host. +.PP +.Vb 5 +\& #!/usr/bin/perl +\& use strict; +\& use warnings; +\& use Socket; +\& use Sys::Hostname; +\& +\& my $SECS_OF_70_YEARS = 2_208_988_800; +\& +\& my $iaddr = gethostbyname(hostname()); +\& my $proto = getprotobyname("udp"); +\& my $port = getservbyname("time", "udp"); +\& my $paddr = sockaddr_in(0, $iaddr); # 0 means let kernel pick +\& +\& socket(my $socket, PF_INET, SOCK_DGRAM, $proto) || die "socket: $!"; +\& bind($socket, $paddr) || die "bind: $!"; +\& +\& $| = 1; +\& printf "%\-12s %8s %s\en", "localhost", 0, scalar localtime(); +\& my $count = 0; +\& for my $host (@ARGV) { +\& $count++; +\& my $hisiaddr = inet_aton($host) || die "unknown host"; +\& my $hispaddr = sockaddr_in($port, $hisiaddr); +\& defined(send($socket, 0, 0, $hispaddr)) || die "send $host: $!"; +\& } +\& +\& my $rout = my $rin = ""; +\& vec($rin, fileno($socket), 1) = 1; +\& +\& # timeout after 10.0 seconds +\& while ($count && select($rout = $rin, undef, undef, 10.0)) { +\& my $rtime = ""; +\& my $hispaddr = recv($socket, $rtime, 4, 0) || die "recv: $!"; +\& my ($port, $hisiaddr) = sockaddr_in($hispaddr); +\& my $host = gethostbyaddr($hisiaddr, AF_INET); +\& my $histime = unpack("N", $rtime) \- $SECS_OF_70_YEARS; +\& printf "%\-12s ", $host; +\& printf "%8d %s\en", $histime \- time(), scalar localtime($histime); +\& $count\-\-; +\& } +.Ve +.PP +This example does not include any retries and may consequently fail to +contact a reachable host. The most prominent reason for this is congestion +of the queues on the sending host if the number of hosts to contact is +sufficiently large. +.SH "SysV IPC" +.IX Header "SysV IPC" +While System V \s-1IPC\s0 isn't so widely used as sockets, it still has some +interesting uses. However, you cannot use SysV \s-1IPC\s0 or Berkeley \fBmmap()\fR to +have a variable shared amongst several processes. That's because Perl +would reallocate your string when you weren't wanting it to. You might +look into the \f(CW\*(C`IPC::Shareable\*(C'\fR or \f(CW\*(C`threads::shared\*(C'\fR modules for that. +.PP +Here's a small example showing shared memory usage. +.PP +.Vb 1 +\& use IPC::SysV qw(IPC_PRIVATE IPC_RMID S_IRUSR S_IWUSR); +\& +\& my $size = 2000; +\& my $id = shmget(IPC_PRIVATE, $size, S_IRUSR | S_IWUSR); +\& defined($id) || die "shmget: $!"; +\& print "shm key $id\en"; +\& +\& my $message = "Message #1"; +\& shmwrite($id, $message, 0, 60) || die "shmwrite: $!"; +\& print "wrote: \*(Aq$message\*(Aq\en"; +\& shmread($id, my $buff, 0, 60) || die "shmread: $!"; +\& print "read : \*(Aq$buff\*(Aq\en"; +\& +\& # the buffer of shmread is zero\-character end\-padded. +\& substr($buff, index($buff, "\e0")) = ""; +\& print "un" unless $buff eq $message; +\& print "swell\en"; +\& +\& print "deleting shm $id\en"; +\& shmctl($id, IPC_RMID, 0) || die "shmctl: $!"; +.Ve +.PP +Here's an example of a semaphore: +.PP +.Vb 1 +\& use IPC::SysV qw(IPC_CREAT); +\& +\& my $IPC_KEY = 1234; +\& my $id = semget($IPC_KEY, 10, 0666 | IPC_CREAT); +\& defined($id) || die "semget: $!"; +\& print "sem id $id\en"; +.Ve +.PP +Put this code in a separate file to be run in more than one process. +Call the file \fItake\fR: +.PP +.Vb 1 +\& # create a semaphore +\& +\& my $IPC_KEY = 1234; +\& my $id = semget($IPC_KEY, 0, 0); +\& defined($id) || die "semget: $!"; +\& +\& my $semnum = 0; +\& my $semflag = 0; +\& +\& # "take" semaphore +\& # wait for semaphore to be zero +\& my $semop = 0; +\& my $opstring1 = pack("s!s!s!", $semnum, $semop, $semflag); +\& +\& # Increment the semaphore count +\& $semop = 1; +\& my $opstring2 = pack("s!s!s!", $semnum, $semop, $semflag); +\& my $opstring = $opstring1 . $opstring2; +\& +\& semop($id, $opstring) || die "semop: $!"; +.Ve +.PP +Put this code in a separate file to be run in more than one process. +Call this file \fIgive\fR: +.PP +.Vb 3 +\& # "give" the semaphore +\& # run this in the original process and you will see +\& # that the second process continues +\& +\& my $IPC_KEY = 1234; +\& my $id = semget($IPC_KEY, 0, 0); +\& die unless defined($id); +\& +\& my $semnum = 0; +\& my $semflag = 0; +\& +\& # Decrement the semaphore count +\& my $semop = \-1; +\& my $opstring = pack("s!s!s!", $semnum, $semop, $semflag); +\& +\& semop($id, $opstring) || die "semop: $!"; +.Ve +.PP +The SysV \s-1IPC\s0 code above was written long ago, and it's definitely +clunky looking. For a more modern look, see the IPC::SysV module. +.PP +A small example demonstrating SysV message queues: +.PP +.Vb 1 +\& use IPC::SysV qw(IPC_PRIVATE IPC_RMID IPC_CREAT S_IRUSR S_IWUSR); +\& +\& my $id = msgget(IPC_PRIVATE, IPC_CREAT | S_IRUSR | S_IWUSR); +\& defined($id) || die "msgget failed: $!"; +\& +\& my $sent = "message"; +\& my $type_sent = 1234; +\& +\& msgsnd($id, pack("l! a*", $type_sent, $sent), 0) +\& || die "msgsnd failed: $!"; +\& +\& msgrcv($id, my $rcvd_buf, 60, 0, 0) +\& || die "msgrcv failed: $!"; +\& +\& my($type_rcvd, $rcvd) = unpack("l! a*", $rcvd_buf); +\& +\& if ($rcvd eq $sent) { +\& print "okay\en"; +\& } else { +\& print "not okay\en"; +\& } +\& +\& msgctl($id, IPC_RMID, 0) || die "msgctl failed: $!\en"; +.Ve +.SH "NOTES" +.IX Header "NOTES" +Most of these routines quietly but politely return \f(CW\*(C`undef\*(C'\fR when they +fail instead of causing your program to die right then and there due to +an uncaught exception. (Actually, some of the new \fISocket\fR conversion +functions do \fBcroak()\fR on bad arguments.) It is therefore essential to +check return values from these functions. Always begin your socket +programs this way for optimal success, and don't forget to add the \fB\-T\fR +taint-checking flag to the \f(CW\*(C`#!\*(C'\fR line for servers: +.PP +.Vb 5 +\& #!/usr/bin/perl \-T +\& use strict; +\& use warnings; +\& use sigtrap; +\& use Socket; +.Ve +.SH "BUGS" +.IX Header "BUGS" +These routines all create system-specific portability problems. As noted +elsewhere, Perl is at the mercy of your C libraries for much of its system +behavior. It's probably safest to assume broken SysV semantics for +signals and to stick with simple \s-1TCP\s0 and \s-1UDP\s0 socket operations; e.g., don't +try to pass open file descriptors over a local \s-1UDP\s0 datagram socket if you +want your code to stand a chance of being portable. +.SH "AUTHOR" +.IX Header "AUTHOR" +Tom Christiansen, with occasional vestiges of Larry Wall's original +version and suggestions from the Perl Porters. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +There's a lot more to networking than this, but this should get you +started. +.PP +For intrepid programmers, the indispensable textbook is \fIUnix Network +Programming, 2nd Edition, Volume 1\fR by W. Richard Stevens (published by +Prentice-Hall). Most books on networking address the subject from the +perspective of a C programmer; translation to Perl is left as an exercise +for the reader. +.PP +The \fBIO::Socket\fR\|(3) manpage describes the object library, and the \fBSocket\fR\|(3) +manpage describes the low-level interface to sockets. Besides the obvious +functions in perlfunc, you should also check out the \fImodules\fR file at +your nearest \s-1CPAN\s0 site, especially +. +See perlmodlib or best yet, the \fIPerl \s-1FAQ\s0\fR for a description +of what \s-1CPAN\s0 is and where to get it if the previous link doesn't work +for you. +.PP +Section 5 of \s-1CPAN\s0's \fImodules\fR file is devoted to \*(L"Networking, Device +Control (modems), and Interprocess Communication\*(R", and contains numerous +unbundled modules numerous networking modules, Chat and Expect operations, +\&\s-1CGI\s0 programming, \s-1DCE, FTP, IPC, NNTP,\s0 Proxy, Ptty, \s-1RPC, SNMP, SMTP,\s0 Telnet, +Threads, and ToolTalk\*(--to name just a few. diff --git a/data/miniconda3/man/man1/perlirix.1 b/data/miniconda3/man/man1/perlirix.1 new file mode 100644 index 0000000000000000000000000000000000000000..ca0c23eec63cb982cbbe064ca3cc74d11336c52b --- /dev/null +++ b/data/miniconda3/man/man1/perlirix.1 @@ -0,0 +1,284 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLIRIX 1" +.TH PERLIRIX 1 "2020-12-18" "perl v5.32.1" "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" +perlirix \- Perl version 5 on Irix systems +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes various features of Irix that will affect how Perl +version 5 (hereafter just Perl) is compiled and/or runs. +.SS "Building 32\-bit Perl in Irix" +.IX Subsection "Building 32-bit Perl in Irix" +Use +.PP +.Vb 1 +\& sh Configure \-Dcc=\*(Aqcc \-n32\*(Aq +.Ve +.PP +to compile Perl 32\-bit. Don't bother with \-n32 unless you have 7.1 +or later compilers (use cc \-version to check). +.PP +(Building 'cc \-n32' is the default.) +.SS "Building 64\-bit Perl in Irix" +.IX Subsection "Building 64-bit Perl in Irix" +Use +.PP +.Vb 1 +\& sh Configure \-Dcc=\*(Aqcc \-64\*(Aq \-Duse64bitint +.Ve +.PP +This requires require a 64\-bit \s-1MIPS CPU\s0 (R8000, R10000, ...) +.PP +You can also use +.PP +.Vb 1 +\& sh Configure \-Dcc=\*(Aqcc \-64\*(Aq \-Duse64bitall +.Ve +.PP +but that makes no difference compared with the \-Duse64bitint because +of the \f(CW\*(C`cc \-64\*(C'\fR. +.PP +You can also do +.PP +.Vb 1 +\& sh Configure \-Dcc=\*(Aqcc \-n32\*(Aq \-Duse64bitint +.Ve +.PP +to use long longs for the 64\-bit integer type, in case you don't +have a 64\-bit \s-1CPU.\s0 +.PP +If you are using gcc, just +.PP +.Vb 1 +\& sh Configure \-Dcc=gcc \-Duse64bitint +.Ve +.PP +should be enough, the Configure should automatically probe for the +correct 64\-bit settings. +.SS "About Compiler Versions of Irix" +.IX Subsection "About Compiler Versions of Irix" +Some Irix cc versions, e.g. 7.3.1.1m (try cc \-version) have been known +to have issues (coredumps) when compiling perl.c. If you've used +\&\-OPT:fast_io=ON and this happens, try removing it. If that fails, or +you didn't use that, then try adjusting other optimization options +(\-LNO, \-INLINE, \-O3 to \-O2, etcetera). The compiler bug has been +reported to \s-1SGI.\s0 (Allen Smith ) +.SS "Linker Problems in Irix" +.IX Subsection "Linker Problems in Irix" +If you get complaints about so_locations then search in the file +hints/irix_6.sh for \*(L"lddflags\*(R" and do the suggested adjustments. +(David Billinghurst ) +.SS "Malloc in Irix" +.IX Subsection "Malloc in Irix" +Do not try to use Perl's malloc, this will lead into very mysterious +errors (especially with \-Duse64bitall). +.SS "Building with threads in Irix" +.IX Subsection "Building with threads in Irix" +Run Configure with \-Duseithreads which will configure Perl with +the Perl 5.8.0 \*(L"interpreter threads\*(R", see threads. +.PP +For Irix 6.2 with perl threads, you have to have the following +patches installed: +.PP +.Vb 5 +\& 1404 Irix 6.2 Posix 1003.1b man pages +\& 1645 Irix 6.2 & 6.3 POSIX header file updates +\& 2000 Irix 6.2 Posix 1003.1b support modules +\& 2254 Pthread library fixes +\& 2401 6.2 all platform kernel rollup +.Ve +.PP +\&\fB\s-1IMPORTANT\s0\fR: Without patch 2401, a kernel bug in Irix 6.2 will cause +your machine to panic and crash when running threaded perl. Irix 6.3 +and later are okay. +.PP +.Vb 2 +\& Thanks to Hannu Napari for the IRIX +\& pthreads patches information. +.Ve +.SS "Irix 5.3" +.IX Subsection "Irix 5.3" +While running Configure and when building, you are likely to get +quite a few of these warnings: +.PP +.Vb 3 +\& ld: +\& The shared object /usr/lib/libm.so did not resolve any symbols. +\& You may want to remove it from your link line. +.Ve +.PP +Ignore them: in \s-1IRIX 5.3\s0 there is no way to quieten ld about this. +.PP +During compilation you will see this warning from toke.c: +.PP +.Vb 3 +\& uopt: Warning: Perl_yylex: this procedure not optimized because it +\& exceeds size threshold; to optimize this procedure, use \-Olimit +\& option with value >= 4252. +.Ve +.PP +Ignore the warning. +.PP +In \s-1IRIX 5.3\s0 and with Perl 5.8.1 (Perl 5.8.0 didn't compile in \s-1IRIX 5.3\s0) +the following failures are known. +.PP +.Vb 8 +\& Failed Test Stat Wstat Total Fail Failed List of Failed +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& ../ext/List/Util/t/shuffle.t 0 139 ?? ?? % ?? +\& ../lib/Math/Trig.t 255 65280 29 12 41.38% 24\-29 +\& ../lib/sort.t 0 138 119 72 60.50% 48\-119 +\& 56 tests and 474 subtests skipped. +\& Failed 3/811 test scripts, 99.63% okay. 78/75813 subtests failed, +\& 99.90% okay. +.Ve +.PP +They are suspected to be compiler errors (at least the shuffle.t +failure is known from some \s-1IRIX 6\s0 setups) and math library errors +(the Trig.t failure), but since \s-1IRIX 5\s0 is long since end-of-lifed, +further fixes for the \s-1IRIX\s0 are unlikely. If you can get gcc for 5.3, +you could try that, too, since gcc in \s-1IRIX 6\s0 is a known workaround for +at least the shuffle.t and sort.t failures. +.SH "AUTHOR" +.IX Header "AUTHOR" +Jarkko Hietaniemi +.PP +Please report any errors, updates, or suggestions to +. diff --git a/data/miniconda3/man/man1/perllexwarn.1 b/data/miniconda3/man/man1/perllexwarn.1 new file mode 100644 index 0000000000000000000000000000000000000000..10253faf4fbda84df8275ebca688a69183ef976e --- /dev/null +++ b/data/miniconda3/man/man1/perllexwarn.1 @@ -0,0 +1,148 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLLEXWARN 1" +.TH PERLLEXWARN 1 "2020-12-18" "perl v5.32.1" "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" +perllexwarn \- Perl Lexical Warnings +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Perl v5.6.0 introduced lexical control over the handling of warnings by +category. The \f(CW\*(C`warnings\*(C'\fR pragma generally replaces the command line flag +\&\fB\-w\fR. Documentation on the use of lexical warnings, once partly found in +this document, is now found in the warnings documentation. diff --git a/data/miniconda3/man/man1/perllocale.1 b/data/miniconda3/man/man1/perllocale.1 new file mode 100644 index 0000000000000000000000000000000000000000..8f6189bad04f798f53a9f434dbe4bcc03a70c2b4 --- /dev/null +++ b/data/miniconda3/man/man1/perllocale.1 @@ -0,0 +1,1834 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLLOCALE 1" +.TH PERLLOCALE 1 "2020-12-18" "perl v5.32.1" "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" +perllocale \- Perl locale handling (internationalization and localization) +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +In the beginning there was \s-1ASCII,\s0 the \*(L"American Standard Code for +Information Interchange\*(R", which works quite well for Americans with +their English alphabet and dollar-denominated currency. But it doesn't +work so well even for other English speakers, who may use different +currencies, such as the pound sterling (as the symbol for that currency +is not in \s-1ASCII\s0); and it's hopelessly inadequate for many of the +thousands of the world's other languages. +.PP +To address these deficiencies, the concept of locales was invented +(formally the \s-1ISO C, XPG4, POSIX 1\s0.c \*(L"locale system\*(R"). And applications +were and are being written that use the locale mechanism. The process of +making such an application take account of its users' preferences in +these kinds of matters is called \fBinternationalization\fR (often +abbreviated as \fBi18n\fR); telling such an application about a particular +set of preferences is known as \fBlocalization\fR (\fBl10n\fR). +.PP +Perl has been extended to support certain types of locales available in +the locale system. This is controlled per application by using one +pragma, one function call, and several environment variables. +.PP +Perl supports single-byte locales that are supersets of \s-1ASCII,\s0 such as +the \s-1ISO 8859\s0 ones, and one multi-byte-type locale, \s-1UTF\-8\s0 ones, described +in the next paragraph. Perl doesn't support any other multi-byte +locales, such as the ones for East Asian languages. +.PP +Unfortunately, there are quite a few deficiencies with the design (and +often, the implementations) of locales. Unicode was invented (see +perlunitut for an introduction to that) in part to address these +design deficiencies, and nowadays, there is a series of \*(L"\s-1UTF\-8\s0 +locales\*(R", based on Unicode. These are locales whose character set is +Unicode, encoded in \s-1UTF\-8.\s0 Starting in v5.20, Perl fully supports +\&\s-1UTF\-8\s0 locales, except for sorting and string comparisons like \f(CW\*(C`lt\*(C'\fR and +\&\f(CW\*(C`ge\*(C'\fR. Starting in v5.26, Perl can handle these reasonably as well, +depending on the platform's implementation. However, for earlier +releases or for better control, use Unicode::Collate. There are +actually two slightly different types of \s-1UTF\-8\s0 locales: one for Turkic +languages and one for everything else. +.PP +Starting in Perl v5.30, Perl detects Turkic locales by their +behaviour, and seamlessly handles both types; previously only the +non-Turkic one was supported. The name of the locale is ignored, if +your system has a \f(CW\*(C`tr_TR.UTF\-8\*(C'\fR locale and it doesn't behave like a +Turkic locale, perl will treat it like a non-Turkic locale. +.PP +Perl continues to support the old non \s-1UTF\-8\s0 locales as well. There are +currently no \s-1UTF\-8\s0 locales for \s-1EBCDIC\s0 platforms. +.PP +(Unicode is also creating \f(CW\*(C`CLDR\*(C'\fR, the \*(L"Common Locale Data Repository\*(R", + which includes more types of information than +are available in the \s-1POSIX\s0 locale system. At the time of this writing, +there was no \s-1CPAN\s0 module that provides access to this XML-encoded data. +However, it is possible to compute the \s-1POSIX\s0 locale data from them, and +earlier \s-1CLDR\s0 versions had these already extracted for you as \s-1UTF\-8\s0 locales +.) +.SH "WHAT IS A LOCALE" +.IX Header "WHAT IS A LOCALE" +A locale is a set of data that describes various aspects of how various +communities in the world categorize their world. These categories are +broken down into the following types (some of which include a brief +note here): +.ie n .IP "Category ""LC_NUMERIC"": Numeric formatting" 4 +.el .IP "Category \f(CWLC_NUMERIC\fR: Numeric formatting" 4 +.IX Item "Category LC_NUMERIC: Numeric formatting" +This indicates how numbers should be formatted for human readability, +for example the character used as the decimal point. +.ie n .IP "Category ""LC_MONETARY"": Formatting of monetary amounts" 4 +.el .IP "Category \f(CWLC_MONETARY\fR: Formatting of monetary amounts" 4 +.IX Item "Category LC_MONETARY: Formatting of monetary amounts" + +.ie n .IP "Category ""LC_TIME"": Date/Time formatting" 4 +.el .IP "Category \f(CWLC_TIME\fR: Date/Time formatting" 4 +.IX Item "Category LC_TIME: Date/Time formatting" + +.ie n .IP "Category ""LC_MESSAGES"": Error and other messages" 4 +.el .IP "Category \f(CWLC_MESSAGES\fR: Error and other messages" 4 +.IX Item "Category LC_MESSAGES: Error and other messages" +This is used by Perl itself only for accessing operating system error +messages via $! and $^E. +.ie n .IP "Category ""LC_COLLATE"": Collation" 4 +.el .IP "Category \f(CWLC_COLLATE\fR: Collation" 4 +.IX Item "Category LC_COLLATE: Collation" +This indicates the ordering of letters for comparison and sorting. +In Latin alphabets, for example, \*(L"b\*(R", generally follows \*(L"a\*(R". +.ie n .IP "Category ""LC_CTYPE"": Character Types" 4 +.el .IP "Category \f(CWLC_CTYPE\fR: Character Types" 4 +.IX Item "Category LC_CTYPE: Character Types" +This indicates, for example if a character is an uppercase letter. +.IP "Other categories" 4 +.IX Item "Other categories" +Some platforms have other categories, dealing with such things as +measurement units and paper sizes. None of these are used directly by +Perl, but outside operations that Perl interacts with may use +these. See \*(L"Not within the scope of \*(R"use locale"" below. +.PP +More details on the categories used by Perl are given below in \*(L"\s-1LOCALE +CATEGORIES\*(R"\s0. +.PP +Together, these categories go a long way towards being able to customize +a single program to run in many different locations. But there are +deficiencies, so keep reading. +.SH "PREPARING TO USE LOCALES" +.IX Header "PREPARING TO USE LOCALES" +Perl itself (outside the \s-1POSIX\s0 module) will not use locales unless +specifically requested to (but +again note that Perl may interact with code that does use them). Even +if there is such a request, \fBall\fR of the following must be true +for it to work properly: +.IP "\(bu" 4 +\&\fBYour operating system must support the locale system\fR. If it does, +you should find that the \f(CW\*(C`setlocale()\*(C'\fR function is a documented part of +its C library. +.IP "\(bu" 4 +\&\fBDefinitions for locales that you use must be installed\fR. You, or +your system administrator, must make sure that this is the case. The +available locales, the location in which they are kept, and the manner +in which they are installed all vary from system to system. Some systems +provide only a few, hard-wired locales and do not allow more to be +added. Others allow you to add \*(L"canned\*(R" locales provided by the system +supplier. Still others allow you or the system administrator to define +and add arbitrary locales. (You may have to ask your supplier to +provide canned locales that are not delivered with your operating +system.) Read your system documentation for further illumination. +.IP "\(bu" 4 +\&\fBPerl must believe that the locale system is supported\fR. If it does, +\&\f(CW\*(C`perl \-V:d_setlocale\*(C'\fR will say that the value for \f(CW\*(C`d_setlocale\*(C'\fR is +\&\f(CW\*(C`define\*(C'\fR. +.PP +If you want a Perl application to process and present your data +according to a particular locale, the application code should include +the \f(CW\*(C`use\ locale\*(C'\fR pragma (see \*(L"The \*(R"use locale\*(L" pragma\*(R") where +appropriate, and \fBat least one\fR of the following must be true: +.IP "1." 4 +\&\fBThe locale-determining environment variables (see \*(L"\s-1ENVIRONMENT\*(R"\s0) +must be correctly set up\fR at the time the application is started, either +by yourself or by whomever set up your system account; or +.IP "2." 4 +\&\fBThe application must set its own locale\fR using the method described in +\&\*(L"The setlocale function\*(R". +.SH "USING LOCALES" +.IX Header "USING LOCALES" +.ie n .SS "The ""use locale"" pragma" +.el .SS "The \f(CW``use locale''\fP pragma" +.IX Subsection "The ""use locale"" pragma" +Starting in Perl 5.28, this pragma may be used in +multi-threaded applications on systems that have thread-safe +locale ability. Some caveats apply, see \*(L"Multi-threaded\*(R" below. On +systems without this capability, or in earlier Perls, do \s-1NOT\s0 use this +pragma in scripts that have multiple threads active. The +locale in these cases is not local to a single thread. Another thread +may change the locale at any time, which could cause at a minimum that a +given thread is operating in a locale it isn't expecting to be in. On +some platforms, segfaults can also occur. The locale change need not be +explicit; some operations cause perl to change the locale itself. You +are vulnerable simply by having done a \f(CW"use\ locale"\fR. +.PP +By default, Perl itself (outside the \s-1POSIX\s0 module) +ignores the current locale. The \f(CW\*(C`use\ locale\*(C'\fR +pragma tells Perl to use the current locale for some operations. +Starting in v5.16, there are optional parameters to this pragma, +described below, which restrict which operations are affected by it. +.PP +The current locale is set at execution time by +\&\fBsetlocale()\fR described below. If that function +hasn't yet been called in the course of the program's execution, the +current locale is that which was determined by the \*(L"\s-1ENVIRONMENT\*(R"\s0 in +effect at the start of the program. +If there is no valid environment, the current locale is whatever the +system default has been set to. On \s-1POSIX\s0 systems, it is likely, but +not necessarily, the \*(L"C\*(R" locale. On Windows, the default is set via the +computer's \f(CW\*(C`Control\ Panel\->Regional\ and\ Language\ Options\*(C'\fR (or its +current equivalent). +.PP +The operations that are affected by locale are: +.ie n .IP "\fBNot within the scope of \f(CB""use locale""\fB\fR" 4 +.el .IP "\fBNot within the scope of \f(CB``use locale''\fB\fR" 4 +.IX Item "Not within the scope of ""use locale""" +Only certain operations (all originating outside Perl) should be +affected, as follows: +.RS 4 +.IP "\(bu" 4 +The current locale is used when going outside of Perl with +operations like \fBsystem()\fR or +qx//, if those operations are +locale-sensitive. +.IP "\(bu" 4 +Also Perl gives access to various C library functions through the +\&\s-1POSIX\s0 module. Some of those functions are always affected by the +current locale. For example, \f(CW\*(C`POSIX::strftime()\*(C'\fR uses \f(CW\*(C`LC_TIME\*(C'\fR; +\&\f(CW\*(C`POSIX::strtod()\*(C'\fR uses \f(CW\*(C`LC_NUMERIC\*(C'\fR; \f(CW\*(C`POSIX::strcoll()\*(C'\fR and +\&\f(CW\*(C`POSIX::strxfrm()\*(C'\fR use \f(CW\*(C`LC_COLLATE\*(C'\fR. All such functions +will behave according to the current underlying locale, even if that +locale isn't exposed to Perl space. +.Sp +This applies as well to I18N::Langinfo. +.IP "\(bu" 4 +\&\s-1XS\s0 modules for all categories but \f(CW\*(C`LC_NUMERIC\*(C'\fR get the underlying +locale, and hence any C library functions they call will use that +underlying locale. For more discussion, see \*(L"\s-1CAVEATS\*(R"\s0 in perlxs. +.RE +.RS 4 +.Sp +Note that all C programs (including the perl interpreter, which is +written in C) always have an underlying locale. That locale is the \*(L"C\*(R" +locale unless changed by a call to \fBsetlocale()\fR. When Perl starts up, it changes the underlying locale to the +one which is indicated by the \*(L"\s-1ENVIRONMENT\*(R"\s0. When using the \s-1POSIX\s0 +module or writing \s-1XS\s0 code, it is important to keep in mind that the +underlying locale may be something other than \*(L"C\*(R", even if the program +hasn't explicitly changed it. +.Sp + +.RE +.ie n .IP "\fBLingering effects of \f(CB""use\ locale""\fB\fR" 4 +.el .IP "\fBLingering effects of \f(CBuse\ locale\fB\fR" 4 +.IX Item "Lingering effects of uselocale" +Certain Perl operations that are set-up within the scope of a +\&\f(CW\*(C`use locale\*(C'\fR retain that effect even outside the scope. +These include: +.RS 4 +.IP "\(bu" 4 +The output format of a \fBwrite()\fR is determined by an +earlier format declaration (\*(L"format\*(R" in perlfunc), so whether or not the +output is affected by locale is determined by if the \f(CW\*(C`format()\*(C'\fR is +within the scope of a \f(CW\*(C`use locale\*(C'\fR, not whether the \f(CW\*(C`write()\*(C'\fR +is. +.IP "\(bu" 4 +Regular expression patterns can be compiled using +qr// with actual +matching deferred to later. Again, it is whether or not the compilation +was done within the scope of \f(CW\*(C`use locale\*(C'\fR that determines the match +behavior, not if the matches are done within such a scope or not. +.RE +.RS 4 +.Sp + +.RE +.ie n .IP "\fBUnder \f(CB""""use locale"";""\fB\fR" 4 +.el .IP "\fBUnder \f(CB``use locale'';\fB\fR" 4 +.IX Item "Under ""use locale"";" +.RS 4 +.PD 0 +.IP "\(bu" 4 +.PD +All the above operations +.IP "\(bu" 4 +\&\fBFormat declarations\fR (\*(L"format\*(R" in perlfunc) and hence any subsequent +\&\f(CW\*(C`write()\*(C'\fRs use \f(CW\*(C`LC_NUMERIC\*(C'\fR. +.IP "\(bu" 4 +\&\fBstringification and output\fR use \f(CW\*(C`LC_NUMERIC\*(C'\fR. +These include the results of +\&\f(CW\*(C`print()\*(C'\fR, +\&\f(CW\*(C`printf()\*(C'\fR, +\&\f(CW\*(C`say()\*(C'\fR, +and +\&\f(CW\*(C`sprintf()\*(C'\fR. +.IP "\(bu" 4 +\&\fBThe comparison operators\fR (\f(CW\*(C`lt\*(C'\fR, \f(CW\*(C`le\*(C'\fR, \f(CW\*(C`cmp\*(C'\fR, \f(CW\*(C`ge\*(C'\fR, and \f(CW\*(C`gt\*(C'\fR) use +\&\f(CW\*(C`LC_COLLATE\*(C'\fR. \f(CW\*(C`sort()\*(C'\fR is also affected if used without an +explicit comparison function, because it uses \f(CW\*(C`cmp\*(C'\fR by default. +.Sp +\&\fBNote:\fR \f(CW\*(C`eq\*(C'\fR and \f(CW\*(C`ne\*(C'\fR are unaffected by locale: they always +perform a char-by-char comparison of their scalar operands. What's +more, if \f(CW\*(C`cmp\*(C'\fR finds that its operands are equal according to the +collation sequence specified by the current locale, it goes on to +perform a char-by-char comparison, and only returns \fI0\fR (equal) if the +operands are char-for-char identical. If you really want to know whether +two strings\*(--which \f(CW\*(C`eq\*(C'\fR and \f(CW\*(C`cmp\*(C'\fR may consider different\*(--are equal +as far as collation in the locale is concerned, see the discussion in +"Category \f(CW\*(C`LC_COLLATE\*(C'\fR: Collation". +.IP "\(bu" 4 +\&\fBRegular expressions and case-modification functions\fR (\f(CW\*(C`uc()\*(C'\fR, \f(CW\*(C`lc()\*(C'\fR, +\&\f(CW\*(C`ucfirst()\*(C'\fR, and \f(CW\*(C`lcfirst()\*(C'\fR) use \f(CW\*(C`LC_CTYPE\*(C'\fR +.IP "\(bu" 4 +\&\fBThe variables $!\fR (and its synonyms \f(CW$ERRNO\fR and +\&\f(CW$OS_ERROR\fR) \fBand $^E\fR (and its synonym +\&\f(CW$EXTENDED_OS_ERROR\fR) when used as strings use \f(CW\*(C`LC_MESSAGES\*(C'\fR. +.RE +.RS 4 +.RE +.PP +The default behavior is restored with the \f(CW\*(C`no\ locale\*(C'\fR pragma, or +upon reaching the end of the block enclosing \f(CW\*(C`use locale\*(C'\fR. +Note that \f(CW\*(C`use locale\*(C'\fR calls may be +nested, and that what is in effect within an inner scope will revert to +the outer scope's rules at the end of the inner scope. +.PP +The string result of any operation that uses locale +information is tainted, as it is possible for a locale to be +untrustworthy. See \*(L"\s-1SECURITY\*(R"\s0. +.PP +Starting in Perl v5.16 in a very limited way, and more generally in +v5.22, you can restrict which category or categories are enabled by this +particular instance of the pragma by adding parameters to it. For +example, +.PP +.Vb 1 +\& use locale qw(:ctype :numeric); +.Ve +.PP +enables locale awareness within its scope of only those operations +(listed above) that are affected by \f(CW\*(C`LC_CTYPE\*(C'\fR and \f(CW\*(C`LC_NUMERIC\*(C'\fR. +.PP +The possible categories are: \f(CW\*(C`:collate\*(C'\fR, \f(CW\*(C`:ctype\*(C'\fR, \f(CW\*(C`:messages\*(C'\fR, +\&\f(CW\*(C`:monetary\*(C'\fR, \f(CW\*(C`:numeric\*(C'\fR, \f(CW\*(C`:time\*(C'\fR, and the pseudo category +\&\f(CW\*(C`:characters\*(C'\fR (described below). +.PP +Thus you can say +.PP +.Vb 1 +\& use locale \*(Aq:messages\*(Aq; +.Ve +.PP +and only $! and $^E +will be locale aware. Everything else is unaffected. +.PP +Since Perl doesn't currently do anything with the \f(CW\*(C`LC_MONETARY\*(C'\fR +category, specifying \f(CW\*(C`:monetary\*(C'\fR does effectively nothing. Some +systems have other categories, such as \f(CW\*(C`LC_PAPER\*(C'\fR, but Perl +also doesn't do anything with them, and there is no way to specify +them in this pragma's arguments. +.PP +You can also easily say to use all categories but one, by either, for +example, +.PP +.Vb 2 +\& use locale \*(Aq:!ctype\*(Aq; +\& use locale \*(Aq:not_ctype\*(Aq; +.Ve +.PP +both of which mean to enable locale awarness of all categories but +\&\f(CW\*(C`LC_CTYPE\*(C'\fR. Only one category argument may be specified in a +\&\f(CW\*(C`use\ locale\*(C'\fR if it is of the negated form. +.PP +Prior to v5.22 only one form of the pragma with arguments is available: +.PP +.Vb 1 +\& use locale \*(Aq:not_characters\*(Aq; +.Ve +.PP +(and you have to say \f(CW\*(C`not_\*(C'\fR; you can't use the bang \f(CW\*(C`!\*(C'\fR form). This +pseudo category is a shorthand for specifying both \f(CW\*(C`:collate\*(C'\fR and +\&\f(CW\*(C`:ctype\*(C'\fR. Hence, in the negated form, it is nearly the same thing as +saying +.PP +.Vb 1 +\& use locale qw(:messages :monetary :numeric :time); +.Ve +.PP +We use the term \*(L"nearly\*(R", because \f(CW\*(C`:not_characters\*(C'\fR also turns on +\&\f(CW\*(C`use\ feature\ \*(Aqunicode_strings\*(Aq\*(C'\fR within its scope. This form is +less useful in v5.20 and later, and is described fully in +\&\*(L"Unicode and \s-1UTF\-8\*(R"\s0, but briefly, it tells Perl to not use the +character portions of the locale definition, that is the \f(CW\*(C`LC_CTYPE\*(C'\fR and +\&\f(CW\*(C`LC_COLLATE\*(C'\fR categories. Instead it will use the native character set +(extended by Unicode). When using this parameter, you are responsible +for getting the external character set translated into the +native/Unicode one (which it already will be if it is one of the +increasingly popular \s-1UTF\-8\s0 locales). There are convenient ways of doing +this, as described in \*(L"Unicode and \s-1UTF\-8\*(R"\s0. +.SS "The setlocale function" +.IX Subsection "The setlocale function" +\&\s-1WARNING\s0! Prior to Perl 5.28 or on a system that does not support +thread-safe locale operations, do \s-1NOT\s0 use this function in a +thread. The locale will change in all other threads at the +same time, and should your thread get paused by the operating system, +and another started, that thread will not have the locale it is +expecting. On some platforms, there can be a race leading to segfaults +if two threads call this function nearly simultaneously. This warning +does not apply on unthreaded builds, or on perls where +\&\f(CW\*(C`${^SAFE_LOCALES}\*(C'\fR exists and is non-zero; namely Perl 5.28 and later +unthreaded or compiled to be locale-thread-safe. +.PP +You can switch locales as often as you wish at run time with the +\&\f(CW\*(C`POSIX::setlocale()\*(C'\fR function: +.PP +.Vb 6 +\& # Import locale\-handling tool set from POSIX module. +\& # This example uses: setlocale \-\- the function call +\& # LC_CTYPE \-\- explained below +\& # (Showing the testing for success/failure of operations is +\& # omitted in these examples to avoid distracting from the main +\& # point) +\& +\& use POSIX qw(locale_h); +\& use locale; +\& my $old_locale; +\& +\& # query and save the old locale +\& $old_locale = setlocale(LC_CTYPE); +\& +\& setlocale(LC_CTYPE, "fr_CA.ISO8859\-1"); +\& # LC_CTYPE now in locale "French, Canada, codeset ISO 8859\-1" +\& +\& setlocale(LC_CTYPE, ""); +\& # LC_CTYPE now reset to the default defined by the +\& # LC_ALL/LC_CTYPE/LANG environment variables, or to the system +\& # default. See below for documentation. +\& +\& # restore the old locale +\& setlocale(LC_CTYPE, $old_locale); +.Ve +.PP +The first argument of \f(CW\*(C`setlocale()\*(C'\fR gives the \fBcategory\fR, the second the +\&\fBlocale\fR. The category tells in what aspect of data processing you +want to apply locale-specific rules. Category names are discussed in +\&\*(L"\s-1LOCALE CATEGORIES\*(R"\s0 and \*(L"\s-1ENVIRONMENT\*(R"\s0. The locale is the name of a +collection of customization information corresponding to a particular +combination of language, country or territory, and codeset. Read on for +hints on the naming of locales: not all systems name locales as in the +example. +.PP +If no second argument is provided and the category is something other +than \f(CW\*(C`LC_ALL\*(C'\fR, the function returns a string naming the current locale +for the category. You can use this value as the second argument in a +subsequent call to \f(CW\*(C`setlocale()\*(C'\fR, \fBbut\fR on some platforms the string +is opaque, not something that most people would be able to decipher as +to what locale it means. +.PP +If no second argument is provided and the category is \f(CW\*(C`LC_ALL\*(C'\fR, the +result is implementation-dependent. It may be a string of +concatenated locale names (separator also implementation-dependent) +or a single locale name. Please consult your \fBsetlocale\fR\|(3) man page for +details. +.PP +If a second argument is given and it corresponds to a valid locale, +the locale for the category is set to that value, and the function +returns the now-current locale value. You can then use this in yet +another call to \f(CW\*(C`setlocale()\*(C'\fR. (In some implementations, the return +value may sometimes differ from the value you gave as the second +argument\*(--think of it as an alias for the value you gave.) +.PP +As the example shows, if the second argument is an empty string, the +category's locale is returned to the default specified by the +corresponding environment variables. Generally, this results in a +return to the default that was in force when Perl started up: changes +to the environment made by the application after startup may or may not +be noticed, depending on your system's C library. +.PP +Note that when a form of \f(CW\*(C`use locale\*(C'\fR that doesn't include all +categories is specified, Perl ignores the excluded categories. +.PP +If \f(CW\*(C`setlocale()\*(C'\fR fails for some reason (for example, an attempt to set +to a locale unknown to the system), the locale for the category is not +changed, and the function returns \f(CW\*(C`undef\*(C'\fR. +.PP +Starting in Perl 5.28, on multi-threaded perls compiled on systems that +implement \s-1POSIX 2008\s0 thread-safe locale operations, this function +doesn't actually call the system \f(CW\*(C`setlocale\*(C'\fR. Instead those +thread-safe operations are used to emulate the \f(CW\*(C`setlocale\*(C'\fR function, +but in a thread-safe manner. +.PP +You can force the thread-safe locale operations to always be used (if +available) by recompiling perl with +.PP +.Vb 1 +\& \-Accflags=\*(Aq\-DUSE_THREAD_SAFE_LOCALE\*(Aq +.Ve +.PP +added to your call to \fIConfigure\fR. +.PP +For further information about the categories, consult \fBsetlocale\fR\|(3). +.SS "Multi-threaded operation" +.IX Subsection "Multi-threaded operation" +Beginning in Perl 5.28, multi-threaded locale operation is supported on +systems that implement either the \s-1POSIX 2008\s0 or Windows-specific +thread-safe locale operations. Many modern systems, such as various +Unix variants and Darwin do have this. +.PP +You can tell if using locales is safe on your system by looking at the +read-only boolean variable \f(CW\*(C`${^SAFE_LOCALES}\*(C'\fR. The value is 1 if the +perl is not threaded, or if it is using thread-safe locale operations. +.PP +Thread-safe operations are supported in Windows starting in Visual Studio +2005, and in systems compatible with \s-1POSIX 2008.\s0 Some platforms claim +to support \s-1POSIX 2008,\s0 but have buggy implementations, so that the hints +files for compiling to run on them turn off attempting to use +thread-safety. \f(CW\*(C`${^SAFE_LOCALES}\*(C'\fR will be 0 on them. +.PP +Be aware that writing a multi-threaded application will not be portable +to a platform which lacks the native thread-safe locale support. On +systems that do have it, you automatically get this behavior for +threaded perls, without having to do anything. If for some reason, you +don't want to use this capability (perhaps the \s-1POSIX 2008\s0 support is +buggy on your system), you can manually compile Perl to use the old +non-thread-safe implementation by passing the argument +\&\f(CW\*(C`\-Accflags=\*(Aq\-DNO_THREAD_SAFE_LOCALE\*(Aq\*(C'\fR to \fIConfigure\fR. +Except on Windows, this will continue to use certain of the \s-1POSIX 2008\s0 +functions in some situations. If these are buggy, you can pass the +following to \fIConfigure\fR instead or additionally: +\&\f(CW\*(C`\-Accflags=\*(Aq\-DNO_POSIX_2008_LOCALE\*(Aq\*(C'\fR. This will also keep the code +from using thread-safe locales. +\&\f(CW\*(C`${^SAFE_LOCALES}\*(C'\fR will be 0 on systems that turn off the thread-safe +operations. +.PP +Normally on unthreaded builds, the traditional \f(CW\*(C`setlocale()\*(C'\fR is used +and not the thread-safe locale functions. You can force the use of these +on systems that have them by adding the +\&\f(CW\*(C`\-Accflags=\*(Aq\-DUSE_THREAD_SAFE_LOCALE\*(Aq\*(C'\fR to \fIConfigure\fR. +.PP +The initial program is started up using the locale specified from the +environment, as currently, described in \*(L"\s-1ENVIRONMENT\*(R"\s0. All newly +created threads start with \f(CW\*(C`LC_ALL\*(C'\fR set to \f(CW"C"\fR>. Each thread may +use \f(CW\*(C`POSIX::setlocale()\*(C'\fR to query or switch its locale at any time, +without affecting any other thread. All locale-dependent operations +automatically use their thread's locale. +.PP +This should be completely transparent to any applications written +entirely in Perl (minus a few rarely encountered caveats given in the +\&\*(L"Multi-threaded\*(R" section). Information for \s-1XS\s0 module writers is given +in \*(L"Locale-aware \s-1XS\s0 code\*(R" in perlxs. +.SS "Finding locales" +.IX Subsection "Finding locales" +For locales available in your system, consult also \fBsetlocale\fR\|(3) to +see whether it leads to the list of available locales (search for the +\&\fI\s-1SEE ALSO\s0\fR section). If that fails, try the following command lines: +.PP +.Vb 1 +\& locale \-a +\& +\& nlsinfo +\& +\& ls /usr/lib/nls/loc +\& +\& ls /usr/lib/locale +\& +\& ls /usr/lib/nls +\& +\& ls /usr/share/locale +.Ve +.PP +and see whether they list something resembling these +.PP +.Vb 7 +\& en_US.ISO8859\-1 de_DE.ISO8859\-1 ru_RU.ISO8859\-5 +\& en_US.iso88591 de_DE.iso88591 ru_RU.iso88595 +\& en_US de_DE ru_RU +\& en de ru +\& english german russian +\& english.iso88591 german.iso88591 russian.iso88595 +\& english.roman8 russian.koi8r +.Ve +.PP +Sadly, even though the calling interface for \f(CW\*(C`setlocale()\*(C'\fR has been +standardized, names of locales and the directories where the +configuration resides have not been. The basic form of the name is +\&\fIlanguage_territory\fR\fB.\fR\fIcodeset\fR, but the latter parts after +\&\fIlanguage\fR are not always present. The \fIlanguage\fR and \fIcountry\fR +are usually from the standards \fB\s-1ISO 3166\s0\fR and \fB\s-1ISO 639\s0\fR, the +two-letter abbreviations for the countries and the languages of the +world, respectively. The \fIcodeset\fR part often mentions some \fB\s-1ISO +8859\s0\fR character set, the Latin codesets. For example, \f(CW\*(C`ISO 8859\-1\*(C'\fR +is the so-called \*(L"Western European codeset\*(R" that can be used to encode +most Western European languages adequately. Again, there are several +ways to write even the name of that one standard. Lamentably. +.PP +Two special locales are worth particular mention: \*(L"C\*(R" and \*(L"\s-1POSIX\*(R".\s0 +Currently these are effectively the same locale: the difference is +mainly that the first one is defined by the C standard, the second by +the \s-1POSIX\s0 standard. They define the \fBdefault locale\fR in which +every program starts in the absence of locale information in its +environment. (The \fIdefault\fR default locale, if you will.) Its language +is (American) English and its character codeset \s-1ASCII\s0 or, rarely, a +superset thereof (such as the \*(L"\s-1DEC\s0 Multinational Character Set +(DEC-MCS)\*(R"). \fBWarning\fR. The C locale delivered by some vendors +may not actually exactly match what the C standard calls for. So +beware. +.PP +\&\fB\s-1NOTE\s0\fR: Not all systems have the \*(L"\s-1POSIX\*(R"\s0 locale (not all systems are +POSIX-conformant), so use \*(L"C\*(R" when you need explicitly to specify this +default locale. +.SS "\s-1LOCALE PROBLEMS\s0" +.IX Subsection "LOCALE PROBLEMS" +You may encounter the following warning message at Perl startup: +.PP +.Vb 6 +\& perl: warning: Setting locale failed. +\& perl: warning: Please check that your locale settings: +\& LC_ALL = "En_US", +\& LANG = (unset) +\& are supported and installed on your system. +\& perl: warning: Falling back to the standard locale ("C"). +.Ve +.PP +This means that your locale settings had \f(CW\*(C`LC_ALL\*(C'\fR set to \*(L"En_US\*(R" and +\&\s-1LANG\s0 exists but has no value. Perl tried to believe you but could not. +Instead, Perl gave up and fell back to the \*(L"C\*(R" locale, the default locale +that is supposed to work no matter what. (On Windows, it first tries +falling back to the system default locale.) This usually means your +locale settings were wrong, they mention locales your system has never +heard of, or the locale installation in your system has problems (for +example, some system files are broken or missing). There are quick and +temporary fixes to these problems, as well as more thorough and lasting +fixes. +.SS "Testing for broken locales" +.IX Subsection "Testing for broken locales" +If you are building Perl from source, the Perl test suite file +\&\fIlib/locale.t\fR can be used to test the locales on your system. +Setting the environment variable \f(CW\*(C`PERL_DEBUG_FULL_TEST\*(C'\fR to 1 +will cause it to output detailed results. For example, on Linux, you +could say +.PP +.Vb 1 +\& PERL_DEBUG_FULL_TEST=1 ./perl \-T \-Ilib lib/locale.t > locale.log 2>&1 +.Ve +.PP +Besides many other tests, it will test every locale it finds on your +system to see if they conform to the \s-1POSIX\s0 standard. If any have +errors, it will include a summary near the end of the output of which +locales passed all its tests, and which failed, and why. +.SS "Temporarily fixing locale problems" +.IX Subsection "Temporarily fixing locale problems" +The two quickest fixes are either to render Perl silent about any +locale inconsistencies or to run Perl under the default locale \*(L"C\*(R". +.PP +Perl's moaning about locale problems can be silenced by setting the +environment variable \f(CW\*(C`PERL_BADLANG\*(C'\fR to \*(L"0\*(R" or "". +This method really just sweeps the problem under the carpet: you tell +Perl to shut up even when Perl sees that something is wrong. Do not +be surprised if later something locale-dependent misbehaves. +.PP +Perl can be run under the \*(L"C\*(R" locale by setting the environment +variable \f(CW\*(C`LC_ALL\*(C'\fR to \*(L"C\*(R". This method is perhaps a bit more civilized +than the \f(CW\*(C`PERL_BADLANG\*(C'\fR approach, but setting \f(CW\*(C`LC_ALL\*(C'\fR (or +other locale variables) may affect other programs as well, not just +Perl. In particular, external programs run from within Perl will see +these changes. If you make the new settings permanent (read on), all +programs you run see the changes. See \*(L"\s-1ENVIRONMENT\*(R"\s0 for +the full list of relevant environment variables and \*(L"\s-1USING LOCALES\*(R"\s0 +for their effects in Perl. Effects in other programs are +easily deducible. For example, the variable \f(CW\*(C`LC_COLLATE\*(C'\fR may well affect +your \fBsort\fR program (or whatever the program that arranges \*(L"records\*(R" +alphabetically in your system is called). +.PP +You can test out changing these variables temporarily, and if the +new settings seem to help, put those settings into your shell startup +files. Consult your local documentation for the exact details. For +Bourne-like shells (\fBsh\fR, \fBksh\fR, \fBbash\fR, \fBzsh\fR): +.PP +.Vb 2 +\& LC_ALL=en_US.ISO8859\-1 +\& export LC_ALL +.Ve +.PP +This assumes that we saw the locale \*(L"en_US.ISO8859\-1\*(R" using the commands +discussed above. We decided to try that instead of the above faulty +locale \*(L"En_US\*(R"\-\-and in Cshish shells (\fBcsh\fR, \fBtcsh\fR) +.PP +.Vb 1 +\& setenv LC_ALL en_US.ISO8859\-1 +.Ve +.PP +or if you have the \*(L"env\*(R" application you can do (in any shell) +.PP +.Vb 1 +\& env LC_ALL=en_US.ISO8859\-1 perl ... +.Ve +.PP +If you do not know what shell you have, consult your local +helpdesk or the equivalent. +.SS "Permanently fixing locale problems" +.IX Subsection "Permanently fixing locale problems" +The slower but superior fixes are when you may be able to yourself +fix the misconfiguration of your own environment variables. The +mis(sing)configuration of the whole system's locales usually requires +the help of your friendly system administrator. +.PP +First, see earlier in this document about \*(L"Finding locales\*(R". That tells +how to find which locales are really supported\*(--and more importantly, +installed\*(--on your system. In our example error message, environment +variables affecting the locale are listed in the order of decreasing +importance (and unset variables do not matter). Therefore, having +\&\s-1LC_ALL\s0 set to \*(L"En_US\*(R" must have been the bad choice, as shown by the +error message. First try fixing locale settings listed first. +.PP +Second, if using the listed commands you see something \fBexactly\fR +(prefix matches do not count and case usually counts) like \*(L"En_US\*(R" +without the quotes, then you should be okay because you are using a +locale name that should be installed and available in your system. +In this case, see \*(L"Permanently fixing your system's locale configuration\*(R". +.SS "Permanently fixing your system's locale configuration" +.IX Subsection "Permanently fixing your system's locale configuration" +This is when you see something like: +.PP +.Vb 4 +\& perl: warning: Please check that your locale settings: +\& LC_ALL = "En_US", +\& LANG = (unset) +\& are supported and installed on your system. +.Ve +.PP +but then cannot see that \*(L"En_US\*(R" listed by the above-mentioned +commands. You may see things like \*(L"en_US.ISO8859\-1\*(R", but that isn't +the same. In this case, try running under a locale +that you can list and which somehow matches what you tried. The +rules for matching locale names are a bit vague because +standardization is weak in this area. See again the +\&\*(L"Finding locales\*(R" about general rules. +.SS "Fixing system locale configuration" +.IX Subsection "Fixing system locale configuration" +Contact a system administrator (preferably your own) and report the exact +error message you get, and ask them to read this same documentation you +are now reading. They should be able to check whether there is something +wrong with the locale configuration of the system. The \*(L"Finding locales\*(R" +section is unfortunately a bit vague about the exact commands and places +because these things are not that standardized. +.SS "The localeconv function" +.IX Subsection "The localeconv function" +The \f(CW\*(C`POSIX::localeconv()\*(C'\fR function allows you to get particulars of the +locale-dependent numeric formatting information specified by the current +underlying \f(CW\*(C`LC_NUMERIC\*(C'\fR and \f(CW\*(C`LC_MONETARY\*(C'\fR locales (regardless of +whether called from within the scope of \f(CW\*(C`use\ locale\*(C'\fR or not). (If +you just want the name of +the current locale for a particular category, use \f(CW\*(C`POSIX::setlocale()\*(C'\fR +with a single parameter\*(--see \*(L"The setlocale function\*(R".) +.PP +.Vb 1 +\& use POSIX qw(locale_h); +\& +\& # Get a reference to a hash of locale\-dependent info +\& $locale_values = localeconv(); +\& +\& # Output sorted list of the values +\& for (sort keys %$locale_values) { +\& printf "%\-20s = %s\en", $_, $locale_values\->{$_} +\& } +.Ve +.PP +\&\f(CW\*(C`localeconv()\*(C'\fR takes no arguments, and returns \fBa reference to\fR a hash. +The keys of this hash are variable names for formatting, such as +\&\f(CW\*(C`decimal_point\*(C'\fR and \f(CW\*(C`thousands_sep\*(C'\fR. The values are the +corresponding, er, values. See \*(L"localeconv\*(R" in \s-1POSIX\s0 for a longer +example listing the categories an implementation might be expected to +provide; some provide more and others fewer. You don't need an +explicit \f(CW\*(C`use locale\*(C'\fR, because \f(CW\*(C`localeconv()\*(C'\fR always observes the +current locale. +.PP +Here's a simple-minded example program that rewrites its command-line +parameters as integers correctly formatted in the current locale: +.PP +.Vb 1 +\& use POSIX qw(locale_h); +\& +\& # Get some of locale\*(Aqs numeric formatting parameters +\& my ($thousands_sep, $grouping) = +\& @{localeconv()}{\*(Aqthousands_sep\*(Aq, \*(Aqgrouping\*(Aq}; +\& +\& # Apply defaults if values are missing +\& $thousands_sep = \*(Aq,\*(Aq unless $thousands_sep; +\& +\& # grouping and mon_grouping are packed lists +\& # of small integers (characters) telling the +\& # grouping (thousand_seps and mon_thousand_seps +\& # being the group dividers) of numbers and +\& # monetary quantities. The integers\*(Aq meanings: +\& # 255 means no more grouping, 0 means repeat +\& # the previous grouping, 1\-254 means use that +\& # as the current grouping. Grouping goes from +\& # right to left (low to high digits). In the +\& # below we cheat slightly by never using anything +\& # else than the first grouping (whatever that is). +\& if ($grouping) { +\& @grouping = unpack("C*", $grouping); +\& } else { +\& @grouping = (3); +\& } +\& +\& # Format command line params for current locale +\& for (@ARGV) { +\& $_ = int; # Chop non\-integer part +\& 1 while +\& s/(\ed)(\ed{$grouping[0]}($|$thousands_sep))/$1$thousands_sep$2/; +\& print "$_"; +\& } +\& print "\en"; +.Ve +.PP +Note that if the platform doesn't have \f(CW\*(C`LC_NUMERIC\*(C'\fR and/or +\&\f(CW\*(C`LC_MONETARY\*(C'\fR available or enabled, the corresponding elements of the +hash will be missing. +.SS "I18N::Langinfo" +.IX Subsection "I18N::Langinfo" +Another interface for querying locale-dependent information is the +\&\f(CW\*(C`I18N::Langinfo::langinfo()\*(C'\fR function. +.PP +The following example will import the \f(CW\*(C`langinfo()\*(C'\fR function itself and +three constants to be used as arguments to \f(CW\*(C`langinfo()\*(C'\fR: a constant for +the abbreviated first day of the week (the numbering starts from +Sunday = 1) and two more constants for the affirmative and negative +answers for a yes/no question in the current locale. +.PP +.Vb 1 +\& use I18N::Langinfo qw(langinfo ABDAY_1 YESSTR NOSTR); +\& +\& my ($abday_1, $yesstr, $nostr) +\& = map { langinfo } qw(ABDAY_1 YESSTR NOSTR); +\& +\& print "$abday_1? [$yesstr/$nostr] "; +.Ve +.PP +In other words, in the \*(L"C\*(R" (or English) locale the above will probably +print something like: +.PP +.Vb 1 +\& Sun? [yes/no] +.Ve +.PP +See I18N::Langinfo for more information. +.SH "LOCALE CATEGORIES" +.IX Header "LOCALE CATEGORIES" +The following subsections describe basic locale categories. Beyond these, +some combination categories allow manipulation of more than one +basic category at a time. See \*(L"\s-1ENVIRONMENT\*(R"\s0 for a discussion of these. +.ie n .SS "Category ""LC_COLLATE"": Collation: Text Comparisons and Sorting" +.el .SS "Category \f(CWLC_COLLATE\fP: Collation: Text Comparisons and Sorting" +.IX Subsection "Category LC_COLLATE: Collation: Text Comparisons and Sorting" +In the scope of a \f(CW\*(C`use\ locale\*(C'\fR form that includes collation, Perl +looks to the \f(CW\*(C`LC_COLLATE\*(C'\fR +environment variable to determine the application's notions on collation +(ordering) of characters. For example, \*(L"b\*(R" follows \*(L"a\*(R" in Latin +alphabets, but where do \*(L"a\*'\*(R" and \*(L"a\*o\*(R" belong? And while +\&\*(L"color\*(R" follows \*(L"chocolate\*(R" in English, what about in traditional Spanish? +.PP +The following collations all make sense and you may meet any of them +if you \f(CW"use locale"\fR. +.PP +.Vb 4 +\& A B C D E a b c d e +\& A a B b C c D d E e +\& a A b B c C d D e E +\& a b c d e A B C D E +.Ve +.PP +Here is a code snippet to tell what \*(L"word\*(R" +characters are in the current locale, in that locale's order: +.PP +.Vb 2 +\& use locale; +\& print +(sort grep /\ew/, map { chr } 0..255), "\en"; +.Ve +.PP +Compare this with the characters that you see and their order if you +state explicitly that the locale should be ignored: +.PP +.Vb 2 +\& no locale; +\& print +(sort grep /\ew/, map { chr } 0..255), "\en"; +.Ve +.PP +This machine-native collation (which is what you get unless \f(CW\*(C`use\ locale\*(C'\fR has appeared earlier in the same block) must be used for +sorting raw binary data, whereas the locale-dependent collation of the +first example is useful for natural text. +.PP +As noted in \*(L"\s-1USING LOCALES\*(R"\s0, \f(CW\*(C`cmp\*(C'\fR compares according to the current +collation locale when \f(CW\*(C`use locale\*(C'\fR is in effect, but falls back to a +char-by-char comparison for strings that the locale says are equal. You +can use \f(CW\*(C`POSIX::strcoll()\*(C'\fR if you don't want this fall-back: +.PP +.Vb 3 +\& use POSIX qw(strcoll); +\& $equal_in_locale = +\& !strcoll("space and case ignored", "SpaceAndCaseIgnored"); +.Ve +.PP +\&\f(CW$equal_in_locale\fR will be true if the collation locale specifies a +dictionary-like ordering that ignores space characters completely and +which folds case. +.PP +Perl uses the platform's C library collation functions \f(CW\*(C`strcoll()\*(C'\fR and +\&\f(CW\*(C`strxfrm()\*(C'\fR. That means you get whatever they give. On some +platforms, these functions work well on \s-1UTF\-8\s0 locales, giving +a reasonable default collation for the code points that are important in +that locale. (And if they aren't working well, the problem may only be +that the locale definition is deficient, so can be fixed by using a +better definition file. Unicode's definitions (see \*(L"Freely available +locale definitions\*(R") provide reasonable \s-1UTF\-8\s0 locale collation +definitions.) Starting in Perl v5.26, Perl's use of these functions has +been made more seamless. This may be sufficient for your needs. For +more control, and to make sure strings containing any code point (not +just the ones important in the locale) collate properly, the +Unicode::Collate module is suggested. +.PP +In non\-UTF\-8 locales (hence single byte), code points above 0xFF are +technically invalid. But if present, again starting in v5.26, they will +collate to the same position as the highest valid code point does. This +generally gives good results, but the collation order may be skewed if +the valid code point gets special treatment when it forms particular +sequences with other characters as defined by the locale. +When two strings collate identically, the code point order is used as a +tie breaker. +.PP +If Perl detects that there are problems with the locale collation order, +it reverts to using non-locale collation rules for that locale. +.PP +If you have a single string that you want to check for \*(L"equality in +locale\*(R" against several others, you might think you could gain a little +efficiency by using \f(CW\*(C`POSIX::strxfrm()\*(C'\fR in conjunction with \f(CW\*(C`eq\*(C'\fR: +.PP +.Vb 8 +\& use POSIX qw(strxfrm); +\& $xfrm_string = strxfrm("Mixed\-case string"); +\& print "locale collation ignores spaces\en" +\& if $xfrm_string eq strxfrm("Mixed\-casestring"); +\& print "locale collation ignores hyphens\en" +\& if $xfrm_string eq strxfrm("Mixedcase string"); +\& print "locale collation ignores case\en" +\& if $xfrm_string eq strxfrm("mixed\-case string"); +.Ve +.PP +\&\f(CW\*(C`strxfrm()\*(C'\fR takes a string and maps it into a transformed string for use +in char-by-char comparisons against other transformed strings during +collation. \*(L"Under the hood\*(R", locale-affected Perl comparison operators +call \f(CW\*(C`strxfrm()\*(C'\fR for both operands, then do a char-by-char +comparison of the transformed strings. By calling \f(CW\*(C`strxfrm()\*(C'\fR explicitly +and using a non locale-affected comparison, the example attempts to save +a couple of transformations. But in fact, it doesn't save anything: Perl +magic (see \*(L"Magic Variables\*(R" in perlguts) creates the transformed version of a +string the first time it's needed in a comparison, then keeps this version around +in case it's needed again. An example rewritten the easy way with +\&\f(CW\*(C`cmp\*(C'\fR runs just about as fast. It also copes with null characters +embedded in strings; if you call \f(CW\*(C`strxfrm()\*(C'\fR directly, it treats the first +null it finds as a terminator. Don't expect the transformed strings +it produces to be portable across systems\*(--or even from one revision +of your operating system to the next. In short, don't call \f(CW\*(C`strxfrm()\*(C'\fR +directly: let Perl do it for you. +.PP +Note: \f(CW\*(C`use locale\*(C'\fR isn't shown in some of these examples because it isn't +needed: \f(CW\*(C`strcoll()\*(C'\fR and \f(CW\*(C`strxfrm()\*(C'\fR are \s-1POSIX\s0 functions +which use the standard system-supplied \f(CW\*(C`libc\*(C'\fR functions that +always obey the current \f(CW\*(C`LC_COLLATE\*(C'\fR locale. +.ie n .SS "Category ""LC_CTYPE"": Character Types" +.el .SS "Category \f(CWLC_CTYPE\fP: Character Types" +.IX Subsection "Category LC_CTYPE: Character Types" +In the scope of a \f(CW\*(C`use\ locale\*(C'\fR form that includes \f(CW\*(C`LC_CTYPE\*(C'\fR, Perl +obeys the \f(CW\*(C`LC_CTYPE\*(C'\fR locale +setting. This controls the application's notion of which characters are +alphabetic, numeric, punctuation, \fIetc\fR. This affects Perl's \f(CW\*(C`\ew\*(C'\fR +regular expression metanotation, +which stands for alphanumeric characters\*(--that is, alphabetic, +numeric, and the platform's native underscore. +(Consult perlre for more information about +regular expressions.) Thanks to \f(CW\*(C`LC_CTYPE\*(C'\fR, depending on your locale +setting, characters like \*(L"\*(ae\*(R", \*(L"\*(d-\*(R", \*(L"\*8\*(R", and +\&\*(L"o\*/\*(R" may be understood as \f(CW\*(C`\ew\*(C'\fR characters. +It also affects things like \f(CW\*(C`\es\*(C'\fR, \f(CW\*(C`\eD\*(C'\fR, and the \s-1POSIX\s0 character +classes, like \f(CW\*(C`[[:graph:]]\*(C'\fR. (See perlrecharclass for more +information on all these.) +.PP +The \f(CW\*(C`LC_CTYPE\*(C'\fR locale also provides the map used in transliterating +characters between lower and uppercase. This affects the case-mapping +functions\*(--\f(CW\*(C`fc()\*(C'\fR, \f(CW\*(C`lc()\*(C'\fR, \f(CW\*(C`lcfirst()\*(C'\fR, \f(CW\*(C`uc()\*(C'\fR, and \f(CW\*(C`ucfirst()\*(C'\fR; +case-mapping +interpolation with \f(CW\*(C`\eF\*(C'\fR, \f(CW\*(C`\el\*(C'\fR, \f(CW\*(C`\eL\*(C'\fR, \f(CW\*(C`\eu\*(C'\fR, or \f(CW\*(C`\eU\*(C'\fR in double-quoted +strings and \f(CW\*(C`s///\*(C'\fR substitutions; and case-insensitive regular expression +pattern matching using the \f(CW\*(C`i\*(C'\fR modifier. +.PP +Starting in v5.20, Perl supports \s-1UTF\-8\s0 locales for \f(CW\*(C`LC_CTYPE\*(C'\fR, but +otherwise Perl only supports single-byte locales, such as the \s-1ISO 8859\s0 +series. This means that wide character locales, for example for Asian +languages, are not well-supported. Use of these locales may cause core +dumps. If the platform has the capability for Perl to detect such a +locale, starting in Perl v5.22, Perl will warn, default +enabled, using the \f(CW\*(C`locale\*(C'\fR warning +category, whenever such a locale is switched into. The \s-1UTF\-8\s0 locale +support is actually a +superset of \s-1POSIX\s0 locales, because it is really full Unicode behavior +as if no \f(CW\*(C`LC_CTYPE\*(C'\fR locale were in effect at all (except for tainting; +see \*(L"\s-1SECURITY\*(R"\s0). \s-1POSIX\s0 locales, even \s-1UTF\-8\s0 ones, +are lacking certain concepts in Unicode, such as the idea that changing +the case of a character could expand to be more than one character. +Perl in a \s-1UTF\-8\s0 locale, will give you that expansion. Prior to v5.20, +Perl treated a \s-1UTF\-8\s0 locale on some platforms like an \s-1ISO 8859\-1\s0 one, +with some restrictions, and on other platforms more like the \*(L"C\*(R" locale. +For releases v5.16 and v5.18, \f(CW\*(C`use\ locale\ \*(Aqnot_characters\*(C'\fR could be +used as a workaround for this (see \*(L"Unicode and \s-1UTF\-8\*(R"\s0). +.PP +Note that there are quite a few things that are unaffected by the +current locale. Any literal character is the native character for the +given platform. Hence 'A' means the character at code point 65 on \s-1ASCII\s0 +platforms, and 193 on \s-1EBCDIC.\s0 That may or may not be an 'A' in the +current locale, if that locale even has an 'A'. +Similarly, all the escape sequences for particular characters, +\&\f(CW\*(C`\en\*(C'\fR for example, always mean the platform's native one. This means, +for example, that \f(CW\*(C`\eN\*(C'\fR in regular expressions (every character +but new-line) works on the platform character set. +.PP +Starting in v5.22, Perl will by default warn when switching into a +locale that redefines any \s-1ASCII\s0 printable character (plus \f(CW\*(C`\et\*(C'\fR and +\&\f(CW\*(C`\en\*(C'\fR) into a different class than expected. This is likely to +happen on modern locales only on \s-1EBCDIC\s0 platforms, where, for example, +a \s-1CCSID 0037\s0 locale on a \s-1CCSID 1047\s0 machine moves \f(CW"["\fR, but it can +happen on \s-1ASCII\s0 platforms with the \s-1ISO 646\s0 and other +7\-bit locales that are essentially obsolete. Things may still work, +depending on what features of Perl are used by the program. For +example, in the example from above where \f(CW"|"\fR becomes a \f(CW\*(C`\ew\*(C'\fR, and +there are no regular expressions where this matters, the program may +still work properly. The warning lists all the characters that +it can determine could be adversely affected. +.PP +\&\fBNote:\fR A broken or malicious \f(CW\*(C`LC_CTYPE\*(C'\fR locale definition may result +in clearly ineligible characters being considered to be alphanumeric by +your application. For strict matching of (mundane) \s-1ASCII\s0 letters and +digits\*(--for example, in command strings\*(--locale\-aware applications +should use \f(CW\*(C`\ew\*(C'\fR with the \f(CW\*(C`/a\*(C'\fR regular expression modifier. See \*(L"\s-1SECURITY\*(R"\s0. +.ie n .SS "Category ""LC_NUMERIC"": Numeric Formatting" +.el .SS "Category \f(CWLC_NUMERIC\fP: Numeric Formatting" +.IX Subsection "Category LC_NUMERIC: Numeric Formatting" +After a proper \f(CW\*(C`POSIX::setlocale()\*(C'\fR call, and within the scope +of a \f(CW\*(C`use locale\*(C'\fR form that includes numerics, Perl obeys the +\&\f(CW\*(C`LC_NUMERIC\*(C'\fR locale information, which controls an application's idea +of how numbers should be formatted for human readability. +In most implementations the only effect is to +change the character used for the decimal point\*(--perhaps from \*(L".\*(R" to \*(L",\*(R". +The functions aren't aware of such niceties as thousands separation and +so on. (See \*(L"The localeconv function\*(R" if you care about these things.) +.PP +.Vb 2 +\& use POSIX qw(strtod setlocale LC_NUMERIC); +\& use locale; +\& +\& setlocale LC_NUMERIC, ""; +\& +\& $n = 5/2; # Assign numeric 2.5 to $n +\& +\& $a = " $n"; # Locale\-dependent conversion to string +\& +\& print "half five is $n\en"; # Locale\-dependent output +\& +\& printf "half five is %g\en", $n; # Locale\-dependent output +\& +\& print "DECIMAL POINT IS COMMA\en" +\& if $n == (strtod("2,5"))[0]; # Locale\-dependent conversion +.Ve +.PP +See also I18N::Langinfo and \f(CW\*(C`RADIXCHAR\*(C'\fR. +.ie n .SS "Category ""LC_MONETARY"": Formatting of monetary amounts" +.el .SS "Category \f(CWLC_MONETARY\fP: Formatting of monetary amounts" +.IX Subsection "Category LC_MONETARY: Formatting of monetary amounts" +The C standard defines the \f(CW\*(C`LC_MONETARY\*(C'\fR category, but not a function +that is affected by its contents. (Those with experience of standards +committees will recognize that the working group decided to punt on the +issue.) Consequently, Perl essentially takes no notice of it. If you +really want to use \f(CW\*(C`LC_MONETARY\*(C'\fR, you can query its contents\*(--see +\&\*(L"The localeconv function\*(R"\-\-and use the information that it returns in your +application's own formatting of currency amounts. However, you may well +find that the information, voluminous and complex though it may be, still +does not quite meet your requirements: currency formatting is a hard nut +to crack. +.PP +See also I18N::Langinfo and \f(CW\*(C`CRNCYSTR\*(C'\fR. +.ie n .SS "Category ""LC_TIME"": Respresentation of time" +.el .SS "Category \f(CWLC_TIME\fP: Respresentation of time" +.IX Subsection "Category LC_TIME: Respresentation of time" +Output produced by \f(CW\*(C`POSIX::strftime()\*(C'\fR, which builds a formatted +human-readable date/time string, is affected by the current \f(CW\*(C`LC_TIME\*(C'\fR +locale. Thus, in a French locale, the output produced by the \f(CW%B\fR +format element (full month name) for the first month of the year would +be \*(L"janvier\*(R". Here's how to get a list of long month names in the +current locale: +.PP +.Vb 5 +\& use POSIX qw(strftime); +\& for (0..11) { +\& $long_month_name[$_] = +\& strftime("%B", 0, 0, 0, 1, $_, 96); +\& } +.Ve +.PP +Note: \f(CW\*(C`use locale\*(C'\fR isn't needed in this example: \f(CW\*(C`strftime()\*(C'\fR is a \s-1POSIX\s0 +function which uses the standard system-supplied \f(CW\*(C`libc\*(C'\fR function that +always obeys the current \f(CW\*(C`LC_TIME\*(C'\fR locale. +.PP +See also I18N::Langinfo and \f(CW\*(C`ABDAY_1\*(C'\fR..\f(CW\*(C`ABDAY_7\*(C'\fR, \f(CW\*(C`DAY_1\*(C'\fR..\f(CW\*(C`DAY_7\*(C'\fR, +\&\f(CW\*(C`ABMON_1\*(C'\fR..\f(CW\*(C`ABMON_12\*(C'\fR, and \f(CW\*(C`ABMON_1\*(C'\fR..\f(CW\*(C`ABMON_12\*(C'\fR. +.SS "Other categories" +.IX Subsection "Other categories" +The remaining locale categories are not currently used by Perl itself. +But again note that things Perl interacts with may use these, including +extensions outside the standard Perl distribution, and by the +operating system and its utilities. Note especially that the string +value of \f(CW$!\fR and the error messages given by external utilities may +be changed by \f(CW\*(C`LC_MESSAGES\*(C'\fR. If you want to have portable error +codes, use \f(CW\*(C`%!\*(C'\fR. See Errno. +.SH "SECURITY" +.IX Header "SECURITY" +Although the main discussion of Perl security issues can be found in +perlsec, a discussion of Perl's locale handling would be incomplete +if it did not draw your attention to locale-dependent security issues. +Locales\*(--particularly on systems that allow unprivileged users to +build their own locales\*(--are untrustworthy. A malicious (or just plain +broken) locale can make a locale-aware application give unexpected +results. Here are a few possibilities: +.IP "\(bu" 4 +Regular expression checks for safe file names or mail addresses using +\&\f(CW\*(C`\ew\*(C'\fR may be spoofed by an \f(CW\*(C`LC_CTYPE\*(C'\fR locale that claims that +characters such as \f(CW">"\fR and \f(CW"|"\fR are alphanumeric. +.IP "\(bu" 4 +String interpolation with case-mapping, as in, say, \f(CW\*(C`$dest = +"C:\eU$name.$ext"\*(C'\fR, may produce dangerous results if a bogus \f(CW\*(C`LC_CTYPE\*(C'\fR +case-mapping table is in effect. +.IP "\(bu" 4 +A sneaky \f(CW\*(C`LC_COLLATE\*(C'\fR locale could result in the names of students with +\&\*(L"D\*(R" grades appearing ahead of those with \*(L"A\*(R"s. +.IP "\(bu" 4 +An application that takes the trouble to use information in +\&\f(CW\*(C`LC_MONETARY\*(C'\fR may format debits as if they were credits and vice versa +if that locale has been subverted. Or it might make payments in \s-1US\s0 +dollars instead of Hong Kong dollars. +.IP "\(bu" 4 +The date and day names in dates formatted by \f(CW\*(C`strftime()\*(C'\fR could be +manipulated to advantage by a malicious user able to subvert the +\&\f(CW\*(C`LC_DATE\*(C'\fR locale. (\*(L"Look\*(--it says I wasn't in the building on +Sunday.\*(R") +.PP +Such dangers are not peculiar to the locale system: any aspect of an +application's environment which may be modified maliciously presents +similar challenges. Similarly, they are not specific to Perl: any +programming language that allows you to write programs that take +account of their environment exposes you to these issues. +.PP +Perl cannot protect you from all possibilities shown in the +examples\*(--there is no substitute for your own vigilance\*(--but, when +\&\f(CW\*(C`use locale\*(C'\fR is in effect, Perl uses the tainting mechanism (see +perlsec) to mark string results that become locale-dependent, and +which may be untrustworthy in consequence. Here is a summary of the +tainting behavior of operators and functions that may be affected by +the locale: +.IP "\(bu" 4 +\&\fBComparison operators\fR (\f(CW\*(C`lt\*(C'\fR, \f(CW\*(C`le\*(C'\fR, \f(CW\*(C`ge\*(C'\fR, \f(CW\*(C`gt\*(C'\fR and \f(CW\*(C`cmp\*(C'\fR): +.Sp +Scalar true/false (or less/equal/greater) result is never tainted. +.IP "\(bu" 4 +\&\fBCase-mapping interpolation\fR (with \f(CW\*(C`\el\*(C'\fR, \f(CW\*(C`\eL\*(C'\fR, \f(CW\*(C`\eu\*(C'\fR, \f(CW\*(C`\eU\*(C'\fR, or \f(CW\*(C`\eF\*(C'\fR) +.Sp +The result string containing interpolated material is tainted if +a \f(CW\*(C`use locale\*(C'\fR form that includes \f(CW\*(C`LC_CTYPE\*(C'\fR is in effect. +.IP "\(bu" 4 +\&\fBMatching operator\fR (\f(CW\*(C`m//\*(C'\fR): +.Sp +Scalar true/false result never tainted. +.Sp +All subpatterns, either delivered as a list-context result or as \f(CW$1\fR +\&\fIetc\fR., are tainted if a \f(CW\*(C`use locale\*(C'\fR form that includes +\&\f(CW\*(C`LC_CTYPE\*(C'\fR is in effect, and the subpattern +regular expression contains a locale-dependent construct. These +constructs include \f(CW\*(C`\ew\*(C'\fR (to match an alphanumeric character), \f(CW\*(C`\eW\*(C'\fR +(non-alphanumeric character), \f(CW\*(C`\eb\*(C'\fR and \f(CW\*(C`\eB\*(C'\fR (word-boundary and +non-boundardy, which depend on what \f(CW\*(C`\ew\*(C'\fR and \f(CW\*(C`\eW\*(C'\fR match), \f(CW\*(C`\es\*(C'\fR +(whitespace character), \f(CW\*(C`\eS\*(C'\fR (non whitespace character), \f(CW\*(C`\ed\*(C'\fR and +\&\f(CW\*(C`\eD\*(C'\fR (digits and non-digits), and the \s-1POSIX\s0 character classes, such as +\&\f(CW\*(C`[:alpha:]\*(C'\fR (see \*(L"\s-1POSIX\s0 Character Classes\*(R" in perlrecharclass). +.Sp +Tainting is also likely if the pattern is to be matched +case-insensitively (via \f(CW\*(C`/i\*(C'\fR). The exception is if all the code points +to be matched this way are above 255 and do not have folds under Unicode +rules to below 256. Tainting is not done for these because Perl +only uses Unicode rules for such code points, and those rules are the +same no matter what the current locale. +.Sp +The matched-pattern variables, \f(CW$&\fR, \f(CW\*(C`$\`\*(C'\fR (pre-match), \f(CW\*(C`$\*(Aq\*(C'\fR +(post-match), and \f(CW$+\fR (last match) also are tainted. +.IP "\(bu" 4 +\&\fBSubstitution operator\fR (\f(CW\*(C`s///\*(C'\fR): +.Sp +Has the same behavior as the match operator. Also, the left +operand of \f(CW\*(C`=~\*(C'\fR becomes tainted when a \f(CW\*(C`use locale\*(C'\fR +form that includes \f(CW\*(C`LC_CTYPE\*(C'\fR is in effect, if modified as +a result of a substitution based on a regular +expression match involving any of the things mentioned in the previous +item, or of case-mapping, such as \f(CW\*(C`\el\*(C'\fR, \f(CW\*(C`\eL\*(C'\fR,\f(CW\*(C`\eu\*(C'\fR, \f(CW\*(C`\eU\*(C'\fR, or \f(CW\*(C`\eF\*(C'\fR. +.IP "\(bu" 4 +\&\fBOutput formatting functions\fR (\f(CW\*(C`printf()\*(C'\fR and \f(CW\*(C`write()\*(C'\fR): +.Sp +Results are never tainted because otherwise even output from print, +for example \f(CW\*(C`print(1/7)\*(C'\fR, should be tainted if \f(CW\*(C`use locale\*(C'\fR is in +effect. +.IP "\(bu" 4 +\&\fBCase-mapping functions\fR (\f(CW\*(C`lc()\*(C'\fR, \f(CW\*(C`lcfirst()\*(C'\fR, \f(CW\*(C`uc()\*(C'\fR, \f(CW\*(C`ucfirst()\*(C'\fR): +.Sp +Results are tainted if a \f(CW\*(C`use locale\*(C'\fR form that includes \f(CW\*(C`LC_CTYPE\*(C'\fR is +in effect. +.IP "\(bu" 4 +\&\fB\s-1POSIX\s0 locale-dependent functions\fR (\f(CW\*(C`localeconv()\*(C'\fR, \f(CW\*(C`strcoll()\*(C'\fR, +\&\f(CW\*(C`strftime()\*(C'\fR, \f(CW\*(C`strxfrm()\*(C'\fR): +.Sp +Results are never tainted. +.PP +Three examples illustrate locale-dependent tainting. +The first program, which ignores its locale, won't run: a value taken +directly from the command line may not be used to name an output file +when taint checks are enabled. +.PP +.Vb 2 +\& #/usr/local/bin/perl \-T +\& # Run with taint checking +\& +\& # Command line sanity check omitted... +\& $tainted_output_file = shift; +\& +\& open(F, ">$tainted_output_file") +\& or warn "Open of $tainted_output_file failed: $!\en"; +.Ve +.PP +The program can be made to run by \*(L"laundering\*(R" the tainted value through +a regular expression: the second example\*(--which still ignores locale +information\*(--runs, creating the file named on its command line +if it can. +.PP +.Vb 1 +\& #/usr/local/bin/perl \-T +\& +\& $tainted_output_file = shift; +\& $tainted_output_file =~ m%[\ew/]+%; +\& $untainted_output_file = $&; +\& +\& open(F, ">$untainted_output_file") +\& or warn "Open of $untainted_output_file failed: $!\en"; +.Ve +.PP +Compare this with a similar but locale-aware program: +.PP +.Vb 1 +\& #/usr/local/bin/perl \-T +\& +\& $tainted_output_file = shift; +\& use locale; +\& $tainted_output_file =~ m%[\ew/]+%; +\& $localized_output_file = $&; +\& +\& open(F, ">$localized_output_file") +\& or warn "Open of $localized_output_file failed: $!\en"; +.Ve +.PP +This third program fails to run because \f(CW$&\fR is tainted: it is the result +of a match involving \f(CW\*(C`\ew\*(C'\fR while \f(CW\*(C`use locale\*(C'\fR is in effect. +.SH "ENVIRONMENT" +.IX Header "ENVIRONMENT" +.IP "\s-1PERL_SKIP_LOCALE_INIT\s0" 12 +.IX Item "PERL_SKIP_LOCALE_INIT" +This environment variable, available starting in Perl v5.20, if set +(to any value), tells Perl to not use the rest of the +environment variables to initialize with. Instead, Perl uses whatever +the current locale settings are. This is particularly useful in +embedded environments, see +\&\*(L"Using embedded Perl with \s-1POSIX\s0 locales\*(R" in perlembed. +.IP "\s-1PERL_BADLANG\s0" 12 +.IX Item "PERL_BADLANG" +A string that can suppress Perl's warning about failed locale settings +at startup. Failure can occur if the locale support in the operating +system is lacking (broken) in some way\*(--or if you mistyped the name of +a locale when you set up your environment. If this environment +variable is absent, or has a value other than \*(L"0\*(R" or "", Perl will +complain about locale setting failures. +.Sp +\&\fB\s-1NOTE\s0\fR: \f(CW\*(C`PERL_BADLANG\*(C'\fR only gives you a way to hide the warning message. +The message tells about some problem in your system's locale support, +and you should investigate what the problem is. +.PP +The following environment variables are not specific to Perl: They are +part of the standardized (\s-1ISO C, XPG4, POSIX 1\s0.c) \f(CW\*(C`setlocale()\*(C'\fR method +for controlling an application's opinion on data. Windows is non-POSIX, +but Perl arranges for the following to work as described anyway. +If the locale given by an environment variable is not valid, Perl tries +the next lower one in priority. If none are valid, on Windows, the +system default locale is then tried. If all else fails, the \f(CW"C"\fR +locale is used. If even that doesn't work, something is badly broken, +but Perl tries to forge ahead with whatever the locale settings might +be. +.ie n .IP """LC_ALL""" 12 +.el .IP "\f(CWLC_ALL\fR" 12 +.IX Item "LC_ALL" +\&\f(CW\*(C`LC_ALL\*(C'\fR is the \*(L"override-all\*(R" locale environment variable. If +set, it overrides all the rest of the locale environment variables. +.ie n .IP """LANGUAGE""" 12 +.el .IP "\f(CWLANGUAGE\fR" 12 +.IX Item "LANGUAGE" +\&\fB\s-1NOTE\s0\fR: \f(CW\*(C`LANGUAGE\*(C'\fR is a \s-1GNU\s0 extension, it affects you only if you +are using the \s-1GNU\s0 libc. This is the case if you are using e.g. Linux. +If you are using \*(L"commercial\*(R" Unixes you are most probably \fInot\fR +using \s-1GNU\s0 libc and you can ignore \f(CW\*(C`LANGUAGE\*(C'\fR. +.Sp +However, in the case you are using \f(CW\*(C`LANGUAGE\*(C'\fR: it affects the +language of informational, warning, and error messages output by +commands (in other words, it's like \f(CW\*(C`LC_MESSAGES\*(C'\fR) but it has higher +priority than \f(CW\*(C`LC_ALL\*(C'\fR. Moreover, it's not a single value but +instead a \*(L"path\*(R" (\*(L":\*(R"\-separated list) of \fIlanguages\fR (not locales). +See the \s-1GNU\s0 \f(CW\*(C`gettext\*(C'\fR library documentation for more information. +.ie n .IP """LC_CTYPE""" 12 +.el .IP "\f(CWLC_CTYPE\fR" 12 +.IX Item "LC_CTYPE" +In the absence of \f(CW\*(C`LC_ALL\*(C'\fR, \f(CW\*(C`LC_CTYPE\*(C'\fR chooses the character type +locale. In the absence of both \f(CW\*(C`LC_ALL\*(C'\fR and \f(CW\*(C`LC_CTYPE\*(C'\fR, \f(CW\*(C`LANG\*(C'\fR +chooses the character type locale. +.ie n .IP """LC_COLLATE""" 12 +.el .IP "\f(CWLC_COLLATE\fR" 12 +.IX Item "LC_COLLATE" +In the absence of \f(CW\*(C`LC_ALL\*(C'\fR, \f(CW\*(C`LC_COLLATE\*(C'\fR chooses the collation +(sorting) locale. In the absence of both \f(CW\*(C`LC_ALL\*(C'\fR and \f(CW\*(C`LC_COLLATE\*(C'\fR, +\&\f(CW\*(C`LANG\*(C'\fR chooses the collation locale. +.ie n .IP """LC_MONETARY""" 12 +.el .IP "\f(CWLC_MONETARY\fR" 12 +.IX Item "LC_MONETARY" +In the absence of \f(CW\*(C`LC_ALL\*(C'\fR, \f(CW\*(C`LC_MONETARY\*(C'\fR chooses the monetary +formatting locale. In the absence of both \f(CW\*(C`LC_ALL\*(C'\fR and \f(CW\*(C`LC_MONETARY\*(C'\fR, +\&\f(CW\*(C`LANG\*(C'\fR chooses the monetary formatting locale. +.ie n .IP """LC_NUMERIC""" 12 +.el .IP "\f(CWLC_NUMERIC\fR" 12 +.IX Item "LC_NUMERIC" +In the absence of \f(CW\*(C`LC_ALL\*(C'\fR, \f(CW\*(C`LC_NUMERIC\*(C'\fR chooses the numeric format +locale. In the absence of both \f(CW\*(C`LC_ALL\*(C'\fR and \f(CW\*(C`LC_NUMERIC\*(C'\fR, \f(CW\*(C`LANG\*(C'\fR +chooses the numeric format. +.ie n .IP """LC_TIME""" 12 +.el .IP "\f(CWLC_TIME\fR" 12 +.IX Item "LC_TIME" +In the absence of \f(CW\*(C`LC_ALL\*(C'\fR, \f(CW\*(C`LC_TIME\*(C'\fR chooses the date and time +formatting locale. In the absence of both \f(CW\*(C`LC_ALL\*(C'\fR and \f(CW\*(C`LC_TIME\*(C'\fR, +\&\f(CW\*(C`LANG\*(C'\fR chooses the date and time formatting locale. +.ie n .IP """LANG""" 12 +.el .IP "\f(CWLANG\fR" 12 +.IX Item "LANG" +\&\f(CW\*(C`LANG\*(C'\fR is the \*(L"catch-all\*(R" locale environment variable. If it is set, it +is used as the last resort after the overall \f(CW\*(C`LC_ALL\*(C'\fR and the +category-specific \f(CW\*(C`LC_\f(CIfoo\f(CW\*(C'\fR. +.SS "Examples" +.IX Subsection "Examples" +The \f(CW\*(C`LC_NUMERIC\*(C'\fR controls the numeric output: +.PP +.Vb 4 +\& use locale; +\& use POSIX qw(locale_h); # Imports setlocale() and the LC_ constants. +\& setlocale(LC_NUMERIC, "fr_FR") or die "Pardon"; +\& printf "%g\en", 1.23; # If the "fr_FR" succeeded, probably shows 1,23. +.Ve +.PP +and also how strings are parsed by \f(CW\*(C`POSIX::strtod()\*(C'\fR as numbers: +.PP +.Vb 5 +\& use locale; +\& use POSIX qw(locale_h strtod); +\& setlocale(LC_NUMERIC, "de_DE") or die "Entschuldigung"; +\& my $x = strtod("2,34") + 5; +\& print $x, "\en"; # Probably shows 7,34. +.Ve +.SH "NOTES" +.IX Header "NOTES" +.ie n .SS "String ""eval"" and ""LC_NUMERIC""" +.el .SS "String \f(CWeval\fP and \f(CWLC_NUMERIC\fP" +.IX Subsection "String eval and LC_NUMERIC" +A string eval parses its expression as standard +Perl. It is therefore expecting the decimal point to be a dot. If +\&\f(CW\*(C`LC_NUMERIC\*(C'\fR is set to have this be a comma instead, the parsing will +be confused, perhaps silently. +.PP +.Vb 6 +\& use locale; +\& use POSIX qw(locale_h); +\& setlocale(LC_NUMERIC, "fr_FR") or die "Pardon"; +\& my $a = 1.2; +\& print eval "$a + 1.5"; +\& print "\en"; +.Ve +.PP +prints \f(CW\*(C`13,5\*(C'\fR. This is because in that locale, the comma is the +decimal point character. The \f(CW\*(C`eval\*(C'\fR thus expands to: +.PP +.Vb 1 +\& eval "1,2 + 1.5" +.Ve +.PP +and the result is not what you likely expected. No warnings are +generated. If you do string \f(CW\*(C`eval\*(C'\fR's within the scope of +\&\f(CW\*(C`use\ locale\*(C'\fR, you should instead change the \f(CW\*(C`eval\*(C'\fR line to do +something like: +.PP +.Vb 1 +\& print eval "no locale; $a + 1.5"; +.Ve +.PP +This prints \f(CW2.7\fR. +.PP +You could also exclude \f(CW\*(C`LC_NUMERIC\*(C'\fR, if you don't need it, by +.PP +.Vb 1 +\& use locale \*(Aq:!numeric\*(Aq; +.Ve +.SS "Backward compatibility" +.IX Subsection "Backward compatibility" +Versions of Perl prior to 5.004 \fBmostly\fR ignored locale information, +generally behaving as if something similar to the \f(CW"C"\fR locale were +always in force, even if the program environment suggested otherwise +(see \*(L"The setlocale function\*(R"). By default, Perl still behaves this +way for backward compatibility. If you want a Perl application to pay +attention to locale information, you \fBmust\fR use the \f(CW\*(C`use\ locale\*(C'\fR +pragma (see \*(L"The \*(R"use locale\*(L" pragma\*(R") or, in the unlikely event +that you want to do so for just pattern matching, the +\&\f(CW\*(C`/l\*(C'\fR regular expression modifier (see \*(L"Character set +modifiers\*(R" in perlre) to instruct it to do so. +.PP +Versions of Perl from 5.002 to 5.003 did use the \f(CW\*(C`LC_CTYPE\*(C'\fR +information if available; that is, \f(CW\*(C`\ew\*(C'\fR did understand what +were the letters according to the locale environment variables. +The problem was that the user had no control over the feature: +if the C library supported locales, Perl used them. +.SS "I18N:Collate obsolete" +.IX Subsection "I18N:Collate obsolete" +In versions of Perl prior to 5.004, per-locale collation was possible +using the \f(CW\*(C`I18N::Collate\*(C'\fR library module. This module is now mildly +obsolete and should be avoided in new applications. The \f(CW\*(C`LC_COLLATE\*(C'\fR +functionality is now integrated into the Perl core language: One can +use locale-specific scalar data completely normally with \f(CW\*(C`use locale\*(C'\fR, +so there is no longer any need to juggle with the scalar references of +\&\f(CW\*(C`I18N::Collate\*(C'\fR. +.SS "Sort speed and memory use impacts" +.IX Subsection "Sort speed and memory use impacts" +Comparing and sorting by locale is usually slower than the default +sorting; slow-downs of two to four times have been observed. It will +also consume more memory: once a Perl scalar variable has participated +in any string comparison or sorting operation obeying the locale +collation rules, it will take 3\-15 times more memory than before. (The +exact multiplier depends on the string's contents, the operating system +and the locale.) These downsides are dictated more by the operating +system's implementation of the locale system than by Perl. +.SS "Freely available locale definitions" +.IX Subsection "Freely available locale definitions" +The Unicode \s-1CLDR\s0 project extracts the \s-1POSIX\s0 portion of many of its +locales, available at +.PP +.Vb 1 +\& https://unicode.org/Public/cldr/2.0.1/ +.Ve +.PP +(Newer versions of \s-1CLDR\s0 require you to compute the \s-1POSIX\s0 data yourself. +See .) +.PP +There is a large collection of locale definitions at: +.PP +.Vb 1 +\& http://std.dkuug.dk/i18n/WG15\-collection/locales/ +.Ve +.PP +You should be aware that it is +unsupported, and is not claimed to be fit for any purpose. If your +system allows installation of arbitrary locales, you may find the +definitions useful as they are, or as a basis for the development of +your own locales. +.SS "I18n and l10n" +.IX Subsection "I18n and l10n" +\&\*(L"Internationalization\*(R" is often abbreviated as \fBi18n\fR because its first +and last letters are separated by eighteen others. (You may guess why +the internalin ... internaliti ... i18n tends to get abbreviated.) In +the same way, \*(L"localization\*(R" is often abbreviated to \fBl10n\fR. +.SS "An imperfect standard" +.IX Subsection "An imperfect standard" +Internationalization, as defined in the C and \s-1POSIX\s0 standards, can be +criticized as incomplete and ungainly. They also have a tendency, like +standards groups, to divide the world into nations, when we all know +that the world can equally well be divided into bankers, bikers, gamers, +and so on. +.SH "Unicode and UTF\-8" +.IX Header "Unicode and UTF-8" +The support of Unicode is new starting from Perl version v5.6, and more fully +implemented in versions v5.8 and later. See perluniintro. +.PP +Starting in Perl v5.20, \s-1UTF\-8\s0 locales are supported in Perl, except +\&\f(CW\*(C`LC_COLLATE\*(C'\fR is only partially supported; collation support is improved +in Perl v5.26 to a level that may be sufficient for your needs +(see "Category \f(CW\*(C`LC_COLLATE\*(C'\fR: Collation: Text Comparisons and Sorting"). +.PP +If you have Perl v5.16 or v5.18 and can't upgrade, you can use +.PP +.Vb 1 +\& use locale \*(Aq:not_characters\*(Aq; +.Ve +.PP +When this form of the pragma is used, only the non-character portions of +locales are used by Perl, for example \f(CW\*(C`LC_NUMERIC\*(C'\fR. Perl assumes that +you have translated all the characters it is to operate on into Unicode +(actually the platform's native character set (\s-1ASCII\s0 or \s-1EBCDIC\s0) plus +Unicode). For data in files, this can conveniently be done by also +specifying +.PP +.Vb 1 +\& use open \*(Aq:locale\*(Aq; +.Ve +.PP +This pragma arranges for all inputs from files to be translated into +Unicode from the current locale as specified in the environment (see +\&\*(L"\s-1ENVIRONMENT\*(R"\s0), and all outputs to files to be translated back +into the locale. (See open). On a per-filehandle basis, you can +instead use the PerlIO::locale module, or the Encode::Locale +module, both available from \s-1CPAN.\s0 The latter module also has methods to +ease the handling of \f(CW\*(C`ARGV\*(C'\fR and environment variables, and can be used +on individual strings. If you know that all your locales will be +\&\s-1UTF\-8,\s0 as many are these days, you can use the +\&\fB\-C\fR command line switch. +.PP +This form of the pragma allows essentially seamless handling of locales +with Unicode. The collation order will be by Unicode code point order. +Unicode::Collate can be used to get Unicode rules collation. +.PP +All the modules and switches just described can be used in v5.20 with +just plain \f(CW\*(C`use locale\*(C'\fR, and, should the input locales not be \s-1UTF\-8,\s0 +you'll get the less than ideal behavior, described below, that you get +with pre\-v5.16 Perls, or when you use the locale pragma without the +\&\f(CW\*(C`:not_characters\*(C'\fR parameter in v5.16 and v5.18. If you are using +exclusively \s-1UTF\-8\s0 locales in v5.20 and higher, the rest of this section +does not apply to you. +.PP +There are two cases, multi-byte and single-byte locales. First +multi-byte: +.PP +The only multi-byte (or wide character) locale that Perl is ever likely +to support is \s-1UTF\-8.\s0 This is due to the difficulty of implementation, +the fact that high quality \s-1UTF\-8\s0 locales are now published for every +area of the world ( for +ones that are already set-up, but from an earlier version; + for the most up-to-date, but +you have to extract the \s-1POSIX\s0 information yourself), and that +failing all that you can use the Encode module to translate to/from +your locale. So, you'll have to do one of those things if you're using +one of these locales, such as Big5 or Shift \s-1JIS.\s0 For \s-1UTF\-8\s0 locales, in +Perls (pre v5.20) that don't have full \s-1UTF\-8\s0 locale support, they may +work reasonably well (depending on your C library implementation) +simply because both +they and Perl store characters that take up multiple bytes the same way. +However, some, if not most, C library implementations may not process +the characters in the upper half of the Latin\-1 range (128 \- 255) +properly under \f(CW\*(C`LC_CTYPE\*(C'\fR. To see if a character is a particular type +under a locale, Perl uses the functions like \f(CW\*(C`isalnum()\*(C'\fR. Your C +library may not work for \s-1UTF\-8\s0 locales with those functions, instead +only working under the newer wide library functions like \f(CW\*(C`iswalnum()\*(C'\fR, +which Perl does not use. +These multi-byte locales are treated like single-byte locales, and will +have the restrictions described below. Starting in Perl v5.22 a warning +message is raised when Perl detects a multi-byte locale that it doesn't +fully support. +.PP +For single-byte locales, +Perl generally takes the tack to use locale rules on code points that can fit +in a single byte, and Unicode rules for those that can't (though this +isn't uniformly applied, see the note at the end of this section). This +prevents many problems in locales that aren't \s-1UTF\-8.\s0 Suppose the locale +is \s-1ISO8859\-7,\s0 Greek. The character at 0xD7 there is a capital Chi. But +in the \s-1ISO8859\-1\s0 locale, Latin1, it is a multiplication sign. The \s-1POSIX\s0 +regular expression character class \f(CW\*(C`[[:alpha:]]\*(C'\fR will magically match +0xD7 in the Greek locale but not in the Latin one. +.PP +However, there are places where this breaks down. Certain Perl constructs are +for Unicode only, such as \f(CW\*(C`\ep{Alpha}\*(C'\fR. They assume that 0xD7 always has its +Unicode meaning (or the equivalent on \s-1EBCDIC\s0 platforms). Since Latin1 is a +subset of Unicode and 0xD7 is the multiplication sign in both Latin1 and +Unicode, \f(CW\*(C`\ep{Alpha}\*(C'\fR will never match it, regardless of locale. A similar +issue occurs with \f(CW\*(C`\eN{...}\*(C'\fR. Prior to v5.20, it is therefore a bad +idea to use \f(CW\*(C`\ep{}\*(C'\fR or +\&\f(CW\*(C`\eN{}\*(C'\fR under plain \f(CW\*(C`use locale\*(C'\fR\-\-\fIunless\fR you can guarantee that the +locale will be \s-1ISO8859\-1.\s0 Use \s-1POSIX\s0 character classes instead. +.PP +Another problem with this approach is that operations that cross the +single byte/multiple byte boundary are not well-defined, and so are +disallowed. (This boundary is between the codepoints at 255/256.) +For example, lower casing \s-1LATIN CAPITAL LETTER Y WITH DIAERESIS\s0 (U+0178) +should return \s-1LATIN SMALL LETTER Y WITH DIAERESIS\s0 (U+00FF). But in the +Greek locale, for example, there is no character at 0xFF, and Perl +has no way of knowing what the character at 0xFF is really supposed to +represent. Thus it disallows the operation. In this mode, the +lowercase of U+0178 is itself. +.PP +The same problems ensue if you enable automatic UTF\-8\-ification of your +standard file handles, default \f(CW\*(C`open()\*(C'\fR layer, and \f(CW@ARGV\fR on non\-ISO8859\-1, +non\-UTF\-8 locales (by using either the \fB\-C\fR command line switch or the +\&\f(CW\*(C`PERL_UNICODE\*(C'\fR environment variable; see +perlrun). +Things are read in as \s-1UTF\-8,\s0 which would normally imply a Unicode +interpretation, but the presence of a locale causes them to be interpreted +in that locale instead. For example, a 0xD7 code point in the Unicode +input, which should mean the multiplication sign, won't be interpreted by +Perl that way under the Greek locale. This is not a problem +\&\fIprovided\fR you make certain that all locales will always and only be either +an \s-1ISO8859\-1,\s0 or, if you don't have a deficient C library, a \s-1UTF\-8\s0 locale. +.PP +Still another problem is that this approach can lead to two code +points meaning the same character. Thus in a Greek locale, both U+03A7 +and U+00D7 are \s-1GREEK CAPITAL LETTER CHI.\s0 +.PP +Because of all these problems, starting in v5.22, Perl will raise a +warning if a multi-byte (hence Unicode) code point is used when a +single-byte locale is in effect. (Although it doesn't check for this if +doing so would unreasonably slow execution down.) +.PP +Vendor locales are notoriously buggy, and it is difficult for Perl to test +its locale-handling code because this interacts with code that Perl has no +control over; therefore the locale-handling code in Perl may be buggy as +well. (However, the Unicode-supplied locales should be better, and +there is a feed back mechanism to correct any problems. See +\&\*(L"Freely available locale definitions\*(R".) +.PP +If you have Perl v5.16, the problems mentioned above go away if you use +the \f(CW\*(C`:not_characters\*(C'\fR parameter to the locale pragma (except for vendor +bugs in the non-character portions). If you don't have v5.16, and you +\&\fIdo\fR have locales that work, using them may be worthwhile for certain +specific purposes, as long as you keep in mind the gotchas already +mentioned. For example, if the collation for your locales works, it +runs faster under locales than under Unicode::Collate; and you gain +access to such things as the local currency symbol and the names of the +months and days of the week. (But to hammer home the point, in v5.16, +you get this access without the downsides of locales by using the +\&\f(CW\*(C`:not_characters\*(C'\fR form of the pragma.) +.PP +Note: The policy of using locale rules for code points that can fit in a +byte, and Unicode rules for those that can't is not uniformly applied. +Pre\-v5.12, it was somewhat haphazard; in v5.12 it was applied fairly +consistently to regular expression matching except for bracketed +character classes; in v5.14 it was extended to all regex matches; and in +v5.16 to the casing operations such as \f(CW\*(C`\eL\*(C'\fR and \f(CW\*(C`uc()\*(C'\fR. For +collation, in all releases so far, the system's \f(CW\*(C`strxfrm()\*(C'\fR function is +called, and whatever it does is what you get. Starting in v5.26, various +bugs are fixed with the way perl uses this function. +.SH "BUGS" +.IX Header "BUGS" +.ie n .SS "Collation of strings containing embedded ""NUL"" characters" +.el .SS "Collation of strings containing embedded \f(CWNUL\fP characters" +.IX Subsection "Collation of strings containing embedded NUL characters" +\&\f(CW\*(C`NUL\*(C'\fR characters will sort the same as the lowest collating control +character does, or to \f(CW"\e001"\fR in the unlikely event that there are no +control characters at all in the locale. In cases where the strings +don't contain this non\-\f(CW\*(C`NUL\*(C'\fR control, the results will be correct, and +in many locales, this control, whatever it might be, will rarely be +encountered. But there are cases where a \f(CW\*(C`NUL\*(C'\fR should sort before this +control, but doesn't. If two strings do collate identically, the one +containing the \f(CW\*(C`NUL\*(C'\fR will sort to earlier. Prior to 5.26, there were +more bugs. +.SS "Multi-threaded" +.IX Subsection "Multi-threaded" +\&\s-1XS\s0 code or C\-language libraries called from it that use the system +\&\f(CWsetlocale(3)\fR function (except on Windows) likely will not work +from a multi-threaded application without changes. See +\&\*(L"Locale-aware \s-1XS\s0 code\*(R" in perlxs. +.PP +An \s-1XS\s0 module that is locale-dependent could have been written under the +assumption that it will never be called in a multi-threaded environment, +and so uses other non-locale constructs that aren't multi-thread-safe. +See \*(L"Thread-aware system interfaces\*(R" in perlxs. +.PP +\&\s-1POSIX\s0 does not define a way to get the name of the current per-thread +locale. Some systems, such as Darwin and NetBSD do implement a +function, \fBquerylocale\fR\|(3) to do this. On non-Windows systems without +it, such as Linux, there are some additional caveats: +.IP "\(bu" 4 +An embedded perl needs to be started up while the global locale is in +effect. See \*(L"Using embedded Perl with \s-1POSIX\s0 locales\*(R" in perlembed. +.IP "\(bu" 4 +It becomes more important for perl to know about all the possible +locale categories on the platform, even if they aren't apparently used +in your program. Perl knows all of the Linux ones. If your platform +has others, you can submit an issue at + for +inclusion of it in the next release. In the meantime, it is possible to +edit the Perl source to teach it about the category, and then recompile. +Search for instances of, say, \f(CW\*(C`LC_PAPER\*(C'\fR in the source, and use that as +a template to add the omitted one. +.IP "\(bu" 4 +It is possible, though hard to do, to call \f(CW\*(C`POSIX::setlocale\*(C'\fR with a +locale that it doesn't recognize as syntactically legal, but actually is +legal on that system. This should happen only with embedded perls, or +if you hand-craft a locale name yourself. +.SS "Broken systems" +.IX Subsection "Broken systems" +In certain systems, the operating system's locale support +is broken and cannot be fixed or used by Perl. Such deficiencies can +and will result in mysterious hangs and/or Perl core dumps when +\&\f(CW\*(C`use locale\*(C'\fR is in effect. When confronted with such a system, +please report in excruciating detail to +<>, and +also contact your vendor: bug fixes may exist for these problems +in your operating system. Sometimes such bug fixes are called an +operating system upgrade. If you have the source for Perl, include in +the bug report the output of the test described above in \*(L"Testing +for broken locales\*(R". +.SH "SEE ALSO" +.IX Header "SEE ALSO" +I18N::Langinfo, perluniintro, perlunicode, open, +\&\*(L"localeconv\*(R" in \s-1POSIX\s0, +\&\*(L"setlocale\*(R" in \s-1POSIX\s0, \*(L"strcoll\*(R" in \s-1POSIX\s0, \*(L"strftime\*(R" in \s-1POSIX\s0, +\&\*(L"strtod\*(R" in \s-1POSIX\s0, \*(L"strxfrm\*(R" in \s-1POSIX\s0. +.PP +For special considerations when Perl is embedded in a C program, +see \*(L"Using embedded Perl with \s-1POSIX\s0 locales\*(R" in perlembed. +.SH "HISTORY" +.IX Header "HISTORY" +Jarkko Hietaniemi's original \fIperli18n.pod\fR heavily hacked by Dominic +Dunlop, assisted by the perl5\-porters. Prose worked over a bit by +Tom Christiansen, and now maintained by Perl 5 porters. diff --git a/data/miniconda3/man/man1/perlmacos.1 b/data/miniconda3/man/man1/perlmacos.1 new file mode 100644 index 0000000000000000000000000000000000000000..e13a37f58608b9e3b7bdb16400f16ad2d4e3a45b --- /dev/null +++ b/data/miniconda3/man/man1/perlmacos.1 @@ -0,0 +1,162 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLMACOS 1" +.TH PERLMACOS 1 "2020-12-18" "perl v5.32.1" "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" +perlmacos \- Perl under Mac OS (Classic) +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +For Mac \s-1OS X\s0 see \s-1README\s0.macosx +.PP +Perl under Mac \s-1OS\s0 Classic has not been supported since before Perl 5.10 +(April 2004). +.PP +When we say \*(L"Mac \s-1OS\*(R"\s0 below, we mean Mac \s-1OS 7, 8,\s0 and 9, and \fInot\fR +Mac \s-1OS X.\s0 +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The port of Perl to Mac \s-1OS\s0 was officially removed as of Perl 5.12, +though the last official production release of MacPerl corresponded to +Perl 5.6. While Perl 5.10 included the port to Mac \s-1OS,\s0 ExtUtils::MakeMaker, +a core part of Perl's module installation infrastructure officially dropped support for Mac \s-1OS\s0 in April 2004. +.SH "AUTHOR" +.IX Header "AUTHOR" +Perl was ported to Mac \s-1OS\s0 by Matthias Neeracher +. Chris Nandor +continued development and maintenance for the duration of the port's life. diff --git a/data/miniconda3/man/man1/perlmacosx.1 b/data/miniconda3/man/man1/perlmacosx.1 new file mode 100644 index 0000000000000000000000000000000000000000..f2a0d85f40e609455377822e89f7b95bf10c5be2 --- /dev/null +++ b/data/miniconda3/man/man1/perlmacosx.1 @@ -0,0 +1,415 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLMACOSX 1" +.TH PERLMACOSX 1 "2020-12-18" "perl v5.32.1" "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" +perlmacosx \- Perl under Mac OS X +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +This document briefly describes Perl under Mac \s-1OS X.\s0 +.PP +.Vb 7 +\& curl \-O https://www.cpan.org/src/perl\-5.32.1.tar.gz +\& tar \-xzf perl\-5.32.1.tar.gz +\& cd perl\-5.32.1 +\& ./Configure \-des \-Dprefix=/usr/local/ +\& make +\& make test +\& sudo make install +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The latest Perl release (5.32.1 as of this writing) builds without changes +under all versions of Mac \s-1OS X\s0 from 10.3 \*(L"Panther\*(R" onwards. +.PP +In order to build your own version of Perl you will need 'make', +which is part of Apple's developer tools \- also known as Xcode. From +Mac \s-1OS X 10.7\s0 \*(L"Lion\*(R" onwards, it can be downloaded separately as the +\&'Command Line Tools' bundle directly from +(you will need a free account to log in), or as a part of the Xcode suite, +freely available at the App Store. Xcode is a pretty big app, so +unless you already have it or really want it, you are advised to get the +\&'Command Line Tools' bundle separately from the link above. If you want +to do it from within Xcode, go to Xcode \-> Preferences \-> Downloads and +select the 'Command Line Tools' option. +.PP +Between Mac \s-1OS X 10.3\s0 \*(L"Panther\*(R" and 10.6 \*(L"Snow Leopard\*(R", the 'Command +Line Tools' bundle was called 'unix tools', and was usually supplied +with Mac \s-1OS\s0 install DVDs. +.PP +Earlier Mac \s-1OS X\s0 releases (10.2 \*(L"Jaguar\*(R" and older) did not include a +completely thread-safe libc, so threading is not fully supported. Also, +earlier releases included a buggy libdb, so some of the DB_File tests +are known to fail on those releases. +.SS "Installation Prefix" +.IX Subsection "Installation Prefix" +The default installation location for this release uses the traditional +\&\s-1UNIX\s0 directory layout under /usr/local. This is the recommended location +for most users, and will leave the Apple-supplied Perl and its modules +undisturbed. +.PP +Using an installation prefix of '/usr' will result in a directory layout +that mirrors that of Apple's default Perl, with core modules stored in +\&'/System/Library/Perl/${version}', \s-1CPAN\s0 modules stored in +\&'/Library/Perl/${version}', and the addition of +\&'/Network/Library/Perl/${version}' to \f(CW@INC\fR for modules that are stored +on a file server and used by many Macs. +.SS "\s-1SDK\s0 support" +.IX Subsection "SDK support" +First, export the path to the \s-1SDK\s0 into the build environment: +.PP +.Vb 1 +\& export SDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk +.Ve +.PP +Please make sure the \s-1SDK\s0 version (i.e. the numbers right before '.sdk') +matches your system's (in this case, Mac \s-1OS X 10.8\s0 \*(L"Mountain Lion\*(R"), as it is +possible to have more than one \s-1SDK\s0 installed. Also make sure the path exists +in your system, and if it doesn't please make sure the \s-1SDK\s0 is properly +installed, as it should come with the 'Command Line Tools' bundle mentioned +above. Finally, if you have an older Mac \s-1OS X\s0 (10.6 \*(L"Snow Leopard\*(R" and below) +running Xcode 4.2 or lower, the \s-1SDK\s0 path might be something like +\&\f(CW\*(Aq/Developer/SDKs/MacOSX10.3.9.sdk\*(Aq\fR. +.PP +You can use the \s-1SDK\s0 by exporting some additions to Perl's 'ccflags' and '..flags' +config variables: +.PP +.Vb 5 +\& ./Configure \-Accflags="\-nostdinc \-B$SDK/usr/include/gcc \e +\& \-B$SDK/usr/lib/gcc \-isystem$SDK/usr/include \e +\& \-F$SDK/System/Library/Frameworks" \e +\& \-Aldflags="\-Wl,\-syslibroot,$SDK" \e +\& \-de +.Ve +.SS "Universal Binary support" +.IX Subsection "Universal Binary support" +Note: From Mac \s-1OS X 10.6\s0 \*(L"Snow Leopard\*(R" onwards, Apple only supports +Intel-based hardware. This means you can safely skip this section unless +you have an older Apple computer running on ppc or wish to create a perl +binary with backwards compatibility. +.PP +You can compile perl as a universal binary (built for both ppc and intel). +In Mac \s-1OS X 10.4\s0 \*(L"Tiger\*(R", you must export the 'u' variant of the \s-1SDK:\s0 +.PP +.Vb 1 +\& export SDK=/Developer/SDKs/MacOSX10.4u.sdk +.Ve +.PP +Mac \s-1OS X 10.5\s0 \*(L"Leopard\*(R" and above do not require the 'u' variant. +.PP +In addition to the compiler flags used to select the \s-1SDK,\s0 also add the flags +for creating a universal binary: +.PP +.Vb 6 +\& ./Configure \-Accflags="\-arch i686 \-arch ppc \-nostdinc \e +\& \-B$SDK/usr/include/gcc \e +\& \-B$SDK/usr/lib/gcc \-isystem$SDK/usr/include \e +\& \-F$SDK/System/Library/Frameworks" \e +\& \-Aldflags="\-arch i686 \-arch ppc \-Wl,\-syslibroot,$SDK" \e +\& \-de +.Ve +.PP +Keep in mind that these compiler and linker settings will also be used when +building \s-1CPAN\s0 modules. For \s-1XS\s0 modules to be compiled as a universal binary, any +libraries it links to must also be universal binaries. The system libraries that +Apple includes with the 10.4u \s-1SDK\s0 are all universal, but user-installed libraries +may need to be re-installed as universal binaries. +.SS "64\-bit \s-1PPC\s0 support" +.IX Subsection "64-bit PPC support" +Follow the instructions in \fI\s-1INSTALL\s0\fR to build perl with support for 64\-bit +integers (\f(CW\*(C`use64bitint\*(C'\fR) or both 64\-bit integers and 64\-bit addressing +(\f(CW\*(C`use64bitall\*(C'\fR). In the latter case, the resulting binary will run only +on G5\-based hosts. +.PP +Support for 64\-bit addressing is experimental: some aspects of Perl may be +omitted or buggy. Note the messages output by \fIConfigure\fR for further +information. Please use to submit a +problem report in the event that you encounter difficulties. +.PP +When building 64\-bit modules, it is your responsibility to ensure that linked +external libraries and frameworks provide 64\-bit support: if they do not, +module building may appear to succeed, but attempts to use the module will +result in run-time dynamic linking errors, and subsequent test failures. +You can use \f(CW\*(C`file\*(C'\fR to discover the architectures supported by a library: +.PP +.Vb 4 +\& $ file libgdbm.3.0.0.dylib +\& libgdbm.3.0.0.dylib: Mach\-O fat file with 2 architectures +\& libgdbm.3.0.0.dylib (for architecture ppc): Mach\-O dynamically linked shared library ppc +\& libgdbm.3.0.0.dylib (for architecture ppc64): Mach\-O 64\-bit dynamically linked shared library ppc64 +.Ve +.PP +Note that this issue precludes the building of many Macintosh-specific \s-1CPAN\s0 +modules (\f(CW\*(C`Mac::*\*(C'\fR), as the required Apple frameworks do not provide \s-1PPC64\s0 +support. Similarly, downloads from Fink or Darwinports are unlikely to provide +64\-bit support; the libraries must be rebuilt from source with the appropriate +compiler and linker flags. For further information, see Apple's +\&\fI64\-Bit Transition Guide\fR at +. +.SS "libperl and Prebinding" +.IX Subsection "libperl and Prebinding" +Mac \s-1OS X\s0 ships with a dynamically-loaded libperl, but the default for +this release is to compile a static libperl. The reason for this is +pre-binding. Dynamic libraries can be pre-bound to a specific address in +memory in order to decrease load time. To do this, one needs to be aware +of the location and size of all previously-loaded libraries. Apple +collects this information as part of their overall \s-1OS\s0 build process, and +thus has easy access to it when building Perl, but ordinary users would +need to go to a great deal of effort to obtain the information needed +for pre-binding. +.PP +You can override the default and build a shared libperl if you wish +(Configure\ ...\ \-Duseshrplib). +.PP +With Mac \s-1OS X 10.4\s0 \*(L"Tiger\*(R" and newer, there is almost no performance +penalty for non-prebound libraries. Earlier releases will suffer a greater +load time than either the static library, or Apple's pre-bound dynamic library. +.SS "Updating Apple's Perl" +.IX Subsection "Updating Apple's Perl" +In a word \- don't, at least not without a *very* good reason. Your scripts +can just as easily begin with \*(L"#!/usr/local/bin/perl\*(R" as with +\&\*(L"#!/usr/bin/perl\*(R". Scripts supplied by Apple and other third parties as +part of installation packages and such have generally only been tested +with the /usr/bin/perl that's installed by Apple. +.PP +If you find that you do need to update the system Perl, one issue worth +keeping in mind is the question of static vs. dynamic libraries. If you +upgrade using the default static libperl, you will find that the dynamic +libperl supplied by Apple will not be deleted. If both libraries are +present when an application that links against libperl is built, ld will +link against the dynamic library by default. So, if you need to replace +Apple's dynamic libperl with a static libperl, you need to be sure to +delete the older dynamic library after you've installed the update. +.SS "Known problems" +.IX Subsection "Known problems" +If you have installed extra libraries such as \s-1GDBM\s0 through Fink +(in other words, you have libraries under \fI/sw/lib\fR), or libdlcompat +to \fI/usr/local/lib\fR, you may need to be extra careful when running +Configure to not to confuse Configure and Perl about which libraries +to use. Being confused will show up for example as \*(L"dyld\*(R" errors about +symbol problems, for example during \*(L"make test\*(R". The safest bet is to run +Configure as +.PP +.Vb 1 +\& Configure ... \-Uloclibpth \-Dlibpth=/usr/lib +.Ve +.PP +to make Configure look only into the system libraries. If you have some +extra library directories that you really want to use (such as newer +Berkeley \s-1DB\s0 libraries in pre-Panther systems), add those to the libpth: +.PP +.Vb 1 +\& Configure ... \-Uloclibpth \-Dlibpth=\*(Aq/usr/lib /opt/lib\*(Aq +.Ve +.PP +The default of building Perl statically may cause problems with complex +applications like Tk: in that case consider building shared Perl +.PP +.Vb 1 +\& Configure ... \-Duseshrplib +.Ve +.PP +but remember that there's a startup cost to pay in that case (see above +\&\*(L"libperl and Prebinding\*(R"). +.PP +Starting with Tiger (Mac \s-1OS X 10.4\s0), Apple shipped broken locale files for +the eu_ES locale (Basque-Spain). In previous releases of Perl, this resulted in +failures in the \fIlib/locale\fR test. These failures have been suppressed +in the current release of Perl by making the test ignore the broken locale. +If you need to use the eu_ES locale, you should contact Apple support. +.SS "Cocoa" +.IX Subsection "Cocoa" +There are two ways to use Cocoa from Perl. Apple's PerlObjCBridge +module, included with Mac \s-1OS X,\s0 can be used by standalone scripts to +access Foundation (i.e. non-GUI) classes and objects. +.PP +An alternative is CamelBones, a framework that allows access to both +Foundation and AppKit classes and objects, so that full \s-1GUI\s0 applications +can be built in Perl. CamelBones can be found on SourceForge, at +. +.SH "Starting From Scratch" +.IX Header "Starting From Scratch" +Unfortunately it is not that difficult somehow manage to break one's +Mac \s-1OS X\s0 Perl rather severely. If all else fails and you want to +really, \fB\s-1REALLY\s0\fR, start from scratch and remove even your Apple Perl +installation (which has become corrupted somehow), the following +instructions should do it. \fBPlease think twice before following +these instructions: they are much like conducting brain surgery to +yourself. Without anesthesia.\fR We will \fBnot\fR come to fix your system +if you do this. +.PP +First, get rid of the libperl.dylib: +.PP +.Vb 2 +\& # cd /System/Library/Perl/darwin/CORE +\& # rm libperl.dylib +.Ve +.PP +Then delete every .bundle file found anywhere in the folders: +.PP +.Vb 2 +\& /System/Library/Perl +\& /Library/Perl +.Ve +.PP +You can find them for example by +.PP +.Vb 1 +\& # find /System/Library/Perl /Library/Perl \-name \*(Aq*.bundle\*(Aq \-print +.Ve +.PP +After this you can either copy Perl from your operating system media +(you will need at least the /System/Library/Perl and /usr/bin/perl), +or rebuild Perl from the source code with \f(CW\*(C`Configure \-Dprefix=/usr +\&\-Duseshrplib\*(C'\fR \s-1NOTE:\s0 the \f(CW\*(C`\-Dprefix=/usr\*(C'\fR to replace the system Perl +works much better with Perl 5.8.1 and later, in Perl 5.8.0 the +settings were not quite right. +.PP +\&\*(L"Pacifist\*(R" from CharlesSoft () is a nice +way to extract the Perl binaries from the \s-1OS\s0 media, without having to +reinstall the entire \s-1OS.\s0 +.SH "AUTHOR" +.IX Header "AUTHOR" +This \s-1README\s0 was written by Sherm Pendley , +and subsequently updated by Dominic Dunlop +and Breno G. de Oliveira . The \*(L"Starting From Scratch\*(R" +recipe was contributed by John Montbriand . +.SH "DATE" +.IX Header "DATE" +Last modified 2013\-04\-29. diff --git a/data/miniconda3/man/man1/perlmroapi.1 b/data/miniconda3/man/man1/perlmroapi.1 new file mode 100644 index 0000000000000000000000000000000000000000..92d2d50952af3d762824fbdb8ea2462b471512f9 --- /dev/null +++ b/data/miniconda3/man/man1/perlmroapi.1 @@ -0,0 +1,233 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLMROAPI 1" +.TH PERLMROAPI 1 "2020-12-18" "perl v5.32.1" "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" +perlmroapi \- Perl method resolution plugin interface +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +As of Perl 5.10.1 there is a new interface for plugging and using method +resolution orders other than the default (linear depth first search). +The C3 method resolution order added in 5.10.0 has been re-implemented as +a plugin, without changing its Perl-space interface. +.PP +Each plugin should register itself by providing +the following structure +.PP +.Vb 7 +\& struct mro_alg { +\& AV *(*resolve)(pTHX_ HV *stash, U32 level); +\& const char *name; +\& U16 length; +\& U16 kflags; +\& U32 hash; +\& }; +.Ve +.PP +and calling \f(CW\*(C`Perl_mro_register\*(C'\fR: +.PP +.Vb 1 +\& Perl_mro_register(aTHX_ &my_mro_alg); +.Ve +.IP "resolve" 4 +.IX Item "resolve" +Pointer to the linearisation function, described below. +.IP "name" 4 +.IX Item "name" +Name of the \s-1MRO,\s0 either in \s-1ISO\-8859\-1\s0 or \s-1UTF\-8.\s0 +.IP "length" 4 +.IX Item "length" +Length of the name. +.IP "kflags" 4 +.IX Item "kflags" +If the name is given in \s-1UTF\-8,\s0 set this to \f(CW\*(C`HVhek_UTF8\*(C'\fR. The value is passed +direct as the parameter \fIkflags\fR to \f(CW\*(C`hv_common()\*(C'\fR. +.IP "hash" 4 +.IX Item "hash" +A precomputed hash value for the \s-1MRO\s0's name, or 0. +.SH "Callbacks" +.IX Header "Callbacks" +The \f(CW\*(C`resolve\*(C'\fR function is called to generate a linearised \s-1ISA\s0 for the +given stash, using this \s-1MRO.\s0 It is called with a pointer to the stash, and +a \fIlevel\fR of 0. The core always sets \fIlevel\fR to 0 when it calls your +function \- the parameter is provided to allow your implementation to track +depth if it needs to recurse. +.PP +The function should return a reference to an array containing the parent +classes in order. The names of the classes should be the result of calling +\&\f(CW\*(C`HvENAME()\*(C'\fR on the stash. In those cases where \f(CW\*(C`HvENAME()\*(C'\fR returns null, +\&\f(CW\*(C`HvNAME()\*(C'\fR should be used instead. +.PP +The caller is responsible for incrementing the reference count of the array +returned if it wants to keep the structure. Hence, if you have created a +temporary value that you keep no pointer to, \f(CW\*(C`sv_2mortal()\*(C'\fR to ensure that +it is disposed of correctly. If you have cached your return value, then +return a pointer to it without changing the reference count. +.SH "Caching" +.IX Header "Caching" +Computing MROs can be expensive. The implementation provides a cache, in +which you can store a single \f(CW\*(C`SV *\*(C'\fR, or anything that can be cast to +\&\f(CW\*(C`SV *\*(C'\fR, such as \f(CW\*(C`AV *\*(C'\fR. To read your private value, use the macro +\&\f(CW\*(C`MRO_GET_PRIVATE_DATA()\*(C'\fR, passing it the \f(CW\*(C`mro_meta\*(C'\fR structure from the +stash, and a pointer to your \f(CW\*(C`mro_alg\*(C'\fR structure: +.PP +.Vb 2 +\& meta = HvMROMETA(stash); +\& private_sv = MRO_GET_PRIVATE_DATA(meta, &my_mro_alg); +.Ve +.PP +To set your private value, call \f(CW\*(C`Perl_mro_set_private_data()\*(C'\fR: +.PP +.Vb 1 +\& Perl_mro_set_private_data(aTHX_ meta, &c3_alg, private_sv); +.Ve +.PP +The private data cache will take ownership of a reference to private_sv, +much the same way that \f(CW\*(C`hv_store()\*(C'\fR takes ownership of a reference to the +value that you pass it. +.SH "Examples" +.IX Header "Examples" +For examples of \s-1MRO\s0 implementations, see \f(CW\*(C`S_mro_get_linear_isa_c3()\*(C'\fR +and the \f(CW\*(C`BOOT:\*(C'\fR section of \fIext/mro/mro.xs\fR, and +\&\f(CW\*(C`S_mro_get_linear_isa_dfs()\*(C'\fR in \fImro_core.c\fR +.SH "AUTHORS" +.IX Header "AUTHORS" +The implementation of the C3 \s-1MRO\s0 and switchable MROs within the perl core was +written by Brandon L Black. Nicholas Clark created the pluggable interface, +refactored Brandon's implementation to work with it, and wrote this document. diff --git a/data/miniconda3/man/man1/perlnewmod.1 b/data/miniconda3/man/man1/perlnewmod.1 new file mode 100644 index 0000000000000000000000000000000000000000..71ea219e09bc32471e42f29936c5dd8e94a766b9 --- /dev/null +++ b/data/miniconda3/man/man1/perlnewmod.1 @@ -0,0 +1,395 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLNEWMOD 1" +.TH PERLNEWMOD 1 "2020-12-18" "perl v5.32.1" "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" +perlnewmod \- preparing a new module for distribution +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document gives you some suggestions about how to go about writing +Perl modules, preparing them for distribution, and making them available +via \s-1CPAN.\s0 +.PP +One of the things that makes Perl really powerful is the fact that Perl +hackers tend to want to share the solutions to problems they've faced, +so you and I don't have to battle with the same problem again. +.PP +The main way they do this is by abstracting the solution into a Perl +module. If you don't know what one of these is, the rest of this +document isn't going to be much use to you. You're also missing out on +an awful lot of useful code; consider having a look at perlmod, +perlmodlib and perlmodinstall before coming back here. +.PP +When you've found that there isn't a module available for what you're +trying to do, and you've had to write the code yourself, consider +packaging up the solution into a module and uploading it to \s-1CPAN\s0 so that +others can benefit. +.PP +You should also take a look at perlmodstyle for best practices in +making a module. +.SS "Warning" +.IX Subsection "Warning" +We're going to primarily concentrate on Perl-only modules here, rather +than \s-1XS\s0 modules. \s-1XS\s0 modules serve a rather different purpose, and +you should consider different things before distributing them \- the +popularity of the library you are gluing, the portability to other +operating systems, and so on. However, the notes on preparing the Perl +side of the module and packaging and distributing it will apply equally +well to an \s-1XS\s0 module as a pure-Perl one. +.SS "What should I make into a module?" +.IX Subsection "What should I make into a module?" +You should make a module out of any code that you think is going to be +useful to others. Anything that's likely to fill a hole in the communal +library and which someone else can slot directly into their program. Any +part of your code which you can isolate and extract and plug into +something else is a likely candidate. +.PP +Let's take an example. Suppose you're reading in data from a local +format into a hash-of-hashes in Perl, turning that into a tree, walking +the tree and then piping each node to an Acme Transmogrifier Server. +.PP +Now, quite a few people have the Acme Transmogrifier, and you've had to +write something to talk the protocol from scratch \- you'd almost +certainly want to make that into a module. The level at which you pitch +it is up to you: you might want protocol-level modules analogous to +Net::SMTP which then talk to higher level modules analogous +to Mail::Send. The choice is yours, but you do want to get +a module out for that server protocol. +.PP +Nobody else on the planet is going to talk your local data format, so we +can ignore that. But what about the thing in the middle? Building tree +structures from Perl variables and then traversing them is a nice, +general problem, and if nobody's already written a module that does +that, you might want to modularise that code too. +.PP +So hopefully you've now got a few ideas about what's good to modularise. +Let's now see how it's done. +.SS "Step-by-step: Preparing the ground" +.IX Subsection "Step-by-step: Preparing the ground" +Before we even start scraping out the code, there are a few things we'll +want to do in advance. +.IP "Look around" 3 +.IX Item "Look around" +Dig into a bunch of modules to see how they're written. I'd suggest +starting with Text::Tabs, since it's in the standard +library and is nice and simple, and then looking at something a little +more complex like File::Copy. For object oriented +code, WWW::Mechanize or the \f(CW\*(C`Email::*\*(C'\fR modules provide some good +examples. +.Sp +These should give you an overall feel for how modules are laid out and +written. +.IP "Check it's new" 3 +.IX Item "Check it's new" +There are a lot of modules on \s-1CPAN,\s0 and it's easy to miss one that's +similar to what you're planning on contributing. Have a good plough +through and make sure you're not the one +reinventing the wheel! +.IP "Discuss the need" 3 +.IX Item "Discuss the need" +You might love it. You might feel that everyone else needs it. But there +might not actually be any real demand for it out there. If you're unsure +about the demand your module will have, consider asking the +\&\f(CW\*(C`module\-authors@perl.org\*(C'\fR mailing list (send an email to +\&\f(CW\*(C`module\-authors\-subscribe@perl.org\*(C'\fR to subscribe; see + for more information +and a link to the archives). +.IP "Choose a name" 3 +.IX Item "Choose a name" +Perl modules included on \s-1CPAN\s0 have a naming hierarchy you should try to +fit in with. See perlmodlib for more details on how this works, and +browse around \s-1CPAN\s0 and the modules list to get a feel of it. At the very +least, remember this: modules should be title capitalised, (This::Thing) +fit in with a category, and explain their purpose succinctly. +.IP "Check again" 3 +.IX Item "Check again" +While you're doing that, make really sure you haven't missed a module +similar to the one you're about to write. +.Sp +When you've got your name sorted out and you're sure that your module is +wanted and not currently available, it's time to start coding. +.SS "Step-by-step: Making the module" +.IX Subsection "Step-by-step: Making the module" +.IP "Start with \fImodule-starter\fR or \fIh2xs\fR" 3 +.IX Item "Start with module-starter or h2xs" +The \fImodule-starter\fR utility is distributed as part of the +Module::Starter \s-1CPAN\s0 package. It creates a directory +with stubs of all the necessary files to start a new module, according +to recent \*(L"best practice\*(R" for module development, and is invoked from +the command line, thus: +.Sp +.Vb 2 +\& module\-starter \-\-module=Foo::Bar \e +\& \-\-author="Your Name" \-\-email=yourname@cpan.org +.Ve +.Sp +If you do not wish to install the Module::Starter +package from \s-1CPAN,\s0 \fIh2xs\fR is an older tool, originally intended for the +development of \s-1XS\s0 modules, which comes packaged with the Perl +distribution. +.Sp +A typical invocation of h2xs for a pure Perl module is: +.Sp +.Vb 1 +\& h2xs \-AX \-\-skip\-exporter \-\-use\-new\-tests \-n Foo::Bar +.Ve +.Sp +The \f(CW\*(C`\-A\*(C'\fR omits the Autoloader code, \f(CW\*(C`\-X\*(C'\fR omits \s-1XS\s0 elements, +\&\f(CW\*(C`\-\-skip\-exporter\*(C'\fR omits the Exporter code, \f(CW\*(C`\-\-use\-new\-tests\*(C'\fR sets up a +modern testing environment, and \f(CW\*(C`\-n\*(C'\fR specifies the name of the module. +.IP "Use strict and warnings" 3 +.IX Item "Use strict and warnings" +A module's code has to be warning and strict-clean, since you can't +guarantee the conditions that it'll be used under. Besides, you wouldn't +want to distribute code that wasn't warning or strict-clean anyway, +right? +.IP "Use Carp" 3 +.IX Item "Use Carp" +The Carp module allows you to present your error messages from +the caller's perspective; this gives you a way to signal a problem with +the caller and not your module. For instance, if you say this: +.Sp +.Vb 1 +\& warn "No hostname given"; +.Ve +.Sp +the user will see something like this: +.Sp +.Vb 2 +\& No hostname given at +\& /usr/local/lib/perl5/site_perl/5.6.0/Net/Acme.pm line 123. +.Ve +.Sp +which looks like your module is doing something wrong. Instead, you want +to put the blame on the user, and say this: +.Sp +.Vb 1 +\& No hostname given at bad_code, line 10. +.Ve +.Sp +You do this by using Carp and replacing your \f(CW\*(C`warn\*(C'\fRs with +\&\f(CW\*(C`carp\*(C'\fRs. If you need to \f(CW\*(C`die\*(C'\fR, say \f(CW\*(C`croak\*(C'\fR instead. However, keep +\&\f(CW\*(C`warn\*(C'\fR and \f(CW\*(C`die\*(C'\fR in place for your sanity checks \- where it really is +your module at fault. +.IP "Use Exporter \- wisely!" 3 +.IX Item "Use Exporter - wisely!" +Exporter gives you a standard way of exporting symbols and +subroutines from your module into the caller's namespace. For instance, +saying \f(CW\*(C`use Net::Acme qw(&frob)\*(C'\fR would import the \f(CW\*(C`frob\*(C'\fR subroutine. +.Sp +The package variable \f(CW@EXPORT\fR will determine which symbols will get +exported when the caller simply says \f(CW\*(C`use Net::Acme\*(C'\fR \- you will hardly +ever want to put anything in there. \f(CW@EXPORT_OK\fR, on the other hand, +specifies which symbols you're willing to export. If you do want to +export a bunch of symbols, use the \f(CW%EXPORT_TAGS\fR and define a standard +export set \- look at Exporter for more details. +.IP "Use plain old documentation" 3 +.IX Item "Use plain old documentation" +The work isn't over until the paperwork is done, and you're going to +need to put in some time writing some documentation for your module. +\&\f(CW\*(C`module\-starter\*(C'\fR or \f(CW\*(C`h2xs\*(C'\fR will provide a stub for you to fill in; if +you're not sure about the format, look at perlpod for an +introduction. Provide a good synopsis of how your module is used in +code, a description, and then notes on the syntax and function of the +individual subroutines or methods. Use Perl comments for developer notes +and \s-1POD\s0 for end-user notes. +.IP "Write tests" 3 +.IX Item "Write tests" +You're encouraged to create self-tests for your module to ensure it's +working as intended on the myriad platforms Perl supports; if you upload +your module to \s-1CPAN,\s0 a host of testers will build your module and send +you the results of the tests. Again, \f(CW\*(C`module\-starter\*(C'\fR and \f(CW\*(C`h2xs\*(C'\fR +provide a test framework which you can extend \- you should do something +more than just checking your module will compile. +Test::Simple and Test::More are good +places to start when writing a test suite. +.IP "Write the \fI\s-1README\s0\fR" 3 +.IX Item "Write the README" +If you're uploading to \s-1CPAN,\s0 the automated gremlins will extract the +\&\s-1README\s0 file and place that in your \s-1CPAN\s0 directory. It'll also appear in +the main \fIby-module\fR and \fIby-category\fR directories if you make it onto +the modules list. It's a good idea to put here what the module actually +does in detail. +.IP "Write \fIChanges\fR" 3 +.IX Item "Write Changes" +Add any user-visible changes since the last release to your \fIChanges\fR +file. +.SS "Step-by-step: Distributing your module" +.IX Subsection "Step-by-step: Distributing your module" +.IP "Get a \s-1CPAN\s0 user \s-1ID\s0" 3 +.IX Item "Get a CPAN user ID" +Every developer publishing modules on \s-1CPAN\s0 needs a \s-1CPAN ID.\s0 Visit +\&\f(CW\*(C`\*(C'\fR, select \*(L"Request \s-1PAUSE\s0 Account\*(R", and wait for +your request to be approved by the \s-1PAUSE\s0 administrators. +.ie n .IP """perl Makefile.PL; make test; make distcheck; make dist""" 3 +.el .IP "\f(CWperl Makefile.PL; make test; make distcheck; make dist\fR" 3 +.IX Item "perl Makefile.PL; make test; make distcheck; make dist" +Once again, \f(CW\*(C`module\-starter\*(C'\fR or \f(CW\*(C`h2xs\*(C'\fR has done all the work for you. +They produce the standard \f(CW\*(C`Makefile.PL\*(C'\fR you see when you download and +install modules, and this produces a Makefile with a \f(CW\*(C`dist\*(C'\fR target. +.Sp +Once you've ensured that your module passes its own tests \- always a +good thing to make sure \- you can \f(CW\*(C`make distcheck\*(C'\fR to make sure +everything looks \s-1OK,\s0 followed by \f(CW\*(C`make dist\*(C'\fR, and the Makefile will +hopefully produce you a nice tarball of your module, ready for upload. +.IP "Upload the tarball" 3 +.IX Item "Upload the tarball" +The email you got when you received your \s-1CPAN ID\s0 will tell you how to +log in to \s-1PAUSE,\s0 the Perl Authors Upload SErver. From the menus there, +you can upload your module to \s-1CPAN.\s0 +.Sp +Alternatively you can use the \fIcpan-upload\fR script, part of the +CPAN::Uploader distribution on \s-1CPAN.\s0 +.IP "Fix bugs!" 3 +.IX Item "Fix bugs!" +Once you start accumulating users, they'll send you bug reports. If +you're lucky, they'll even send you patches. Welcome to the joys of +maintaining a software project... +.SH "AUTHOR" +.IX Header "AUTHOR" +Simon Cozens, \f(CW\*(C`simon@cpan.org\*(C'\fR +.PP +Updated by Kirrily \*(L"Skud\*(R" Robert, \f(CW\*(C`skud@cpan.org\*(C'\fR +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perlmod, perlmodlib, perlmodinstall, h2xs, strict, +Carp, Exporter, perlpod, Test::Simple, Test::More +ExtUtils::MakeMaker, Module::Build, Module::Starter +, Ken Williams' tutorial on building your own +module at diff --git a/data/miniconda3/man/man1/perlobj.1 b/data/miniconda3/man/man1/perlobj.1 new file mode 100644 index 0000000000000000000000000000000000000000..cf05977019e4b0a328746b37a41cc0ca858df0cb --- /dev/null +++ b/data/miniconda3/man/man1/perlobj.1 @@ -0,0 +1,1271 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLOBJ 1" +.TH PERLOBJ 1 "2020-12-18" "perl v5.32.1" "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" +perlobj \- Perl object reference +.IX Xref "object OOP" +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document provides a reference for Perl's object orientation +features. If you're looking for an introduction to object-oriented +programming in Perl, please see perlootut. +.PP +In order to understand Perl objects, you first need to understand +references in Perl. See perlreftut for details. +.PP +This document describes all of Perl's object-oriented (\s-1OO\s0) features +from the ground up. If you're just looking to write some +object-oriented code of your own, you are probably better served by +using one of the object systems from \s-1CPAN\s0 described in perlootut. +.PP +If you're looking to write your own object system, or you need to +maintain code which implements objects from scratch then this document +will help you understand exactly how Perl does object orientation. +.PP +There are a few basic principles which define object oriented Perl: +.IP "1." 4 +An object is simply a data structure that knows to which class it +belongs. +.IP "2." 4 +A class is simply a package. A class provides methods that expect to +operate on objects. +.IP "3." 4 +A method is simply a subroutine that expects a reference to an object +(or a package name, for class methods) as the first argument. +.PP +Let's look at each of these principles in depth. +.SS "An Object is Simply a Data Structure" +.IX Xref "object bless constructor new" +.IX Subsection "An Object is Simply a Data Structure" +Unlike many other languages which support object orientation, Perl does +not provide any special syntax for constructing an object. Objects are +merely Perl data structures (hashes, arrays, scalars, filehandles, +etc.) that have been explicitly associated with a particular class. +.PP +That explicit association is created by the built-in \f(CW\*(C`bless\*(C'\fR function, +which is typically used within the \fIconstructor\fR subroutine of the +class. +.PP +Here is a simple constructor: +.PP +.Vb 1 +\& package File; +\& +\& sub new { +\& my $class = shift; +\& +\& return bless {}, $class; +\& } +.Ve +.PP +The name \f(CW\*(C`new\*(C'\fR isn't special. We could name our constructor something +else: +.PP +.Vb 1 +\& package File; +\& +\& sub load { +\& my $class = shift; +\& +\& return bless {}, $class; +\& } +.Ve +.PP +The modern convention for \s-1OO\s0 modules is to always use \f(CW\*(C`new\*(C'\fR as the +name for the constructor, but there is no requirement to do so. Any +subroutine that blesses a data structure into a class is a valid +constructor in Perl. +.PP +In the previous examples, the \f(CW\*(C`{}\*(C'\fR code creates a reference to an +empty anonymous hash. The \f(CW\*(C`bless\*(C'\fR function then takes that reference +and associates the hash with the class in \f(CW$class\fR. In the simplest +case, the \f(CW$class\fR variable will end up containing the string \*(L"File\*(R". +.PP +We can also use a variable to store a reference to the data structure +that is being blessed as our object: +.PP +.Vb 2 +\& sub new { +\& my $class = shift; +\& +\& my $self = {}; +\& bless $self, $class; +\& +\& return $self; +\& } +.Ve +.PP +Once we've blessed the hash referred to by \f(CW$self\fR we can start +calling methods on it. This is useful if you want to put object +initialization in its own separate method: +.PP +.Vb 2 +\& sub new { +\& my $class = shift; +\& +\& my $self = {}; +\& bless $self, $class; +\& +\& $self\->_initialize(); +\& +\& return $self; +\& } +.Ve +.PP +Since the object is also a hash, you can treat it as one, using it to +store data associated with the object. Typically, code inside the class +can treat the hash as an accessible data structure, while code outside +the class should always treat the object as opaque. This is called +\&\fBencapsulation\fR. Encapsulation means that the user of an object does +not have to know how it is implemented. The user simply calls +documented methods on the object. +.PP +Note, however, that (unlike most other \s-1OO\s0 languages) Perl does not +ensure or enforce encapsulation in any way. If you want objects to +actually \fIbe\fR opaque you need to arrange for that yourself. This can +be done in a variety of ways, including using \*(L"Inside-Out objects\*(R" +or modules from \s-1CPAN.\s0 +.PP +\fIObjects Are Blessed; Variables Are Not\fR +.IX Subsection "Objects Are Blessed; Variables Are Not" +.PP +When we bless something, we are not blessing the variable which +contains a reference to that thing, nor are we blessing the reference +that the variable stores; we are blessing the thing that the variable +refers to (sometimes known as the \fIreferent\fR). This is best +demonstrated with this code: +.PP +.Vb 1 +\& use Scalar::Util \*(Aqblessed\*(Aq; +\& +\& my $foo = {}; +\& my $bar = $foo; +\& +\& bless $foo, \*(AqClass\*(Aq; +\& print blessed( $bar ) // \*(Aqnot blessed\*(Aq; # prints "Class" +\& +\& $bar = "some other value"; +\& print blessed( $bar ) // \*(Aqnot blessed\*(Aq; # prints "not blessed" +.Ve +.PP +When we call \f(CW\*(C`bless\*(C'\fR on a variable, we are actually blessing the +underlying data structure that the variable refers to. We are not +blessing the reference itself, nor the variable that contains that +reference. That's why the second call to \f(CW\*(C`blessed( $bar )\*(C'\fR returns +false. At that point \f(CW$bar\fR is no longer storing a reference to an +object. +.PP +You will sometimes see older books or documentation mention \*(L"blessing a +reference\*(R" or describe an object as a \*(L"blessed reference\*(R", but this is +incorrect. It isn't the reference that is blessed as an object; it's +the thing the reference refers to (i.e. the referent). +.SS "A Class is Simply a Package" +.IX Xref "class package @ISA inheritance" +.IX Subsection "A Class is Simply a Package" +Perl does not provide any special syntax for class definitions. A +package is simply a namespace containing variables and subroutines. The +only difference is that in a class, the subroutines may expect a +reference to an object or the name of a class as the first argument. +This is purely a matter of convention, so a class may contain both +methods and subroutines which \fIdon't\fR operate on an object or class. +.PP +Each package contains a special array called \f(CW@ISA\fR. The \f(CW@ISA\fR array +contains a list of that class's parent classes, if any. This array is +examined when Perl does method resolution, which we will cover later. +.PP +Calling methods from a package means it must be loaded, of course, so +you will often want to load a module and add it to \f(CW@ISA\fR at the same +time. You can do so in a single step using the parent pragma. +(In older code you may encounter the base pragma, which is nowadays +discouraged except when you have to work with the equally discouraged +fields pragma.) +.PP +However the parent classes are set, the package's \f(CW@ISA\fR variable will +contain a list of those parents. This is simply a list of scalars, each +of which is a string that corresponds to a package name. +.PP +All classes inherit from the \s-1UNIVERSAL\s0 class implicitly. The +\&\s-1UNIVERSAL\s0 class is implemented by the Perl core, and provides +several default methods, such as \f(CW\*(C`isa()\*(C'\fR, \f(CW\*(C`can()\*(C'\fR, and \f(CW\*(C`VERSION()\*(C'\fR. +The \f(CW\*(C`UNIVERSAL\*(C'\fR class will \fInever\fR appear in a package's \f(CW@ISA\fR +variable. +.PP +Perl \fIonly\fR provides method inheritance as a built-in feature. +Attribute inheritance is left up the class to implement. See the +\&\*(L"Writing Accessors\*(R" section for details. +.SS "A Method is Simply a Subroutine" +.IX Xref "method" +.IX Subsection "A Method is Simply a Subroutine" +Perl does not provide any special syntax for defining a method. A +method is simply a regular subroutine, and is declared with \f(CW\*(C`sub\*(C'\fR. +What makes a method special is that it expects to receive either an +object or a class name as its first argument. +.PP +Perl \fIdoes\fR provide special syntax for method invocation, the \f(CW\*(C`\->\*(C'\fR operator. We will cover this in more detail later. +.PP +Most methods you write will expect to operate on objects: +.PP +.Vb 2 +\& sub save { +\& my $self = shift; +\& +\& open my $fh, \*(Aq>\*(Aq, $self\->path() or die $!; +\& print {$fh} $self\->data() or die $!; +\& close $fh or die $!; +\& } +.Ve +.SS "Method Invocation" +.IX Xref "invocation method arrow ->" +.IX Subsection "Method Invocation" +Calling a method on an object is written as \f(CW\*(C`$object\->method\*(C'\fR. +.PP +The left hand side of the method invocation (or arrow) operator is the +object (or class name), and the right hand side is the method name. +.PP +.Vb 2 +\& my $pod = File\->new( \*(Aqperlobj.pod\*(Aq, $data ); +\& $pod\->save(); +.Ve +.PP +The \f(CW\*(C`\->\*(C'\fR syntax is also used when dereferencing a reference. It +looks like the same operator, but these are two different operations. +.PP +When you call a method, the thing on the left side of the arrow is +passed as the first argument to the method. That means when we call \f(CW\*(C`Critter\->new()\*(C'\fR, the \f(CW\*(C`new()\*(C'\fR method receives the string \f(CW"Critter"\fR +as its first argument. When we call \f(CW\*(C`$fred\->speak()\*(C'\fR, the \f(CW$fred\fR +variable is passed as the first argument to \f(CW\*(C`speak()\*(C'\fR. +.PP +Just as with any Perl subroutine, all of the arguments passed in \f(CW@_\fR +are aliases to the original argument. This includes the object itself. +If you assign directly to \f(CW$_[0]\fR you will change the contents of the +variable that holds the reference to the object. We recommend that you +don't do this unless you know exactly what you're doing. +.PP +Perl knows what package the method is in by looking at the left side of +the arrow. If the left hand side is a package name, it looks for the +method in that package. If the left hand side is an object, then Perl +looks for the method in the package that the object has been blessed +into. +.PP +If the left hand side is neither a package name nor an object, then the +method call will cause an error, but see the section on \*(L"Method Call +Variations\*(R" for more nuances. +.SS "Inheritance" +.IX Xref "inheritance" +.IX Subsection "Inheritance" +We already talked about the special \f(CW@ISA\fR array and the parent +pragma. +.PP +When a class inherits from another class, any methods defined in the +parent class are available to the child class. If you attempt to call a +method on an object that isn't defined in its own class, Perl will also +look for that method in any parent classes it may have. +.PP +.Vb 2 +\& package File::MP3; +\& use parent \*(AqFile\*(Aq; # sets @File::MP3::ISA = (\*(AqFile\*(Aq); +\& +\& my $mp3 = File::MP3\->new( \*(AqAndvari.mp3\*(Aq, $data ); +\& $mp3\->save(); +.Ve +.PP +Since we didn't define a \f(CW\*(C`save()\*(C'\fR method in the \f(CW\*(C`File::MP3\*(C'\fR class, +Perl will look at the \f(CW\*(C`File::MP3\*(C'\fR class's parent classes to find the +\&\f(CW\*(C`save()\*(C'\fR method. If Perl cannot find a \f(CW\*(C`save()\*(C'\fR method anywhere in +the inheritance hierarchy, it will die. +.PP +In this case, it finds a \f(CW\*(C`save()\*(C'\fR method in the \f(CW\*(C`File\*(C'\fR class. Note +that the object passed to \f(CW\*(C`save()\*(C'\fR in this case is still a +\&\f(CW\*(C`File::MP3\*(C'\fR object, even though the method is found in the \f(CW\*(C`File\*(C'\fR +class. +.PP +We can override a parent's method in a child class. When we do so, we +can still call the parent class's method with the \f(CW\*(C`SUPER\*(C'\fR +pseudo-class. +.PP +.Vb 2 +\& sub save { +\& my $self = shift; +\& +\& say \*(AqPrepare to rock\*(Aq; +\& $self\->SUPER::save(); +\& } +.Ve +.PP +The \f(CW\*(C`SUPER\*(C'\fR modifier can \fIonly\fR be used for method calls. You can't +use it for regular subroutine calls or class methods: +.PP +.Vb 1 +\& SUPER::save($thing); # FAIL: looks for save() sub in package SUPER +\& +\& SUPER\->save($thing); # FAIL: looks for save() method in class +\& # SUPER +\& +\& $thing\->SUPER::save(); # Okay: looks for save() method in parent +\& # classes +.Ve +.PP +\fIHow \s-1SUPER\s0 is Resolved\fR +.IX Xref "SUPER" +.IX Subsection "How SUPER is Resolved" +.PP +The \f(CW\*(C`SUPER\*(C'\fR pseudo-class is resolved from the package where the call +is made. It is \fInot\fR resolved based on the object's class. This is +important, because it lets methods at different levels within a deep +inheritance hierarchy each correctly call their respective parent +methods. +.PP +.Vb 1 +\& package A; +\& +\& sub new { +\& return bless {}, shift; +\& } +\& +\& sub speak { +\& my $self = shift; +\& +\& say \*(AqA\*(Aq; +\& } +\& +\& package B; +\& +\& use parent \-norequire, \*(AqA\*(Aq; +\& +\& sub speak { +\& my $self = shift; +\& +\& $self\->SUPER::speak(); +\& +\& say \*(AqB\*(Aq; +\& } +\& +\& package C; +\& +\& use parent \-norequire, \*(AqB\*(Aq; +\& +\& sub speak { +\& my $self = shift; +\& +\& $self\->SUPER::speak(); +\& +\& say \*(AqC\*(Aq; +\& } +\& +\& my $c = C\->new(); +\& $c\->speak(); +.Ve +.PP +In this example, we will get the following output: +.PP +.Vb 3 +\& A +\& B +\& C +.Ve +.PP +This demonstrates how \f(CW\*(C`SUPER\*(C'\fR is resolved. Even though the object is +blessed into the \f(CW\*(C`C\*(C'\fR class, the \f(CW\*(C`speak()\*(C'\fR method in the \f(CW\*(C`B\*(C'\fR class +can still call \f(CW\*(C`SUPER::speak()\*(C'\fR and expect it to correctly look in the +parent class of \f(CW\*(C`B\*(C'\fR (i.e the class the method call is in), not in the +parent class of \f(CW\*(C`C\*(C'\fR (i.e. the class the object belongs to). +.PP +There are rare cases where this package-based resolution can be a +problem. If you copy a subroutine from one package to another, \f(CW\*(C`SUPER\*(C'\fR +resolution will be done based on the original package. +.PP +\fIMultiple Inheritance\fR +.IX Xref "multiple inheritance" +.IX Subsection "Multiple Inheritance" +.PP +Multiple inheritance often indicates a design problem, but Perl always +gives you enough rope to hang yourself with if you ask for it. +.PP +To declare multiple parents, you simply need to pass multiple class +names to \f(CW\*(C`use parent\*(C'\fR: +.PP +.Vb 1 +\& package MultiChild; +\& +\& use parent \*(AqParent1\*(Aq, \*(AqParent2\*(Aq; +.Ve +.PP +\fIMethod Resolution Order\fR +.IX Xref "method resolution order mro" +.IX Subsection "Method Resolution Order" +.PP +Method resolution order only matters in the case of multiple +inheritance. In the case of single inheritance, Perl simply looks up +the inheritance chain to find a method: +.PP +.Vb 5 +\& Grandparent +\& | +\& Parent +\& | +\& Child +.Ve +.PP +If we call a method on a \f(CW\*(C`Child\*(C'\fR object and that method is not defined +in the \f(CW\*(C`Child\*(C'\fR class, Perl will look for that method in the \f(CW\*(C`Parent\*(C'\fR +class and then, if necessary, in the \f(CW\*(C`Grandparent\*(C'\fR class. +.PP +If Perl cannot find the method in any of these classes, it will die +with an error message. +.PP +When a class has multiple parents, the method lookup order becomes more +complicated. +.PP +By default, Perl does a depth-first left-to-right search for a method. +That means it starts with the first parent in the \f(CW@ISA\fR array, and +then searches all of its parents, grandparents, etc. If it fails to +find the method, it then goes to the next parent in the original +class's \f(CW@ISA\fR array and searches from there. +.PP +.Vb 7 +\& SharedGreatGrandParent +\& / \e +\& PaternalGrandparent MaternalGrandparent +\& \e / +\& Father Mother +\& \e / +\& Child +.Ve +.PP +So given the diagram above, Perl will search \f(CW\*(C`Child\*(C'\fR, \f(CW\*(C`Father\*(C'\fR, +\&\f(CW\*(C`PaternalGrandparent\*(C'\fR, \f(CW\*(C`SharedGreatGrandParent\*(C'\fR, \f(CW\*(C`Mother\*(C'\fR, and +finally \f(CW\*(C`MaternalGrandparent\*(C'\fR. This may be a problem because now we're +looking in \f(CW\*(C`SharedGreatGrandParent\*(C'\fR \fIbefore\fR we've checked all its +derived classes (i.e. before we tried \f(CW\*(C`Mother\*(C'\fR and +\&\f(CW\*(C`MaternalGrandparent\*(C'\fR). +.PP +It is possible to ask for a different method resolution order with the +mro pragma. +.PP +.Vb 1 +\& package Child; +\& +\& use mro \*(Aqc3\*(Aq; +\& use parent \*(AqFather\*(Aq, \*(AqMother\*(Aq; +.Ve +.PP +This pragma lets you switch to the \*(L"C3\*(R" resolution order. In simple +terms, \*(L"C3\*(R" order ensures that shared parent classes are never searched +before child classes, so Perl will now search: \f(CW\*(C`Child\*(C'\fR, \f(CW\*(C`Father\*(C'\fR, +\&\f(CW\*(C`PaternalGrandparent\*(C'\fR, \f(CW\*(C`Mother\*(C'\fR \f(CW\*(C`MaternalGrandparent\*(C'\fR, and finally +\&\f(CW\*(C`SharedGreatGrandParent\*(C'\fR. Note however that this is not +\&\*(L"breadth-first\*(R" searching: All the \f(CW\*(C`Father\*(C'\fR ancestors (except the +common ancestor) are searched before any of the \f(CW\*(C`Mother\*(C'\fR ancestors are +considered. +.PP +The C3 order also lets you call methods in sibling classes with the +\&\f(CW\*(C`next\*(C'\fR pseudo-class. See the mro documentation for more details on +this feature. +.PP +\fIMethod Resolution Caching\fR +.IX Subsection "Method Resolution Caching" +.PP +When Perl searches for a method, it caches the lookup so that future +calls to the method do not need to search for it again. Changing a +class's parent class or adding subroutines to a class will invalidate +the cache for that class. +.PP +The mro pragma provides some functions for manipulating the method +cache directly. +.SS "Writing Constructors" +.IX Xref "constructor" +.IX Subsection "Writing Constructors" +As we mentioned earlier, Perl provides no special constructor syntax. +This means that a class must implement its own constructor. A +constructor is simply a class method that returns a reference to a new +object. +.PP +The constructor can also accept additional parameters that define the +object. Let's write a real constructor for the \f(CW\*(C`File\*(C'\fR class we used +earlier: +.PP +.Vb 1 +\& package File; +\& +\& sub new { +\& my $class = shift; +\& my ( $path, $data ) = @_; +\& +\& my $self = bless { +\& path => $path, +\& data => $data, +\& }, $class; +\& +\& return $self; +\& } +.Ve +.PP +As you can see, we've stored the path and file data in the object +itself. Remember, under the hood, this object is still just a hash. +Later, we'll write accessors to manipulate this data. +.PP +For our \f(CW\*(C`File::MP3\*(C'\fR class, we can check to make sure that the path +we're given ends with \*(L".mp3\*(R": +.PP +.Vb 1 +\& package File::MP3; +\& +\& sub new { +\& my $class = shift; +\& my ( $path, $data ) = @_; +\& +\& die "You cannot create a File::MP3 without an mp3 extension\en" +\& unless $path =~ /\e.mp3\ez/; +\& +\& return $class\->SUPER::new(@_); +\& } +.Ve +.PP +This constructor lets its parent class do the actual object +construction. +.SS "Attributes" +.IX Xref "attribute" +.IX Subsection "Attributes" +An attribute is a piece of data belonging to a particular object. +Unlike most object-oriented languages, Perl provides no special syntax +or support for declaring and manipulating attributes. +.PP +Attributes are often stored in the object itself. For example, if the +object is an anonymous hash, we can store the attribute values in the +hash using the attribute name as the key. +.PP +While it's possible to refer directly to these hash keys outside of the +class, it's considered a best practice to wrap all access to the +attribute with accessor methods. +.PP +This has several advantages. Accessors make it easier to change the +implementation of an object later while still preserving the original +\&\s-1API.\s0 +.PP +An accessor lets you add additional code around attribute access. For +example, you could apply a default to an attribute that wasn't set in +the constructor, or you could validate that a new value for the +attribute is acceptable. +.PP +Finally, using accessors makes inheritance much simpler. Subclasses can +use the accessors rather than having to know how a parent class is +implemented internally. +.PP +\fIWriting Accessors\fR +.IX Xref "accessor" +.IX Subsection "Writing Accessors" +.PP +As with constructors, Perl provides no special accessor declaration +syntax, so classes must provide explicitly written accessor methods. +There are two common types of accessors, read-only and read-write. +.PP +A simple read-only accessor simply gets the value of a single +attribute: +.PP +.Vb 2 +\& sub path { +\& my $self = shift; +\& +\& return $self\->{path}; +\& } +.Ve +.PP +A read-write accessor will allow the caller to set the value as well as +get it: +.PP +.Vb 2 +\& sub path { +\& my $self = shift; +\& +\& if (@_) { +\& $self\->{path} = shift; +\& } +\& +\& return $self\->{path}; +\& } +.Ve +.SS "An Aside About Smarter and Safer Code" +.IX Subsection "An Aside About Smarter and Safer Code" +Our constructor and accessors are not very smart. They don't check that +a \f(CW$path\fR is defined, nor do they check that a \f(CW$path\fR is a valid +filesystem path. +.PP +Doing these checks by hand can quickly become tedious. Writing a bunch +of accessors by hand is also incredibly tedious. There are a lot of +modules on \s-1CPAN\s0 that can help you write safer and more concise code, +including the modules we recommend in perlootut. +.SS "Method Call Variations" +.IX Xref "method" +.IX Subsection "Method Call Variations" +Perl supports several other ways to call methods besides the \f(CW\*(C`$object\->method()\*(C'\fR usage we've seen so far. +.PP +\fIMethod Names with a Fully Qualified Name\fR +.IX Subsection "Method Names with a Fully Qualified Name" +.PP +Perl allows you to call methods using their fully qualified name (the +package and method name): +.PP +.Vb 2 +\& my $mp3 = File::MP3\->new( \*(AqRegin.mp3\*(Aq, $data ); +\& $mp3\->File::save(); +.Ve +.PP +When you call a fully qualified method name like \f(CW\*(C`File::save\*(C'\fR, the method +resolution search for the \f(CW\*(C`save\*(C'\fR method starts in the \f(CW\*(C`File\*(C'\fR class, +skipping any \f(CW\*(C`save\*(C'\fR method the \f(CW\*(C`File::MP3\*(C'\fR class may have defined. It +still searches the \f(CW\*(C`File\*(C'\fR class's parents if necessary. +.PP +While this feature is most commonly used to explicitly call methods +inherited from an ancestor class, there is no technical restriction +that enforces this: +.PP +.Vb 2 +\& my $obj = Tree\->new(); +\& $obj\->Dog::bark(); +.Ve +.PP +This calls the \f(CW\*(C`bark\*(C'\fR method from class \f(CW\*(C`Dog\*(C'\fR on an object of class +\&\f(CW\*(C`Tree\*(C'\fR, even if the two classes are completely unrelated. Use this +with great care. +.PP +The \f(CW\*(C`SUPER\*(C'\fR pseudo-class that was described earlier is \fInot\fR the same +as calling a method with a fully-qualified name. See the earlier +\&\*(L"Inheritance\*(R" section for details. +.PP +\fIMethod Names as Strings\fR +.IX Subsection "Method Names as Strings" +.PP +Perl lets you use a scalar variable containing a string as a method +name: +.PP +.Vb 1 +\& my $file = File\->new( $path, $data ); +\& +\& my $method = \*(Aqsave\*(Aq; +\& $file\->$method(); +.Ve +.PP +This works exactly like calling \f(CW\*(C`$file\->save()\*(C'\fR. This can be very +useful for writing dynamic code. For example, it allows you to pass a +method name to be called as a parameter to another method. +.PP +\fIClass Names as Strings\fR +.IX Subsection "Class Names as Strings" +.PP +Perl also lets you use a scalar containing a string as a class name: +.PP +.Vb 1 +\& my $class = \*(AqFile\*(Aq; +\& +\& my $file = $class\->new( $path, $data ); +.Ve +.PP +Again, this allows for very dynamic code. +.PP +\fISubroutine References as Methods\fR +.IX Subsection "Subroutine References as Methods" +.PP +You can also use a subroutine reference as a method: +.PP +.Vb 2 +\& my $sub = sub { +\& my $self = shift; +\& +\& $self\->save(); +\& }; +\& +\& $file\->$sub(); +.Ve +.PP +This is exactly equivalent to writing \f(CW\*(C`$sub\->($file)\*(C'\fR. You may see +this idiom in the wild combined with a call to \f(CW\*(C`can\*(C'\fR: +.PP +.Vb 3 +\& if ( my $meth = $object\->can(\*(Aqfoo\*(Aq) ) { +\& $object\->$meth(); +\& } +.Ve +.PP +\fIDereferencing Method Call\fR +.IX Subsection "Dereferencing Method Call" +.PP +Perl also lets you use a dereferenced scalar reference in a method +call. That's a mouthful, so let's look at some code: +.PP +.Vb 4 +\& $file\->${ \e\*(Aqsave\*(Aq }; +\& $file\->${ returns_scalar_ref() }; +\& $file\->${ \e( returns_scalar() ) }; +\& $file\->${ returns_ref_to_sub_ref() }; +.Ve +.PP +This works if the dereference produces a string \fIor\fR a subroutine +reference. +.PP +\fIMethod Calls on Filehandles\fR +.IX Subsection "Method Calls on Filehandles" +.PP +Under the hood, Perl filehandles are instances of the \f(CW\*(C`IO::Handle\*(C'\fR or +\&\f(CW\*(C`IO::File\*(C'\fR class. Once you have an open filehandle, you can call +methods on it. Additionally, you can call methods on the \f(CW\*(C`STDIN\*(C'\fR, +\&\f(CW\*(C`STDOUT\*(C'\fR, and \f(CW\*(C`STDERR\*(C'\fR filehandles. +.PP +.Vb 3 +\& open my $fh, \*(Aq>\*(Aq, \*(Aqpath/to/file\*(Aq; +\& $fh\->autoflush(); +\& $fh\->print(\*(Aqcontent\*(Aq); +\& +\& STDOUT\->autoflush(); +.Ve +.SS "Invoking Class Methods" +.IX Xref "invocation" +.IX Subsection "Invoking Class Methods" +Because Perl allows you to use barewords for package names and +subroutine names, it sometimes interprets a bareword's meaning +incorrectly. For example, the construct \f(CW\*(C`Class\->new()\*(C'\fR can be +interpreted as either \f(CW\*(C`\*(AqClass\*(Aq\->new()\*(C'\fR or \f(CW\*(C`Class()\->new()\*(C'\fR. +In English, that second interpretation reads as \*(L"call a subroutine +named \fBClass()\fR, then call \fBnew()\fR as a method on the return value of +\&\fBClass()\fR\*(R". If there is a subroutine named \f(CW\*(C`Class()\*(C'\fR in the current +namespace, Perl will always interpret \f(CW\*(C`Class\->new()\*(C'\fR as the second +alternative: a call to \f(CW\*(C`new()\*(C'\fR on the object returned by a call to +\&\f(CW\*(C`Class()\*(C'\fR +.PP +You can force Perl to use the first interpretation (i.e. as a method +call on the class named \*(L"Class\*(R") in two ways. First, you can append a +\&\f(CW\*(C`::\*(C'\fR to the class name: +.PP +.Vb 1 +\& Class::\->new() +.Ve +.PP +Perl will always interpret this as a method call. +.PP +Alternatively, you can quote the class name: +.PP +.Vb 1 +\& \*(AqClass\*(Aq\->new() +.Ve +.PP +Of course, if the class name is in a scalar Perl will do the right +thing as well: +.PP +.Vb 2 +\& my $class = \*(AqClass\*(Aq; +\& $class\->new(); +.Ve +.PP +\fIIndirect Object Syntax\fR +.IX Xref "indirect object" +.IX Subsection "Indirect Object Syntax" +.PP +\&\fBOutside of the file handle case, use of this syntax is discouraged as +it can confuse the Perl interpreter. See below for more details.\fR +.PP +Perl supports another method invocation syntax called \*(L"indirect object\*(R" +notation. This syntax is called \*(L"indirect\*(R" because the method comes +before the object it is being invoked on. +.PP +This syntax can be used with any class or object method: +.PP +.Vb 2 +\& my $file = new File $path, $data; +\& save $file; +.Ve +.PP +We recommend that you avoid this syntax, for several reasons. +.PP +First, it can be confusing to read. In the above example, it's not +clear if \f(CW\*(C`save\*(C'\fR is a method provided by the \f(CW\*(C`File\*(C'\fR class or simply a +subroutine that expects a file object as its first argument. +.PP +When used with class methods, the problem is even worse. Because Perl +allows subroutine names to be written as barewords, Perl has to guess +whether the bareword after the method is a class name or subroutine +name. In other words, Perl can resolve the syntax as either \f(CW\*(C`File\->new( $path, $data )\*(C'\fR \fBor\fR \f(CW\*(C`new( File( $path, $data ) )\*(C'\fR. +.PP +To parse this code, Perl uses a heuristic based on what package names +it has seen, what subroutines exist in the current package, what +barewords it has previously seen, and other input. Needless to say, +heuristics can produce very surprising results! +.PP +Older documentation (and some \s-1CPAN\s0 modules) encouraged this syntax, +particularly for constructors, so you may still find it in the wild. +However, we encourage you to avoid using it in new code. +.PP +You can force Perl to interpret the bareword as a class name by +appending \*(L"::\*(R" to it, like we saw earlier: +.PP +.Vb 1 +\& my $file = new File:: $path, $data; +.Ve +.ie n .SS """bless"", ""blessed"", and ""ref""" +.el .SS "\f(CWbless\fP, \f(CWblessed\fP, and \f(CWref\fP" +.IX Subsection "bless, blessed, and ref" +As we saw earlier, an object is simply a data structure that has been +blessed into a class via the \f(CW\*(C`bless\*(C'\fR function. The \f(CW\*(C`bless\*(C'\fR function +can take either one or two arguments: +.PP +.Vb 2 +\& my $object = bless {}, $class; +\& my $object = bless {}; +.Ve +.PP +In the first form, the anonymous hash is being blessed into the class +in \f(CW$class\fR. In the second form, the anonymous hash is blessed into +the current package. +.PP +The second form is strongly discouraged, because it breaks the ability +of a subclass to reuse the parent's constructor, but you may still run +across it in existing code. +.PP +If you want to know whether a particular scalar refers to an object, +you can use the \f(CW\*(C`blessed\*(C'\fR function exported by Scalar::Util, which +is shipped with the Perl core. +.PP +.Vb 1 +\& use Scalar::Util \*(Aqblessed\*(Aq; +\& +\& if ( defined blessed($thing) ) { ... } +.Ve +.PP +If \f(CW$thing\fR refers to an object, then this function returns the name +of the package the object has been blessed into. If \f(CW$thing\fR doesn't +contain a reference to a blessed object, the \f(CW\*(C`blessed\*(C'\fR function +returns \f(CW\*(C`undef\*(C'\fR. +.PP +Note that \f(CW\*(C`blessed($thing)\*(C'\fR will also return false if \f(CW$thing\fR has +been blessed into a class named \*(L"0\*(R". This is a possible, but quite +pathological. Don't create a class named \*(L"0\*(R" unless you know what +you're doing. +.PP +Similarly, Perl's built-in \f(CW\*(C`ref\*(C'\fR function treats a reference to a +blessed object specially. If you call \f(CW\*(C`ref($thing)\*(C'\fR and \f(CW$thing\fR +holds a reference to an object, it will return the name of the class +that the object has been blessed into. +.PP +If you simply want to check that a variable contains an object +reference, we recommend that you use \f(CW\*(C`defined blessed($object)\*(C'\fR, since +\&\f(CW\*(C`ref\*(C'\fR returns true values for all references, not just objects. +.SS "The \s-1UNIVERSAL\s0 Class" +.IX Xref "UNIVERSAL" +.IX Subsection "The UNIVERSAL Class" +All classes automatically inherit from the \s-1UNIVERSAL\s0 class, which is +built-in to the Perl core. This class provides a number of methods, all +of which can be called on either a class or an object. You can also +choose to override some of these methods in your class. If you do so, +we recommend that you follow the built-in semantics described below. +.IP "isa($class)" 4 +.IX Xref "isa" +.IX Item "isa($class)" +The \f(CW\*(C`isa\*(C'\fR method returns \fItrue\fR if the object is a member of the +class in \f(CW$class\fR, or a member of a subclass of \f(CW$class\fR. +.Sp +If you override this method, it should never throw an exception. +.IP "\s-1DOES\s0($role)" 4 +.IX Xref "DOES" +.IX Item "DOES($role)" +The \f(CW\*(C`DOES\*(C'\fR method returns \fItrue\fR if its object claims to perform the +role \f(CW$role\fR. By default, this is equivalent to \f(CW\*(C`isa\*(C'\fR. This method is +provided for use by object system extensions that implement roles, like +\&\f(CW\*(C`Moose\*(C'\fR and \f(CW\*(C`Role::Tiny\*(C'\fR. +.Sp +You can also override \f(CW\*(C`DOES\*(C'\fR directly in your own classes. If you +override this method, it should never throw an exception. +.IP "can($method)" 4 +.IX Xref "can" +.IX Item "can($method)" +The \f(CW\*(C`can\*(C'\fR method checks to see if the class or object it was called on +has a method named \f(CW$method\fR. This checks for the method in the class +and all of its parents. If the method exists, then a reference to the +subroutine is returned. If it does not then \f(CW\*(C`undef\*(C'\fR is returned. +.Sp +If your class responds to method calls via \f(CW\*(C`AUTOLOAD\*(C'\fR, you may want to +overload \f(CW\*(C`can\*(C'\fR to return a subroutine reference for methods which your +\&\f(CW\*(C`AUTOLOAD\*(C'\fR method handles. +.Sp +If you override this method, it should never throw an exception. +.IP "\s-1VERSION\s0($need)" 4 +.IX Xref "VERSION" +.IX Item "VERSION($need)" +The \f(CW\*(C`VERSION\*(C'\fR method returns the version number of the class +(package). +.Sp +If the \f(CW$need\fR argument is given then it will check that the current +version (as defined by the \f(CW$VERSION\fR variable in the package) is greater +than or equal to \f(CW$need\fR; it will die if this is not the case. This +method is called automatically by the \f(CW\*(C`VERSION\*(C'\fR form of \f(CW\*(C`use\*(C'\fR. +.Sp +.Vb 3 +\& use Package 1.2 qw(some imported subs); +\& # implies: +\& Package\->VERSION(1.2); +.Ve +.Sp +We recommend that you use this method to access another package's +version, rather than looking directly at \f(CW$Package::VERSION\fR. The +package you are looking at could have overridden the \f(CW\*(C`VERSION\*(C'\fR method. +.Sp +We also recommend using this method to check whether a module has a +sufficient version. The internal implementation uses the version +module to make sure that different types of version numbers are +compared correctly. +.SS "\s-1AUTOLOAD\s0" +.IX Xref "AUTOLOAD" +.IX Subsection "AUTOLOAD" +If you call a method that doesn't exist in a class, Perl will throw an +error. However, if that class or any of its parent classes defines an +\&\f(CW\*(C`AUTOLOAD\*(C'\fR method, that \f(CW\*(C`AUTOLOAD\*(C'\fR method is called instead. +.PP +\&\f(CW\*(C`AUTOLOAD\*(C'\fR is called as a regular method, and the caller will not know +the difference. Whatever value your \f(CW\*(C`AUTOLOAD\*(C'\fR method returns is +returned to the caller. +.PP +The fully qualified method name that was called is available in the +\&\f(CW$AUTOLOAD\fR package global for your class. Since this is a global, if +you want to refer to do it without a package name prefix under \f(CW\*(C`strict +\&\*(Aqvars\*(Aq\*(C'\fR, you need to declare it. +.PP +.Vb 5 +\& # XXX \- this is a terrible way to implement accessors, but it makes +\& # for a simple example. +\& our $AUTOLOAD; +\& sub AUTOLOAD { +\& my $self = shift; +\& +\& # Remove qualifier from original method name... +\& my $called = $AUTOLOAD =~ s/.*:://r; +\& +\& # Is there an attribute of that name? +\& die "No such attribute: $called" +\& unless exists $self\->{$called}; +\& +\& # If so, return it... +\& return $self\->{$called}; +\& } +\& +\& sub DESTROY { } # see below +.Ve +.PP +Without the \f(CW\*(C`our $AUTOLOAD\*(C'\fR declaration, this code will not compile +under the strict pragma. +.PP +As the comment says, this is not a good way to implement accessors. +It's slow and too clever by far. However, you may see this as a way to +provide accessors in older Perl code. See perlootut for +recommendations on \s-1OO\s0 coding in Perl. +.PP +If your class does have an \f(CW\*(C`AUTOLOAD\*(C'\fR method, we strongly recommend +that you override \f(CW\*(C`can\*(C'\fR in your class as well. Your overridden \f(CW\*(C`can\*(C'\fR +method should return a subroutine reference for any method that your +\&\f(CW\*(C`AUTOLOAD\*(C'\fR responds to. +.SS "Destructors" +.IX Xref "destructor DESTROY" +.IX Subsection "Destructors" +When the last reference to an object goes away, the object is +destroyed. If you only have one reference to an object stored in a +lexical scalar, the object is destroyed when that scalar goes out of +scope. If you store the object in a package global, that object may not +go out of scope until the program exits. +.PP +If you want to do something when the object is destroyed, you can +define a \f(CW\*(C`DESTROY\*(C'\fR method in your class. This method will always be +called by Perl at the appropriate time, unless the method is empty. +.PP +This is called just like any other method, with the object as the first +argument. It does not receive any additional arguments. However, the +\&\f(CW$_[0]\fR variable will be read-only in the destructor, so you cannot +assign a value to it. +.PP +If your \f(CW\*(C`DESTROY\*(C'\fR method throws an exception, this will not cause +any control transfer beyond exiting the method. The exception will be +reported to \f(CW\*(C`STDERR\*(C'\fR as a warning, marked \*(L"(in cleanup)\*(R", and Perl will +continue with whatever it was doing before. +.PP +Because \f(CW\*(C`DESTROY\*(C'\fR methods can be called at any time, you should localize +any global status variables that might be set by anything you do in +your \f(CW\*(C`DESTROY\*(C'\fR method. If you are in doubt about a particular status +variable, it doesn't hurt to localize it. There are five global status +variables, and the safest way is to localize all five of them: +.PP +.Vb 5 +\& sub DESTROY { +\& local($., $@, $!, $^E, $?); +\& my $self = shift; +\& ...; +\& } +.Ve +.PP +If you define an \f(CW\*(C`AUTOLOAD\*(C'\fR in your class, then Perl will call your +\&\f(CW\*(C`AUTOLOAD\*(C'\fR to handle the \f(CW\*(C`DESTROY\*(C'\fR method. You can prevent this by +defining an empty \f(CW\*(C`DESTROY\*(C'\fR, like we did in the autoloading example. +You can also check the value of \f(CW$AUTOLOAD\fR and return without doing +anything when called to handle \f(CW\*(C`DESTROY\*(C'\fR. +.PP +\fIGlobal Destruction\fR +.IX Subsection "Global Destruction" +.PP +The order in which objects are destroyed during the global destruction +before the program exits is unpredictable. This means that any objects +contained by your object may already have been destroyed. You should +check that a contained object is defined before calling a method on it: +.PP +.Vb 2 +\& sub DESTROY { +\& my $self = shift; +\& +\& $self\->{handle}\->close() if $self\->{handle}; +\& } +.Ve +.PP +You can use the \f(CW\*(C`${^GLOBAL_PHASE}\*(C'\fR variable to detect if you are +currently in the global destruction phase: +.PP +.Vb 2 +\& sub DESTROY { +\& my $self = shift; +\& +\& return if ${^GLOBAL_PHASE} eq \*(AqDESTRUCT\*(Aq; +\& +\& $self\->{handle}\->close(); +\& } +.Ve +.PP +Note that this variable was added in Perl 5.14.0. If you want to detect +the global destruction phase on older versions of Perl, you can use the +\&\f(CW\*(C`Devel::GlobalDestruction\*(C'\fR module on \s-1CPAN.\s0 +.PP +If your \f(CW\*(C`DESTROY\*(C'\fR method issues a warning during global destruction, +the Perl interpreter will append the string \*(L" during global +destruction\*(R" to the warning. +.PP +During global destruction, Perl will always garbage collect objects +before unblessed references. See \*(L"\s-1PERL_DESTRUCT_LEVEL\*(R"\s0 in perlhacktips +for more information about global destruction. +.SS "Non-Hash Objects" +.IX Subsection "Non-Hash Objects" +All the examples so far have shown objects based on a blessed hash. +However, it's possible to bless any type of data structure or referent, +including scalars, globs, and subroutines. You may see this sort of +thing when looking at code in the wild. +.PP +Here's an example of a module as a blessed scalar: +.PP +.Vb 1 +\& package Time; +\& +\& use strict; +\& use warnings; +\& +\& sub new { +\& my $class = shift; +\& +\& my $time = time; +\& return bless \e$time, $class; +\& } +\& +\& sub epoch { +\& my $self = shift; +\& return ${ $self }; +\& } +\& +\& my $time = Time\->new(); +\& print $time\->epoch(); +.Ve +.SS "Inside-Out objects" +.IX Subsection "Inside-Out objects" +In the past, the Perl community experimented with a technique called +\&\*(L"inside-out objects\*(R". An inside-out object stores its data outside of +the object's reference, indexed on a unique property of the object, +such as its memory address, rather than in the object itself. This has +the advantage of enforcing the encapsulation of object attributes, +since their data is not stored in the object itself. +.PP +This technique was popular for a while (and was recommended in Damian +Conway's \fIPerl Best Practices\fR), but never achieved universal +adoption. The Object::InsideOut module on \s-1CPAN\s0 provides a +comprehensive implementation of this technique, and you may see it or +other inside-out modules in the wild. +.PP +Here is a simple example of the technique, using the +Hash::Util::FieldHash core module. This module was added to the core +to support inside-out object implementations. +.PP +.Vb 1 +\& package Time; +\& +\& use strict; +\& use warnings; +\& +\& use Hash::Util::FieldHash \*(Aqfieldhash\*(Aq; +\& +\& fieldhash my %time_for; +\& +\& sub new { +\& my $class = shift; +\& +\& my $self = bless \e( my $object ), $class; +\& +\& $time_for{$self} = time; +\& +\& return $self; +\& } +\& +\& sub epoch { +\& my $self = shift; +\& +\& return $time_for{$self}; +\& } +\& +\& my $time = Time\->new; +\& print $time\->epoch; +.Ve +.SS "Pseudo-hashes" +.IX Subsection "Pseudo-hashes" +The pseudo-hash feature was an experimental feature introduced in +earlier versions of Perl and removed in 5.10.0. A pseudo-hash is an +array reference which can be accessed using named keys like a hash. You +may run in to some code in the wild which uses it. See the fields +pragma for more information. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +A kinder, gentler tutorial on object-oriented programming in Perl can +be found in perlootut. You should also check out perlmodlib for +some style guides on constructing both modules and classes. diff --git a/data/miniconda3/man/man1/perlootut.1 b/data/miniconda3/man/man1/perlootut.1 new file mode 100644 index 0000000000000000000000000000000000000000..0fd8f84ba4680c82d9e69fb8a695df4d8635d2e2 --- /dev/null +++ b/data/miniconda3/man/man1/perlootut.1 @@ -0,0 +1,863 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLOOTUT 1" +.TH PERLOOTUT 1 "2020-12-18" "perl v5.32.1" "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" +perlootut \- Object\-Oriented Programming in Perl Tutorial +.SH "DATE" +.IX Header "DATE" +This document was created in February, 2011, and the last major +revision was in February, 2013. +.PP +If you are reading this in the future then it's possible that the state +of the art has changed. We recommend you start by reading the perlootut +document in the latest stable release of Perl, rather than this +version. +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document provides an introduction to object-oriented programming +in Perl. It begins with a brief overview of the concepts behind object +oriented design. Then it introduces several different \s-1OO\s0 systems from +\&\s-1CPAN\s0 which build on top of what Perl +provides. +.PP +By default, Perl's built-in \s-1OO\s0 system is very minimal, leaving you to +do most of the work. This minimalism made a lot of sense in 1994, but +in the years since Perl 5.0 we've seen a number of common patterns +emerge in Perl \s-1OO.\s0 Fortunately, Perl's flexibility has allowed a rich +ecosystem of Perl \s-1OO\s0 systems to flourish. +.PP +If you want to know how Perl \s-1OO\s0 works under the hood, the perlobj +document explains the nitty gritty details. +.PP +This document assumes that you already understand the basics of Perl +syntax, variable types, operators, and subroutine calls. If you don't +understand these concepts yet, please read perlintro first. You +should also read the perlsyn, perlop, and perlsub documents. +.SH "OBJECT-ORIENTED FUNDAMENTALS" +.IX Header "OBJECT-ORIENTED FUNDAMENTALS" +Most object systems share a number of common concepts. You've probably +heard terms like \*(L"class\*(R", \*(L"object, \*(R"method\*(L", and \*(R"attribute" before. +Understanding the concepts will make it much easier to read and write +object-oriented code. If you're already familiar with these terms, you +should still skim this section, since it explains each concept in terms +of Perl's \s-1OO\s0 implementation. +.PP +Perl's \s-1OO\s0 system is class-based. Class-based \s-1OO\s0 is fairly common. It's +used by Java, \*(C+, C#, Python, Ruby, and many other languages. There +are other object orientation paradigms as well. JavaScript is the most +popular language to use another paradigm. JavaScript's \s-1OO\s0 system is +prototype-based. +.SS "Object" +.IX Subsection "Object" +An \fBobject\fR is a data structure that bundles together data and +subroutines which operate on that data. An object's data is called +\&\fBattributes\fR, and its subroutines are called \fBmethods\fR. An object can +be thought of as a noun (a person, a web service, a computer). +.PP +An object represents a single discrete thing. For example, an object +might represent a file. The attributes for a file object might include +its path, content, and last modification time. If we created an object +to represent \fI/etc/hostname\fR on a machine named \*(L"foo.example.com\*(R", +that object's path would be \*(L"/etc/hostname\*(R", its content would be +\&\*(L"foo\en\*(R", and it's last modification time would be 1304974868 seconds +since the beginning of the epoch. +.PP +The methods associated with a file might include \f(CW\*(C`rename()\*(C'\fR and +\&\f(CW\*(C`write()\*(C'\fR. +.PP +In Perl most objects are hashes, but the \s-1OO\s0 systems we recommend keep +you from having to worry about this. In practice, it's best to consider +an object's internal data structure opaque. +.SS "Class" +.IX Subsection "Class" +A \fBclass\fR defines the behavior of a category of objects. A class is a +name for a category (like \*(L"File\*(R"), and a class also defines the +behavior of objects in that category. +.PP +All objects belong to a specific class. For example, our +\&\fI/etc/hostname\fR object belongs to the \f(CW\*(C`File\*(C'\fR class. When we want to +create a specific object, we start with its class, and \fBconstruct\fR or +\&\fBinstantiate\fR an object. A specific object is often referred to as an +\&\fBinstance\fR of a class. +.PP +In Perl, any package can be a class. The difference between a package +which is a class and one which isn't is based on how the package is +used. Here's our \*(L"class declaration\*(R" for the \f(CW\*(C`File\*(C'\fR class: +.PP +.Vb 1 +\& package File; +.Ve +.PP +In Perl, there is no special keyword for constructing an object. +However, most \s-1OO\s0 modules on \s-1CPAN\s0 use a method named \f(CW\*(C`new()\*(C'\fR to +construct a new object: +.PP +.Vb 5 +\& my $hostname = File\->new( +\& path => \*(Aq/etc/hostname\*(Aq, +\& content => "foo\en", +\& last_mod_time => 1304974868, +\& ); +.Ve +.PP +(Don't worry about that \f(CW\*(C`\->\*(C'\fR operator, it will be explained +later.) +.PP +\fIBlessing\fR +.IX Subsection "Blessing" +.PP +As we said earlier, most Perl objects are hashes, but an object can be +an instance of any Perl data type (scalar, array, etc.). Turning a +plain data structure into an object is done by \fBblessing\fR that data +structure using Perl's \f(CW\*(C`bless\*(C'\fR function. +.PP +While we strongly suggest you don't build your objects from scratch, +you should know the term \fBbless\fR. A \fBblessed\fR data structure (aka \*(L"a +referent\*(R") is an object. We sometimes say that an object has been +\&\*(L"blessed into a class\*(R". +.PP +Once a referent has been blessed, the \f(CW\*(C`blessed\*(C'\fR function from the +Scalar::Util core module can tell us its class name. This subroutine +returns an object's class when passed an object, and false otherwise. +.PP +.Vb 1 +\& use Scalar::Util \*(Aqblessed\*(Aq; +\& +\& print blessed($hash); # undef +\& print blessed($hostname); # File +.Ve +.PP +\fIConstructor\fR +.IX Subsection "Constructor" +.PP +A \fBconstructor\fR creates a new object. In Perl, a class's constructor +is just another method, unlike some other languages, which provide +syntax for constructors. Most Perl classes use \f(CW\*(C`new\*(C'\fR as the name for +their constructor: +.PP +.Vb 1 +\& my $file = File\->new(...); +.Ve +.SS "Methods" +.IX Subsection "Methods" +You already learned that a \fBmethod\fR is a subroutine that operates on +an object. You can think of a method as the things that an object can +\&\fIdo\fR. If an object is a noun, then methods are its verbs (save, print, +open). +.PP +In Perl, methods are simply subroutines that live in a class's package. +Methods are always written to receive the object as their first +argument: +.PP +.Vb 2 +\& sub print_info { +\& my $self = shift; +\& +\& print "This file is at ", $self\->path, "\en"; +\& } +\& +\& $file\->print_info; +\& # The file is at /etc/hostname +.Ve +.PP +What makes a method special is \fIhow it's called\fR. The arrow operator +(\f(CW\*(C`\->\*(C'\fR) tells Perl that we are calling a method. +.PP +When we make a method call, Perl arranges for the method's \fBinvocant\fR +to be passed as the first argument. \fBInvocant\fR is a fancy name for the +thing on the left side of the arrow. The invocant can either be a class +name or an object. We can also pass additional arguments to the method: +.PP +.Vb 3 +\& sub print_info { +\& my $self = shift; +\& my $prefix = shift // "This file is at "; +\& +\& print $prefix, ", ", $self\->path, "\en"; +\& } +\& +\& $file\->print_info("The file is located at "); +\& # The file is located at /etc/hostname +.Ve +.SS "Attributes" +.IX Subsection "Attributes" +Each class can define its \fBattributes\fR. When we instantiate an object, +we assign values to those attributes. For example, every \f(CW\*(C`File\*(C'\fR object +has a path. Attributes are sometimes called \fBproperties\fR. +.PP +Perl has no special syntax for attributes. Under the hood, attributes +are often stored as keys in the object's underlying hash, but don't +worry about this. +.PP +We recommend that you only access attributes via \fBaccessor\fR methods. +These are methods that can get or set the value of each attribute. We +saw this earlier in the \f(CW\*(C`print_info()\*(C'\fR example, which calls \f(CW\*(C`$self\->path\*(C'\fR. +.PP +You might also see the terms \fBgetter\fR and \fBsetter\fR. These are two +types of accessors. A getter gets the attribute's value, while a setter +sets it. Another term for a setter is \fBmutator\fR +.PP +Attributes are typically defined as read-only or read-write. Read-only +attributes can only be set when the object is first created, while +read-write attributes can be altered at any time. +.PP +The value of an attribute may itself be another object. For example, +instead of returning its last mod time as a number, the \f(CW\*(C`File\*(C'\fR class +could return a DateTime object representing that value. +.PP +It's possible to have a class that does not expose any publicly +settable attributes. Not every class has attributes and methods. +.SS "Polymorphism" +.IX Subsection "Polymorphism" +\&\fBPolymorphism\fR is a fancy way of saying that objects from two +different classes share an \s-1API.\s0 For example, we could have \f(CW\*(C`File\*(C'\fR and +\&\f(CW\*(C`WebPage\*(C'\fR classes which both have a \f(CW\*(C`print_content()\*(C'\fR method. This +method might produce different output for each class, but they share a +common interface. +.PP +While the two classes may differ in many ways, when it comes to the +\&\f(CW\*(C`print_content()\*(C'\fR method, they are the same. This means that we can +try to call the \f(CW\*(C`print_content()\*(C'\fR method on an object of either class, +and \fBwe don't have to know what class the object belongs to!\fR +.PP +Polymorphism is one of the key concepts of object-oriented design. +.SS "Inheritance" +.IX Subsection "Inheritance" +\&\fBInheritance\fR lets you create a specialized version of an existing +class. Inheritance lets the new class reuse the methods and attributes +of another class. +.PP +For example, we could create an \f(CW\*(C`File::MP3\*(C'\fR class which \fBinherits\fR +from \f(CW\*(C`File\*(C'\fR. An \f(CW\*(C`File::MP3\*(C'\fR \fBis-a\fR \fImore specific\fR type of \f(CW\*(C`File\*(C'\fR. +All mp3 files are files, but not all files are mp3 files. +.PP +We often refer to inheritance relationships as \fBparent-child\fR or +\&\f(CW\*(C`superclass\*(C'\fR/\f(CW\*(C`subclass\*(C'\fR relationships. Sometimes we say that the +child has an \fBis-a\fR relationship with its parent class. +.PP +\&\f(CW\*(C`File\*(C'\fR is a \fBsuperclass\fR of \f(CW\*(C`File::MP3\*(C'\fR, and \f(CW\*(C`File::MP3\*(C'\fR is a +\&\fBsubclass\fR of \f(CW\*(C`File\*(C'\fR. +.PP +.Vb 1 +\& package File::MP3; +\& +\& use parent \*(AqFile\*(Aq; +.Ve +.PP +The parent module is one of several ways that Perl lets you define +inheritance relationships. +.PP +Perl allows multiple inheritance, which means that a class can inherit +from multiple parents. While this is possible, we strongly recommend +against it. Generally, you can use \fBroles\fR to do everything you can do +with multiple inheritance, but in a cleaner way. +.PP +Note that there's nothing wrong with defining multiple subclasses of a +given class. This is both common and safe. For example, we might define +\&\f(CW\*(C`File::MP3::FixedBitrate\*(C'\fR and \f(CW\*(C`File::MP3::VariableBitrate\*(C'\fR classes to +distinguish between different types of mp3 file. +.PP +\fIOverriding methods and method resolution\fR +.IX Subsection "Overriding methods and method resolution" +.PP +Inheritance allows two classes to share code. By default, every method +in the parent class is also available in the child. The child can +explicitly \fBoverride\fR a parent's method to provide its own +implementation. For example, if we have an \f(CW\*(C`File::MP3\*(C'\fR object, it has +the \f(CW\*(C`print_info()\*(C'\fR method from \f(CW\*(C`File\*(C'\fR: +.PP +.Vb 6 +\& my $cage = File::MP3\->new( +\& path => \*(Aqmp3s/My\-Body\-Is\-a\-Cage.mp3\*(Aq, +\& content => $mp3_data, +\& last_mod_time => 1304974868, +\& title => \*(AqMy Body Is a Cage\*(Aq, +\& ); +\& +\& $cage\->print_info; +\& # The file is at mp3s/My\-Body\-Is\-a\-Cage.mp3 +.Ve +.PP +If we wanted to include the mp3's title in the greeting, we could +override the method: +.PP +.Vb 1 +\& package File::MP3; +\& +\& use parent \*(AqFile\*(Aq; +\& +\& sub print_info { +\& my $self = shift; +\& +\& print "This file is at ", $self\->path, "\en"; +\& print "Its title is ", $self\->title, "\en"; +\& } +\& +\& $cage\->print_info; +\& # The file is at mp3s/My\-Body\-Is\-a\-Cage.mp3 +\& # Its title is My Body Is a Cage +.Ve +.PP +The process of determining what method should be used is called +\&\fBmethod resolution\fR. What Perl does is look at the object's class +first (\f(CW\*(C`File::MP3\*(C'\fR in this case). If that class defines the method, +then that class's version of the method is called. If not, Perl looks +at each parent class in turn. For \f(CW\*(C`File::MP3\*(C'\fR, its only parent is +\&\f(CW\*(C`File\*(C'\fR. If \f(CW\*(C`File::MP3\*(C'\fR does not define the method, but \f(CW\*(C`File\*(C'\fR does, +then Perl calls the method in \f(CW\*(C`File\*(C'\fR. +.PP +If \f(CW\*(C`File\*(C'\fR inherited from \f(CW\*(C`DataSource\*(C'\fR, which inherited from \f(CW\*(C`Thing\*(C'\fR, +then Perl would keep looking \*(L"up the chain\*(R" if necessary. +.PP +It is possible to explicitly call a parent method from a child: +.PP +.Vb 1 +\& package File::MP3; +\& +\& use parent \*(AqFile\*(Aq; +\& +\& sub print_info { +\& my $self = shift; +\& +\& $self\->SUPER::print_info(); +\& print "Its title is ", $self\->title, "\en"; +\& } +.Ve +.PP +The \f(CW\*(C`SUPER::\*(C'\fR bit tells Perl to look for the \f(CW\*(C`print_info()\*(C'\fR in the +\&\f(CW\*(C`File::MP3\*(C'\fR class's inheritance chain. When it finds the parent class +that implements this method, the method is called. +.PP +We mentioned multiple inheritance earlier. The main problem with +multiple inheritance is that it greatly complicates method resolution. +See perlobj for more details. +.SS "Encapsulation" +.IX Subsection "Encapsulation" +\&\fBEncapsulation\fR is the idea that an object is opaque. When another +developer uses your class, they don't need to know \fIhow\fR it is +implemented, they just need to know \fIwhat\fR it does. +.PP +Encapsulation is important for several reasons. First, it allows you to +separate the public \s-1API\s0 from the private implementation. This means you +can change that implementation without breaking the \s-1API.\s0 +.PP +Second, when classes are well encapsulated, they become easier to +subclass. Ideally, a subclass uses the same APIs to access object data +that its parent class uses. In reality, subclassing sometimes involves +violating encapsulation, but a good \s-1API\s0 can minimize the need to do +this. +.PP +We mentioned earlier that most Perl objects are implemented as hashes +under the hood. The principle of encapsulation tells us that we should +not rely on this. Instead, we should use accessor methods to access the +data in that hash. The object systems that we recommend below all +automate the generation of accessor methods. If you use one of them, +you should never have to access the object as a hash directly. +.SS "Composition" +.IX Subsection "Composition" +In object-oriented code, we often find that one object references +another object. This is called \fBcomposition\fR, or a \fBhas-a\fR +relationship. +.PP +Earlier, we mentioned that the \f(CW\*(C`File\*(C'\fR class's \f(CW\*(C`last_mod_time\*(C'\fR +accessor could return a DateTime object. This is a perfect example +of composition. We could go even further, and make the \f(CW\*(C`path\*(C'\fR and +\&\f(CW\*(C`content\*(C'\fR accessors return objects as well. The \f(CW\*(C`File\*(C'\fR class would +then be \fBcomposed\fR of several other objects. +.SS "Roles" +.IX Subsection "Roles" +\&\fBRoles\fR are something that a class \fIdoes\fR, rather than something that +it \fIis\fR. Roles are relatively new to Perl, but have become rather +popular. Roles are \fBapplied\fR to classes. Sometimes we say that classes +\&\fBconsume\fR roles. +.PP +Roles are an alternative to inheritance for providing polymorphism. +Let's assume we have two classes, \f(CW\*(C`Radio\*(C'\fR and \f(CW\*(C`Computer\*(C'\fR. Both of +these things have on/off switches. We want to model that in our class +definitions. +.PP +We could have both classes inherit from a common parent, like +\&\f(CW\*(C`Machine\*(C'\fR, but not all machines have on/off switches. We could create +a parent class called \f(CW\*(C`HasOnOffSwitch\*(C'\fR, but that is very artificial. +Radios and computers are not specializations of this parent. This +parent is really a rather ridiculous creation. +.PP +This is where roles come in. It makes a lot of sense to create a +\&\f(CW\*(C`HasOnOffSwitch\*(C'\fR role and apply it to both classes. This role would +define a known \s-1API\s0 like providing \f(CW\*(C`turn_on()\*(C'\fR and \f(CW\*(C`turn_off()\*(C'\fR +methods. +.PP +Perl does not have any built-in way to express roles. In the past, +people just bit the bullet and used multiple inheritance. Nowadays, +there are several good choices on \s-1CPAN\s0 for using roles. +.SS "When to Use \s-1OO\s0" +.IX Subsection "When to Use OO" +Object Orientation is not the best solution to every problem. In \fIPerl +Best Practices\fR (copyright 2004, Published by O'Reilly Media, Inc.), +Damian Conway provides a list of criteria to use when deciding if \s-1OO\s0 is +the right fit for your problem: +.IP "\(bu" 4 +The system being designed is large, or is likely to become large. +.IP "\(bu" 4 +The data can be aggregated into obvious structures, especially if +there's a large amount of data in each aggregate. +.IP "\(bu" 4 +The various types of data aggregate form a natural hierarchy that +facilitates the use of inheritance and polymorphism. +.IP "\(bu" 4 +You have a piece of data on which many different operations are +applied. +.IP "\(bu" 4 +You need to perform the same general operations on related types of +data, but with slight variations depending on the specific type of data +the operations are applied to. +.IP "\(bu" 4 +It's likely you'll have to add new data types later. +.IP "\(bu" 4 +The typical interactions between pieces of data are best represented by +operators. +.IP "\(bu" 4 +The implementation of individual components of the system is likely to +change over time. +.IP "\(bu" 4 +The system design is already object-oriented. +.IP "\(bu" 4 +Large numbers of other programmers will be using your code modules. +.SH "PERL OO SYSTEMS" +.IX Header "PERL OO SYSTEMS" +As we mentioned before, Perl's built-in \s-1OO\s0 system is very minimal, but +also quite flexible. Over the years, many people have developed systems +which build on top of Perl's built-in system to provide more features +and convenience. +.PP +We strongly recommend that you use one of these systems. Even the most +minimal of them eliminates a lot of repetitive boilerplate. There's +really no good reason to write your classes from scratch in Perl. +.PP +If you are interested in the guts underlying these systems, check out +perlobj. +.SS "Moose" +.IX Subsection "Moose" +Moose bills itself as a \*(L"postmodern object system for Perl 5\*(R". Don't +be scared, the \*(L"postmodern\*(R" label is a callback to Larry's description +of Perl as \*(L"the first postmodern computer language\*(R". +.PP +\&\f(CW\*(C`Moose\*(C'\fR provides a complete, modern \s-1OO\s0 system. Its biggest influence +is the Common Lisp Object System, but it also borrows ideas from +Smalltalk and several other languages. \f(CW\*(C`Moose\*(C'\fR was created by Stevan +Little, and draws heavily from his work on the Raku \s-1OO\s0 design. +.PP +Here is our \f(CW\*(C`File\*(C'\fR class using \f(CW\*(C`Moose\*(C'\fR: +.PP +.Vb 2 +\& package File; +\& use Moose; +\& +\& has path => ( is => \*(Aqro\*(Aq ); +\& has content => ( is => \*(Aqro\*(Aq ); +\& has last_mod_time => ( is => \*(Aqro\*(Aq ); +\& +\& sub print_info { +\& my $self = shift; +\& +\& print "This file is at ", $self\->path, "\en"; +\& } +.Ve +.PP +\&\f(CW\*(C`Moose\*(C'\fR provides a number of features: +.IP "\(bu" 4 +Declarative sugar +.Sp +\&\f(CW\*(C`Moose\*(C'\fR provides a layer of declarative \*(L"sugar\*(R" for defining classes. +That sugar is just a set of exported functions that make declaring how +your class works simpler and more palatable. This lets you describe +\&\fIwhat\fR your class is, rather than having to tell Perl \fIhow\fR to +implement your class. +.Sp +The \f(CW\*(C`has()\*(C'\fR subroutine declares an attribute, and \f(CW\*(C`Moose\*(C'\fR +automatically creates accessors for these attributes. It also takes +care of creating a \f(CW\*(C`new()\*(C'\fR method for you. This constructor knows +about the attributes you declared, so you can set them when creating a +new \f(CW\*(C`File\*(C'\fR. +.IP "\(bu" 4 +Roles built-in +.Sp +\&\f(CW\*(C`Moose\*(C'\fR lets you define roles the same way you define classes: +.Sp +.Vb 2 +\& package HasOnOffSwitch; +\& use Moose::Role; +\& +\& has is_on => ( +\& is => \*(Aqrw\*(Aq, +\& isa => \*(AqBool\*(Aq, +\& ); +\& +\& sub turn_on { +\& my $self = shift; +\& $self\->is_on(1); +\& } +\& +\& sub turn_off { +\& my $self = shift; +\& $self\->is_on(0); +\& } +.Ve +.IP "\(bu" 4 +A miniature type system +.Sp +In the example above, you can see that we passed \f(CW\*(C`isa => \*(AqBool\*(Aq\*(C'\fR +to \f(CW\*(C`has()\*(C'\fR when creating our \f(CW\*(C`is_on\*(C'\fR attribute. This tells \f(CW\*(C`Moose\*(C'\fR +that this attribute must be a boolean value. If we try to set it to an +invalid value, our code will throw an error. +.IP "\(bu" 4 +Full introspection and manipulation +.Sp +Perl's built-in introspection features are fairly minimal. \f(CW\*(C`Moose\*(C'\fR +builds on top of them and creates a full introspection layer for your +classes. This lets you ask questions like \*(L"what methods does the File +class implement?\*(R" It also lets you modify your classes +programmatically. +.IP "\(bu" 4 +Self-hosted and extensible +.Sp +\&\f(CW\*(C`Moose\*(C'\fR describes itself using its own introspection \s-1API.\s0 Besides +being a cool trick, this means that you can extend \f(CW\*(C`Moose\*(C'\fR using +\&\f(CW\*(C`Moose\*(C'\fR itself. +.IP "\(bu" 4 +Rich ecosystem +.Sp +There is a rich ecosystem of \f(CW\*(C`Moose\*(C'\fR extensions on \s-1CPAN\s0 under the +MooseX +namespace. In addition, many modules on \s-1CPAN\s0 already use \f(CW\*(C`Moose\*(C'\fR, +providing you with lots of examples to learn from. +.IP "\(bu" 4 +Many more features +.Sp +\&\f(CW\*(C`Moose\*(C'\fR is a very powerful tool, and we can't cover all of its +features here. We encourage you to learn more by reading the \f(CW\*(C`Moose\*(C'\fR +documentation, starting with +Moose::Manual . +.PP +Of course, \f(CW\*(C`Moose\*(C'\fR isn't perfect. +.PP +\&\f(CW\*(C`Moose\*(C'\fR can make your code slower to load. \f(CW\*(C`Moose\*(C'\fR itself is not +small, and it does a \fIlot\fR of code generation when you define your +class. This code generation means that your runtime code is as fast as +it can be, but you pay for this when your modules are first loaded. +.PP +This load time hit can be a problem when startup speed is important, +such as with a command-line script or a \*(L"plain vanilla\*(R" \s-1CGI\s0 script that +must be loaded each time it is executed. +.PP +Before you panic, know that many people do use \f(CW\*(C`Moose\*(C'\fR for +command-line tools and other startup-sensitive code. We encourage you +to try \f(CW\*(C`Moose\*(C'\fR out first before worrying about startup speed. +.PP +\&\f(CW\*(C`Moose\*(C'\fR also has several dependencies on other modules. Most of these +are small stand-alone modules, a number of which have been spun off +from \f(CW\*(C`Moose\*(C'\fR. \f(CW\*(C`Moose\*(C'\fR itself, and some of its dependencies, require a +compiler. If you need to install your software on a system without a +compiler, or if having \fIany\fR dependencies is a problem, then \f(CW\*(C`Moose\*(C'\fR +may not be right for you. +.PP +\fIMoo\fR +.IX Subsection "Moo" +.PP +If you try \f(CW\*(C`Moose\*(C'\fR and find that one of these issues is preventing you +from using \f(CW\*(C`Moose\*(C'\fR, we encourage you to consider Moo next. \f(CW\*(C`Moo\*(C'\fR +implements a subset of \f(CW\*(C`Moose\*(C'\fR's functionality in a simpler package. +For most features that it does implement, the end-user \s-1API\s0 is +\&\fIidentical\fR to \f(CW\*(C`Moose\*(C'\fR, meaning you can switch from \f(CW\*(C`Moo\*(C'\fR to +\&\f(CW\*(C`Moose\*(C'\fR quite easily. +.PP +\&\f(CW\*(C`Moo\*(C'\fR does not implement most of \f(CW\*(C`Moose\*(C'\fR's introspection \s-1API,\s0 so it's +often faster when loading your modules. Additionally, none of its +dependencies require \s-1XS,\s0 so it can be installed on machines without a +compiler. +.PP +One of \f(CW\*(C`Moo\*(C'\fR's most compelling features is its interoperability with +\&\f(CW\*(C`Moose\*(C'\fR. When someone tries to use \f(CW\*(C`Moose\*(C'\fR's introspection \s-1API\s0 on a +\&\f(CW\*(C`Moo\*(C'\fR class or role, it is transparently inflated into a \f(CW\*(C`Moose\*(C'\fR +class or role. This makes it easier to incorporate \f(CW\*(C`Moo\*(C'\fR\-using code +into a \f(CW\*(C`Moose\*(C'\fR code base and vice versa. +.PP +For example, a \f(CW\*(C`Moose\*(C'\fR class can subclass a \f(CW\*(C`Moo\*(C'\fR class using +\&\f(CW\*(C`extends\*(C'\fR or consume a \f(CW\*(C`Moo\*(C'\fR role using \f(CW\*(C`with\*(C'\fR. +.PP +The \f(CW\*(C`Moose\*(C'\fR authors hope that one day \f(CW\*(C`Moo\*(C'\fR can be made obsolete by +improving \f(CW\*(C`Moose\*(C'\fR enough, but for now it provides a worthwhile +alternative to \f(CW\*(C`Moose\*(C'\fR. +.SS "Class::Accessor" +.IX Subsection "Class::Accessor" +Class::Accessor is the polar opposite of \f(CW\*(C`Moose\*(C'\fR. It provides very +few features, nor is it self-hosting. +.PP +It is, however, very simple, pure Perl, and it has no non-core +dependencies. It also provides a \*(L"Moose-like\*(R" \s-1API\s0 on demand for the +features it supports. +.PP +Even though it doesn't do much, it is still preferable to writing your +own classes from scratch. +.PP +Here's our \f(CW\*(C`File\*(C'\fR class with \f(CW\*(C`Class::Accessor\*(C'\fR: +.PP +.Vb 2 +\& package File; +\& use Class::Accessor \*(Aqantlers\*(Aq; +\& +\& has path => ( is => \*(Aqro\*(Aq ); +\& has content => ( is => \*(Aqro\*(Aq ); +\& has last_mod_time => ( is => \*(Aqro\*(Aq ); +\& +\& sub print_info { +\& my $self = shift; +\& +\& print "This file is at ", $self\->path, "\en"; +\& } +.Ve +.PP +The \f(CW\*(C`antlers\*(C'\fR import flag tells \f(CW\*(C`Class::Accessor\*(C'\fR that you want to +define your attributes using \f(CW\*(C`Moose\*(C'\fR\-like syntax. The only parameter +that you can pass to \f(CW\*(C`has\*(C'\fR is \f(CW\*(C`is\*(C'\fR. We recommend that you use this +Moose-like syntax if you choose \f(CW\*(C`Class::Accessor\*(C'\fR since it means you +will have a smoother upgrade path if you later decide to move to +\&\f(CW\*(C`Moose\*(C'\fR. +.PP +Like \f(CW\*(C`Moose\*(C'\fR, \f(CW\*(C`Class::Accessor\*(C'\fR generates accessor methods and a +constructor for your class. +.SS "Class::Tiny" +.IX Subsection "Class::Tiny" +Finally, we have Class::Tiny. This module truly lives up to its +name. It has an incredibly minimal \s-1API\s0 and absolutely no dependencies +on any recent Perl. Still, we think it's a lot easier to use than +writing your own \s-1OO\s0 code from scratch. +.PP +Here's our \f(CW\*(C`File\*(C'\fR class once more: +.PP +.Vb 2 +\& package File; +\& use Class::Tiny qw( path content last_mod_time ); +\& +\& sub print_info { +\& my $self = shift; +\& +\& print "This file is at ", $self\->path, "\en"; +\& } +.Ve +.PP +That's it! +.PP +With \f(CW\*(C`Class::Tiny\*(C'\fR, all accessors are read-write. It generates a +constructor for you, as well as the accessors you define. +.PP +You can also use Class::Tiny::Antlers for \f(CW\*(C`Moose\*(C'\fR\-like syntax. +.SS "Role::Tiny" +.IX Subsection "Role::Tiny" +As we mentioned before, roles provide an alternative to inheritance, +but Perl does not have any built-in role support. If you choose to use +Moose, it comes with a full-fledged role implementation. However, if +you use one of our other recommended \s-1OO\s0 modules, you can still use +roles with Role::Tiny +.PP +\&\f(CW\*(C`Role::Tiny\*(C'\fR provides some of the same features as Moose's role +system, but in a much smaller package. Most notably, it doesn't support +any sort of attribute declaration, so you have to do that by hand. +Still, it's useful, and works well with \f(CW\*(C`Class::Accessor\*(C'\fR and +\&\f(CW\*(C`Class::Tiny\*(C'\fR +.SS "\s-1OO\s0 System Summary" +.IX Subsection "OO System Summary" +Here's a brief recap of the options we covered: +.IP "\(bu" 4 +Moose +.Sp +\&\f(CW\*(C`Moose\*(C'\fR is the maximal option. It has a lot of features, a big +ecosystem, and a thriving user base. We also covered Moo briefly. +\&\f(CW\*(C`Moo\*(C'\fR is \f(CW\*(C`Moose\*(C'\fR lite, and a reasonable alternative when Moose +doesn't work for your application. +.IP "\(bu" 4 +Class::Accessor +.Sp +\&\f(CW\*(C`Class::Accessor\*(C'\fR does a lot less than \f(CW\*(C`Moose\*(C'\fR, and is a nice +alternative if you find \f(CW\*(C`Moose\*(C'\fR overwhelming. It's been around a long +time and is well battle-tested. It also has a minimal \f(CW\*(C`Moose\*(C'\fR +compatibility mode which makes moving from \f(CW\*(C`Class::Accessor\*(C'\fR to +\&\f(CW\*(C`Moose\*(C'\fR easy. +.IP "\(bu" 4 +Class::Tiny +.Sp +\&\f(CW\*(C`Class::Tiny\*(C'\fR is the absolute minimal option. It has no dependencies, +and almost no syntax to learn. It's a good option for a super minimal +environment and for throwing something together quickly without having +to worry about details. +.IP "\(bu" 4 +Role::Tiny +.Sp +Use \f(CW\*(C`Role::Tiny\*(C'\fR with \f(CW\*(C`Class::Accessor\*(C'\fR or \f(CW\*(C`Class::Tiny\*(C'\fR if you find +yourself considering multiple inheritance. If you go with \f(CW\*(C`Moose\*(C'\fR, it +comes with its own role implementation. +.SS "Other \s-1OO\s0 Systems" +.IX Subsection "Other OO Systems" +There are literally dozens of other OO-related modules on \s-1CPAN\s0 besides +those covered here, and you're likely to run across one or more of them +if you work with other people's code. +.PP +In addition, plenty of code in the wild does all of its \s-1OO\s0 \*(L"by hand\*(R", +using just the Perl built-in \s-1OO\s0 features. If you need to maintain such +code, you should read perlobj to understand exactly how Perl's +built-in \s-1OO\s0 works. +.SH "CONCLUSION" +.IX Header "CONCLUSION" +As we said before, Perl's minimal \s-1OO\s0 system has led to a profusion of +\&\s-1OO\s0 systems on \s-1CPAN.\s0 While you can still drop down to the bare metal and +write your classes by hand, there's really no reason to do that with +modern Perl. +.PP +For small systems, Class::Tiny and Class::Accessor both provide +minimal object systems that take care of basic boilerplate for you. +.PP +For bigger projects, Moose provides a rich set of features that will +let you focus on implementing your business logic. Moo provides a +nice alternative to Moose when you want a lot of features but need +faster compile time or to avoid \s-1XS.\s0 +.PP +We encourage you to play with and evaluate Moose, Moo, +Class::Accessor, and Class::Tiny to see which \s-1OO\s0 system is right +for you. diff --git a/data/miniconda3/man/man1/perlos400.1 b/data/miniconda3/man/man1/perlos400.1 new file mode 100644 index 0000000000000000000000000000000000000000..1eb6aacd2b833ba0b8fc21947c41a57cb3a6e682 --- /dev/null +++ b/data/miniconda3/man/man1/perlos400.1 @@ -0,0 +1,253 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLOS400 1" +.TH PERLOS400 1 "2020-12-18" "perl v5.32.1" "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" +perlos400 \- Perl version 5 on OS/400 +.PP +This document needs to be updated, but we don't know what it should say. +Please submit comments to . +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes various features of \s-1IBM\s0's \s-1OS/400\s0 operating +system that will affect how Perl version 5 (hereafter just Perl) is +compiled and/or runs. +.PP +By far the easiest way to build Perl for \s-1OS/400\s0 is to use the \s-1PASE\s0 +(Portable Application Solutions Environment), for more information see + +This environment allows one to use \s-1AIX\s0 APIs while programming, and it +provides a runtime that allows \s-1AIX\s0 binaries to execute directly on the +PowerPC iSeries. +.SS "Compiling Perl for \s-1OS/400 PASE\s0" +.IX Subsection "Compiling Perl for OS/400 PASE" +The recommended way to build Perl for the \s-1OS/400 PASE\s0 is to build the +Perl 5 source code (release 5.8.1 or later) under \s-1AIX.\s0 +.PP +The trick is to give a special parameter to the Configure shell script +when running it on \s-1AIX:\s0 +.PP +.Vb 1 +\& sh Configure \-DPASE ... +.Ve +.PP +The default installation directory of Perl under \s-1PASE\s0 is /QOpenSys/perl. +This can be modified if needed with Configure parameter \-Dprefix=/some/dir. +.PP +Starting from \s-1OS/400 V5R2\s0 the \s-1IBM\s0 Visual Age compiler is supported +on \s-1OS/400 PASE,\s0 so it is possible to build Perl natively on \s-1OS/400.\s0 +The easier way, however, is to compile in \s-1AIX,\s0 as just described. +.PP +If you don't want to install the compiled Perl in \s-1AIX\s0 into /QOpenSys +(for packaging it before copying it to \s-1PASE\s0), you can use a Configure +parameter: \-Dinstallprefix=/tmp/QOpenSys/perl. This will cause the +\&\*(L"make install\*(R" to install everything into that directory, while the +installed files still think they are (will be) in /QOpenSys/perl. +.PP +If building natively on \s-1PASE,\s0 please do the build under the /QOpenSys +directory, since Perl is happier when built on a case sensitive filesystem. +.SS "Installing Perl in \s-1OS/400 PASE\s0" +.IX Subsection "Installing Perl in OS/400 PASE" +If you are compiling on \s-1AIX,\s0 simply do a \*(L"make install\*(R" on the \s-1AIX\s0 box. +Once the install finishes, tar up the /QOpenSys/perl directory. Transfer +the tarball to the \s-1OS/400\s0 using \s-1FTP\s0 with the following commands: +.PP +.Vb 3 +\& > binary +\& > site namefmt 1 +\& > put perl.tar /QOpenSys +.Ve +.PP +Once you have it on, simply bring up a \s-1PASE\s0 shell and extract the tarball. +.PP +If you are compiling in \s-1PASE,\s0 then \*(L"make install\*(R" is the only thing you +will need to do. +.PP +The default path for perl binary is /QOpenSys/perl/bin/perl. You'll +want to symlink /QOpenSys/usr/bin/perl to this file so you don't have +to modify your path. +.SS "Using Perl in \s-1OS/400 PASE\s0" +.IX Subsection "Using Perl in OS/400 PASE" +Perl in \s-1PASE\s0 may be used in the same manner as you would use Perl on \s-1AIX.\s0 +.PP +Scripts starting with #!/usr/bin/perl should work if you have +/QOpenSys/usr/bin/perl symlinked to your perl binary. This will not +work if you've done a setuid/setgid or have environment variable +PASE_EXEC_QOPENSYS=\*(L"N\*(R". If you have V5R1, you'll need to get the +latest PTFs to have this feature. Scripts starting with +#!/QOpenSys/perl/bin/perl should always work. +.SS "Known Problems" +.IX Subsection "Known Problems" +When compiling in \s-1PASE,\s0 there is no \*(L"oslevel\*(R" command. Therefore, +you may want to create a script called \*(L"oslevel\*(R" that echoes the +level of \s-1AIX\s0 that your version of \s-1PASE\s0 runtime supports. If you're +unsure, consult your documentation or use \*(L"4.3.3.0\*(R". +.PP +If you have test cases that fail, check for the existence of spool files. +The test case may be trying to use a syscall that is not implemented +in \s-1PASE.\s0 To avoid the \s-1SIGILL,\s0 try setting the \s-1PASE_SYSCALL_NOSIGILL\s0 +environment variable or have a handler for the \s-1SIGILL.\s0 If you can +compile programs for \s-1PASE,\s0 run the config script and edit config.sh +when it gives you the option. If you want to remove \fBfchdir()\fR, which +isn't implement in V5R1, simply change the line that says: +.PP +d_fchdir='define' +.PP +to +.PP +d_fchdir='undef' +.PP +and then compile Perl. The places where \fBfchdir()\fR is used have +alternatives for systems that do not have \fBfchdir()\fR available. +.SS "Perl on \s-1ILE\s0" +.IX Subsection "Perl on ILE" +There exists a port of Perl to the \s-1ILE\s0 environment. This port, however, +is based quite an old release of Perl, Perl 5.00502 (August 1998). +(As of July 2002 the latest release of Perl is 5.8.0, and even 5.6.1 +has been out since April 2001.) If you need to run Perl on \s-1ILE,\s0 though, +you may need this older port: +Note that any Perl release later than 5.00502 has not been ported to \s-1ILE.\s0 +.PP +If you need to use Perl in the \s-1ILE\s0 environment, you may want to consider +using \fBQp2RunPase()\fR to call the \s-1PASE\s0 version of Perl. +.SH "AUTHORS" +.IX Header "AUTHORS" +Jarkko Hietaniemi +Bryan Logan +David Larson diff --git a/data/miniconda3/man/man1/perlperf.1 b/data/miniconda3/man/man1/perlperf.1 new file mode 100644 index 0000000000000000000000000000000000000000..dc2bd84aca1f99cb51f773ad22636c1610a260da --- /dev/null +++ b/data/miniconda3/man/man1/perlperf.1 @@ -0,0 +1,1377 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLPERF 1" +.TH PERLPERF 1 "2020-12-18" "perl v5.32.1" "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" +perlperf \- Perl Performance and Optimization Techniques +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This is an introduction to the use of performance and optimization techniques +which can be used with particular reference to perl programs. While many perl +developers have come from other languages, and can use their prior knowledge +where appropriate, there are many other people who might benefit from a few +perl specific pointers. If you want the condensed version, perhaps the best +advice comes from the renowned Japanese Samurai, Miyamoto Musashi, who said: +.PP +.Vb 1 +\& "Do Not Engage in Useless Activity" +.Ve +.PP +in 1645. +.SH "OVERVIEW" +.IX Header "OVERVIEW" +Perhaps the most common mistake programmers make is to attempt to optimize +their code before a program actually does anything useful \- this is a bad idea. +There's no point in having an extremely fast program that doesn't work. The +first job is to get a program to \fIcorrectly\fR do something \fBuseful\fR, (not to +mention ensuring the test suite is fully functional), and only then to consider +optimizing it. Having decided to optimize existing working code, there are +several simple but essential steps to consider which are intrinsic to any +optimization process. +.SS "\s-1ONE STEP SIDEWAYS\s0" +.IX Subsection "ONE STEP SIDEWAYS" +Firstly, you need to establish a baseline time for the existing code, which +timing needs to be reliable and repeatable. You'll probably want to use the +\&\f(CW\*(C`Benchmark\*(C'\fR or \f(CW\*(C`Devel::NYTProf\*(C'\fR modules, or something similar, for this step, +or perhaps the Unix system \f(CW\*(C`time\*(C'\fR utility, whichever is appropriate. See the +base of this document for a longer list of benchmarking and profiling modules, +and recommended further reading. +.SS "\s-1ONE STEP FORWARD\s0" +.IX Subsection "ONE STEP FORWARD" +Next, having examined the program for \fIhot spots\fR, (places where the code +seems to run slowly), change the code with the intention of making it run +faster. Using version control software, like \f(CW\*(C`subversion\*(C'\fR, will ensure no +changes are irreversible. It's too easy to fiddle here and fiddle there \- +don't change too much at any one time or you might not discover which piece of +code \fBreally\fR was the slow bit. +.SS "\s-1ANOTHER STEP SIDEWAYS\s0" +.IX Subsection "ANOTHER STEP SIDEWAYS" +It's not enough to say: \*(L"that will make it run faster\*(R", you have to check it. +Rerun the code under control of the benchmarking or profiling modules, from the +first step above, and check that the new code executed the \fBsame task\fR in +\&\fIless time\fR. Save your work and repeat... +.SH "GENERAL GUIDELINES" +.IX Header "GENERAL GUIDELINES" +The critical thing when considering performance is to remember there is no such +thing as a \f(CW\*(C`Golden Bullet\*(C'\fR, which is why there are no rules, only guidelines. +.PP +It is clear that inline code is going to be faster than subroutine or method +calls, because there is less overhead, but this approach has the disadvantage +of being less maintainable and comes at the cost of greater memory usage \- +there is no such thing as a free lunch. If you are searching for an element in +a list, it can be more efficient to store the data in a hash structure, and +then simply look to see whether the key is defined, rather than to loop through +the entire array using \fBgrep()\fR for instance. \fBsubstr()\fR may be (a lot) faster +than \fBgrep()\fR but not as flexible, so you have another trade-off to access. Your +code may contain a line which takes 0.01 of a second to execute which if you +call it 1,000 times, quite likely in a program parsing even medium sized files +for instance, you already have a 10 second delay, in just one single code +location, and if you call that line 100,000 times, your entire program will +slow down to an unbearable crawl. +.PP +Using a subroutine as part of your sort is a powerful way to get exactly what +you want, but will usually be slower than the built-in \fIalphabetic\fR \f(CW\*(C`cmp\*(C'\fR and +\&\fInumeric\fR \f(CW\*(C`<=>\*(C'\fR sort operators. It is possible to make multiple +passes over your data, building indices to make the upcoming sort more +efficient, and to use what is known as the \f(CW\*(C`OM\*(C'\fR (Orcish Maneuver) to cache the +sort keys in advance. The cache lookup, while a good idea, can itself be a +source of slowdown by enforcing a double pass over the data \- once to setup the +cache, and once to sort the data. Using \f(CW\*(C`pack()\*(C'\fR to extract the required sort +key into a consistent string can be an efficient way to build a single string +to compare, instead of using multiple sort keys, which makes it possible to use +the standard, written in \f(CW\*(C`c\*(C'\fR and fast, perl \f(CW\*(C`sort()\*(C'\fR function on the output, +and is the basis of the \f(CW\*(C`GRT\*(C'\fR (Guttman Rossler Transform). Some string +combinations can slow the \f(CW\*(C`GRT\*(C'\fR down, by just being too plain complex for its +own good. +.PP +For applications using database backends, the standard \f(CW\*(C`DBIx\*(C'\fR namespace has +tries to help with keeping things nippy, not least because it tries to \fInot\fR +query the database until the latest possible moment, but always read the docs +which come with your choice of libraries. Among the many issues facing +developers dealing with databases should remain aware of is to always use +\&\f(CW\*(C`SQL\*(C'\fR placeholders and to consider pre-fetching data sets when this might +prove advantageous. Splitting up a large file by assigning multiple processes +to parsing a single file, using say \f(CW\*(C`POE\*(C'\fR, \f(CW\*(C`threads\*(C'\fR or \f(CW\*(C`fork\*(C'\fR can also be a +useful way of optimizing your usage of the available \f(CW\*(C`CPU\*(C'\fR resources, though +this technique is fraught with concurrency issues and demands high attention to +detail. +.PP +Every case has a specific application and one or more exceptions, and there is +no replacement for running a few tests and finding out which method works best +for your particular environment, this is why writing optimal code is not an +exact science, and why we love using Perl so much \- \s-1TMTOWTDI.\s0 +.SH "BENCHMARKS" +.IX Header "BENCHMARKS" +Here are a few examples to demonstrate usage of Perl's benchmarking tools. +.SS "Assigning and Dereferencing Variables." +.IX Subsection "Assigning and Dereferencing Variables." +I'm sure most of us have seen code which looks like, (or worse than), this: +.PP +.Vb 2 +\& if ( $obj\->{_ref}\->{_myscore} >= $obj\->{_ref}\->{_yourscore} ) { +\& ... +.Ve +.PP +This sort of code can be a real eyesore to read, as well as being very +sensitive to typos, and it's much clearer to dereference the variable +explicitly. We're side-stepping the issue of working with object-oriented +programming techniques to encapsulate variable access via methods, only +accessible through an object. Here we're just discussing the technical +implementation of choice, and whether this has an effect on performance. We +can see whether this dereferencing operation, has any overhead by putting +comparative code in a file and running a \f(CW\*(C`Benchmark\*(C'\fR test. +.PP +# dereference +.PP +.Vb 1 +\& #!/usr/bin/perl +\& +\& use strict; +\& use warnings; +\& +\& use Benchmark; +\& +\& my $ref = { +\& \*(Aqref\*(Aq => { +\& _myscore => \*(Aq100 + 1\*(Aq, +\& _yourscore => \*(Aq102 \- 1\*(Aq, +\& }, +\& }; +\& +\& timethese(1000000, { +\& \*(Aqdirect\*(Aq => sub { +\& my $x = $ref\->{ref}\->{_myscore} . $ref\->{ref}\->{_yourscore} ; +\& }, +\& \*(Aqdereference\*(Aq => sub { +\& my $ref = $ref\->{ref}; +\& my $myscore = $ref\->{_myscore}; +\& my $yourscore = $ref\->{_yourscore}; +\& my $x = $myscore . $yourscore; +\& }, +\& }); +.Ve +.PP +It's essential to run any timing measurements a sufficient number of times so +the numbers settle on a numerical average, otherwise each run will naturally +fluctuate due to variations in the environment, to reduce the effect of +contention for \f(CW\*(C`CPU\*(C'\fR resources and network bandwidth for instance. Running +the above code for one million iterations, we can take a look at the report +output by the \f(CW\*(C`Benchmark\*(C'\fR module, to see which approach is the most effective. +.PP +.Vb 1 +\& $> perl dereference +\& +\& Benchmark: timing 1000000 iterations of dereference, direct... +\& dereference: 2 wallclock secs ( 1.59 usr + 0.00 sys = 1.59 CPU) @ 628930.82/s (n=1000000) +\& direct: 1 wallclock secs ( 1.20 usr + 0.00 sys = 1.20 CPU) @ 833333.33/s (n=1000000) +.Ve +.PP +The difference is clear to see and the dereferencing approach is slower. While +it managed to execute an average of 628,930 times a second during our test, the +direct approach managed to run an additional 204,403 times, unfortunately. +Unfortunately, because there are many examples of code written using the +multiple layer direct variable access, and it's usually horrible. It is, +however, minusculy faster. The question remains whether the minute gain is +actually worth the eyestrain, or the loss of maintainability. +.SS "Search and replace or tr" +.IX Subsection "Search and replace or tr" +If we have a string which needs to be modified, while a regex will almost +always be much more flexible, \f(CW\*(C`tr\*(C'\fR, an oft underused tool, can still be a +useful. One scenario might be replace all vowels with another character. The +regex solution might look like this: +.PP +.Vb 1 +\& $str =~ s/[aeiou]/x/g +.Ve +.PP +The \f(CW\*(C`tr\*(C'\fR alternative might look like this: +.PP +.Vb 1 +\& $str =~ tr/aeiou/xxxxx/ +.Ve +.PP +We can put that into a test file which we can run to check which approach is +the fastest, using a global \f(CW$STR\fR variable to assign to the \f(CW\*(C`my $str\*(C'\fR +variable so as to avoid perl trying to optimize any of the work away by +noticing it's assigned only the once. +.PP +# regex-transliterate +.PP +.Vb 1 +\& #!/usr/bin/perl +\& +\& use strict; +\& use warnings; +\& +\& use Benchmark; +\& +\& my $STR = "$$\-this and that"; +\& +\& timethese( 1000000, { +\& \*(Aqsr\*(Aq => sub { my $str = $STR; $str =~ s/[aeiou]/x/g; return $str; }, +\& \*(Aqtr\*(Aq => sub { my $str = $STR; $str =~ tr/aeiou/xxxxx/; return $str; }, +\& }); +.Ve +.PP +Running the code gives us our results: +.PP +.Vb 1 +\& $> perl regex\-transliterate +\& +\& Benchmark: timing 1000000 iterations of sr, tr... +\& sr: 2 wallclock secs ( 1.19 usr + 0.00 sys = 1.19 CPU) @ 840336.13/s (n=1000000) +\& tr: 0 wallclock secs ( 0.49 usr + 0.00 sys = 0.49 CPU) @ 2040816.33/s (n=1000000) +.Ve +.PP +The \f(CW\*(C`tr\*(C'\fR version is a clear winner. One solution is flexible, the other is +fast \- and it's appropriately the programmer's choice which to use. +.PP +Check the \f(CW\*(C`Benchmark\*(C'\fR docs for further useful techniques. +.SH "PROFILING TOOLS" +.IX Header "PROFILING TOOLS" +A slightly larger piece of code will provide something on which a profiler can +produce more extensive reporting statistics. This example uses the simplistic +\&\f(CW\*(C`wordmatch\*(C'\fR program which parses a given input file and spews out a short +report on the contents. +.PP +# wordmatch +.PP +.Vb 1 +\& #!/usr/bin/perl +\& +\& use strict; +\& use warnings; +\& +\& =head1 NAME +\& +\& filewords \- word analysis of input file +\& +\& =head1 SYNOPSIS +\& +\& filewords \-f inputfilename [\-d] +\& +\& =head1 DESCRIPTION +\& +\& This program parses the given filename, specified with C<\-f>, and +\& displays a simple analysis of the words found therein. Use the C<\-d> +\& switch to enable debugging messages. +\& +\& =cut +\& +\& use FileHandle; +\& use Getopt::Long; +\& +\& my $debug = 0; +\& my $file = \*(Aq\*(Aq; +\& +\& my $result = GetOptions ( +\& \*(Aqdebug\*(Aq => \e$debug, +\& \*(Aqfile=s\*(Aq => \e$file, +\& ); +\& die("invalid args") unless $result; +\& +\& unless ( \-f $file ) { +\& die("Usage: $0 \-f filename [\-d]"); +\& } +\& my $FH = FileHandle\->new("< $file") +\& or die("unable to open file($file): $!"); +\& +\& my $i_LINES = 0; +\& my $i_WORDS = 0; +\& my %count = (); +\& +\& my @lines = <$FH>; +\& foreach my $line ( @lines ) { +\& $i_LINES++; +\& $line =~ s/\en//; +\& my @words = split(/ +/, $line); +\& my $i_words = scalar(@words); +\& $i_WORDS = $i_WORDS + $i_words; +\& debug("line: $i_LINES supplying $i_words words: @words"); +\& my $i_word = 0; +\& foreach my $word ( @words ) { +\& $i_word++; +\& $count{$i_LINES}{spec} += matches($i_word, $word, +\& \*(Aq[^a\-zA\-Z0\-9]\*(Aq); +\& $count{$i_LINES}{only} += matches($i_word, $word, +\& \*(Aq^[^a\-zA\-Z0\-9]+$\*(Aq); +\& $count{$i_LINES}{cons} += matches($i_word, $word, +\& \*(Aq^[(?i:bcdfghjklmnpqrstvwxyz)]+$\*(Aq); +\& $count{$i_LINES}{vows} += matches($i_word, $word, +\& \*(Aq^[(?i:aeiou)]+$\*(Aq); +\& $count{$i_LINES}{caps} += matches($i_word, $word, +\& \*(Aq^[(A\-Z)]+$\*(Aq); +\& } +\& } +\& +\& print report( %count ); +\& +\& sub matches { +\& my $i_wd = shift; +\& my $word = shift; +\& my $regex = shift; +\& my $has = 0; +\& +\& if ( $word =~ /($regex)/ ) { +\& $has++ if $1; +\& } +\& +\& debug( "word: $i_wd " +\& . ($has ? \*(Aqmatches\*(Aq : \*(Aqdoes not match\*(Aq) +\& . " chars: /$regex/"); +\& +\& return $has; +\& } +\& +\& sub report { +\& my %report = @_; +\& my %rep; +\& +\& foreach my $line ( keys %report ) { +\& foreach my $key ( keys %{ $report{$line} } ) { +\& $rep{$key} += $report{$line}{$key}; +\& } +\& } +\& +\& my $report = qq| +\& $0 report for $file: +\& lines in file: $i_LINES +\& words in file: $i_WORDS +\& words with special (non\-word) characters: $i_spec +\& words with only special (non\-word) characters: $i_only +\& words with only consonants: $i_cons +\& words with only capital letters: $i_caps +\& words with only vowels: $i_vows +\& |; +\& +\& return $report; +\& } +\& +\& sub debug { +\& my $message = shift; +\& +\& if ( $debug ) { +\& print STDERR "DBG: $message\en"; +\& } +\& } +\& +\& exit 0; +.Ve +.SS "Devel::DProf" +.IX Subsection "Devel::DProf" +This venerable module has been the de-facto standard for Perl code profiling +for more than a decade, but has been replaced by a number of other modules +which have brought us back to the 21st century. Although you're recommended to +evaluate your tool from the several mentioned here and from the \s-1CPAN\s0 list at +the base of this document, (and currently Devel::NYTProf seems to be the +weapon of choice \- see below), we'll take a quick look at the output from +Devel::DProf first, to set a baseline for Perl profiling tools. Run the +above program under the control of \f(CW\*(C`Devel::DProf\*(C'\fR by using the \f(CW\*(C`\-d\*(C'\fR switch on +the command-line. +.PP +.Vb 1 +\& $> perl \-d:DProf wordmatch \-f perl5db.pl +\& +\& <...multiple lines snipped...> +\& +\& wordmatch report for perl5db.pl: +\& lines in file: 9428 +\& words in file: 50243 +\& words with special (non\-word) characters: 20480 +\& words with only special (non\-word) characters: 7790 +\& words with only consonants: 4801 +\& words with only capital letters: 1316 +\& words with only vowels: 1701 +.Ve +.PP +\&\f(CW\*(C`Devel::DProf\*(C'\fR produces a special file, called \fItmon.out\fR by default, and +this file is read by the \f(CW\*(C`dprofpp\*(C'\fR program, which is already installed as part +of the \f(CW\*(C`Devel::DProf\*(C'\fR distribution. If you call \f(CW\*(C`dprofpp\*(C'\fR with no options, +it will read the \fItmon.out\fR file in the current directory and produce a human +readable statistics report of the run of your program. Note that this may take +a little time. +.PP +.Vb 1 +\& $> dprofpp +\& +\& Total Elapsed Time = 2.951677 Seconds +\& User+System Time = 2.871677 Seconds +\& Exclusive Times +\& %Time ExclSec CumulS #Calls sec/call Csec/c Name +\& 102. 2.945 3.003 251215 0.0000 0.0000 main::matches +\& 2.40 0.069 0.069 260643 0.0000 0.0000 main::debug +\& 1.74 0.050 0.050 1 0.0500 0.0500 main::report +\& 1.04 0.030 0.049 4 0.0075 0.0123 main::BEGIN +\& 0.35 0.010 0.010 3 0.0033 0.0033 Exporter::as_heavy +\& 0.35 0.010 0.010 7 0.0014 0.0014 IO::File::BEGIN +\& 0.00 \- \-0.000 1 \- \- Getopt::Long::FindOption +\& 0.00 \- \-0.000 1 \- \- Symbol::BEGIN +\& 0.00 \- \-0.000 1 \- \- Fcntl::BEGIN +\& 0.00 \- \-0.000 1 \- \- Fcntl::bootstrap +\& 0.00 \- \-0.000 1 \- \- warnings::BEGIN +\& 0.00 \- \-0.000 1 \- \- IO::bootstrap +\& 0.00 \- \-0.000 1 \- \- Getopt::Long::ConfigDefaults +\& 0.00 \- \-0.000 1 \- \- Getopt::Long::Configure +\& 0.00 \- \-0.000 1 \- \- Symbol::gensym +.Ve +.PP +\&\f(CW\*(C`dprofpp\*(C'\fR will produce some quite detailed reporting on the activity of the +\&\f(CW\*(C`wordmatch\*(C'\fR program. The wallclock, user and system, times are at the top of +the analysis, and after this are the main columns defining which define the +report. Check the \f(CW\*(C`dprofpp\*(C'\fR docs for details of the many options it supports. +.PP +See also \f(CW\*(C`Apache::DProf\*(C'\fR which hooks \f(CW\*(C`Devel::DProf\*(C'\fR into \f(CW\*(C`mod_perl\*(C'\fR. +.SS "Devel::Profiler" +.IX Subsection "Devel::Profiler" +Let's take a look at the same program using a different profiler: +\&\f(CW\*(C`Devel::Profiler\*(C'\fR, a drop-in Perl-only replacement for \f(CW\*(C`Devel::DProf\*(C'\fR. The +usage is very slightly different in that instead of using the special \f(CW\*(C`\-d:\*(C'\fR +flag, you pull \f(CW\*(C`Devel::Profiler\*(C'\fR in directly as a module using \f(CW\*(C`\-M\*(C'\fR. +.PP +.Vb 1 +\& $> perl \-MDevel::Profiler wordmatch \-f perl5db.pl +\& +\& <...multiple lines snipped...> +\& +\& wordmatch report for perl5db.pl: +\& lines in file: 9428 +\& words in file: 50243 +\& words with special (non\-word) characters: 20480 +\& words with only special (non\-word) characters: 7790 +\& words with only consonants: 4801 +\& words with only capital letters: 1316 +\& words with only vowels: 1701 +.Ve +.PP +\&\f(CW\*(C`Devel::Profiler\*(C'\fR generates a tmon.out file which is compatible with the +\&\f(CW\*(C`dprofpp\*(C'\fR program, thus saving the construction of a dedicated statistics +reader program. \f(CW\*(C`dprofpp\*(C'\fR usage is therefore identical to the above example. +.PP +.Vb 1 +\& $> dprofpp +\& +\& Total Elapsed Time = 20.984 Seconds +\& User+System Time = 19.981 Seconds +\& Exclusive Times +\& %Time ExclSec CumulS #Calls sec/call Csec/c Name +\& 49.0 9.792 14.509 251215 0.0000 0.0001 main::matches +\& 24.4 4.887 4.887 260643 0.0000 0.0000 main::debug +\& 0.25 0.049 0.049 1 0.0490 0.0490 main::report +\& 0.00 0.000 0.000 1 0.0000 0.0000 Getopt::Long::GetOptions +\& 0.00 0.000 0.000 2 0.0000 0.0000 Getopt::Long::ParseOptionSpec +\& 0.00 0.000 0.000 1 0.0000 0.0000 Getopt::Long::FindOption +\& 0.00 0.000 0.000 1 0.0000 0.0000 IO::File::new +\& 0.00 0.000 0.000 1 0.0000 0.0000 IO::Handle::new +\& 0.00 0.000 0.000 1 0.0000 0.0000 Symbol::gensym +\& 0.00 0.000 0.000 1 0.0000 0.0000 IO::File::open +.Ve +.PP +Interestingly we get slightly different results, which is mostly because the +algorithm which generates the report is different, even though the output file +format was allegedly identical. The elapsed, user and system times are clearly +showing the time it took for \f(CW\*(C`Devel::Profiler\*(C'\fR to execute its own run, but +the column listings feel more accurate somehow than the ones we had earlier +from \f(CW\*(C`Devel::DProf\*(C'\fR. The 102% figure has disappeared, for example. This is +where we have to use the tools at our disposal, and recognise their pros and +cons, before using them. Interestingly, the numbers of calls for each +subroutine are identical in the two reports, it's the percentages which differ. +As the author of \f(CW\*(C`Devel::Proviler\*(C'\fR writes: +.PP +.Vb 6 +\& ...running HTML::Template\*(Aqs test suite under Devel::DProf shows +\& output() taking NO time but Devel::Profiler shows around 10% of the +\& time is in output(). I don\*(Aqt know which to trust but my gut tells me +\& something is wrong with Devel::DProf. HTML::Template::output() is a +\& big routine that\*(Aqs called for every test. Either way, something needs +\& fixing. +.Ve +.PP +\&\s-1YMMV.\s0 +.PP +See also \f(CW\*(C`Devel::Apache::Profiler\*(C'\fR which hooks \f(CW\*(C`Devel::Profiler\*(C'\fR +into \f(CW\*(C`mod_perl\*(C'\fR. +.SS "Devel::SmallProf" +.IX Subsection "Devel::SmallProf" +The \f(CW\*(C`Devel::SmallProf\*(C'\fR profiler examines the runtime of your Perl program and +produces a line-by-line listing to show how many times each line was called, +and how long each line took to execute. It is called by supplying the familiar +\&\f(CW\*(C`\-d\*(C'\fR flag to Perl at runtime. +.PP +.Vb 1 +\& $> perl \-d:SmallProf wordmatch \-f perl5db.pl +\& +\& <...multiple lines snipped...> +\& +\& wordmatch report for perl5db.pl: +\& lines in file: 9428 +\& words in file: 50243 +\& words with special (non\-word) characters: 20480 +\& words with only special (non\-word) characters: 7790 +\& words with only consonants: 4801 +\& words with only capital letters: 1316 +\& words with only vowels: 1701 +.Ve +.PP +\&\f(CW\*(C`Devel::SmallProf\*(C'\fR writes it's output into a file called \fIsmallprof.out\fR, by +default. The format of the file looks like this: +.PP +.Vb 1 +\& (12) +\& tail~ BRANCH (3) +\& 26 tsdy~ BRANCH (END) (9) +\& ~ attach to TAIL (25) offset to 16 +\& tsdy~ EXACT (EXACT) (4) +\& ~ STAR (END) (6) +\& ~ attach to TAIL (25) offset to 19 +\& tsdy~ EXACT (EXACT) (10) +\& ~ EXACT (EXACT) (12) +\& ~ ANYOF[Rr] (END) (14) +\& ~ attach to TAIL (25) offset to 11 +\& >(foo|bar)$< tail~ EXACT (1) +\& piec +\& atom +\& >foo|bar)$< reg +\& 28 brnc +\& piec +\& atom +\& >|bar)$< 31 tail~ OPEN1 (26) +\& >bar)$< brnc +\& 32 piec +\& atom +\& >)$< 34 tail~ BRANCH (28) +\& 36 tsdy~ BRANCH (END) (31) +\& ~ attach to CLOSE1 (34) offset to 3 +\& tsdy~ EXACT (EXACT) (29) +\& ~ attach to CLOSE1 (34) offset to 5 +\& tsdy~ EXACT (EXACT) (32) +\& ~ attach to CLOSE1 (34) offset to 2 +\& >$< tail~ BRANCH (3) +\& ~ BRANCH (9) +\& ~ TAIL (25) +\& piec +\& atom +\& >< 37 tail~ OPEN1 (26) +\& ~ BRANCH (28) +\& ~ BRANCH (31) +\& ~ CLOSE1 (34) +\& 38 tsdy~ EXACT (EXACT) (1) +\& ~ BRANCH (END) (3) +\& ~ BRANCH (END) (9) +\& ~ TAIL (END) (25) +\& ~ OPEN1 (END) (26) +\& ~ BRANCH (END) (28) +\& ~ BRANCH (END) (31) +\& ~ CLOSE1 (END) (34) +\& ~ EOL (END) (36) +\& ~ attach to END (37) offset to 1 +.Ve +.PP +Resulting in the program +.PP +.Vb 10 +\& 1: EXACT (3) +\& 3: BRANCH(9) +\& 4: EXACT (6) +\& 6: STAR(26) +\& 7: EXACT (0) +\& 9: BRANCH(25) +\& 10: EXACT (14) +\& 12: OPTIMIZED (2 nodes) +\& 14: ANYOF[Rr](26) +\& 25: TAIL(26) +\& 26: OPEN1(28) +\& 28: TRIE\-EXACT(34) +\& [StS:1 Wds:2 Cs:6 Uq:5 #Sts:7 Mn:3 Mx:3 Stcls:bf] +\& +\& +\& 30: OPTIMIZED (4 nodes) +\& 34: CLOSE1(36) +\& 36: EOL(37) +\& 37: END(0) +.Ve +.PP +Here we can see a much more complex program, with various optimisations in +play. At regnode 10 we see an example where a character class with only +one character in it was turned into an \f(CW\*(C`EXACT\*(C'\fR node. We can also see where +an entire alternation was turned into a \f(CW\*(C`TRIE\-EXACT\*(C'\fR node. As a consequence, +some of the regnodes have been marked as optimised away. We can see that +the \f(CW\*(C`$\*(C'\fR symbol has been converted into an \f(CW\*(C`EOL\*(C'\fR regop, a special piece of +code that looks for \f(CW\*(C`\en\*(C'\fR or the end of the string. +.PP +The next pointer for \f(CW\*(C`BRANCH\*(C'\fRes is interesting in that it points at where +execution should go if the branch fails. When executing, if the engine +tries to traverse from a branch to a \f(CW\*(C`regnext\*(C'\fR that isn't a branch then +the engine will know that the entire set of branches has failed. +.PP +\fIPeep-hole Optimisation and Analysis\fR +.IX Subsection "Peep-hole Optimisation and Analysis" +.PP +The regular expression engine can be a weighty tool to wield. On long +strings and complex patterns it can end up having to do a lot of work +to find a match, and even more to decide that no match is possible. +Consider a situation like the following pattern. +.PP +.Vb 1 +\& \*(Aqababababababababababab\*(Aq =~ /(a|b)*z/ +.Ve +.PP +The \f(CW\*(C`(a|b)*\*(C'\fR part can match at every char in the string, and then fail +every time because there is no \f(CW\*(C`z\*(C'\fR in the string. So obviously we can +avoid using the regex engine unless there is a \f(CW\*(C`z\*(C'\fR in the string. +Likewise in a pattern like: +.PP +.Vb 1 +\& /foo(\ew+)bar/ +.Ve +.PP +In this case we know that the string must contain a \f(CW\*(C`foo\*(C'\fR which must be +followed by \f(CW\*(C`bar\*(C'\fR. We can use Fast Boyer-Moore matching as implemented +in \f(CW\*(C`fbm_instr()\*(C'\fR to find the location of these strings. If they don't exist +then we don't need to resort to the much more expensive regex engine. +Even better, if they do exist then we can use their positions to +reduce the search space that the regex engine needs to cover to determine +if the entire pattern matches. +.PP +There are various aspects of the pattern that can be used to facilitate +optimisations along these lines: +.IP "\(bu" 5 +anchored fixed strings +.IP "\(bu" 5 +floating fixed strings +.IP "\(bu" 5 +minimum and maximum length requirements +.IP "\(bu" 5 +start class +.IP "\(bu" 5 +Beginning/End of line positions +.PP +Another form of optimisation that can occur is the post-parse \*(L"peep-hole\*(R" +optimisation, where inefficient constructs are replaced by more efficient +constructs. The \f(CW\*(C`TAIL\*(C'\fR regops which are used during parsing to mark the end +of branches and the end of groups are examples of this. These regops are used +as place-holders during construction and \*(L"always match\*(R" so they can be +\&\*(L"optimised away\*(R" by making the things that point to the \f(CW\*(C`TAIL\*(C'\fR point to the +thing that \f(CW\*(C`TAIL\*(C'\fR points to, thus \*(L"skipping\*(R" the node. +.PP +Another optimisation that can occur is that of "\f(CW\*(C`EXACT\*(C'\fR merging" which is +where two consecutive \f(CW\*(C`EXACT\*(C'\fR nodes are merged into a single +regop. An even more aggressive form of this is that a branch +sequence of the form \f(CW\*(C`EXACT BRANCH ... EXACT\*(C'\fR can be converted into a +\&\f(CW\*(C`TRIE\-EXACT\*(C'\fR regop. +.PP +All of this occurs in the routine \f(CW\*(C`study_chunk()\*(C'\fR which uses a special +structure \f(CW\*(C`scan_data_t\*(C'\fR to store the analysis that it has performed, and +does the \*(L"peep-hole\*(R" optimisations as it goes. +.PP +The code involved in \f(CW\*(C`study_chunk()\*(C'\fR is extremely cryptic. Be careful. :\-) +.SS "Execution" +.IX Subsection "Execution" +Execution of a regex generally involves two phases, the first being +finding the start point in the string where we should match from, +and the second being running the regop interpreter. +.PP +If we can tell that there is no valid start point then we don't bother running +the interpreter at all. Likewise, if we know from the analysis phase that we +cannot detect a short-cut to the start position, we go straight to the +interpreter. +.PP +The two entry points are \f(CW\*(C`re_intuit_start()\*(C'\fR and \f(CW\*(C`pregexec()\*(C'\fR. These routines +have a somewhat incestuous relationship with overlap between their functions, +and \f(CW\*(C`pregexec()\*(C'\fR may even call \f(CW\*(C`re_intuit_start()\*(C'\fR on its own. Nevertheless +other parts of the perl source code may call into either, or both. +.PP +Execution of the interpreter itself used to be recursive, but thanks to the +efforts of Dave Mitchell in the 5.9.x development track, that has changed: now an +internal stack is maintained on the heap and the routine is fully +iterative. This can make it tricky as the code is quite conservative +about what state it stores, with the result that two consecutive lines in the +code can actually be running in totally different contexts due to the +simulated recursion. +.PP +\fIStart position and no-match optimisations\fR +.IX Subsection "Start position and no-match optimisations" +.PP +\&\f(CW\*(C`re_intuit_start()\*(C'\fR is responsible for handling start points and no-match +optimisations as determined by the results of the analysis done by +\&\f(CW\*(C`study_chunk()\*(C'\fR (and described in \*(L"Peep-hole Optimisation and Analysis\*(R"). +.PP +The basic structure of this routine is to try to find the start\- and/or +end-points of where the pattern could match, and to ensure that the string +is long enough to match the pattern. It tries to use more efficient +methods over less efficient methods and may involve considerable +cross-checking of constraints to find the place in the string that matches. +For instance it may try to determine that a given fixed string must be +not only present but a certain number of chars before the end of the +string, or whatever. +.PP +It calls several other routines, such as \f(CW\*(C`fbm_instr()\*(C'\fR which does +Fast Boyer Moore matching and \f(CW\*(C`find_byclass()\*(C'\fR which is responsible for +finding the start using the first mandatory regop in the program. +.PP +When the optimisation criteria have been satisfied, \f(CW\*(C`reg_try()\*(C'\fR is called +to perform the match. +.PP +\fIProgram execution\fR +.IX Subsection "Program execution" +.PP +\&\f(CW\*(C`pregexec()\*(C'\fR is the main entry point for running a regex. It contains +support for initialising the regex interpreter's state, running +\&\f(CW\*(C`re_intuit_start()\*(C'\fR if needed, and running the interpreter on the string +from various start positions as needed. When it is necessary to use +the regex interpreter \f(CW\*(C`pregexec()\*(C'\fR calls \f(CW\*(C`regtry()\*(C'\fR. +.PP +\&\f(CW\*(C`regtry()\*(C'\fR is the entry point into the regex interpreter. It expects +as arguments a pointer to a \f(CW\*(C`regmatch_info\*(C'\fR structure and a pointer to +a string. It returns an integer 1 for success and a 0 for failure. +It is basically a set-up wrapper around \f(CW\*(C`regmatch()\*(C'\fR. +.PP +\&\f(CW\*(C`regmatch\*(C'\fR is the main \*(L"recursive loop\*(R" of the interpreter. It is +basically a giant switch statement that implements a state machine, where +the possible states are the regops themselves, plus a number of additional +intermediate and failure states. A few of the states are implemented as +subroutines but the bulk are inline code. +.SH "MISCELLANEOUS" +.IX Header "MISCELLANEOUS" +.SS "Unicode and Localisation Support" +.IX Subsection "Unicode and Localisation Support" +When dealing with strings containing characters that cannot be represented +using an eight-bit character set, perl uses an internal representation +that is a permissive version of Unicode's \s-1UTF\-8\s0 encoding[2]. This uses single +bytes to represent characters from the \s-1ASCII\s0 character set, and sequences +of two or more bytes for all other characters. (See perlunitut +for more information about the relationship between \s-1UTF\-8\s0 and perl's +encoding, utf8. The difference isn't important for this discussion.) +.PP +No matter how you look at it, Unicode support is going to be a pain in a +regex engine. Tricks that might be fine when you have 256 possible +characters often won't scale to handle the size of the \s-1UTF\-8\s0 character +set. Things you can take for granted with \s-1ASCII\s0 may not be true with +Unicode. For instance, in \s-1ASCII,\s0 it is safe to assume that +\&\f(CW\*(C`sizeof(char1) == sizeof(char2)\*(C'\fR, but in \s-1UTF\-8\s0 it isn't. Unicode case folding is +vastly more complex than the simple rules of \s-1ASCII,\s0 and even when not +using Unicode but only localised single byte encodings, things can get +tricky (for example, \fB\s-1LATIN SMALL LETTER SHARP S\s0\fR (U+00DF, \*8) +should match '\s-1SS\s0' in localised case-insensitive matching). +.PP +Making things worse is that \s-1UTF\-8\s0 support was a later addition to the +regex engine (as it was to perl) and this necessarily made things a lot +more complicated. Obviously it is easier to design a regex engine with +Unicode support in mind from the beginning than it is to retrofit it to +one that wasn't. +.PP +Nearly all regops that involve looking at the input string have +two cases, one for \s-1UTF\-8,\s0 and one not. In fact, it's often more complex +than that, as the pattern may be \s-1UTF\-8\s0 as well. +.PP +Care must be taken when making changes to make sure that you handle +\&\s-1UTF\-8\s0 properly, both at compile time and at execution time, including +when the string and pattern are mismatched. +.SS "Base Structures" +.IX Subsection "Base Structures" +The \f(CW\*(C`regexp\*(C'\fR structure described in perlreapi is common to all +regex engines. Two of its fields are intended for the private use +of the regex engine that compiled the pattern. These are the +\&\f(CW\*(C`intflags\*(C'\fR and pprivate members. The \f(CW\*(C`pprivate\*(C'\fR is a void pointer to +an arbitrary structure whose use and management is the responsibility +of the compiling engine. perl will never modify either of these +values. In the case of the stock engine the structure pointed to by +\&\f(CW\*(C`pprivate\*(C'\fR is called \f(CW\*(C`regexp_internal\*(C'\fR. +.PP +Its \f(CW\*(C`pprivate\*(C'\fR and \f(CW\*(C`intflags\*(C'\fR fields contain data +specific to each engine. +.PP +There are two structures used to store a compiled regular expression. +One, the \f(CW\*(C`regexp\*(C'\fR structure described in perlreapi is populated by +the engine currently being. used and some of its fields read by perl to +implement things such as the stringification of \f(CW\*(C`qr//\*(C'\fR. +.PP +The other structure is pointed to by the \f(CW\*(C`regexp\*(C'\fR struct's +\&\f(CW\*(C`pprivate\*(C'\fR and is in addition to \f(CW\*(C`intflags\*(C'\fR in the same struct +considered to be the property of the regex engine which compiled the +regular expression; +.PP +The regexp structure contains all the data that perl needs to be aware of +to properly work with the regular expression. It includes data about +optimisations that perl can use to determine if the regex engine should +really be used, and various other control info that is needed to properly +execute patterns in various contexts such as is the pattern anchored in +some way, or what flags were used during the compile, or whether the +program contains special constructs that perl needs to be aware of. +.PP +In addition it contains two fields that are intended for the private use +of the regex engine that compiled the pattern. These are the \f(CW\*(C`intflags\*(C'\fR +and pprivate members. The \f(CW\*(C`pprivate\*(C'\fR is a void pointer to an arbitrary +structure whose use and management is the responsibility of the compiling +engine. perl will never modify either of these values. +.PP +As mentioned earlier, in the case of the default engines, the \f(CW\*(C`pprivate\*(C'\fR +will be a pointer to a regexp_internal structure which holds the compiled +program and any additional data that is private to the regex engine +implementation. +.PP +\fIPerl's \f(CI\*(C`pprivate\*(C'\fI structure\fR +.IX Subsection "Perl's pprivate structure" +.PP +The following structure is used as the \f(CW\*(C`pprivate\*(C'\fR struct by perl's +regex engine. Since it is specific to perl it is only of curiosity +value to other engine implementations. +.PP +.Vb 10 +\& typedef struct regexp_internal { +\& U32 *offsets; /* offset annotations 20001228 MJD +\& * data about mapping the program to +\& * the string*/ +\& regnode *regstclass; /* Optional startclass as identified or +\& * constructed by the optimiser */ +\& struct reg_data *data; /* Additional miscellaneous data used +\& * by the program. Used to make it +\& * easier to clone and free arbitrary +\& * data that the regops need. Often the +\& * ARG field of a regop is an index +\& * into this structure */ +\& regnode program[1]; /* Unwarranted chumminess with +\& * compiler. */ +\& } regexp_internal; +.Ve +.ie n .IP """offsets""" 5 +.el .IP "\f(CWoffsets\fR" 5 +.IX Item "offsets" +Offsets holds a mapping of offset in the \f(CW\*(C`program\*(C'\fR +to offset in the \f(CW\*(C`precomp\*(C'\fR string. This is only used by ActiveState's +visual regex debugger. +.ie n .IP """regstclass""" 5 +.el .IP "\f(CWregstclass\fR" 5 +.IX Item "regstclass" +Special regop that is used by \f(CW\*(C`re_intuit_start()\*(C'\fR to check if a pattern +can match at a certain position. For instance if the regex engine knows +that the pattern must start with a 'Z' then it can scan the string until +it finds one and then launch the regex engine from there. The routine +that handles this is called \f(CW\*(C`find_by_class()\*(C'\fR. Sometimes this field +points at a regop embedded in the program, and sometimes it points at +an independent synthetic regop that has been constructed by the optimiser. +.ie n .IP """data""" 5 +.el .IP "\f(CWdata\fR" 5 +.IX Item "data" +This field points at a \f(CW\*(C`reg_data\*(C'\fR structure, which is defined as follows +.Sp +.Vb 5 +\& struct reg_data { +\& U32 count; +\& U8 *what; +\& void* data[1]; +\& }; +.Ve +.Sp +This structure is used for handling data structures that the regex engine +needs to handle specially during a clone or free operation on the compiled +product. Each element in the data array has a corresponding element in the +what array. During compilation regops that need special structures stored +will add an element to each array using the \fBadd_data()\fR routine and then store +the index in the regop. +.ie n .IP """program""" 5 +.el .IP "\f(CWprogram\fR" 5 +.IX Item "program" +Compiled program. Inlined into the structure so the entire struct can be +treated as a single blob. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perlreapi +.PP +perlre +.PP +perlunitut +.SH "AUTHOR" +.IX Header "AUTHOR" +by Yves Orton, 2006. +.PP +With excerpts from Perl, and contributions and suggestions from +Ronald J. Kimball, Dave Mitchell, Dominic Dunlop, Mark Jason Dominus, +Stephen McCamant, and David Landgren. +.PP +Now maintained by Perl 5 Porters. +.SH "LICENCE" +.IX Header "LICENCE" +Same terms as Perl. +.SH "REFERENCES" +.IX Header "REFERENCES" +[1] +.PP +[2] diff --git a/data/miniconda3/man/man1/perlretut.1 b/data/miniconda3/man/man1/perlretut.1 new file mode 100644 index 0000000000000000000000000000000000000000..f304439024b1b2090e29d4f37b35adf83978da16 --- /dev/null +++ b/data/miniconda3/man/man1/perlretut.1 @@ -0,0 +1,3293 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLRETUT 1" +.TH PERLRETUT 1 "2020-12-18" "perl v5.32.1" "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" +perlretut \- Perl regular expressions tutorial +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This page provides a basic tutorial on understanding, creating and +using regular expressions in Perl. It serves as a complement to the +reference page on regular expressions perlre. Regular expressions +are an integral part of the \f(CW\*(C`m//\*(C'\fR, \f(CW\*(C`s///\*(C'\fR, \f(CW\*(C`qr//\*(C'\fR and \f(CW\*(C`split\*(C'\fR +operators and so this tutorial also overlaps with +\&\*(L"Regexp Quote-Like Operators\*(R" in perlop and \*(L"split\*(R" in perlfunc. +.PP +Perl is widely renowned for excellence in text processing, and regular +expressions are one of the big factors behind this fame. Perl regular +expressions display an efficiency and flexibility unknown in most +other computer languages. Mastering even the basics of regular +expressions will allow you to manipulate text with surprising ease. +.PP +What is a regular expression? At its most basic, a regular expression +is a template that is used to determine if a string has certain +characteristics. The string is most often some text, such as a line, +sentence, web page, or even a whole book, but less commonly it could be +some binary data as well. +Suppose we want to determine if the text in variable, \f(CW$var\fR contains +the sequence of characters \f(CW\*(C`m\ u\ s\ h\ r\ o\ o\ m\*(C'\fR +(blanks added for legibility). We can write in Perl +.PP +.Vb 1 +\& $var =~ m/mushroom/ +.Ve +.PP +The value of this expression will be \s-1TRUE\s0 if \f(CW$var\fR contains that +sequence of characters, and \s-1FALSE\s0 otherwise. The portion enclosed in +\&\f(CW\*(Aq/\*(Aq\fR characters denotes the characteristic we are looking for. +We use the term \fIpattern\fR for it. The process of looking to see if the +pattern occurs in the string is called \fImatching\fR, and the \f(CW"=~"\fR +operator along with the \f(CW\*(C`m//\*(C'\fR tell Perl to try to match the pattern +against the string. Note that the pattern is also a string, but a very +special kind of one, as we will see. Patterns are in common use these +days; +examples are the patterns typed into a search engine to find web pages +and the patterns used to list files in a directory, \fIe.g.\fR, "\f(CW\*(C`ls *.txt\*(C'\fR\*(L" +or \*(R"\f(CW\*(C`dir *.*\*(C'\fR". In Perl, the patterns described by regular expressions +are used not only to search strings, but to also extract desired parts +of strings, and to do search and replace operations. +.PP +Regular expressions have the undeserved reputation of being abstract +and difficult to understand. This really stems simply because the +notation used to express them tends to be terse and dense, and not +because of inherent complexity. We recommend using the \f(CW\*(C`/x\*(C'\fR regular +expression modifier (described below) along with plenty of white space +to make them less dense, and easier to read. Regular expressions are +constructed using +simple concepts like conditionals and loops and are no more difficult +to understand than the corresponding \f(CW\*(C`if\*(C'\fR conditionals and \f(CW\*(C`while\*(C'\fR +loops in the Perl language itself. +.PP +This tutorial flattens the learning curve by discussing regular +expression concepts, along with their notation, one at a time and with +many examples. The first part of the tutorial will progress from the +simplest word searches to the basic regular expression concepts. If +you master the first part, you will have all the tools needed to solve +about 98% of your needs. The second part of the tutorial is for those +comfortable with the basics and hungry for more power tools. It +discusses the more advanced regular expression operators and +introduces the latest cutting-edge innovations. +.PP +A note: to save time, \*(L"regular expression\*(R" is often abbreviated as +regexp or regex. Regexp is a more natural abbreviation than regex, but +is harder to pronounce. The Perl pod documentation is evenly split on +regexp vs regex; in Perl, there is more than one way to abbreviate it. +We'll use regexp in this tutorial. +.PP +New in v5.22, \f(CW\*(C`use re \*(Aqstrict\*(Aq\*(C'\fR applies stricter +rules than otherwise when compiling regular expression patterns. It can +find things that, while legal, may not be what you intended. +.SH "Part 1: The basics" +.IX Header "Part 1: The basics" +.SS "Simple word matching" +.IX Subsection "Simple word matching" +The simplest regexp is simply a word, or more generally, a string of +characters. A regexp consisting of just a word matches any string that +contains that word: +.PP +.Vb 1 +\& "Hello World" =~ /World/; # matches +.Ve +.PP +What is this Perl statement all about? \f(CW"Hello World"\fR is a simple +double-quoted string. \f(CW\*(C`World\*(C'\fR is the regular expression and the +\&\f(CW\*(C`//\*(C'\fR enclosing \f(CW\*(C`/World/\*(C'\fR tells Perl to search a string for a match. +The operator \f(CW\*(C`=~\*(C'\fR associates the string with the regexp match and +produces a true value if the regexp matched, or false if the regexp +did not match. In our case, \f(CW\*(C`World\*(C'\fR matches the second word in +\&\f(CW"Hello World"\fR, so the expression is true. Expressions like this +are useful in conditionals: +.PP +.Vb 6 +\& if ("Hello World" =~ /World/) { +\& print "It matches\en"; +\& } +\& else { +\& print "It doesn\*(Aqt match\en"; +\& } +.Ve +.PP +There are useful variations on this theme. The sense of the match can +be reversed by using the \f(CW\*(C`!~\*(C'\fR operator: +.PP +.Vb 6 +\& if ("Hello World" !~ /World/) { +\& print "It doesn\*(Aqt match\en"; +\& } +\& else { +\& print "It matches\en"; +\& } +.Ve +.PP +The literal string in the regexp can be replaced by a variable: +.PP +.Vb 7 +\& my $greeting = "World"; +\& if ("Hello World" =~ /$greeting/) { +\& print "It matches\en"; +\& } +\& else { +\& print "It doesn\*(Aqt match\en"; +\& } +.Ve +.PP +If you're matching against the special default variable \f(CW$_\fR, the +\&\f(CW\*(C`$_ =~\*(C'\fR part can be omitted: +.PP +.Vb 7 +\& $_ = "Hello World"; +\& if (/World/) { +\& print "It matches\en"; +\& } +\& else { +\& print "It doesn\*(Aqt match\en"; +\& } +.Ve +.PP +And finally, the \f(CW\*(C`//\*(C'\fR default delimiters for a match can be changed +to arbitrary delimiters by putting an \f(CW\*(Aqm\*(Aq\fR out front: +.PP +.Vb 4 +\& "Hello World" =~ m!World!; # matches, delimited by \*(Aq!\*(Aq +\& "Hello World" =~ m{World}; # matches, note the matching \*(Aq{}\*(Aq +\& "/usr/bin/perl" =~ m"/perl"; # matches after \*(Aq/usr/bin\*(Aq, +\& # \*(Aq/\*(Aq becomes an ordinary char +.Ve +.PP +\&\f(CW\*(C`/World/\*(C'\fR, \f(CW\*(C`m!World!\*(C'\fR, and \f(CW\*(C`m{World}\*(C'\fR all represent the +same thing. When, \fIe.g.\fR, the quote (\f(CW\*(Aq"\*(Aq\fR) is used as a delimiter, the forward +slash \f(CW\*(Aq/\*(Aq\fR becomes an ordinary character and can be used in this regexp +without trouble. +.PP +Let's consider how different regexps would match \f(CW"Hello World"\fR: +.PP +.Vb 4 +\& "Hello World" =~ /world/; # doesn\*(Aqt match +\& "Hello World" =~ /o W/; # matches +\& "Hello World" =~ /oW/; # doesn\*(Aqt match +\& "Hello World" =~ /World /; # doesn\*(Aqt match +.Ve +.PP +The first regexp \f(CW\*(C`world\*(C'\fR doesn't match because regexps are +case-sensitive. The second regexp matches because the substring +\&\f(CW\*(Aqo\ W\*(Aq\fR occurs in the string \f(CW"Hello\ World"\fR. The space +character \f(CW\*(Aq \*(Aq\fR is treated like any other character in a regexp and is +needed to match in this case. The lack of a space character is the +reason the third regexp \f(CW\*(AqoW\*(Aq\fR doesn't match. The fourth regexp +"\f(CW\*(C`World \*(C'\fR" doesn't match because there is a space at the end of the +regexp, but not at the end of the string. The lesson here is that +regexps must match a part of the string \fIexactly\fR in order for the +statement to be true. +.PP +If a regexp matches in more than one place in the string, Perl will +always match at the earliest possible point in the string: +.PP +.Vb 2 +\& "Hello World" =~ /o/; # matches \*(Aqo\*(Aq in \*(AqHello\*(Aq +\& "That hat is red" =~ /hat/; # matches \*(Aqhat\*(Aq in \*(AqThat\*(Aq +.Ve +.PP +With respect to character matching, there are a few more points you +need to know about. First of all, not all characters can be used \*(L"as +is\*(R" in a match. Some characters, called \fImetacharacters\fR, are +generally reserved for use in regexp notation. The metacharacters are +.PP +.Vb 1 +\& {}[]()^$.|*+?\-#\e +.Ve +.PP +This list is not as definitive as it may appear (or be claimed to be in +other documentation). For example, \f(CW"#"\fR is a metacharacter only when +the \f(CW\*(C`/x\*(C'\fR pattern modifier (described below) is used, and both \f(CW"}"\fR +and \f(CW"]"\fR are metacharacters only when paired with opening \f(CW"{"\fR or +\&\f(CW"["\fR respectively; other gotchas apply. +.PP +The significance of each of these will be explained +in the rest of the tutorial, but for now, it is important only to know +that a metacharacter can be matched as-is by putting a backslash before +it: +.PP +.Vb 5 +\& "2+2=4" =~ /2+2/; # doesn\*(Aqt match, + is a metacharacter +\& "2+2=4" =~ /2\e+2/; # matches, \e+ is treated like an ordinary + +\& "The interval is [0,1)." =~ /[0,1)./ # is a syntax error! +\& "The interval is [0,1)." =~ /\e[0,1\e)\e./ # matches +\& "#!/usr/bin/perl" =~ /#!\e/usr\e/bin\e/perl/; # matches +.Ve +.PP +In the last regexp, the forward slash \f(CW\*(Aq/\*(Aq\fR is also backslashed, +because it is used to delimit the regexp. This can lead to \s-1LTS\s0 +(leaning toothpick syndrome), however, and it is often more readable +to change delimiters. +.PP +.Vb 1 +\& "#!/usr/bin/perl" =~ m!#\e!/usr/bin/perl!; # easier to read +.Ve +.PP +The backslash character \f(CW\*(Aq\e\*(Aq\fR is a metacharacter itself and needs to +be backslashed: +.PP +.Vb 1 +\& \*(AqC:\eWIN32\*(Aq =~ /C:\e\eWIN/; # matches +.Ve +.PP +In situations where it doesn't make sense for a particular metacharacter +to mean what it normally does, it automatically loses its +metacharacter-ness and becomes an ordinary character that is to be +matched literally. For example, the \f(CW\*(Aq}\*(Aq\fR is a metacharacter only when +it is the mate of a \f(CW\*(Aq{\*(Aq\fR metacharacter. Otherwise it is treated as a +literal \s-1RIGHT CURLY BRACKET.\s0 This may lead to unexpected results. +\&\f(CW\*(C`use re \*(Aqstrict\*(Aq\*(C'\fR can catch some of these. +.PP +In addition to the metacharacters, there are some \s-1ASCII\s0 characters +which don't have printable character equivalents and are instead +represented by \fIescape sequences\fR. Common examples are \f(CW\*(C`\et\*(C'\fR for a +tab, \f(CW\*(C`\en\*(C'\fR for a newline, \f(CW\*(C`\er\*(C'\fR for a carriage return and \f(CW\*(C`\ea\*(C'\fR for a +bell (or alert). If your string is better thought of as a sequence of arbitrary +bytes, the octal escape sequence, \fIe.g.\fR, \f(CW\*(C`\e033\*(C'\fR, or hexadecimal escape +sequence, \fIe.g.\fR, \f(CW\*(C`\ex1B\*(C'\fR may be a more natural representation for your +bytes. Here are some examples of escapes: +.PP +.Vb 5 +\& "1000\et2000" =~ m(0\et2) # matches +\& "1000\en2000" =~ /0\en20/ # matches +\& "1000\et2000" =~ /\e000\et2/ # doesn\*(Aqt match, "0" ne "\e000" +\& "cat" =~ /\eo{143}\ex61\ex74/ # matches in ASCII, but a weird way +\& # to spell cat +.Ve +.PP +If you've been around Perl a while, all this talk of escape sequences +may seem familiar. Similar escape sequences are used in double-quoted +strings and in fact the regexps in Perl are mostly treated as +double-quoted strings. This means that variables can be used in +regexps as well. Just like double-quoted strings, the values of the +variables in the regexp will be substituted in before the regexp is +evaluated for matching purposes. So we have: +.PP +.Vb 4 +\& $foo = \*(Aqhouse\*(Aq; +\& \*(Aqhousecat\*(Aq =~ /$foo/; # matches +\& \*(Aqcathouse\*(Aq =~ /cat$foo/; # matches +\& \*(Aqhousecat\*(Aq =~ /${foo}cat/; # matches +.Ve +.PP +So far, so good. With the knowledge above you can already perform +searches with just about any literal string regexp you can dream up. +Here is a \fIvery simple\fR emulation of the Unix grep program: +.PP +.Vb 7 +\& % cat > simple_grep +\& #!/usr/bin/perl +\& $regexp = shift; +\& while (<>) { +\& print if /$regexp/; +\& } +\& ^D +\& +\& % chmod +x simple_grep +\& +\& % simple_grep abba /usr/dict/words +\& Babbage +\& cabbage +\& cabbages +\& sabbath +\& Sabbathize +\& Sabbathizes +\& sabbatical +\& scabbard +\& scabbards +.Ve +.PP +This program is easy to understand. \f(CW\*(C`#!/usr/bin/perl\*(C'\fR is the standard +way to invoke a perl program from the shell. +\&\f(CW\*(C`$regexp\ =\ shift;\*(C'\fR saves the first command line argument as the +regexp to be used, leaving the rest of the command line arguments to +be treated as files. \f(CW\*(C`while\ (<>)\*(C'\fR loops over all the lines in +all the files. For each line, \f(CW\*(C`print\ if\ /$regexp/;\*(C'\fR prints the +line if the regexp matches the line. In this line, both \f(CW\*(C`print\*(C'\fR and +\&\f(CW\*(C`/$regexp/\*(C'\fR use the default variable \f(CW$_\fR implicitly. +.PP +With all of the regexps above, if the regexp matched anywhere in the +string, it was considered a match. Sometimes, however, we'd like to +specify \fIwhere\fR in the string the regexp should try to match. To do +this, we would use the \fIanchor\fR metacharacters \f(CW\*(Aq^\*(Aq\fR and \f(CW\*(Aq$\*(Aq\fR. The +anchor \f(CW\*(Aq^\*(Aq\fR means match at the beginning of the string and the anchor +\&\f(CW\*(Aq$\*(Aq\fR means match at the end of the string, or before a newline at the +end of the string. Here is how they are used: +.PP +.Vb 4 +\& "housekeeper" =~ /keeper/; # matches +\& "housekeeper" =~ /^keeper/; # doesn\*(Aqt match +\& "housekeeper" =~ /keeper$/; # matches +\& "housekeeper\en" =~ /keeper$/; # matches +.Ve +.PP +The second regexp doesn't match because \f(CW\*(Aq^\*(Aq\fR constrains \f(CW\*(C`keeper\*(C'\fR to +match only at the beginning of the string, but \f(CW"housekeeper"\fR has +keeper starting in the middle. The third regexp does match, since the +\&\f(CW\*(Aq$\*(Aq\fR constrains \f(CW\*(C`keeper\*(C'\fR to match only at the end of the string. +.PP +When both \f(CW\*(Aq^\*(Aq\fR and \f(CW\*(Aq$\*(Aq\fR are used at the same time, the regexp has to +match both the beginning and the end of the string, \fIi.e.\fR, the regexp +matches the whole string. Consider +.PP +.Vb 3 +\& "keeper" =~ /^keep$/; # doesn\*(Aqt match +\& "keeper" =~ /^keeper$/; # matches +\& "" =~ /^$/; # ^$ matches an empty string +.Ve +.PP +The first regexp doesn't match because the string has more to it than +\&\f(CW\*(C`keep\*(C'\fR. Since the second regexp is exactly the string, it +matches. Using both \f(CW\*(Aq^\*(Aq\fR and \f(CW\*(Aq$\*(Aq\fR in a regexp forces the complete +string to match, so it gives you complete control over which strings +match and which don't. Suppose you are looking for a fellow named +bert, off in a string by himself: +.PP +.Vb 1 +\& "dogbert" =~ /bert/; # matches, but not what you want +\& +\& "dilbert" =~ /^bert/; # doesn\*(Aqt match, but .. +\& "bertram" =~ /^bert/; # matches, so still not good enough +\& +\& "bertram" =~ /^bert$/; # doesn\*(Aqt match, good +\& "dilbert" =~ /^bert$/; # doesn\*(Aqt match, good +\& "bert" =~ /^bert$/; # matches, perfect +.Ve +.PP +Of course, in the case of a literal string, one could just as easily +use the string comparison \f(CW\*(C`$string\ eq\ \*(Aqbert\*(Aq\*(C'\fR and it would be +more efficient. The \f(CW\*(C`^...$\*(C'\fR regexp really becomes useful when we +add in the more powerful regexp tools below. +.SS "Using character classes" +.IX Subsection "Using character classes" +Although one can already do quite a lot with the literal string +regexps above, we've only scratched the surface of regular expression +technology. In this and subsequent sections we will introduce regexp +concepts (and associated metacharacter notations) that will allow a +regexp to represent not just a single character sequence, but a \fIwhole +class\fR of them. +.PP +One such concept is that of a \fIcharacter class\fR. A character class +allows a set of possible characters, rather than just a single +character, to match at a particular point in a regexp. You can define +your own custom character classes. These +are denoted by brackets \f(CW\*(C`[...]\*(C'\fR, with the set of characters +to be possibly matched inside. Here are some examples: +.PP +.Vb 4 +\& /cat/; # matches \*(Aqcat\*(Aq +\& /[bcr]at/; # matches \*(Aqbat, \*(Aqcat\*(Aq, or \*(Aqrat\*(Aq +\& /item[0123456789]/; # matches \*(Aqitem0\*(Aq or ... or \*(Aqitem9\*(Aq +\& "abc" =~ /[cab]/; # matches \*(Aqa\*(Aq +.Ve +.PP +In the last statement, even though \f(CW\*(Aqc\*(Aq\fR is the first character in +the class, \f(CW\*(Aqa\*(Aq\fR matches because the first character position in the +string is the earliest point at which the regexp can match. +.PP +.Vb 2 +\& /[yY][eE][sS]/; # match \*(Aqyes\*(Aq in a case\-insensitive way +\& # \*(Aqyes\*(Aq, \*(AqYes\*(Aq, \*(AqYES\*(Aq, etc. +.Ve +.PP +This regexp displays a common task: perform a case-insensitive +match. Perl provides a way of avoiding all those brackets by simply +appending an \f(CW\*(Aqi\*(Aq\fR to the end of the match. Then \f(CW\*(C`/[yY][eE][sS]/;\*(C'\fR +can be rewritten as \f(CW\*(C`/yes/i;\*(C'\fR. The \f(CW\*(Aqi\*(Aq\fR stands for +case-insensitive and is an example of a \fImodifier\fR of the matching +operation. We will meet other modifiers later in the tutorial. +.PP +We saw in the section above that there were ordinary characters, which +represented themselves, and special characters, which needed a +backslash \f(CW\*(Aq\e\*(Aq\fR to represent themselves. The same is true in a +character class, but the sets of ordinary and special characters +inside a character class are different than those outside a character +class. The special characters for a character class are \f(CW\*(C`\-]\e^$\*(C'\fR (and +the pattern delimiter, whatever it is). +\&\f(CW\*(Aq]\*(Aq\fR is special because it denotes the end of a character class. \f(CW\*(Aq$\*(Aq\fR is +special because it denotes a scalar variable. \f(CW\*(Aq\e\*(Aq\fR is special because +it is used in escape sequences, just like above. Here is how the +special characters \f(CW\*(C`]$\e\*(C'\fR are handled: +.PP +.Vb 5 +\& /[\e]c]def/; # matches \*(Aq]def\*(Aq or \*(Aqcdef\*(Aq +\& $x = \*(Aqbcr\*(Aq; +\& /[$x]at/; # matches \*(Aqbat\*(Aq, \*(Aqcat\*(Aq, or \*(Aqrat\*(Aq +\& /[\e$x]at/; # matches \*(Aq$at\*(Aq or \*(Aqxat\*(Aq +\& /[\e\e$x]at/; # matches \*(Aq\eat\*(Aq, \*(Aqbat, \*(Aqcat\*(Aq, or \*(Aqrat\*(Aq +.Ve +.PP +The last two are a little tricky. In \f(CW\*(C`[\e$x]\*(C'\fR, the backslash protects +the dollar sign, so the character class has two members \f(CW\*(Aq$\*(Aq\fR and \f(CW\*(Aqx\*(Aq\fR. +In \f(CW\*(C`[\e\e$x]\*(C'\fR, the backslash is protected, so \f(CW$x\fR is treated as a +variable and substituted in double quote fashion. +.PP +The special character \f(CW\*(Aq\-\*(Aq\fR acts as a range operator within character +classes, so that a contiguous set of characters can be written as a +range. With ranges, the unwieldy \f(CW\*(C`[0123456789]\*(C'\fR and \f(CW\*(C`[abc...xyz]\*(C'\fR +become the svelte \f(CW\*(C`[0\-9]\*(C'\fR and \f(CW\*(C`[a\-z]\*(C'\fR. Some examples are +.PP +.Vb 6 +\& /item[0\-9]/; # matches \*(Aqitem0\*(Aq or ... or \*(Aqitem9\*(Aq +\& /[0\-9bx\-z]aa/; # matches \*(Aq0aa\*(Aq, ..., \*(Aq9aa\*(Aq, +\& # \*(Aqbaa\*(Aq, \*(Aqxaa\*(Aq, \*(Aqyaa\*(Aq, or \*(Aqzaa\*(Aq +\& /[0\-9a\-fA\-F]/; # matches a hexadecimal digit +\& /[0\-9a\-zA\-Z_]/; # matches a "word" character, +\& # like those in a Perl variable name +.Ve +.PP +If \f(CW\*(Aq\-\*(Aq\fR is the first or last character in a character class, it is +treated as an ordinary character; \f(CW\*(C`[\-ab]\*(C'\fR, \f(CW\*(C`[ab\-]\*(C'\fR and \f(CW\*(C`[a\e\-b]\*(C'\fR are +all equivalent. +.PP +The special character \f(CW\*(Aq^\*(Aq\fR in the first position of a character class +denotes a \fInegated character class\fR, which matches any character but +those in the brackets. Both \f(CW\*(C`[...]\*(C'\fR and \f(CW\*(C`[^...]\*(C'\fR must match a +character, or the match fails. Then +.PP +.Vb 4 +\& /[^a]at/; # doesn\*(Aqt match \*(Aqaat\*(Aq or \*(Aqat\*(Aq, but matches +\& # all other \*(Aqbat\*(Aq, \*(Aqcat, \*(Aq0at\*(Aq, \*(Aq%at\*(Aq, etc. +\& /[^0\-9]/; # matches a non\-numeric character +\& /[a^]at/; # matches \*(Aqaat\*(Aq or \*(Aq^at\*(Aq; here \*(Aq^\*(Aq is ordinary +.Ve +.PP +Now, even \f(CW\*(C`[0\-9]\*(C'\fR can be a bother to write multiple times, so in the +interest of saving keystrokes and making regexps more readable, Perl +has several abbreviations for common character classes, as shown below. +Since the introduction of Unicode, unless the \f(CW\*(C`/a\*(C'\fR modifier is in +effect, these character classes match more than just a few characters in +the \s-1ASCII\s0 range. +.IP "\(bu" 4 +\&\f(CW\*(C`\ed\*(C'\fR matches a digit, not just \f(CW\*(C`[0\-9]\*(C'\fR but also digits from non-roman scripts +.IP "\(bu" 4 +\&\f(CW\*(C`\es\*(C'\fR matches a whitespace character, the set \f(CW\*(C`[\e \et\er\en\ef]\*(C'\fR and others +.IP "\(bu" 4 +\&\f(CW\*(C`\ew\*(C'\fR matches a word character (alphanumeric or \f(CW\*(Aq_\*(Aq\fR), not just \f(CW\*(C`[0\-9a\-zA\-Z_]\*(C'\fR +but also digits and characters from non-roman scripts +.IP "\(bu" 4 +\&\f(CW\*(C`\eD\*(C'\fR is a negated \f(CW\*(C`\ed\*(C'\fR; it represents any other character than a digit, or \f(CW\*(C`[^\ed]\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`\eS\*(C'\fR is a negated \f(CW\*(C`\es\*(C'\fR; it represents any non-whitespace character \f(CW\*(C`[^\es]\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`\eW\*(C'\fR is a negated \f(CW\*(C`\ew\*(C'\fR; it represents any non-word character \f(CW\*(C`[^\ew]\*(C'\fR +.IP "\(bu" 4 +The period \f(CW\*(Aq.\*(Aq\fR matches any character but \f(CW"\en"\fR (unless the modifier \f(CW\*(C`/s\*(C'\fR is +in effect, as explained below). +.IP "\(bu" 4 +\&\f(CW\*(C`\eN\*(C'\fR, like the period, matches any character but \f(CW"\en"\fR, but it does so +regardless of whether the modifier \f(CW\*(C`/s\*(C'\fR is in effect. +.PP +The \f(CW\*(C`/a\*(C'\fR modifier, available starting in Perl 5.14, is used to +restrict the matches of \f(CW\*(C`\ed\*(C'\fR, \f(CW\*(C`\es\*(C'\fR, and \f(CW\*(C`\ew\*(C'\fR to just those in the \s-1ASCII\s0 range. +It is useful to keep your program from being needlessly exposed to full +Unicode (and its accompanying security considerations) when all you want +is to process English-like text. (The \*(L"a\*(R" may be doubled, \f(CW\*(C`/aa\*(C'\fR, to +provide even more restrictions, preventing case-insensitive matching of +\&\s-1ASCII\s0 with non-ASCII characters; otherwise a Unicode \*(L"Kelvin Sign\*(R" +would caselessly match a \*(L"k\*(R" or \*(L"K\*(R".) +.PP +The \f(CW\*(C`\ed\es\ew\eD\eS\eW\*(C'\fR abbreviations can be used both inside and outside +of bracketed character classes. Here are some in use: +.PP +.Vb 7 +\& /\ed\ed:\ed\ed:\ed\ed/; # matches a hh:mm:ss time format +\& /[\ed\es]/; # matches any digit or whitespace character +\& /\ew\eW\ew/; # matches a word char, followed by a +\& # non\-word char, followed by a word char +\& /..rt/; # matches any two chars, followed by \*(Aqrt\*(Aq +\& /end\e./; # matches \*(Aqend.\*(Aq +\& /end[.]/; # same thing, matches \*(Aqend.\*(Aq +.Ve +.PP +Because a period is a metacharacter, it needs to be escaped to match +as an ordinary period. Because, for example, \f(CW\*(C`\ed\*(C'\fR and \f(CW\*(C`\ew\*(C'\fR are sets +of characters, it is incorrect to think of \f(CW\*(C`[^\ed\ew]\*(C'\fR as \f(CW\*(C`[\eD\eW]\*(C'\fR; in +fact \f(CW\*(C`[^\ed\ew]\*(C'\fR is the same as \f(CW\*(C`[^\ew]\*(C'\fR, which is the same as +\&\f(CW\*(C`[\eW]\*(C'\fR. Think DeMorgan's laws. +.PP +In actuality, the period and \f(CW\*(C`\ed\es\ew\eD\eS\eW\*(C'\fR abbreviations are +themselves types of character classes, so the ones surrounded by +brackets are just one type of character class. When we need to make a +distinction, we refer to them as \*(L"bracketed character classes.\*(R" +.PP +An anchor useful in basic regexps is the \fIword anchor\fR +\&\f(CW\*(C`\eb\*(C'\fR. This matches a boundary between a word character and a non-word +character \f(CW\*(C`\ew\eW\*(C'\fR or \f(CW\*(C`\eW\ew\*(C'\fR: +.PP +.Vb 5 +\& $x = "Housecat catenates house and cat"; +\& $x =~ /cat/; # matches cat in \*(Aqhousecat\*(Aq +\& $x =~ /\ebcat/; # matches cat in \*(Aqcatenates\*(Aq +\& $x =~ /cat\eb/; # matches cat in \*(Aqhousecat\*(Aq +\& $x =~ /\ebcat\eb/; # matches \*(Aqcat\*(Aq at end of string +.Ve +.PP +Note in the last example, the end of the string is considered a word +boundary. +.PP +For natural language processing (so that, for example, apostrophes are +included in words), use instead \f(CW\*(C`\eb{wb}\*(C'\fR +.PP +.Vb 1 +\& "don\*(Aqt" =~ / .+? \eb{wb} /x; # matches the whole string +.Ve +.PP +You might wonder why \f(CW\*(Aq.\*(Aq\fR matches everything but \f(CW"\en"\fR \- why not +every character? The reason is that often one is matching against +lines and would like to ignore the newline characters. For instance, +while the string \f(CW"\en"\fR represents one line, we would like to think +of it as empty. Then +.PP +.Vb 2 +\& "" =~ /^$/; # matches +\& "\en" =~ /^$/; # matches, $ anchors before "\en" +\& +\& "" =~ /./; # doesn\*(Aqt match; it needs a char +\& "" =~ /^.$/; # doesn\*(Aqt match; it needs a char +\& "\en" =~ /^.$/; # doesn\*(Aqt match; it needs a char other than "\en" +\& "a" =~ /^.$/; # matches +\& "a\en" =~ /^.$/; # matches, $ anchors before "\en" +.Ve +.PP +This behavior is convenient, because we usually want to ignore +newlines when we count and match characters in a line. Sometimes, +however, we want to keep track of newlines. We might even want \f(CW\*(Aq^\*(Aq\fR +and \f(CW\*(Aq$\*(Aq\fR to anchor at the beginning and end of lines within the +string, rather than just the beginning and end of the string. Perl +allows us to choose between ignoring and paying attention to newlines +by using the \f(CW\*(C`/s\*(C'\fR and \f(CW\*(C`/m\*(C'\fR modifiers. \f(CW\*(C`/s\*(C'\fR and \f(CW\*(C`/m\*(C'\fR stand for +single line and multi-line and they determine whether a string is to +be treated as one continuous string, or as a set of lines. The two +modifiers affect two aspects of how the regexp is interpreted: 1) how +the \f(CW\*(Aq.\*(Aq\fR character class is defined, and 2) where the anchors \f(CW\*(Aq^\*(Aq\fR +and \f(CW\*(Aq$\*(Aq\fR are able to match. Here are the four possible combinations: +.IP "\(bu" 4 +no modifiers: Default behavior. \f(CW\*(Aq.\*(Aq\fR matches any character +except \f(CW"\en"\fR. \f(CW\*(Aq^\*(Aq\fR matches only at the beginning of the string and +\&\f(CW\*(Aq$\*(Aq\fR matches only at the end or before a newline at the end. +.IP "\(bu" 4 +s modifier (\f(CW\*(C`/s\*(C'\fR): Treat string as a single long line. \f(CW\*(Aq.\*(Aq\fR matches +any character, even \f(CW"\en"\fR. \f(CW\*(Aq^\*(Aq\fR matches only at the beginning of +the string and \f(CW\*(Aq$\*(Aq\fR matches only at the end or before a newline at the +end. +.IP "\(bu" 4 +m modifier (\f(CW\*(C`/m\*(C'\fR): Treat string as a set of multiple lines. \f(CW\*(Aq.\*(Aq\fR +matches any character except \f(CW"\en"\fR. \f(CW\*(Aq^\*(Aq\fR and \f(CW\*(Aq$\*(Aq\fR are able to match +at the start or end of \fIany\fR line within the string. +.IP "\(bu" 4 +both s and m modifiers (\f(CW\*(C`/sm\*(C'\fR): Treat string as a single long line, but +detect multiple lines. \f(CW\*(Aq.\*(Aq\fR matches any character, even +\&\f(CW"\en"\fR. \f(CW\*(Aq^\*(Aq\fR and \f(CW\*(Aq$\*(Aq\fR, however, are able to match at the start or end +of \fIany\fR line within the string. +.PP +Here are examples of \f(CW\*(C`/s\*(C'\fR and \f(CW\*(C`/m\*(C'\fR in action: +.PP +.Vb 1 +\& $x = "There once was a girl\enWho programmed in Perl\en"; +\& +\& $x =~ /^Who/; # doesn\*(Aqt match, "Who" not at start of string +\& $x =~ /^Who/s; # doesn\*(Aqt match, "Who" not at start of string +\& $x =~ /^Who/m; # matches, "Who" at start of second line +\& $x =~ /^Who/sm; # matches, "Who" at start of second line +\& +\& $x =~ /girl.Who/; # doesn\*(Aqt match, "." doesn\*(Aqt match "\en" +\& $x =~ /girl.Who/s; # matches, "." matches "\en" +\& $x =~ /girl.Who/m; # doesn\*(Aqt match, "." doesn\*(Aqt match "\en" +\& $x =~ /girl.Who/sm; # matches, "." matches "\en" +.Ve +.PP +Most of the time, the default behavior is what is wanted, but \f(CW\*(C`/s\*(C'\fR and +\&\f(CW\*(C`/m\*(C'\fR are occasionally very useful. If \f(CW\*(C`/m\*(C'\fR is being used, the start +of the string can still be matched with \f(CW\*(C`\eA\*(C'\fR and the end of the string +can still be matched with the anchors \f(CW\*(C`\eZ\*(C'\fR (matches both the end and +the newline before, like \f(CW\*(Aq$\*(Aq\fR), and \f(CW\*(C`\ez\*(C'\fR (matches only the end): +.PP +.Vb 2 +\& $x =~ /^Who/m; # matches, "Who" at start of second line +\& $x =~ /\eAWho/m; # doesn\*(Aqt match, "Who" is not at start of string +\& +\& $x =~ /girl$/m; # matches, "girl" at end of first line +\& $x =~ /girl\eZ/m; # doesn\*(Aqt match, "girl" is not at end of string +\& +\& $x =~ /Perl\eZ/m; # matches, "Perl" is at newline before end +\& $x =~ /Perl\ez/m; # doesn\*(Aqt match, "Perl" is not at end of string +.Ve +.PP +We now know how to create choices among classes of characters in a +regexp. What about choices among words or character strings? Such +choices are described in the next section. +.SS "Matching this or that" +.IX Subsection "Matching this or that" +Sometimes we would like our regexp to be able to match different +possible words or character strings. This is accomplished by using +the \fIalternation\fR metacharacter \f(CW\*(Aq|\*(Aq\fR. To match \f(CW\*(C`dog\*(C'\fR or \f(CW\*(C`cat\*(C'\fR, we +form the regexp \f(CW\*(C`dog|cat\*(C'\fR. As before, Perl will try to match the +regexp at the earliest possible point in the string. At each +character position, Perl will first try to match the first +alternative, \f(CW\*(C`dog\*(C'\fR. If \f(CW\*(C`dog\*(C'\fR doesn't match, Perl will then try the +next alternative, \f(CW\*(C`cat\*(C'\fR. If \f(CW\*(C`cat\*(C'\fR doesn't match either, then the +match fails and Perl moves to the next position in the string. Some +examples: +.PP +.Vb 2 +\& "cats and dogs" =~ /cat|dog|bird/; # matches "cat" +\& "cats and dogs" =~ /dog|cat|bird/; # matches "cat" +.Ve +.PP +Even though \f(CW\*(C`dog\*(C'\fR is the first alternative in the second regexp, +\&\f(CW\*(C`cat\*(C'\fR is able to match earlier in the string. +.PP +.Vb 2 +\& "cats" =~ /c|ca|cat|cats/; # matches "c" +\& "cats" =~ /cats|cat|ca|c/; # matches "cats" +.Ve +.PP +Here, all the alternatives match at the first string position, so the +first alternative is the one that matches. If some of the +alternatives are truncations of the others, put the longest ones first +to give them a chance to match. +.PP +.Vb 2 +\& "cab" =~ /a|b|c/ # matches "c" +\& # /a|b|c/ == /[abc]/ +.Ve +.PP +The last example points out that character classes are like +alternations of characters. At a given character position, the first +alternative that allows the regexp match to succeed will be the one +that matches. +.SS "Grouping things and hierarchical matching" +.IX Subsection "Grouping things and hierarchical matching" +Alternation allows a regexp to choose among alternatives, but by +itself it is unsatisfying. The reason is that each alternative is a whole +regexp, but sometime we want alternatives for just part of a +regexp. For instance, suppose we want to search for housecats or +housekeepers. The regexp \f(CW\*(C`housecat|housekeeper\*(C'\fR fits the bill, but is +inefficient because we had to type \f(CW\*(C`house\*(C'\fR twice. It would be nice to +have parts of the regexp be constant, like \f(CW\*(C`house\*(C'\fR, and some +parts have alternatives, like \f(CW\*(C`cat|keeper\*(C'\fR. +.PP +The \fIgrouping\fR metacharacters \f(CW\*(C`()\*(C'\fR solve this problem. Grouping +allows parts of a regexp to be treated as a single unit. Parts of a +regexp are grouped by enclosing them in parentheses. Thus we could solve +the \f(CW\*(C`housecat|housekeeper\*(C'\fR by forming the regexp as +\&\f(CW\*(C`house(cat|keeper)\*(C'\fR. The regexp \f(CW\*(C`house(cat|keeper)\*(C'\fR means match +\&\f(CW\*(C`house\*(C'\fR followed by either \f(CW\*(C`cat\*(C'\fR or \f(CW\*(C`keeper\*(C'\fR. Some more examples +are +.PP +.Vb 4 +\& /(a|b)b/; # matches \*(Aqab\*(Aq or \*(Aqbb\*(Aq +\& /(ac|b)b/; # matches \*(Aqacb\*(Aq or \*(Aqbb\*(Aq +\& /(^a|b)c/; # matches \*(Aqac\*(Aq at start of string or \*(Aqbc\*(Aq anywhere +\& /(a|[bc])d/; # matches \*(Aqad\*(Aq, \*(Aqbd\*(Aq, or \*(Aqcd\*(Aq +\& +\& /house(cat|)/; # matches either \*(Aqhousecat\*(Aq or \*(Aqhouse\*(Aq +\& /house(cat(s|)|)/; # matches either \*(Aqhousecats\*(Aq or \*(Aqhousecat\*(Aq or +\& # \*(Aqhouse\*(Aq. Note groups can be nested. +\& +\& /(19|20|)\ed\ed/; # match years 19xx, 20xx, or the Y2K problem, xx +\& "20" =~ /(19|20|)\ed\ed/; # matches the null alternative \*(Aq()\ed\ed\*(Aq, +\& # because \*(Aq20\ed\ed\*(Aq can\*(Aqt match +.Ve +.PP +Alternations behave the same way in groups as out of them: at a given +string position, the leftmost alternative that allows the regexp to +match is taken. So in the last example at the first string position, +\&\f(CW"20"\fR matches the second alternative, but there is nothing left over +to match the next two digits \f(CW\*(C`\ed\ed\*(C'\fR. So Perl moves on to the next +alternative, which is the null alternative and that works, since +\&\f(CW"20"\fR is two digits. +.PP +The process of trying one alternative, seeing if it matches, and +moving on to the next alternative, while going back in the string +from where the previous alternative was tried, if it doesn't, is called +\&\fIbacktracking\fR. The term \*(L"backtracking\*(R" comes from the idea that +matching a regexp is like a walk in the woods. Successfully matching +a regexp is like arriving at a destination. There are many possible +trailheads, one for each string position, and each one is tried in +order, left to right. From each trailhead there may be many paths, +some of which get you there, and some which are dead ends. When you +walk along a trail and hit a dead end, you have to backtrack along the +trail to an earlier point to try another trail. If you hit your +destination, you stop immediately and forget about trying all the +other trails. You are persistent, and only if you have tried all the +trails from all the trailheads and not arrived at your destination, do +you declare failure. To be concrete, here is a step-by-step analysis +of what Perl does when it tries to match the regexp +.PP +.Vb 1 +\& "abcde" =~ /(abd|abc)(df|d|de)/; +.Ve +.ie n .IP "0. Start with the first letter in the string \*(Aqa\*(Aq." 4 +.el .IP "0. Start with the first letter in the string \f(CW\*(Aqa\*(Aq\fR." 4 +.IX Item "0. Start with the first letter in the string a." +\&\ +.ie n .IP "1. Try the first alternative in the first group \*(Aqabd\*(Aq." 4 +.el .IP "1. Try the first alternative in the first group \f(CW\*(Aqabd\*(Aq\fR." 4 +.IX Item "1. Try the first alternative in the first group abd." +\&\ +.ie n .IP "2. Match \*(Aqa\*(Aq followed by \*(Aqb\*(Aq. So far so good." 4 +.el .IP "2. Match \f(CW\*(Aqa\*(Aq\fR followed by \f(CW\*(Aqb\*(Aq\fR. So far so good." 4 +.IX Item "2. Match a followed by b. So far so good." +\&\ +.ie n .IP "3. \*(Aqd\*(Aq in the regexp doesn't match \*(Aqc\*(Aq in the string \- a dead end. So backtrack two characters and pick the second alternative in the first group \*(Aqabc\*(Aq." 4 +.el .IP "3. \f(CW\*(Aqd\*(Aq\fR in the regexp doesn't match \f(CW\*(Aqc\*(Aq\fR in the string \- a dead end. So backtrack two characters and pick the second alternative in the first group \f(CW\*(Aqabc\*(Aq\fR." 4 +.IX Item "3. d in the regexp doesn't match c in the string - a dead end. So backtrack two characters and pick the second alternative in the first group abc." +\&\ +.ie n .IP "4. Match \*(Aqa\*(Aq followed by \*(Aqb\*(Aq followed by \*(Aqc\*(Aq. We are on a roll and have satisfied the first group. Set $1 to \*(Aqabc\*(Aq." 4 +.el .IP "4. Match \f(CW\*(Aqa\*(Aq\fR followed by \f(CW\*(Aqb\*(Aq\fR followed by \f(CW\*(Aqc\*(Aq\fR. We are on a roll and have satisfied the first group. Set \f(CW$1\fR to \f(CW\*(Aqabc\*(Aq\fR." 4 +.IX Item "4. Match a followed by b followed by c. We are on a roll and have satisfied the first group. Set $1 to abc." +\&\ +.ie n .IP "5 Move on to the second group and pick the first alternative \*(Aqdf\*(Aq." 4 +.el .IP "5 Move on to the second group and pick the first alternative \f(CW\*(Aqdf\*(Aq\fR." 4 +.IX Item "5 Move on to the second group and pick the first alternative df." +\&\ +.ie n .IP "6 Match the \*(Aqd\*(Aq." 4 +.el .IP "6 Match the \f(CW\*(Aqd\*(Aq\fR." 4 +.IX Item "6 Match the d." +\&\ +.ie n .IP "7. \*(Aqf\*(Aq in the regexp doesn't match \*(Aqe\*(Aq in the string, so a dead end. Backtrack one character and pick the second alternative in the second group \*(Aqd\*(Aq." 4 +.el .IP "7. \f(CW\*(Aqf\*(Aq\fR in the regexp doesn't match \f(CW\*(Aqe\*(Aq\fR in the string, so a dead end. Backtrack one character and pick the second alternative in the second group \f(CW\*(Aqd\*(Aq\fR." 4 +.IX Item "7. f in the regexp doesn't match e in the string, so a dead end. Backtrack one character and pick the second alternative in the second group d." +\&\ +.ie n .IP "8. \*(Aqd\*(Aq matches. The second grouping is satisfied, so set $2 to \*(Aqd\*(Aq." 4 +.el .IP "8. \f(CW\*(Aqd\*(Aq\fR matches. The second grouping is satisfied, so set \f(CW$2\fR to \f(CW\*(Aqd\*(Aq\fR." 4 +.IX Item "8. d matches. The second grouping is satisfied, so set $2 to d." +\&\ +.ie n .IP "9. We are at the end of the regexp, so we are done! We have matched \*(Aqabcd\*(Aq out of the string ""abcde""." 4 +.el .IP "9. We are at the end of the regexp, so we are done! We have matched \f(CW\*(Aqabcd\*(Aq\fR out of the string \f(CW``abcde''\fR." 4 +.IX Item "9. We are at the end of the regexp, so we are done! We have matched abcd out of the string ""abcde""." +.PP +There are a couple of things to note about this analysis. First, the +third alternative in the second group \f(CW\*(Aqde\*(Aq\fR also allows a match, but we +stopped before we got to it \- at a given character position, leftmost +wins. Second, we were able to get a match at the first character +position of the string \f(CW\*(Aqa\*(Aq\fR. If there were no matches at the first +position, Perl would move to the second character position \f(CW\*(Aqb\*(Aq\fR and +attempt the match all over again. Only when all possible paths at all +possible character positions have been exhausted does Perl give +up and declare \f(CW\*(C`$string\ =~\ /(abd|abc)(df|d|de)/;\*(C'\fR to be false. +.PP +Even with all this work, regexp matching happens remarkably fast. To +speed things up, Perl compiles the regexp into a compact sequence of +opcodes that can often fit inside a processor cache. When the code is +executed, these opcodes can then run at full throttle and search very +quickly. +.SS "Extracting matches" +.IX Subsection "Extracting matches" +The grouping metacharacters \f(CW\*(C`()\*(C'\fR also serve another completely +different function: they allow the extraction of the parts of a string +that matched. This is very useful to find out what matched and for +text processing in general. For each grouping, the part that matched +inside goes into the special variables \f(CW$1\fR, \f(CW$2\fR, \fIetc\fR. They can be +used just as ordinary variables: +.PP +.Vb 6 +\& # extract hours, minutes, seconds +\& if ($time =~ /(\ed\ed):(\ed\ed):(\ed\ed)/) { # match hh:mm:ss format +\& $hours = $1; +\& $minutes = $2; +\& $seconds = $3; +\& } +.Ve +.PP +Now, we know that in scalar context, +\&\f(CW\*(C`$time\ =~\ /(\ed\ed):(\ed\ed):(\ed\ed)/\*(C'\fR returns a true or false +value. In list context, however, it returns the list of matched values +\&\f(CW\*(C`($1,$2,$3)\*(C'\fR. So we could write the code more compactly as +.PP +.Vb 2 +\& # extract hours, minutes, seconds +\& ($hours, $minutes, $second) = ($time =~ /(\ed\ed):(\ed\ed):(\ed\ed)/); +.Ve +.PP +If the groupings in a regexp are nested, \f(CW$1\fR gets the group with the +leftmost opening parenthesis, \f(CW$2\fR the next opening parenthesis, +\&\fIetc\fR. Here is a regexp with nested groups: +.PP +.Vb 2 +\& /(ab(cd|ef)((gi)|j))/; +\& 1 2 34 +.Ve +.PP +If this regexp matches, \f(CW$1\fR contains a string starting with +\&\f(CW\*(Aqab\*(Aq\fR, \f(CW$2\fR is either set to \f(CW\*(Aqcd\*(Aq\fR or \f(CW\*(Aqef\*(Aq\fR, \f(CW$3\fR equals either +\&\f(CW\*(Aqgi\*(Aq\fR or \f(CW\*(Aqj\*(Aq\fR, and \f(CW$4\fR is either set to \f(CW\*(Aqgi\*(Aq\fR, just like \f(CW$3\fR, +or it remains undefined. +.PP +For convenience, Perl sets \f(CW$+\fR to the string held by the highest numbered +\&\f(CW$1\fR, \f(CW$2\fR,... that got assigned (and, somewhat related, \f(CW$^N\fR to the +value of the \f(CW$1\fR, \f(CW$2\fR,... most-recently assigned; \fIi.e.\fR the \f(CW$1\fR, +\&\f(CW$2\fR,... associated with the rightmost closing parenthesis used in the +match). +.SS "Backreferences" +.IX Subsection "Backreferences" +Closely associated with the matching variables \f(CW$1\fR, \f(CW$2\fR, ... are +the \fIbackreferences\fR \f(CW\*(C`\eg1\*(C'\fR, \f(CW\*(C`\eg2\*(C'\fR,... Backreferences are simply +matching variables that can be used \fIinside\fR a regexp. This is a +really nice feature; what matches later in a regexp is made to depend on +what matched earlier in the regexp. Suppose we wanted to look +for doubled words in a text, like \*(L"the the\*(R". The following regexp finds +all 3\-letter doubles with a space in between: +.PP +.Vb 1 +\& /\eb(\ew\ew\ew)\es\eg1\eb/; +.Ve +.PP +The grouping assigns a value to \f(CW\*(C`\eg1\*(C'\fR, so that the same 3\-letter sequence +is used for both parts. +.PP +A similar task is to find words consisting of two identical parts: +.PP +.Vb 7 +\& % simple_grep \*(Aq^(\ew\ew\ew\ew|\ew\ew\ew|\ew\ew|\ew)\eg1$\*(Aq /usr/dict/words +\& beriberi +\& booboo +\& coco +\& mama +\& murmur +\& papa +.Ve +.PP +The regexp has a single grouping which considers 4\-letter +combinations, then 3\-letter combinations, \fIetc\fR., and uses \f(CW\*(C`\eg1\*(C'\fR to look for +a repeat. Although \f(CW$1\fR and \f(CW\*(C`\eg1\*(C'\fR represent the same thing, care should be +taken to use matched variables \f(CW$1\fR, \f(CW$2\fR,... only \fIoutside\fR a regexp +and backreferences \f(CW\*(C`\eg1\*(C'\fR, \f(CW\*(C`\eg2\*(C'\fR,... only \fIinside\fR a regexp; not doing +so may lead to surprising and unsatisfactory results. +.SS "Relative backreferences" +.IX Subsection "Relative backreferences" +Counting the opening parentheses to get the correct number for a +backreference is error-prone as soon as there is more than one +capturing group. A more convenient technique became available +with Perl 5.10: relative backreferences. To refer to the immediately +preceding capture group one now may write \f(CW\*(C`\eg{\-1}\*(C'\fR, the next but +last is available via \f(CW\*(C`\eg{\-2}\*(C'\fR, and so on. +.PP +Another good reason in addition to readability and maintainability +for using relative backreferences is illustrated by the following example, +where a simple pattern for matching peculiar strings is used: +.PP +.Vb 1 +\& $a99a = \*(Aq([a\-z])(\ed)\eg2\eg1\*(Aq; # matches a11a, g22g, x33x, etc. +.Ve +.PP +Now that we have this pattern stored as a handy string, we might feel +tempted to use it as a part of some other pattern: +.PP +.Vb 6 +\& $line = "code=e99e"; +\& if ($line =~ /^(\ew+)=$a99a$/){ # unexpected behavior! +\& print "$1 is valid\en"; +\& } else { +\& print "bad line: \*(Aq$line\*(Aq\en"; +\& } +.Ve +.PP +But this doesn't match, at least not the way one might expect. Only +after inserting the interpolated \f(CW$a99a\fR and looking at the resulting +full text of the regexp is it obvious that the backreferences have +backfired. The subexpression \f(CW\*(C`(\ew+)\*(C'\fR has snatched number 1 and +demoted the groups in \f(CW$a99a\fR by one rank. This can be avoided by +using relative backreferences: +.PP +.Vb 1 +\& $a99a = \*(Aq([a\-z])(\ed)\eg{\-1}\eg{\-2}\*(Aq; # safe for being interpolated +.Ve +.SS "Named backreferences" +.IX Subsection "Named backreferences" +Perl 5.10 also introduced named capture groups and named backreferences. +To attach a name to a capturing group, you write either +\&\f(CW\*(C`(?...)\*(C'\fR or \f(CW\*(C`(?\*(Aqname\*(Aq...)\*(C'\fR. The backreference may +then be written as \f(CW\*(C`\eg{name}\*(C'\fR. It is permissible to attach the +same name to more than one group, but then only the leftmost one of the +eponymous set can be referenced. Outside of the pattern a named +capture group is accessible through the \f(CW\*(C`%+\*(C'\fR hash. +.PP +Assuming that we have to match calendar dates which may be given in one +of the three formats yyyy-mm-dd, mm/dd/yyyy or dd.mm.yyyy, we can write +three suitable patterns where we use \f(CW\*(Aqd\*(Aq\fR, \f(CW\*(Aqm\*(Aq\fR and \f(CW\*(Aqy\*(Aq\fR respectively as the +names of the groups capturing the pertaining components of a date. The +matching operation combines the three patterns as alternatives: +.PP +.Vb 8 +\& $fmt1 = \*(Aq(?\ed\ed\ed\ed)\-(?\ed\ed)\-(?\ed\ed)\*(Aq; +\& $fmt2 = \*(Aq(?\ed\ed)/(?\ed\ed)/(?\ed\ed\ed\ed)\*(Aq; +\& $fmt3 = \*(Aq(?\ed\ed)\e.(?\ed\ed)\e.(?\ed\ed\ed\ed)\*(Aq; +\& for my $d (qw(2006\-10\-21 15.01.2007 10/31/2005)) { +\& if ( $d =~ m{$fmt1|$fmt2|$fmt3} ){ +\& print "day=$+{d} month=$+{m} year=$+{y}\en"; +\& } +\& } +.Ve +.PP +If any of the alternatives matches, the hash \f(CW\*(C`%+\*(C'\fR is bound to contain the +three key-value pairs. +.SS "Alternative capture group numbering" +.IX Subsection "Alternative capture group numbering" +Yet another capturing group numbering technique (also as from Perl 5.10) +deals with the problem of referring to groups within a set of alternatives. +Consider a pattern for matching a time of the day, civil or military style: +.PP +.Vb 3 +\& if ( $time =~ /(\ed\ed|\ed):(\ed\ed)|(\ed\ed)(\ed\ed)/ ){ +\& # process hour and minute +\& } +.Ve +.PP +Processing the results requires an additional if statement to determine +whether \f(CW$1\fR and \f(CW$2\fR or \f(CW$3\fR and \f(CW$4\fR contain the goodies. It would +be easier if we could use group numbers 1 and 2 in second alternative as +well, and this is exactly what the parenthesized construct \f(CW\*(C`(?|...)\*(C'\fR, +set around an alternative achieves. Here is an extended version of the +previous pattern: +.PP +.Vb 3 +\& if($time =~ /(?|(\ed\ed|\ed):(\ed\ed)|(\ed\ed)(\ed\ed))\es+([A\-Z][A\-Z][A\-Z])/){ +\& print "hour=$1 minute=$2 zone=$3\en"; +\& } +.Ve +.PP +Within the alternative numbering group, group numbers start at the same +position for each alternative. After the group, numbering continues +with one higher than the maximum reached across all the alternatives. +.SS "Position information" +.IX Subsection "Position information" +In addition to what was matched, Perl also provides the +positions of what was matched as contents of the \f(CW\*(C`@\-\*(C'\fR and \f(CW\*(C`@+\*(C'\fR +arrays. \f(CW\*(C`$\-[0]\*(C'\fR is the position of the start of the entire match and +\&\f(CW$+[0]\fR is the position of the end. Similarly, \f(CW\*(C`$\-[n]\*(C'\fR is the +position of the start of the \f(CW$n\fR match and \f(CW$+[n]\fR is the position +of the end. If \f(CW$n\fR is undefined, so are \f(CW\*(C`$\-[n]\*(C'\fR and \f(CW$+[n]\fR. Then +this code +.PP +.Vb 5 +\& $x = "Mmm...donut, thought Homer"; +\& $x =~ /^(Mmm|Yech)\e.\e.\e.(donut|peas)/; # matches +\& foreach $exp (1..$#\-) { +\& print "Match $exp: \*(Aq${$exp}\*(Aq at position ($\-[$exp],$+[$exp])\en"; +\& } +.Ve +.PP +prints +.PP +.Vb 2 +\& Match 1: \*(AqMmm\*(Aq at position (0,3) +\& Match 2: \*(Aqdonut\*(Aq at position (6,11) +.Ve +.PP +Even if there are no groupings in a regexp, it is still possible to +find out what exactly matched in a string. If you use them, Perl +will set \f(CW\*(C`$\`\*(C'\fR to the part of the string before the match, will set \f(CW$&\fR +to the part of the string that matched, and will set \f(CW\*(C`$\*(Aq\*(C'\fR to the part +of the string after the match. An example: +.PP +.Vb 3 +\& $x = "the cat caught the mouse"; +\& $x =~ /cat/; # $\` = \*(Aqthe \*(Aq, $& = \*(Aqcat\*(Aq, $\*(Aq = \*(Aq caught the mouse\*(Aq +\& $x =~ /the/; # $\` = \*(Aq\*(Aq, $& = \*(Aqthe\*(Aq, $\*(Aq = \*(Aq cat caught the mouse\*(Aq +.Ve +.PP +In the second match, \f(CW\*(C`$\`\*(C'\fR equals \f(CW\*(Aq\*(Aq\fR because the regexp matched at the +first character position in the string and stopped; it never saw the +second \*(L"the\*(R". +.PP +If your code is to run on Perl versions earlier than +5.20, it is worthwhile to note that using \f(CW\*(C`$\`\*(C'\fR and \f(CW\*(C`$\*(Aq\*(C'\fR +slows down regexp matching quite a bit, while \f(CW$&\fR slows it down to a +lesser extent, because if they are used in one regexp in a program, +they are generated for \fIall\fR regexps in the program. So if raw +performance is a goal of your application, they should be avoided. +If you need to extract the corresponding substrings, use \f(CW\*(C`@\-\*(C'\fR and +\&\f(CW\*(C`@+\*(C'\fR instead: +.PP +.Vb 3 +\& $\` is the same as substr( $x, 0, $\-[0] ) +\& $& is the same as substr( $x, $\-[0], $+[0]\-$\-[0] ) +\& $\*(Aq is the same as substr( $x, $+[0] ) +.Ve +.PP +As of Perl 5.10, the \f(CW\*(C`${^PREMATCH}\*(C'\fR, \f(CW\*(C`${^MATCH}\*(C'\fR and \f(CW\*(C`${^POSTMATCH}\*(C'\fR +variables may be used. These are only set if the \f(CW\*(C`/p\*(C'\fR modifier is +present. Consequently they do not penalize the rest of the program. In +Perl 5.20, \f(CW\*(C`${^PREMATCH}\*(C'\fR, \f(CW\*(C`${^MATCH}\*(C'\fR and \f(CW\*(C`${^POSTMATCH}\*(C'\fR are available +whether the \f(CW\*(C`/p\*(C'\fR has been used or not (the modifier is ignored), and +\&\f(CW\*(C`$\`\*(C'\fR, \f(CW\*(C`$\*(Aq\*(C'\fR and \f(CW$&\fR do not cause any speed difference. +.SS "Non-capturing groupings" +.IX Subsection "Non-capturing groupings" +A group that is required to bundle a set of alternatives may or may not be +useful as a capturing group. If it isn't, it just creates a superfluous +addition to the set of available capture group values, inside as well as +outside the regexp. Non-capturing groupings, denoted by \f(CW\*(C`(?:regexp)\*(C'\fR, +still allow the regexp to be treated as a single unit, but don't establish +a capturing group at the same time. Both capturing and non-capturing +groupings are allowed to co-exist in the same regexp. Because there is +no extraction, non-capturing groupings are faster than capturing +groupings. Non-capturing groupings are also handy for choosing exactly +which parts of a regexp are to be extracted to matching variables: +.PP +.Vb 2 +\& # match a number, $1\-$4 are set, but we only want $1 +\& /([+\-]?\e *(\ed+(\e.\ed*)?|\e.\ed+)([eE][+\-]?\ed+)?)/; +\& +\& # match a number faster , only $1 is set +\& /([+\-]?\e *(?:\ed+(?:\e.\ed*)?|\e.\ed+)(?:[eE][+\-]?\ed+)?)/; +\& +\& # match a number, get $1 = whole number, $2 = exponent +\& /([+\-]?\e *(?:\ed+(?:\e.\ed*)?|\e.\ed+)(?:[eE]([+\-]?\ed+))?)/; +.Ve +.PP +Non-capturing groupings are also useful for removing nuisance +elements gathered from a split operation where parentheses are +required for some reason: +.PP +.Vb 3 +\& $x = \*(Aq12aba34ba5\*(Aq; +\& @num = split /(a|b)+/, $x; # @num = (\*(Aq12\*(Aq,\*(Aqa\*(Aq,\*(Aq34\*(Aq,\*(Aqa\*(Aq,\*(Aq5\*(Aq) +\& @num = split /(?:a|b)+/, $x; # @num = (\*(Aq12\*(Aq,\*(Aq34\*(Aq,\*(Aq5\*(Aq) +.Ve +.PP +In Perl 5.22 and later, all groups within a regexp can be set to +non-capturing by using the new \f(CW\*(C`/n\*(C'\fR flag: +.PP +.Vb 1 +\& "hello" =~ /(hi|hello)/n; # $1 is not set! +.Ve +.PP +See \*(L"n\*(R" in perlre for more information. +.SS "Matching repetitions" +.IX Subsection "Matching repetitions" +The examples in the previous section display an annoying weakness. We +were only matching 3\-letter words, or chunks of words of 4 letters or +less. We'd like to be able to match words or, more generally, strings +of any length, without writing out tedious alternatives like +\&\f(CW\*(C`\ew\ew\ew\ew|\ew\ew\ew|\ew\ew|\ew\*(C'\fR. +.PP +This is exactly the problem the \fIquantifier\fR metacharacters \f(CW\*(Aq?\*(Aq\fR, +\&\f(CW\*(Aq*\*(Aq\fR, \f(CW\*(Aq+\*(Aq\fR, and \f(CW\*(C`{}\*(C'\fR were created for. They allow us to delimit the +number of repeats for a portion of a regexp we consider to be a +match. Quantifiers are put immediately after the character, character +class, or grouping that we want to specify. They have the following +meanings: +.IP "\(bu" 4 +\&\f(CW\*(C`a?\*(C'\fR means: match \f(CW\*(Aqa\*(Aq\fR 1 or 0 times +.IP "\(bu" 4 +\&\f(CW\*(C`a*\*(C'\fR means: match \f(CW\*(Aqa\*(Aq\fR 0 or more times, \fIi.e.\fR, any number of times +.IP "\(bu" 4 +\&\f(CW\*(C`a+\*(C'\fR means: match \f(CW\*(Aqa\*(Aq\fR 1 or more times, \fIi.e.\fR, at least once +.IP "\(bu" 4 +\&\f(CW\*(C`a{n,m}\*(C'\fR means: match at least \f(CW\*(C`n\*(C'\fR times, but not more than \f(CW\*(C`m\*(C'\fR +times. +.IP "\(bu" 4 +\&\f(CW\*(C`a{n,}\*(C'\fR means: match at least \f(CW\*(C`n\*(C'\fR or more times +.IP "\(bu" 4 +\&\f(CW\*(C`a{n}\*(C'\fR means: match exactly \f(CW\*(C`n\*(C'\fR times +.PP +Here are some examples: +.PP +.Vb 10 +\& /[a\-z]+\es+\ed*/; # match a lowercase word, at least one space, and +\& # any number of digits +\& /(\ew+)\es+\eg1/; # match doubled words of arbitrary length +\& /y(es)?/i; # matches \*(Aqy\*(Aq, \*(AqY\*(Aq, or a case\-insensitive \*(Aqyes\*(Aq +\& $year =~ /^\ed{2,4}$/; # make sure year is at least 2 but not more +\& # than 4 digits +\& $year =~ /^\ed{4}$|^\ed{2}$/; # better match; throw out 3\-digit dates +\& $year =~ /^\ed{2}(\ed{2})?$/; # same thing written differently. +\& # However, this captures the last two +\& # digits in $1 and the other does not. +\& +\& % simple_grep \*(Aq^(\ew+)\eg1$\*(Aq /usr/dict/words # isn\*(Aqt this easier? +\& beriberi +\& booboo +\& coco +\& mama +\& murmur +\& papa +.Ve +.PP +For all of these quantifiers, Perl will try to match as much of the +string as possible, while still allowing the regexp to succeed. Thus +with \f(CW\*(C`/a?.../\*(C'\fR, Perl will first try to match the regexp with the \f(CW\*(Aqa\*(Aq\fR +present; if that fails, Perl will try to match the regexp without the +\&\f(CW\*(Aqa\*(Aq\fR present. For the quantifier \f(CW\*(Aq*\*(Aq\fR, we get the following: +.PP +.Vb 5 +\& $x = "the cat in the hat"; +\& $x =~ /^(.*)(cat)(.*)$/; # matches, +\& # $1 = \*(Aqthe \*(Aq +\& # $2 = \*(Aqcat\*(Aq +\& # $3 = \*(Aq in the hat\*(Aq +.Ve +.PP +Which is what we might expect, the match finds the only \f(CW\*(C`cat\*(C'\fR in the +string and locks onto it. Consider, however, this regexp: +.PP +.Vb 4 +\& $x =~ /^(.*)(at)(.*)$/; # matches, +\& # $1 = \*(Aqthe cat in the h\*(Aq +\& # $2 = \*(Aqat\*(Aq +\& # $3 = \*(Aq\*(Aq (0 characters match) +.Ve +.PP +One might initially guess that Perl would find the \f(CW\*(C`at\*(C'\fR in \f(CW\*(C`cat\*(C'\fR and +stop there, but that wouldn't give the longest possible string to the +first quantifier \f(CW\*(C`.*\*(C'\fR. Instead, the first quantifier \f(CW\*(C`.*\*(C'\fR grabs as +much of the string as possible while still having the regexp match. In +this example, that means having the \f(CW\*(C`at\*(C'\fR sequence with the final \f(CW\*(C`at\*(C'\fR +in the string. The other important principle illustrated here is that, +when there are two or more elements in a regexp, the \fIleftmost\fR +quantifier, if there is one, gets to grab as much of the string as +possible, leaving the rest of the regexp to fight over scraps. Thus in +our example, the first quantifier \f(CW\*(C`.*\*(C'\fR grabs most of the string, while +the second quantifier \f(CW\*(C`.*\*(C'\fR gets the empty string. Quantifiers that +grab as much of the string as possible are called \fImaximal match\fR or +\&\fIgreedy\fR quantifiers. +.PP +When a regexp can match a string in several different ways, we can use +the principles above to predict which way the regexp will match: +.IP "\(bu" 4 +Principle 0: Taken as a whole, any regexp will be matched at the +earliest possible position in the string. +.IP "\(bu" 4 +Principle 1: In an alternation \f(CW\*(C`a|b|c...\*(C'\fR, the leftmost alternative +that allows a match for the whole regexp will be the one used. +.IP "\(bu" 4 +Principle 2: The maximal matching quantifiers \f(CW\*(Aq?\*(Aq\fR, \f(CW\*(Aq*\*(Aq\fR, \f(CW\*(Aq+\*(Aq\fR and +\&\f(CW\*(C`{n,m}\*(C'\fR will in general match as much of the string as possible while +still allowing the whole regexp to match. +.IP "\(bu" 4 +Principle 3: If there are two or more elements in a regexp, the +leftmost greedy quantifier, if any, will match as much of the string +as possible while still allowing the whole regexp to match. The next +leftmost greedy quantifier, if any, will try to match as much of the +string remaining available to it as possible, while still allowing the +whole regexp to match. And so on, until all the regexp elements are +satisfied. +.PP +As we have seen above, Principle 0 overrides the others. The regexp +will be matched as early as possible, with the other principles +determining how the regexp matches at that earliest character +position. +.PP +Here is an example of these principles in action: +.PP +.Vb 5 +\& $x = "The programming republic of Perl"; +\& $x =~ /^(.+)(e|r)(.*)$/; # matches, +\& # $1 = \*(AqThe programming republic of Pe\*(Aq +\& # $2 = \*(Aqr\*(Aq +\& # $3 = \*(Aql\*(Aq +.Ve +.PP +This regexp matches at the earliest string position, \f(CW\*(AqT\*(Aq\fR. One +might think that \f(CW\*(Aqe\*(Aq\fR, being leftmost in the alternation, would be +matched, but \f(CW\*(Aqr\*(Aq\fR produces the longest string in the first quantifier. +.PP +.Vb 3 +\& $x =~ /(m{1,2})(.*)$/; # matches, +\& # $1 = \*(Aqmm\*(Aq +\& # $2 = \*(Aqing republic of Perl\*(Aq +.Ve +.PP +Here, The earliest possible match is at the first \f(CW\*(Aqm\*(Aq\fR in +\&\f(CW\*(C`programming\*(C'\fR. \f(CW\*(C`m{1,2}\*(C'\fR is the first quantifier, so it gets to match +a maximal \f(CW\*(C`mm\*(C'\fR. +.PP +.Vb 3 +\& $x =~ /.*(m{1,2})(.*)$/; # matches, +\& # $1 = \*(Aqm\*(Aq +\& # $2 = \*(Aqing republic of Perl\*(Aq +.Ve +.PP +Here, the regexp matches at the start of the string. The first +quantifier \f(CW\*(C`.*\*(C'\fR grabs as much as possible, leaving just a single +\&\f(CW\*(Aqm\*(Aq\fR for the second quantifier \f(CW\*(C`m{1,2}\*(C'\fR. +.PP +.Vb 4 +\& $x =~ /(.?)(m{1,2})(.*)$/; # matches, +\& # $1 = \*(Aqa\*(Aq +\& # $2 = \*(Aqmm\*(Aq +\& # $3 = \*(Aqing republic of Perl\*(Aq +.Ve +.PP +Here, \f(CW\*(C`.?\*(C'\fR eats its maximal one character at the earliest possible +position in the string, \f(CW\*(Aqa\*(Aq\fR in \f(CW\*(C`programming\*(C'\fR, leaving \f(CW\*(C`m{1,2}\*(C'\fR +the opportunity to match both \f(CW\*(Aqm\*(Aq\fR's. Finally, +.PP +.Vb 1 +\& "aXXXb" =~ /(X*)/; # matches with $1 = \*(Aq\*(Aq +.Ve +.PP +because it can match zero copies of \f(CW\*(AqX\*(Aq\fR at the beginning of the +string. If you definitely want to match at least one \f(CW\*(AqX\*(Aq\fR, use +\&\f(CW\*(C`X+\*(C'\fR, not \f(CW\*(C`X*\*(C'\fR. +.PP +Sometimes greed is not good. At times, we would like quantifiers to +match a \fIminimal\fR piece of string, rather than a maximal piece. For +this purpose, Larry Wall created the \fIminimal match\fR or +\&\fInon-greedy\fR quantifiers \f(CW\*(C`??\*(C'\fR, \f(CW\*(C`*?\*(C'\fR, \f(CW\*(C`+?\*(C'\fR, and \f(CW\*(C`{}?\*(C'\fR. These are +the usual quantifiers with a \f(CW\*(Aq?\*(Aq\fR appended to them. They have the +following meanings: +.IP "\(bu" 4 +\&\f(CW\*(C`a??\*(C'\fR means: match \f(CW\*(Aqa\*(Aq\fR 0 or 1 times. Try 0 first, then 1. +.IP "\(bu" 4 +\&\f(CW\*(C`a*?\*(C'\fR means: match \f(CW\*(Aqa\*(Aq\fR 0 or more times, \fIi.e.\fR, any number of times, +but as few times as possible +.IP "\(bu" 4 +\&\f(CW\*(C`a+?\*(C'\fR means: match \f(CW\*(Aqa\*(Aq\fR 1 or more times, \fIi.e.\fR, at least once, but +as few times as possible +.IP "\(bu" 4 +\&\f(CW\*(C`a{n,m}?\*(C'\fR means: match at least \f(CW\*(C`n\*(C'\fR times, not more than \f(CW\*(C`m\*(C'\fR +times, as few times as possible +.IP "\(bu" 4 +\&\f(CW\*(C`a{n,}?\*(C'\fR means: match at least \f(CW\*(C`n\*(C'\fR times, but as few times as +possible +.IP "\(bu" 4 +\&\f(CW\*(C`a{n}?\*(C'\fR means: match exactly \f(CW\*(C`n\*(C'\fR times. Because we match exactly +\&\f(CW\*(C`n\*(C'\fR times, \f(CW\*(C`a{n}?\*(C'\fR is equivalent to \f(CW\*(C`a{n}\*(C'\fR and is just there for +notational consistency. +.PP +Let's look at the example above, but with minimal quantifiers: +.PP +.Vb 5 +\& $x = "The programming republic of Perl"; +\& $x =~ /^(.+?)(e|r)(.*)$/; # matches, +\& # $1 = \*(AqTh\*(Aq +\& # $2 = \*(Aqe\*(Aq +\& # $3 = \*(Aq programming republic of Perl\*(Aq +.Ve +.PP +The minimal string that will allow both the start of the string \f(CW\*(Aq^\*(Aq\fR +and the alternation to match is \f(CW\*(C`Th\*(C'\fR, with the alternation \f(CW\*(C`e|r\*(C'\fR +matching \f(CW\*(Aqe\*(Aq\fR. The second quantifier \f(CW\*(C`.*\*(C'\fR is free to gobble up the +rest of the string. +.PP +.Vb 3 +\& $x =~ /(m{1,2}?)(.*?)$/; # matches, +\& # $1 = \*(Aqm\*(Aq +\& # $2 = \*(Aqming republic of Perl\*(Aq +.Ve +.PP +The first string position that this regexp can match is at the first +\&\f(CW\*(Aqm\*(Aq\fR in \f(CW\*(C`programming\*(C'\fR. At this position, the minimal \f(CW\*(C`m{1,2}?\*(C'\fR +matches just one \f(CW\*(Aqm\*(Aq\fR. Although the second quantifier \f(CW\*(C`.*?\*(C'\fR would +prefer to match no characters, it is constrained by the end-of-string +anchor \f(CW\*(Aq$\*(Aq\fR to match the rest of the string. +.PP +.Vb 4 +\& $x =~ /(.*?)(m{1,2}?)(.*)$/; # matches, +\& # $1 = \*(AqThe progra\*(Aq +\& # $2 = \*(Aqm\*(Aq +\& # $3 = \*(Aqming republic of Perl\*(Aq +.Ve +.PP +In this regexp, you might expect the first minimal quantifier \f(CW\*(C`.*?\*(C'\fR +to match the empty string, because it is not constrained by a \f(CW\*(Aq^\*(Aq\fR +anchor to match the beginning of the word. Principle 0 applies here, +however. Because it is possible for the whole regexp to match at the +start of the string, it \fIwill\fR match at the start of the string. Thus +the first quantifier has to match everything up to the first \f(CW\*(Aqm\*(Aq\fR. The +second minimal quantifier matches just one \f(CW\*(Aqm\*(Aq\fR and the third +quantifier matches the rest of the string. +.PP +.Vb 4 +\& $x =~ /(.??)(m{1,2})(.*)$/; # matches, +\& # $1 = \*(Aqa\*(Aq +\& # $2 = \*(Aqmm\*(Aq +\& # $3 = \*(Aqing republic of Perl\*(Aq +.Ve +.PP +Just as in the previous regexp, the first quantifier \f(CW\*(C`.??\*(C'\fR can match +earliest at position \f(CW\*(Aqa\*(Aq\fR, so it does. The second quantifier is +greedy, so it matches \f(CW\*(C`mm\*(C'\fR, and the third matches the rest of the +string. +.PP +We can modify principle 3 above to take into account non-greedy +quantifiers: +.IP "\(bu" 4 +Principle 3: If there are two or more elements in a regexp, the +leftmost greedy (non-greedy) quantifier, if any, will match as much +(little) of the string as possible while still allowing the whole +regexp to match. The next leftmost greedy (non-greedy) quantifier, if +any, will try to match as much (little) of the string remaining +available to it as possible, while still allowing the whole regexp to +match. And so on, until all the regexp elements are satisfied. +.PP +Just like alternation, quantifiers are also susceptible to +backtracking. Here is a step-by-step analysis of the example +.PP +.Vb 5 +\& $x = "the cat in the hat"; +\& $x =~ /^(.*)(at)(.*)$/; # matches, +\& # $1 = \*(Aqthe cat in the h\*(Aq +\& # $2 = \*(Aqat\*(Aq +\& # $3 = \*(Aq\*(Aq (0 matches) +.Ve +.ie n .IP "0. Start with the first letter in the string \*(Aqt\*(Aq." 4 +.el .IP "0. Start with the first letter in the string \f(CW\*(Aqt\*(Aq\fR." 4 +.IX Item "0. Start with the first letter in the string t." +\&\ +.ie n .IP "1. The first quantifier \*(Aq.*\*(Aq starts out by matching the whole string """"the cat in the hat""""." 4 +.el .IP "1. The first quantifier \f(CW\*(Aq.*\*(Aq\fR starts out by matching the whole string ``\f(CWthe cat in the hat\fR''." 4 +.IX Item "1. The first quantifier .* starts out by matching the whole string ""the cat in the hat""." +\&\ +.ie n .IP "2. \*(Aqa\*(Aq in the regexp element \*(Aqat\*(Aq doesn't match the end of the string. Backtrack one character." 4 +.el .IP "2. \f(CW\*(Aqa\*(Aq\fR in the regexp element \f(CW\*(Aqat\*(Aq\fR doesn't match the end of the string. Backtrack one character." 4 +.IX Item "2. a in the regexp element at doesn't match the end of the string. Backtrack one character." +\&\ +.ie n .IP "3. \*(Aqa\*(Aq in the regexp element \*(Aqat\*(Aq still doesn't match the last letter of the string \*(Aqt\*(Aq, so backtrack one more character." 4 +.el .IP "3. \f(CW\*(Aqa\*(Aq\fR in the regexp element \f(CW\*(Aqat\*(Aq\fR still doesn't match the last letter of the string \f(CW\*(Aqt\*(Aq\fR, so backtrack one more character." 4 +.IX Item "3. a in the regexp element at still doesn't match the last letter of the string t, so backtrack one more character." +\&\ +.ie n .IP "4. Now we can match the \*(Aqa\*(Aq and the \*(Aqt\*(Aq." 4 +.el .IP "4. Now we can match the \f(CW\*(Aqa\*(Aq\fR and the \f(CW\*(Aqt\*(Aq\fR." 4 +.IX Item "4. Now we can match the a and the t." +\&\ +.ie n .IP "5. Move on to the third element \*(Aq.*\*(Aq. Since we are at the end of the string and \*(Aq.*\*(Aq can match 0 times, assign it the empty string." 4 +.el .IP "5. Move on to the third element \f(CW\*(Aq.*\*(Aq\fR. Since we are at the end of the string and \f(CW\*(Aq.*\*(Aq\fR can match 0 times, assign it the empty string." 4 +.IX Item "5. Move on to the third element .*. Since we are at the end of the string and .* can match 0 times, assign it the empty string." +\&\ +.IP "6. We are done!" 4 +.IX Item "6. We are done!" +.PP +Most of the time, all this moving forward and backtracking happens +quickly and searching is fast. There are some pathological regexps, +however, whose execution time exponentially grows with the size of the +string. A typical structure that blows up in your face is of the form +.PP +.Vb 1 +\& /(a|b+)*/; +.Ve +.PP +The problem is the nested indeterminate quantifiers. There are many +different ways of partitioning a string of length n between the \f(CW\*(Aq+\*(Aq\fR +and \f(CW\*(Aq*\*(Aq\fR: one repetition with \f(CW\*(C`b+\*(C'\fR of length n, two repetitions with +the first \f(CW\*(C`b+\*(C'\fR length k and the second with length n\-k, m repetitions +whose bits add up to length n, \fIetc\fR. In fact there are an exponential +number of ways to partition a string as a function of its length. A +regexp may get lucky and match early in the process, but if there is +no match, Perl will try \fIevery\fR possibility before giving up. So be +careful with nested \f(CW\*(Aq*\*(Aq\fR's, \f(CW\*(C`{n,m}\*(C'\fR's, and \f(CW\*(Aq+\*(Aq\fR's. The book +\&\fIMastering Regular Expressions\fR by Jeffrey Friedl gives a wonderful +discussion of this and other efficiency issues. +.SS "Possessive quantifiers" +.IX Subsection "Possessive quantifiers" +Backtracking during the relentless search for a match may be a waste +of time, particularly when the match is bound to fail. Consider +the simple pattern +.PP +.Vb 1 +\& /^\ew+\es+\ew+$/; # a word, spaces, a word +.Ve +.PP +Whenever this is applied to a string which doesn't quite meet the +pattern's expectations such as \f(CW"abc\ \ "\fR or \f(CW"abc\ \ def\ "\fR, +the regexp engine will backtrack, approximately once for each character +in the string. But we know that there is no way around taking \fIall\fR +of the initial word characters to match the first repetition, that \fIall\fR +spaces must be eaten by the middle part, and the same goes for the second +word. +.PP +With the introduction of the \fIpossessive quantifiers\fR in Perl 5.10, we +have a way of instructing the regexp engine not to backtrack, with the +usual quantifiers with a \f(CW\*(Aq+\*(Aq\fR appended to them. This makes them greedy as +well as stingy; once they succeed they won't give anything back to permit +another solution. They have the following meanings: +.IP "\(bu" 4 +\&\f(CW\*(C`a{n,m}+\*(C'\fR means: match at least \f(CW\*(C`n\*(C'\fR times, not more than \f(CW\*(C`m\*(C'\fR times, +as many times as possible, and don't give anything up. \f(CW\*(C`a?+\*(C'\fR is short +for \f(CW\*(C`a{0,1}+\*(C'\fR +.IP "\(bu" 4 +\&\f(CW\*(C`a{n,}+\*(C'\fR means: match at least \f(CW\*(C`n\*(C'\fR times, but as many times as possible, +and don't give anything up. \f(CW\*(C`a*+\*(C'\fR is short for \f(CW\*(C`a{0,}+\*(C'\fR and \f(CW\*(C`a++\*(C'\fR is +short for \f(CW\*(C`a{1,}+\*(C'\fR. +.IP "\(bu" 4 +\&\f(CW\*(C`a{n}+\*(C'\fR means: match exactly \f(CW\*(C`n\*(C'\fR times. It is just there for +notational consistency. +.PP +These possessive quantifiers represent a special case of a more general +concept, the \fIindependent subexpression\fR, see below. +.PP +As an example where a possessive quantifier is suitable we consider +matching a quoted string, as it appears in several programming languages. +The backslash is used as an escape character that indicates that the +next character is to be taken literally, as another character for the +string. Therefore, after the opening quote, we expect a (possibly +empty) sequence of alternatives: either some character except an +unescaped quote or backslash or an escaped character. +.PP +.Vb 1 +\& /"(?:[^"\e\e]++|\e\e.)*+"/; +.Ve +.SS "Building a regexp" +.IX Subsection "Building a regexp" +At this point, we have all the basic regexp concepts covered, so let's +give a more involved example of a regular expression. We will build a +regexp that matches numbers. +.PP +The first task in building a regexp is to decide what we want to match +and what we want to exclude. In our case, we want to match both +integers and floating point numbers and we want to reject any string +that isn't a number. +.PP +The next task is to break the problem down into smaller problems that +are easily converted into a regexp. +.PP +The simplest case is integers. These consist of a sequence of digits, +with an optional sign in front. The digits we can represent with +\&\f(CW\*(C`\ed+\*(C'\fR and the sign can be matched with \f(CW\*(C`[+\-]\*(C'\fR. Thus the integer +regexp is +.PP +.Vb 1 +\& /[+\-]?\ed+/; # matches integers +.Ve +.PP +A floating point number potentially has a sign, an integral part, a +decimal point, a fractional part, and an exponent. One or more of these +parts is optional, so we need to check out the different +possibilities. Floating point numbers which are in proper form include +123., 0.345, .34, \-1e6, and 25.4E\-72. As with integers, the sign out +front is completely optional and can be matched by \f(CW\*(C`[+\-]?\*(C'\fR. We can +see that if there is no exponent, floating point numbers must have a +decimal point, otherwise they are integers. We might be tempted to +model these with \f(CW\*(C`\ed*\e.\ed*\*(C'\fR, but this would also match just a single +decimal point, which is not a number. So the three cases of floating +point number without exponent are +.PP +.Vb 3 +\& /[+\-]?\ed+\e./; # 1., 321., etc. +\& /[+\-]?\e.\ed+/; # .1, .234, etc. +\& /[+\-]?\ed+\e.\ed+/; # 1.0, 30.56, etc. +.Ve +.PP +These can be combined into a single regexp with a three-way alternation: +.PP +.Vb 1 +\& /[+\-]?(\ed+\e.\ed+|\ed+\e.|\e.\ed+)/; # floating point, no exponent +.Ve +.PP +In this alternation, it is important to put \f(CW\*(Aq\ed+\e.\ed+\*(Aq\fR before +\&\f(CW\*(Aq\ed+\e.\*(Aq\fR. If \f(CW\*(Aq\ed+\e.\*(Aq\fR were first, the regexp would happily match that +and ignore the fractional part of the number. +.PP +Now consider floating point numbers with exponents. The key +observation here is that \fIboth\fR integers and numbers with decimal +points are allowed in front of an exponent. Then exponents, like the +overall sign, are independent of whether we are matching numbers with +or without decimal points, and can be \*(L"decoupled\*(R" from the +mantissa. The overall form of the regexp now becomes clear: +.PP +.Vb 1 +\& /^(optional sign)(integer | f.p. mantissa)(optional exponent)$/; +.Ve +.PP +The exponent is an \f(CW\*(Aqe\*(Aq\fR or \f(CW\*(AqE\*(Aq\fR, followed by an integer. So the +exponent regexp is +.PP +.Vb 1 +\& /[eE][+\-]?\ed+/; # exponent +.Ve +.PP +Putting all the parts together, we get a regexp that matches numbers: +.PP +.Vb 1 +\& /^[+\-]?(\ed+\e.\ed+|\ed+\e.|\e.\ed+|\ed+)([eE][+\-]?\ed+)?$/; # Ta da! +.Ve +.PP +Long regexps like this may impress your friends, but can be hard to +decipher. In complex situations like this, the \f(CW\*(C`/x\*(C'\fR modifier for a +match is invaluable. It allows one to put nearly arbitrary whitespace +and comments into a regexp without affecting their meaning. Using it, +we can rewrite our \*(L"extended\*(R" regexp in the more pleasing form +.PP +.Vb 10 +\& /^ +\& [+\-]? # first, match an optional sign +\& ( # then match integers or f.p. mantissas: +\& \ed+\e.\ed+ # mantissa of the form a.b +\& |\ed+\e. # mantissa of the form a. +\& |\e.\ed+ # mantissa of the form .b +\& |\ed+ # integer of the form a +\& ) +\& ( [eE] [+\-]? \ed+ )? # finally, optionally match an exponent +\& $/x; +.Ve +.PP +If whitespace is mostly irrelevant, how does one include space +characters in an extended regexp? The answer is to backslash it +\&\f(CW\*(Aq\e\ \*(Aq\fR or put it in a character class \f(CW\*(C`[\ ]\*(C'\fR. The same thing +goes for pound signs: use \f(CW\*(C`\e#\*(C'\fR or \f(CW\*(C`[#]\*(C'\fR. For instance, Perl allows +a space between the sign and the mantissa or integer, and we could add +this to our regexp as follows: +.PP +.Vb 10 +\& /^ +\& [+\-]?\e * # first, match an optional sign *and space* +\& ( # then match integers or f.p. mantissas: +\& \ed+\e.\ed+ # mantissa of the form a.b +\& |\ed+\e. # mantissa of the form a. +\& |\e.\ed+ # mantissa of the form .b +\& |\ed+ # integer of the form a +\& ) +\& ( [eE] [+\-]? \ed+ )? # finally, optionally match an exponent +\& $/x; +.Ve +.PP +In this form, it is easier to see a way to simplify the +alternation. Alternatives 1, 2, and 4 all start with \f(CW\*(C`\ed+\*(C'\fR, so it +could be factored out: +.PP +.Vb 11 +\& /^ +\& [+\-]?\e * # first, match an optional sign +\& ( # then match integers or f.p. mantissas: +\& \ed+ # start out with a ... +\& ( +\& \e.\ed* # mantissa of the form a.b or a. +\& )? # ? takes care of integers of the form a +\& |\e.\ed+ # mantissa of the form .b +\& ) +\& ( [eE] [+\-]? \ed+ )? # finally, optionally match an exponent +\& $/x; +.Ve +.PP +Starting in Perl v5.26, specifying \f(CW\*(C`/xx\*(C'\fR changes the square-bracketed +portions of a pattern to ignore tabs and space characters unless they +are escaped by preceding them with a backslash. So, we could write +.PP +.Vb 11 +\& /^ +\& [ + \- ]?\e * # first, match an optional sign +\& ( # then match integers or f.p. mantissas: +\& \ed+ # start out with a ... +\& ( +\& \e.\ed* # mantissa of the form a.b or a. +\& )? # ? takes care of integers of the form a +\& |\e.\ed+ # mantissa of the form .b +\& ) +\& ( [ e E ] [ + \- ]? \ed+ )? # finally, optionally match an exponent +\& $/xx; +.Ve +.PP +This doesn't really improve the legibility of this example, but it's +available in case you want it. Squashing the pattern down to the +compact form, we have +.PP +.Vb 1 +\& /^[+\-]?\e *(\ed+(\e.\ed*)?|\e.\ed+)([eE][+\-]?\ed+)?$/; +.Ve +.PP +This is our final regexp. To recap, we built a regexp by +.IP "\(bu" 4 +specifying the task in detail, +.IP "\(bu" 4 +breaking down the problem into smaller parts, +.IP "\(bu" 4 +translating the small parts into regexps, +.IP "\(bu" 4 +combining the regexps, +.IP "\(bu" 4 +and optimizing the final combined regexp. +.PP +These are also the typical steps involved in writing a computer +program. This makes perfect sense, because regular expressions are +essentially programs written in a little computer language that specifies +patterns. +.SS "Using regular expressions in Perl" +.IX Subsection "Using regular expressions in Perl" +The last topic of Part 1 briefly covers how regexps are used in Perl +programs. Where do they fit into Perl syntax? +.PP +We have already introduced the matching operator in its default +\&\f(CW\*(C`/regexp/\*(C'\fR and arbitrary delimiter \f(CW\*(C`m!regexp!\*(C'\fR forms. We have used +the binding operator \f(CW\*(C`=~\*(C'\fR and its negation \f(CW\*(C`!~\*(C'\fR to test for string +matches. Associated with the matching operator, we have discussed the +single line \f(CW\*(C`/s\*(C'\fR, multi-line \f(CW\*(C`/m\*(C'\fR, case-insensitive \f(CW\*(C`/i\*(C'\fR and +extended \f(CW\*(C`/x\*(C'\fR modifiers. There are a few more things you might +want to know about matching operators. +.PP +\fIProhibiting substitution\fR +.IX Subsection "Prohibiting substitution" +.PP +If you change \f(CW$pattern\fR after the first substitution happens, Perl +will ignore it. If you don't want any substitutions at all, use the +special delimiter \f(CW\*(C`m\*(Aq\*(Aq\*(C'\fR: +.PP +.Vb 4 +\& @pattern = (\*(AqSeuss\*(Aq); +\& while (<>) { +\& print if m\*(Aq@pattern\*(Aq; # matches literal \*(Aq@pattern\*(Aq, not \*(AqSeuss\*(Aq +\& } +.Ve +.PP +Similar to strings, \f(CW\*(C`m\*(Aq\*(Aq\*(C'\fR acts like apostrophes on a regexp; all other +\&\f(CW\*(Aqm\*(Aq\fR delimiters act like quotes. If the regexp evaluates to the empty string, +the regexp in the \fIlast successful match\fR is used instead. So we have +.PP +.Vb 2 +\& "dog" =~ /d/; # \*(Aqd\*(Aq matches +\& "dogbert" =~ //; # this matches the \*(Aqd\*(Aq regexp used before +.Ve +.PP +\fIGlobal matching\fR +.IX Subsection "Global matching" +.PP +The final two modifiers we will discuss here, +\&\f(CW\*(C`/g\*(C'\fR and \f(CW\*(C`/c\*(C'\fR, concern multiple matches. +The modifier \f(CW\*(C`/g\*(C'\fR stands for global matching and allows the +matching operator to match within a string as many times as possible. +In scalar context, successive invocations against a string will have +\&\f(CW\*(C`/g\*(C'\fR jump from match to match, keeping track of position in the +string as it goes along. You can get or set the position with the +\&\f(CW\*(C`pos()\*(C'\fR function. +.PP +The use of \f(CW\*(C`/g\*(C'\fR is shown in the following example. Suppose we have +a string that consists of words separated by spaces. If we know how +many words there are in advance, we could extract the words using +groupings: +.PP +.Vb 5 +\& $x = "cat dog house"; # 3 words +\& $x =~ /^\es*(\ew+)\es+(\ew+)\es+(\ew+)\es*$/; # matches, +\& # $1 = \*(Aqcat\*(Aq +\& # $2 = \*(Aqdog\*(Aq +\& # $3 = \*(Aqhouse\*(Aq +.Ve +.PP +But what if we had an indeterminate number of words? This is the sort +of task \f(CW\*(C`/g\*(C'\fR was made for. To extract all words, form the simple +regexp \f(CW\*(C`(\ew+)\*(C'\fR and loop over all matches with \f(CW\*(C`/(\ew+)/g\*(C'\fR: +.PP +.Vb 3 +\& while ($x =~ /(\ew+)/g) { +\& print "Word is $1, ends at position ", pos $x, "\en"; +\& } +.Ve +.PP +prints +.PP +.Vb 3 +\& Word is cat, ends at position 3 +\& Word is dog, ends at position 7 +\& Word is house, ends at position 13 +.Ve +.PP +A failed match or changing the target string resets the position. If +you don't want the position reset after failure to match, add the +\&\f(CW\*(C`/c\*(C'\fR, as in \f(CW\*(C`/regexp/gc\*(C'\fR. The current position in the string is +associated with the string, not the regexp. This means that different +strings have different positions and their respective positions can be +set or read independently. +.PP +In list context, \f(CW\*(C`/g\*(C'\fR returns a list of matched groupings, or if +there are no groupings, a list of matches to the whole regexp. So if +we wanted just the words, we could use +.PP +.Vb 4 +\& @words = ($x =~ /(\ew+)/g); # matches, +\& # $words[0] = \*(Aqcat\*(Aq +\& # $words[1] = \*(Aqdog\*(Aq +\& # $words[2] = \*(Aqhouse\*(Aq +.Ve +.PP +Closely associated with the \f(CW\*(C`/g\*(C'\fR modifier is the \f(CW\*(C`\eG\*(C'\fR anchor. The +\&\f(CW\*(C`\eG\*(C'\fR anchor matches at the point where the previous \f(CW\*(C`/g\*(C'\fR match left +off. \f(CW\*(C`\eG\*(C'\fR allows us to easily do context-sensitive matching: +.PP +.Vb 12 +\& $metric = 1; # use metric units +\& ... +\& $x = ; # read in measurement +\& $x =~ /^([+\-]?\ed+)\es*/g; # get magnitude +\& $weight = $1; +\& if ($metric) { # error checking +\& print "Units error!" unless $x =~ /\eGkg\e./g; +\& } +\& else { +\& print "Units error!" unless $x =~ /\eGlbs\e./g; +\& } +\& $x =~ /\eG\es+(widget|sprocket)/g; # continue processing +.Ve +.PP +The combination of \f(CW\*(C`/g\*(C'\fR and \f(CW\*(C`\eG\*(C'\fR allows us to process the string a +bit at a time and use arbitrary Perl logic to decide what to do next. +Currently, the \f(CW\*(C`\eG\*(C'\fR anchor is only fully supported when used to anchor +to the start of the pattern. +.PP +\&\f(CW\*(C`\eG\*(C'\fR is also invaluable in processing fixed-length records with +regexps. Suppose we have a snippet of coding region \s-1DNA,\s0 encoded as +base pair letters \f(CW\*(C`ATCGTTGAAT...\*(C'\fR and we want to find all the stop +codons \f(CW\*(C`TGA\*(C'\fR. In a coding region, codons are 3\-letter sequences, so +we can think of the \s-1DNA\s0 snippet as a sequence of 3\-letter records. The +naive regexp +.PP +.Vb 3 +\& # expanded, this is "ATC GTT GAA TGC AAA TGA CAT GAC" +\& $dna = "ATCGTTGAATGCAAATGACATGAC"; +\& $dna =~ /TGA/; +.Ve +.PP +doesn't work; it may match a \f(CW\*(C`TGA\*(C'\fR, but there is no guarantee that +the match is aligned with codon boundaries, \fIe.g.\fR, the substring +\&\f(CW\*(C`GTT\ GAA\*(C'\fR gives a match. A better solution is +.PP +.Vb 3 +\& while ($dna =~ /(\ew\ew\ew)*?TGA/g) { # note the minimal *? +\& print "Got a TGA stop codon at position ", pos $dna, "\en"; +\& } +.Ve +.PP +which prints +.PP +.Vb 2 +\& Got a TGA stop codon at position 18 +\& Got a TGA stop codon at position 23 +.Ve +.PP +Position 18 is good, but position 23 is bogus. What happened? +.PP +The answer is that our regexp works well until we get past the last +real match. Then the regexp will fail to match a synchronized \f(CW\*(C`TGA\*(C'\fR +and start stepping ahead one character position at a time, not what we +want. The solution is to use \f(CW\*(C`\eG\*(C'\fR to anchor the match to the codon +alignment: +.PP +.Vb 3 +\& while ($dna =~ /\eG(\ew\ew\ew)*?TGA/g) { +\& print "Got a TGA stop codon at position ", pos $dna, "\en"; +\& } +.Ve +.PP +This prints +.PP +.Vb 1 +\& Got a TGA stop codon at position 18 +.Ve +.PP +which is the correct answer. This example illustrates that it is +important not only to match what is desired, but to reject what is not +desired. +.PP +(There are other regexp modifiers that are available, such as +\&\f(CW\*(C`/o\*(C'\fR, but their specialized uses are beyond the +scope of this introduction. ) +.PP +\fISearch and replace\fR +.IX Subsection "Search and replace" +.PP +Regular expressions also play a big role in \fIsearch and replace\fR +operations in Perl. Search and replace is accomplished with the +\&\f(CW\*(C`s///\*(C'\fR operator. The general form is +\&\f(CW\*(C`s/regexp/replacement/modifiers\*(C'\fR, with everything we know about +regexps and modifiers applying in this case as well. The +\&\fIreplacement\fR is a Perl double-quoted string that replaces in the +string whatever is matched with the \f(CW\*(C`regexp\*(C'\fR. The operator \f(CW\*(C`=~\*(C'\fR is +also used here to associate a string with \f(CW\*(C`s///\*(C'\fR. If matching +against \f(CW$_\fR, the \f(CW\*(C`$_\ =~\*(C'\fR can be dropped. If there is a match, +\&\f(CW\*(C`s///\*(C'\fR returns the number of substitutions made; otherwise it returns +false. Here are a few examples: +.PP +.Vb 8 +\& $x = "Time to feed the cat!"; +\& $x =~ s/cat/hacker/; # $x contains "Time to feed the hacker!" +\& if ($x =~ s/^(Time.*hacker)!$/$1 now!/) { +\& $more_insistent = 1; +\& } +\& $y = "\*(Aqquoted words\*(Aq"; +\& $y =~ s/^\*(Aq(.*)\*(Aq$/$1/; # strip single quotes, +\& # $y contains "quoted words" +.Ve +.PP +In the last example, the whole string was matched, but only the part +inside the single quotes was grouped. With the \f(CW\*(C`s///\*(C'\fR operator, the +matched variables \f(CW$1\fR, \f(CW$2\fR, \fIetc\fR. are immediately available for use +in the replacement expression, so we use \f(CW$1\fR to replace the quoted +string with just what was quoted. With the global modifier, \f(CW\*(C`s///g\*(C'\fR +will search and replace all occurrences of the regexp in the string: +.PP +.Vb 6 +\& $x = "I batted 4 for 4"; +\& $x =~ s/4/four/; # doesn\*(Aqt do it all: +\& # $x contains "I batted four for 4" +\& $x = "I batted 4 for 4"; +\& $x =~ s/4/four/g; # does it all: +\& # $x contains "I batted four for four" +.Ve +.PP +If you prefer \*(L"regex\*(R" over \*(L"regexp\*(R" in this tutorial, you could use +the following program to replace it: +.PP +.Vb 9 +\& % cat > simple_replace +\& #!/usr/bin/perl +\& $regexp = shift; +\& $replacement = shift; +\& while (<>) { +\& s/$regexp/$replacement/g; +\& print; +\& } +\& ^D +\& +\& % simple_replace regexp regex perlretut.pod +.Ve +.PP +In \f(CW\*(C`simple_replace\*(C'\fR we used the \f(CW\*(C`s///g\*(C'\fR modifier to replace all +occurrences of the regexp on each line. (Even though the regular +expression appears in a loop, Perl is smart enough to compile it +only once.) As with \f(CW\*(C`simple_grep\*(C'\fR, both the +\&\f(CW\*(C`print\*(C'\fR and the \f(CW\*(C`s/$regexp/$replacement/g\*(C'\fR use \f(CW$_\fR implicitly. +.PP +If you don't want \f(CW\*(C`s///\*(C'\fR to change your original variable you can use +the non-destructive substitute modifier, \f(CW\*(C`s///r\*(C'\fR. This changes the +behavior so that \f(CW\*(C`s///r\*(C'\fR returns the final substituted string +(instead of the number of substitutions): +.PP +.Vb 3 +\& $x = "I like dogs."; +\& $y = $x =~ s/dogs/cats/r; +\& print "$x $y\en"; +.Ve +.PP +That example will print \*(L"I like dogs. I like cats\*(R". Notice the original +\&\f(CW$x\fR variable has not been affected. The overall +result of the substitution is instead stored in \f(CW$y\fR. If the +substitution doesn't affect anything then the original string is +returned: +.PP +.Vb 3 +\& $x = "I like dogs."; +\& $y = $x =~ s/elephants/cougars/r; +\& print "$x $y\en"; # prints "I like dogs. I like dogs." +.Ve +.PP +One other interesting thing that the \f(CW\*(C`s///r\*(C'\fR flag allows is chaining +substitutions: +.PP +.Vb 4 +\& $x = "Cats are great."; +\& print $x =~ s/Cats/Dogs/r =~ s/Dogs/Frogs/r =~ +\& s/Frogs/Hedgehogs/r, "\en"; +\& # prints "Hedgehogs are great." +.Ve +.PP +A modifier available specifically to search and replace is the +\&\f(CW\*(C`s///e\*(C'\fR evaluation modifier. \f(CW\*(C`s///e\*(C'\fR treats the +replacement text as Perl code, rather than a double-quoted +string. The value that the code returns is substituted for the +matched substring. \f(CW\*(C`s///e\*(C'\fR is useful if you need to do a bit of +computation in the process of replacing text. This example counts +character frequencies in a line: +.PP +.Vb 4 +\& $x = "Bill the cat"; +\& $x =~ s/(.)/$chars{$1}++;$1/eg; # final $1 replaces char with itself +\& print "frequency of \*(Aq$_\*(Aq is $chars{$_}\en" +\& foreach (sort {$chars{$b} <=> $chars{$a}} keys %chars); +.Ve +.PP +This prints +.PP +.Vb 9 +\& frequency of \*(Aq \*(Aq is 2 +\& frequency of \*(Aqt\*(Aq is 2 +\& frequency of \*(Aql\*(Aq is 2 +\& frequency of \*(AqB\*(Aq is 1 +\& frequency of \*(Aqc\*(Aq is 1 +\& frequency of \*(Aqe\*(Aq is 1 +\& frequency of \*(Aqh\*(Aq is 1 +\& frequency of \*(Aqi\*(Aq is 1 +\& frequency of \*(Aqa\*(Aq is 1 +.Ve +.PP +As with the match \f(CW\*(C`m//\*(C'\fR operator, \f(CW\*(C`s///\*(C'\fR can use other delimiters, +such as \f(CW\*(C`s!!!\*(C'\fR and \f(CW\*(C`s{}{}\*(C'\fR, and even \f(CW\*(C`s{}//\*(C'\fR. If single quotes are +used \f(CW\*(C`s\*(Aq\*(Aq\*(Aq\*(C'\fR, then the regexp and replacement are +treated as single-quoted strings and there are no +variable substitutions. \f(CW\*(C`s///\*(C'\fR in list context +returns the same thing as in scalar context, \fIi.e.\fR, the number of +matches. +.PP +\fIThe split function\fR +.IX Subsection "The split function" +.PP +The \f(CW\*(C`split()\*(C'\fR function is another place where a regexp is used. +\&\f(CW\*(C`split /regexp/, string, limit\*(C'\fR separates the \f(CW\*(C`string\*(C'\fR operand into +a list of substrings and returns that list. The regexp must be designed +to match whatever constitutes the separators for the desired substrings. +The \f(CW\*(C`limit\*(C'\fR, if present, constrains splitting into no more than \f(CW\*(C`limit\*(C'\fR +number of strings. For example, to split a string into words, use +.PP +.Vb 4 +\& $x = "Calvin and Hobbes"; +\& @words = split /\es+/, $x; # $word[0] = \*(AqCalvin\*(Aq +\& # $word[1] = \*(Aqand\*(Aq +\& # $word[2] = \*(AqHobbes\*(Aq +.Ve +.PP +If the empty regexp \f(CW\*(C`//\*(C'\fR is used, the regexp always matches and +the string is split into individual characters. If the regexp has +groupings, then the resulting list contains the matched substrings from the +groupings as well. For instance, +.PP +.Vb 12 +\& $x = "/usr/bin/perl"; +\& @dirs = split m!/!, $x; # $dirs[0] = \*(Aq\*(Aq +\& # $dirs[1] = \*(Aqusr\*(Aq +\& # $dirs[2] = \*(Aqbin\*(Aq +\& # $dirs[3] = \*(Aqperl\*(Aq +\& @parts = split m!(/)!, $x; # $parts[0] = \*(Aq\*(Aq +\& # $parts[1] = \*(Aq/\*(Aq +\& # $parts[2] = \*(Aqusr\*(Aq +\& # $parts[3] = \*(Aq/\*(Aq +\& # $parts[4] = \*(Aqbin\*(Aq +\& # $parts[5] = \*(Aq/\*(Aq +\& # $parts[6] = \*(Aqperl\*(Aq +.Ve +.PP +Since the first character of \f(CW$x\fR matched the regexp, \f(CW\*(C`split\*(C'\fR prepended +an empty initial element to the list. +.PP +If you have read this far, congratulations! You now have all the basic +tools needed to use regular expressions to solve a wide range of text +processing problems. If this is your first time through the tutorial, +why not stop here and play around with regexps a while.... Part\ 2 +concerns the more esoteric aspects of regular expressions and those +concepts certainly aren't needed right at the start. +.SH "Part 2: Power tools" +.IX Header "Part 2: Power tools" +\&\s-1OK,\s0 you know the basics of regexps and you want to know more. If +matching regular expressions is analogous to a walk in the woods, then +the tools discussed in Part 1 are analogous to topo maps and a +compass, basic tools we use all the time. Most of the tools in part 2 +are analogous to flare guns and satellite phones. They aren't used +too often on a hike, but when we are stuck, they can be invaluable. +.PP +What follows are the more advanced, less used, or sometimes esoteric +capabilities of Perl regexps. In Part 2, we will assume you are +comfortable with the basics and concentrate on the advanced features. +.SS "More on characters, strings, and character classes" +.IX Subsection "More on characters, strings, and character classes" +There are a number of escape sequences and character classes that we +haven't covered yet. +.PP +There are several escape sequences that convert characters or strings +between upper and lower case, and they are also available within +patterns. \f(CW\*(C`\el\*(C'\fR and \f(CW\*(C`\eu\*(C'\fR convert the next character to lower or +upper case, respectively: +.PP +.Vb 4 +\& $x = "perl"; +\& $string =~ /\eu$x/; # matches \*(AqPerl\*(Aq in $string +\& $x = "M(rs?|s)\e\e."; # note the double backslash +\& $string =~ /\el$x/; # matches \*(Aqmr.\*(Aq, \*(Aqmrs.\*(Aq, and \*(Aqms.\*(Aq, +.Ve +.PP +A \f(CW\*(C`\eL\*(C'\fR or \f(CW\*(C`\eU\*(C'\fR indicates a lasting conversion of case, until +terminated by \f(CW\*(C`\eE\*(C'\fR or thrown over by another \f(CW\*(C`\eU\*(C'\fR or \f(CW\*(C`\eL\*(C'\fR: +.PP +.Vb 4 +\& $x = "This word is in lower case:\eL SHOUT\eE"; +\& $x =~ /shout/; # matches +\& $x = "I STILL KEYPUNCH CARDS FOR MY 360"; +\& $x =~ /\eUkeypunch/; # matches punch card string +.Ve +.PP +If there is no \f(CW\*(C`\eE\*(C'\fR, case is converted until the end of the +string. The regexps \f(CW\*(C`\eL\eu$word\*(C'\fR or \f(CW\*(C`\eu\eL$word\*(C'\fR convert the first +character of \f(CW$word\fR to uppercase and the rest of the characters to +lowercase. +.PP +Control characters can be escaped with \f(CW\*(C`\ec\*(C'\fR, so that a control-Z +character would be matched with \f(CW\*(C`\ecZ\*(C'\fR. The escape sequence +\&\f(CW\*(C`\eQ\*(C'\fR...\f(CW\*(C`\eE\*(C'\fR quotes, or protects most non-alphabetic characters. For +instance, +.PP +.Vb 2 +\& $x = "\eQThat !^*&%~& cat!"; +\& $x =~ /\eQ!^*&%~&\eE/; # check for rough language +.Ve +.PP +It does not protect \f(CW\*(Aq$\*(Aq\fR or \f(CW\*(Aq@\*(Aq\fR, so that variables can still be +substituted. +.PP +\&\f(CW\*(C`\eQ\*(C'\fR, \f(CW\*(C`\eL\*(C'\fR, \f(CW\*(C`\el\*(C'\fR, \f(CW\*(C`\eU\*(C'\fR, \f(CW\*(C`\eu\*(C'\fR and \f(CW\*(C`\eE\*(C'\fR are actually part of +double-quotish syntax, and not part of regexp syntax proper. They will +work if they appear in a regular expression embedded directly in a +program, but not when contained in a string that is interpolated in a +pattern. +.PP +Perl regexps can handle more than just the +standard \s-1ASCII\s0 character set. Perl supports \fIUnicode\fR, a standard +for representing the alphabets from virtually all of the world's written +languages, and a host of symbols. Perl's text strings are Unicode strings, so +they can contain characters with a value (codepoint or character number) higher +than 255. +.PP +What does this mean for regexps? Well, regexp users don't need to know +much about Perl's internal representation of strings. But they do need +to know 1) how to represent Unicode characters in a regexp and 2) that +a matching operation will treat the string to be searched as a sequence +of characters, not bytes. The answer to 1) is that Unicode characters +greater than \f(CW\*(C`chr(255)\*(C'\fR are represented using the \f(CW\*(C`\ex{hex}\*(C'\fR notation, because +\&\f(CW\*(C`\ex\*(C'\fR\fI\s-1XY\s0\fR (without curly braces and \fI\s-1XY\s0\fR are two hex digits) doesn't +go further than 255. (Starting in Perl 5.14, if you're an octal fan, +you can also use \f(CW\*(C`\eo{oct}\*(C'\fR.) +.PP +.Vb 1 +\& /\ex{263a}/; # match a Unicode smiley face :) +.Ve +.PP +\&\fB\s-1NOTE\s0\fR: In Perl 5.6.0 it used to be that one needed to say \f(CW\*(C`use +utf8\*(C'\fR to use any Unicode features. This is no more the case: for +almost all Unicode processing, the explicit \f(CW\*(C`utf8\*(C'\fR pragma is not +needed. (The only case where it matters is if your Perl script is in +Unicode and encoded in \s-1UTF\-8,\s0 then an explicit \f(CW\*(C`use utf8\*(C'\fR is needed.) +.PP +Figuring out the hexadecimal sequence of a Unicode character you want +or deciphering someone else's hexadecimal Unicode regexp is about as +much fun as programming in machine code. So another way to specify +Unicode characters is to use the \fInamed character\fR escape +sequence \f(CW\*(C`\eN{\f(CIname\f(CW}\*(C'\fR. \fIname\fR is a name for the Unicode character, as +specified in the Unicode standard. For instance, if we wanted to +represent or match the astrological sign for the planet Mercury, we +could use +.PP +.Vb 2 +\& $x = "abc\eN{MERCURY}def"; +\& $x =~ /\eN{MERCURY}/; # matches +.Ve +.PP +One can also use \*(L"short\*(R" names: +.PP +.Vb 2 +\& print "\eN{GREEK SMALL LETTER SIGMA} is called sigma.\en"; +\& print "\eN{greek:Sigma} is an upper\-case sigma.\en"; +.Ve +.PP +You can also restrict names to a certain alphabet by specifying the +charnames pragma: +.PP +.Vb 2 +\& use charnames qw(greek); +\& print "\eN{sigma} is Greek sigma\en"; +.Ve +.PP +An index of character names is available on-line from the Unicode +Consortium, ; explanatory +material with links to other resources at +. +.PP +Starting in Perl v5.32, an alternative to \f(CW\*(C`\eN{...}\*(C'\fR for full names is +available, and that is to say +.PP +.Vb 1 +\& /\ep{Name=greek small letter sigma}/ +.Ve +.PP +The casing of the character name is irrelevant when used in \f(CW\*(C`\ep{}\*(C'\fR, as +are most spaces, underscores and hyphens. (A few outlier characters +cause problems with ignoring all of them always. The details (which you +can look up when you get more proficient, and if ever needed) are in +). +.PP +The answer to requirement 2) is that a regexp (mostly) +uses Unicode characters. The \*(L"mostly\*(R" is for messy backward +compatibility reasons, but starting in Perl 5.14, any regexp compiled in +the scope of a \f(CW\*(C`use feature \*(Aqunicode_strings\*(Aq\*(C'\fR (which is automatically +turned on within the scope of a \f(CW\*(C`use 5.012\*(C'\fR or higher) will turn that +\&\*(L"mostly\*(R" into \*(L"always\*(R". If you want to handle Unicode properly, you +should ensure that \f(CW\*(Aqunicode_strings\*(Aq\fR is turned on. +Internally, this is encoded to bytes using either \s-1UTF\-8\s0 or a native 8 +bit encoding, depending on the history of the string, but conceptually +it is a sequence of characters, not bytes. See perlunitut for a +tutorial about that. +.PP +Let us now discuss Unicode character classes, most usually called +\&\*(L"character properties\*(R". These are represented by the \f(CW\*(C`\ep{\f(CIname\f(CW}\*(C'\fR +escape sequence. The negation of this is \f(CW\*(C`\eP{\f(CIname\f(CW}\*(C'\fR. For example, +to match lower and uppercase characters, +.PP +.Vb 5 +\& $x = "BOB"; +\& $x =~ /^\ep{IsUpper}/; # matches, uppercase char class +\& $x =~ /^\eP{IsUpper}/; # doesn\*(Aqt match, char class sans uppercase +\& $x =~ /^\ep{IsLower}/; # doesn\*(Aqt match, lowercase char class +\& $x =~ /^\eP{IsLower}/; # matches, char class sans lowercase +.Ve +.PP +(The "\f(CW\*(C`Is\*(C'\fR" is optional.) +.PP +There are many, many Unicode character properties. For the full list +see perluniprops. Most of them have synonyms with shorter names, +also listed there. Some synonyms are a single character. For these, +you can drop the braces. For instance, \f(CW\*(C`\epM\*(C'\fR is the same thing as +\&\f(CW\*(C`\ep{Mark}\*(C'\fR, meaning things like accent marks. +.PP +The Unicode \f(CW\*(C`\ep{Script}\*(C'\fR and \f(CW\*(C`\ep{Script_Extensions}\*(C'\fR properties are +used to categorize every Unicode character into the language script it +is written in. (\f(CW\*(C`Script_Extensions\*(C'\fR is an improved version of +\&\f(CW\*(C`Script\*(C'\fR, which is retained for backward compatibility, and so you +should generally use \f(CW\*(C`Script_Extensions\*(C'\fR.) +For example, +English, French, and a bunch of other European languages are written in +the Latin script. But there is also the Greek script, the Thai script, +the Katakana script, \fIetc\fR. You can test whether a character is in a +particular script (based on \f(CW\*(C`Script_Extensions\*(C'\fR) with, for example +\&\f(CW\*(C`\ep{Latin}\*(C'\fR, \f(CW\*(C`\ep{Greek}\*(C'\fR, or \f(CW\*(C`\ep{Katakana}\*(C'\fR. To test if it isn't in +the Balinese script, you would use \f(CW\*(C`\eP{Balinese}\*(C'\fR. +.PP +What we have described so far is the single form of the \f(CW\*(C`\ep{...}\*(C'\fR character +classes. There is also a compound form which you may run into. These +look like \f(CW\*(C`\ep{\f(CIname\f(CW=\f(CIvalue\f(CW}\*(C'\fR or \f(CW\*(C`\ep{\f(CIname\f(CW:\f(CIvalue\f(CW}\*(C'\fR (the equals sign and colon +can be used interchangeably). These are more general than the single form, +and in fact most of the single forms are just Perl-defined shortcuts for common +compound forms. For example, the script examples in the previous paragraph +could be written equivalently as \f(CW\*(C`\ep{Script_Extensions=Latin}\*(C'\fR, \f(CW\*(C`\ep{Script_Extensions:Greek}\*(C'\fR, +\&\f(CW\*(C`\ep{script_extensions=katakana}\*(C'\fR, and \f(CW\*(C`\eP{script_extensions=balinese}\*(C'\fR (case is irrelevant +between the \f(CW\*(C`{}\*(C'\fR braces). You may +never have to use the compound forms, but sometimes it is necessary, and their +use can make your code easier to understand. +.PP +\&\f(CW\*(C`\eX\*(C'\fR is an abbreviation for a character class that comprises +a Unicode \fIextended grapheme cluster\fR. This represents a \*(L"logical character\*(R": +what appears to be a single character, but may be represented internally by more +than one. As an example, using the Unicode full names, \fIe.g.\fR, \*(L"A\ +\ \s-1COMBINING\s0\ \s-1RING\*(R"\s0 is a grapheme cluster with base character \*(L"A\*(R" and combining character +\&\*(L"\s-1COMBINING\s0\ \s-1RING,\s0 which translates in Danish to \*(R"A" with the circle atop it, +as in the word A\*ongstrom. +.PP +For the full and latest information about Unicode see the latest +Unicode standard, or the Unicode Consortium's website +.PP +As if all those classes weren't enough, Perl also defines POSIX-style +character classes. These have the form \f(CW\*(C`[:\f(CIname\f(CW:]\*(C'\fR, with \fIname\fR the +name of the \s-1POSIX\s0 class. The \s-1POSIX\s0 classes are \f(CW\*(C`alpha\*(C'\fR, \f(CW\*(C`alnum\*(C'\fR, +\&\f(CW\*(C`ascii\*(C'\fR, \f(CW\*(C`cntrl\*(C'\fR, \f(CW\*(C`digit\*(C'\fR, \f(CW\*(C`graph\*(C'\fR, \f(CW\*(C`lower\*(C'\fR, \f(CW\*(C`print\*(C'\fR, \f(CW\*(C`punct\*(C'\fR, +\&\f(CW\*(C`space\*(C'\fR, \f(CW\*(C`upper\*(C'\fR, and \f(CW\*(C`xdigit\*(C'\fR, and two extensions, \f(CW\*(C`word\*(C'\fR (a Perl +extension to match \f(CW\*(C`\ew\*(C'\fR), and \f(CW\*(C`blank\*(C'\fR (a \s-1GNU\s0 extension). The \f(CW\*(C`/a\*(C'\fR +modifier restricts these to matching just in the \s-1ASCII\s0 range; otherwise +they can match the same as their corresponding Perl Unicode classes: +\&\f(CW\*(C`[:upper:]\*(C'\fR is the same as \f(CW\*(C`\ep{IsUpper}\*(C'\fR, \fIetc\fR. (There are some +exceptions and gotchas with this; see perlrecharclass for a full +discussion.) The \f(CW\*(C`[:digit:]\*(C'\fR, \f(CW\*(C`[:word:]\*(C'\fR, and +\&\f(CW\*(C`[:space:]\*(C'\fR correspond to the familiar \f(CW\*(C`\ed\*(C'\fR, \f(CW\*(C`\ew\*(C'\fR, and \f(CW\*(C`\es\*(C'\fR +character classes. To negate a \s-1POSIX\s0 class, put a \f(CW\*(Aq^\*(Aq\fR in front of +the name, so that, \fIe.g.\fR, \f(CW\*(C`[:^digit:]\*(C'\fR corresponds to \f(CW\*(C`\eD\*(C'\fR and, under +Unicode, \f(CW\*(C`\eP{IsDigit}\*(C'\fR. The Unicode and \s-1POSIX\s0 character classes can +be used just like \f(CW\*(C`\ed\*(C'\fR, with the exception that \s-1POSIX\s0 character +classes can only be used inside of a character class: +.PP +.Vb 6 +\& /\es+[abc[:digit:]xyz]\es*/; # match a,b,c,x,y,z, or a digit +\& /^=item\es[[:digit:]]/; # match \*(Aq=item\*(Aq, +\& # followed by a space and a digit +\& /\es+[abc\ep{IsDigit}xyz]\es+/; # match a,b,c,x,y,z, or a digit +\& /^=item\es\ep{IsDigit}/; # match \*(Aq=item\*(Aq, +\& # followed by a space and a digit +.Ve +.PP +Whew! That is all the rest of the characters and character classes. +.SS "Compiling and saving regular expressions" +.IX Subsection "Compiling and saving regular expressions" +In Part 1 we mentioned that Perl compiles a regexp into a compact +sequence of opcodes. Thus, a compiled regexp is a data structure +that can be stored once and used again and again. The regexp quote +\&\f(CW\*(C`qr//\*(C'\fR does exactly that: \f(CW\*(C`qr/string/\*(C'\fR compiles the \f(CW\*(C`string\*(C'\fR as a +regexp and transforms the result into a form that can be assigned to a +variable: +.PP +.Vb 1 +\& $reg = qr/foo+bar?/; # reg contains a compiled regexp +.Ve +.PP +Then \f(CW$reg\fR can be used as a regexp: +.PP +.Vb 3 +\& $x = "fooooba"; +\& $x =~ $reg; # matches, just like /foo+bar?/ +\& $x =~ /$reg/; # same thing, alternate form +.Ve +.PP +\&\f(CW$reg\fR can also be interpolated into a larger regexp: +.PP +.Vb 1 +\& $x =~ /(abc)?$reg/; # still matches +.Ve +.PP +As with the matching operator, the regexp quote can use different +delimiters, \fIe.g.\fR, \f(CW\*(C`qr!!\*(C'\fR, \f(CW\*(C`qr{}\*(C'\fR or \f(CW\*(C`qr~~\*(C'\fR. Apostrophes +as delimiters (\f(CW\*(C`qr\*(Aq\*(Aq\*(C'\fR) inhibit any interpolation. +.PP +Pre-compiled regexps are useful for creating dynamic matches that +don't need to be recompiled each time they are encountered. Using +pre-compiled regexps, we write a \f(CW\*(C`grep_step\*(C'\fR program which greps +for a sequence of patterns, advancing to the next pattern as soon +as one has been satisfied. +.PP +.Vb 4 +\& % cat > grep_step +\& #!/usr/bin/perl +\& # grep_step \- match regexps, one after the other +\& # usage: multi_grep regexp1 regexp2 ... file1 file2 ... +\& +\& $number = shift; +\& $regexp[$_] = shift foreach (0..$number\-1); +\& @compiled = map qr/$_/, @regexp; +\& while ($line = <>) { +\& if ($line =~ /$compiled[0]/) { +\& print $line; +\& shift @compiled; +\& last unless @compiled; +\& } +\& } +\& ^D +\& +\& % grep_step 3 shift print last grep_step +\& $number = shift; +\& print $line; +\& last unless @compiled; +.Ve +.PP +Storing pre-compiled regexps in an array \f(CW@compiled\fR allows us to +simply loop through the regexps without any recompilation, thus gaining +flexibility without sacrificing speed. +.SS "Composing regular expressions at runtime" +.IX Subsection "Composing regular expressions at runtime" +Backtracking is more efficient than repeated tries with different regular +expressions. If there are several regular expressions and a match with +any of them is acceptable, then it is possible to combine them into a set +of alternatives. If the individual expressions are input data, this +can be done by programming a join operation. We'll exploit this idea in +an improved version of the \f(CW\*(C`simple_grep\*(C'\fR program: a program that matches +multiple patterns: +.PP +.Vb 4 +\& % cat > multi_grep +\& #!/usr/bin/perl +\& # multi_grep \- match any of regexps +\& # usage: multi_grep regexp1 regexp2 ... file1 file2 ... +\& +\& $number = shift; +\& $regexp[$_] = shift foreach (0..$number\-1); +\& $pattern = join \*(Aq|\*(Aq, @regexp; +\& +\& while ($line = <>) { +\& print $line if $line =~ /$pattern/; +\& } +\& ^D +\& +\& % multi_grep 2 shift for multi_grep +\& $number = shift; +\& $regexp[$_] = shift foreach (0..$number\-1); +.Ve +.PP +Sometimes it is advantageous to construct a pattern from the \fIinput\fR +that is to be analyzed and use the permissible values on the left +hand side of the matching operations. As an example for this somewhat +paradoxical situation, let's assume that our input contains a command +verb which should match one out of a set of available command verbs, +with the additional twist that commands may be abbreviated as long as +the given string is unique. The program below demonstrates the basic +algorithm. +.PP +.Vb 10 +\& % cat > keymatch +\& #!/usr/bin/perl +\& $kwds = \*(Aqcopy compare list print\*(Aq; +\& while( $cmd = <> ){ +\& $cmd =~ s/^\es+|\es+$//g; # trim leading and trailing spaces +\& if( ( @matches = $kwds =~ /\eb$cmd\ew*/g ) == 1 ){ +\& print "command: \*(Aq@matches\*(Aq\en"; +\& } elsif( @matches == 0 ){ +\& print "no such command: \*(Aq$cmd\*(Aq\en"; +\& } else { +\& print "not unique: \*(Aq$cmd\*(Aq (could be one of: @matches)\en"; +\& } +\& } +\& ^D +\& +\& % keymatch +\& li +\& command: \*(Aqlist\*(Aq +\& co +\& not unique: \*(Aqco\*(Aq (could be one of: copy compare) +\& printer +\& no such command: \*(Aqprinter\*(Aq +.Ve +.PP +Rather than trying to match the input against the keywords, we match the +combined set of keywords against the input. The pattern matching +operation \f(CW\*(C`$kwds\ =~\ /\eb($cmd\ew*)/g\*(C'\fR does several things at the +same time. It makes sure that the given command begins where a keyword +begins (\f(CW\*(C`\eb\*(C'\fR). It tolerates abbreviations due to the added \f(CW\*(C`\ew*\*(C'\fR. It +tells us the number of matches (\f(CW\*(C`scalar @matches\*(C'\fR) and all the keywords +that were actually matched. You could hardly ask for more. +.SS "Embedding comments and modifiers in a regular expression" +.IX Subsection "Embedding comments and modifiers in a regular expression" +Starting with this section, we will be discussing Perl's set of +\&\fIextended patterns\fR. These are extensions to the traditional regular +expression syntax that provide powerful new tools for pattern +matching. We have already seen extensions in the form of the minimal +matching constructs \f(CW\*(C`??\*(C'\fR, \f(CW\*(C`*?\*(C'\fR, \f(CW\*(C`+?\*(C'\fR, \f(CW\*(C`{n,m}?\*(C'\fR, and \f(CW\*(C`{n,}?\*(C'\fR. Most +of the extensions below have the form \f(CW\*(C`(?char...)\*(C'\fR, where the +\&\f(CW\*(C`char\*(C'\fR is a character that determines the type of extension. +.PP +The first extension is an embedded comment \f(CW\*(C`(?#text)\*(C'\fR. This embeds a +comment into the regular expression without affecting its meaning. The +comment should not have any closing parentheses in the text. An +example is +.PP +.Vb 1 +\& /(?# Match an integer:)[+\-]?\ed+/; +.Ve +.PP +This style of commenting has been largely superseded by the raw, +freeform commenting that is allowed with the \f(CW\*(C`/x\*(C'\fR modifier. +.PP +Most modifiers, such as \f(CW\*(C`/i\*(C'\fR, \f(CW\*(C`/m\*(C'\fR, \f(CW\*(C`/s\*(C'\fR and \f(CW\*(C`/x\*(C'\fR (or any +combination thereof) can also be embedded in +a regexp using \f(CW\*(C`(?i)\*(C'\fR, \f(CW\*(C`(?m)\*(C'\fR, \f(CW\*(C`(?s)\*(C'\fR, and \f(CW\*(C`(?x)\*(C'\fR. For instance, +.PP +.Vb 7 +\& /(?i)yes/; # match \*(Aqyes\*(Aq case insensitively +\& /yes/i; # same thing +\& /(?x)( # freeform version of an integer regexp +\& [+\-]? # match an optional sign +\& \ed+ # match a sequence of digits +\& ) +\& /x; +.Ve +.PP +Embedded modifiers can have two important advantages over the usual +modifiers. Embedded modifiers allow a custom set of modifiers for +\&\fIeach\fR regexp pattern. This is great for matching an array of regexps +that must have different modifiers: +.PP +.Vb 8 +\& $pattern[0] = \*(Aq(?i)doctor\*(Aq; +\& $pattern[1] = \*(AqJohnson\*(Aq; +\& ... +\& while (<>) { +\& foreach $patt (@pattern) { +\& print if /$patt/; +\& } +\& } +.Ve +.PP +The second advantage is that embedded modifiers (except \f(CW\*(C`/p\*(C'\fR, which +modifies the entire regexp) only affect the regexp +inside the group the embedded modifier is contained in. So grouping +can be used to localize the modifier's effects: +.PP +.Vb 1 +\& /Answer: ((?i)yes)/; # matches \*(AqAnswer: yes\*(Aq, \*(AqAnswer: YES\*(Aq, etc. +.Ve +.PP +Embedded modifiers can also turn off any modifiers already present +by using, \fIe.g.\fR, \f(CW\*(C`(?\-i)\*(C'\fR. Modifiers can also be combined into +a single expression, \fIe.g.\fR, \f(CW\*(C`(?s\-i)\*(C'\fR turns on single line mode and +turns off case insensitivity. +.PP +Embedded modifiers may also be added to a non-capturing grouping. +\&\f(CW\*(C`(?i\-m:regexp)\*(C'\fR is a non-capturing grouping that matches \f(CW\*(C`regexp\*(C'\fR +case insensitively and turns off multi-line mode. +.SS "Looking ahead and looking behind" +.IX Subsection "Looking ahead and looking behind" +This section concerns the lookahead and lookbehind assertions. First, +a little background. +.PP +In Perl regular expressions, most regexp elements \*(L"eat up\*(R" a certain +amount of string when they match. For instance, the regexp element +\&\f(CW\*(C`[abc]\*(C'\fR eats up one character of the string when it matches, in the +sense that Perl moves to the next character position in the string +after the match. There are some elements, however, that don't eat up +characters (advance the character position) if they match. The examples +we have seen so far are the anchors. The anchor \f(CW\*(Aq^\*(Aq\fR matches the +beginning of the line, but doesn't eat any characters. Similarly, the +word boundary anchor \f(CW\*(C`\eb\*(C'\fR matches wherever a character matching \f(CW\*(C`\ew\*(C'\fR +is next to a character that doesn't, but it doesn't eat up any +characters itself. Anchors are examples of \fIzero-width assertions\fR: +zero-width, because they consume +no characters, and assertions, because they test some property of the +string. In the context of our walk in the woods analogy to regexp +matching, most regexp elements move us along a trail, but anchors have +us stop a moment and check our surroundings. If the local environment +checks out, we can proceed forward. But if the local environment +doesn't satisfy us, we must backtrack. +.PP +Checking the environment entails either looking ahead on the trail, +looking behind, or both. \f(CW\*(Aq^\*(Aq\fR looks behind, to see that there are no +characters before. \f(CW\*(Aq$\*(Aq\fR looks ahead, to see that there are no +characters after. \f(CW\*(C`\eb\*(C'\fR looks both ahead and behind, to see if the +characters on either side differ in their \*(L"word-ness\*(R". +.PP +The lookahead and lookbehind assertions are generalizations of the +anchor concept. Lookahead and lookbehind are zero-width assertions +that let us specify which characters we want to test for. The +lookahead assertion is denoted by \f(CW\*(C`(?=regexp)\*(C'\fR or (starting in 5.32, +experimentally in 5.28) \f(CW\*(C`(*pla:regexp)\*(C'\fR or +\&\f(CW\*(C`(*positive_lookahead:regexp)\*(C'\fR; and the lookbehind assertion is denoted +by \f(CW\*(C`(?<=fixed\-regexp)\*(C'\fR or (starting in 5.32, experimentally in +5.28) \f(CW\*(C`(*plb:fixed\-regexp)\*(C'\fR or \f(CW\*(C`(*positive_lookbehind:fixed\-regexp)\*(C'\fR. +Some examples are +.PP +.Vb 8 +\& $x = "I catch the housecat \*(AqTom\-cat\*(Aq with catnip"; +\& $x =~ /cat(*pla:\es)/; # matches \*(Aqcat\*(Aq in \*(Aqhousecat\*(Aq +\& @catwords = ($x =~ /(?<=\es)cat\ew+/g); # matches, +\& # $catwords[0] = \*(Aqcatch\*(Aq +\& # $catwords[1] = \*(Aqcatnip\*(Aq +\& $x =~ /\ebcat\eb/; # matches \*(Aqcat\*(Aq in \*(AqTom\-cat\*(Aq +\& $x =~ /(?<=\es)cat(?=\es)/; # doesn\*(Aqt match; no isolated \*(Aqcat\*(Aq in +\& # middle of $x +.Ve +.PP +Note that the parentheses in these are +non-capturing, since these are zero-width assertions. Thus in the +second regexp, the substrings captured are those of the whole regexp +itself. Lookahead can match arbitrary regexps, but +lookbehind prior to 5.30 \f(CW\*(C`(?<=fixed\-regexp)\*(C'\fR only works for regexps +of fixed width, \fIi.e.\fR, a fixed number of characters long. Thus +\&\f(CW\*(C`(?<=(ab|bc))\*(C'\fR is fine, but \f(CW\*(C`(?<=(ab)*)\*(C'\fR prior to 5.30 is not. +.PP +The negated versions of the lookahead and lookbehind assertions are +denoted by \f(CW\*(C`(?!regexp)\*(C'\fR and \f(CW\*(C`(?regexp)\*(C'\fR or (starting in 5.32, experimentally in 5.28) +\&\f(CW\*(C`(*atomic:regexp)\*(C'\fR. We can illustrate their behavior by first +considering an ordinary regexp: +.PP +.Vb 2 +\& $x = "ab"; +\& $x =~ /a*ab/; # matches +.Ve +.PP +This obviously matches, but in the process of matching, the +subexpression \f(CW\*(C`a*\*(C'\fR first grabbed the \f(CW\*(Aqa\*(Aq\fR. Doing so, however, +wouldn't allow the whole regexp to match, so after backtracking, \f(CW\*(C`a*\*(C'\fR +eventually gave back the \f(CW\*(Aqa\*(Aq\fR and matched the empty string. Here, what +\&\f(CW\*(C`a*\*(C'\fR matched was \fIdependent\fR on what the rest of the regexp matched. +.PP +Contrast that with an independent subexpression: +.PP +.Vb 1 +\& $x =~ /(?>a*)ab/; # doesn\*(Aqt match! +.Ve +.PP +The independent subexpression \f(CW\*(C`(?>a*)\*(C'\fR doesn't care about the rest +of the regexp, so it sees an \f(CW\*(Aqa\*(Aq\fR and grabs it. Then the rest of the +regexp \f(CW\*(C`ab\*(C'\fR cannot match. Because \f(CW\*(C`(?>a*)\*(C'\fR is independent, there +is no backtracking and the independent subexpression does not give +up its \f(CW\*(Aqa\*(Aq\fR. Thus the match of the regexp as a whole fails. A similar +behavior occurs with completely independent regexps: +.PP +.Vb 3 +\& $x = "ab"; +\& $x =~ /a*/g; # matches, eats an \*(Aqa\*(Aq +\& $x =~ /\eGab/g; # doesn\*(Aqt match, no \*(Aqa\*(Aq available +.Ve +.PP +Here \f(CW\*(C`/g\*(C'\fR and \f(CW\*(C`\eG\*(C'\fR create a \*(L"tag team\*(R" handoff of the string from +one regexp to the other. Regexps with an independent subexpression are +much like this, with a handoff of the string to the independent +subexpression, and a handoff of the string back to the enclosing +regexp. +.PP +The ability of an independent subexpression to prevent backtracking +can be quite useful. Suppose we want to match a non-empty string +enclosed in parentheses up to two levels deep. Then the following +regexp matches: +.PP +.Vb 2 +\& $x = "abc(de(fg)h"; # unbalanced parentheses +\& $x =~ /\e( ( [ ^ () ]+ | \e( [ ^ () ]* \e) )+ \e)/xx; +.Ve +.PP +The regexp matches an open parenthesis, one or more copies of an +alternation, and a close parenthesis. The alternation is two-way, with +the first alternative \f(CW\*(C`[^()]+\*(C'\fR matching a substring with no +parentheses and the second alternative \f(CW\*(C`\e([^()]*\e)\*(C'\fR matching a +substring delimited by parentheses. The problem with this regexp is +that it is pathological: it has nested indeterminate quantifiers +of the form \f(CW\*(C`(a+|b)+\*(C'\fR. We discussed in Part 1 how nested quantifiers +like this could take an exponentially long time to execute if there +was no match possible. To prevent the exponential blowup, we need to +prevent useless backtracking at some point. This can be done by +enclosing the inner quantifier as an independent subexpression: +.PP +.Vb 1 +\& $x =~ /\e( ( (?> [ ^ () ]+ ) | \e([ ^ () ]* \e) )+ \e)/xx; +.Ve +.PP +Here, \f(CW\*(C`(?>[^()]+)\*(C'\fR breaks the degeneracy of string partitioning +by gobbling up as much of the string as possible and keeping it. Then +match failures fail much more quickly. +.SS "Conditional expressions" +.IX Subsection "Conditional expressions" +A \fIconditional expression\fR is a form of if-then-else statement +that allows one to choose which patterns are to be matched, based on +some condition. There are two types of conditional expression: +\&\f(CW\*(C`(?(\f(CIcondition\f(CW)\f(CIyes\-regexp\f(CW)\*(C'\fR and +\&\f(CW\*(C`(?(condition)\f(CIyes\-regexp\f(CW|\f(CIno\-regexp\f(CW)\*(C'\fR. +\&\f(CW\*(C`(?(\f(CIcondition\f(CW)\f(CIyes\-regexp\f(CW)\*(C'\fR is +like an \f(CW\*(Aqif\ ()\ {}\*(Aq\fR statement in Perl. If the \fIcondition\fR is true, +the \fIyes-regexp\fR will be matched. If the \fIcondition\fR is false, the +\&\fIyes-regexp\fR will be skipped and Perl will move onto the next regexp +element. The second form is like an \f(CW\*(Aqif\ ()\ {}\ else\ {}\*(Aq\fR statement +in Perl. If the \fIcondition\fR is true, the \fIyes-regexp\fR will be +matched, otherwise the \fIno-regexp\fR will be matched. +.PP +The \fIcondition\fR can have several forms. The first form is simply an +integer in parentheses \f(CW\*(C`(\f(CIinteger\f(CW)\*(C'\fR. It is true if the corresponding +backreference \f(CW\*(C`\e\f(CIinteger\f(CW\*(C'\fR matched earlier in the regexp. The same +thing can be done with a name associated with a capture group, written +as \f(CW\*(C`(<\f(CIname\f(CW>)\*(C'\fR or \f(CW\*(C`(\*(Aq\f(CIname\f(CW\*(Aq)\*(C'\fR. The second form is a bare +zero-width assertion \f(CW\*(C`(?...)\*(C'\fR, either a lookahead, a lookbehind, or a +code assertion (discussed in the next section). The third set of forms +provides tests that return true if the expression is executed within +a recursion (\f(CW\*(C`(R)\*(C'\fR) or is being called from some capturing group, +referenced either by number (\f(CW\*(C`(R1)\*(C'\fR, \f(CW\*(C`(R2)\*(C'\fR,...) or by name +(\f(CW\*(C`(R&\f(CIname\f(CW)\*(C'\fR). +.PP +The integer or name form of the \f(CW\*(C`condition\*(C'\fR allows us to choose, +with more flexibility, what to match based on what matched earlier in the +regexp. This searches for words of the form \f(CW"$x$x"\fR or \f(CW"$x$y$y$x"\fR: +.PP +.Vb 9 +\& % simple_grep \*(Aq^(\ew+)(\ew+)?(?(2)\eg2\eg1|\eg1)$\*(Aq /usr/dict/words +\& beriberi +\& coco +\& couscous +\& deed +\& ... +\& toot +\& toto +\& tutu +.Ve +.PP +The lookbehind \f(CW\*(C`condition\*(C'\fR allows, along with backreferences, +an earlier part of the match to influence a later part of the +match. For instance, +.PP +.Vb 1 +\& /[ATGC]+(?(?<=AA)G|C)$/; +.Ve +.PP +matches a \s-1DNA\s0 sequence such that it either ends in \f(CW\*(C`AAG\*(C'\fR, or some +other base pair combination and \f(CW\*(AqC\*(Aq\fR. Note that the form is +\&\f(CW\*(C`(?(?<=AA)G|C)\*(C'\fR and not \f(CW\*(C`(?((?<=AA))G|C)\*(C'\fR; for the +lookahead, lookbehind or code assertions, the parentheses around the +conditional are not needed. +.SS "Defining named patterns" +.IX Subsection "Defining named patterns" +Some regular expressions use identical subpatterns in several places. +Starting with Perl 5.10, it is possible to define named subpatterns in +a section of the pattern so that they can be called up by name +anywhere in the pattern. This syntactic pattern for this definition +group is \f(CW\*(C`(?(DEFINE)(?<\f(CIname\f(CW>\f(CIpattern\f(CW)...)\*(C'\fR. An insertion +of a named pattern is written as \f(CW\*(C`(?&\f(CIname\f(CW)\*(C'\fR. +.PP +The example below illustrates this feature using the pattern for +floating point numbers that was presented earlier on. The three +subpatterns that are used more than once are the optional sign, the +digit sequence for an integer and the decimal fraction. The \f(CW\*(C`DEFINE\*(C'\fR +group at the end of the pattern contains their definition. Notice +that the decimal fraction pattern is the first place where we can +reuse the integer pattern. +.PP +.Vb 8 +\& /^ (?&osg)\e * ( (?&int)(?&dec)? | (?&dec) ) +\& (?: [eE](?&osg)(?&int) )? +\& $ +\& (?(DEFINE) +\& (?[\-+]?) # optional sign +\& (?\ed++) # integer +\& (?\e.(?&int)) # decimal fraction +\& )/x +.Ve +.SS "Recursive patterns" +.IX Subsection "Recursive patterns" +This feature (introduced in Perl 5.10) significantly extends the +power of Perl's pattern matching. By referring to some other +capture group anywhere in the pattern with the construct +\&\f(CW\*(C`(?\f(CIgroup\-ref\f(CW)\*(C'\fR, the \fIpattern\fR within the referenced group is used +as an independent subpattern in place of the group reference itself. +Because the group reference may be contained \fIwithin\fR the group it +refers to, it is now possible to apply pattern matching to tasks that +hitherto required a recursive parser. +.PP +To illustrate this feature, we'll design a pattern that matches if +a string contains a palindrome. (This is a word or a sentence that, +while ignoring spaces, interpunctuation and case, reads the same backwards +as forwards. We begin by observing that the empty string or a string +containing just one word character is a palindrome. Otherwise it must +have a word character up front and the same at its end, with another +palindrome in between. +.PP +.Vb 1 +\& /(?: (\ew) (?...Here be a palindrome...) \eg{\-1} | \ew? )/x +.Ve +.PP +Adding \f(CW\*(C`\eW*\*(C'\fR at either end to eliminate what is to be ignored, we already +have the full pattern: +.PP +.Vb 4 +\& my $pp = qr/^(\eW* (?: (\ew) (?1) \eg{\-1} | \ew? ) \eW*)$/ix; +\& for $s ( "saippuakauppias", "A man, a plan, a canal: Panama!" ){ +\& print "\*(Aq$s\*(Aq is a palindrome\en" if $s =~ /$pp/; +\& } +.Ve +.PP +In \f(CW\*(C`(?...)\*(C'\fR both absolute and relative backreferences may be used. +The entire pattern can be reinserted with \f(CW\*(C`(?R)\*(C'\fR or \f(CW\*(C`(?0)\*(C'\fR. +If you prefer to name your groups, you can use \f(CW\*(C`(?&\f(CIname\f(CW)\*(C'\fR to +recurse into that group. +.SS "A bit of magic: executing Perl code in a regular expression" +.IX Subsection "A bit of magic: executing Perl code in a regular expression" +Normally, regexps are a part of Perl expressions. +\&\fICode evaluation\fR expressions turn that around by allowing +arbitrary Perl code to be a part of a regexp. A code evaluation +expression is denoted \f(CW\*(C`(?{\f(CIcode\f(CW})\*(C'\fR, with \fIcode\fR a string of Perl +statements. +.PP +Code expressions are zero-width assertions, and the value they return +depends on their environment. There are two possibilities: either the +code expression is used as a conditional in a conditional expression +\&\f(CW\*(C`(?(\f(CIcondition\f(CW)...)\*(C'\fR, or it is not. If the code expression is a +conditional, the code is evaluated and the result (\fIi.e.\fR, the result of +the last statement) is used to determine truth or falsehood. If the +code expression is not used as a conditional, the assertion always +evaluates true and the result is put into the special variable +\&\f(CW$^R\fR. The variable \f(CW$^R\fR can then be used in code expressions later +in the regexp. Here are some silly examples: +.PP +.Vb 5 +\& $x = "abcdef"; +\& $x =~ /abc(?{print "Hi Mom!";})def/; # matches, +\& # prints \*(AqHi Mom!\*(Aq +\& $x =~ /aaa(?{print "Hi Mom!";})def/; # doesn\*(Aqt match, +\& # no \*(AqHi Mom!\*(Aq +.Ve +.PP +Pay careful attention to the next example: +.PP +.Vb 3 +\& $x =~ /abc(?{print "Hi Mom!";})ddd/; # doesn\*(Aqt match, +\& # no \*(AqHi Mom!\*(Aq +\& # but why not? +.Ve +.PP +At first glance, you'd think that it shouldn't print, because obviously +the \f(CW\*(C`ddd\*(C'\fR isn't going to match the target string. But look at this +example: +.PP +.Vb 2 +\& $x =~ /abc(?{print "Hi Mom!";})[dD]dd/; # doesn\*(Aqt match, +\& # but _does_ print +.Ve +.PP +Hmm. What happened here? If you've been following along, you know that +the above pattern should be effectively (almost) the same as the last one; +enclosing the \f(CW\*(Aqd\*(Aq\fR in a character class isn't going to change what it +matches. So why does the first not print while the second one does? +.PP +The answer lies in the optimizations the regexp engine makes. In the first +case, all the engine sees are plain old characters (aside from the +\&\f(CW\*(C`?{}\*(C'\fR construct). It's smart enough to realize that the string \f(CW\*(Aqddd\*(Aq\fR +doesn't occur in our target string before actually running the pattern +through. But in the second case, we've tricked it into thinking that our +pattern is more complicated. It takes a look, sees our +character class, and decides that it will have to actually run the +pattern to determine whether or not it matches, and in the process of +running it hits the print statement before it discovers that we don't +have a match. +.PP +To take a closer look at how the engine does optimizations, see the +section \*(L"Pragmas and debugging\*(R" below. +.PP +More fun with \f(CW\*(C`?{}\*(C'\fR: +.PP +.Vb 6 +\& $x =~ /(?{print "Hi Mom!";})/; # matches, +\& # prints \*(AqHi Mom!\*(Aq +\& $x =~ /(?{$c = 1;})(?{print "$c";})/; # matches, +\& # prints \*(Aq1\*(Aq +\& $x =~ /(?{$c = 1;})(?{print "$^R";})/; # matches, +\& # prints \*(Aq1\*(Aq +.Ve +.PP +The bit of magic mentioned in the section title occurs when the regexp +backtracks in the process of searching for a match. If the regexp +backtracks over a code expression and if the variables used within are +localized using \f(CW\*(C`local\*(C'\fR, the changes in the variables produced by the +code expression are undone! Thus, if we wanted to count how many times +a character got matched inside a group, we could use, \fIe.g.\fR, +.PP +.Vb 11 +\& $x = "aaaa"; +\& $count = 0; # initialize \*(Aqa\*(Aq count +\& $c = "bob"; # test if $c gets clobbered +\& $x =~ /(?{local $c = 0;}) # initialize count +\& ( a # match \*(Aqa\*(Aq +\& (?{local $c = $c + 1;}) # increment count +\& )* # do this any number of times, +\& aa # but match \*(Aqaa\*(Aq at the end +\& (?{$count = $c;}) # copy local $c var into $count +\& /x; +\& print "\*(Aqa\*(Aq count is $count, \e$c variable is \*(Aq$c\*(Aq\en"; +.Ve +.PP +This prints +.PP +.Vb 1 +\& \*(Aqa\*(Aq count is 2, $c variable is \*(Aqbob\*(Aq +.Ve +.PP +If we replace the \f(CW\*(C`\ (?{local\ $c\ =\ $c\ +\ 1;})\*(C'\fR with +\&\f(CW\*(C`\ (?{$c\ =\ $c\ +\ 1;})\*(C'\fR, the variable changes are \fInot\fR undone +during backtracking, and we get +.PP +.Vb 1 +\& \*(Aqa\*(Aq count is 4, $c variable is \*(Aqbob\*(Aq +.Ve +.PP +Note that only localized variable changes are undone. Other side +effects of code expression execution are permanent. Thus +.PP +.Vb 2 +\& $x = "aaaa"; +\& $x =~ /(a(?{print "Yow\en";}))*aa/; +.Ve +.PP +produces +.PP +.Vb 4 +\& Yow +\& Yow +\& Yow +\& Yow +.Ve +.PP +The result \f(CW$^R\fR is automatically localized, so that it will behave +properly in the presence of backtracking. +.PP +This example uses a code expression in a conditional to match a +definite article, either \f(CW\*(Aqthe\*(Aq\fR in English or \f(CW\*(Aqder|die|das\*(Aq\fR in +German: +.PP +.Vb 11 +\& $lang = \*(AqDE\*(Aq; # use German +\& ... +\& $text = "das"; +\& print "matched\en" +\& if $text =~ /(?(?{ +\& $lang eq \*(AqEN\*(Aq; # is the language English? +\& }) +\& the | # if so, then match \*(Aqthe\*(Aq +\& (der|die|das) # else, match \*(Aqder|die|das\*(Aq +\& ) +\& /xi; +.Ve +.PP +Note that the syntax here is \f(CW\*(C`(?(?{...})\f(CIyes\-regexp\f(CW|\f(CIno\-regexp\f(CW)\*(C'\fR, not +\&\f(CW\*(C`(?((?{...}))\f(CIyes\-regexp\f(CW|\f(CIno\-regexp\f(CW)\*(C'\fR. In other words, in the case of a +code expression, we don't need the extra parentheses around the +conditional. +.PP +If you try to use code expressions where the code text is contained within +an interpolated variable, rather than appearing literally in the pattern, +Perl may surprise you: +.PP +.Vb 5 +\& $bar = 5; +\& $pat = \*(Aq(?{ 1 })\*(Aq; +\& /foo(?{ $bar })bar/; # compiles ok, $bar not interpolated +\& /foo(?{ 1 })$bar/; # compiles ok, $bar interpolated +\& /foo${pat}bar/; # compile error! +\& +\& $pat = qr/(?{ $foo = 1 })/; # precompile code regexp +\& /foo${pat}bar/; # compiles ok +.Ve +.PP +If a regexp has a variable that interpolates a code expression, Perl +treats the regexp as an error. If the code expression is precompiled into +a variable, however, interpolating is ok. The question is, why is this an +error? +.PP +The reason is that variable interpolation and code expressions +together pose a security risk. The combination is dangerous because +many programmers who write search engines often take user input and +plug it directly into a regexp: +.PP +.Vb 3 +\& $regexp = <>; # read user\-supplied regexp +\& $chomp $regexp; # get rid of possible newline +\& $text =~ /$regexp/; # search $text for the $regexp +.Ve +.PP +If the \f(CW$regexp\fR variable contains a code expression, the user could +then execute arbitrary Perl code. For instance, some joker could +search for \f(CW\*(C`system(\*(Aqrm\ \-rf\ *\*(Aq);\*(C'\fR to erase your files. In this +sense, the combination of interpolation and code expressions \fItaints\fR +your regexp. So by default, using both interpolation and code +expressions in the same regexp is not allowed. If you're not +concerned about malicious users, it is possible to bypass this +security check by invoking \f(CW\*(C`use\ re\ \*(Aqeval\*(Aq\*(C'\fR: +.PP +.Vb 4 +\& use re \*(Aqeval\*(Aq; # throw caution out the door +\& $bar = 5; +\& $pat = \*(Aq(?{ 1 })\*(Aq; +\& /foo${pat}bar/; # compiles ok +.Ve +.PP +Another form of code expression is the \fIpattern code expression\fR. +The pattern code expression is like a regular code expression, except +that the result of the code evaluation is treated as a regular +expression and matched immediately. A simple example is +.PP +.Vb 4 +\& $length = 5; +\& $char = \*(Aqa\*(Aq; +\& $x = \*(Aqaaaaabb\*(Aq; +\& $x =~ /(??{$char x $length})/x; # matches, there are 5 of \*(Aqa\*(Aq +.Ve +.PP +This final example contains both ordinary and pattern code +expressions. It detects whether a binary string \f(CW1101010010001...\fR has a +Fibonacci spacing 0,1,1,2,3,5,... of the \f(CW\*(Aq1\*(Aq\fR's: +.PP +.Vb 12 +\& $x = "1101010010001000001"; +\& $z0 = \*(Aq\*(Aq; $z1 = \*(Aq0\*(Aq; # initial conditions +\& print "It is a Fibonacci sequence\en" +\& if $x =~ /^1 # match an initial \*(Aq1\*(Aq +\& (?: +\& ((??{ $z0 })) # match some \*(Aq0\*(Aq +\& 1 # and then a \*(Aq1\*(Aq +\& (?{ $z0 = $z1; $z1 .= $^N; }) +\& )+ # repeat as needed +\& $ # that is all there is +\& /x; +\& printf "Largest sequence matched was %d\en", length($z1)\-length($z0); +.Ve +.PP +Remember that \f(CW$^N\fR is set to whatever was matched by the last +completed capture group. This prints +.PP +.Vb 2 +\& It is a Fibonacci sequence +\& Largest sequence matched was 5 +.Ve +.PP +Ha! Try that with your garden variety regexp package... +.PP +Note that the variables \f(CW$z0\fR and \f(CW$z1\fR are not substituted when the +regexp is compiled, as happens for ordinary variables outside a code +expression. Rather, the whole code block is parsed as perl code at the +same time as perl is compiling the code containing the literal regexp +pattern. +.PP +This regexp without the \f(CW\*(C`/x\*(C'\fR modifier is +.PP +.Vb 1 +\& /^1(?:((??{ $z0 }))1(?{ $z0 = $z1; $z1 .= $^N; }))+$/ +.Ve +.PP +which shows that spaces are still possible in the code parts. Nevertheless, +when working with code and conditional expressions, the extended form of +regexps is almost necessary in creating and debugging regexps. +.SS "Backtracking control verbs" +.IX Subsection "Backtracking control verbs" +Perl 5.10 introduced a number of control verbs intended to provide +detailed control over the backtracking process, by directly influencing +the regexp engine and by providing monitoring techniques. See +\&\*(L"Special Backtracking Control Verbs\*(R" in perlre for a detailed +description. +.PP +Below is just one example, illustrating the control verb \f(CW\*(C`(*FAIL)\*(C'\fR, +which may be abbreviated as \f(CW\*(C`(*F)\*(C'\fR. If this is inserted in a regexp +it will cause it to fail, just as it would at some +mismatch between the pattern and the string. Processing +of the regexp continues as it would after any \*(L"normal\*(R" +failure, so that, for instance, the next position in the string or another +alternative will be tried. As failing to match doesn't preserve capture +groups or produce results, it may be necessary to use this in +combination with embedded code. +.PP +.Vb 4 +\& %count = (); +\& "supercalifragilisticexpialidocious" =~ +\& /([aeiou])(?{ $count{$1}++; })(*FAIL)/i; +\& printf "%3d \*(Aq%s\*(Aq\en", $count{$_}, $_ for (sort keys %count); +.Ve +.PP +The pattern begins with a class matching a subset of letters. Whenever +this matches, a statement like \f(CW\*(C`$count{\*(Aqa\*(Aq}++;\*(C'\fR is executed, incrementing +the letter's counter. Then \f(CW\*(C`(*FAIL)\*(C'\fR does what it says, and +the regexp engine proceeds according to the book: as long as the end of +the string hasn't been reached, the position is advanced before looking +for another vowel. Thus, match or no match makes no difference, and the +regexp engine proceeds until the entire string has been inspected. +(It's remarkable that an alternative solution using something like +.PP +.Vb 2 +\& $count{lc($_)}++ for split(\*(Aq\*(Aq, "supercalifragilisticexpialidocious"); +\& printf "%3d \*(Aq%s\*(Aq\en", $count2{$_}, $_ for ( qw{ a e i o u } ); +.Ve +.PP +is considerably slower.) +.SS "Pragmas and debugging" +.IX Subsection "Pragmas and debugging" +Speaking of debugging, there are several pragmas available to control +and debug regexps in Perl. We have already encountered one pragma in +the previous section, \f(CW\*(C`use\ re\ \*(Aqeval\*(Aq;\*(C'\fR, that allows variable +interpolation and code expressions to coexist in a regexp. The other +pragmas are +.PP +.Vb 3 +\& use re \*(Aqtaint\*(Aq; +\& $tainted = <>; +\& @parts = ($tainted =~ /(\ew+)\es+(\ew+)/; # @parts is now tainted +.Ve +.PP +The \f(CW\*(C`taint\*(C'\fR pragma causes any substrings from a match with a tainted +variable to be tainted as well. This is not normally the case, as +regexps are often used to extract the safe bits from a tainted +variable. Use \f(CW\*(C`taint\*(C'\fR when you are not extracting safe bits, but are +performing some other processing. Both \f(CW\*(C`taint\*(C'\fR and \f(CW\*(C`eval\*(C'\fR pragmas +are lexically scoped, which means they are in effect only until +the end of the block enclosing the pragmas. +.PP +.Vb 2 +\& use re \*(Aq/m\*(Aq; # or any other flags +\& $multiline_string =~ /^foo/; # /m is implied +.Ve +.PP +The \f(CW\*(C`re \*(Aq/flags\*(Aq\*(C'\fR pragma (introduced in Perl +5.14) turns on the given regular expression flags +until the end of the lexical scope. See +\&\*(L"'/flags' mode\*(R" in re for more +detail. +.PP +.Vb 2 +\& use re \*(Aqdebug\*(Aq; +\& /^(.*)$/s; # output debugging info +\& +\& use re \*(Aqdebugcolor\*(Aq; +\& /^(.*)$/s; # output debugging info in living color +.Ve +.PP +The global \f(CW\*(C`debug\*(C'\fR and \f(CW\*(C`debugcolor\*(C'\fR pragmas allow one to get +detailed debugging info about regexp compilation and +execution. \f(CW\*(C`debugcolor\*(C'\fR is the same as debug, except the debugging +information is displayed in color on terminals that can display +termcap color sequences. Here is example output: +.PP +.Vb 10 +\& % perl \-e \*(Aquse re "debug"; "abc" =~ /a*b+c/;\*(Aq +\& Compiling REx \*(Aqa*b+c\*(Aq +\& size 9 first at 1 +\& 1: STAR(4) +\& 2: EXACT (0) +\& 4: PLUS(7) +\& 5: EXACT (0) +\& 7: EXACT (9) +\& 9: END(0) +\& floating \*(Aqbc\*(Aq at 0..2147483647 (checking floating) minlen 2 +\& Guessing start of match, REx \*(Aqa*b+c\*(Aq against \*(Aqabc\*(Aq... +\& Found floating substr \*(Aqbc\*(Aq at offset 1... +\& Guessed: match at offset 0 +\& Matching REx \*(Aqa*b+c\*(Aq against \*(Aqabc\*(Aq +\& Setting an EVAL scope, savestack=3 +\& 0 <> | 1: STAR +\& EXACT can match 1 times out of 32767... +\& Setting an EVAL scope, savestack=3 +\& 1 | 4: PLUS +\& EXACT can match 1 times out of 32767... +\& Setting an EVAL scope, savestack=3 +\& 2 | 7: EXACT +\& 3 <> | 9: END +\& Match successful! +\& Freeing REx: \*(Aqa*b+c\*(Aq +.Ve +.PP +If you have gotten this far into the tutorial, you can probably guess +what the different parts of the debugging output tell you. The first +part +.PP +.Vb 8 +\& Compiling REx \*(Aqa*b+c\*(Aq +\& size 9 first at 1 +\& 1: STAR(4) +\& 2: EXACT (0) +\& 4: PLUS(7) +\& 5: EXACT (0) +\& 7: EXACT (9) +\& 9: END(0) +.Ve +.PP +describes the compilation stage. \f(CWSTAR(4)\fR means that there is a +starred object, in this case \f(CW\*(Aqa\*(Aq\fR, and if it matches, goto line 4, +\&\fIi.e.\fR, \f(CWPLUS(7)\fR. The middle lines describe some heuristics and +optimizations performed before a match: +.PP +.Vb 4 +\& floating \*(Aqbc\*(Aq at 0..2147483647 (checking floating) minlen 2 +\& Guessing start of match, REx \*(Aqa*b+c\*(Aq against \*(Aqabc\*(Aq... +\& Found floating substr \*(Aqbc\*(Aq at offset 1... +\& Guessed: match at offset 0 +.Ve +.PP +Then the match is executed and the remaining lines describe the +process: +.PP +.Vb 12 +\& Matching REx \*(Aqa*b+c\*(Aq against \*(Aqabc\*(Aq +\& Setting an EVAL scope, savestack=3 +\& 0 <> | 1: STAR +\& EXACT can match 1 times out of 32767... +\& Setting an EVAL scope, savestack=3 +\& 1 | 4: PLUS +\& EXACT can match 1 times out of 32767... +\& Setting an EVAL scope, savestack=3 +\& 2 | 7: EXACT +\& 3 <> | 9: END +\& Match successful! +\& Freeing REx: \*(Aqa*b+c\*(Aq +.Ve +.PP +Each step is of the form \f(CW\*(C`n\ \ \*(C'\fR, with \f(CW\*(C`\*(C'\fR the +part of the string matched and \f(CW\*(C`\*(C'\fR the part not yet +matched. The \f(CW\*(C`|\ \ 1:\ \ STAR\*(C'\fR says that Perl is at line number 1 +in the compilation list above. See +\&\*(L"Debugging Regular Expressions\*(R" in perldebguts for much more detail. +.PP +An alternative method of debugging regexps is to embed \f(CW\*(C`print\*(C'\fR +statements within the regexp. This provides a blow-by-blow account of +the backtracking in an alternation: +.PP +.Vb 12 +\& "that this" =~ m@(?{print "Start at position ", pos, "\en";}) +\& t(?{print "t1\en";}) +\& h(?{print "h1\en";}) +\& i(?{print "i1\en";}) +\& s(?{print "s1\en";}) +\& | +\& t(?{print "t2\en";}) +\& h(?{print "h2\en";}) +\& a(?{print "a2\en";}) +\& t(?{print "t2\en";}) +\& (?{print "Done at position ", pos, "\en";}) +\& @x; +.Ve +.PP +prints +.PP +.Vb 8 +\& Start at position 0 +\& t1 +\& h1 +\& t2 +\& h2 +\& a2 +\& t2 +\& Done at position 4 +.Ve +.SH "SEE ALSO" +.IX Header "SEE ALSO" +This is just a tutorial. For the full story on Perl regular +expressions, see the perlre regular expressions reference page. +.PP +For more information on the matching \f(CW\*(C`m//\*(C'\fR and substitution \f(CW\*(C`s///\*(C'\fR +operators, see \*(L"Regexp Quote-Like Operators\*(R" in perlop. For +information on the \f(CW\*(C`split\*(C'\fR operation, see \*(L"split\*(R" in perlfunc. +.PP +For an excellent all-around resource on the care and feeding of +regular expressions, see the book \fIMastering Regular Expressions\fR by +Jeffrey Friedl (published by O'Reilly, \s-1ISBN 1556592\-257\-3\s0). +.SH "AUTHOR AND COPYRIGHT" +.IX Header "AUTHOR AND COPYRIGHT" +Copyright (c) 2000 Mark Kvale. +All rights reserved. +Now maintained by Perl porters. +.PP +This document may be distributed under the same terms as Perl itself. +.SS "Acknowledgments" +.IX Subsection "Acknowledgments" +The inspiration for the stop codon \s-1DNA\s0 example came from the \s-1ZIP\s0 +code example in chapter 7 of \fIMastering Regular Expressions\fR. +.PP +The author would like to thank Jeff Pinyan, Andrew Johnson, Peter +Haworth, Ronald J Kimball, and Joe Smith for all their helpful +comments. diff --git a/data/miniconda3/man/man1/perlriscos.1 b/data/miniconda3/man/man1/perlriscos.1 new file mode 100644 index 0000000000000000000000000000000000000000..0ead58cf60aff28c01c8c2b9405b025c6ac640fa --- /dev/null +++ b/data/miniconda3/man/man1/perlriscos.1 @@ -0,0 +1,187 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLRISCOS 1" +.TH PERLRISCOS 1 "2020-12-18" "perl v5.32.1" "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" +perlriscos \- Perl version 5 for RISC OS +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document gives instructions for building Perl for \s-1RISC OS.\s0 It is +complicated by the need to cross compile. There is a binary version of +perl available from which you may wish to +use instead of trying to compile it yourself. +.SH "BUILD" +.IX Header "BUILD" +You need an installed and working gccsdk cross compiler + and \s-1REXEN\s0 + +.PP +Firstly, copy the source and build a native copy of perl for your host +system. +Then, in the source to be cross compiled: +.IP "1." 4 +.Vb 1 +\& $ ./Configure +.Ve +.IP "2." 4 +Select the riscos hint file. The default answers for the rest of the +questions are usually sufficient. +.Sp +Note that, if you wish to run Configure non-interactively (see the \s-1INSTALL\s0 +document for details), to have it select the correct hint file, you'll +need to provide the argument \-Dhintfile=riscos on the Configure +command-line. +.IP "3." 4 +.Vb 1 +\& $ make miniperl +.Ve +.IP "4." 4 +This should build miniperl and then fail when it tries to run it. +.IP "5." 4 +Copy the miniperl executable from the native build done earlier to +replace the cross compiled miniperl. +.IP "6." 4 +.Vb 1 +\& $ make +.Ve +.IP "7." 4 +This will use miniperl to complete the rest of the build. +.SH "AUTHOR" +.IX Header "AUTHOR" +Alex Waugh diff --git a/data/miniconda3/man/man1/perlsec.1 b/data/miniconda3/man/man1/perlsec.1 new file mode 100644 index 0000000000000000000000000000000000000000..c54ce9c45431ea82bc6b4c565492f54b4bbe34ae --- /dev/null +++ b/data/miniconda3/man/man1/perlsec.1 @@ -0,0 +1,746 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLSEC 1" +.TH PERLSEC 1 "2020-12-26" "perl v5.32.1" "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" +perlsec \- Perl security +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Perl is designed to make it easy to program securely even when running +with extra privileges, like setuid or setgid programs. Unlike most +command line shells, which are based on multiple substitution passes on +each line of the script, Perl uses a more conventional evaluation scheme +with fewer hidden snags. Additionally, because the language has more +builtin functionality, it can rely less upon external (and possibly +untrustworthy) programs to accomplish its purposes. +.SH "SECURITY VULNERABILITY CONTACT INFORMATION" +.IX Header "SECURITY VULNERABILITY CONTACT INFORMATION" +If you believe you have found a security vulnerability in the Perl +interpreter or modules maintained in the core Perl codebase, +email the details to +perl\-security@perl.org . +This address is a closed membership mailing list monitored by the Perl +security team. +.PP +See perlsecpolicy for additional information. +.SH "SECURITY MECHANISMS AND CONCERNS" +.IX Header "SECURITY MECHANISMS AND CONCERNS" +.SS "Taint mode" +.IX Subsection "Taint mode" +Perl automatically enables a set of special security checks, called \fItaint +mode\fR, when it detects its program running with differing real and effective +user or group IDs. The setuid bit in Unix permissions is mode 04000, the +setgid bit mode 02000; either or both may be set. You can also enable taint +mode explicitly by using the \fB\-T\fR command line flag. This flag is +\&\fIstrongly\fR suggested for server programs and any program run on behalf of +someone else, such as a \s-1CGI\s0 script. Once taint mode is on, it's on for +the remainder of your script. +.PP +While in this mode, Perl takes special precautions called \fItaint +checks\fR to prevent both obvious and subtle traps. Some of these checks +are reasonably simple, such as verifying that path directories aren't +writable by others; careful programmers have always used checks like +these. Other checks, however, are best supported by the language itself, +and it is these checks especially that contribute to making a set-id Perl +program more secure than the corresponding C program. +.PP +You may not use data derived from outside your program to affect +something else outside your program\*(--at least, not by accident. All +command line arguments, environment variables, locale information (see +perllocale), results of certain system calls (\f(CW\*(C`readdir()\*(C'\fR, +\&\f(CW\*(C`readlink()\*(C'\fR, the variable of \f(CW\*(C`shmread()\*(C'\fR, the messages returned by +\&\f(CW\*(C`msgrcv()\*(C'\fR, the password, gcos and shell fields returned by the +\&\f(CW\*(C`getpwxxx()\*(C'\fR calls), and all file input are marked as \*(L"tainted\*(R". +Tainted data may not be used directly or indirectly in any command +that invokes a sub-shell, nor in any command that modifies files, +directories, or processes, \fBwith the following exceptions\fR: +.IP "\(bu" 4 +Arguments to \f(CW\*(C`print\*(C'\fR and \f(CW\*(C`syswrite\*(C'\fR are \fBnot\fR checked for taintedness. +.IP "\(bu" 4 +Symbolic methods +.Sp +.Vb 1 +\& $obj\->$method(@args); +.Ve +.Sp +and symbolic sub references +.Sp +.Vb 2 +\& &{$foo}(@args); +\& $foo\->(@args); +.Ve +.Sp +are not checked for taintedness. This requires extra carefulness +unless you want external data to affect your control flow. Unless +you carefully limit what these symbolic values are, people are able +to call functions \fBoutside\fR your Perl code, such as POSIX::system, +in which case they are able to run arbitrary external code. +.IP "\(bu" 4 +Hash keys are \fBnever\fR tainted. +.PP +For efficiency reasons, Perl takes a conservative view of +whether data is tainted. If an expression contains tainted data, +any subexpression may be considered tainted, even if the value +of the subexpression is not itself affected by the tainted data. +.PP +Because taintedness is associated with each scalar value, some +elements of an array or hash can be tainted and others not. +The keys of a hash are \fBnever\fR tainted. +.PP +For example: +.PP +.Vb 8 +\& $arg = shift; # $arg is tainted +\& $hid = $arg . \*(Aqbar\*(Aq; # $hid is also tainted +\& $line = <>; # Tainted +\& $line = ; # Also tainted +\& open FOO, "/home/me/bar" or die $!; +\& $line = ; # Still tainted +\& $path = $ENV{\*(AqPATH\*(Aq}; # Tainted, but see below +\& $data = \*(Aqabc\*(Aq; # Not tainted +\& +\& system "echo $arg"; # Insecure +\& system "/bin/echo", $arg; # Considered insecure +\& # (Perl doesn\*(Aqt know about /bin/echo) +\& system "echo $hid"; # Insecure +\& system "echo $data"; # Insecure until PATH set +\& +\& $path = $ENV{\*(AqPATH\*(Aq}; # $path now tainted +\& +\& $ENV{\*(AqPATH\*(Aq} = \*(Aq/bin:/usr/bin\*(Aq; +\& delete @ENV{\*(AqIFS\*(Aq, \*(AqCDPATH\*(Aq, \*(AqENV\*(Aq, \*(AqBASH_ENV\*(Aq}; +\& +\& $path = $ENV{\*(AqPATH\*(Aq}; # $path now NOT tainted +\& system "echo $data"; # Is secure now! +\& +\& open(FOO, "< $arg"); # OK \- read\-only file +\& open(FOO, "> $arg"); # Not OK \- trying to write +\& +\& open(FOO,"echo $arg|"); # Not OK +\& open(FOO,"\-|") +\& or exec \*(Aqecho\*(Aq, $arg; # Also not OK +\& +\& $shout = \`echo $arg\`; # Insecure, $shout now tainted +\& +\& unlink $data, $arg; # Insecure +\& umask $arg; # Insecure +\& +\& exec "echo $arg"; # Insecure +\& exec "echo", $arg; # Insecure +\& exec "sh", \*(Aq\-c\*(Aq, $arg; # Very insecure! +\& +\& @files = <*.c>; # insecure (uses readdir() or similar) +\& @files = glob(\*(Aq*.c\*(Aq); # insecure (uses readdir() or similar) +\& +\& # In either case, the results of glob are tainted, since the list of +\& # filenames comes from outside of the program. +\& +\& $bad = ($arg, 23); # $bad will be tainted +\& $arg, \`true\`; # Insecure (although it isn\*(Aqt really) +.Ve +.PP +If you try to do something insecure, you will get a fatal error saying +something like \*(L"Insecure dependency\*(R" or \*(L"Insecure \f(CW$ENV\fR{\s-1PATH\s0}\*(R". +.PP +The exception to the principle of \*(L"one tainted value taints the whole +expression\*(R" is with the ternary conditional operator \f(CW\*(C`?:\*(C'\fR. Since code +with a ternary conditional +.PP +.Vb 1 +\& $result = $tainted_value ? "Untainted" : "Also untainted"; +.Ve +.PP +is effectively +.PP +.Vb 5 +\& if ( $tainted_value ) { +\& $result = "Untainted"; +\& } else { +\& $result = "Also untainted"; +\& } +.Ve +.PP +it doesn't make sense for \f(CW$result\fR to be tainted. +.SS "Laundering and Detecting Tainted Data" +.IX Subsection "Laundering and Detecting Tainted Data" +To test whether a variable contains tainted data, and whose use would +thus trigger an \*(L"Insecure dependency\*(R" message, you can use the +\&\f(CW\*(C`tainted()\*(C'\fR function of the Scalar::Util module, available in your +nearby \s-1CPAN\s0 mirror, and included in Perl starting from the release 5.8.0. +Or you may be able to use the following \f(CW\*(C`is_tainted()\*(C'\fR function. +.PP +.Vb 4 +\& sub is_tainted { +\& local $@; # Don\*(Aqt pollute caller\*(Aqs value. +\& return ! eval { eval("#" . substr(join("", @_), 0, 0)); 1 }; +\& } +.Ve +.PP +This function makes use of the fact that the presence of tainted data +anywhere within an expression renders the entire expression tainted. It +would be inefficient for every operator to test every argument for +taintedness. Instead, the slightly more efficient and conservative +approach is used that if any tainted value has been accessed within the +same expression, the whole expression is considered tainted. +.PP +But testing for taintedness gets you only so far. Sometimes you have just +to clear your data's taintedness. Values may be untainted by using them +as keys in a hash; otherwise the only way to bypass the tainting +mechanism is by referencing subpatterns from a regular expression match. +Perl presumes that if you reference a substring using \f(CW$1\fR, \f(CW$2\fR, etc. in a +non-tainting pattern, that +you knew what you were doing when you wrote that pattern. That means using +a bit of thought\*(--don't just blindly untaint anything, or you defeat the +entire mechanism. It's better to verify that the variable has only good +characters (for certain values of \*(L"good\*(R") rather than checking whether it +has any bad characters. That's because it's far too easy to miss bad +characters that you never thought of. +.PP +Here's a test to make sure that the data contains nothing but \*(L"word\*(R" +characters (alphabetics, numerics, and underscores), a hyphen, an at sign, +or a dot. +.PP +.Vb 5 +\& if ($data =~ /^([\-\e@\ew.]+)$/) { +\& $data = $1; # $data now untainted +\& } else { +\& die "Bad data in \*(Aq$data\*(Aq"; # log this somewhere +\& } +.Ve +.PP +This is fairly secure because \f(CW\*(C`/\ew+/\*(C'\fR doesn't normally match shell +metacharacters, nor are dot, dash, or at going to mean something special +to the shell. Use of \f(CW\*(C`/.+/\*(C'\fR would have been insecure in theory because +it lets everything through, but Perl doesn't check for that. The lesson +is that when untainting, you must be exceedingly careful with your patterns. +Laundering data using regular expression is the \fIonly\fR mechanism for +untainting dirty data, unless you use the strategy detailed below to fork +a child of lesser privilege. +.PP +The example does not untaint \f(CW$data\fR if \f(CW\*(C`use locale\*(C'\fR is in effect, +because the characters matched by \f(CW\*(C`\ew\*(C'\fR are determined by the locale. +Perl considers that locale definitions are untrustworthy because they +contain data from outside the program. If you are writing a +locale-aware program, and want to launder data with a regular expression +containing \f(CW\*(C`\ew\*(C'\fR, put \f(CW\*(C`no locale\*(C'\fR ahead of the expression in the same +block. See \*(L"\s-1SECURITY\*(R"\s0 in perllocale for further discussion and examples. +.ie n .SS "Switches On the ""#!"" Line" +.el .SS "Switches On the ``#!'' Line" +.IX Subsection "Switches On the #! Line" +When you make a script executable, in order to make it usable as a +command, the system will pass switches to perl from the script's #! +line. Perl checks that any command line switches given to a setuid +(or setgid) script actually match the ones set on the #! line. Some +Unix and Unix-like environments impose a one-switch limit on the #! +line, so you may need to use something like \f(CW\*(C`\-wU\*(C'\fR instead of \f(CW\*(C`\-w \-U\*(C'\fR +under such systems. (This issue should arise only in Unix or +Unix-like environments that support #! and setuid or setgid scripts.) +.ie n .SS "Taint mode and @INC" +.el .SS "Taint mode and \f(CW@INC\fP" +.IX Subsection "Taint mode and @INC" +When the taint mode (\f(CW\*(C`\-T\*(C'\fR) is in effect, the environment variables +\&\f(CW\*(C`PERL5LIB\*(C'\fR and \f(CW\*(C`PERLLIB\*(C'\fR +are ignored by Perl. You can still adjust \f(CW@INC\fR from outside the +program by using the \f(CW\*(C`\-I\*(C'\fR command line option as explained in +perlrun. The two environment variables are +ignored because they are obscured, and a user running a program could +be unaware that they are set, whereas the \f(CW\*(C`\-I\*(C'\fR option is clearly +visible and therefore permitted. +.PP +Another way to modify \f(CW@INC\fR without modifying the program, is to use +the \f(CW\*(C`lib\*(C'\fR pragma, e.g.: +.PP +.Vb 1 +\& perl \-Mlib=/foo program +.Ve +.PP +The benefit of using \f(CW\*(C`\-Mlib=/foo\*(C'\fR over \f(CW\*(C`\-I/foo\*(C'\fR, is that the former +will automagically remove any duplicated directories, while the latter +will not. +.PP +Note that if a tainted string is added to \f(CW@INC\fR, the following +problem will be reported: +.PP +.Vb 1 +\& Insecure dependency in require while running with \-T switch +.Ve +.PP +On versions of Perl before 5.26, activating taint mode will also remove +the current directory (\*(L".\*(R") from the default value of \f(CW@INC\fR. Since +version 5.26, the current directory isn't included in \f(CW@INC\fR by +default. +.SS "Cleaning Up Your Path" +.IX Subsection "Cleaning Up Your Path" +For "Insecure \f(CW$ENV{PATH}\fR" messages, you need to set \f(CW$ENV{\*(AqPATH\*(Aq}\fR to +a known value, and each directory in the path must be absolute and +non-writable by others than its owner and group. You may be surprised to +get this message even if the pathname to your executable is fully +qualified. This is \fInot\fR generated because you didn't supply a full path +to the program; instead, it's generated because you never set your \s-1PATH\s0 +environment variable, or you didn't set it to something that was safe. +Because Perl can't guarantee that the executable in question isn't itself +going to turn around and execute some other program that is dependent on +your \s-1PATH,\s0 it makes sure you set the \s-1PATH.\s0 +.PP +The \s-1PATH\s0 isn't the only environment variable which can cause problems. +Because some shells may use the variables \s-1IFS, CDPATH, ENV,\s0 and +\&\s-1BASH_ENV,\s0 Perl checks that those are either empty or untainted when +starting subprocesses. You may wish to add something like this to your +setid and taint-checking scripts. +.PP +.Vb 1 +\& delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer +.Ve +.PP +It's also possible to get into trouble with other operations that don't +care whether they use tainted values. Make judicious use of the file +tests in dealing with any user-supplied filenames. When possible, do +opens and such \fBafter\fR properly dropping any special user (or group!) +privileges. Perl doesn't prevent you from +opening tainted filenames for reading, +so be careful what you print out. The tainting mechanism is intended to +prevent stupid mistakes, not to remove the need for thought. +.PP +Perl does not call the shell to expand wild cards when you pass \f(CW\*(C`system\*(C'\fR +and \f(CW\*(C`exec\*(C'\fR explicit parameter lists instead of strings with possible shell +wildcards in them. Unfortunately, the \f(CW\*(C`open\*(C'\fR, \f(CW\*(C`glob\*(C'\fR, and +backtick functions provide no such alternate calling convention, so more +subterfuge will be required. +.PP +Perl provides a reasonably safe way to open a file or pipe from a setuid +or setgid program: just create a child process with reduced privilege who +does the dirty work for you. First, fork a child using the special +\&\f(CW\*(C`open\*(C'\fR syntax that connects the parent and child by a pipe. Now the +child resets its \s-1ID\s0 set and any other per-process attributes, like +environment variables, umasks, current working directories, back to the +originals or known safe values. Then the child process, which no longer +has any special permissions, does the \f(CW\*(C`open\*(C'\fR or other system call. +Finally, the child passes the data it managed to access back to the +parent. Because the file or pipe was opened in the child while running +under less privilege than the parent, it's not apt to be tricked into +doing something it shouldn't. +.PP +Here's a way to do backticks reasonably safely. Notice how the \f(CW\*(C`exec\*(C'\fR is +not called with a string that the shell could expand. This is by far the +best way to call something that might be subjected to shell escapes: just +never call the shell at all. +.PP +.Vb 10 +\& use English; +\& die "Can\*(Aqt fork: $!" unless defined($pid = open(KID, "\-|")); +\& if ($pid) { # parent +\& while () { +\& # do something +\& } +\& close KID; +\& } else { +\& my @temp = ($EUID, $EGID); +\& my $orig_uid = $UID; +\& my $orig_gid = $GID; +\& $EUID = $UID; +\& $EGID = $GID; +\& # Drop privileges +\& $UID = $orig_uid; +\& $GID = $orig_gid; +\& # Make sure privs are really gone +\& ($EUID, $EGID) = @temp; +\& die "Can\*(Aqt drop privileges" +\& unless $UID == $EUID && $GID eq $EGID; +\& $ENV{PATH} = "/bin:/usr/bin"; # Minimal PATH. +\& # Consider sanitizing the environment even more. +\& exec \*(Aqmyprog\*(Aq, \*(Aqarg1\*(Aq, \*(Aqarg2\*(Aq +\& or die "can\*(Aqt exec myprog: $!"; +\& } +.Ve +.PP +A similar strategy would work for wildcard expansion via \f(CW\*(C`glob\*(C'\fR, although +you can use \f(CW\*(C`readdir\*(C'\fR instead. +.PP +Taint checking is most useful when although you trust yourself not to have +written a program to give away the farm, you don't necessarily trust those +who end up using it not to try to trick it into doing something bad. This +is the kind of security checking that's useful for set-id programs and +programs launched on someone else's behalf, like \s-1CGI\s0 programs. +.PP +This is quite different, however, from not even trusting the writer of the +code not to try to do something evil. That's the kind of trust needed +when someone hands you a program you've never seen before and says, \*(L"Here, +run this.\*(R" For that kind of safety, you might want to check out the Safe +module, included standard in the Perl distribution. This module allows the +programmer to set up special compartments in which all system operations +are trapped and namespace access is carefully controlled. Safe should +not be considered bullet-proof, though: it will not prevent the foreign +code to set up infinite loops, allocate gigabytes of memory, or even +abusing perl bugs to make the host interpreter crash or behave in +unpredictable ways. In any case it's better avoided completely if you're +really concerned about security. +.SS "Shebang Race Condition" +.IX Subsection "Shebang Race Condition" +Beyond the obvious problems that stem from giving special privileges to +systems as flexible as scripts, on many versions of Unix, set-id scripts +are inherently insecure right from the start. The problem is a race +condition in the kernel. Between the time the kernel opens the file to +see which interpreter to run and when the (now-set-id) interpreter turns +around and reopens the file to interpret it, the file in question may have +changed, especially if you have symbolic links on your system. +.PP +Some Unixes, especially more recent ones, are free of this +inherent security bug. On such systems, when the kernel passes the name +of the set-id script to open to the interpreter, rather than using a +pathname subject to meddling, it instead passes \fI/dev/fd/3\fR. This is a +special file already opened on the script, so that there can be no race +condition for evil scripts to exploit. On these systems, Perl should be +compiled with \f(CW\*(C`\-DSETUID_SCRIPTS_ARE_SECURE_NOW\*(C'\fR. The \fIConfigure\fR +program that builds Perl tries to figure this out for itself, so you +should never have to specify this yourself. Most modern releases of +SysVr4 and \s-1BSD 4.4\s0 use this approach to avoid the kernel race condition. +.PP +If you don't have the safe version of set-id scripts, all is not lost. +Sometimes this kernel \*(L"feature\*(R" can be disabled, so that the kernel +either doesn't run set-id scripts with the set-id or doesn't run them +at all. Either way avoids the exploitability of the race condition, +but doesn't help in actually running scripts set-id. +.PP +If the kernel set-id script feature isn't disabled, then any set-id +script provides an exploitable vulnerability. Perl can't avoid being +exploitable, but will point out vulnerable scripts where it can. If Perl +detects that it is being applied to a set-id script then it will complain +loudly that your set-id script is insecure, and won't run it. When Perl +complains, you need to remove the set-id bit from the script to eliminate +the vulnerability. Refusing to run the script doesn't in itself close +the vulnerability; it is just Perl's way of encouraging you to do this. +.PP +To actually run a script set-id, if you don't have the safe version of +set-id scripts, you'll need to put a C wrapper around +the script. A C wrapper is just a compiled program that does nothing +except call your Perl program. Compiled programs are not subject to the +kernel bug that plagues set-id scripts. Here's a simple wrapper, written +in C: +.PP +.Vb 4 +\& #include +\& #include +\& #include +\& #include +\& +\& #define REAL_PATH "/path/to/script" +\& +\& int main(int argc, char **argv) +\& { +\& execv(REAL_PATH, argv); +\& fprintf(stderr, "%s: %s: %s\en", +\& argv[0], REAL_PATH, strerror(errno)); +\& return 127; +\& } +.Ve +.PP +Compile this wrapper into a binary executable and then make \fIit\fR rather +than your script setuid or setgid. Note that this wrapper isn't doing +anything to sanitise the execution environment other than ensuring +that a safe path to the script is used. It only avoids the shebang +race condition. It relies on Perl's own features, and on the script +itself being careful, to make it safe enough to run the script set-id. +.SS "Protecting Your Programs" +.IX Subsection "Protecting Your Programs" +There are a number of ways to hide the source to your Perl programs, +with varying levels of \*(L"security\*(R". +.PP +First of all, however, you \fIcan't\fR take away read permission, because +the source code has to be readable in order to be compiled and +interpreted. (That doesn't mean that a \s-1CGI\s0 script's source is +readable by people on the web, though.) So you have to leave the +permissions at the socially friendly 0755 level. This lets +people on your local system only see your source. +.PP +Some people mistakenly regard this as a security problem. If your program does +insecure things, and relies on people not knowing how to exploit those +insecurities, it is not secure. It is often possible for someone to +determine the insecure things and exploit them without viewing the +source. Security through obscurity, the name for hiding your bugs +instead of fixing them, is little security indeed. +.PP +You can try using encryption via source filters (Filter::* from \s-1CPAN,\s0 +or Filter::Util::Call and Filter::Simple since Perl 5.8). +But crackers might be able to decrypt it. You can try using the byte +code compiler and interpreter described below, but crackers might be +able to de-compile it. You can try using the native-code compiler +described below, but crackers might be able to disassemble it. These +pose varying degrees of difficulty to people wanting to get at your +code, but none can definitively conceal it (this is true of every +language, not just Perl). +.PP +If you're concerned about people profiting from your code, then the +bottom line is that nothing but a restrictive license will give you +legal security. License your software and pepper it with threatening +statements like \*(L"This is unpublished proprietary software of \s-1XYZ\s0 Corp. +Your access to it does not give you permission to use it blah blah +blah.\*(R" You should see a lawyer to be sure your license's wording will +stand up in court. +.SS "Unicode" +.IX Subsection "Unicode" +Unicode is a new and complex technology and one may easily overlook +certain security pitfalls. See perluniintro for an overview and +perlunicode for details, and \*(L"Security Implications +of Unicode\*(R" in perlunicode for security implications in particular. +.SS "Algorithmic Complexity Attacks" +.IX Subsection "Algorithmic Complexity Attacks" +Certain internal algorithms used in the implementation of Perl can +be attacked by choosing the input carefully to consume large amounts +of either time or space or both. This can lead into the so-called +\&\fIDenial of Service\fR (DoS) attacks. +.IP "\(bu" 4 +Hash Algorithm \- Hash algorithms like the one used in Perl are well +known to be vulnerable to collision attacks on their hash function. +Such attacks involve constructing a set of keys which collide into +the same bucket producing inefficient behavior. Such attacks often +depend on discovering the seed of the hash function used to map the +keys to buckets. That seed is then used to brute-force a key set which +can be used to mount a denial of service attack. In Perl 5.8.1 changes +were introduced to harden Perl to such attacks, and then later in +Perl 5.18.0 these features were enhanced and additional protections +added. +.Sp +At the time of this writing, Perl 5.18.0 is considered to be +well-hardened against algorithmic complexity attacks on its hash +implementation. This is largely owed to the following measures +mitigate attacks: +.RS 4 +.IP "Hash Seed Randomization" 4 +.IX Item "Hash Seed Randomization" +In order to make it impossible to know what seed to generate an attack +key set for, this seed is randomly initialized at process start. This +may be overridden by using the \s-1PERL_HASH_SEED\s0 environment variable, see +\&\*(L"\s-1PERL_HASH_SEED\*(R"\s0 in perlrun. This environment variable controls how +items are actually stored, not how they are presented via +\&\f(CW\*(C`keys\*(C'\fR, \f(CW\*(C`values\*(C'\fR and \f(CW\*(C`each\*(C'\fR. +.IP "Hash Traversal Randomization" 4 +.IX Item "Hash Traversal Randomization" +Independent of which seed is used in the hash function, \f(CW\*(C`keys\*(C'\fR, +\&\f(CW\*(C`values\*(C'\fR, and \f(CW\*(C`each\*(C'\fR return items in a per-hash randomized order. +Modifying a hash by insertion will change the iteration order of that hash. +This behavior can be overridden by using \f(CW\*(C`hash_traversal_mask()\*(C'\fR from +Hash::Util or by using the \s-1PERL_PERTURB_KEYS\s0 environment variable, +see \*(L"\s-1PERL_PERTURB_KEYS\*(R"\s0 in perlrun. Note that this feature controls the +\&\*(L"visible\*(R" order of the keys, and not the actual order they are stored in. +.IP "Bucket Order Perturbance" 4 +.IX Item "Bucket Order Perturbance" +When items collide into a given hash bucket the order they are stored in +the chain is no longer predictable in Perl 5.18. This +has the intention to make it harder to observe a +collision. This behavior can be overridden by using +the \s-1PERL_PERTURB_KEYS\s0 environment variable, see \*(L"\s-1PERL_PERTURB_KEYS\*(R"\s0 in perlrun. +.IP "New Default Hash Function" 4 +.IX Item "New Default Hash Function" +The default hash function has been modified with the intention of making +it harder to infer the hash seed. +.IP "Alternative Hash Functions" 4 +.IX Item "Alternative Hash Functions" +The source code includes multiple hash algorithms to choose from. While we +believe that the default perl hash is robust to attack, we have included the +hash function Siphash as a fall-back option. At the time of release of +Perl 5.18.0 Siphash is believed to be of cryptographic strength. This is +not the default as it is much slower than the default hash. +.RE +.RS 4 +.Sp +Without compiling a special Perl, there is no way to get the exact same +behavior of any versions prior to Perl 5.18.0. The closest one can get +is by setting \s-1PERL_PERTURB_KEYS\s0 to 0 and setting the \s-1PERL_HASH_SEED\s0 +to a known value. We do not advise those settings for production use +due to the above security considerations. +.Sp +\&\fBPerl has never guaranteed any ordering of the hash keys\fR, and +the ordering has already changed several times during the lifetime of +Perl 5. Also, the ordering of hash keys has always been, and continues +to be, affected by the insertion order and the history of changes made +to the hash over its lifetime. +.Sp +Also note that while the order of the hash elements might be +randomized, this \*(L"pseudo-ordering\*(R" should \fBnot\fR be used for +applications like shuffling a list randomly (use \f(CW\*(C`List::Util::shuffle()\*(C'\fR +for that, see List::Util, a standard core module since Perl 5.8.0; +or the \s-1CPAN\s0 module \f(CW\*(C`Algorithm::Numerical::Shuffle\*(C'\fR), or for generating +permutations (use e.g. the \s-1CPAN\s0 modules \f(CW\*(C`Algorithm::Permute\*(C'\fR or +\&\f(CW\*(C`Algorithm::FastPermute\*(C'\fR), or for any cryptographic applications. +.Sp +Tied hashes may have their own ordering and algorithmic complexity +attacks. +.RE +.IP "\(bu" 4 +Regular expressions \- Perl's regular expression engine is so called \s-1NFA\s0 +(Non-deterministic Finite Automaton), which among other things means that +it can rather easily consume large amounts of both time and space if the +regular expression may match in several ways. Careful crafting of the +regular expressions can help but quite often there really isn't much +one can do (the book \*(L"Mastering Regular Expressions\*(R" is required +reading, see perlfaq2). Running out of space manifests itself by +Perl running out of memory. +.IP "\(bu" 4 +Sorting \- the quicksort algorithm used in Perls before 5.8.0 to +implement the \fBsort()\fR function was very easy to trick into misbehaving +so that it consumes a lot of time. Starting from Perl 5.8.0 a different +sorting algorithm, mergesort, is used by default. Mergesort cannot +misbehave on any input. +.PP +See for more information, +and any computer science textbook on algorithmic complexity. +.SS "Using Sudo" +.IX Subsection "Using Sudo" +The popular tool \f(CW\*(C`sudo\*(C'\fR provides a controlled way for users to be able +to run programs as other users. It sanitises the execution environment +to some extent, and will avoid the shebang race condition. If you don't have the safe version of set-id scripts, +then \f(CW\*(C`sudo\*(C'\fR may be a more convenient way of executing a script as +another user than writing a C wrapper would be. +.PP +However, \f(CW\*(C`sudo\*(C'\fR sets the real user or group \s-1ID\s0 to that of the target +identity, not just the effective \s-1ID\s0 as set-id bits do. As a result, Perl +can't detect that it is running under \f(CW\*(C`sudo\*(C'\fR, and so won't automatically +take its own security precautions such as turning on taint mode. Where +\&\f(CW\*(C`sudo\*(C'\fR configuration dictates exactly which command can be run, the +approved command may include a \f(CW\*(C`\-T\*(C'\fR option to perl to enable taint mode. +.PP +In general, it is necessary to evaluate the suitaility of a script to +run under \f(CW\*(C`sudo\*(C'\fR specifically with that kind of execution environment +in mind. It is neither necessary nor sufficient for the same script to +be suitable to run in a traditional set-id arrangement, though many of +the issues overlap. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\*(L"\s-1ENVIRONMENT\*(R"\s0 in perlrun for its description of cleaning up environment +variables. diff --git a/data/miniconda3/man/man1/perlsolaris.1 b/data/miniconda3/man/man1/perlsolaris.1 new file mode 100644 index 0000000000000000000000000000000000000000..3b7a39fbd2b3b08bdd6304d19e330198efd3e1e7 --- /dev/null +++ b/data/miniconda3/man/man1/perlsolaris.1 @@ -0,0 +1,863 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLSOLARIS 1" +.TH PERLSOLARIS 1 "2020-12-18" "perl v5.32.1" "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" +perlsolaris \- Perl version 5 on Solaris systems +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document describes various features of Sun's Solaris operating system +that will affect how Perl version 5 (hereafter just perl) is +compiled and/or runs. Some issues relating to the older SunOS 4.x are +also discussed, though they may be out of date. +.PP +For the most part, everything should just work. +.PP +Starting with Solaris 8, perl5.00503 (or higher) is supplied with the +operating system, so you might not even need to build a newer version +of perl at all. The Sun-supplied version is installed in /usr/perl5 +with \fI/usr/bin/perl\fR pointing to \fI/usr/perl5/bin/perl\fR. Do not disturb +that installation unless you really know what you are doing. If you +remove the perl supplied with the \s-1OS,\s0 you will render some bits of +your system inoperable. If you wish to install a newer version of perl, +install it under a different prefix from /usr/perl5. Common prefixes +to use are /usr/local and /opt/perl. +.PP +You may wish to put your version of perl in the \s-1PATH\s0 of all users by +changing the link \fI/usr/bin/perl\fR. This is probably \s-1OK,\s0 as most perl +scripts shipped with Solaris use an explicit path. (There are a few +exceptions, such as \fI/usr/bin/rpm2cpio\fR and \fI/etc/rcm/scripts/README\fR, but +these are also sufficiently generic that the actual version of perl +probably doesn't matter too much.) +.PP +Solaris ships with a range of Solaris-specific modules. If you choose +to install your own version of perl you will find the source of many of +these modules is available on \s-1CPAN\s0 under the Sun::Solaris:: namespace. +.PP +Solaris may include two versions of perl, e.g. Solaris 9 includes +both 5.005_03 and 5.6.1. This is to provide stability across Solaris +releases, in cases where a later perl version has incompatibilities +with the version included in the preceding Solaris release. The +default perl version will always be the most recent, and in general +the old version will only be retained for one Solaris release. Note +also that the default perl will \s-1NOT\s0 be configured to search for modules +in the older version, again due to compatibility/stability concerns. +As a consequence if you upgrade Solaris, you will have to +rebuild/reinstall any additional \s-1CPAN\s0 modules that you installed for +the previous Solaris version. See the \s-1CPAN\s0 manpage under 'autobundle' +for a quick way of doing this. +.PP +As an interim measure, you may either change the #! line of your +scripts to specifically refer to the old perl version, e.g. on +Solaris 9 use #!/usr/perl5/5.00503/bin/perl to use the perl version +that was the default for Solaris 8, or if you have a large number of +scripts it may be more convenient to make the old version of perl the +default on your system. You can do this by changing the appropriate +symlinks under /usr/perl5 as follows (example for Solaris 9): +.PP +.Vb 7 +\& # cd /usr/perl5 +\& # rm bin man pod +\& # ln \-s ./5.00503/bin +\& # ln \-s ./5.00503/man +\& # ln \-s ./5.00503/lib/pod +\& # rm /usr/bin/perl +\& # ln \-s ../perl5/5.00503/bin/perl /usr/bin/perl +.Ve +.PP +In both cases this should only be considered to be a temporary +measure \- you should upgrade to the later version of perl as soon as +is practicable. +.PP +Note also that the perl command-line utilities (e.g. perldoc) and any +that are added by modules that you install will be under +/usr/perl5/bin, so that directory should be added to your \s-1PATH.\s0 +.SS "Solaris Version Numbers." +.IX Subsection "Solaris Version Numbers." +For consistency with common usage, perl's Configure script performs +some minor manipulations on the operating system name and version +number as reported by uname. Here's a partial translation table: +.PP +.Vb 7 +\& Sun: perl\*(Aqs Configure: +\& uname uname \-r Name osname osvers +\& SunOS 4.1.3 Solaris 1.1 sunos 4.1.3 +\& SunOS 5.6 Solaris 2.6 solaris 2.6 +\& SunOS 5.8 Solaris 8 solaris 2.8 +\& SunOS 5.9 Solaris 9 solaris 2.9 +\& SunOS 5.10 Solaris 10 solaris 2.10 +.Ve +.PP +The complete table can be found in the Sun Managers' \s-1FAQ\s0 + under +\&\*(L"9.1) Which Sun models run which versions of SunOS?\*(R". +.SH "RESOURCES" +.IX Header "RESOURCES" +There are many, many sources for Solaris information. A few of the +important ones for perl: +.IP "Solaris \s-1FAQ\s0" 4 +.IX Item "Solaris FAQ" +The Solaris \s-1FAQ\s0 is available at +. +.Sp +The Sun Managers' \s-1FAQ\s0 is available at + +.IP "Precompiled Binaries" 4 +.IX Item "Precompiled Binaries" +Precompiled binaries, links to many sites, and much, much more are +available at and +. +.IP "Solaris Documentation" 4 +.IX Item "Solaris Documentation" +All Solaris documentation is available on-line at . +.SH "SETTING UP" +.IX Header "SETTING UP" +.SS "File Extraction Problems on Solaris." +.IX Subsection "File Extraction Problems on Solaris." +Be sure to use a tar program compiled under Solaris (not SunOS 4.x) +to extract the perl\-5.x.x.tar.gz file. Do not use \s-1GNU\s0 tar compiled +for SunOS4 on Solaris. (\s-1GNU\s0 tar compiled for Solaris should be fine.) +When you run SunOS4 binaries on Solaris, the run-time system magically +alters pathnames matching m#lib/locale# so that when tar tries to create +lib/locale.pm, a file named lib/oldlocale.pm gets created instead. +If you found this advice too late and used a SunOS4\-compiled tar +anyway, you must find the incorrectly renamed file and move it back +to lib/locale.pm. +.SS "Compiler and Related Tools on Solaris." +.IX Subsection "Compiler and Related Tools on Solaris." +You must use an \s-1ANSI C\s0 compiler to build perl. Perl can be compiled +with either Sun's add-on C compiler or with gcc. The C compiler that +shipped with SunOS4 will not do. +.PP +\fIInclude /usr/ccs/bin/ in your \s-1PATH.\s0\fR +.IX Subsection "Include /usr/ccs/bin/ in your PATH." +.PP +Several tools needed to build perl are located in /usr/ccs/bin/: ar, +as, ld, and make. Make sure that /usr/ccs/bin/ is in your \s-1PATH.\s0 +.PP +On all the released versions of Solaris (8, 9 and 10) you need to make sure the following packages are installed (this info is extracted from the Solaris \s-1FAQ\s0): +.PP +for tools (sccs, lex, yacc, make, nm, truss, ld, as): SUNWbtool, +SUNWsprot, SUNWtoo +.PP +for libraries & headers: SUNWhea, SUNWarc, SUNWlibm, SUNWlibms, SUNWdfbh, +SUNWcg6h, SUNWxwinc +.PP +Additionally, on Solaris 8 and 9 you also need: +.PP +for 64 bit development: SUNWarcx, SUNWbtoox, SUNWdplx, SUNWscpux, +SUNWsprox, SUNWtoox, SUNWlmsx, SUNWlmx, SUNWlibCx +.PP +And only on Solaris 8 you also need: +.PP +for libraries & headers: SUNWolinc +.PP +If you are in doubt which package contains a file you are missing, +try to find an installation that has that file. Then do a +.PP +.Vb 1 +\& $ grep /my/missing/file /var/sadm/install/contents +.Ve +.PP +This will display a line like this: +.PP +/usr/include/sys/errno.h f none 0644 root bin 7471 37605 956241356 SUNWhea +.PP +The last item listed (SUNWhea in this example) is the package you need. +.PP +\fIAvoid /usr/ucb/cc.\fR +.IX Subsection "Avoid /usr/ucb/cc." +.PP +You don't need to have /usr/ucb/ in your \s-1PATH\s0 to build perl. If you +want /usr/ucb/ in your \s-1PATH\s0 anyway, make sure that /usr/ucb/ is \s-1NOT\s0 +in your \s-1PATH\s0 before the directory containing the right C compiler. +.PP +\fISun's C Compiler\fR +.IX Subsection "Sun's C Compiler" +.PP +If you use Sun's C compiler, make sure the correct directory +(usually /opt/SUNWspro/bin/) is in your \s-1PATH\s0 (before /usr/ucb/). +.PP +\fI\s-1GCC\s0\fR +.IX Subsection "GCC" +.PP +If you use gcc, make sure your installation is recent and complete. +perl versions since 5.6.0 build fine with gcc > 2.8.1 on Solaris >= +2.6. +.PP +You must Configure perl with +.PP +.Vb 1 +\& $ sh Configure \-Dcc=gcc +.Ve +.PP +If you don't, you may experience strange build errors. +.PP +If you have updated your Solaris version, you may also have to update +your gcc. For example, if you are running Solaris 2.6 and your gcc is +installed under /usr/local, check in /usr/local/lib/gcc\-lib and make +sure you have the appropriate directory, sparc\-sun\-solaris2.6/ or +i386\-pc\-solaris2.6/. If gcc's directory is for a different version of +Solaris than you are running, then you will need to rebuild gcc for +your new version of Solaris. +.PP +You can get a precompiled version of gcc from + or . Make +sure you pick up the package for your Solaris release. +.PP +If you wish to use gcc to build add-on modules for use with the perl +shipped with Solaris, you should use the Solaris::PerlGcc module +which is available from \s-1CPAN.\s0 The perl shipped with Solaris +is configured and built with the Sun compilers, and the compiler +configuration information stored in Config.pm is therefore only +relevant to the Sun compilers. The Solaris:PerlGcc module contains a +replacement Config.pm that is correct for gcc \- see the module for +details. +.PP +\fI\s-1GNU\s0 as and \s-1GNU\s0 ld\fR +.IX Subsection "GNU as and GNU ld" +.PP +The following information applies to gcc version 2. Volunteers to +update it as appropriately for gcc version 3 would be appreciated. +.PP +The versions of as and ld supplied with Solaris work fine for building +perl. There is normally no need to install the \s-1GNU\s0 versions to +compile perl. +.PP +If you decide to ignore this advice and use the \s-1GNU\s0 versions anyway, +then be sure that they are relatively recent. Versions newer than 2.7 +are apparently new enough. Older versions may have trouble with +dynamic loading. +.PP +If you wish to use \s-1GNU\s0 ld, then you need to pass it the \-Wl,\-E flag. +The hints/solaris_2.sh file tries to do this automatically by setting +the following Configure variables: +.PP +.Vb 2 +\& ccdlflags="$ccdlflags \-Wl,\-E" +\& lddlflags="$lddlflags \-Wl,\-E \-G" +.Ve +.PP +However, over the years, changes in gcc, \s-1GNU\s0 ld, and Solaris ld have made +it difficult to automatically detect which ld ultimately gets called. +You may have to manually edit config.sh and add the \-Wl,\-E flags +yourself, or else run Configure interactively and add the flags at the +appropriate prompts. +.PP +If your gcc is configured to use \s-1GNU\s0 as and ld but you want to use the +Solaris ones instead to build perl, then you'll need to add +\&\-B/usr/ccs/bin/ to the gcc command line. One convenient way to do +that is with +.PP +.Vb 1 +\& $ sh Configure \-Dcc=\*(Aqgcc \-B/usr/ccs/bin/\*(Aq +.Ve +.PP +Note that the trailing slash is required. This will result in some +harmless warnings as Configure is run: +.PP +.Vb 1 +\& gcc: file path prefix \`/usr/ccs/bin/\*(Aq never used +.Ve +.PP +These messages may safely be ignored. +(Note that for a SunOS4 system, you must use \-B/bin/ instead.) +.PP +Alternatively, you can use the \s-1GCC_EXEC_PREFIX\s0 environment variable to +ensure that Sun's as and ld are used. Consult your gcc documentation +for further information on the \-B option and the \s-1GCC_EXEC_PREFIX\s0 variable. +.PP +\fISun and \s-1GNU\s0 make\fR +.IX Subsection "Sun and GNU make" +.PP +The make under /usr/ccs/bin works fine for building perl. If you +have the Sun C compilers, you will also have a parallel version of +make (dmake). This works fine to build perl, but can sometimes cause +problems when running 'make test' due to underspecified dependencies +between the different test harness files. The same problem can also +affect the building of some add-on modules, so in those cases either +specify '\-m serial' on the dmake command line, or use +/usr/ccs/bin/make instead. If you wish to use \s-1GNU\s0 make, be sure that +the set-group-id bit is not set. If it is, then arrange your \s-1PATH\s0 so +that /usr/ccs/bin/make is before \s-1GNU\s0 make or else have the system +administrator disable the set-group-id bit on \s-1GNU\s0 make. +.PP +\fIAvoid libucb.\fR +.IX Subsection "Avoid libucb." +.PP +Solaris provides some BSD-compatibility functions in /usr/ucblib/libucb.a. +Perl will not build and run correctly if linked against \-lucb since it +contains routines that are incompatible with the standard Solaris libc. +Normally this is not a problem since the solaris hints file prevents +Configure from even looking in /usr/ucblib for libraries, and also +explicitly omits \-lucb. +.SS "Environment for Compiling perl on Solaris" +.IX Subsection "Environment for Compiling perl on Solaris" +\fI\s-1PATH\s0\fR +.IX Subsection "PATH" +.PP +Make sure your \s-1PATH\s0 includes the compiler (/opt/SUNWspro/bin/ if you're +using Sun's compiler) as well as /usr/ccs/bin/ to pick up the other +development tools (such as make, ar, as, and ld). Make sure your path +either doesn't include /usr/ucb or that it includes it after the +compiler and compiler tools and other standard Solaris directories. +You definitely don't want /usr/ucb/cc. +.PP +\fI\s-1LD_LIBRARY_PATH\s0\fR +.IX Subsection "LD_LIBRARY_PATH" +.PP +If you have the \s-1LD_LIBRARY_PATH\s0 environment variable set, be sure that +it does \s-1NOT\s0 include /lib or /usr/lib. If you will be building +extensions that call third-party shared libraries (e.g. Berkeley \s-1DB\s0) +then make sure that your \s-1LD_LIBRARY_PATH\s0 environment variable includes +the directory with that library (e.g. /usr/local/lib). +.PP +If you get an error message +.PP +.Vb 1 +\& dlopen: stub interception failed +.Ve +.PP +it is probably because your \s-1LD_LIBRARY_PATH\s0 environment variable +includes a directory which is a symlink to /usr/lib (such as /lib). +The reason this causes a problem is quite subtle. The file +libdl.so.1.0 actually *only* contains functions which generate 'stub +interception failed' errors! The runtime linker intercepts links to +\&\*(L"/usr/lib/libdl.so.1.0\*(R" and links in internal implementations of those +functions instead. [Thanks to Tim Bunce for this explanation.] +.SH "RUN CONFIGURE." +.IX Header "RUN CONFIGURE." +See the \s-1INSTALL\s0 file for general information regarding Configure. +Only Solaris-specific issues are discussed here. Usually, the +defaults should be fine. +.SS "64\-bit perl on Solaris." +.IX Subsection "64-bit perl on Solaris." +See the \s-1INSTALL\s0 file for general information regarding 64\-bit compiles. +In general, the defaults should be fine for most people. +.PP +By default, perl\-5.6.0 (or later) is compiled as a 32\-bit application +with largefile and long-long support. +.PP +\fIGeneral 32\-bit vs. 64\-bit issues.\fR +.IX Subsection "General 32-bit vs. 64-bit issues." +.PP +Solaris 7 and above will run in either 32 bit or 64 bit mode on \s-1SPARC\s0 +CPUs, via a reboot. You can build 64 bit apps whilst running 32 bit +mode and vice-versa. 32 bit apps will run under Solaris running in +either 32 or 64 bit mode. 64 bit apps require Solaris to be running +64 bit mode. +.PP +Existing 32 bit apps are properly known as \s-1LP32,\s0 i.e. Longs and +Pointers are 32 bit. 64\-bit apps are more properly known as \s-1LP64.\s0 +The discriminating feature of a \s-1LP64\s0 bit app is its ability to utilise a +64\-bit address space. It is perfectly possible to have a \s-1LP32\s0 bit app +that supports both 64\-bit integers (long long) and largefiles (> 2GB), +and this is the default for perl\-5.6.0. +.PP +For a more complete explanation of 64\-bit issues, see the +\&\*(L"Solaris 64\-bit Developer's Guide\*(R" at +.PP +You can detect the \s-1OS\s0 mode using \*(L"isainfo \-v\*(R", e.g. +.PP +.Vb 3 +\& $ isainfo \-v # Ultra 30 in 64 bit mode +\& 64\-bit sparcv9 applications +\& 32\-bit sparc applications +.Ve +.PP +By default, perl will be compiled as a 32\-bit application. Unless +you want to allocate more than ~ 4GB of memory inside perl, or unless +you need more than 255 open file descriptors, you probably don't need +perl to be a 64\-bit app. +.PP +\fILarge File Support\fR +.IX Subsection "Large File Support" +.PP +For Solaris 2.6 and onwards, there are two different ways for 32\-bit +applications to manipulate large files (files whose size is > 2GByte). +(A 64\-bit application automatically has largefile support built in +by default.) +.PP +First is the \*(L"transitional compilation environment\*(R", described in +\&\fBlfcompile64\fR\|(5). According to the man page, +.PP +.Vb 7 +\& The transitional compilation environment exports all the +\& explicit 64\-bit functions (xxx64()) and types in addition to +\& all the regular functions (xxx()) and types. Both xxx() and +\& xxx64() functions are available to the program source. A +\& 32\-bit application must use the xxx64() functions in order +\& to access large files. See the lf64(5) manual page for a +\& complete listing of the 64\-bit transitional interfaces. +.Ve +.PP +The transitional compilation environment is obtained with the +following compiler and linker flags: +.PP +.Vb 3 +\& getconf LFS64_CFLAGS \-D_LARGEFILE64_SOURCE +\& getconf LFS64_LDFLAG # nothing special needed +\& getconf LFS64_LIBS # nothing special needed +.Ve +.PP +Second is the \*(L"large file compilation environment\*(R", described in +\&\fBlfcompile\fR\|(5). According to the man page, +.PP +.Vb 5 +\& Each interface named xxx() that needs to access 64\-bit entities +\& to access large files maps to a xxx64() call in the +\& resulting binary. All relevant data types are defined to be +\& of correct size (for example, off_t has a typedef definition +\& for a 64\-bit entity). +\& +\& An application compiled in this environment is able to use +\& the xxx() source interfaces to access both large and small +\& files, rather than having to explicitly utilize the transitional +\& xxx64() interface calls to access large files. +.Ve +.PP +Two exceptions are \fBfseek()\fR and \fBftell()\fR. 32\-bit applications should +use fseeko(3C) and ftello(3C). These will get automatically mapped +to \fBfseeko64()\fR and \fBftello64()\fR. +.PP +The large file compilation environment is obtained with +.PP +.Vb 3 +\& getconf LFS_CFLAGS \-D_LARGEFILE_SOURCE \-D_FILE_OFFSET_BITS=64 +\& getconf LFS_LDFLAGS # nothing special needed +\& getconf LFS_LIBS # nothing special needed +.Ve +.PP +By default, perl uses the large file compilation environment and +relies on Solaris to do the underlying mapping of interfaces. +.PP +\fIBuilding an \s-1LP64\s0 perl\fR +.IX Subsection "Building an LP64 perl" +.PP +To compile a 64\-bit application on an UltraSparc with a recent Sun Compiler, +you need to use the flag \*(L"\-xarch=v9\*(R". \fBgetconf\fR\|(1) will tell you this, e.g. +.PP +.Vb 10 +\& $ getconf \-a | grep v9 +\& XBS5_LP64_OFF64_CFLAGS: \-xarch=v9 +\& XBS5_LP64_OFF64_LDFLAGS: \-xarch=v9 +\& XBS5_LP64_OFF64_LINTFLAGS: \-xarch=v9 +\& XBS5_LPBIG_OFFBIG_CFLAGS: \-xarch=v9 +\& XBS5_LPBIG_OFFBIG_LDFLAGS: \-xarch=v9 +\& XBS5_LPBIG_OFFBIG_LINTFLAGS: \-xarch=v9 +\& _XBS5_LP64_OFF64_CFLAGS: \-xarch=v9 +\& _XBS5_LP64_OFF64_LDFLAGS: \-xarch=v9 +\& _XBS5_LP64_OFF64_LINTFLAGS: \-xarch=v9 +\& _XBS5_LPBIG_OFFBIG_CFLAGS: \-xarch=v9 +\& _XBS5_LPBIG_OFFBIG_LDFLAGS: \-xarch=v9 +\& _XBS5_LPBIG_OFFBIG_LINTFLAGS: \-xarch=v9 +.Ve +.PP +This flag is supported in Sun WorkShop Compilers 5.0 and onwards +(now marketed under the name Forte) when used on Solaris 7 or later on +UltraSparc systems. +.PP +If you are using gcc, you would need to use \-mcpu=v9 \-m64 instead. This +option is not yet supported as of gcc 2.95.2; from install/SPECIFIC +in that release: +.PP +.Vb 5 +\& GCC version 2.95 is not able to compile code correctly for sparc64 +\& targets. Users of the Linux kernel, at least, can use the sparc32 +\& program to start up a new shell invocation with an environment that +\& causes configure to recognize (via uname \-a) the system as sparc\-*\-* +\& instead. +.Ve +.PP +All this should be handled automatically by the hints file, if +requested. +.PP +\fILong Doubles.\fR +.IX Subsection "Long Doubles." +.PP +As of 5.8.1, long doubles are working if you use the Sun compilers +(needed for additional math routines not included in libm). +.SS "Threads in perl on Solaris." +.IX Subsection "Threads in perl on Solaris." +It is possible to build a threaded version of perl on Solaris. The entire +perl thread implementation is still experimental, however, so beware. +.SS "Malloc Issues with perl on Solaris." +.IX Subsection "Malloc Issues with perl on Solaris." +Starting from perl 5.7.1 perl uses the Solaris malloc, since the perl +malloc breaks when dealing with more than 2GB of memory, and the Solaris +malloc also seems to be faster. +.PP +If you for some reason (such as binary backward compatibility) really +need to use perl's malloc, you can rebuild perl from the sources +and Configure the build with +.PP +.Vb 1 +\& $ sh Configure \-Dusemymalloc +.Ve +.PP +You should not use perl's malloc if you are building with gcc. There +are reports of core dumps, especially in the \s-1PDL\s0 module. The problem +appears to go away under \-DDEBUGGING, so it has been difficult to +track down. Sun's compiler appears to be okay with or without perl's +malloc. [\s-1XXX\s0 further investigation is needed here.] +.SH "MAKE PROBLEMS." +.IX Header "MAKE PROBLEMS." +.IP "Dynamic Loading Problems With \s-1GNU\s0 as and \s-1GNU\s0 ld" 4 +.IX Item "Dynamic Loading Problems With GNU as and GNU ld" +If you have problems with dynamic loading using gcc on SunOS or +Solaris, and you are using \s-1GNU\s0 as and \s-1GNU\s0 ld, see the section +\&\*(L"\s-1GNU\s0 as and \s-1GNU\s0 ld\*(R" above. +.IP "ld.so.1: ./perl: fatal: relocation error:" 4 +.IX Item "ld.so.1: ./perl: fatal: relocation error:" +If you get this message on SunOS or Solaris, and you're using gcc, +it's probably the \s-1GNU\s0 as or \s-1GNU\s0 ld problem in the previous item +\&\*(L"\s-1GNU\s0 as and \s-1GNU\s0 ld\*(R". +.IP "dlopen: stub interception failed" 4 +.IX Item "dlopen: stub interception failed" +The primary cause of the 'dlopen: stub interception failed' message is +that the \s-1LD_LIBRARY_PATH\s0 environment variable includes a directory +which is a symlink to /usr/lib (such as /lib). See +\&\*(L"\s-1LD_LIBRARY_PATH\*(R"\s0 above. +.ie n .IP "#error ""No \s-1DATAMODEL_NATIVE\s0 specified""" 4 +.el .IP "#error ``No \s-1DATAMODEL_NATIVE\s0 specified''" 4 +.IX Item "#error No DATAMODEL_NATIVE specified" +This is a common error when trying to build perl on Solaris 2.6 with a +gcc installation from Solaris 2.5 or 2.5.1. The Solaris header files +changed, so you need to update your gcc installation. You can either +rerun the fixincludes script from gcc or take the opportunity to +update your gcc installation. +.IP "sh: ar: not found" 4 +.IX Item "sh: ar: not found" +This is a message from your shell telling you that the command 'ar' +was not found. You need to check your \s-1PATH\s0 environment variable to +make sure that it includes the directory with the 'ar' command. This +is a common problem on Solaris, where 'ar' is in the /usr/ccs/bin/ +directory. +.SH "MAKE TEST" +.IX Header "MAKE TEST" +.SS "op/stat.t test 4 in Solaris" +.IX Subsection "op/stat.t test 4 in Solaris" +\&\fIop/stat.t\fR test 4 may fail if you are on a tmpfs of some sort. +Building in /tmp sometimes shows this behavior. The +test suite detects if you are building in /tmp, but it may not be able +to catch all tmpfs situations. +.SS "nss_delete core dump from op/pwent or op/grent" +.IX Subsection "nss_delete core dump from op/pwent or op/grent" +See \*(L"nss_delete core dump from op/pwent or op/grent\*(R" in perlhpux. +.SH "CROSS-COMPILATION" +.IX Header "CROSS-COMPILATION" +Nothing too unusual here. You can easily do this if you have a +cross-compiler available; A usual Configure invocation when targetting a +Solaris x86 looks something like this: +.PP +.Vb 5 +\& sh ./Configure \-des \-Dusecrosscompile \e +\& \-Dcc=i386\-pc\-solaris2.11\-gcc \e +\& \-Dsysroot=$SYSROOT \e +\& \-Alddlflags=" \-Wl,\-z,notext" \e +\& \-Dtargethost=... # The usual cross\-compilation options +.Ve +.PP +The lddlflags addition is the only abnormal bit. +.SH "PREBUILT BINARIES OF PERL FOR SOLARIS." +.IX Header "PREBUILT BINARIES OF PERL FOR SOLARIS." +You can pick up prebuilt binaries for Solaris from +, , +ActiveState , and + under the Binaries list at the top of the +page. There are probably other sources as well. Please note that +these sites are under the control of their respective owners, not the +perl developers. +.SH "RUNTIME ISSUES FOR PERL ON SOLARIS." +.IX Header "RUNTIME ISSUES FOR PERL ON SOLARIS." +.SS "Limits on Numbers of Open Files on Solaris." +.IX Subsection "Limits on Numbers of Open Files on Solaris." +The stdio(3C) manpage notes that for \s-1LP32\s0 applications, only 255 +files may be opened using \fBfopen()\fR, and only file descriptors 0 +through 255 can be used in a stream. Since perl calls \fBopen()\fR and +then fdopen(3C) with the resulting file descriptor, perl is limited +to 255 simultaneous open files, even if \fBsysopen()\fR is used. If this +proves to be an insurmountable problem, you can compile perl as a +\&\s-1LP64\s0 application, see \*(L"Building an \s-1LP64\s0 perl\*(R" for details. Note +also that the default resource limit for open file descriptors on +Solaris is 255, so you will have to modify your ulimit or rctl +(Solaris 9 onwards) appropriately. +.SH "SOLARIS-SPECIFIC MODULES." +.IX Header "SOLARIS-SPECIFIC MODULES." +See the modules under the Solaris:: and Sun::Solaris namespaces on \s-1CPAN,\s0 +see and +. +.SH "SOLARIS-SPECIFIC PROBLEMS WITH MODULES." +.IX Header "SOLARIS-SPECIFIC PROBLEMS WITH MODULES." +.SS "Proc::ProcessTable on Solaris" +.IX Subsection "Proc::ProcessTable on Solaris" +Proc::ProcessTable does not compile on Solaris with perl5.6.0 and higher +if you have \s-1LARGEFILES\s0 defined. Since largefile support is the +default in 5.6.0 and later, you have to take special steps to use this +module. +.PP +The problem is that various structures visible via procfs use off_t, +and if you compile with largefile support these change from 32 bits to +64 bits. Thus what you get back from procfs doesn't match up with +the structures in perl, resulting in garbage. See \fBproc\fR\|(4) for further +discussion. +.PP +A fix for Proc::ProcessTable is to edit Makefile to +explicitly remove the largefile flags from the ones MakeMaker picks up +from Config.pm. This will result in Proc::ProcessTable being built +under the correct environment. Everything should then be \s-1OK\s0 as long as +Proc::ProcessTable doesn't try to share off_t's with the rest of perl, +or if it does they should be explicitly specified as off64_t. +.SS "BSD::Resource on Solaris" +.IX Subsection "BSD::Resource on Solaris" +BSD::Resource versions earlier than 1.09 do not compile on Solaris +with perl 5.6.0 and higher, for the same reasons as Proc::ProcessTable. +BSD::Resource versions starting from 1.09 have a workaround for the problem. +.SS "Net::SSLeay on Solaris" +.IX Subsection "Net::SSLeay on Solaris" +Net::SSLeay requires a /dev/urandom to be present. This device is +available from Solaris 9 onwards. For earlier Solaris versions you +can either get the package SUNWski (packaged with several Sun +software products, for example the Sun WebServer, which is part of +the Solaris Server Intranet Extension, or the Sun Directory Services, +part of Solaris for ISPs) or download the ANDIrand package from +. If you use SUNWski, make a +symbolic link /dev/urandom pointing to /dev/random. For more details, +see Document \s-1ID27606\s0 entitled \*(L"Differing /dev/random support requirements +within Solaris[\s-1TM\s0] Operating Environments\*(R", available at + . +.PP +It may be possible to use the Entropy Gathering Daemon (written in +Perl!), available from . +.SH "SunOS 4.x" +.IX Header "SunOS 4.x" +In SunOS 4.x you most probably want to use the SunOS ld, /usr/bin/ld, +since the more recent versions of \s-1GNU\s0 ld (like 2.13) do not seem to +work for building Perl anymore. When linking the extensions, the +\&\s-1GNU\s0 ld gets very unhappy and spews a lot of errors like this +.PP +.Vb 1 +\& ... relocation truncated to fit: BASE13 ... +.Ve +.PP +and dies. Therefore the SunOS 4.1 hints file explicitly sets the +ld to be \fI/usr/bin/ld\fR. +.PP +As of Perl 5.8.1 the dynamic loading of libraries (DynaLoader, XSLoader) +also seems to have become broken in in SunOS 4.x. Therefore the default +is to build Perl statically. +.PP +Running the test suite in SunOS 4.1 is a bit tricky since the +\&\fIdist/Tie\-File/t/09_gen_rs.t\fR test hangs (subtest #51, \s-1FWIW\s0) for some +unknown reason. Just stop the test and kill that particular Perl +process. +.PP +There are various other failures, that as of SunOS 4.1.4 and gcc 3.2.2 +look a lot like gcc bugs. Many of the failures happen in the Encode +tests, where for example when the test expects \*(L"0\*(R" you get \*(L"0\*(R" +which should after a little squinting look very odd indeed. +Another example is earlier in \fIt/run/fresh_perl\fR where \fBchr\fR\|(0xff) is +expected but the test fails because the result is \fBchr\fR\|(0xff). Exactly. +.PP +This is the \*(L"make test\*(R" result from the said combination: +.PP +.Vb 1 +\& Failed 27 test scripts out of 745, 96.38% okay. +.Ve +.PP +Running the \f(CW\*(C`harness\*(C'\fR is painful because of the many failing +Unicode-related tests will output megabytes of failure messages, +but if one patiently waits, one gets these results: +.PP +.Vb 10 +\& Failed Test Stat Wstat Total Fail Failed List of Failed +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& ... +\& ../ext/Encode/t/at\-cn.t 4 1024 29 4 13.79% 14\-17 +\& ../ext/Encode/t/at\-tw.t 10 2560 17 10 58.82% 2 4 6 8 10 12 +\& 14\-17 +\& ../ext/Encode/t/enc_data.t 29 7424 ?? ?? % ?? +\& ../ext/Encode/t/enc_eucjp.t 29 7424 ?? ?? % ?? +\& ../ext/Encode/t/enc_module.t 29 7424 ?? ?? % ?? +\& ../ext/Encode/t/encoding.t 29 7424 ?? ?? % ?? +\& ../ext/Encode/t/grow.t 12 3072 24 12 50.00% 2 4 6 8 10 12 14 +\& 16 18 20 22 24 +\& Failed Test Stat Wstat Total Fail Failed List of Failed +\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& ../ext/Encode/t/guess.t 255 65280 29 40 137.93% 10\-29 +\& ../ext/Encode/t/jperl.t 29 7424 15 30 200.00% 1\-15 +\& ../ext/Encode/t/mime\-header.t 2 512 10 2 20.00% 2\-3 +\& ../ext/Encode/t/perlio.t 22 5632 38 22 57.89% 1\-4 9\-16 19\-20 +\& 23\-24 27\-32 +\& ../ext/List/Util/t/shuffle.t 0 139 ?? ?? % ?? +\& ../ext/PerlIO/t/encoding.t 14 1 7.14% 11 +\& ../ext/PerlIO/t/fallback.t 9 2 22.22% 3 5 +\& ../ext/Socket/t/socketpair.t 0 2 45 70 155.56% 11\-45 +\& ../lib/CPAN/t/vcmp.t 30 1 3.33% 25 +\& ../lib/Tie/File/t/09_gen_rs.t 0 15 ?? ?? % ?? +\& ../lib/Unicode/Collate/t/test.t 199 30 15.08% 7 26\-27 71\-75 +\& 81\-88 95 101 +\& 103\-104 106 108\- +\& 109 122 124 161 +\& 169\-172 +\& ../lib/sort.t 0 139 119 26 21.85% 107\-119 +\& op/alarm.t 4 1 25.00% 4 +\& op/utfhash.t 97 1 1.03% 31 +\& run/fresh_perl.t 91 1 1.10% 32 +\& uni/tr_7jis.t ?? ?? % ?? +\& uni/tr_eucjp.t 29 7424 6 12 200.00% 1\-6 +\& uni/tr_sjis.t 29 7424 6 12 200.00% 1\-6 +\& 56 tests and 467 subtests skipped. +\& Failed 27/811 test scripts, 96.67% okay. 1383/75399 subtests failed, +\& 98.17% okay. +.Ve +.PP +The \fBalarm()\fR test failure is caused by \fBsystem()\fR apparently blocking +\&\fBalarm()\fR. That is probably a libc bug, and given that SunOS 4.x +has been end-of-lifed years ago, don't hold your breath for a fix. +In addition to that, don't try anything too Unicode-y, especially +with Encode, and you should be fine in SunOS 4.x. +.SH "AUTHOR" +.IX Header "AUTHOR" +The original was written by Andy Dougherty \fIdoughera@lafayette.edu\fR +drawing heavily on advice from Alan Burlison, Nick Ing-Simmons, Tim Bunce, +and many other Solaris users over the years. +.PP +Please report any errors, updates, or suggestions to +. diff --git a/data/miniconda3/man/man1/perlsub.1 b/data/miniconda3/man/man1/perlsub.1 new file mode 100644 index 0000000000000000000000000000000000000000..a8bdbe27c829d92ade36cc24c85735703690ab40 --- /dev/null +++ b/data/miniconda3/man/man1/perlsub.1 @@ -0,0 +1,2370 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLSUB 1" +.TH PERLSUB 1 "2020-12-18" "perl v5.32.1" "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" +perlsub \- Perl subroutines +.IX Xref "subroutine function" +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +To declare subroutines: +.IX Xref "subroutine, declaration sub" +.PP +.Vb 4 +\& sub NAME; # A "forward" declaration. +\& sub NAME(PROTO); # ditto, but with prototypes +\& sub NAME : ATTRS; # with attributes +\& sub NAME(PROTO) : ATTRS; # with attributes and prototypes +\& +\& sub NAME BLOCK # A declaration and a definition. +\& sub NAME(PROTO) BLOCK # ditto, but with prototypes +\& sub NAME : ATTRS BLOCK # with attributes +\& sub NAME(PROTO) : ATTRS BLOCK # with prototypes and attributes +\& +\& use feature \*(Aqsignatures\*(Aq; +\& sub NAME(SIG) BLOCK # with signature +\& sub NAME :ATTRS (SIG) BLOCK # with signature, attributes +\& sub NAME :prototype(PROTO) (SIG) BLOCK # with signature, prototype +.Ve +.PP +To define an anonymous subroutine at runtime: +.IX Xref "subroutine, anonymous" +.PP +.Vb 4 +\& $subref = sub BLOCK; # no proto +\& $subref = sub (PROTO) BLOCK; # with proto +\& $subref = sub : ATTRS BLOCK; # with attributes +\& $subref = sub (PROTO) : ATTRS BLOCK; # with proto and attributes +\& +\& use feature \*(Aqsignatures\*(Aq; +\& $subref = sub (SIG) BLOCK; # with signature +\& $subref = sub : ATTRS(SIG) BLOCK; # with signature, attributes +.Ve +.PP +To import subroutines: +.IX Xref "import" +.PP +.Vb 1 +\& use MODULE qw(NAME1 NAME2 NAME3); +.Ve +.PP +To call subroutines: +.IX Xref "subroutine, call call" +.PP +.Vb 4 +\& NAME(LIST); # & is optional with parentheses. +\& NAME LIST; # Parentheses optional if predeclared/imported. +\& &NAME(LIST); # Circumvent prototypes. +\& &NAME; # Makes current @_ visible to called subroutine. +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Like many languages, Perl provides for user-defined subroutines. +These may be located anywhere in the main program, loaded in from +other files via the \f(CW\*(C`do\*(C'\fR, \f(CW\*(C`require\*(C'\fR, or \f(CW\*(C`use\*(C'\fR keywords, or +generated on the fly using \f(CW\*(C`eval\*(C'\fR or anonymous subroutines. +You can even call a function indirectly using a variable containing +its name or a \s-1CODE\s0 reference. +.PP +The Perl model for function call and return values is simple: all +functions are passed as parameters one single flat list of scalars, and +all functions likewise return to their caller one single flat list of +scalars. Any arrays or hashes in these call and return lists will +collapse, losing their identities\*(--but you may always use +pass-by-reference instead to avoid this. Both call and return lists may +contain as many or as few scalar elements as you'd like. (Often a +function without an explicit return statement is called a subroutine, but +there's really no difference from Perl's perspective.) +.IX Xref "subroutine, parameter parameter" +.PP +Any arguments passed in show up in the array \f(CW@_\fR. +(They may also show up in lexical variables introduced by a signature; +see \*(L"Signatures\*(R" below.) Therefore, if +you called a function with two arguments, those would be stored in +\&\f(CW$_[0]\fR and \f(CW$_[1]\fR. The array \f(CW@_\fR is a local array, but its +elements are aliases for the actual scalar parameters. In particular, +if an element \f(CW$_[0]\fR is updated, the corresponding argument is +updated (or an error occurs if it is not updatable). If an argument +is an array or hash element which did not exist when the function +was called, that element is created only when (and if) it is modified +or a reference to it is taken. (Some earlier versions of Perl +created the element whether or not the element was assigned to.) +Assigning to the whole array \f(CW@_\fR removes that aliasing, and does +not update any arguments. +.IX Xref "subroutine, argument argument @_" +.PP +A \f(CW\*(C`return\*(C'\fR statement may be used to exit a subroutine, optionally +specifying the returned value, which will be evaluated in the +appropriate context (list, scalar, or void) depending on the context of +the subroutine call. If you specify no return value, the subroutine +returns an empty list in list context, the undefined value in scalar +context, or nothing in void context. If you return one or more +aggregates (arrays and hashes), these will be flattened together into +one large indistinguishable list. +.PP +If no \f(CW\*(C`return\*(C'\fR is found and if the last statement is an expression, its +value is returned. If the last statement is a loop control structure +like a \f(CW\*(C`foreach\*(C'\fR or a \f(CW\*(C`while\*(C'\fR, the returned value is unspecified. The +empty sub returns the empty list. +.IX Xref "subroutine, return value return value return" +.PP +Aside from an experimental facility (see \*(L"Signatures\*(R" below), +Perl does not have named formal parameters. In practice all you +do is assign to a \f(CW\*(C`my()\*(C'\fR list of these. Variables that aren't +declared to be private are global variables. For gory details +on creating private variables, see \*(L"Private Variables via \fBmy()\fR\*(R" +and \*(L"Temporary Values via \fBlocal()\fR\*(R". To create protected +environments for a set of functions in a separate package (and +probably a separate file), see \*(L"Packages\*(R" in perlmod. +.IX Xref "formal parameter parameter, formal" +.PP +Example: +.PP +.Vb 8 +\& sub max { +\& my $max = shift(@_); +\& foreach $foo (@_) { +\& $max = $foo if $max < $foo; +\& } +\& return $max; +\& } +\& $bestday = max($mon,$tue,$wed,$thu,$fri); +.Ve +.PP +Example: +.PP +.Vb 2 +\& # get a line, combining continuation lines +\& # that start with whitespace +\& +\& sub get_line { +\& $thisline = $lookahead; # global variables! +\& LINE: while (defined($lookahead = )) { +\& if ($lookahead =~ /^[ \et]/) { +\& $thisline .= $lookahead; +\& } +\& else { +\& last LINE; +\& } +\& } +\& return $thisline; +\& } +\& +\& $lookahead = ; # get first line +\& while (defined($line = get_line())) { +\& ... +\& } +.Ve +.PP +Assigning to a list of private variables to name your arguments: +.PP +.Vb 4 +\& sub maybeset { +\& my($key, $value) = @_; +\& $Foo{$key} = $value unless $Foo{$key}; +\& } +.Ve +.PP +Because the assignment copies the values, this also has the effect +of turning call-by-reference into call-by-value. Otherwise a +function is free to do in-place modifications of \f(CW@_\fR and change +its caller's values. +.IX Xref "call-by-reference call-by-value" +.PP +.Vb 4 +\& upcase_in($v1, $v2); # this changes $v1 and $v2 +\& sub upcase_in { +\& for (@_) { tr/a\-z/A\-Z/ } +\& } +.Ve +.PP +You aren't allowed to modify constants in this way, of course. If an +argument were actually literal and you tried to change it, you'd take a +(presumably fatal) exception. For example, this won't work: +.IX Xref "call-by-reference call-by-value" +.PP +.Vb 1 +\& upcase_in("frederick"); +.Ve +.PP +It would be much safer if the \f(CW\*(C`upcase_in()\*(C'\fR function +were written to return a copy of its parameters instead +of changing them in place: +.PP +.Vb 7 +\& ($v3, $v4) = upcase($v1, $v2); # this doesn\*(Aqt change $v1 and $v2 +\& sub upcase { +\& return unless defined wantarray; # void context, do nothing +\& my @parms = @_; +\& for (@parms) { tr/a\-z/A\-Z/ } +\& return wantarray ? @parms : $parms[0]; +\& } +.Ve +.PP +Notice how this (unprototyped) function doesn't care whether it was +passed real scalars or arrays. Perl sees all arguments as one big, +long, flat parameter list in \f(CW@_\fR. This is one area where +Perl's simple argument-passing style shines. The \f(CW\*(C`upcase()\*(C'\fR +function would work perfectly well without changing the \f(CW\*(C`upcase()\*(C'\fR +definition even if we fed it things like this: +.PP +.Vb 2 +\& @newlist = upcase(@list1, @list2); +\& @newlist = upcase( split /:/, $var ); +.Ve +.PP +Do not, however, be tempted to do this: +.PP +.Vb 1 +\& (@a, @b) = upcase(@list1, @list2); +.Ve +.PP +Like the flattened incoming parameter list, the return list is also +flattened on return. So all you have managed to do here is stored +everything in \f(CW@a\fR and made \f(CW@b\fR empty. See +\&\*(L"Pass by Reference\*(R" for alternatives. +.PP +A subroutine may be called using an explicit \f(CW\*(C`&\*(C'\fR prefix. The +\&\f(CW\*(C`&\*(C'\fR is optional in modern Perl, as are parentheses if the +subroutine has been predeclared. The \f(CW\*(C`&\*(C'\fR is \fInot\fR optional +when just naming the subroutine, such as when it's used as +an argument to \fBdefined()\fR or \fBundef()\fR. Nor is it optional when you +want to do an indirect subroutine call with a subroutine name or +reference using the \f(CW\*(C`&$subref()\*(C'\fR or \f(CW\*(C`&{$subref}()\*(C'\fR constructs, +although the \f(CW\*(C`$subref\->()\*(C'\fR notation solves that problem. +See perlref for more about all that. +.IX Xref "&" +.PP +Subroutines may be called recursively. If a subroutine is called +using the \f(CW\*(C`&\*(C'\fR form, the argument list is optional, and if omitted, +no \f(CW@_\fR array is set up for the subroutine: the \f(CW@_\fR array at the +time of the call is visible to subroutine instead. This is an +efficiency mechanism that new users may wish to avoid. +.IX Xref "recursion" +.PP +.Vb 2 +\& &foo(1,2,3); # pass three arguments +\& foo(1,2,3); # the same +\& +\& foo(); # pass a null list +\& &foo(); # the same +\& +\& &foo; # foo() get current args, like foo(@_) !! +\& use strict \*(Aqsubs\*(Aq; +\& foo; # like foo() iff sub foo predeclared, else +\& # a compile\-time error +\& no strict \*(Aqsubs\*(Aq; +\& foo; # like foo() iff sub foo predeclared, else +\& # a literal string "foo" +.Ve +.PP +Not only does the \f(CW\*(C`&\*(C'\fR form make the argument list optional, it also +disables any prototype checking on arguments you do provide. This +is partly for historical reasons, and partly for having a convenient way +to cheat if you know what you're doing. See \*(L"Prototypes\*(R" below. +.IX Xref "&" +.PP +Since Perl 5.16.0, the \f(CW\*(C`_\|_SUB_\|_\*(C'\fR token is available under \f(CW\*(C`use feature +\&\*(Aqcurrent_sub\*(Aq\*(C'\fR and \f(CW\*(C`use 5.16.0\*(C'\fR. It will evaluate to a reference to the +currently-running sub, which allows for recursive calls without knowing +your subroutine's name. +.PP +.Vb 6 +\& use 5.16.0; +\& my $factorial = sub { +\& my ($x) = @_; +\& return 1 if $x == 1; +\& return($x * _\|_SUB_\|_\->( $x \- 1 ) ); +\& }; +.Ve +.PP +The behavior of \f(CW\*(C`_\|_SUB_\|_\*(C'\fR within a regex code block (such as \f(CW\*(C`/(?{...})/\*(C'\fR) +is subject to change. +.PP +Subroutines whose names are in all upper case are reserved to the Perl +core, as are modules whose names are in all lower case. A subroutine in +all capitals is a loosely-held convention meaning it will be called +indirectly by the run-time system itself, usually due to a triggered event. +Subroutines whose name start with a left parenthesis are also reserved the +same way. The following is a list of some subroutines that currently do +special, pre-defined things. +.IP "documented later in this document" 4 +.IX Item "documented later in this document" +\&\f(CW\*(C`AUTOLOAD\*(C'\fR +.IP "documented in perlmod" 4 +.IX Item "documented in perlmod" +\&\f(CW\*(C`CLONE\*(C'\fR, \f(CW\*(C`CLONE_SKIP\*(C'\fR +.IP "documented in perlobj" 4 +.IX Item "documented in perlobj" +\&\f(CW\*(C`DESTROY\*(C'\fR, \f(CW\*(C`DOES\*(C'\fR +.IP "documented in perltie" 4 +.IX Item "documented in perltie" +\&\f(CW\*(C`BINMODE\*(C'\fR, \f(CW\*(C`CLEAR\*(C'\fR, \f(CW\*(C`CLOSE\*(C'\fR, \f(CW\*(C`DELETE\*(C'\fR, \f(CW\*(C`DESTROY\*(C'\fR, \f(CW\*(C`EOF\*(C'\fR, \f(CW\*(C`EXISTS\*(C'\fR, +\&\f(CW\*(C`EXTEND\*(C'\fR, \f(CW\*(C`FETCH\*(C'\fR, \f(CW\*(C`FETCHSIZE\*(C'\fR, \f(CW\*(C`FILENO\*(C'\fR, \f(CW\*(C`FIRSTKEY\*(C'\fR, \f(CW\*(C`GETC\*(C'\fR, +\&\f(CW\*(C`NEXTKEY\*(C'\fR, \f(CW\*(C`OPEN\*(C'\fR, \f(CW\*(C`POP\*(C'\fR, \f(CW\*(C`PRINT\*(C'\fR, \f(CW\*(C`PRINTF\*(C'\fR, \f(CW\*(C`PUSH\*(C'\fR, \f(CW\*(C`READ\*(C'\fR, +\&\f(CW\*(C`READLINE\*(C'\fR, \f(CW\*(C`SCALAR\*(C'\fR, \f(CW\*(C`SEEK\*(C'\fR, \f(CW\*(C`SHIFT\*(C'\fR, \f(CW\*(C`SPLICE\*(C'\fR, \f(CW\*(C`STORE\*(C'\fR, +\&\f(CW\*(C`STORESIZE\*(C'\fR, \f(CW\*(C`TELL\*(C'\fR, \f(CW\*(C`TIEARRAY\*(C'\fR, \f(CW\*(C`TIEHANDLE\*(C'\fR, \f(CW\*(C`TIEHASH\*(C'\fR, +\&\f(CW\*(C`TIESCALAR\*(C'\fR, \f(CW\*(C`UNSHIFT\*(C'\fR, \f(CW\*(C`UNTIE\*(C'\fR, \f(CW\*(C`WRITE\*(C'\fR +.IP "documented in PerlIO::via" 4 +.IX Item "documented in PerlIO::via" +\&\f(CW\*(C`BINMODE\*(C'\fR, \f(CW\*(C`CLEARERR\*(C'\fR, \f(CW\*(C`CLOSE\*(C'\fR, \f(CW\*(C`EOF\*(C'\fR, \f(CW\*(C`ERROR\*(C'\fR, \f(CW\*(C`FDOPEN\*(C'\fR, \f(CW\*(C`FILENO\*(C'\fR, +\&\f(CW\*(C`FILL\*(C'\fR, \f(CW\*(C`FLUSH\*(C'\fR, \f(CW\*(C`OPEN\*(C'\fR, \f(CW\*(C`POPPED\*(C'\fR, \f(CW\*(C`PUSHED\*(C'\fR, \f(CW\*(C`READ\*(C'\fR, \f(CW\*(C`SEEK\*(C'\fR, +\&\f(CW\*(C`SETLINEBUF\*(C'\fR, \f(CW\*(C`SYSOPEN\*(C'\fR, \f(CW\*(C`TELL\*(C'\fR, \f(CW\*(C`UNREAD\*(C'\fR, \f(CW\*(C`UTF8\*(C'\fR, \f(CW\*(C`WRITE\*(C'\fR +.IP "documented in perlfunc" 4 +.IX Item "documented in perlfunc" +\&\f(CW\*(C`import\*(C'\fR , \f(CW\*(C`unimport\*(C'\fR , +\&\f(CW\*(C`INC\*(C'\fR +.IP "documented in \s-1UNIVERSAL\s0" 4 +.IX Item "documented in UNIVERSAL" +\&\f(CW\*(C`VERSION\*(C'\fR +.IP "documented in perldebguts" 4 +.IX Item "documented in perldebguts" +\&\f(CW\*(C`DB::DB\*(C'\fR, \f(CW\*(C`DB::sub\*(C'\fR, \f(CW\*(C`DB::lsub\*(C'\fR, \f(CW\*(C`DB::goto\*(C'\fR, \f(CW\*(C`DB::postponed\*(C'\fR +.IP "undocumented, used internally by the overload feature" 4 +.IX Item "undocumented, used internally by the overload feature" +any starting with \f(CW\*(C`(\*(C'\fR +.PP +The \f(CW\*(C`BEGIN\*(C'\fR, \f(CW\*(C`UNITCHECK\*(C'\fR, \f(CW\*(C`CHECK\*(C'\fR, \f(CW\*(C`INIT\*(C'\fR and \f(CW\*(C`END\*(C'\fR subroutines +are not so much subroutines as named special code blocks, of which you +can have more than one in a package, and which you can \fBnot\fR call +explicitly. See \*(L"\s-1BEGIN, UNITCHECK, CHECK, INIT\s0 and \s-1END\*(R"\s0 in perlmod +.SS "Signatures" +.IX Subsection "Signatures" +\&\fB\s-1WARNING\s0\fR: Subroutine signatures are experimental. The feature may be +modified or removed in future versions of Perl. +.PP +Perl has an experimental facility to allow a subroutine's formal +parameters to be introduced by special syntax, separate from the +procedural code of the subroutine body. The formal parameter list +is known as a \fIsignature\fR. The facility must be enabled first by a +pragmatic declaration, \f(CW\*(C`use feature \*(Aqsignatures\*(Aq\*(C'\fR, and it will produce +a warning unless the \*(L"experimental::signatures\*(R" warnings category is +disabled. +.PP +The signature is part of a subroutine's body. Normally the body of a +subroutine is simply a braced block of code, but when using a signature, +the signature is a parenthesised list that goes immediately before the +block, after any name or attributes. +.PP +For example, +.PP +.Vb 1 +\& sub foo :lvalue ($a, $b = 1, @c) { .... } +.Ve +.PP +The signature declares lexical variables that are +in scope for the block. When the subroutine is called, the signature +takes control first. It populates the signature variables from the +list of arguments that were passed. If the argument list doesn't meet +the requirements of the signature, then it will throw an exception. +When the signature processing is complete, control passes to the block. +.PP +Positional parameters are handled by simply naming scalar variables in +the signature. For example, +.PP +.Vb 3 +\& sub foo ($left, $right) { +\& return $left + $right; +\& } +.Ve +.PP +takes two positional parameters, which must be filled at runtime by +two arguments. By default the parameters are mandatory, and it is +not permitted to pass more arguments than expected. So the above is +equivalent to +.PP +.Vb 7 +\& sub foo { +\& die "Too many arguments for subroutine" unless @_ <= 2; +\& die "Too few arguments for subroutine" unless @_ >= 2; +\& my $left = $_[0]; +\& my $right = $_[1]; +\& return $left + $right; +\& } +.Ve +.PP +An argument can be ignored by omitting the main part of the name from +a parameter declaration, leaving just a bare \f(CW\*(C`$\*(C'\fR sigil. For example, +.PP +.Vb 3 +\& sub foo ($first, $, $third) { +\& return "first=$first, third=$third"; +\& } +.Ve +.PP +Although the ignored argument doesn't go into a variable, it is still +mandatory for the caller to pass it. +.PP +A positional parameter is made optional by giving a default value, +separated from the parameter name by \f(CW\*(C`=\*(C'\fR: +.PP +.Vb 3 +\& sub foo ($left, $right = 0) { +\& return $left + $right; +\& } +.Ve +.PP +The above subroutine may be called with either one or two arguments. +The default value expression is evaluated when the subroutine is called, +so it may provide different default values for different calls. It is +only evaluated if the argument was actually omitted from the call. +For example, +.PP +.Vb 4 +\& my $auto_id = 0; +\& sub foo ($thing, $id = $auto_id++) { +\& print "$thing has ID $id"; +\& } +.Ve +.PP +automatically assigns distinct sequential IDs to things for which no +\&\s-1ID\s0 was supplied by the caller. A default value expression may also +refer to parameters earlier in the signature, making the default for +one parameter vary according to the earlier parameters. For example, +.PP +.Vb 3 +\& sub foo ($first_name, $surname, $nickname = $first_name) { +\& print "$first_name $surname is known as \e"$nickname\e""; +\& } +.Ve +.PP +An optional parameter can be nameless just like a mandatory parameter. +For example, +.PP +.Vb 3 +\& sub foo ($thing, $ = 1) { +\& print $thing; +\& } +.Ve +.PP +The parameter's default value will still be evaluated if the corresponding +argument isn't supplied, even though the value won't be stored anywhere. +This is in case evaluating it has important side effects. However, it +will be evaluated in void context, so if it doesn't have side effects +and is not trivial it will generate a warning if the \*(L"void\*(R" warning +category is enabled. If a nameless optional parameter's default value +is not important, it may be omitted just as the parameter's name was: +.PP +.Vb 3 +\& sub foo ($thing, $=) { +\& print $thing; +\& } +.Ve +.PP +Optional positional parameters must come after all mandatory positional +parameters. (If there are no mandatory positional parameters then an +optional positional parameters can be the first thing in the signature.) +If there are multiple optional positional parameters and not enough +arguments are supplied to fill them all, they will be filled from left +to right. +.PP +After positional parameters, additional arguments may be captured in a +slurpy parameter. The simplest form of this is just an array variable: +.PP +.Vb 3 +\& sub foo ($filter, @inputs) { +\& print $filter\->($_) foreach @inputs; +\& } +.Ve +.PP +With a slurpy parameter in the signature, there is no upper limit on how +many arguments may be passed. A slurpy array parameter may be nameless +just like a positional parameter, in which case its only effect is to +turn off the argument limit that would otherwise apply: +.PP +.Vb 3 +\& sub foo ($thing, @) { +\& print $thing; +\& } +.Ve +.PP +A slurpy parameter may instead be a hash, in which case the arguments +available to it are interpreted as alternating keys and values. +There must be as many keys as values: if there is an odd argument then +an exception will be thrown. Keys will be stringified, and if there are +duplicates then the later instance takes precedence over the earlier, +as with standard hash construction. +.PP +.Vb 3 +\& sub foo ($filter, %inputs) { +\& print $filter\->($_, $inputs{$_}) foreach sort keys %inputs; +\& } +.Ve +.PP +A slurpy hash parameter may be nameless just like other kinds of +parameter. It still insists that the number of arguments available to +it be even, even though they're not being put into a variable. +.PP +.Vb 3 +\& sub foo ($thing, %) { +\& print $thing; +\& } +.Ve +.PP +A slurpy parameter, either array or hash, must be the last thing in the +signature. It may follow mandatory and optional positional parameters; +it may also be the only thing in the signature. Slurpy parameters cannot +have default values: if no arguments are supplied for them then you get +an empty array or empty hash. +.PP +A signature may be entirely empty, in which case all it does is check +that the caller passed no arguments: +.PP +.Vb 3 +\& sub foo () { +\& return 123; +\& } +.Ve +.PP +When using a signature, the arguments are still available in the special +array variable \f(CW@_\fR, in addition to the lexical variables of the +signature. There is a difference between the two ways of accessing the +arguments: \f(CW@_\fR \fIaliases\fR the arguments, but the signature variables +get \fIcopies\fR of the arguments. So writing to a signature variable +only changes that variable, and has no effect on the caller's variables, +but writing to an element of \f(CW@_\fR modifies whatever the caller used to +supply that argument. +.PP +There is a potential syntactic ambiguity between signatures and prototypes +(see \*(L"Prototypes\*(R"), because both start with an opening parenthesis and +both can appear in some of the same places, such as just after the name +in a subroutine declaration. For historical reasons, when signatures +are not enabled, any opening parenthesis in such a context will trigger +very forgiving prototype parsing. Most signatures will be interpreted +as prototypes in those circumstances, but won't be valid prototypes. +(A valid prototype cannot contain any alphabetic character.) This will +lead to somewhat confusing error messages. +.PP +To avoid ambiguity, when signatures are enabled the special syntax +for prototypes is disabled. There is no attempt to guess whether a +parenthesised group was intended to be a prototype or a signature. +To give a subroutine a prototype under these circumstances, use a +prototype attribute. For example, +.PP +.Vb 1 +\& sub foo :prototype($) { $_[0] } +.Ve +.PP +It is entirely possible for a subroutine to have both a prototype and +a signature. They do different jobs: the prototype affects compilation +of calls to the subroutine, and the signature puts argument values into +lexical variables at runtime. You can therefore write +.PP +.Vb 3 +\& sub foo :prototype($$) ($left, $right) { +\& return $left + $right; +\& } +.Ve +.PP +The prototype attribute, and any other attributes, must come before +the signature. The signature always immediately precedes the block of +the subroutine's body. +.SS "Private Variables via \fBmy()\fP" +.IX Xref "my variable, lexical lexical lexical variable scope, lexical lexical scope attributes, my" +.IX Subsection "Private Variables via my()" +Synopsis: +.PP +.Vb 5 +\& my $foo; # declare $foo lexically local +\& my (@wid, %get); # declare list of variables local +\& my $foo = "flurp"; # declare $foo lexical, and init it +\& my @oof = @bar; # declare @oof lexical, and init it +\& my $x : Foo = $y; # similar, with an attribute applied +.Ve +.PP +\&\fB\s-1WARNING\s0\fR: The use of attribute lists on \f(CW\*(C`my\*(C'\fR declarations is still +evolving. The current semantics and interface are subject to change. +See attributes and Attribute::Handlers. +.PP +The \f(CW\*(C`my\*(C'\fR operator declares the listed variables to be lexically +confined to the enclosing block, conditional +(\f(CW\*(C`if\*(C'\fR/\f(CW\*(C`unless\*(C'\fR/\f(CW\*(C`elsif\*(C'\fR/\f(CW\*(C`else\*(C'\fR), loop +(\f(CW\*(C`for\*(C'\fR/\f(CW\*(C`foreach\*(C'\fR/\f(CW\*(C`while\*(C'\fR/\f(CW\*(C`until\*(C'\fR/\f(CW\*(C`continue\*(C'\fR), subroutine, \f(CW\*(C`eval\*(C'\fR, +or \f(CW\*(C`do\*(C'\fR/\f(CW\*(C`require\*(C'\fR/\f(CW\*(C`use\*(C'\fR'd file. If more than one value is listed, the +list must be placed in parentheses. All listed elements must be +legal lvalues. Only alphanumeric identifiers may be lexically +scoped\*(--magical built-ins like \f(CW$/\fR must currently be \f(CW\*(C`local\*(C'\fRized +with \f(CW\*(C`local\*(C'\fR instead. +.PP +Unlike dynamic variables created by the \f(CW\*(C`local\*(C'\fR operator, lexical +variables declared with \f(CW\*(C`my\*(C'\fR are totally hidden from the outside +world, including any called subroutines. This is true if it's the +same subroutine called from itself or elsewhere\*(--every call gets +its own copy. +.IX Xref "local" +.PP +This doesn't mean that a \f(CW\*(C`my\*(C'\fR variable declared in a statically +enclosing lexical scope would be invisible. Only dynamic scopes +are cut off. For example, the \f(CW\*(C`bumpx()\*(C'\fR function below has access +to the lexical \f(CW$x\fR variable because both the \f(CW\*(C`my\*(C'\fR and the \f(CW\*(C`sub\*(C'\fR +occurred at the same scope, presumably file scope. +.PP +.Vb 2 +\& my $x = 10; +\& sub bumpx { $x++ } +.Ve +.PP +An \f(CW\*(C`eval()\*(C'\fR, however, can see lexical variables of the scope it is +being evaluated in, so long as the names aren't hidden by declarations within +the \f(CW\*(C`eval()\*(C'\fR itself. See perlref. +.IX Xref "eval, scope of" +.PP +The parameter list to \fBmy()\fR may be assigned to if desired, which allows you +to initialize your variables. (If no initializer is given for a +particular variable, it is created with the undefined value.) Commonly +this is used to name input parameters to a subroutine. Examples: +.PP +.Vb 4 +\& $arg = "fred"; # "global" variable +\& $n = cube_root(27); +\& print "$arg thinks the root is $n\en"; +\& fred thinks the root is 3 +\& +\& sub cube_root { +\& my $arg = shift; # name doesn\*(Aqt matter +\& $arg **= 1/3; +\& return $arg; +\& } +.Ve +.PP +The \f(CW\*(C`my\*(C'\fR is simply a modifier on something you might assign to. So when +you do assign to variables in its argument list, \f(CW\*(C`my\*(C'\fR doesn't +change whether those variables are viewed as a scalar or an array. So +.PP +.Vb 2 +\& my ($foo) = ; # WRONG? +\& my @FOO = ; +.Ve +.PP +both supply a list context to the right-hand side, while +.PP +.Vb 1 +\& my $foo = ; +.Ve +.PP +supplies a scalar context. But the following declares only one variable: +.PP +.Vb 1 +\& my $foo, $bar = 1; # WRONG +.Ve +.PP +That has the same effect as +.PP +.Vb 2 +\& my $foo; +\& $bar = 1; +.Ve +.PP +The declared variable is not introduced (is not visible) until after +the current statement. Thus, +.PP +.Vb 1 +\& my $x = $x; +.Ve +.PP +can be used to initialize a new \f(CW$x\fR with the value of the old \f(CW$x\fR, and +the expression +.PP +.Vb 1 +\& my $x = 123 and $x == 123 +.Ve +.PP +is false unless the old \f(CW$x\fR happened to have the value \f(CW123\fR. +.PP +Lexical scopes of control structures are not bounded precisely by the +braces that delimit their controlled blocks; control expressions are +part of that scope, too. Thus in the loop +.PP +.Vb 5 +\& while (my $line = <>) { +\& $line = lc $line; +\& } continue { +\& print $line; +\& } +.Ve +.PP +the scope of \f(CW$line\fR extends from its declaration throughout the rest of +the loop construct (including the \f(CW\*(C`continue\*(C'\fR clause), but not beyond +it. Similarly, in the conditional +.PP +.Vb 8 +\& if ((my $answer = ) =~ /^yes$/i) { +\& user_agrees(); +\& } elsif ($answer =~ /^no$/i) { +\& user_disagrees(); +\& } else { +\& chomp $answer; +\& die "\*(Aq$answer\*(Aq is neither \*(Aqyes\*(Aq nor \*(Aqno\*(Aq"; +\& } +.Ve +.PP +the scope of \f(CW$answer\fR extends from its declaration through the rest +of that conditional, including any \f(CW\*(C`elsif\*(C'\fR and \f(CW\*(C`else\*(C'\fR clauses, +but not beyond it. See \*(L"Simple Statements\*(R" in perlsyn for information +on the scope of variables in statements with modifiers. +.PP +The \f(CW\*(C`foreach\*(C'\fR loop defaults to scoping its index variable dynamically +in the manner of \f(CW\*(C`local\*(C'\fR. However, if the index variable is +prefixed with the keyword \f(CW\*(C`my\*(C'\fR, or if there is already a lexical +by that name in scope, then a new lexical is created instead. Thus +in the loop +.IX Xref "foreach for" +.PP +.Vb 3 +\& for my $i (1, 2, 3) { +\& some_function(); +\& } +.Ve +.PP +the scope of \f(CW$i\fR extends to the end of the loop, but not beyond it, +rendering the value of \f(CW$i\fR inaccessible within \f(CW\*(C`some_function()\*(C'\fR. +.IX Xref "foreach for" +.PP +Some users may wish to encourage the use of lexically scoped variables. +As an aid to catching implicit uses to package variables, +which are always global, if you say +.PP +.Vb 1 +\& use strict \*(Aqvars\*(Aq; +.Ve +.PP +then any variable mentioned from there to the end of the enclosing +block must either refer to a lexical variable, be predeclared via +\&\f(CW\*(C`our\*(C'\fR or \f(CW\*(C`use vars\*(C'\fR, or else must be fully qualified with the package name. +A compilation error results otherwise. An inner block may countermand +this with \f(CW\*(C`no strict \*(Aqvars\*(Aq\*(C'\fR. +.PP +A \f(CW\*(C`my\*(C'\fR has both a compile-time and a run-time effect. At compile +time, the compiler takes notice of it. The principal usefulness +of this is to quiet \f(CW\*(C`use strict \*(Aqvars\*(Aq\*(C'\fR, but it is also essential +for generation of closures as detailed in perlref. Actual +initialization is delayed until run time, though, so it gets executed +at the appropriate time, such as each time through a loop, for +example. +.PP +Variables declared with \f(CW\*(C`my\*(C'\fR are not part of any package and are therefore +never fully qualified with the package name. In particular, you're not +allowed to try to make a package variable (or other global) lexical: +.PP +.Vb 1 +\& my $pack::var; # ERROR! Illegal syntax +.Ve +.PP +In fact, a dynamic variable (also known as package or global variables) +are still accessible using the fully qualified \f(CW\*(C`::\*(C'\fR notation even while a +lexical of the same name is also visible: +.PP +.Vb 4 +\& package main; +\& local $x = 10; +\& my $x = 20; +\& print "$x and $::x\en"; +.Ve +.PP +That will print out \f(CW20\fR and \f(CW10\fR. +.PP +You may declare \f(CW\*(C`my\*(C'\fR variables at the outermost scope of a file +to hide any such identifiers from the world outside that file. This +is similar in spirit to C's static variables when they are used at +the file level. To do this with a subroutine requires the use of +a closure (an anonymous function that accesses enclosing lexicals). +If you want to create a private subroutine that cannot be called +from outside that block, it can declare a lexical variable containing +an anonymous sub reference: +.PP +.Vb 3 +\& my $secret_version = \*(Aq1.001\-beta\*(Aq; +\& my $secret_sub = sub { print $secret_version }; +\& &$secret_sub(); +.Ve +.PP +As long as the reference is never returned by any function within the +module, no outside module can see the subroutine, because its name is not in +any package's symbol table. Remember that it's not \fI\s-1REALLY\s0\fR called +\&\f(CW$some_pack::secret_version\fR or anything; it's just \f(CW$secret_version\fR, +unqualified and unqualifiable. +.PP +This does not work with object methods, however; all object methods +have to be in the symbol table of some package to be found. See +\&\*(L"Function Templates\*(R" in perlref for something of a work-around to +this. +.SS "Persistent Private Variables" +.IX Xref "state state variable static variable, persistent variable, static closure" +.IX Subsection "Persistent Private Variables" +There are two ways to build persistent private variables in Perl 5.10. +First, you can simply use the \f(CW\*(C`state\*(C'\fR feature. Or, you can use closures, +if you want to stay compatible with releases older than 5.10. +.PP +\fIPersistent variables via \f(BIstate()\fI\fR +.IX Subsection "Persistent variables via state()" +.PP +Beginning with Perl 5.10.0, you can declare variables with the \f(CW\*(C`state\*(C'\fR +keyword in place of \f(CW\*(C`my\*(C'\fR. For that to work, though, you must have +enabled that feature beforehand, either by using the \f(CW\*(C`feature\*(C'\fR pragma, or +by using \f(CW\*(C`\-E\*(C'\fR on one-liners (see feature). Beginning with Perl 5.16, +the \f(CW\*(C`CORE::state\*(C'\fR form does not require the +\&\f(CW\*(C`feature\*(C'\fR pragma. +.PP +The \f(CW\*(C`state\*(C'\fR keyword creates a lexical variable (following the same scoping +rules as \f(CW\*(C`my\*(C'\fR) that persists from one subroutine call to the next. If a +state variable resides inside an anonymous subroutine, then each copy of +the subroutine has its own copy of the state variable. However, the value +of the state variable will still persist between calls to the same copy of +the anonymous subroutine. (Don't forget that \f(CW\*(C`sub { ... }\*(C'\fR creates a new +subroutine each time it is executed.) +.PP +For example, the following code maintains a private counter, incremented +each time the \fBgimme_another()\fR function is called: +.PP +.Vb 2 +\& use feature \*(Aqstate\*(Aq; +\& sub gimme_another { state $x; return ++$x } +.Ve +.PP +And this example uses anonymous subroutines to create separate counters: +.PP +.Vb 4 +\& use feature \*(Aqstate\*(Aq; +\& sub create_counter { +\& return sub { state $x; return ++$x } +\& } +.Ve +.PP +Also, since \f(CW$x\fR is lexical, it can't be reached or modified by any Perl +code outside. +.PP +When combined with variable declaration, simple assignment to \f(CW\*(C`state\*(C'\fR +variables (as in \f(CW\*(C`state $x = 42\*(C'\fR) is executed only the first time. When such +statements are evaluated subsequent times, the assignment is ignored. The +behavior of assignment to \f(CW\*(C`state\*(C'\fR declarations where the left hand side +of the assignment involves any parentheses is currently undefined. +.PP +\fIPersistent variables with closures\fR +.IX Subsection "Persistent variables with closures" +.PP +Just because a lexical variable is lexically (also called statically) +scoped to its enclosing block, \f(CW\*(C`eval\*(C'\fR, or \f(CW\*(C`do\*(C'\fR \s-1FILE,\s0 this doesn't mean that +within a function it works like a C static. It normally works more +like a C auto, but with implicit garbage collection. +.PP +Unlike local variables in C or \*(C+, Perl's lexical variables don't +necessarily get recycled just because their scope has exited. +If something more permanent is still aware of the lexical, it will +stick around. So long as something else references a lexical, that +lexical won't be freed\*(--which is as it should be. You wouldn't want +memory being free until you were done using it, or kept around once you +were done. Automatic garbage collection takes care of this for you. +.PP +This means that you can pass back or save away references to lexical +variables, whereas to return a pointer to a C auto is a grave error. +It also gives us a way to simulate C's function statics. Here's a +mechanism for giving a function private variables with both lexical +scoping and a static lifetime. If you do want to create something like +C's static variables, just enclose the whole function in an extra block, +and put the static variable outside the function but in the block. +.PP +.Vb 8 +\& { +\& my $secret_val = 0; +\& sub gimme_another { +\& return ++$secret_val; +\& } +\& } +\& # $secret_val now becomes unreachable by the outside +\& # world, but retains its value between calls to gimme_another +.Ve +.PP +If this function is being sourced in from a separate file +via \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`use\*(C'\fR, then this is probably just fine. If it's +all in the main program, you'll need to arrange for the \f(CW\*(C`my\*(C'\fR +to be executed early, either by putting the whole block above +your main program, or more likely, placing merely a \f(CW\*(C`BEGIN\*(C'\fR +code block around it to make sure it gets executed before your program +starts to run: +.PP +.Vb 6 +\& BEGIN { +\& my $secret_val = 0; +\& sub gimme_another { +\& return ++$secret_val; +\& } +\& } +.Ve +.PP +See \*(L"\s-1BEGIN, UNITCHECK, CHECK, INIT\s0 and \s-1END\*(R"\s0 in perlmod about the +special triggered code blocks, \f(CW\*(C`BEGIN\*(C'\fR, \f(CW\*(C`UNITCHECK\*(C'\fR, \f(CW\*(C`CHECK\*(C'\fR, +\&\f(CW\*(C`INIT\*(C'\fR and \f(CW\*(C`END\*(C'\fR. +.PP +If declared at the outermost scope (the file scope), then lexicals +work somewhat like C's file statics. They are available to all +functions in that same file declared below them, but are inaccessible +from outside that file. This strategy is sometimes used in modules +to create private variables that the whole module can see. +.SS "Temporary Values via \fBlocal()\fP" +.IX Xref "local scope, dynamic dynamic scope variable, local variable, temporary" +.IX Subsection "Temporary Values via local()" +\&\fB\s-1WARNING\s0\fR: In general, you should be using \f(CW\*(C`my\*(C'\fR instead of \f(CW\*(C`local\*(C'\fR, because +it's faster and safer. Exceptions to this include the global punctuation +variables, global filehandles and formats, and direct manipulation of the +Perl symbol table itself. \f(CW\*(C`local\*(C'\fR is mostly used when the current value +of a variable must be visible to called subroutines. +.PP +Synopsis: +.PP +.Vb 1 +\& # localization of values +\& +\& local $foo; # make $foo dynamically local +\& local (@wid, %get); # make list of variables local +\& local $foo = "flurp"; # make $foo dynamic, and init it +\& local @oof = @bar; # make @oof dynamic, and init it +\& +\& local $hash{key} = "val"; # sets a local value for this hash entry +\& delete local $hash{key}; # delete this entry for the current block +\& local ($cond ? $v1 : $v2); # several types of lvalues support +\& # localization +\& +\& # localization of symbols +\& +\& local *FH; # localize $FH, @FH, %FH, &FH ... +\& local *merlyn = *randal; # now $merlyn is really $randal, plus +\& # @merlyn is really @randal, etc +\& local *merlyn = \*(Aqrandal\*(Aq; # SAME THING: promote \*(Aqrandal\*(Aq to *randal +\& local *merlyn = \e$randal; # just alias $merlyn, not @merlyn etc +.Ve +.PP +A \f(CW\*(C`local\*(C'\fR modifies its listed variables to be \*(L"local\*(R" to the +enclosing block, \f(CW\*(C`eval\*(C'\fR, or \f(CW\*(C`do FILE\*(C'\fR\-\-and to \fIany subroutine +called from within that block\fR. A \f(CW\*(C`local\*(C'\fR just gives temporary +values to global (meaning package) variables. It does \fInot\fR create +a local variable. This is known as dynamic scoping. Lexical scoping +is done with \f(CW\*(C`my\*(C'\fR, which works more like C's auto declarations. +.PP +Some types of lvalues can be localized as well: hash and array elements +and slices, conditionals (provided that their result is always +localizable), and symbolic references. As for simple variables, this +creates new, dynamically scoped values. +.PP +If more than one variable or expression is given to \f(CW\*(C`local\*(C'\fR, they must be +placed in parentheses. This operator works +by saving the current values of those variables in its argument list on a +hidden stack and restoring them upon exiting the block, subroutine, or +eval. This means that called subroutines can also reference the local +variable, but not the global one. The argument list may be assigned to if +desired, which allows you to initialize your local variables. (If no +initializer is given for a particular variable, it is created with an +undefined value.) +.PP +Because \f(CW\*(C`local\*(C'\fR is a run-time operator, it gets executed each time +through a loop. Consequently, it's more efficient to localize your +variables outside the loop. +.PP +\fIGrammatical note on \f(BIlocal()\fI\fR +.IX Xref "local, context" +.IX Subsection "Grammatical note on local()" +.PP +A \f(CW\*(C`local\*(C'\fR is simply a modifier on an lvalue expression. When you assign to +a \f(CW\*(C`local\*(C'\fRized variable, the \f(CW\*(C`local\*(C'\fR doesn't change whether its list is viewed +as a scalar or an array. So +.PP +.Vb 2 +\& local($foo) = ; +\& local @FOO = ; +.Ve +.PP +both supply a list context to the right-hand side, while +.PP +.Vb 1 +\& local $foo = ; +.Ve +.PP +supplies a scalar context. +.PP +\fILocalization of special variables\fR +.IX Xref "local, special variable" +.IX Subsection "Localization of special variables" +.PP +If you localize a special variable, you'll be giving a new value to it, +but its magic won't go away. That means that all side-effects related +to this magic still work with the localized value. +.PP +This feature allows code like this to work : +.PP +.Vb 2 +\& # Read the whole contents of FILE in $slurp +\& { local $/ = undef; $slurp = ; } +.Ve +.PP +Note, however, that this restricts localization of some values ; for +example, the following statement dies, as of perl 5.10.0, with an error +\&\fIModification of a read-only value attempted\fR, because the \f(CW$1\fR variable is +magical and read-only : +.PP +.Vb 1 +\& local $1 = 2; +.Ve +.PP +One exception is the default scalar variable: starting with perl 5.14 +\&\f(CW\*(C`local($_)\*(C'\fR will always strip all magic from \f(CW$_\fR, to make it possible +to safely reuse \f(CW$_\fR in a subroutine. +.PP +\&\fB\s-1WARNING\s0\fR: Localization of tied arrays and hashes does not currently +work as described. +This will be fixed in a future release of Perl; in the meantime, avoid +code that relies on any particular behavior of localising tied arrays +or hashes (localising individual elements is still okay). +See \*(L"Localising Tied Arrays and Hashes Is Broken\*(R" in perl58delta for more +details. +.IX Xref "local, tie" +.PP +\fILocalization of globs\fR +.IX Xref "local, glob glob" +.IX Subsection "Localization of globs" +.PP +The construct +.PP +.Vb 1 +\& local *name; +.Ve +.PP +creates a whole new symbol table entry for the glob \f(CW\*(C`name\*(C'\fR in the +current package. That means that all variables in its glob slot ($name, +\&\f(CW@name\fR, \f(CW%name\fR, &name, and the \f(CW\*(C`name\*(C'\fR filehandle) are dynamically reset. +.PP +This implies, among other things, that any magic eventually carried by +those variables is locally lost. In other words, saying \f(CW\*(C`local */\*(C'\fR +will not have any effect on the internal value of the input record +separator. +.PP +\fILocalization of elements of composite types\fR +.IX Xref "local, composite type element local, array element local, hash element" +.IX Subsection "Localization of elements of composite types" +.PP +It's also worth taking a moment to explain what happens when you +\&\f(CW\*(C`local\*(C'\fRize a member of a composite type (i.e. an array or hash element). +In this case, the element is \f(CW\*(C`local\*(C'\fRized \fIby name\fR. This means that +when the scope of the \f(CW\*(C`local()\*(C'\fR ends, the saved value will be +restored to the hash element whose key was named in the \f(CW\*(C`local()\*(C'\fR, or +the array element whose index was named in the \f(CW\*(C`local()\*(C'\fR. If that +element was deleted while the \f(CW\*(C`local()\*(C'\fR was in effect (e.g. by a +\&\f(CW\*(C`delete()\*(C'\fR from a hash or a \f(CW\*(C`shift()\*(C'\fR of an array), it will spring +back into existence, possibly extending an array and filling in the +skipped elements with \f(CW\*(C`undef\*(C'\fR. For instance, if you say +.PP +.Vb 10 +\& %hash = ( \*(AqThis\*(Aq => \*(Aqis\*(Aq, \*(Aqa\*(Aq => \*(Aqtest\*(Aq ); +\& @ary = ( 0..5 ); +\& { +\& local($ary[5]) = 6; +\& local($hash{\*(Aqa\*(Aq}) = \*(Aqdrill\*(Aq; +\& while (my $e = pop(@ary)) { +\& print "$e . . .\en"; +\& last unless $e > 3; +\& } +\& if (@ary) { +\& $hash{\*(Aqonly a\*(Aq} = \*(Aqtest\*(Aq; +\& delete $hash{\*(Aqa\*(Aq}; +\& } +\& } +\& print join(\*(Aq \*(Aq, map { "$_ $hash{$_}" } sort keys %hash),".\en"; +\& print "The array has ",scalar(@ary)," elements: ", +\& join(\*(Aq, \*(Aq, map { defined $_ ? $_ : \*(Aqundef\*(Aq } @ary),"\en"; +.Ve +.PP +Perl will print +.PP +.Vb 5 +\& 6 . . . +\& 4 . . . +\& 3 . . . +\& This is a test only a test. +\& The array has 6 elements: 0, 1, 2, undef, undef, 5 +.Ve +.PP +The behavior of \fBlocal()\fR on non-existent members of composite +types is subject to change in future. The behavior of \fBlocal()\fR +on array elements specified using negative indexes is particularly +surprising, and is very likely to change. +.PP +\fILocalized deletion of elements of composite types\fR +.IX Xref "delete local, composite type element local, array element local, hash element" +.IX Subsection "Localized deletion of elements of composite types" +.PP +You can use the \f(CW\*(C`delete local $array[$idx]\*(C'\fR and \f(CW\*(C`delete local $hash{key}\*(C'\fR +constructs to delete a composite type entry for the current block and restore +it when it ends. They return the array/hash value before the localization, +which means that they are respectively equivalent to +.PP +.Vb 6 +\& do { +\& my $val = $array[$idx]; +\& local $array[$idx]; +\& delete $array[$idx]; +\& $val +\& } +.Ve +.PP +and +.PP +.Vb 6 +\& do { +\& my $val = $hash{key}; +\& local $hash{key}; +\& delete $hash{key}; +\& $val +\& } +.Ve +.PP +except that for those the \f(CW\*(C`local\*(C'\fR is +scoped to the \f(CW\*(C`do\*(C'\fR block. Slices are +also accepted. +.PP +.Vb 4 +\& my %hash = ( +\& a => [ 7, 8, 9 ], +\& b => 1, +\& ) +\& +\& { +\& my $a = delete local $hash{a}; +\& # $a is [ 7, 8, 9 ] +\& # %hash is (b => 1) +\& +\& { +\& my @nums = delete local @$a[0, 2] +\& # @nums is (7, 9) +\& # $a is [ undef, 8 ] +\& +\& $a[0] = 999; # will be erased when the scope ends +\& } +\& # $a is back to [ 7, 8, 9 ] +\& +\& } +\& # %hash is back to its original state +.Ve +.SS "Lvalue subroutines" +.IX Xref "lvalue subroutine, lvalue" +.IX Subsection "Lvalue subroutines" +It is possible to return a modifiable value from a subroutine. +To do this, you have to declare the subroutine to return an lvalue. +.PP +.Vb 7 +\& my $val; +\& sub canmod : lvalue { +\& $val; # or: return $val; +\& } +\& sub nomod { +\& $val; +\& } +\& +\& canmod() = 5; # assigns to $val +\& nomod() = 5; # ERROR +.Ve +.PP +The scalar/list context for the subroutine and for the right-hand +side of assignment is determined as if the subroutine call is replaced +by a scalar. For example, consider: +.PP +.Vb 1 +\& data(2,3) = get_data(3,4); +.Ve +.PP +Both subroutines here are called in a scalar context, while in: +.PP +.Vb 1 +\& (data(2,3)) = get_data(3,4); +.Ve +.PP +and in: +.PP +.Vb 1 +\& (data(2),data(3)) = get_data(3,4); +.Ve +.PP +all the subroutines are called in a list context. +.PP +Lvalue subroutines are convenient, but you have to keep in mind that, +when used with objects, they may violate encapsulation. A normal +mutator can check the supplied argument before setting the attribute +it is protecting, an lvalue subroutine cannot. If you require any +special processing when storing and retrieving the values, consider +using the \s-1CPAN\s0 module Sentinel or something similar. +.SS "Lexical Subroutines" +.IX Xref "my sub state sub our sub subroutine, lexical" +.IX Subsection "Lexical Subroutines" +Beginning with Perl 5.18, you can declare a private subroutine with \f(CW\*(C`my\*(C'\fR +or \f(CW\*(C`state\*(C'\fR. As with state variables, the \f(CW\*(C`state\*(C'\fR keyword is only +available under \f(CW\*(C`use feature \*(Aqstate\*(Aq\*(C'\fR or \f(CW\*(C`use 5.010\*(C'\fR or higher. +.PP +Prior to Perl 5.26, lexical subroutines were deemed experimental and were +available only under the \f(CW\*(C`use feature \*(Aqlexical_subs\*(Aq\*(C'\fR pragma. They also +produced a warning unless the \*(L"experimental::lexical_subs\*(R" warnings +category was disabled. +.PP +These subroutines are only visible within the block in which they are +declared, and only after that declaration: +.PP +.Vb 4 +\& # Include these two lines if your code is intended to run under Perl +\& # versions earlier than 5.26. +\& no warnings "experimental::lexical_subs"; +\& use feature \*(Aqlexical_subs\*(Aq; +\& +\& foo(); # calls the package/global subroutine +\& state sub foo { +\& foo(); # also calls the package subroutine +\& } +\& foo(); # calls "state" sub +\& my $ref = \e&foo; # take a reference to "state" sub +\& +\& my sub bar { ... } +\& bar(); # calls "my" sub +.Ve +.PP +You can't (directly) write a recursive lexical subroutine: +.PP +.Vb 4 +\& # WRONG +\& my sub baz { +\& baz(); +\& } +.Ve +.PP +This example fails because \f(CW\*(C`baz()\*(C'\fR refers to the package/global subroutine +\&\f(CW\*(C`baz\*(C'\fR, not the lexical subroutine currently being defined. +.PP +The solution is to use \f(CW\*(C`_\|_SUB_\|_\*(C'\fR: +.PP +.Vb 3 +\& my sub baz { +\& _\|_SUB_\|_\->(); # calls itself +\& } +.Ve +.PP +It is possible to predeclare a lexical subroutine. The \f(CW\*(C`sub foo {...}\*(C'\fR +subroutine definition syntax respects any previous \f(CW\*(C`my sub;\*(C'\fR or \f(CW\*(C`state sub;\*(C'\fR +declaration. Using this to define recursive subroutines is a bad idea, +however: +.PP +.Vb 4 +\& my sub baz; # predeclaration +\& sub baz { # define the "my" sub +\& baz(); # WRONG: calls itself, but leaks memory +\& } +.Ve +.PP +Just like \f(CW\*(C`my $f; $f = sub { $f\->() }\*(C'\fR, this example leaks memory. The +name \f(CW\*(C`baz\*(C'\fR is a reference to the subroutine, and the subroutine uses the name +\&\f(CW\*(C`baz\*(C'\fR; they keep each other alive (see \*(L"Circular References\*(R" in perlref). +.PP +\fI\f(CI\*(C`state sub\*(C'\fI vs \f(CI\*(C`my sub\*(C'\fI\fR +.IX Subsection "state sub vs my sub" +.PP +What is the difference between \*(L"state\*(R" subs and \*(L"my\*(R" subs? Each time that +execution enters a block when \*(L"my\*(R" subs are declared, a new copy of each +sub is created. \*(L"State\*(R" subroutines persist from one execution of the +containing block to the next. +.PP +So, in general, \*(L"state\*(R" subroutines are faster. But \*(L"my\*(R" subs are +necessary if you want to create closures: +.PP +.Vb 7 +\& sub whatever { +\& my $x = shift; +\& my sub inner { +\& ... do something with $x ... +\& } +\& inner(); +\& } +.Ve +.PP +In this example, a new \f(CW$x\fR is created when \f(CW\*(C`whatever\*(C'\fR is called, and +also a new \f(CW\*(C`inner\*(C'\fR, which can see the new \f(CW$x\fR. A \*(L"state\*(R" sub will only +see the \f(CW$x\fR from the first call to \f(CW\*(C`whatever\*(C'\fR. +.PP +\fI\f(CI\*(C`our\*(C'\fI subroutines\fR +.IX Subsection "our subroutines" +.PP +Like \f(CW\*(C`our $variable\*(C'\fR, \f(CW\*(C`our sub\*(C'\fR creates a lexical alias to the package +subroutine of the same name. +.PP +The two main uses for this are to switch back to using the package sub +inside an inner scope: +.PP +.Vb 1 +\& sub foo { ... } +\& +\& sub bar { +\& my sub foo { ... } +\& { +\& # need to use the outer foo here +\& our sub foo; +\& foo(); +\& } +\& } +.Ve +.PP +and to make a subroutine visible to other packages in the same scope: +.PP +.Vb 1 +\& package MySneakyModule; +\& +\& our sub do_something { ... } +\& +\& sub do_something_with_caller { +\& package DB; +\& () = caller 1; # sets @DB::args +\& do_something(@args); # uses MySneakyModule::do_something +\& } +.Ve +.SS "Passing Symbol Table Entries (typeglobs)" +.IX Xref "typeglob *" +.IX Subsection "Passing Symbol Table Entries (typeglobs)" +\&\fB\s-1WARNING\s0\fR: The mechanism described in this section was originally +the only way to simulate pass-by-reference in older versions of +Perl. While it still works fine in modern versions, the new reference +mechanism is generally easier to work with. See below. +.PP +Sometimes you don't want to pass the value of an array to a subroutine +but rather the name of it, so that the subroutine can modify the global +copy of it rather than working with a local copy. In perl you can +refer to all objects of a particular name by prefixing the name +with a star: \f(CW*foo\fR. This is often known as a \*(L"typeglob\*(R", because the +star on the front can be thought of as a wildcard match for all the +funny prefix characters on variables and subroutines and such. +.PP +When evaluated, the typeglob produces a scalar value that represents +all the objects of that name, including any filehandle, format, or +subroutine. When assigned to, it causes the name mentioned to refer to +whatever \f(CW\*(C`*\*(C'\fR value was assigned to it. Example: +.PP +.Vb 8 +\& sub doubleary { +\& local(*someary) = @_; +\& foreach $elem (@someary) { +\& $elem *= 2; +\& } +\& } +\& doubleary(*foo); +\& doubleary(*bar); +.Ve +.PP +Scalars are already passed by reference, so you can modify +scalar arguments without using this mechanism by referring explicitly +to \f(CW$_[0]\fR etc. You can modify all the elements of an array by passing +all the elements as scalars, but you have to use the \f(CW\*(C`*\*(C'\fR mechanism (or +the equivalent reference mechanism) to \f(CW\*(C`push\*(C'\fR, \f(CW\*(C`pop\*(C'\fR, or change the size of +an array. It will certainly be faster to pass the typeglob (or reference). +.PP +Even if you don't want to modify an array, this mechanism is useful for +passing multiple arrays in a single \s-1LIST,\s0 because normally the \s-1LIST\s0 +mechanism will merge all the array values so that you can't extract out +the individual arrays. For more on typeglobs, see +\&\*(L"Typeglobs and Filehandles\*(R" in perldata. +.SS "When to Still Use \fBlocal()\fP" +.IX Xref "local variable, local" +.IX Subsection "When to Still Use local()" +Despite the existence of \f(CW\*(C`my\*(C'\fR, there are still three places where the +\&\f(CW\*(C`local\*(C'\fR operator still shines. In fact, in these three places, you +\&\fImust\fR use \f(CW\*(C`local\*(C'\fR instead of \f(CW\*(C`my\*(C'\fR. +.IP "1." 4 +You need to give a global variable a temporary value, especially \f(CW$_\fR. +.Sp +The global variables, like \f(CW@ARGV\fR or the punctuation variables, must be +\&\f(CW\*(C`local\*(C'\fRized with \f(CW\*(C`local()\*(C'\fR. This block reads in \fI/etc/motd\fR, and splits +it up into chunks separated by lines of equal signs, which are placed +in \f(CW@Fields\fR. +.Sp +.Vb 6 +\& { +\& local @ARGV = ("/etc/motd"); +\& local $/ = undef; +\& local $_ = <>; +\& @Fields = split /^\es*=+\es*$/; +\& } +.Ve +.Sp +It particular, it's important to \f(CW\*(C`local\*(C'\fRize \f(CW$_\fR in any routine that assigns +to it. Look out for implicit assignments in \f(CW\*(C`while\*(C'\fR conditionals. +.IP "2." 4 +You need to create a local file or directory handle or a local function. +.Sp +A function that needs a filehandle of its own must use +\&\f(CW\*(C`local()\*(C'\fR on a complete typeglob. This can be used to create new symbol +table entries: +.Sp +.Vb 6 +\& sub ioqueue { +\& local (*READER, *WRITER); # not my! +\& pipe (READER, WRITER) or die "pipe: $!"; +\& return (*READER, *WRITER); +\& } +\& ($head, $tail) = ioqueue(); +.Ve +.Sp +See the Symbol module for a way to create anonymous symbol table +entries. +.Sp +Because assignment of a reference to a typeglob creates an alias, this +can be used to create what is effectively a local function, or at least, +a local alias. +.Sp +.Vb 6 +\& { +\& local *grow = \e&shrink; # only until this block exits +\& grow(); # really calls shrink() +\& move(); # if move() grow()s, it shrink()s too +\& } +\& grow(); # get the real grow() again +.Ve +.Sp +See \*(L"Function Templates\*(R" in perlref for more about manipulating +functions by name in this way. +.IP "3." 4 +You want to temporarily change just one element of an array or hash. +.Sp +You can \f(CW\*(C`local\*(C'\fRize just one element of an aggregate. Usually this +is done on dynamics: +.Sp +.Vb 5 +\& { +\& local $SIG{INT} = \*(AqIGNORE\*(Aq; +\& funct(); # uninterruptible +\& } +\& # interruptibility automatically restored here +.Ve +.Sp +But it also works on lexically declared aggregates. +.SS "Pass by Reference" +.IX Xref "pass by reference pass-by-reference reference" +.IX Subsection "Pass by Reference" +If you want to pass more than one array or hash into a function\*(--or +return them from it\*(--and have them maintain their integrity, then +you're going to have to use an explicit pass-by-reference. Before you +do that, you need to understand references as detailed in perlref. +This section may not make much sense to you otherwise. +.PP +Here are a few simple examples. First, let's pass in several arrays +to a function and have it \f(CW\*(C`pop\*(C'\fR all of then, returning a new list +of all their former last elements: +.PP +.Vb 1 +\& @tailings = popmany ( \e@a, \e@b, \e@c, \e@d ); +\& +\& sub popmany { +\& my $aref; +\& my @retlist; +\& foreach $aref ( @_ ) { +\& push @retlist, pop @$aref; +\& } +\& return @retlist; +\& } +.Ve +.PP +Here's how you might write a function that returns a +list of keys occurring in all the hashes passed to it: +.PP +.Vb 10 +\& @common = inter( \e%foo, \e%bar, \e%joe ); +\& sub inter { +\& my ($k, $href, %seen); # locals +\& foreach $href (@_) { +\& while ( $k = each %$href ) { +\& $seen{$k}++; +\& } +\& } +\& return grep { $seen{$_} == @_ } keys %seen; +\& } +.Ve +.PP +So far, we're using just the normal list return mechanism. +What happens if you want to pass or return a hash? Well, +if you're using only one of them, or you don't mind them +concatenating, then the normal calling convention is ok, although +a little expensive. +.PP +Where people get into trouble is here: +.PP +.Vb 3 +\& (@a, @b) = func(@c, @d); +\&or +\& (%a, %b) = func(%c, %d); +.Ve +.PP +That syntax simply won't work. It sets just \f(CW@a\fR or \f(CW%a\fR and +clears the \f(CW@b\fR or \f(CW%b\fR. Plus the function didn't get passed +into two separate arrays or hashes: it got one long list in \f(CW@_\fR, +as always. +.PP +If you can arrange for everyone to deal with this through references, it's +cleaner code, although not so nice to look at. Here's a function that +takes two array references as arguments, returning the two array elements +in order of how many elements they have in them: +.PP +.Vb 10 +\& ($aref, $bref) = func(\e@c, \e@d); +\& print "@$aref has more than @$bref\en"; +\& sub func { +\& my ($cref, $dref) = @_; +\& if (@$cref > @$dref) { +\& return ($cref, $dref); +\& } else { +\& return ($dref, $cref); +\& } +\& } +.Ve +.PP +It turns out that you can actually do this also: +.PP +.Vb 10 +\& (*a, *b) = func(\e@c, \e@d); +\& print "@a has more than @b\en"; +\& sub func { +\& local (*c, *d) = @_; +\& if (@c > @d) { +\& return (\e@c, \e@d); +\& } else { +\& return (\e@d, \e@c); +\& } +\& } +.Ve +.PP +Here we're using the typeglobs to do symbol table aliasing. It's +a tad subtle, though, and also won't work if you're using \f(CW\*(C`my\*(C'\fR +variables, because only globals (even in disguise as \f(CW\*(C`local\*(C'\fRs) +are in the symbol table. +.PP +If you're passing around filehandles, you could usually just use the bare +typeglob, like \f(CW*STDOUT\fR, but typeglobs references work, too. +For example: +.PP +.Vb 5 +\& splutter(\e*STDOUT); +\& sub splutter { +\& my $fh = shift; +\& print $fh "her um well a hmmm\en"; +\& } +\& +\& $rec = get_rec(\e*STDIN); +\& sub get_rec { +\& my $fh = shift; +\& return scalar <$fh>; +\& } +.Ve +.PP +If you're planning on generating new filehandles, you could do this. +Notice to pass back just the bare *FH, not its reference. +.PP +.Vb 5 +\& sub openit { +\& my $path = shift; +\& local *FH; +\& return open (FH, $path) ? *FH : undef; +\& } +.Ve +.SS "Prototypes" +.IX Xref "prototype subroutine, prototype" +.IX Subsection "Prototypes" +Perl supports a very limited kind of compile-time argument checking +using function prototyping. This can be declared in either the \s-1PROTO\s0 +section or with a prototype attribute. +If you declare either of +.PP +.Vb 2 +\& sub mypush (\e@@) +\& sub mypush :prototype(\e@@) +.Ve +.PP +then \f(CW\*(C`mypush()\*(C'\fR takes arguments exactly like \f(CW\*(C`push()\*(C'\fR does. +.PP +If subroutine signatures are enabled (see \*(L"Signatures\*(R"), then +the shorter \s-1PROTO\s0 syntax is unavailable, because it would clash with +signatures. In that case, a prototype can only be declared in the form +of an attribute. +.PP +The +function declaration must be visible at compile time. The prototype +affects only interpretation of new-style calls to the function, +where new-style is defined as not using the \f(CW\*(C`&\*(C'\fR character. In +other words, if you call it like a built-in function, then it behaves +like a built-in function. If you call it like an old-fashioned +subroutine, then it behaves like an old-fashioned subroutine. It +naturally falls out from this rule that prototypes have no influence +on subroutine references like \f(CW\*(C`\e&foo\*(C'\fR or on indirect subroutine +calls like \f(CW\*(C`&{$subref}\*(C'\fR or \f(CW\*(C`$subref\->()\*(C'\fR. +.PP +Method calls are not influenced by prototypes either, because the +function to be called is indeterminate at compile time, since +the exact code called depends on inheritance. +.PP +Because the intent of this feature is primarily to let you define +subroutines that work like built-in functions, here are prototypes +for some other functions that parse almost exactly like the +corresponding built-in. +.PP +.Vb 1 +\& Declared as Called as +\& +\& sub mylink ($$) mylink $old, $new +\& sub myvec ($$$) myvec $var, $offset, 1 +\& sub myindex ($$;$) myindex &getstring, "substr" +\& sub mysyswrite ($$$;$) mysyswrite $buf, 0, length($buf) \- $off, $off +\& sub myreverse (@) myreverse $a, $b, $c +\& sub myjoin ($@) myjoin ":", $a, $b, $c +\& sub mypop (\e@) mypop @array +\& sub mysplice (\e@$$@) mysplice @array, 0, 2, @pushme +\& sub mykeys (\e[%@]) mykeys %{$hashref} +\& sub myopen (*;$) myopen HANDLE, $name +\& sub mypipe (**) mypipe READHANDLE, WRITEHANDLE +\& sub mygrep (&@) mygrep { /foo/ } $a, $b, $c +\& sub myrand (;$) myrand 42 +\& sub mytime () mytime +.Ve +.PP +Any backslashed prototype character represents an actual argument +that must start with that character (optionally preceded by \f(CW\*(C`my\*(C'\fR, +\&\f(CW\*(C`our\*(C'\fR or \f(CW\*(C`local\*(C'\fR), with the exception of \f(CW\*(C`$\*(C'\fR, which will +accept any scalar lvalue expression, such as \f(CW\*(C`$foo = 7\*(C'\fR or +\&\f(CW\*(C`my_function()\->[0]\*(C'\fR. The value passed as part of \f(CW@_\fR will be a +reference to the actual argument given in the subroutine call, +obtained by applying \f(CW\*(C`\e\*(C'\fR to that argument. +.PP +You can use the \f(CW\*(C`\e[]\*(C'\fR backslash group notation to specify more than one +allowed argument type. For example: +.PP +.Vb 1 +\& sub myref (\e[$@%&*]) +.Ve +.PP +will allow calling \fBmyref()\fR as +.PP +.Vb 5 +\& myref $var +\& myref @array +\& myref %hash +\& myref &sub +\& myref *glob +.Ve +.PP +and the first argument of \fBmyref()\fR will be a reference to +a scalar, an array, a hash, a code, or a glob. +.PP +Unbackslashed prototype characters have special meanings. Any +unbackslashed \f(CW\*(C`@\*(C'\fR or \f(CW\*(C`%\*(C'\fR eats all remaining arguments, and forces +list context. An argument represented by \f(CW\*(C`$\*(C'\fR forces scalar context. An +\&\f(CW\*(C`&\*(C'\fR requires an anonymous subroutine, which, if passed as the first +argument, does not require the \f(CW\*(C`sub\*(C'\fR keyword or a subsequent comma. +.PP +A \f(CW\*(C`*\*(C'\fR allows the subroutine to accept a bareword, constant, scalar expression, +typeglob, or a reference to a typeglob in that slot. The value will be +available to the subroutine either as a simple scalar, or (in the latter +two cases) as a reference to the typeglob. If you wish to always convert +such arguments to a typeglob reference, use \fBSymbol::qualify_to_ref()\fR as +follows: +.PP +.Vb 1 +\& use Symbol \*(Aqqualify_to_ref\*(Aq; +\& +\& sub foo (*) { +\& my $fh = qualify_to_ref(shift, caller); +\& ... +\& } +.Ve +.PP +The \f(CW\*(C`+\*(C'\fR prototype is a special alternative to \f(CW\*(C`$\*(C'\fR that will act like +\&\f(CW\*(C`\e[@%]\*(C'\fR when given a literal array or hash variable, but will otherwise +force scalar context on the argument. This is useful for functions which +should accept either a literal array or an array reference as the argument: +.PP +.Vb 5 +\& sub mypush (+@) { +\& my $aref = shift; +\& die "Not an array or arrayref" unless ref $aref eq \*(AqARRAY\*(Aq; +\& push @$aref, @_; +\& } +.Ve +.PP +When using the \f(CW\*(C`+\*(C'\fR prototype, your function must check that the argument +is of an acceptable type. +.PP +A semicolon (\f(CW\*(C`;\*(C'\fR) separates mandatory arguments from optional arguments. +It is redundant before \f(CW\*(C`@\*(C'\fR or \f(CW\*(C`%\*(C'\fR, which gobble up everything else. +.PP +As the last character of a prototype, or just before a semicolon, a \f(CW\*(C`@\*(C'\fR +or a \f(CW\*(C`%\*(C'\fR, you can use \f(CW\*(C`_\*(C'\fR in place of \f(CW\*(C`$\*(C'\fR: if this argument is not +provided, \f(CW$_\fR will be used instead. +.PP +Note how the last three examples in the table above are treated +specially by the parser. \f(CW\*(C`mygrep()\*(C'\fR is parsed as a true list +operator, \f(CW\*(C`myrand()\*(C'\fR is parsed as a true unary operator with unary +precedence the same as \f(CW\*(C`rand()\*(C'\fR, and \f(CW\*(C`mytime()\*(C'\fR is truly without +arguments, just like \f(CW\*(C`time()\*(C'\fR. That is, if you say +.PP +.Vb 1 +\& mytime +2; +.Ve +.PP +you'll get \f(CW\*(C`mytime() + 2\*(C'\fR, not \f(CWmytime(2)\fR, which is how it would be parsed +without a prototype. If you want to force a unary function to have the +same precedence as a list operator, add \f(CW\*(C`;\*(C'\fR to the end of the prototype: +.PP +.Vb 2 +\& sub mygetprotobynumber($;); +\& mygetprotobynumber $a > $b; # parsed as mygetprotobynumber($a > $b) +.Ve +.PP +The interesting thing about \f(CW\*(C`&\*(C'\fR is that you can generate new syntax with it, +provided it's in the initial position: +.IX Xref "&" +.PP +.Vb 9 +\& sub try (&@) { +\& my($try,$catch) = @_; +\& eval { &$try }; +\& if ($@) { +\& local $_ = $@; +\& &$catch; +\& } +\& } +\& sub catch (&) { $_[0] } +\& +\& try { +\& die "phooey"; +\& } catch { +\& /phooey/ and print "unphooey\en"; +\& }; +.Ve +.PP +That prints \f(CW"unphooey"\fR. (Yes, there are still unresolved +issues having to do with visibility of \f(CW@_\fR. I'm ignoring that +question for the moment. (But note that if we make \f(CW@_\fR lexically +scoped, those anonymous subroutines can act like closures... (Gee, +is this sounding a little Lispish? (Never mind.)))) +.PP +And here's a reimplementation of the Perl \f(CW\*(C`grep\*(C'\fR operator: +.IX Xref "grep" +.PP +.Vb 8 +\& sub mygrep (&@) { +\& my $code = shift; +\& my @result; +\& foreach $_ (@_) { +\& push(@result, $_) if &$code; +\& } +\& @result; +\& } +.Ve +.PP +Some folks would prefer full alphanumeric prototypes. Alphanumerics have +been intentionally left out of prototypes for the express purpose of +someday in the future adding named, formal parameters. The current +mechanism's main goal is to let module writers provide better diagnostics +for module users. Larry feels the notation quite understandable to Perl +programmers, and that it will not intrude greatly upon the meat of the +module, nor make it harder to read. The line noise is visually +encapsulated into a small pill that's easy to swallow. +.PP +If you try to use an alphanumeric sequence in a prototype you will +generate an optional warning \- \*(L"Illegal character in prototype...\*(R". +Unfortunately earlier versions of Perl allowed the prototype to be +used as long as its prefix was a valid prototype. The warning may be +upgraded to a fatal error in a future version of Perl once the +majority of offending code is fixed. +.PP +It's probably best to prototype new functions, not retrofit prototyping +into older ones. That's because you must be especially careful about +silent impositions of differing list versus scalar contexts. For example, +if you decide that a function should take just one parameter, like this: +.PP +.Vb 4 +\& sub func ($) { +\& my $n = shift; +\& print "you gave me $n\en"; +\& } +.Ve +.PP +and someone has been calling it with an array or expression +returning a list: +.PP +.Vb 2 +\& func(@foo); +\& func( $text =~ /\ew+/g ); +.Ve +.PP +Then you've just supplied an automatic \f(CW\*(C`scalar\*(C'\fR in front of their +argument, which can be more than a bit surprising. The old \f(CW@foo\fR +which used to hold one thing doesn't get passed in. Instead, +\&\f(CW\*(C`func()\*(C'\fR now gets passed in a \f(CW1\fR; that is, the number of elements +in \f(CW@foo\fR. And the \f(CW\*(C`m//g\*(C'\fR gets called in scalar context so instead of a +list of words it returns a boolean result and advances \f(CW\*(C`pos($text)\*(C'\fR. Ouch! +.PP +If a sub has both a \s-1PROTO\s0 and a \s-1BLOCK,\s0 the prototype is not applied +until after the \s-1BLOCK\s0 is completely defined. This means that a recursive +function with a prototype has to be predeclared for the prototype to take +effect, like so: +.PP +.Vb 4 +\& sub foo($$); +\& sub foo($$) { +\& foo 1, 2; +\& } +.Ve +.PP +This is all very powerful, of course, and should be used only in moderation +to make the world a better place. +.SS "Constant Functions" +.IX Xref "constant" +.IX Subsection "Constant Functions" +Functions with a prototype of \f(CW\*(C`()\*(C'\fR are potential candidates for +inlining. If the result after optimization and constant folding +is either a constant or a lexically-scoped scalar which has no other +references, then it will be used in place of function calls made +without \f(CW\*(C`&\*(C'\fR. Calls made using \f(CW\*(C`&\*(C'\fR are never inlined. (See +\&\fIconstant.pm\fR for an easy way to declare most constants.) +.PP +The following functions would all be inlined: +.PP +.Vb 5 +\& sub pi () { 3.14159 } # Not exact, but close. +\& sub PI () { 4 * atan2 1, 1 } # As good as it gets, +\& # and it\*(Aqs inlined, too! +\& sub ST_DEV () { 0 } +\& sub ST_INO () { 1 } +\& +\& sub FLAG_FOO () { 1 << 8 } +\& sub FLAG_BAR () { 1 << 9 } +\& sub FLAG_MASK () { FLAG_FOO | FLAG_BAR } +\& +\& sub OPT_BAZ () { not (0x1B58 & FLAG_MASK) } +\& +\& sub N () { int(OPT_BAZ) / 3 } +\& +\& sub FOO_SET () { 1 if FLAG_MASK & FLAG_FOO } +\& sub FOO_SET2 () { if (FLAG_MASK & FLAG_FOO) { 1 } } +.Ve +.PP +(Be aware that the last example was not always inlined in Perl 5.20 and +earlier, which did not behave consistently with subroutines containing +inner scopes.) You can countermand inlining by using an explicit +\&\f(CW\*(C`return\*(C'\fR: +.PP +.Vb 9 +\& sub baz_val () { +\& if (OPT_BAZ) { +\& return 23; +\& } +\& else { +\& return 42; +\& } +\& } +\& sub bonk_val () { return 12345 } +.Ve +.PP +As alluded to earlier you can also declare inlined subs dynamically at +\&\s-1BEGIN\s0 time if their body consists of a lexically-scoped scalar which +has no other references. Only the first example here will be inlined: +.PP +.Vb 5 +\& BEGIN { +\& my $var = 1; +\& no strict \*(Aqrefs\*(Aq; +\& *INLINED = sub () { $var }; +\& } +\& +\& BEGIN { +\& my $var = 1; +\& my $ref = \e$var; +\& no strict \*(Aqrefs\*(Aq; +\& *NOT_INLINED = sub () { $var }; +\& } +.Ve +.PP +A not so obvious caveat with this (see [\s-1RT\s0 #79908]) is that the +variable will be immediately inlined, and will stop behaving like a +normal lexical variable, e.g. this will print \f(CW79907\fR, not \f(CW79908\fR: +.PP +.Vb 6 +\& BEGIN { +\& my $x = 79907; +\& *RT_79908 = sub () { $x }; +\& $x++; +\& } +\& print RT_79908(); # prints 79907 +.Ve +.PP +As of Perl 5.22, this buggy behavior, while preserved for backward +compatibility, is detected and emits a deprecation warning. If you want +the subroutine to be inlined (with no warning), make sure the variable is +not used in a context where it could be modified aside from where it is +declared. +.PP +.Vb 11 +\& # Fine, no warning +\& BEGIN { +\& my $x = 54321; +\& *INLINED = sub () { $x }; +\& } +\& # Warns. Future Perl versions will stop inlining it. +\& BEGIN { +\& my $x; +\& $x = 54321; +\& *ALSO_INLINED = sub () { $x }; +\& } +.Ve +.PP +Perl 5.22 also introduces the experimental \*(L"const\*(R" attribute as an +alternative. (Disable the \*(L"experimental::const_attr\*(R" warnings if you want +to use it.) When applied to an anonymous subroutine, it forces the sub to +be called when the \f(CW\*(C`sub\*(C'\fR expression is evaluated. The return value is +captured and turned into a constant subroutine: +.PP +.Vb 3 +\& my $x = 54321; +\& *INLINED = sub : const { $x }; +\& $x++; +.Ve +.PP +The return value of \f(CW\*(C`INLINED\*(C'\fR in this example will always be 54321, +regardless of later modifications to \f(CW$x\fR. You can also put any arbitrary +code inside the sub, at it will be executed immediately and its return +value captured the same way. +.PP +If you really want a subroutine with a \f(CW\*(C`()\*(C'\fR prototype that returns a +lexical variable you can easily force it to not be inlined by adding +an explicit \f(CW\*(C`return\*(C'\fR: +.PP +.Vb 6 +\& BEGIN { +\& my $x = 79907; +\& *RT_79908 = sub () { return $x }; +\& $x++; +\& } +\& print RT_79908(); # prints 79908 +.Ve +.PP +The easiest way to tell if a subroutine was inlined is by using +B::Deparse. Consider this example of two subroutines returning +\&\f(CW1\fR, one with a \f(CW\*(C`()\*(C'\fR prototype causing it to be inlined, and one +without (with deparse output truncated for clarity): +.PP +.Vb 12 +\& $ perl \-MO=Deparse \-le \*(Aqsub ONE { 1 } if (ONE) { print ONE if ONE }\*(Aq +\& sub ONE { +\& 1; +\& } +\& if (ONE ) { +\& print ONE() if ONE ; +\& } +\& $ perl \-MO=Deparse \-le \*(Aqsub ONE () { 1 } if (ONE) { print ONE if ONE }\*(Aq +\& sub ONE () { 1 } +\& do { +\& print 1 +\& }; +.Ve +.PP +If you redefine a subroutine that was eligible for inlining, you'll +get a warning by default. You can use this warning to tell whether or +not a particular subroutine is considered inlinable, since it's +different than the warning for overriding non-inlined subroutines: +.PP +.Vb 4 +\& $ perl \-e \*(Aqsub one () {1} sub one () {2}\*(Aq +\& Constant subroutine one redefined at \-e line 1. +\& $ perl \-we \*(Aqsub one {1} sub one {2}\*(Aq +\& Subroutine one redefined at \-e line 1. +.Ve +.PP +The warning is considered severe enough not to be affected by the +\&\fB\-w\fR switch (or its absence) because previously compiled invocations +of the function will still be using the old value of the function. If +you need to be able to redefine the subroutine, you need to ensure +that it isn't inlined, either by dropping the \f(CW\*(C`()\*(C'\fR prototype (which +changes calling semantics, so beware) or by thwarting the inlining +mechanism in some other way, e.g. by adding an explicit \f(CW\*(C`return\*(C'\fR, as +mentioned above: +.PP +.Vb 1 +\& sub not_inlined () { return 23 } +.Ve +.SS "Overriding Built-in Functions" +.IX Xref "built-in override CORE CORE::GLOBAL" +.IX Subsection "Overriding Built-in Functions" +Many built-in functions may be overridden, though this should be tried +only occasionally and for good reason. Typically this might be +done by a package attempting to emulate missing built-in functionality +on a non-Unix system. +.PP +Overriding may be done only by importing the name from a module at +compile time\*(--ordinary predeclaration isn't good enough. However, the +\&\f(CW\*(C`use subs\*(C'\fR pragma lets you, in effect, predeclare subs +via the import syntax, and these names may then override built-in ones: +.PP +.Vb 3 +\& use subs \*(Aqchdir\*(Aq, \*(Aqchroot\*(Aq, \*(Aqchmod\*(Aq, \*(Aqchown\*(Aq; +\& chdir $somewhere; +\& sub chdir { ... } +.Ve +.PP +To unambiguously refer to the built-in form, precede the +built-in name with the special package qualifier \f(CW\*(C`CORE::\*(C'\fR. For example, +saying \f(CW\*(C`CORE::open()\*(C'\fR always refers to the built-in \f(CW\*(C`open()\*(C'\fR, even +if the current package has imported some other subroutine called +\&\f(CW\*(C`&open()\*(C'\fR from elsewhere. Even though it looks like a regular +function call, it isn't: the \s-1CORE::\s0 prefix in that case is part of Perl's +syntax, and works for any keyword, regardless of what is in the \s-1CORE\s0 +package. Taking a reference to it, that is, \f(CW\*(C`\e&CORE::open\*(C'\fR, only works +for some keywords. See \s-1CORE\s0. +.PP +Library modules should not in general export built-in names like \f(CW\*(C`open\*(C'\fR +or \f(CW\*(C`chdir\*(C'\fR as part of their default \f(CW@EXPORT\fR list, because these may +sneak into someone else's namespace and change the semantics unexpectedly. +Instead, if the module adds that name to \f(CW@EXPORT_OK\fR, then it's +possible for a user to import the name explicitly, but not implicitly. +That is, they could say +.PP +.Vb 1 +\& use Module \*(Aqopen\*(Aq; +.Ve +.PP +and it would import the \f(CW\*(C`open\*(C'\fR override. But if they said +.PP +.Vb 1 +\& use Module; +.Ve +.PP +they would get the default imports without overrides. +.PP +The foregoing mechanism for overriding built-in is restricted, quite +deliberately, to the package that requests the import. There is a second +method that is sometimes applicable when you wish to override a built-in +everywhere, without regard to namespace boundaries. This is achieved by +importing a sub into the special namespace \f(CW\*(C`CORE::GLOBAL::\*(C'\fR. Here is an +example that quite brazenly replaces the \f(CW\*(C`glob\*(C'\fR operator with something +that understands regular expressions. +.PP +.Vb 4 +\& package REGlob; +\& require Exporter; +\& @ISA = \*(AqExporter\*(Aq; +\& @EXPORT_OK = \*(Aqglob\*(Aq; +\& +\& sub import { +\& my $pkg = shift; +\& return unless @_; +\& my $sym = shift; +\& my $where = ($sym =~ s/^GLOBAL_// ? \*(AqCORE::GLOBAL\*(Aq : caller(0)); +\& $pkg\->export($where, $sym, @_); +\& } +\& +\& sub glob { +\& my $pat = shift; +\& my @got; +\& if (opendir my $d, \*(Aq.\*(Aq) { +\& @got = grep /$pat/, readdir $d; +\& closedir $d; +\& } +\& return @got; +\& } +\& 1; +.Ve +.PP +And here's how it could be (ab)used: +.PP +.Vb 4 +\& #use REGlob \*(AqGLOBAL_glob\*(Aq; # override glob() in ALL namespaces +\& package Foo; +\& use REGlob \*(Aqglob\*(Aq; # override glob() in Foo:: only +\& print for <^[a\-z_]+\e.pm\e$>; # show all pragmatic modules +.Ve +.PP +The initial comment shows a contrived, even dangerous example. +By overriding \f(CW\*(C`glob\*(C'\fR globally, you would be forcing the new (and +subversive) behavior for the \f(CW\*(C`glob\*(C'\fR operator for \fIevery\fR namespace, +without the complete cognizance or cooperation of the modules that own +those namespaces. Naturally, this should be done with extreme caution\*(--if +it must be done at all. +.PP +The \f(CW\*(C`REGlob\*(C'\fR example above does not implement all the support needed to +cleanly override perl's \f(CW\*(C`glob\*(C'\fR operator. The built-in \f(CW\*(C`glob\*(C'\fR has +different behaviors depending on whether it appears in a scalar or list +context, but our \f(CW\*(C`REGlob\*(C'\fR doesn't. Indeed, many perl built-in have such +context sensitive behaviors, and these must be adequately supported by +a properly written override. For a fully functional example of overriding +\&\f(CW\*(C`glob\*(C'\fR, study the implementation of \f(CW\*(C`File::DosGlob\*(C'\fR in the standard +library. +.PP +When you override a built-in, your replacement should be consistent (if +possible) with the built-in native syntax. You can achieve this by using +a suitable prototype. To get the prototype of an overridable built-in, +use the \f(CW\*(C`prototype\*(C'\fR function with an argument of \f(CW"CORE::builtin_name"\fR +(see \*(L"prototype\*(R" in perlfunc). +.PP +Note however that some built-ins can't have their syntax expressed by a +prototype (such as \f(CW\*(C`system\*(C'\fR or \f(CW\*(C`chomp\*(C'\fR). If you override them you won't +be able to fully mimic their original syntax. +.PP +The built-ins \f(CW\*(C`do\*(C'\fR, \f(CW\*(C`require\*(C'\fR and \f(CW\*(C`glob\*(C'\fR can also be overridden, but due +to special magic, their original syntax is preserved, and you don't have +to define a prototype for their replacements. (You can't override the +\&\f(CW\*(C`do BLOCK\*(C'\fR syntax, though). +.PP +\&\f(CW\*(C`require\*(C'\fR has special additional dark magic: if you invoke your +\&\f(CW\*(C`require\*(C'\fR replacement as \f(CW\*(C`require Foo::Bar\*(C'\fR, it will actually receive +the argument \f(CW"Foo/Bar.pm"\fR in \f(CW@_\fR. See \*(L"require\*(R" in perlfunc. +.PP +And, as you'll have noticed from the previous example, if you override +\&\f(CW\*(C`glob\*(C'\fR, the \f(CW\*(C`<*>\*(C'\fR glob operator is overridden as well. +.PP +In a similar fashion, overriding the \f(CW\*(C`readline\*(C'\fR function also overrides +the equivalent I/O operator \f(CW\*(C`\*(C'\fR. Also, overriding +\&\f(CW\*(C`readpipe\*(C'\fR also overrides the operators \f(CW\*(C`\`\`\*(C'\fR and \f(CW\*(C`qx//\*(C'\fR. +.PP +Finally, some built-ins (e.g. \f(CW\*(C`exists\*(C'\fR or \f(CW\*(C`grep\*(C'\fR) can't be overridden. +.SS "Autoloading" +.IX Xref "autoloading AUTOLOAD" +.IX Subsection "Autoloading" +If you call a subroutine that is undefined, you would ordinarily +get an immediate, fatal error complaining that the subroutine doesn't +exist. (Likewise for subroutines being used as methods, when the +method doesn't exist in any base class of the class's package.) +However, if an \f(CW\*(C`AUTOLOAD\*(C'\fR subroutine is defined in the package or +packages used to locate the original subroutine, then that +\&\f(CW\*(C`AUTOLOAD\*(C'\fR subroutine is called with the arguments that would have +been passed to the original subroutine. The fully qualified name +of the original subroutine magically appears in the global \f(CW$AUTOLOAD\fR +variable of the same package as the \f(CW\*(C`AUTOLOAD\*(C'\fR routine. The name +is not passed as an ordinary argument because, er, well, just +because, that's why. (As an exception, a method call to a nonexistent +\&\f(CW\*(C`import\*(C'\fR or \f(CW\*(C`unimport\*(C'\fR method is just skipped instead. Also, if +the \s-1AUTOLOAD\s0 subroutine is an \s-1XSUB,\s0 there are other ways to retrieve the +subroutine name. See \*(L"Autoloading with XSUBs\*(R" in perlguts for details.) +.PP +Many \f(CW\*(C`AUTOLOAD\*(C'\fR routines load in a definition for the requested +subroutine using \fBeval()\fR, then execute that subroutine using a special +form of \fBgoto()\fR that erases the stack frame of the \f(CW\*(C`AUTOLOAD\*(C'\fR routine +without a trace. (See the source to the standard module documented +in AutoLoader, for example.) But an \f(CW\*(C`AUTOLOAD\*(C'\fR routine can +also just emulate the routine and never define it. For example, +let's pretend that a function that wasn't defined should just invoke +\&\f(CW\*(C`system\*(C'\fR with those arguments. All you'd do is: +.PP +.Vb 9 +\& sub AUTOLOAD { +\& our $AUTOLOAD; # keep \*(Aquse strict\*(Aq happy +\& my $program = $AUTOLOAD; +\& $program =~ s/.*:://; +\& system($program, @_); +\& } +\& date(); +\& who(); +\& ls(\*(Aq\-l\*(Aq); +.Ve +.PP +In fact, if you predeclare functions you want to call that way, you don't +even need parentheses: +.PP +.Vb 4 +\& use subs qw(date who ls); +\& date; +\& who; +\& ls \*(Aq\-l\*(Aq; +.Ve +.PP +A more complete example of this is the Shell module on \s-1CPAN,\s0 which +can treat undefined subroutine calls as calls to external programs. +.PP +Mechanisms are available to help modules writers split their modules +into autoloadable files. See the standard AutoLoader module +described in AutoLoader and in AutoSplit, the standard +SelfLoader modules in SelfLoader, and the document on adding C +functions to Perl code in perlxs. +.SS "Subroutine Attributes" +.IX Xref "attribute subroutine, attribute attrs" +.IX Subsection "Subroutine Attributes" +A subroutine declaration or definition may have a list of attributes +associated with it. If such an attribute list is present, it is +broken up at space or colon boundaries and treated as though a +\&\f(CW\*(C`use attributes\*(C'\fR had been seen. See attributes for details +about what attributes are currently supported. +Unlike the limitation with the obsolescent \f(CW\*(C`use attrs\*(C'\fR, the +\&\f(CW\*(C`sub : ATTRLIST\*(C'\fR syntax works to associate the attributes with +a pre-declaration, and not just with a subroutine definition. +.PP +The attributes must be valid as simple identifier names (without any +punctuation other than the '_' character). They may have a parameter +list appended, which is only checked for whether its parentheses ('(',')') +nest properly. +.PP +Examples of valid syntax (even though the attributes are unknown): +.PP +.Vb 3 +\& sub fnord (&\e%) : switch(10,foo(7,3)) : expensive; +\& sub plugh () : Ugly(\*(Aq\e(") :Bad; +\& sub xyzzy : _5x5 { ... } +.Ve +.PP +Examples of invalid syntax: +.PP +.Vb 5 +\& sub fnord : switch(10,foo(); # ()\-string not balanced +\& sub snoid : Ugly(\*(Aq(\*(Aq); # ()\-string not balanced +\& sub xyzzy : 5x5; # "5x5" not a valid identifier +\& sub plugh : Y2::north; # "Y2::north" not a simple identifier +\& sub snurt : foo + bar; # "+" not a colon or space +.Ve +.PP +The attribute list is passed as a list of constant strings to the code +which associates them with the subroutine. In particular, the second example +of valid syntax above currently looks like this in terms of how it's +parsed and invoked: +.PP +.Vb 1 +\& use attributes _\|_PACKAGE_\|_, \e&plugh, q[Ugly(\*(Aq\e(")], \*(AqBad\*(Aq; +.Ve +.PP +For further details on attribute lists and their manipulation, +see attributes and Attribute::Handlers. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +See \*(L"Function Templates\*(R" in perlref for more about references and closures. +See perlxs if you'd like to learn about calling C subroutines from Perl. +See perlembed if you'd like to learn about calling Perl subroutines from C. +See perlmod to learn about bundling up your functions in separate files. +See perlmodlib to learn what library modules come standard on your system. +See perlootut to learn how to make object method calls. diff --git a/data/miniconda3/man/man1/perlsyn.1 b/data/miniconda3/man/man1/perlsyn.1 new file mode 100644 index 0000000000000000000000000000000000000000..fd9c8602c999f69a232790d1df9d93901c0b9720 --- /dev/null +++ b/data/miniconda3/man/man1/perlsyn.1 @@ -0,0 +1,1461 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLSYN 1" +.TH PERLSYN 1 "2020-12-18" "perl v5.32.1" "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" +perlsyn \- Perl syntax +.IX Xref "syntax" +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +A Perl program consists of a sequence of declarations and statements +which run from the top to the bottom. Loops, subroutines, and other +control structures allow you to jump around within the code. +.PP +Perl is a \fBfree-form\fR language: you can format and indent it however +you like. Whitespace serves mostly to separate tokens, unlike +languages like Python where it is an important part of the syntax, +or Fortran where it is immaterial. +.PP +Many of Perl's syntactic elements are \fBoptional\fR. Rather than +requiring you to put parentheses around every function call and +declare every variable, you can often leave such explicit elements off +and Perl will figure out what you meant. This is known as \fBDo What I +Mean\fR, abbreviated \fB\s-1DWIM\s0\fR. It allows programmers to be \fBlazy\fR and to +code in a style with which they are comfortable. +.PP +Perl \fBborrows syntax\fR and concepts from many languages: awk, sed, C, +Bourne Shell, Smalltalk, Lisp and even English. Other +languages have borrowed syntax from Perl, particularly its regular +expression extensions. So if you have programmed in another language +you will see familiar pieces in Perl. They often work the same, but +see perltrap for information about how they differ. +.SS "Declarations" +.IX Xref "declaration undef undefined uninitialized" +.IX Subsection "Declarations" +The only things you need to declare in Perl are report formats and +subroutines (and sometimes not even subroutines). A scalar variable holds +the undefined value (\f(CW\*(C`undef\*(C'\fR) until it has been assigned a defined +value, which is anything other than \f(CW\*(C`undef\*(C'\fR. When used as a number, +\&\f(CW\*(C`undef\*(C'\fR is treated as \f(CW0\fR; when used as a string, it is treated as +the empty string, \f(CW""\fR; and when used as a reference that isn't being +assigned to, it is treated as an error. If you enable warnings, +you'll be notified of an uninitialized value whenever you treat +\&\f(CW\*(C`undef\*(C'\fR as a string or a number. Well, usually. Boolean contexts, +such as: +.PP +.Vb 1 +\& if ($a) {} +.Ve +.PP +are exempt from warnings (because they care about truth rather than +definedness). Operators such as \f(CW\*(C`++\*(C'\fR, \f(CW\*(C`\-\-\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, +\&\f(CW\*(C`\-=\*(C'\fR, and \f(CW\*(C`.=\*(C'\fR, that operate on undefined variables such as: +.PP +.Vb 2 +\& undef $a; +\& $a++; +.Ve +.PP +are also always exempt from such warnings. +.PP +A declaration can be put anywhere a statement can, but has no effect on +the execution of the primary sequence of statements: declarations all +take effect at compile time. All declarations are typically put at +the beginning or the end of the script. However, if you're using +lexically-scoped private variables created with \f(CW\*(C`my()\*(C'\fR, +\&\f(CW\*(C`state()\*(C'\fR, or \f(CW\*(C`our()\*(C'\fR, you'll have to make sure +your format or subroutine definition is within the same block scope +as the my if you expect to be able to access those private variables. +.PP +Declaring a subroutine allows a subroutine name to be used as if it were a +list operator from that point forward in the program. You can declare a +subroutine without defining it by saying \f(CW\*(C`sub name\*(C'\fR, thus: +.IX Xref "subroutine, declaration" +.PP +.Vb 2 +\& sub myname; +\& $me = myname $0 or die "can\*(Aqt get myname"; +.Ve +.PP +A bare declaration like that declares the function to be a list operator, +not a unary operator, so you have to be careful to use parentheses (or +\&\f(CW\*(C`or\*(C'\fR instead of \f(CW\*(C`||\*(C'\fR.) The \f(CW\*(C`||\*(C'\fR operator binds too tightly to use after +list operators; it becomes part of the last element. You can always use +parentheses around the list operators arguments to turn the list operator +back into something that behaves more like a function call. Alternatively, +you can use the prototype \f(CW\*(C`($)\*(C'\fR to turn the subroutine into a unary +operator: +.PP +.Vb 2 +\& sub myname ($); +\& $me = myname $0 || die "can\*(Aqt get myname"; +.Ve +.PP +That now parses as you'd expect, but you still ought to get in the habit of +using parentheses in that situation. For more on prototypes, see +perlsub. +.PP +Subroutines declarations can also be loaded up with the \f(CW\*(C`require\*(C'\fR statement +or both loaded and imported into your namespace with a \f(CW\*(C`use\*(C'\fR statement. +See perlmod for details on this. +.PP +A statement sequence may contain declarations of lexically-scoped +variables, but apart from declaring a variable name, the declaration acts +like an ordinary statement, and is elaborated within the sequence of +statements as if it were an ordinary statement. That means it actually +has both compile-time and run-time effects. +.SS "Comments" +.IX Xref "comment #" +.IX Subsection "Comments" +Text from a \f(CW"#"\fR character until the end of the line is a comment, +and is ignored. Exceptions include \f(CW"#"\fR inside a string or regular +expression. +.SS "Simple Statements" +.IX Xref "statement semicolon expression ;" +.IX Subsection "Simple Statements" +The only kind of simple statement is an expression evaluated for its +side-effects. Every simple statement must be terminated with a +semicolon, unless it is the final statement in a block, in which case +the semicolon is optional. But put the semicolon in anyway if the +block takes up more than one line, because you may eventually add +another line. Note that there are operators like \f(CW\*(C`eval {}\*(C'\fR, \f(CW\*(C`sub {}\*(C'\fR, and +\&\f(CW\*(C`do {}\*(C'\fR that \fIlook\fR like compound statements, but aren't\*(--they're just +TERMs in an expression\*(--and thus need an explicit termination when used +as the last item in a statement. +.SS "Statement Modifiers" +.IX Xref "statement modifier modifier if unless while until when foreach for" +.IX Subsection "Statement Modifiers" +Any simple statement may optionally be followed by a \fI\s-1SINGLE\s0\fR modifier, +just before the terminating semicolon (or block ending). The possible +modifiers are: +.PP +.Vb 7 +\& if EXPR +\& unless EXPR +\& while EXPR +\& until EXPR +\& for LIST +\& foreach LIST +\& when EXPR +.Ve +.PP +The \f(CW\*(C`EXPR\*(C'\fR following the modifier is referred to as the \*(L"condition\*(R". +Its truth or falsehood determines how the modifier will behave. +.PP +\&\f(CW\*(C`if\*(C'\fR executes the statement once \fIif\fR and only if the condition is +true. \f(CW\*(C`unless\*(C'\fR is the opposite, it executes the statement \fIunless\fR +the condition is true (that is, if the condition is false). See +\&\*(L"Scalar values\*(R" in perldata for definitions of true and false. +.PP +.Vb 2 +\& print "Basset hounds got long ears" if length $ear >= 10; +\& go_outside() and play() unless $is_raining; +.Ve +.PP +The \f(CW\*(C`for(each)\*(C'\fR modifier is an iterator: it executes the statement once +for each item in the \s-1LIST\s0 (with \f(CW$_\fR aliased to each item in turn). +There is no syntax to specify a C\-style for loop or a lexically scoped +iteration variable in this form. +.PP +.Vb 1 +\& print "Hello $_!\en" for qw(world Dolly nurse); +.Ve +.PP +\&\f(CW\*(C`while\*(C'\fR repeats the statement \fIwhile\fR the condition is true. +Postfix \f(CW\*(C`while\*(C'\fR has the same magic treatment of some kinds of condition +that prefix \f(CW\*(C`while\*(C'\fR has. +\&\f(CW\*(C`until\*(C'\fR does the opposite, it repeats the statement \fIuntil\fR the +condition is true (or while the condition is false): +.PP +.Vb 3 +\& # Both of these count from 0 to 10. +\& print $i++ while $i <= 10; +\& print $j++ until $j > 10; +.Ve +.PP +The \f(CW\*(C`while\*(C'\fR and \f(CW\*(C`until\*(C'\fR modifiers have the usual "\f(CW\*(C`while\*(C'\fR loop" +semantics (conditional evaluated first), except when applied to a +\&\f(CW\*(C`do\*(C'\fR\-BLOCK (or to the Perl4 \f(CW\*(C`do\*(C'\fR\-SUBROUTINE statement), in +which case the block executes once before the conditional is +evaluated. +.PP +This is so that you can write loops like: +.PP +.Vb 4 +\& do { +\& $line = ; +\& ... +\& } until !defined($line) || $line eq ".\en" +.Ve +.PP +See \*(L"do\*(R" in perlfunc. Note also that the loop control statements described +later will \fI\s-1NOT\s0\fR work in this construct, because modifiers don't take +loop labels. Sorry. You can always put another block inside of it +(for \f(CW\*(C`next\*(C'\fR/\f(CW\*(C`redo\*(C'\fR) or around it (for \f(CW\*(C`last\*(C'\fR) to do that sort of thing. +.IX Xref "next last redo" +.PP +For \f(CW\*(C`next\*(C'\fR or \f(CW\*(C`redo\*(C'\fR, just double the braces: +.PP +.Vb 4 +\& do {{ +\& next if $x == $y; +\& # do something here +\& }} until $x++ > $z; +.Ve +.PP +For \f(CW\*(C`last\*(C'\fR, you have to be more elaborate and put braces around it: +.IX Xref "last" +.PP +.Vb 6 +\& { +\& do { +\& last if $x == $y**2; +\& # do something here +\& } while $x++ <= $z; +\& } +.Ve +.PP +If you need both \f(CW\*(C`next\*(C'\fR and \f(CW\*(C`last\*(C'\fR, you have to do both and also use a +loop label: +.PP +.Vb 7 +\& LOOP: { +\& do {{ +\& next if $x == $y; +\& last LOOP if $x == $y**2; +\& # do something here +\& }} until $x++ > $z; +\& } +.Ve +.PP +\&\fB\s-1NOTE:\s0\fR The behaviour of a \f(CW\*(C`my\*(C'\fR, \f(CW\*(C`state\*(C'\fR, or +\&\f(CW\*(C`our\*(C'\fR modified with a statement modifier conditional +or loop construct (for example, \f(CW\*(C`my $x if ...\*(C'\fR) is +\&\fBundefined\fR. The value of the \f(CW\*(C`my\*(C'\fR variable may be \f(CW\*(C`undef\*(C'\fR, any +previously assigned value, or possibly anything else. Don't rely on +it. Future versions of perl might do something different from the +version of perl you try it out on. Here be dragons. +.IX Xref "my" +.PP +The \f(CW\*(C`when\*(C'\fR modifier is an experimental feature that first appeared in Perl +5.14. To use it, you should include a \f(CW\*(C`use v5.14\*(C'\fR declaration. +(Technically, it requires only the \f(CW\*(C`switch\*(C'\fR feature, but that aspect of it +was not available before 5.14.) Operative only from within a \f(CW\*(C`foreach\*(C'\fR +loop or a \f(CW\*(C`given\*(C'\fR block, it executes the statement only if the smartmatch +\&\f(CW\*(C`$_ ~~ \f(CIEXPR\f(CW\*(C'\fR is true. If the statement executes, it is followed by +a \f(CW\*(C`next\*(C'\fR from inside a \f(CW\*(C`foreach\*(C'\fR and \f(CW\*(C`break\*(C'\fR from inside a \f(CW\*(C`given\*(C'\fR. +.PP +Under the current implementation, the \f(CW\*(C`foreach\*(C'\fR loop can be +anywhere within the \f(CW\*(C`when\*(C'\fR modifier's dynamic scope, but must be +within the \f(CW\*(C`given\*(C'\fR block's lexical scope. This restriction may +be relaxed in a future release. See \*(L"Switch Statements\*(R" below. +.SS "Compound Statements" +.IX Xref "statement, compound block bracket, curly curly bracket brace { } if unless given while until foreach for continue" +.IX Subsection "Compound Statements" +In Perl, a sequence of statements that defines a scope is called a block. +Sometimes a block is delimited by the file containing it (in the case +of a required file, or the program as a whole), and sometimes a block +is delimited by the extent of a string (in the case of an eval). +.PP +But generally, a block is delimited by curly brackets, also known as +braces. We will call this syntactic construct a \s-1BLOCK.\s0 Because enclosing +braces are also the syntax for hash reference constructor expressions +(see perlref), you may occasionally need to disambiguate by placing a +\&\f(CW\*(C`;\*(C'\fR immediately after an opening brace so that Perl realises the brace +is the start of a block. You will more frequently need to disambiguate +the other way, by placing a \f(CW\*(C`+\*(C'\fR immediately before an opening brace to +force it to be interpreted as a hash reference constructor expression. +It is considered good style to use these disambiguating mechanisms +liberally, not only when Perl would otherwise guess incorrectly. +.PP +The following compound statements may be used to control flow: +.PP +.Vb 4 +\& if (EXPR) BLOCK +\& if (EXPR) BLOCK else BLOCK +\& if (EXPR) BLOCK elsif (EXPR) BLOCK ... +\& if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK +\& +\& unless (EXPR) BLOCK +\& unless (EXPR) BLOCK else BLOCK +\& unless (EXPR) BLOCK elsif (EXPR) BLOCK ... +\& unless (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK +\& +\& given (EXPR) BLOCK +\& +\& LABEL while (EXPR) BLOCK +\& LABEL while (EXPR) BLOCK continue BLOCK +\& +\& LABEL until (EXPR) BLOCK +\& LABEL until (EXPR) BLOCK continue BLOCK +\& +\& LABEL for (EXPR; EXPR; EXPR) BLOCK +\& LABEL for VAR (LIST) BLOCK +\& LABEL for VAR (LIST) BLOCK continue BLOCK +\& +\& LABEL foreach (EXPR; EXPR; EXPR) BLOCK +\& LABEL foreach VAR (LIST) BLOCK +\& LABEL foreach VAR (LIST) BLOCK continue BLOCK +\& +\& LABEL BLOCK +\& LABEL BLOCK continue BLOCK +\& +\& PHASE BLOCK +.Ve +.PP +The experimental \f(CW\*(C`given\*(C'\fR statement is \fInot automatically enabled\fR; see +\&\*(L"Switch Statements\*(R" below for how to do so, and the attendant caveats. +.PP +Unlike in C and Pascal, in Perl these are all defined in terms of BLOCKs, +not statements. This means that the curly brackets are \fIrequired\fR\-\-no +dangling statements allowed. If you want to write conditionals without +curly brackets, there are several other ways to do it. The following +all do the same thing: +.PP +.Vb 5 +\& if (!open(FOO)) { die "Can\*(Aqt open $FOO: $!" } +\& die "Can\*(Aqt open $FOO: $!" unless open(FOO); +\& open(FOO) || die "Can\*(Aqt open $FOO: $!"; +\& open(FOO) ? () : die "Can\*(Aqt open $FOO: $!"; +\& # a bit exotic, that last one +.Ve +.PP +The \f(CW\*(C`if\*(C'\fR statement is straightforward. Because BLOCKs are always +bounded by curly brackets, there is never any ambiguity about which +\&\f(CW\*(C`if\*(C'\fR an \f(CW\*(C`else\*(C'\fR goes with. If you use \f(CW\*(C`unless\*(C'\fR in place of \f(CW\*(C`if\*(C'\fR, +the sense of the test is reversed. Like \f(CW\*(C`if\*(C'\fR, \f(CW\*(C`unless\*(C'\fR can be followed +by \f(CW\*(C`else\*(C'\fR. \f(CW\*(C`unless\*(C'\fR can even be followed by one or more \f(CW\*(C`elsif\*(C'\fR +statements, though you may want to think twice before using that particular +language construct, as everyone reading your code will have to think at least +twice before they can understand what's going on. +.PP +The \f(CW\*(C`while\*(C'\fR statement executes the block as long as the expression is +true. +The \f(CW\*(C`until\*(C'\fR statement executes the block as long as the expression is +false. +The \s-1LABEL\s0 is optional, and if present, consists of an identifier followed +by a colon. The \s-1LABEL\s0 identifies the loop for the loop control +statements \f(CW\*(C`next\*(C'\fR, \f(CW\*(C`last\*(C'\fR, and \f(CW\*(C`redo\*(C'\fR. +If the \s-1LABEL\s0 is omitted, the loop control statement +refers to the innermost enclosing loop. This may include dynamically +looking back your call-stack at run time to find the \s-1LABEL.\s0 Such +desperate behavior triggers a warning if you use the \f(CW\*(C`use warnings\*(C'\fR +pragma or the \fB\-w\fR flag. +.PP +If the condition expression of a \f(CW\*(C`while\*(C'\fR statement is based +on any of a group of iterative expression types then it gets +some magic treatment. The affected iterative expression types +are \f(CW\*(C`readline\*(C'\fR, the \f(CW\*(C`\*(C'\fR input operator, \f(CW\*(C`readdir\*(C'\fR, \f(CW\*(C`glob\*(C'\fR, the \f(CW\*(C`\*(C'\fR globbing operator, and \f(CW\*(C`each\*(C'\fR. If the condition expression is one of these expression types, then +the value yielded by the iterative operator will be implicitly assigned +to \f(CW$_\fR. If the condition expression is one of these expression types +or an explicit assignment of one of them to a scalar, then the condition +actually tests for definedness of the expression's value, not for its +regular truth value. +.PP +If there is a \f(CW\*(C`continue\*(C'\fR \s-1BLOCK,\s0 it is always executed just before the +conditional is about to be evaluated again. Thus it can be used to +increment a loop variable, even when the loop has been continued via +the \f(CW\*(C`next\*(C'\fR statement. +.PP +When a block is preceded by a compilation phase keyword such as \f(CW\*(C`BEGIN\*(C'\fR, +\&\f(CW\*(C`END\*(C'\fR, \f(CW\*(C`INIT\*(C'\fR, \f(CW\*(C`CHECK\*(C'\fR, or \f(CW\*(C`UNITCHECK\*(C'\fR, then the block will run only +during the corresponding phase of execution. See perlmod for more details. +.PP +Extension modules can also hook into the Perl parser to define new +kinds of compound statements. These are introduced by a keyword which +the extension recognizes, and the syntax following the keyword is +defined entirely by the extension. If you are an implementor, see +\&\*(L"PL_keyword_plugin\*(R" in perlapi for the mechanism. If you are using such +a module, see the module's documentation for details of the syntax that +it defines. +.SS "Loop Control" +.IX Xref "loop control loop, control next last redo continue" +.IX Subsection "Loop Control" +The \f(CW\*(C`next\*(C'\fR command starts the next iteration of the loop: +.PP +.Vb 4 +\& LINE: while () { +\& next LINE if /^#/; # discard comments +\& ... +\& } +.Ve +.PP +The \f(CW\*(C`last\*(C'\fR command immediately exits the loop in question. The +\&\f(CW\*(C`continue\*(C'\fR block, if any, is not executed: +.PP +.Vb 4 +\& LINE: while () { +\& last LINE if /^$/; # exit when done with header +\& ... +\& } +.Ve +.PP +The \f(CW\*(C`redo\*(C'\fR command restarts the loop block without evaluating the +conditional again. The \f(CW\*(C`continue\*(C'\fR block, if any, is \fInot\fR executed. +This command is normally used by programs that want to lie to themselves +about what was just input. +.PP +For example, when processing a file like \fI/etc/termcap\fR. +If your input lines might end in backslashes to indicate continuation, you +want to skip ahead and get the next record. +.PP +.Vb 8 +\& while (<>) { +\& chomp; +\& if (s/\e\e$//) { +\& $_ .= <>; +\& redo unless eof(); +\& } +\& # now process $_ +\& } +.Ve +.PP +which is Perl shorthand for the more explicitly written version: +.PP +.Vb 8 +\& LINE: while (defined($line = )) { +\& chomp($line); +\& if ($line =~ s/\e\e$//) { +\& $line .= ; +\& redo LINE unless eof(); # not eof(ARGV)! +\& } +\& # now process $line +\& } +.Ve +.PP +Note that if there were a \f(CW\*(C`continue\*(C'\fR block on the above code, it would +get executed only on lines discarded by the regex (since redo skips the +continue block). A continue block is often used to reset line counters +or \f(CW\*(C`m?pat?\*(C'\fR one-time matches: +.PP +.Vb 10 +\& # inspired by :1,$g/fred/s//WILMA/ +\& while (<>) { +\& m?(fred)? && s//WILMA $1 WILMA/; +\& m?(barney)? && s//BETTY $1 BETTY/; +\& m?(homer)? && s//MARGE $1 MARGE/; +\& } continue { +\& print "$ARGV $.: $_"; +\& close ARGV if eof; # reset $. +\& reset if eof; # reset ?pat? +\& } +.Ve +.PP +If the word \f(CW\*(C`while\*(C'\fR is replaced by the word \f(CW\*(C`until\*(C'\fR, the sense of the +test is reversed, but the conditional is still tested before the first +iteration. +.PP +Loop control statements don't work in an \f(CW\*(C`if\*(C'\fR or \f(CW\*(C`unless\*(C'\fR, since +they aren't loops. You can double the braces to make them such, though. +.PP +.Vb 6 +\& if (/pattern/) {{ +\& last if /fred/; +\& next if /barney/; # same effect as "last", +\& # but doesn\*(Aqt document as well +\& # do something here +\& }} +.Ve +.PP +This is caused by the fact that a block by itself acts as a loop that +executes once, see \*(L"Basic BLOCKs\*(R". +.PP +The form \f(CW\*(C`while/if BLOCK BLOCK\*(C'\fR, available in Perl 4, is no longer +available. Replace any occurrence of \f(CW\*(C`if BLOCK\*(C'\fR by \f(CW\*(C`if (do BLOCK)\*(C'\fR. +.SS "For Loops" +.IX Xref "for foreach" +.IX Subsection "For Loops" +Perl's C\-style \f(CW\*(C`for\*(C'\fR loop works like the corresponding \f(CW\*(C`while\*(C'\fR loop; +that means that this: +.PP +.Vb 3 +\& for ($i = 1; $i < 10; $i++) { +\& ... +\& } +.Ve +.PP +is the same as this: +.PP +.Vb 6 +\& $i = 1; +\& while ($i < 10) { +\& ... +\& } continue { +\& $i++; +\& } +.Ve +.PP +There is one minor difference: if variables are declared with \f(CW\*(C`my\*(C'\fR +in the initialization section of the \f(CW\*(C`for\*(C'\fR, the lexical scope of +those variables is exactly the \f(CW\*(C`for\*(C'\fR loop (the body of the loop +and the control sections). +.IX Xref "my" +.PP +As a special case, if the test in the \f(CW\*(C`for\*(C'\fR loop (or the corresponding +\&\f(CW\*(C`while\*(C'\fR loop) is empty, it is treated as true. That is, both +.PP +.Vb 3 +\& for (;;) { +\& ... +\& } +.Ve +.PP +and +.PP +.Vb 3 +\& while () { +\& ... +\& } +.Ve +.PP +are treated as infinite loops. +.PP +Besides the normal array index looping, \f(CW\*(C`for\*(C'\fR can lend itself +to many other interesting applications. Here's one that avoids the +problem you get into if you explicitly test for end-of-file on +an interactive file descriptor causing your program to appear to +hang. +.IX Xref "eof end-of-file end of file" +.PP +.Vb 5 +\& $on_a_tty = \-t STDIN && \-t STDOUT; +\& sub prompt { print "yes? " if $on_a_tty } +\& for ( prompt(); ; prompt() ) { +\& # do something +\& } +.Ve +.PP +The condition expression of a \f(CW\*(C`for\*(C'\fR loop gets the same magic treatment of +\&\f(CW\*(C`readline\*(C'\fR et al that the condition expression of a \f(CW\*(C`while\*(C'\fR loop gets. +.SS "Foreach Loops" +.IX Xref "for foreach" +.IX Subsection "Foreach Loops" +The \f(CW\*(C`foreach\*(C'\fR loop iterates over a normal list value and sets the scalar +variable \s-1VAR\s0 to be each element of the list in turn. If the variable +is preceded with the keyword \f(CW\*(C`my\*(C'\fR, then it is lexically scoped, and +is therefore visible only within the loop. Otherwise, the variable is +implicitly local to the loop and regains its former value upon exiting +the loop. If the variable was previously declared with \f(CW\*(C`my\*(C'\fR, it uses +that variable instead of the global one, but it's still localized to +the loop. This implicit localization occurs \fIonly\fR in a \f(CW\*(C`foreach\*(C'\fR +loop. +.IX Xref "my local" +.PP +The \f(CW\*(C`foreach\*(C'\fR keyword is actually a synonym for the \f(CW\*(C`for\*(C'\fR keyword, so +you can use either. If \s-1VAR\s0 is omitted, \f(CW$_\fR is set to each value. +.IX Xref "$_" +.PP +If any element of \s-1LIST\s0 is an lvalue, you can modify it by modifying +\&\s-1VAR\s0 inside the loop. Conversely, if any element of \s-1LIST\s0 is \s-1NOT\s0 an +lvalue, any attempt to modify that element will fail. In other words, +the \f(CW\*(C`foreach\*(C'\fR loop index variable is an implicit alias for each item +in the list that you're looping over. +.IX Xref "alias" +.PP +If any part of \s-1LIST\s0 is an array, \f(CW\*(C`foreach\*(C'\fR will get very confused if +you add or remove elements within the loop body, for example with +\&\f(CW\*(C`splice\*(C'\fR. So don't do that. +.IX Xref "splice" +.PP +\&\f(CW\*(C`foreach\*(C'\fR probably won't do what you expect if \s-1VAR\s0 is a tied or other +special variable. Don't do that either. +.PP +As of Perl 5.22, there is an experimental variant of this loop that accepts +a variable preceded by a backslash for \s-1VAR,\s0 in which case the items in the +\&\s-1LIST\s0 must be references. The backslashed variable will become an alias +to each referenced item in the \s-1LIST,\s0 which must be of the correct type. +The variable needn't be a scalar in this case, and the backslash may be +followed by \f(CW\*(C`my\*(C'\fR. To use this form, you must enable the \f(CW\*(C`refaliasing\*(C'\fR +feature via \f(CW\*(C`use feature\*(C'\fR. (See feature. See also \*(L"Assigning +to References\*(R" in perlref.) +.PP +Examples: +.PP +.Vb 1 +\& for (@ary) { s/foo/bar/ } +\& +\& for my $elem (@elements) { +\& $elem *= 2; +\& } +\& +\& for $count (reverse(1..10), "BOOM") { +\& print $count, "\en"; +\& sleep(1); +\& } +\& +\& for (1..15) { print "Merry Christmas\en"; } +\& +\& foreach $item (split(/:[\e\e\en:]*/, $ENV{TERMCAP})) { +\& print "Item: $item\en"; +\& } +\& +\& use feature "refaliasing"; +\& no warnings "experimental::refaliasing"; +\& foreach \emy %hash (@array_of_hash_references) { +\& # do something which each %hash +\& } +.Ve +.PP +Here's how a C programmer might code up a particular algorithm in Perl: +.PP +.Vb 9 +\& for (my $i = 0; $i < @ary1; $i++) { +\& for (my $j = 0; $j < @ary2; $j++) { +\& if ($ary1[$i] > $ary2[$j]) { +\& last; # can\*(Aqt go to outer :\-( +\& } +\& $ary1[$i] += $ary2[$j]; +\& } +\& # this is where that last takes me +\& } +.Ve +.PP +Whereas here's how a Perl programmer more comfortable with the idiom might +do it: +.PP +.Vb 6 +\& OUTER: for my $wid (@ary1) { +\& INNER: for my $jet (@ary2) { +\& next OUTER if $wid > $jet; +\& $wid += $jet; +\& } +\& } +.Ve +.PP +See how much easier this is? It's cleaner, safer, and faster. It's +cleaner because it's less noisy. It's safer because if code gets added +between the inner and outer loops later on, the new code won't be +accidentally executed. The \f(CW\*(C`next\*(C'\fR explicitly iterates the other loop +rather than merely terminating the inner one. And it's faster because +Perl executes a \f(CW\*(C`foreach\*(C'\fR statement more rapidly than it would the +equivalent C\-style \f(CW\*(C`for\*(C'\fR loop. +.PP +Perceptive Perl hackers may have noticed that a \f(CW\*(C`for\*(C'\fR loop has a return +value, and that this value can be captured by wrapping the loop in a \f(CW\*(C`do\*(C'\fR +block. The reward for this discovery is this cautionary advice: The +return value of a \f(CW\*(C`for\*(C'\fR loop is unspecified and may change without notice. +Do not rely on it. +.SS "Basic BLOCKs" +.IX Xref "block" +.IX Subsection "Basic BLOCKs" +A \s-1BLOCK\s0 by itself (labeled or not) is semantically equivalent to a +loop that executes once. Thus you can use any of the loop control +statements in it to leave or restart the block. (Note that this is +\&\fI\s-1NOT\s0\fR true in \f(CW\*(C`eval{}\*(C'\fR, \f(CW\*(C`sub{}\*(C'\fR, or contrary to popular belief +\&\f(CW\*(C`do{}\*(C'\fR blocks, which do \fI\s-1NOT\s0\fR count as loops.) The \f(CW\*(C`continue\*(C'\fR +block is optional. +.PP +The \s-1BLOCK\s0 construct can be used to emulate case structures. +.PP +.Vb 6 +\& SWITCH: { +\& if (/^abc/) { $abc = 1; last SWITCH; } +\& if (/^def/) { $def = 1; last SWITCH; } +\& if (/^xyz/) { $xyz = 1; last SWITCH; } +\& $nothing = 1; +\& } +.Ve +.PP +You'll also find that \f(CW\*(C`foreach\*(C'\fR loop used to create a topicalizer +and a switch: +.PP +.Vb 7 +\& SWITCH: +\& for ($var) { +\& if (/^abc/) { $abc = 1; last SWITCH; } +\& if (/^def/) { $def = 1; last SWITCH; } +\& if (/^xyz/) { $xyz = 1; last SWITCH; } +\& $nothing = 1; +\& } +.Ve +.PP +Such constructs are quite frequently used, both because older versions of +Perl had no official \f(CW\*(C`switch\*(C'\fR statement, and also because the new version +described immediately below remains experimental and can sometimes be confusing. +.SS "Switch Statements" +.IX Subsection "Switch Statements" + +.IX Xref "switch case given when default" +.PP +Starting from Perl 5.10.1 (well, 5.10.0, but it didn't work +right), you can say +.PP +.Vb 1 +\& use feature "switch"; +.Ve +.PP +to enable an experimental switch feature. This is loosely based on an +old version of a Raku proposal, but it no longer resembles the Raku +construct. You also get the switch feature whenever you declare that your +code prefers to run under a version of Perl that is 5.10 or later. For +example: +.PP +.Vb 1 +\& use v5.14; +.Ve +.PP +Under the \*(L"switch\*(R" feature, Perl gains the experimental keywords +\&\f(CW\*(C`given\*(C'\fR, \f(CW\*(C`when\*(C'\fR, \f(CW\*(C`default\*(C'\fR, \f(CW\*(C`continue\*(C'\fR, and \f(CW\*(C`break\*(C'\fR. +Starting from Perl 5.16, one can prefix the switch +keywords with \f(CW\*(C`CORE::\*(C'\fR to access the feature without a \f(CW\*(C`use feature\*(C'\fR +statement. The keywords \f(CW\*(C`given\*(C'\fR and +\&\f(CW\*(C`when\*(C'\fR are analogous to \f(CW\*(C`switch\*(C'\fR and +\&\f(CW\*(C`case\*(C'\fR in other languages \*(-- though \f(CW\*(C`continue\*(C'\fR is not \*(-- so the code +in the previous section could be rewritten as +.PP +.Vb 7 +\& use v5.10.1; +\& for ($var) { +\& when (/^abc/) { $abc = 1 } +\& when (/^def/) { $def = 1 } +\& when (/^xyz/) { $xyz = 1 } +\& default { $nothing = 1 } +\& } +.Ve +.PP +The \f(CW\*(C`foreach\*(C'\fR is the non-experimental way to set a topicalizer. +If you wish to use the highly experimental \f(CW\*(C`given\*(C'\fR, that could be +written like this: +.PP +.Vb 7 +\& use v5.10.1; +\& given ($var) { +\& when (/^abc/) { $abc = 1 } +\& when (/^def/) { $def = 1 } +\& when (/^xyz/) { $xyz = 1 } +\& default { $nothing = 1 } +\& } +.Ve +.PP +As of 5.14, that can also be written this way: +.PP +.Vb 7 +\& use v5.14; +\& for ($var) { +\& $abc = 1 when /^abc/; +\& $def = 1 when /^def/; +\& $xyz = 1 when /^xyz/; +\& default { $nothing = 1 } +\& } +.Ve +.PP +Or if you don't care to play it safe, like this: +.PP +.Vb 7 +\& use v5.14; +\& given ($var) { +\& $abc = 1 when /^abc/; +\& $def = 1 when /^def/; +\& $xyz = 1 when /^xyz/; +\& default { $nothing = 1 } +\& } +.Ve +.PP +The arguments to \f(CW\*(C`given\*(C'\fR and \f(CW\*(C`when\*(C'\fR are in scalar context, +and \f(CW\*(C`given\*(C'\fR assigns the \f(CW$_\fR variable its topic value. +.PP +Exactly what the \fI\s-1EXPR\s0\fR argument to \f(CW\*(C`when\*(C'\fR does is hard to describe +precisely, but in general, it tries to guess what you want done. Sometimes +it is interpreted as \f(CW\*(C`$_ ~~ \f(CIEXPR\f(CW\*(C'\fR, and sometimes it is not. It +also behaves differently when lexically enclosed by a \f(CW\*(C`given\*(C'\fR block than +it does when dynamically enclosed by a \f(CW\*(C`foreach\*(C'\fR loop. The rules are far +too difficult to understand to be described here. See \*(L"Experimental Details +on given and when\*(R" later on. +.PP +Due to an unfortunate bug in how \f(CW\*(C`given\*(C'\fR was implemented between Perl 5.10 +and 5.16, under those implementations the version of \f(CW$_\fR governed by +\&\f(CW\*(C`given\*(C'\fR is merely a lexically scoped copy of the original, not a +dynamically scoped alias to the original, as it would be if it were a +\&\f(CW\*(C`foreach\*(C'\fR or under both the original and the current Raku language +specification. This bug was fixed in Perl 5.18 (and lexicalized \f(CW$_\fR itself +was removed in Perl 5.24). +.PP +If your code still needs to run on older versions, +stick to \f(CW\*(C`foreach\*(C'\fR for your topicalizer and +you will be less unhappy. +.SS "Goto" +.IX Xref "goto" +.IX Subsection "Goto" +Although not for the faint of heart, Perl does support a \f(CW\*(C`goto\*(C'\fR +statement. There are three forms: \f(CW\*(C`goto\*(C'\fR\-LABEL, \f(CW\*(C`goto\*(C'\fR\-EXPR, and +\&\f(CW\*(C`goto\*(C'\fR\-&NAME. A loop's \s-1LABEL\s0 is not actually a valid target for +a \f(CW\*(C`goto\*(C'\fR; it's just the name of the loop. +.PP +The \f(CW\*(C`goto\*(C'\fR\-LABEL form finds the statement labeled with \s-1LABEL\s0 and resumes +execution there. It may not be used to go into any construct that +requires initialization, such as a subroutine or a \f(CW\*(C`foreach\*(C'\fR loop. It +also can't be used to go into a construct that is optimized away. It +can be used to go almost anywhere else within the dynamic scope, +including out of subroutines, but it's usually better to use some other +construct such as \f(CW\*(C`last\*(C'\fR or \f(CW\*(C`die\*(C'\fR. The author of Perl has never felt the +need to use this form of \f(CW\*(C`goto\*(C'\fR (in Perl, that is\*(--C is another matter). +.PP +The \f(CW\*(C`goto\*(C'\fR\-EXPR form expects a label name, whose scope will be resolved +dynamically. This allows for computed \f(CW\*(C`goto\*(C'\fRs per \s-1FORTRAN,\s0 but isn't +necessarily recommended if you're optimizing for maintainability: +.PP +.Vb 1 +\& goto(("FOO", "BAR", "GLARCH")[$i]); +.Ve +.PP +The \f(CW\*(C`goto\*(C'\fR\-&NAME form is highly magical, and substitutes a call to the +named subroutine for the currently running subroutine. This is used by +\&\f(CW\*(C`AUTOLOAD()\*(C'\fR subroutines that wish to load another subroutine and then +pretend that the other subroutine had been called in the first place +(except that any modifications to \f(CW@_\fR in the current subroutine are +propagated to the other subroutine.) After the \f(CW\*(C`goto\*(C'\fR, not even \f(CW\*(C`caller()\*(C'\fR +will be able to tell that this routine was called first. +.PP +In almost all cases like this, it's usually a far, far better idea to use the +structured control flow mechanisms of \f(CW\*(C`next\*(C'\fR, \f(CW\*(C`last\*(C'\fR, or \f(CW\*(C`redo\*(C'\fR instead of +resorting to a \f(CW\*(C`goto\*(C'\fR. For certain applications, the catch and throw pair of +\&\f(CW\*(C`eval{}\*(C'\fR and \fBdie()\fR for exception processing can also be a prudent approach. +.SS "The Ellipsis Statement" +.IX Xref "... ... statement ellipsis operator elliptical statement unimplemented statement unimplemented operator yada-yada yada-yada operator ... operator whatever operator triple-dot operator" +.IX Subsection "The Ellipsis Statement" +Beginning in Perl 5.12, Perl accepts an ellipsis, "\f(CW\*(C`...\*(C'\fR", as a +placeholder for code that you haven't implemented yet. +When Perl 5.12 or later encounters an ellipsis statement, it parses this +without error, but if and when you should actually try to execute it, Perl +throws an exception with the text \f(CW\*(C`Unimplemented\*(C'\fR: +.PP +.Vb 6 +\& use v5.12; +\& sub unimplemented { ... } +\& eval { unimplemented() }; +\& if ($@ =~ /^Unimplemented at /) { +\& say "I found an ellipsis!"; +\& } +.Ve +.PP +You can only use the elliptical statement to stand in for a complete +statement. Syntactically, "\f(CW\*(C`...;\*(C'\fR\*(L" is a complete statement, but, +as with other kinds of semicolon-terminated statement, the semicolon +may be omitted if \*(R"\f(CW\*(C`...\*(C'\fR" appears immediately before a closing brace. +These examples show how the ellipsis works: +.PP +.Vb 10 +\& use v5.12; +\& { ... } +\& sub foo { ... } +\& ...; +\& eval { ... }; +\& sub somemeth { +\& my $self = shift; +\& ...; +\& } +\& $x = do { +\& my $n; +\& ...; +\& say "Hurrah!"; +\& $n; +\& }; +.Ve +.PP +The elliptical statement cannot stand in for an expression that +is part of a larger statement. +These examples of attempts to use an ellipsis are syntax errors: +.PP +.Vb 1 +\& use v5.12; +\& +\& print ...; +\& open(my $fh, ">", "/dev/passwd") or ...; +\& if ($condition && ... ) { say "Howdy" }; +\& ... if $a > $b; +\& say "Cromulent" if ...; +\& $flub = 5 + ...; +.Ve +.PP +There are some cases where Perl can't immediately tell the difference +between an expression and a statement. For instance, the syntax for a +block and an anonymous hash reference constructor look the same unless +there's something in the braces to give Perl a hint. The ellipsis is a +syntax error if Perl doesn't guess that the \f(CW\*(C`{ ... }\*(C'\fR is a block. +Inside your block, you can use a \f(CW\*(C`;\*(C'\fR before the ellipsis to denote that the +\&\f(CW\*(C`{ ... }\*(C'\fR is a block and not a hash reference constructor. +.PP +Note: Some folks colloquially refer to this bit of punctuation as a +\&\*(L"yada-yada\*(R" or \*(L"triple-dot\*(R", but its true name +is actually an ellipsis. +.SS "PODs: Embedded Documentation" +.IX Xref "POD documentation" +.IX Subsection "PODs: Embedded Documentation" +Perl has a mechanism for intermixing documentation with source code. +While it's expecting the beginning of a new statement, if the compiler +encounters a line that begins with an equal sign and a word, like this +.PP +.Vb 1 +\& =head1 Here There Be Pods! +.Ve +.PP +Then that text and all remaining text up through and including a line +beginning with \f(CW\*(C`=cut\*(C'\fR will be ignored. The format of the intervening +text is described in perlpod. +.PP +This allows you to intermix your source code +and your documentation text freely, as in +.PP +.Vb 1 +\& =item snazzle($) +\& +\& The snazzle() function will behave in the most spectacular +\& form that you can possibly imagine, not even excepting +\& cybernetic pyrotechnics. +\& +\& =cut back to the compiler, nuff of this pod stuff! +\& +\& sub snazzle($) { +\& my $thingie = shift; +\& ......... +\& } +.Ve +.PP +Note that pod translators should look at only paragraphs beginning +with a pod directive (it makes parsing easier), whereas the compiler +actually knows to look for pod escapes even in the middle of a +paragraph. This means that the following secret stuff will be +ignored by both the compiler and the translators. +.PP +.Vb 5 +\& $a=3; +\& =secret stuff +\& warn "Neither POD nor CODE!?" +\& =cut back +\& print "got $a\en"; +.Ve +.PP +You probably shouldn't rely upon the \f(CW\*(C`warn()\*(C'\fR being podded out forever. +Not all pod translators are well-behaved in this regard, and perhaps +the compiler will become pickier. +.PP +One may also use pod directives to quickly comment out a section +of code. +.SS "Plain Old Comments (Not!)" +.IX Xref "comment line # preprocessor eval" +.IX Subsection "Plain Old Comments (Not!)" +Perl can process line directives, much like the C preprocessor. Using +this, one can control Perl's idea of filenames and line numbers in +error or warning messages (especially for strings that are processed +with \f(CW\*(C`eval()\*(C'\fR). The syntax for this mechanism is almost the same as for +most C preprocessors: it matches the regular expression +.PP +.Vb 5 +\& # example: \*(Aq# line 42 "new_filename.plx"\*(Aq +\& /^\e# \es* +\& line \es+ (\ed+) \es* +\& (?:\es("?)([^"]+)\eg2)? \es* +\& $/x +.Ve +.PP +with \f(CW$1\fR being the line number for the next line, and \f(CW$3\fR being +the optional filename (specified with or without quotes). Note that +no whitespace may precede the \f(CW\*(C`#\*(C'\fR, unlike modern C preprocessors. +.PP +There is a fairly obvious gotcha included with the line directive: +Debuggers and profilers will only show the last source line to appear +at a particular line number in a given file. Care should be taken not +to cause line number collisions in code you'd like to debug later. +.PP +Here are some examples that you should be able to type into your command +shell: +.PP +.Vb 6 +\& % perl +\& # line 200 "bzzzt" +\& # the \*(Aq#\*(Aq on the previous line must be the first char on line +\& die \*(Aqfoo\*(Aq; +\& _\|_END_\|_ +\& foo at bzzzt line 201. +\& +\& % perl +\& # line 200 "bzzzt" +\& eval qq[\en#line 2001 ""\endie \*(Aqfoo\*(Aq]; print $@; +\& _\|_END_\|_ +\& foo at \- line 2001. +\& +\& % perl +\& eval qq[\en#line 200 "foo bar"\endie \*(Aqfoo\*(Aq]; print $@; +\& _\|_END_\|_ +\& foo at foo bar line 200. +\& +\& % perl +\& # line 345 "goop" +\& eval "\en#line " . _\|_LINE_\|_ . \*(Aq "\*(Aq . _\|_FILE_\|_ ."\e"\endie \*(Aqfoo\*(Aq"; +\& print $@; +\& _\|_END_\|_ +\& foo at goop line 345. +.Ve +.SS "Experimental Details on given and when" +.IX Subsection "Experimental Details on given and when" +As previously mentioned, the \*(L"switch\*(R" feature is considered highly +experimental; it is subject to change with little notice. In particular, +\&\f(CW\*(C`when\*(C'\fR has tricky behaviours that are expected to change to become less +tricky in the future. Do not rely upon its current (mis)implementation. +Before Perl 5.18, \f(CW\*(C`given\*(C'\fR also had tricky behaviours that you should still +beware of if your code must run on older versions of Perl. +.PP +Here is a longer example of \f(CW\*(C`given\*(C'\fR: +.PP +.Vb 10 +\& use feature ":5.10"; +\& given ($foo) { +\& when (undef) { +\& say \*(Aq$foo is undefined\*(Aq; +\& } +\& when ("foo") { +\& say \*(Aq$foo is the string "foo"\*(Aq; +\& } +\& when ([1,3,5,7,9]) { +\& say \*(Aq$foo is an odd digit\*(Aq; +\& continue; # Fall through +\& } +\& when ($_ < 100) { +\& say \*(Aq$foo is numerically less than 100\*(Aq; +\& } +\& when (\e&complicated_check) { +\& say \*(Aqa complicated check for $foo is true\*(Aq; +\& } +\& default { +\& die q(I don\*(Aqt know what to do with $foo); +\& } +\& } +.Ve +.PP +Before Perl 5.18, \f(CW\*(C`given(EXPR)\*(C'\fR assigned the value of \fI\s-1EXPR\s0\fR to +merely a lexically scoped \fI\f(BIcopy\fI\fR (!) of \f(CW$_\fR, not a dynamically +scoped alias the way \f(CW\*(C`foreach\*(C'\fR does. That made it similar to +.PP +.Vb 1 +\& do { my $_ = EXPR; ... } +.Ve +.PP +except that the block was automatically broken out of by a successful +\&\f(CW\*(C`when\*(C'\fR or an explicit \f(CW\*(C`break\*(C'\fR. Because it was only a copy, and because +it was only lexically scoped, not dynamically scoped, you could not do the +things with it that you are used to in a \f(CW\*(C`foreach\*(C'\fR loop. In particular, +it did not work for arbitrary function calls if those functions might try +to access \f(CW$_\fR. Best stick to \f(CW\*(C`foreach\*(C'\fR for that. +.PP +Most of the power comes from the implicit smartmatching that can +sometimes apply. Most of the time, \f(CW\*(C`when(EXPR)\*(C'\fR is treated as an +implicit smartmatch of \f(CW$_\fR, that is, \f(CW\*(C`$_ ~~ EXPR\*(C'\fR. (See +\&\*(L"Smartmatch Operator\*(R" in perlop for more information on smartmatching.) +But when \fI\s-1EXPR\s0\fR is one of the 10 exceptional cases (or things like them) +listed below, it is used directly as a boolean. +.IP "1." 4 +.IX Item "1." +A user-defined subroutine call or a method invocation. +.IP "2." 4 +.IX Item "2." +A regular expression match in the form of \f(CW\*(C`/REGEX/\*(C'\fR, \f(CW\*(C`$foo =~ /REGEX/\*(C'\fR, +or \f(CW\*(C`$foo =~ EXPR\*(C'\fR. Also, a negated regular expression match in +the form \f(CW\*(C`!/REGEX/\*(C'\fR, \f(CW\*(C`$foo !~ /REGEX/\*(C'\fR, or \f(CW\*(C`$foo !~ EXPR\*(C'\fR. +.IP "3." 4 +.IX Item "3." +A smart match that uses an explicit \f(CW\*(C`~~\*(C'\fR operator, such as \f(CW\*(C`EXPR ~~ EXPR\*(C'\fR. +.Sp +\&\fB\s-1NOTE:\s0\fR You will often have to use \f(CW\*(C`$c ~~ $_\*(C'\fR because the default case +uses \f(CW\*(C`$_ ~~ $c\*(C'\fR , which is frequently the opposite of what you want. +.IP "4." 4 +.IX Item "4." +A boolean comparison operator such as \f(CW\*(C`$_ < 10\*(C'\fR or \f(CW\*(C`$x eq "abc"\*(C'\fR. The +relational operators that this applies to are the six numeric comparisons +(\f(CW\*(C`<\*(C'\fR, \f(CW\*(C`>\*(C'\fR, \f(CW\*(C`<=\*(C'\fR, \f(CW\*(C`>=\*(C'\fR, \f(CW\*(C`==\*(C'\fR, and \f(CW\*(C`!=\*(C'\fR), and +the six string comparisons (\f(CW\*(C`lt\*(C'\fR, \f(CW\*(C`gt\*(C'\fR, \f(CW\*(C`le\*(C'\fR, \f(CW\*(C`ge\*(C'\fR, \f(CW\*(C`eq\*(C'\fR, and \f(CW\*(C`ne\*(C'\fR). +.IP "5." 4 +.IX Item "5." +At least the three builtin functions \f(CW\*(C`defined(...)\*(C'\fR, \f(CW\*(C`exists(...)\*(C'\fR, and +\&\f(CW\*(C`eof(...)\*(C'\fR. We might someday add more of these later if we think of them. +.IP "6." 4 +.IX Item "6." +A negated expression, whether \f(CW\*(C`!(EXPR)\*(C'\fR or \f(CW\*(C`not(EXPR)\*(C'\fR, or a logical +exclusive-or, \f(CW\*(C`(EXPR1) xor (EXPR2)\*(C'\fR. The bitwise versions (\f(CW\*(C`~\*(C'\fR and \f(CW\*(C`^\*(C'\fR) +are not included. +.IP "7." 4 +.IX Item "7." +A filetest operator, with exactly 4 exceptions: \f(CW\*(C`\-s\*(C'\fR, \f(CW\*(C`\-M\*(C'\fR, \f(CW\*(C`\-A\*(C'\fR, and +\&\f(CW\*(C`\-C\*(C'\fR, as these return numerical values, not boolean ones. The \f(CW\*(C`\-z\*(C'\fR +filetest operator is not included in the exception list. +.IP "8." 4 +.IX Item "8." +The \f(CW\*(C`..\*(C'\fR and \f(CW\*(C`...\*(C'\fR flip-flop operators. Note that the \f(CW\*(C`...\*(C'\fR flip-flop +operator is completely different from the \f(CW\*(C`...\*(C'\fR elliptical statement +just described. +.PP +In those 8 cases above, the value of \s-1EXPR\s0 is used directly as a boolean, so +no smartmatching is done. You may think of \f(CW\*(C`when\*(C'\fR as a smartsmartmatch. +.PP +Furthermore, Perl inspects the operands of logical operators to +decide whether to use smartmatching for each one by applying the +above test to the operands: +.IP "9." 4 +.IX Item "9." +If \s-1EXPR\s0 is \f(CW\*(C`EXPR1 && EXPR2\*(C'\fR or \f(CW\*(C`EXPR1 and EXPR2\*(C'\fR, the test is applied +\&\fIrecursively\fR to both \s-1EXPR1\s0 and \s-1EXPR2.\s0 +Only if \fIboth\fR operands also pass the +test, \fIrecursively\fR, will the expression be treated as boolean. Otherwise, +smartmatching is used. +.IP "10." 4 +.IX Item "10." +If \s-1EXPR\s0 is \f(CW\*(C`EXPR1 || EXPR2\*(C'\fR, \f(CW\*(C`EXPR1 // EXPR2\*(C'\fR, or \f(CW\*(C`EXPR1 or EXPR2\*(C'\fR, the +test is applied \fIrecursively\fR to \s-1EXPR1\s0 only (which might itself be a +higher-precedence \s-1AND\s0 operator, for example, and thus subject to the +previous rule), not to \s-1EXPR2.\s0 If \s-1EXPR1\s0 is to use smartmatching, then \s-1EXPR2\s0 +also does so, no matter what \s-1EXPR2\s0 contains. But if \s-1EXPR2\s0 does not get to +use smartmatching, then the second argument will not be either. This is +quite different from the \f(CW\*(C`&&\*(C'\fR case just described, so be careful. +.PP +These rules are complicated, but the goal is for them to do what you want +(even if you don't quite understand why they are doing it). For example: +.PP +.Vb 1 +\& when (/^\ed+$/ && $_ < 75) { ... } +.Ve +.PP +will be treated as a boolean match because the rules say both +a regex match and an explicit test on \f(CW$_\fR will be treated +as boolean. +.PP +Also: +.PP +.Vb 1 +\& when ([qw(foo bar)] && /baz/) { ... } +.Ve +.PP +will use smartmatching because only \fIone\fR of the operands is a boolean: +the other uses smartmatching, and that wins. +.PP +Further: +.PP +.Vb 1 +\& when ([qw(foo bar)] || /^baz/) { ... } +.Ve +.PP +will use smart matching (only the first operand is considered), whereas +.PP +.Vb 1 +\& when (/^baz/ || [qw(foo bar)]) { ... } +.Ve +.PP +will test only the regex, which causes both operands to be +treated as boolean. Watch out for this one, then, because an +arrayref is always a true value, which makes it effectively +redundant. Not a good idea. +.PP +Tautologous boolean operators are still going to be optimized +away. Don't be tempted to write +.PP +.Vb 1 +\& when ("foo" or "bar") { ... } +.Ve +.PP +This will optimize down to \f(CW"foo"\fR, so \f(CW"bar"\fR will never be considered (even +though the rules say to use a smartmatch +on \f(CW"foo"\fR). For an alternation like +this, an array ref will work, because this will instigate smartmatching: +.PP +.Vb 1 +\& when ([qw(foo bar)] { ... } +.Ve +.PP +This is somewhat equivalent to the C\-style switch statement's fallthrough +functionality (not to be confused with \fIPerl's\fR fallthrough +functionality\*(--see below), wherein the same block is used for several +\&\f(CW\*(C`case\*(C'\fR statements. +.PP +Another useful shortcut is that, if you use a literal array or hash as the +argument to \f(CW\*(C`given\*(C'\fR, it is turned into a reference. So \f(CW\*(C`given(@foo)\*(C'\fR is +the same as \f(CW\*(C`given(\e@foo)\*(C'\fR, for example. +.PP +\&\f(CW\*(C`default\*(C'\fR behaves exactly like \f(CW\*(C`when(1 == 1)\*(C'\fR, which is +to say that it always matches. +.PP +\fIBreaking out\fR +.IX Subsection "Breaking out" +.PP +You can use the \f(CW\*(C`break\*(C'\fR keyword to break out of the enclosing +\&\f(CW\*(C`given\*(C'\fR block. Every \f(CW\*(C`when\*(C'\fR block is implicitly ended with +a \f(CW\*(C`break\*(C'\fR. +.PP +\fIFall-through\fR +.IX Subsection "Fall-through" +.PP +You can use the \f(CW\*(C`continue\*(C'\fR keyword to fall through from one +case to the next immediate \f(CW\*(C`when\*(C'\fR or \f(CW\*(C`default\*(C'\fR: +.PP +.Vb 5 +\& given($foo) { +\& when (/x/) { say \*(Aq$foo contains an x\*(Aq; continue } +\& when (/y/) { say \*(Aq$foo contains a y\*(Aq } +\& default { say \*(Aq$foo does not contain a y\*(Aq } +\& } +.Ve +.PP +\fIReturn value\fR +.IX Subsection "Return value" +.PP +When a \f(CW\*(C`given\*(C'\fR statement is also a valid expression (for example, +when it's the last statement of a block), it evaluates to: +.IP "\(bu" 4 +An empty list as soon as an explicit \f(CW\*(C`break\*(C'\fR is encountered. +.IP "\(bu" 4 +The value of the last evaluated expression of the successful +\&\f(CW\*(C`when\*(C'\fR/\f(CW\*(C`default\*(C'\fR clause, if there happens to be one. +.IP "\(bu" 4 +The value of the last evaluated expression of the \f(CW\*(C`given\*(C'\fR block if no +condition is true. +.PP +In both last cases, the last expression is evaluated in the context that +was applied to the \f(CW\*(C`given\*(C'\fR block. +.PP +Note that, unlike \f(CW\*(C`if\*(C'\fR and \f(CW\*(C`unless\*(C'\fR, failed \f(CW\*(C`when\*(C'\fR statements always +evaluate to an empty list. +.PP +.Vb 8 +\& my $price = do { +\& given ($item) { +\& when (["pear", "apple"]) { 1 } +\& break when "vote"; # My vote cannot be bought +\& 1e10 when /Mona Lisa/; +\& "unknown"; +\& } +\& }; +.Ve +.PP +Currently, \f(CW\*(C`given\*(C'\fR blocks can't always +be used as proper expressions. This +may be addressed in a future version of Perl. +.PP +\fISwitching in a loop\fR +.IX Subsection "Switching in a loop" +.PP +Instead of using \f(CW\*(C`given()\*(C'\fR, you can use a \f(CW\*(C`foreach()\*(C'\fR loop. +For example, here's one way to count how many times a particular +string occurs in an array: +.PP +.Vb 6 +\& use v5.10.1; +\& my $count = 0; +\& for (@array) { +\& when ("foo") { ++$count } +\& } +\& print "\e@array contains $count copies of \*(Aqfoo\*(Aq\en"; +.Ve +.PP +Or in a more recent version: +.PP +.Vb 6 +\& use v5.14; +\& my $count = 0; +\& for (@array) { +\& ++$count when "foo"; +\& } +\& print "\e@array contains $count copies of \*(Aqfoo\*(Aq\en"; +.Ve +.PP +At the end of all \f(CW\*(C`when\*(C'\fR blocks, there is an implicit \f(CW\*(C`next\*(C'\fR. +You can override that with an explicit \f(CW\*(C`last\*(C'\fR if you're +interested in only the first match alone. +.PP +This doesn't work if you explicitly specify a loop variable, as +in \f(CW\*(C`for $item (@array)\*(C'\fR. You have to use the default variable \f(CW$_\fR. +.PP +\fIDifferences from Raku\fR +.IX Subsection "Differences from Raku" +.PP +The Perl 5 smartmatch and \f(CW\*(C`given\*(C'\fR/\f(CW\*(C`when\*(C'\fR constructs are not compatible +with their Raku analogues. The most visible difference and least +important difference is that, in Perl 5, parentheses are required around +the argument to \f(CW\*(C`given()\*(C'\fR and \f(CW\*(C`when()\*(C'\fR (except when this last one is used +as a statement modifier). Parentheses in Raku are always optional in a +control construct such as \f(CW\*(C`if()\*(C'\fR, \f(CW\*(C`while()\*(C'\fR, or \f(CW\*(C`when()\*(C'\fR; they can't be +made optional in Perl 5 without a great deal of potential confusion, +because Perl 5 would parse the expression +.PP +.Vb 3 +\& given $foo { +\& ... +\& } +.Ve +.PP +as though the argument to \f(CW\*(C`given\*(C'\fR were an element of the hash +\&\f(CW%foo\fR, interpreting the braces as hash-element syntax. +.PP +However, their are many, many other differences. For example, +this works in Perl 5: +.PP +.Vb 2 +\& use v5.12; +\& my @primary = ("red", "blue", "green"); +\& +\& if (@primary ~~ "red") { +\& say "primary smartmatches red"; +\& } +\& +\& if ("red" ~~ @primary) { +\& say "red smartmatches primary"; +\& } +\& +\& say "that\*(Aqs all, folks!"; +.Ve +.PP +But it doesn't work at all in Raku. Instead, you should +use the (parallelizable) \f(CW\*(C`any\*(C'\fR operator: +.PP +.Vb 3 +\& if any(@primary) eq "red" { +\& say "primary smartmatches red"; +\& } +\& +\& if "red" eq any(@primary) { +\& say "red smartmatches primary"; +\& } +.Ve +.PP +The table of smartmatches in \*(L"Smartmatch Operator\*(R" in perlop is not +identical to that proposed by the Raku specification, mainly due to +differences between Raku's and Perl 5's data models, but also because +the Raku spec has changed since Perl 5 rushed into early adoption. +.PP +In Raku, \f(CW\*(C`when()\*(C'\fR will always do an implicit smartmatch with its +argument, while in Perl 5 it is convenient (albeit potentially confusing) to +suppress this implicit smartmatch in various rather loosely-defined +situations, as roughly outlined above. (The difference is largely because +Perl 5 does not have, even internally, a boolean type.) diff --git a/data/miniconda3/man/man1/perlsynology.1 b/data/miniconda3/man/man1/perlsynology.1 new file mode 100644 index 0000000000000000000000000000000000000000..b7a34e9c1e2aad53e49a1eb79e768f3301dadff9 --- /dev/null +++ b/data/miniconda3/man/man1/perlsynology.1 @@ -0,0 +1,382 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLSYNOLOGY 1" +.TH PERLSYNOLOGY 1 "2020-12-18" "perl v5.32.1" "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" +perlsynology \- Perl 5 on Synology DSM systems +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Synology manufactures a vast number of Network Attached Storage (\s-1NAS\s0) +devices that are very popular in large organisations as well as small +businesses and homes. +.PP +The \s-1NAS\s0 systems are equipped with Synology Disk Storage Manager (\s-1DSM\s0), +which is a trimmed-down Linux system enhanced with several tools for +managing the \s-1NAS.\s0 There are several flavours of hardware: Marvell +Armada (ARMv5tel, ARMv7l), Intel Atom (i686, x86_64), Freescale QorIQ +(\s-1PPC\s0), and more. For a full list see the +Synology \s-1FAQ\s0 . +.PP +Since it is based on Linux, the \s-1NAS\s0 can run many popular Linux +software packages, including Perl. In fact, Synology provides a +ready-to-install package for Perl, depending on the version of \s-1DSM\s0 +the installed perl ranges from 5.8.6 on \s-1DSM\-4.3\s0 to 5.24.0 on \s-1DSM\-6.1.\s0 +.PP +There is an active user community that provides many software packages +for the Synology \s-1DSM\s0 systems; at the time of writing this document +they provide Perl version 5.24.1. +.PP +This document describes various features of Synology \s-1DSM\s0 operating +system that will affect how Perl 5 (hereafter just Perl) is +configured, compiled and/or runs. It has been compiled and verified by +Johan Vromans for the Synology \s-1DS413\s0 (QorIQ), with feedback from +H.Merijn Brand (\s-1DS213,\s0 ARMv5tel and \s-1RS815,\s0 Intel Atom x64). +.SS "Setting up the build environment" +.IX Subsection "Setting up the build environment" +\fI\s-1DSM 5\s0\fR +.IX Subsection "DSM 5" +.PP +As \s-1DSM\s0 is a trimmed-down Linux system, it lacks many of the tools and +libraries commonly found on Linux. The basic tools like sh, cp, rm, +etc. are implemented using +BusyBox . +.IP "\(bu" 4 +Using your favourite browser open the \s-1DSM\s0 management page and start +the Package Center. +.IP "\(bu" 4 +If you want to smoke test Perl, install \f(CW\*(C`Perl\*(C'\fR. +.IP "\(bu" 4 +In Settings, add the following Package Sources: +.Sp +.Vb 2 +\& https://www.cphub.net +\& http://packages.quadrat4.de +.Ve +.IP "\(bu" 4 +Still in Settings, in Channel Update, select Beta Channel. +.IP "\(bu" 4 +Press Refresh. In the left panel the item \*(L"Community\*(R" will appear. +Click it. Select \*(L"Bootstrap Installer Beta\*(R" and install it. +.IP "\(bu" 4 +Likewise, install \*(L"iPKGui Beta\*(R". +.Sp +The application window should now show an icon for iPKGui. +.IP "\(bu" 4 +Start iPKGui. Install the packages \f(CW\*(C`make\*(C'\fR, \f(CW\*(C`gcc\*(C'\fR and \f(CW\*(C`coreutils\*(C'\fR. +.Sp +If you want to smoke test Perl, install \f(CW\*(C`patch\*(C'\fR. +.PP +The next step is to add some symlinks to system libraries. For +example, the development software expect a library \f(CW\*(C`libm.so\*(C'\fR that +normally is a symlink to \f(CW\*(C`libm.so.6\*(C'\fR. Synology only provides the +latter and not the symlink. +.PP +Here the actual architecture of the Synology system matters. You have +to find out where the gcc libraries have been installed. Look in /opt +for a directory similar to arm-none-linux-gnueab or +powerpc-linux-gnuspe. In the instructions below I'll use +powerpc-linux-gnuspe as an example. +.IP "\(bu" 4 +On the \s-1DSM\s0 management page start the Control Panel. +.IP "\(bu" 4 +Click Terminal, and enable \s-1SSH\s0 service. +.IP "\(bu" 4 +Close Terminal and the Control Panel. +.IP "\(bu" 4 +Open a shell on the Synology using ssh and become root. +.IP "\(bu" 4 +Execute the following commands: +.Sp +.Vb 7 +\& cd /lib +\& ln \-s libm.so.6 libm.so +\& ln \-s libcrypt.so.1 libcrypt.so +\& ln \-s libdl.so.2 libdl.so +\& cd /opt/powerpc\-linux\-gnuspe/lib (or +\& /opt/arm\-none\-linux\-gnueabi/lib) +\& ln \-s /lib/libdl.so.2 libdl.so +.Ve +.PP +\&\fB\s-1WARNING:\s0\fR When you perform a system software upgrade, these links +will disappear and need to be re-established. +.PP +\fI\s-1DSM 6\s0\fR +.IX Subsection "DSM 6" +.PP +Using iPkg has been deprecated on \s-1DSM 6,\s0 but an alternative is available +for \s-1DSM 6:\s0 entware/opkg. For instructions on how to use that, please read +Install Entware-ng on Synology \s-1NAS\s0 +.PP +That sadly does not (yet) work on QorIQ. At the moment of writing, the +supported architectures are armv5, armv7, mipsel, wl500g, x86_32, and x86_64. +Check here for supported platforms. +.PP +Entware-ng comes with a precompiled 5.24.1 (June 2017) that allowes +building shared \s-1XS\s0 code. Note that this installation does \fBnot\fR use +a site_perl folder. The available \f(CW\*(C`cpan\*(C'\fR works. If all required +development packages are installed too, also for \s-1XS.\s0 +.SS "Compiling Perl 5" +.IX Subsection "Compiling Perl 5" +When the build environment has been set up, building and testing Perl +is straightforward. The only thing you need to do is download the +sources as usual, and add a file Policy.sh as follows: +.PP +.Vb 2 +\& # Administrivia. +\& perladmin="your.email@goes.here" +\& +\& # Install Perl in a tree in /opt/perl instead of /opt/bin. +\& prefix=/opt/perl +\& +\& # Select the compiler. Note that there is no \*(Aqcc\*(Aq alias or link. +\& cc=gcc +\& +\& # Build flags. +\& ccflags="\-DDEBUGGING" +\& +\& # Library and include paths. +\& libpth="/lib" +\& locincpth="/opt/include" +\& loclibpth="/lib" +.Ve +.PP +You may want to create the destination directory and give it the right +permissions before installing, thus eliminating the need to build Perl +as a super user. +.PP +In the directory where you unpacked the sources, issue the familiar +commands: +.PP +.Vb 4 +\& ./Configure \-des +\& make +\& make test +\& make install +.Ve +.SS "Known problems" +.IX Subsection "Known problems" +\fIConfigure\fR +.IX Subsection "Configure" +.PP +No known problems yet +.PP +\fIBuild\fR +.IX Subsection "Build" +.ie n .IP "Error message ""No error definitions found""." 4 +.el .IP "Error message ``No error definitions found''." 4 +.IX Item "Error message No error definitions found." +This error is generated when it is not possible to find the local +definitions for error codes, due to the uncommon structure of the +Synology file system. +.Sp +This error was fixed in the Perl development git for version 5.19, +commit 7a8f1212e5482613c8a5b0402528e3105b26ff24. +.PP +\fIFailing tests\fR +.IX Subsection "Failing tests" +.IP "\fIext/DynaLoader/t/DynaLoader.t\fR" 4 +.IX Item "ext/DynaLoader/t/DynaLoader.t" +One subtest fails due to the uncommon structure of the Synology file +system. The file \fI/lib/glibc.so\fR is missing. +.Sp +\&\fB\s-1WARNING:\s0\fR Do not symlink \fI/lib/glibc.so.6\fR to \fI/lib/glibc.so\fR or +some system components will start to fail. +.SS "Smoke testing Perl 5" +.IX Subsection "Smoke testing Perl 5" +If building completes successfully, you can set up smoke testing as +described in the Test::Smoke documentation. +.PP +For smoke testing you need a running Perl. You can either install the +Synology supplied package for Perl 5.8.6, or build and install your +own, much more recent version. +.PP +Note that I could not run successful smokes when initiated by the +Synology Task Scheduler. I resorted to initiating the smokes via a +cron job run on another system, using ssh: +.PP +.Vb 1 +\& ssh nas1 wrk/Test\-Smoke/smoke/smokecurrent.sh +.Ve +.PP +\fILocal patches\fR +.IX Subsection "Local patches" +.PP +When local patches are applied with smoke testing, the test driver +will automatically request regeneration of certain tables after the +patches are applied. The Synology supplied Perl 5.8.6 (at least on the +\&\s-1DS413\s0) \fBis \s-1NOT\s0 capable\fR of generating these tables. It will generate +opcodes with bogus values, causing the build to fail. +.PP +You can prevent regeneration by adding the setting +.PP +.Vb 1 +\& \*(Aqflags\*(Aq => 0, +.Ve +.PP +to the smoke config, or by adding another patch that inserts +.PP +.Vb 1 +\& exit 0 if $] == 5.008006; +.Ve +.PP +in the beginning of the \f(CW\*(C`regen.pl\*(C'\fR program. +.SS "Adding libraries" +.IX Subsection "Adding libraries" +The above procedure describes a basic environment and hence results in +a basic Perl. If you want to add additional libraries to Perl, you may +need some extra settings. +.PP +For example, the basic Perl does not have any of the \s-1DB\s0 libraries (db, +dbm, ndbm, gdsm). You can add these using iPKGui, however, you need to +set environment variable \s-1LD_LIBRARY_PATH\s0 to the appropriate value: +.PP +.Vb 2 +\& LD_LIBRARY_PATH=/lib:/opt/lib +\& export LD_LIBRARY_PATH +.Ve +.PP +This setting needs to be in effect while Perl is built, but also when +the programs are run. +.SH "REVISION" +.IX Header "REVISION" +June 2017, for Synology \s-1DSM 5.1.5022\s0 and \s-1DSM 6.1\-15101\-4.\s0 +.SH "AUTHOR" +.IX Header "AUTHOR" +Johan Vromans +H. Merijn Brand diff --git a/data/miniconda3/man/man1/perltie.1 b/data/miniconda3/man/man1/perltie.1 new file mode 100644 index 0000000000000000000000000000000000000000..cb4faac3a765b4da1d2b3085608bc7f95337abc6 --- /dev/null +++ b/data/miniconda3/man/man1/perltie.1 @@ -0,0 +1,1435 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLTIE 1" +.TH PERLTIE 1 "2020-12-18" "perl v5.32.1" "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" +perltie \- how to hide an object class in a simple variable +.IX Xref "tie" +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 1 +\& tie VARIABLE, CLASSNAME, LIST +\& +\& $object = tied VARIABLE +\& +\& untie VARIABLE +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Prior to release 5.0 of Perl, a programmer could use \fBdbmopen()\fR +to connect an on-disk database in the standard Unix \fBdbm\fR\|(3x) +format magically to a \f(CW%HASH\fR in their program. However, their Perl was either +built with one particular dbm library or another, but not both, and +you couldn't extend this mechanism to other packages or types of variables. +.PP +Now you can. +.PP +The \fBtie()\fR function binds a variable to a class (package) that will provide +the implementation for access methods for that variable. Once this magic +has been performed, accessing a tied variable automatically triggers +method calls in the proper class. The complexity of the class is +hidden behind magic methods calls. The method names are in \s-1ALL CAPS,\s0 +which is a convention that Perl uses to indicate that they're called +implicitly rather than explicitly\*(--just like the \s-1\fBBEGIN\s0()\fR and \s-1\fBEND\s0()\fR +functions. +.PP +In the \fBtie()\fR call, \f(CW\*(C`VARIABLE\*(C'\fR is the name of the variable to be +enchanted. \f(CW\*(C`CLASSNAME\*(C'\fR is the name of a class implementing objects of +the correct type. Any additional arguments in the \f(CW\*(C`LIST\*(C'\fR are passed to +the appropriate constructor method for that class\*(--meaning \s-1\fBTIESCALAR\s0()\fR, +\&\s-1\fBTIEARRAY\s0()\fR, \s-1\fBTIEHASH\s0()\fR, or \s-1\fBTIEHANDLE\s0()\fR. (Typically these are arguments +such as might be passed to the \fBdbminit()\fR function of C.) The object +returned by the \*(L"new\*(R" method is also returned by the \fBtie()\fR function, +which would be useful if you wanted to access other methods in +\&\f(CW\*(C`CLASSNAME\*(C'\fR. (You don't actually have to return a reference to a right +\&\*(L"type\*(R" (e.g., \s-1HASH\s0 or \f(CW\*(C`CLASSNAME\*(C'\fR) so long as it's a properly blessed +object.) You can also retrieve a reference to the underlying object +using the \fBtied()\fR function. +.PP +Unlike \fBdbmopen()\fR, the \fBtie()\fR function will not \f(CW\*(C`use\*(C'\fR or \f(CW\*(C`require\*(C'\fR a module +for you\*(--you need to do that explicitly yourself. +.SS "Tying Scalars" +.IX Xref "scalar, tying" +.IX Subsection "Tying Scalars" +A class implementing a tied scalar should define the following methods: +\&\s-1TIESCALAR, FETCH, STORE,\s0 and possibly \s-1UNTIE\s0 and/or \s-1DESTROY.\s0 +.PP +Let's look at each in turn, using as an example a tie class for +scalars that allows the user to do something like: +.PP +.Vb 2 +\& tie $his_speed, \*(AqNice\*(Aq, getppid(); +\& tie $my_speed, \*(AqNice\*(Aq, $$; +.Ve +.PP +And now whenever either of those variables is accessed, its current +system priority is retrieved and returned. If those variables are set, +then the process's priority is changed! +.PP +We'll use Jarkko Hietaniemi <\fIjhi@iki.fi\fR>'s BSD::Resource class (not +included) to access the \s-1PRIO_PROCESS, PRIO_MIN,\s0 and \s-1PRIO_MAX\s0 constants +from your system, as well as the \fBgetpriority()\fR and \fBsetpriority()\fR system +calls. Here's the preamble of the class. +.PP +.Vb 5 +\& package Nice; +\& use Carp; +\& use BSD::Resource; +\& use strict; +\& $Nice::DEBUG = 0 unless defined $Nice::DEBUG; +.Ve +.IP "\s-1TIESCALAR\s0 classname, \s-1LIST\s0" 4 +.IX Xref "TIESCALAR" +.IX Item "TIESCALAR classname, LIST" +This is the constructor for the class. That means it is +expected to return a blessed reference to a new scalar +(probably anonymous) that it's creating. For example: +.Sp +.Vb 3 +\& sub TIESCALAR { +\& my $class = shift; +\& my $pid = shift || $$; # 0 means me +\& +\& if ($pid !~ /^\ed+$/) { +\& carp "Nice::Tie::Scalar got non\-numeric pid $pid" if $^W; +\& return undef; +\& } +\& +\& unless (kill 0, $pid) { # EPERM or ERSCH, no doubt +\& carp "Nice::Tie::Scalar got bad pid $pid: $!" if $^W; +\& return undef; +\& } +\& +\& return bless \e$pid, $class; +\& } +.Ve +.Sp +This tie class has chosen to return an error rather than raising an +exception if its constructor should fail. While this is how \fBdbmopen()\fR works, +other classes may well not wish to be so forgiving. It checks the global +variable \f(CW$^W\fR to see whether to emit a bit of noise anyway. +.IP "\s-1FETCH\s0 this" 4 +.IX Xref "FETCH" +.IX Item "FETCH this" +This method will be triggered every time the tied variable is accessed +(read). It takes no arguments beyond its self reference, which is the +object representing the scalar we're dealing with. Because in this case +we're using just a \s-1SCALAR\s0 ref for the tied scalar object, a simple $$self +allows the method to get at the real value stored there. In our example +below, that real value is the process \s-1ID\s0 to which we've tied our variable. +.Sp +.Vb 10 +\& sub FETCH { +\& my $self = shift; +\& confess "wrong type" unless ref $self; +\& croak "usage error" if @_; +\& my $nicety; +\& local($!) = 0; +\& $nicety = getpriority(PRIO_PROCESS, $$self); +\& if ($!) { croak "getpriority failed: $!" } +\& return $nicety; +\& } +.Ve +.Sp +This time we've decided to blow up (raise an exception) if the renice +fails\*(--there's no place for us to return an error otherwise, and it's +probably the right thing to do. +.IP "\s-1STORE\s0 this, value" 4 +.IX Xref "STORE" +.IX Item "STORE this, value" +This method will be triggered every time the tied variable is set +(assigned). Beyond its self reference, it also expects one (and only one) +argument: the new value the user is trying to assign. Don't worry about +returning a value from \s-1STORE\s0; the semantic of assignment returning the +assigned value is implemented with \s-1FETCH.\s0 +.Sp +.Vb 5 +\& sub STORE { +\& my $self = shift; +\& confess "wrong type" unless ref $self; +\& my $new_nicety = shift; +\& croak "usage error" if @_; +\& +\& if ($new_nicety < PRIO_MIN) { +\& carp sprintf +\& "WARNING: priority %d less than minimum system priority %d", +\& $new_nicety, PRIO_MIN if $^W; +\& $new_nicety = PRIO_MIN; +\& } +\& +\& if ($new_nicety > PRIO_MAX) { +\& carp sprintf +\& "WARNING: priority %d greater than maximum system priority %d", +\& $new_nicety, PRIO_MAX if $^W; +\& $new_nicety = PRIO_MAX; +\& } +\& +\& unless (defined setpriority(PRIO_PROCESS, +\& $$self, +\& $new_nicety)) +\& { +\& confess "setpriority failed: $!"; +\& } +\& } +.Ve +.IP "\s-1UNTIE\s0 this" 4 +.IX Xref "UNTIE" +.IX Item "UNTIE this" +This method will be triggered when the \f(CW\*(C`untie\*(C'\fR occurs. This can be useful +if the class needs to know when no further calls will be made. (Except \s-1DESTROY\s0 +of course.) See "The \f(CW\*(C`untie\*(C'\fR Gotcha" below for more details. +.IP "\s-1DESTROY\s0 this" 4 +.IX Xref "DESTROY" +.IX Item "DESTROY this" +This method will be triggered when the tied variable needs to be destructed. +As with other object classes, such a method is seldom necessary, because Perl +deallocates its moribund object's memory for you automatically\*(--this isn't +\&\*(C+, you know. We'll use a \s-1DESTROY\s0 method here for debugging purposes only. +.Sp +.Vb 5 +\& sub DESTROY { +\& my $self = shift; +\& confess "wrong type" unless ref $self; +\& carp "[ Nice::DESTROY pid $$self ]" if $Nice::DEBUG; +\& } +.Ve +.PP +That's about all there is to it. Actually, it's more than all there +is to it, because we've done a few nice things here for the sake +of completeness, robustness, and general aesthetics. Simpler +\&\s-1TIESCALAR\s0 classes are certainly possible. +.SS "Tying Arrays" +.IX Xref "array, tying" +.IX Subsection "Tying Arrays" +A class implementing a tied ordinary array should define the following +methods: \s-1TIEARRAY, FETCH, STORE, FETCHSIZE, STORESIZE, CLEAR\s0 +and perhaps \s-1UNTIE\s0 and/or \s-1DESTROY.\s0 +.PP +\&\s-1FETCHSIZE\s0 and \s-1STORESIZE\s0 are used to provide \f(CW$#array\fR and +equivalent \f(CW\*(C`scalar(@array)\*(C'\fR access. +.PP +The methods \s-1POP, PUSH, SHIFT, UNSHIFT, SPLICE, DELETE,\s0 and \s-1EXISTS\s0 are +required if the perl operator with the corresponding (but lowercase) name +is to operate on the tied array. The \fBTie::Array\fR class can be used as a +base class to implement the first five of these in terms of the basic +methods above. The default implementations of \s-1DELETE\s0 and \s-1EXISTS\s0 in +\&\fBTie::Array\fR simply \f(CW\*(C`croak\*(C'\fR. +.PP +In addition \s-1EXTEND\s0 will be called when perl would have pre-extended +allocation in a real array. +.PP +For this discussion, we'll implement an array whose elements are a fixed +size at creation. If you try to create an element larger than the fixed +size, you'll take an exception. For example: +.PP +.Vb 4 +\& use FixedElem_Array; +\& tie @array, \*(AqFixedElem_Array\*(Aq, 3; +\& $array[0] = \*(Aqcat\*(Aq; # ok. +\& $array[1] = \*(Aqdogs\*(Aq; # exception, length(\*(Aqdogs\*(Aq) > 3. +.Ve +.PP +The preamble code for the class is as follows: +.PP +.Vb 3 +\& package FixedElem_Array; +\& use Carp; +\& use strict; +.Ve +.IP "\s-1TIEARRAY\s0 classname, \s-1LIST\s0" 4 +.IX Xref "TIEARRAY" +.IX Item "TIEARRAY classname, LIST" +This is the constructor for the class. That means it is expected to +return a blessed reference through which the new array (probably an +anonymous \s-1ARRAY\s0 ref) will be accessed. +.Sp +In our example, just to show you that you don't \fIreally\fR have to return an +\&\s-1ARRAY\s0 reference, we'll choose a \s-1HASH\s0 reference to represent our object. +A \s-1HASH\s0 works out well as a generic record type: the \f(CW\*(C`{ELEMSIZE}\*(C'\fR field will +store the maximum element size allowed, and the \f(CW\*(C`{ARRAY}\*(C'\fR field will hold the +true \s-1ARRAY\s0 ref. If someone outside the class tries to dereference the +object returned (doubtless thinking it an \s-1ARRAY\s0 ref), they'll blow up. +This just goes to show you that you should respect an object's privacy. +.Sp +.Vb 11 +\& sub TIEARRAY { +\& my $class = shift; +\& my $elemsize = shift; +\& if ( @_ || $elemsize =~ /\eD/ ) { +\& croak "usage: tie ARRAY, \*(Aq" . _\|_PACKAGE_\|_ . "\*(Aq, elem_size"; +\& } +\& return bless { +\& ELEMSIZE => $elemsize, +\& ARRAY => [], +\& }, $class; +\& } +.Ve +.IP "\s-1FETCH\s0 this, index" 4 +.IX Xref "FETCH" +.IX Item "FETCH this, index" +This method will be triggered every time an individual element the tied array +is accessed (read). It takes one argument beyond its self reference: the +index whose value we're trying to fetch. +.Sp +.Vb 5 +\& sub FETCH { +\& my $self = shift; +\& my $index = shift; +\& return $self\->{ARRAY}\->[$index]; +\& } +.Ve +.Sp +If a negative array index is used to read from an array, the index +will be translated to a positive one internally by calling \s-1FETCHSIZE\s0 +before being passed to \s-1FETCH.\s0 You may disable this feature by +assigning a true value to the variable \f(CW$NEGATIVE_INDICES\fR in the +tied array class. +.Sp +As you may have noticed, the name of the \s-1FETCH\s0 method (et al.) is the same +for all accesses, even though the constructors differ in names (\s-1TIESCALAR\s0 +vs \s-1TIEARRAY\s0). While in theory you could have the same class servicing +several tied types, in practice this becomes cumbersome, and it's easiest +to keep them at simply one tie type per class. +.IP "\s-1STORE\s0 this, index, value" 4 +.IX Xref "STORE" +.IX Item "STORE this, index, value" +This method will be triggered every time an element in the tied array is set +(written). It takes two arguments beyond its self reference: the index at +which we're trying to store something and the value we're trying to put +there. +.Sp +In our example, \f(CW\*(C`undef\*(C'\fR is really \f(CW\*(C`$self\->{ELEMSIZE}\*(C'\fR number of +spaces so we have a little more work to do here: +.Sp +.Vb 11 +\& sub STORE { +\& my $self = shift; +\& my( $index, $value ) = @_; +\& if ( length $value > $self\->{ELEMSIZE} ) { +\& croak "length of $value is greater than $self\->{ELEMSIZE}"; +\& } +\& # fill in the blanks +\& $self\->STORESIZE( $index ) if $index > $self\->FETCHSIZE(); +\& # right justify to keep element size for smaller elements +\& $self\->{ARRAY}\->[$index] = sprintf "%$self\->{ELEMSIZE}s", $value; +\& } +.Ve +.Sp +Negative indexes are treated the same as with \s-1FETCH.\s0 +.IP "\s-1FETCHSIZE\s0 this" 4 +.IX Xref "FETCHSIZE" +.IX Item "FETCHSIZE this" +Returns the total number of items in the tied array associated with +object \fIthis\fR. (Equivalent to \f(CW\*(C`scalar(@array)\*(C'\fR). For example: +.Sp +.Vb 4 +\& sub FETCHSIZE { +\& my $self = shift; +\& return scalar @{$self\->{ARRAY}}; +\& } +.Ve +.IP "\s-1STORESIZE\s0 this, count" 4 +.IX Xref "STORESIZE" +.IX Item "STORESIZE this, count" +Sets the total number of items in the tied array associated with +object \fIthis\fR to be \fIcount\fR. If this makes the array larger then +class's mapping of \f(CW\*(C`undef\*(C'\fR should be returned for new positions. +If the array becomes smaller then entries beyond count should be +deleted. +.Sp +In our example, 'undef' is really an element containing +\&\f(CW\*(C`$self\->{ELEMSIZE}\*(C'\fR number of spaces. Observe: +.Sp +.Vb 10 +\& sub STORESIZE { +\& my $self = shift; +\& my $count = shift; +\& if ( $count > $self\->FETCHSIZE() ) { +\& foreach ( $count \- $self\->FETCHSIZE() .. $count ) { +\& $self\->STORE( $_, \*(Aq\*(Aq ); +\& } +\& } elsif ( $count < $self\->FETCHSIZE() ) { +\& foreach ( 0 .. $self\->FETCHSIZE() \- $count \- 2 ) { +\& $self\->POP(); +\& } +\& } +\& } +.Ve +.IP "\s-1EXTEND\s0 this, count" 4 +.IX Xref "EXTEND" +.IX Item "EXTEND this, count" +Informative call that array is likely to grow to have \fIcount\fR entries. +Can be used to optimize allocation. This method need do nothing. +.Sp +In our example there is no reason to implement this method, so we leave +it as a no-op. This method is only relevant to tied array implementations +where there is the possibility of having the allocated size of the array +be larger than is visible to a perl programmer inspecting the size of the +array. Many tied array implementations will have no reason to implement it. +.Sp +.Vb 5 +\& sub EXTEND { +\& my $self = shift; +\& my $count = shift; +\& # nothing to see here, move along. +\& } +.Ve +.Sp +\&\fB\s-1NOTE:\s0\fR It is generally an error to make this equivalent to \s-1STORESIZE.\s0 +Perl may from time to time call \s-1EXTEND\s0 without wanting to actually change +the array size directly. Any tied array should function correctly if this +method is a no-op, even if perhaps they might not be as efficient as they +would if this method was implemented. +.IP "\s-1EXISTS\s0 this, key" 4 +.IX Xref "EXISTS" +.IX Item "EXISTS this, key" +Verify that the element at index \fIkey\fR exists in the tied array \fIthis\fR. +.Sp +In our example, we will determine that if an element consists of +\&\f(CW\*(C`$self\->{ELEMSIZE}\*(C'\fR spaces only, it does not exist: +.Sp +.Vb 7 +\& sub EXISTS { +\& my $self = shift; +\& my $index = shift; +\& return 0 if ! defined $self\->{ARRAY}\->[$index] || +\& $self\->{ARRAY}\->[$index] eq \*(Aq \*(Aq x $self\->{ELEMSIZE}; +\& return 1; +\& } +.Ve +.IP "\s-1DELETE\s0 this, key" 4 +.IX Xref "DELETE" +.IX Item "DELETE this, key" +Delete the element at index \fIkey\fR from the tied array \fIthis\fR. +.Sp +In our example, a deleted item is \f(CW\*(C`$self\->{ELEMSIZE}\*(C'\fR spaces: +.Sp +.Vb 5 +\& sub DELETE { +\& my $self = shift; +\& my $index = shift; +\& return $self\->STORE( $index, \*(Aq\*(Aq ); +\& } +.Ve +.IP "\s-1CLEAR\s0 this" 4 +.IX Xref "CLEAR" +.IX Item "CLEAR this" +Clear (remove, delete, ...) all values from the tied array associated with +object \fIthis\fR. For example: +.Sp +.Vb 4 +\& sub CLEAR { +\& my $self = shift; +\& return $self\->{ARRAY} = []; +\& } +.Ve +.IP "\s-1PUSH\s0 this, \s-1LIST\s0" 4 +.IX Xref "PUSH" +.IX Item "PUSH this, LIST" +Append elements of \fI\s-1LIST\s0\fR to the array. For example: +.Sp +.Vb 7 +\& sub PUSH { +\& my $self = shift; +\& my @list = @_; +\& my $last = $self\->FETCHSIZE(); +\& $self\->STORE( $last + $_, $list[$_] ) foreach 0 .. $#list; +\& return $self\->FETCHSIZE(); +\& } +.Ve +.IP "\s-1POP\s0 this" 4 +.IX Xref "POP" +.IX Item "POP this" +Remove last element of the array and return it. For example: +.Sp +.Vb 4 +\& sub POP { +\& my $self = shift; +\& return pop @{$self\->{ARRAY}}; +\& } +.Ve +.IP "\s-1SHIFT\s0 this" 4 +.IX Xref "SHIFT" +.IX Item "SHIFT this" +Remove the first element of the array (shifting other elements down) +and return it. For example: +.Sp +.Vb 4 +\& sub SHIFT { +\& my $self = shift; +\& return shift @{$self\->{ARRAY}}; +\& } +.Ve +.IP "\s-1UNSHIFT\s0 this, \s-1LIST\s0" 4 +.IX Xref "UNSHIFT" +.IX Item "UNSHIFT this, LIST" +Insert \s-1LIST\s0 elements at the beginning of the array, moving existing elements +up to make room. For example: +.Sp +.Vb 9 +\& sub UNSHIFT { +\& my $self = shift; +\& my @list = @_; +\& my $size = scalar( @list ); +\& # make room for our list +\& @{$self\->{ARRAY}}[ $size .. $#{$self\->{ARRAY}} + $size ] +\& = @{$self\->{ARRAY}}; +\& $self\->STORE( $_, $list[$_] ) foreach 0 .. $#list; +\& } +.Ve +.IP "\s-1SPLICE\s0 this, offset, length, \s-1LIST\s0" 4 +.IX Xref "SPLICE" +.IX Item "SPLICE this, offset, length, LIST" +Perform the equivalent of \f(CW\*(C`splice\*(C'\fR on the array. +.Sp +\&\fIoffset\fR is optional and defaults to zero, negative values count back +from the end of the array. +.Sp +\&\fIlength\fR is optional and defaults to rest of the array. +.Sp +\&\fI\s-1LIST\s0\fR may be empty. +.Sp +Returns a list of the original \fIlength\fR elements at \fIoffset\fR. +.Sp +In our example, we'll use a little shortcut if there is a \fI\s-1LIST\s0\fR: +.Sp +.Vb 11 +\& sub SPLICE { +\& my $self = shift; +\& my $offset = shift || 0; +\& my $length = shift || $self\->FETCHSIZE() \- $offset; +\& my @list = (); +\& if ( @_ ) { +\& tie @list, _\|_PACKAGE_\|_, $self\->{ELEMSIZE}; +\& @list = @_; +\& } +\& return splice @{$self\->{ARRAY}}, $offset, $length, @list; +\& } +.Ve +.IP "\s-1UNTIE\s0 this" 4 +.IX Xref "UNTIE" +.IX Item "UNTIE this" +Will be called when \f(CW\*(C`untie\*(C'\fR happens. (See "The \f(CW\*(C`untie\*(C'\fR Gotcha" below.) +.IP "\s-1DESTROY\s0 this" 4 +.IX Xref "DESTROY" +.IX Item "DESTROY this" +This method will be triggered when the tied variable needs to be destructed. +As with the scalar tie class, this is almost never needed in a +language that does its own garbage collection, so this time we'll +just leave it out. +.SS "Tying Hashes" +.IX Xref "hash, tying" +.IX Subsection "Tying Hashes" +Hashes were the first Perl data type to be tied (see \fBdbmopen()\fR). A class +implementing a tied hash should define the following methods: \s-1TIEHASH\s0 is +the constructor. \s-1FETCH\s0 and \s-1STORE\s0 access the key and value pairs. \s-1EXISTS\s0 +reports whether a key is present in the hash, and \s-1DELETE\s0 deletes one. +\&\s-1CLEAR\s0 empties the hash by deleting all the key and value pairs. \s-1FIRSTKEY\s0 +and \s-1NEXTKEY\s0 implement the \fBkeys()\fR and \fBeach()\fR functions to iterate over all +the keys. \s-1SCALAR\s0 is triggered when the tied hash is evaluated in scalar +context, and in 5.28 onwards, by \f(CW\*(C`keys\*(C'\fR in boolean context. \s-1UNTIE\s0 is +called when \f(CW\*(C`untie\*(C'\fR happens, and \s-1DESTROY\s0 is called when the tied variable +is garbage collected. +.PP +If this seems like a lot, then feel free to inherit from merely the +standard Tie::StdHash module for most of your methods, redefining only the +interesting ones. See Tie::Hash for details. +.PP +Remember that Perl distinguishes between a key not existing in the hash, +and the key existing in the hash but having a corresponding value of +\&\f(CW\*(C`undef\*(C'\fR. The two possibilities can be tested with the \f(CW\*(C`exists()\*(C'\fR and +\&\f(CW\*(C`defined()\*(C'\fR functions. +.PP +Here's an example of a somewhat interesting tied hash class: it gives you +a hash representing a particular user's dot files. You index into the hash +with the name of the file (minus the dot) and you get back that dot file's +contents. For example: +.PP +.Vb 8 +\& use DotFiles; +\& tie %dot, \*(AqDotFiles\*(Aq; +\& if ( $dot{profile} =~ /MANPATH/ || +\& $dot{login} =~ /MANPATH/ || +\& $dot{cshrc} =~ /MANPATH/ ) +\& { +\& print "you seem to set your MANPATH\en"; +\& } +.Ve +.PP +Or here's another sample of using our tied class: +.PP +.Vb 5 +\& tie %him, \*(AqDotFiles\*(Aq, \*(Aqdaemon\*(Aq; +\& foreach $f ( keys %him ) { +\& printf "daemon dot file %s is size %d\en", +\& $f, length $him{$f}; +\& } +.Ve +.PP +In our tied hash DotFiles example, we use a regular +hash for the object containing several important +fields, of which only the \f(CW\*(C`{LIST}\*(C'\fR field will be what the +user thinks of as the real hash. +.IP "\s-1USER\s0" 5 +.IX Item "USER" +whose dot files this object represents +.IP "\s-1HOME\s0" 5 +.IX Item "HOME" +where those dot files live +.IP "\s-1CLOBBER\s0" 5 +.IX Item "CLOBBER" +whether we should try to change or remove those dot files +.IP "\s-1LIST\s0" 5 +.IX Item "LIST" +the hash of dot file names and content mappings +.PP +Here's the start of \fIDotfiles.pm\fR: +.PP +.Vb 5 +\& package DotFiles; +\& use Carp; +\& sub whowasi { (caller(1))[3] . \*(Aq()\*(Aq } +\& my $DEBUG = 0; +\& sub debug { $DEBUG = @_ ? shift : 1 } +.Ve +.PP +For our example, we want to be able to emit debugging info to help in tracing +during development. We keep also one convenience function around +internally to help print out warnings; \fBwhowasi()\fR returns the function name +that calls it. +.PP +Here are the methods for the DotFiles tied hash. +.IP "\s-1TIEHASH\s0 classname, \s-1LIST\s0" 4 +.IX Xref "TIEHASH" +.IX Item "TIEHASH classname, LIST" +This is the constructor for the class. That means it is expected to +return a blessed reference through which the new object (probably but not +necessarily an anonymous hash) will be accessed. +.Sp +Here's the constructor: +.Sp +.Vb 9 +\& sub TIEHASH { +\& my $self = shift; +\& my $user = shift || $>; +\& my $dotdir = shift || \*(Aq\*(Aq; +\& croak "usage: @{[&whowasi]} [USER [DOTDIR]]" if @_; +\& $user = getpwuid($user) if $user =~ /^\ed+$/; +\& my $dir = (getpwnam($user))[7] +\& || croak "@{[&whowasi]}: no user $user"; +\& $dir .= "/$dotdir" if $dotdir; +\& +\& my $node = { +\& USER => $user, +\& HOME => $dir, +\& LIST => {}, +\& CLOBBER => 0, +\& }; +\& +\& opendir(DIR, $dir) +\& || croak "@{[&whowasi]}: can\*(Aqt opendir $dir: $!"; +\& foreach $dot ( grep /^\e./ && \-f "$dir/$_", readdir(DIR)) { +\& $dot =~ s/^\e.//; +\& $node\->{LIST}{$dot} = undef; +\& } +\& closedir DIR; +\& return bless $node, $self; +\& } +.Ve +.Sp +It's probably worth mentioning that if you're going to filetest the +return values out of a readdir, you'd better prepend the directory +in question. Otherwise, because we didn't \fBchdir()\fR there, it would +have been testing the wrong file. +.IP "\s-1FETCH\s0 this, key" 4 +.IX Xref "FETCH" +.IX Item "FETCH this, key" +This method will be triggered every time an element in the tied hash is +accessed (read). It takes one argument beyond its self reference: the key +whose value we're trying to fetch. +.Sp +Here's the fetch for our DotFiles example. +.Sp +.Vb 6 +\& sub FETCH { +\& carp &whowasi if $DEBUG; +\& my $self = shift; +\& my $dot = shift; +\& my $dir = $self\->{HOME}; +\& my $file = "$dir/.$dot"; +\& +\& unless (exists $self\->{LIST}\->{$dot} || \-f $file) { +\& carp "@{[&whowasi]}: no $dot file" if $DEBUG; +\& return undef; +\& } +\& +\& if (defined $self\->{LIST}\->{$dot}) { +\& return $self\->{LIST}\->{$dot}; +\& } else { +\& return $self\->{LIST}\->{$dot} = \`cat $dir/.$dot\`; +\& } +\& } +.Ve +.Sp +It was easy to write by having it call the Unix \fBcat\fR\|(1) command, but it +would probably be more portable to open the file manually (and somewhat +more efficient). Of course, because dot files are a Unixy concept, we're +not that concerned. +.IP "\s-1STORE\s0 this, key, value" 4 +.IX Xref "STORE" +.IX Item "STORE this, key, value" +This method will be triggered every time an element in the tied hash is set +(written). It takes two arguments beyond its self reference: the index at +which we're trying to store something, and the value we're trying to put +there. +.Sp +Here in our DotFiles example, we'll be careful not to let +them try to overwrite the file unless they've called the \fBclobber()\fR +method on the original object reference returned by \fBtie()\fR. +.Sp +.Vb 7 +\& sub STORE { +\& carp &whowasi if $DEBUG; +\& my $self = shift; +\& my $dot = shift; +\& my $value = shift; +\& my $file = $self\->{HOME} . "/.$dot"; +\& my $user = $self\->{USER}; +\& +\& croak "@{[&whowasi]}: $file not clobberable" +\& unless $self\->{CLOBBER}; +\& +\& open(my $f, \*(Aq>\*(Aq, $file) || croak "can\*(Aqt open $file: $!"; +\& print $f $value; +\& close($f); +\& } +.Ve +.Sp +If they wanted to clobber something, they might say: +.Sp +.Vb 3 +\& $ob = tie %daemon_dots, \*(Aqdaemon\*(Aq; +\& $ob\->clobber(1); +\& $daemon_dots{signature} = "A true daemon\en"; +.Ve +.Sp +Another way to lay hands on a reference to the underlying object is to +use the \fBtied()\fR function, so they might alternately have set clobber +using: +.Sp +.Vb 2 +\& tie %daemon_dots, \*(Aqdaemon\*(Aq; +\& tied(%daemon_dots)\->clobber(1); +.Ve +.Sp +The clobber method is simply: +.Sp +.Vb 4 +\& sub clobber { +\& my $self = shift; +\& $self\->{CLOBBER} = @_ ? shift : 1; +\& } +.Ve +.IP "\s-1DELETE\s0 this, key" 4 +.IX Xref "DELETE" +.IX Item "DELETE this, key" +This method is triggered when we remove an element from the hash, +typically by using the \fBdelete()\fR function. Again, we'll +be careful to check whether they really want to clobber files. +.Sp +.Vb 2 +\& sub DELETE { +\& carp &whowasi if $DEBUG; +\& +\& my $self = shift; +\& my $dot = shift; +\& my $file = $self\->{HOME} . "/.$dot"; +\& croak "@{[&whowasi]}: won\*(Aqt remove file $file" +\& unless $self\->{CLOBBER}; +\& delete $self\->{LIST}\->{$dot}; +\& my $success = unlink($file); +\& carp "@{[&whowasi]}: can\*(Aqt unlink $file: $!" unless $success; +\& $success; +\& } +.Ve +.Sp +The value returned by \s-1DELETE\s0 becomes the return value of the call +to \fBdelete()\fR. If you want to emulate the normal behavior of \fBdelete()\fR, +you should return whatever \s-1FETCH\s0 would have returned for this key. +In this example, we have chosen instead to return a value which tells +the caller whether the file was successfully deleted. +.IP "\s-1CLEAR\s0 this" 4 +.IX Xref "CLEAR" +.IX Item "CLEAR this" +This method is triggered when the whole hash is to be cleared, usually by +assigning the empty list to it. +.Sp +In our example, that would remove all the user's dot files! It's such a +dangerous thing that they'll have to set \s-1CLOBBER\s0 to something higher than +1 to make it happen. +.Sp +.Vb 10 +\& sub CLEAR { +\& carp &whowasi if $DEBUG; +\& my $self = shift; +\& croak "@{[&whowasi]}: won\*(Aqt remove all dot files for $self\->{USER}" +\& unless $self\->{CLOBBER} > 1; +\& my $dot; +\& foreach $dot ( keys %{$self\->{LIST}}) { +\& $self\->DELETE($dot); +\& } +\& } +.Ve +.IP "\s-1EXISTS\s0 this, key" 4 +.IX Xref "EXISTS" +.IX Item "EXISTS this, key" +This method is triggered when the user uses the \fBexists()\fR function +on a particular hash. In our example, we'll look at the \f(CW\*(C`{LIST}\*(C'\fR +hash element for this: +.Sp +.Vb 6 +\& sub EXISTS { +\& carp &whowasi if $DEBUG; +\& my $self = shift; +\& my $dot = shift; +\& return exists $self\->{LIST}\->{$dot}; +\& } +.Ve +.IP "\s-1FIRSTKEY\s0 this" 4 +.IX Xref "FIRSTKEY" +.IX Item "FIRSTKEY this" +This method will be triggered when the user is going +to iterate through the hash, such as via a \fBkeys()\fR, \fBvalues()\fR, or \fBeach()\fR call. +.Sp +.Vb 6 +\& sub FIRSTKEY { +\& carp &whowasi if $DEBUG; +\& my $self = shift; +\& my $a = keys %{$self\->{LIST}}; # reset each() iterator +\& each %{$self\->{LIST}} +\& } +.Ve +.Sp +\&\s-1FIRSTKEY\s0 is always called in scalar context and it should just +return the first key. \fBvalues()\fR, and \fBeach()\fR in list context, +will call \s-1FETCH\s0 for the returned keys. +.IP "\s-1NEXTKEY\s0 this, lastkey" 4 +.IX Xref "NEXTKEY" +.IX Item "NEXTKEY this, lastkey" +This method gets triggered during a \fBkeys()\fR, \fBvalues()\fR, or \fBeach()\fR iteration. It has a +second argument which is the last key that had been accessed. This is +useful if you're caring about ordering or calling the iterator from more +than one sequence, or not really storing things in a hash anywhere. +.Sp +\&\s-1NEXTKEY\s0 is always called in scalar context and it should just +return the next key. \fBvalues()\fR, and \fBeach()\fR in list context, +will call \s-1FETCH\s0 for the returned keys. +.Sp +For our example, we're using a real hash so we'll do just the simple +thing, but we'll have to go through the \s-1LIST\s0 field indirectly. +.Sp +.Vb 5 +\& sub NEXTKEY { +\& carp &whowasi if $DEBUG; +\& my $self = shift; +\& return each %{ $self\->{LIST} } +\& } +.Ve +.IP "\s-1SCALAR\s0 this" 4 +.IX Xref "SCALAR" +.IX Item "SCALAR this" +This is called when the hash is evaluated in scalar context, and in 5.28 +onwards, by \f(CW\*(C`keys\*(C'\fR in boolean context. In order to mimic the behaviour of +untied hashes, this method must return a value which when used as boolean, +indicates whether the tied hash is considered empty. If this method does +not exist, perl will make some educated guesses and return true when +the hash is inside an iteration. If this isn't the case, \s-1FIRSTKEY\s0 is +called, and the result will be a false value if \s-1FIRSTKEY\s0 returns the empty +list, true otherwise. +.Sp +However, you should \fBnot\fR blindly rely on perl always doing the right +thing. Particularly, perl will mistakenly return true when you clear the +hash by repeatedly calling \s-1DELETE\s0 until it is empty. You are therefore +advised to supply your own \s-1SCALAR\s0 method when you want to be absolutely +sure that your hash behaves nicely in scalar context. +.Sp +In our example we can just call \f(CW\*(C`scalar\*(C'\fR on the underlying hash +referenced by \f(CW\*(C`$self\->{LIST}\*(C'\fR: +.Sp +.Vb 5 +\& sub SCALAR { +\& carp &whowasi if $DEBUG; +\& my $self = shift; +\& return scalar %{ $self\->{LIST} } +\& } +.Ve +.Sp +\&\s-1NOTE:\s0 In perl 5.25 the behavior of scalar \f(CW%hash\fR on an untied hash changed +to return the count of keys. Prior to this it returned a string containing +information about the bucket setup of the hash. See +\&\*(L"bucket_ratio\*(R" in Hash::Util for a backwards compatibility path. +.IP "\s-1UNTIE\s0 this" 4 +.IX Xref "UNTIE" +.IX Item "UNTIE this" +This is called when \f(CW\*(C`untie\*(C'\fR occurs. See "The \f(CW\*(C`untie\*(C'\fR Gotcha" below. +.IP "\s-1DESTROY\s0 this" 4 +.IX Xref "DESTROY" +.IX Item "DESTROY this" +This method is triggered when a tied hash is about to go out of +scope. You don't really need it unless you're trying to add debugging +or have auxiliary state to clean up. Here's a very simple function: +.Sp +.Vb 3 +\& sub DESTROY { +\& carp &whowasi if $DEBUG; +\& } +.Ve +.PP +Note that functions such as \fBkeys()\fR and \fBvalues()\fR may return huge lists +when used on large objects, like \s-1DBM\s0 files. You may prefer to use the +\&\fBeach()\fR function to iterate over such. Example: +.PP +.Vb 7 +\& # print out history file offsets +\& use NDBM_File; +\& tie(%HIST, \*(AqNDBM_File\*(Aq, \*(Aq/usr/lib/news/history\*(Aq, 1, 0); +\& while (($key,$val) = each %HIST) { +\& print $key, \*(Aq = \*(Aq, unpack(\*(AqL\*(Aq,$val), "\en"; +\& } +\& untie(%HIST); +.Ve +.SS "Tying FileHandles" +.IX Xref "filehandle, tying" +.IX Subsection "Tying FileHandles" +This is partially implemented now. +.PP +A class implementing a tied filehandle should define the following +methods: \s-1TIEHANDLE,\s0 at least one of \s-1PRINT, PRINTF, WRITE, READLINE, GETC, +READ,\s0 and possibly \s-1CLOSE, UNTIE\s0 and \s-1DESTROY.\s0 The class can also provide: \s-1BINMODE, +OPEN, EOF, FILENO, SEEK, TELL\s0 \- if the corresponding perl operators are +used on the handle. +.PP +When \s-1STDERR\s0 is tied, its \s-1PRINT\s0 method will be called to issue warnings +and error messages. This feature is temporarily disabled during the call, +which means you can use \f(CW\*(C`warn()\*(C'\fR inside \s-1PRINT\s0 without starting a recursive +loop. And just like \f(CW\*(C`_\|_WARN_\|_\*(C'\fR and \f(CW\*(C`_\|_DIE_\|_\*(C'\fR handlers, \s-1STDERR\s0's \s-1PRINT\s0 +method may be called to report parser errors, so the caveats mentioned under +\&\*(L"%SIG\*(R" in perlvar apply. +.PP +All of this is especially useful when perl is embedded in some other +program, where output to \s-1STDOUT\s0 and \s-1STDERR\s0 may have to be redirected +in some special way. See nvi and the Apache module for examples. +.PP +When tying a handle, the first argument to \f(CW\*(C`tie\*(C'\fR should begin with an +asterisk. So, if you are tying \s-1STDOUT,\s0 use \f(CW*STDOUT\fR. If you have +assigned it to a scalar variable, say \f(CW$handle\fR, use \f(CW*$handle\fR. +\&\f(CW\*(C`tie $handle\*(C'\fR ties the scalar variable \f(CW$handle\fR, not the handle inside +it. +.PP +In our example we're going to create a shouting handle. +.PP +.Vb 1 +\& package Shout; +.Ve +.IP "\s-1TIEHANDLE\s0 classname, \s-1LIST\s0" 4 +.IX Xref "TIEHANDLE" +.IX Item "TIEHANDLE classname, LIST" +This is the constructor for the class. That means it is expected to +return a blessed reference of some sort. The reference can be used to +hold some internal information. +.Sp +.Vb 1 +\& sub TIEHANDLE { print "\en"; my $i; bless \e$i, shift } +.Ve +.IP "\s-1WRITE\s0 this, \s-1LIST\s0" 4 +.IX Xref "WRITE" +.IX Item "WRITE this, LIST" +This method will be called when the handle is written to via the +\&\f(CW\*(C`syswrite\*(C'\fR function. +.Sp +.Vb 5 +\& sub WRITE { +\& $r = shift; +\& my($buf,$len,$offset) = @_; +\& print "WRITE called, \e$buf=$buf, \e$len=$len, \e$offset=$offset"; +\& } +.Ve +.IP "\s-1PRINT\s0 this, \s-1LIST\s0" 4 +.IX Xref "PRINT" +.IX Item "PRINT this, LIST" +This method will be triggered every time the tied handle is printed to +with the \f(CW\*(C`print()\*(C'\fR or \f(CW\*(C`say()\*(C'\fR functions. Beyond its self reference +it also expects the list that was passed to the print function. +.Sp +.Vb 1 +\& sub PRINT { $r = shift; $$r++; print join($,,map(uc($_),@_)),$\e } +.Ve +.Sp +\&\f(CW\*(C`say()\*(C'\fR acts just like \f(CW\*(C`print()\*(C'\fR except $\e will be localized to \f(CW\*(C`\en\*(C'\fR so +you need do nothing special to handle \f(CW\*(C`say()\*(C'\fR in \f(CW\*(C`PRINT()\*(C'\fR. +.IP "\s-1PRINTF\s0 this, \s-1LIST\s0" 4 +.IX Xref "PRINTF" +.IX Item "PRINTF this, LIST" +This method will be triggered every time the tied handle is printed to +with the \f(CW\*(C`printf()\*(C'\fR function. +Beyond its self reference it also expects the format and list that was +passed to the printf function. +.Sp +.Vb 5 +\& sub PRINTF { +\& shift; +\& my $fmt = shift; +\& print sprintf($fmt, @_); +\& } +.Ve +.IP "\s-1READ\s0 this, \s-1LIST\s0" 4 +.IX Xref "READ" +.IX Item "READ this, LIST" +This method will be called when the handle is read from via the \f(CW\*(C`read\*(C'\fR +or \f(CW\*(C`sysread\*(C'\fR functions. +.Sp +.Vb 8 +\& sub READ { +\& my $self = shift; +\& my $bufref = \e$_[0]; +\& my(undef,$len,$offset) = @_; +\& print "READ called, \e$buf=$bufref, \e$len=$len, \e$offset=$offset"; +\& # add to $$bufref, set $len to number of characters read +\& $len; +\& } +.Ve +.IP "\s-1READLINE\s0 this" 4 +.IX Xref "READLINE" +.IX Item "READLINE this" +This method is called when the handle is read via \f(CW\*(C`\*(C'\fR +or \f(CW\*(C`readline HANDLE\*(C'\fR. +.Sp +As per \f(CW\*(C`readline\*(C'\fR, in scalar context it should return +the next line, or \f(CW\*(C`undef\*(C'\fR for no more data. In list context it should +return all remaining lines, or an empty list for no more data. The strings +returned should include the input record separator \f(CW$/\fR (see perlvar), +unless it is \f(CW\*(C`undef\*(C'\fR (which means \*(L"slurp\*(R" mode). +.Sp +.Vb 10 +\& sub READLINE { +\& my $r = shift; +\& if (wantarray) { +\& return ("all remaining\en", +\& "lines up\en", +\& "to eof\en"); +\& } else { +\& return "READLINE called " . ++$$r . " times\en"; +\& } +\& } +.Ve +.IP "\s-1GETC\s0 this" 4 +.IX Xref "GETC" +.IX Item "GETC this" +This method will be called when the \f(CW\*(C`getc\*(C'\fR function is called. +.Sp +.Vb 1 +\& sub GETC { print "Don\*(Aqt GETC, Get Perl"; return "a"; } +.Ve +.IP "\s-1EOF\s0 this" 4 +.IX Xref "EOF" +.IX Item "EOF this" +This method will be called when the \f(CW\*(C`eof\*(C'\fR function is called. +.Sp +Starting with Perl 5.12, an additional integer parameter will be passed. It +will be zero if \f(CW\*(C`eof\*(C'\fR is called without parameter; \f(CW1\fR if \f(CW\*(C`eof\*(C'\fR is given +a filehandle as a parameter, e.g. \f(CW\*(C`eof(FH)\*(C'\fR; and \f(CW2\fR in the very special +case that the tied filehandle is \f(CW\*(C`ARGV\*(C'\fR and \f(CW\*(C`eof\*(C'\fR is called with an empty +parameter list, e.g. \f(CW\*(C`eof()\*(C'\fR. +.Sp +.Vb 1 +\& sub EOF { not length $stringbuf } +.Ve +.IP "\s-1CLOSE\s0 this" 4 +.IX Xref "CLOSE" +.IX Item "CLOSE this" +This method will be called when the handle is closed via the \f(CW\*(C`close\*(C'\fR +function. +.Sp +.Vb 1 +\& sub CLOSE { print "CLOSE called.\en" } +.Ve +.IP "\s-1UNTIE\s0 this" 4 +.IX Xref "UNTIE" +.IX Item "UNTIE this" +As with the other types of ties, this method will be called when \f(CW\*(C`untie\*(C'\fR happens. +It may be appropriate to \*(L"auto \s-1CLOSE\*(R"\s0 when this occurs. See +"The \f(CW\*(C`untie\*(C'\fR Gotcha" below. +.IP "\s-1DESTROY\s0 this" 4 +.IX Xref "DESTROY" +.IX Item "DESTROY this" +As with the other types of ties, this method will be called when the +tied handle is about to be destroyed. This is useful for debugging and +possibly cleaning up. +.Sp +.Vb 1 +\& sub DESTROY { print "\en" } +.Ve +.PP +Here's how to use our little example: +.PP +.Vb 5 +\& tie(*FOO,\*(AqShout\*(Aq); +\& print FOO "hello\en"; +\& $a = 4; $b = 6; +\& print FOO $a, " plus ", $b, " equals ", $a + $b, "\en"; +\& print ; +.Ve +.SS "\s-1UNTIE\s0 this" +.IX Xref "UNTIE" +.IX Subsection "UNTIE this" +You can define for all tie types an \s-1UNTIE\s0 method that will be called +at \fBuntie()\fR. See "The \f(CW\*(C`untie\*(C'\fR Gotcha" below. +.ie n .SS "The ""untie"" Gotcha" +.el .SS "The \f(CWuntie\fP Gotcha" +.IX Xref "untie" +.IX Subsection "The untie Gotcha" +If you intend making use of the object returned from either \fBtie()\fR or +\&\fBtied()\fR, and if the tie's target class defines a destructor, there is a +subtle gotcha you \fImust\fR guard against. +.PP +As setup, consider this (admittedly rather contrived) example of a +tie; all it does is use a file to keep a log of the values assigned to +a scalar. +.PP +.Vb 1 +\& package Remember; +\& +\& use strict; +\& use warnings; +\& use IO::File; +\& +\& sub TIESCALAR { +\& my $class = shift; +\& my $filename = shift; +\& my $handle = IO::File\->new( "> $filename" ) +\& or die "Cannot open $filename: $!\en"; +\& +\& print $handle "The Start\en"; +\& bless {FH => $handle, Value => 0}, $class; +\& } +\& +\& sub FETCH { +\& my $self = shift; +\& return $self\->{Value}; +\& } +\& +\& sub STORE { +\& my $self = shift; +\& my $value = shift; +\& my $handle = $self\->{FH}; +\& print $handle "$value\en"; +\& $self\->{Value} = $value; +\& } +\& +\& sub DESTROY { +\& my $self = shift; +\& my $handle = $self\->{FH}; +\& print $handle "The End\en"; +\& close $handle; +\& } +\& +\& 1; +.Ve +.PP +Here is an example that makes use of this tie: +.PP +.Vb 2 +\& use strict; +\& use Remember; +\& +\& my $fred; +\& tie $fred, \*(AqRemember\*(Aq, \*(Aqmyfile.txt\*(Aq; +\& $fred = 1; +\& $fred = 4; +\& $fred = 5; +\& untie $fred; +\& system "cat myfile.txt"; +.Ve +.PP +This is the output when it is executed: +.PP +.Vb 5 +\& The Start +\& 1 +\& 4 +\& 5 +\& The End +.Ve +.PP +So far so good. Those of you who have been paying attention will have +spotted that the tied object hasn't been used so far. So lets add an +extra method to the Remember class to allow comments to be included in +the file; say, something like this: +.PP +.Vb 6 +\& sub comment { +\& my $self = shift; +\& my $text = shift; +\& my $handle = $self\->{FH}; +\& print $handle $text, "\en"; +\& } +.Ve +.PP +And here is the previous example modified to use the \f(CW\*(C`comment\*(C'\fR method +(which requires the tied object): +.PP +.Vb 2 +\& use strict; +\& use Remember; +\& +\& my ($fred, $x); +\& $x = tie $fred, \*(AqRemember\*(Aq, \*(Aqmyfile.txt\*(Aq; +\& $fred = 1; +\& $fred = 4; +\& comment $x "changing..."; +\& $fred = 5; +\& untie $fred; +\& system "cat myfile.txt"; +.Ve +.PP +When this code is executed there is no output. Here's why: +.PP +When a variable is tied, it is associated with the object which is the +return value of the \s-1TIESCALAR, TIEARRAY,\s0 or \s-1TIEHASH\s0 function. This +object normally has only one reference, namely, the implicit reference +from the tied variable. When \fBuntie()\fR is called, that reference is +destroyed. Then, as in the first example above, the object's +destructor (\s-1DESTROY\s0) is called, which is normal for objects that have +no more valid references; and thus the file is closed. +.PP +In the second example, however, we have stored another reference to +the tied object in \f(CW$x\fR. That means that when \fBuntie()\fR gets called +there will still be a valid reference to the object in existence, so +the destructor is not called at that time, and thus the file is not +closed. The reason there is no output is because the file buffers +have not been flushed to disk. +.PP +Now that you know what the problem is, what can you do to avoid it? +Prior to the introduction of the optional \s-1UNTIE\s0 method the only way +was the good old \f(CW\*(C`\-w\*(C'\fR flag. Which will spot any instances where you call +\&\fBuntie()\fR and there are still valid references to the tied object. If +the second script above this near the top \f(CW\*(C`use warnings \*(Aquntie\*(Aq\*(C'\fR +or was run with the \f(CW\*(C`\-w\*(C'\fR flag, Perl prints this +warning message: +.PP +.Vb 1 +\& untie attempted while 1 inner references still exist +.Ve +.PP +To get the script to work properly and silence the warning make sure +there are no valid references to the tied object \fIbefore\fR \fBuntie()\fR is +called: +.PP +.Vb 2 +\& undef $x; +\& untie $fred; +.Ve +.PP +Now that \s-1UNTIE\s0 exists the class designer can decide which parts of the +class functionality are really associated with \f(CW\*(C`untie\*(C'\fR and which with +the object being destroyed. What makes sense for a given class depends +on whether the inner references are being kept so that non-tie-related +methods can be called on the object. But in most cases it probably makes +sense to move the functionality that would have been in \s-1DESTROY\s0 to the \s-1UNTIE\s0 +method. +.PP +If the \s-1UNTIE\s0 method exists then the warning above does not occur. Instead the +\&\s-1UNTIE\s0 method is passed the count of \*(L"extra\*(R" references and can issue its own +warning if appropriate. e.g. to replicate the no \s-1UNTIE\s0 case this method can +be used: +.PP +.Vb 6 +\& sub UNTIE +\& { +\& my ($obj,$count) = @_; +\& carp "untie attempted while $count inner references still exist" +\& if $count; +\& } +.Ve +.SH "SEE ALSO" +.IX Header "SEE ALSO" +See DB_File or Config for some interesting \fBtie()\fR implementations. +A good starting point for many \fBtie()\fR implementations is with one of the +modules Tie::Scalar, Tie::Array, Tie::Hash, or Tie::Handle. +.SH "BUGS" +.IX Header "BUGS" +The normal return provided by \f(CW\*(C`scalar(%hash)\*(C'\fR is not +available. What this means is that using \f(CW%tied_hash\fR in boolean +context doesn't work right (currently this always tests false, +regardless of whether the hash is empty or hash elements). +[ This paragraph needs review in light of changes in 5.25 ] +.PP +Localizing tied arrays or hashes does not work. After exiting the +scope the arrays or the hashes are not restored. +.PP +Counting the number of entries in a hash via \f(CW\*(C`scalar(keys(%hash))\*(C'\fR +or \f(CW\*(C`scalar(values(%hash)\*(C'\fR) is inefficient since it needs to iterate +through all the entries with \s-1FIRSTKEY/NEXTKEY.\s0 +.PP +Tied hash/array slices cause multiple \s-1FETCH/STORE\s0 pairs, there are no +tie methods for slice operations. +.PP +You cannot easily tie a multilevel data structure (such as a hash of +hashes) to a dbm file. The first problem is that all but \s-1GDBM\s0 and +Berkeley \s-1DB\s0 have size limitations, but beyond that, you also have problems +with how references are to be represented on disk. One +module that does attempt to address this need is DBM::Deep. Check your +nearest \s-1CPAN\s0 site as described in perlmodlib for source code. Note +that despite its name, DBM::Deep does not use dbm. Another earlier attempt +at solving the problem is \s-1MLDBM,\s0 which is also available on the \s-1CPAN,\s0 but +which has some fairly serious limitations. +.PP +Tied filehandles are still incomplete. \fBsysopen()\fR, \fBtruncate()\fR, +\&\fBflock()\fR, \fBfcntl()\fR, \fBstat()\fR and \-X can't currently be trapped. +.SH "AUTHOR" +.IX Header "AUTHOR" +Tom Christiansen +.PP +\&\s-1TIEHANDLE\s0 by Sven Verdoolaege <\fIskimo@dns.ufsia.ac.be\fR> and Doug MacEachern <\fIdougm@osf.org\fR> +.PP +\&\s-1UNTIE\s0 by Nick Ing-Simmons <\fInick@ing\-simmons.net\fR> +.PP +\&\s-1SCALAR\s0 by Tassilo von Parseval <\fItassilo.von.parseval@rwth\-aachen.de\fR> +.PP +Tying Arrays by Casey West <\fIcasey@geeknest.com\fR> diff --git a/data/miniconda3/man/man1/perltw.1 b/data/miniconda3/man/man1/perltw.1 new file mode 100644 index 0000000000000000000000000000000000000000..528db5958ef2241b73608f15616eeea7878cc9dd --- /dev/null +++ b/data/miniconda3/man/man1/perltw.1 @@ -0,0 +1,270 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLTW 1" +.TH PERLTW 1 "2020-12-18" "perl v5.32.1" "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 +\&\s-1XXXXXXXXXXXXXXXXXX, XXXXXXXXXXXX. +XXXXXX POD\s0 (\s-1XXXXXX\s0) \s-1XX\s0; \s-1XXXXXXXXXXXXXX, +XXXXXX. XXXXXXXXXXX, XXX\s0 perlpod \s-1XXXX.\s0 +.SH "NAME" +perltw \- XXXX Perl XX +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\s-1XXXX\s0 Perl \s-1XXX\s0! +.PP +X 5.8.0 \s-1XXX,\s0 Perl \s-1XXXXXX\s0 Unicode (\s-1XXX\s0) \s-1XX, +XXXXXXXXXXXXXXXXXXX\s0; \s-1CJK\s0 (\s-1XXX\s0) \s-1XXXXXXXX.\s0 +Unicode \s-1XXXXXXX, XXXXXXXXXXXX: XXXX, XXXX, +XXXXXXXX\s0 (\s-1XXX, XXXX, XXXX, XXXX, XXX, +XXXX, XX\s0). \s-1XXXXXXXXXXXXXX\s0 (X \s-1PC XXXX\s0). +.PP +Perl \s-1XXX\s0 Unicode \s-1XXXX. XXX\s0 Perl \s-1XXXXXXXXX\s0 Unicode +\&\s-1XX\s0; Perl \s-1XXXXXX\s0 (\s-1XXXXXXXXX\s0) \s-1XXX\s0 Unicode \s-1XXXX. +XXXXXXX, XXXXX\s0 Unicode \s-1XXXXXXXXXXXX,\s0 Perl +\&\s-1XXX\s0 Encode \s-1XXXX, XXXXXXXXXXXXXXXXXXX.\s0 +.PP +Encode \s-1XXXXXXXXXXXXXXXXX\s0 ('big5' \s-1XX\s0 'big5\-eten'): +.PP +.Vb 3 +\& big5\-eten Big5 XX (XXXXXXX) +\& big5\-hkscs Big5 + XXXXX, 2001 XX +\& cp950 XXX 950 (Big5 + XXXXXXX) +.Ve +.PP +\&\s-1XXXX, X\s0 Big5 \s-1XXXXXXX\s0 Unicode, \s-1XXXXXXXX:\s0 +.PP +.Vb 2 +\& perl \-MEncode \-pe \*(Aq$_= encode( utf8 => decode( big5 => $_ ) )\*(Aq \e +\& < file.big5 > file.utf8 +.Ve +.PP +Perl \s-1XXXX\s0 \*(L"piconv\*(R", \s-1XXXXX\s0 Perl \s-1XXXXXXXXXXX, XXXX:\s0 +.PP +.Vb 2 +\& piconv \-f big5 \-t utf8 < file.big5 > file.utf8 +\& piconv \-f utf8 \-t big5 < file.utf8 > file.big5 +.Ve +.PP +\&\s-1XXXXXXXXXX\s0 utf8 \s-1XXXXXXXXX\s0 utf8 \s-1XXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXX\s0 +.PP +.Vb 4 +\& #!/usr/bin/env perl +\& use utf8; +\& print length("XX"); # 2 (XX 6) +\& print index("XXXX", "XX"); # 2 (X 0 XXX 2 XXX) +.Ve +.SS "\s-1XXXXXXX\s0" +.IX Subsection "XXXXXXX" +\&\s-1XXXXXXXXXXX, XXX CPAN\s0 () \s-1XX\s0 +Encode::HanExtra \s-1XX. XXXXXXXXXXX:\s0 +.PP +.Vb 4 +\& cccii 1980 XXXXXXXXXXXX +\& euc\-tw Unix XXXXX, XX CNS11643 XX 1\-7 +\& big5plus XXXXXXXXXXXXX Big5+ +\& big5ext XXXXXXXXXXXXX Big5e +.Ve +.PP +\&\s-1XX,\s0 Encode::HanConvert \s-1XXXXXXXXXXXXXXXX:\s0 +.PP +.Vb 2 +\& big5\-simp Big5 XXXXX Unicode XXXXXX +\& gbk\-trad GBK XXXXX Unicode XXXXXX +.Ve +.PP +\&\s-1XXX GBK X\s0 Big5 \s-1XXXX, XXXXXXXXX\s0 b2g.pl X g2b.pl \s-1XXXX, +XXXXXXXXXXX:\s0 +.PP +.Vb 3 +\& use Encode::HanConvert; +\& $euc_cn = big5_to_gb($big5); # X Big5 XX GBK +\& $big5 = gb_to_big5($euc_cn); # X GBK XX Big5 +.Ve +.SS "\s-1XXXXXX\s0" +.IX Subsection "XXXXXX" +\&\s-1XXX\s0 Perl \s-1XXXXXXXXX\s0 (\s-1XXXXXXXXX\s0), \s-1XXXXXXX\s0 +Perl \s-1XXX, XX\s0 Unicode \s-1XXXXX. XX, XXXXXXXXX:\s0 +.SS "\s-1XX\s0 Perl \s-1XXXXX\s0" +.IX Subsection "XX Perl XXXXX" +.IP "" 4 +.IX Item "" +Perl \s-1XXX\s0 +.IP "" 4 +.IX Item "" +X Perl \s-1XXXXXXXXXXX\s0 +.IP "" 4 +.IX Item "" +Perl \s-1XXXXX\s0 (Comprehensive Perl Archive Network) +.IP "" 4 +.IX Item "" +Perl \s-1XXXXXX\s0 +.SS "\s-1XX\s0 Perl \s-1XXX\s0" +.IX Subsection "XX Perl XXX" +.IP "" 4 +.IX Item "" +\&\s-1XXXXXXXXX\s0 Perl \s-1XX\s0 +.SS "Perl \s-1XXXXX\s0" +.IX Subsection "Perl XXXXX" +.IP "" 4 +.IX Item "" +\&\s-1XX\s0 Perl \s-1XXXXX\s0 +.IP "" 4 +.IX Item "" +Perl.tw \s-1XXXXX\s0 +.SS "Unicode \s-1XXXX\s0" +.IX Subsection "Unicode XXXX" +.IP "" 4 +.IX Item "" +Unicode \s-1XXXX\s0 (Unicode \s-1XXXXXX\s0) +.IP "" 4 +.IX Item "" +Unix/Linux \s-1XX UTF\-8 X\s0 Unicode \s-1XXX\s0 +.SS "\s-1XXXXX\s0" +.IX Subsection "XXXXX" +.IP "\s-1XXXXXXX\s0" 4 +.IX Item "XXXXXXX" + +.SH "SEE ALSO" +.IX Header "SEE ALSO" +Encode, Encode::TW, perluniintro, perlunicode +.SH "AUTHORS" +.IX Header "AUTHORS" +Jarkko Hietaniemi +.PP +Audrey Tang (\s-1XX\s0) diff --git a/data/miniconda3/man/man1/perluniintro.1 b/data/miniconda3/man/man1/perluniintro.1 new file mode 100644 index 0000000000000000000000000000000000000000..b84a124d3ecc1157f23dc1ca0c18ce2234f8fb5c --- /dev/null +++ b/data/miniconda3/man/man1/perluniintro.1 @@ -0,0 +1,1151 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLUNIINTRO 1" +.TH PERLUNIINTRO 1 "2020-12-18" "perl v5.32.1" "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" +perluniintro \- Perl Unicode introduction +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document gives a general idea of Unicode and how to use Unicode +in Perl. See \*(L"Further Resources\*(R" for references to more in-depth +treatments of Unicode. +.SS "Unicode" +.IX Subsection "Unicode" +Unicode is a character set standard which plans to codify all of the +writing systems of the world, plus many other symbols. +.PP +Unicode and \s-1ISO/IEC 10646\s0 are coordinated standards that unify +almost all other modern character set standards, +covering more than 80 writing systems and hundreds of languages, +including all commercially-important modern languages. All characters +in the largest Chinese, Japanese, and Korean dictionaries are also +encoded. The standards will eventually cover almost all characters in +more than 250 writing systems and thousands of languages. +Unicode 1.0 was released in October 1991, and 6.0 in October 2010. +.PP +A Unicode \fIcharacter\fR is an abstract entity. It is not bound to any +particular integer width, especially not to the C language \f(CW\*(C`char\*(C'\fR. +Unicode is language-neutral and display-neutral: it does not encode the +language of the text, and it does not generally define fonts or other graphical +layout details. Unicode operates on characters and on text built from +those characters. +.PP +Unicode defines characters like \f(CW\*(C`LATIN CAPITAL LETTER A\*(C'\fR or \f(CW\*(C`GREEK +SMALL LETTER ALPHA\*(C'\fR and unique numbers for the characters, in this +case 0x0041 and 0x03B1, respectively. These unique numbers are called +\&\fIcode points\fR. A code point is essentially the position of the +character within the set of all possible Unicode characters, and thus in +Perl, the term \fIordinal\fR is often used interchangeably with it. +.PP +The Unicode standard prefers using hexadecimal notation for the code +points. If numbers like \f(CW0x0041\fR are unfamiliar to you, take a peek +at a later section, \*(L"Hexadecimal Notation\*(R". The Unicode standard +uses the notation \f(CW\*(C`U+0041 LATIN CAPITAL LETTER A\*(C'\fR, to give the +hexadecimal code point and the normative name of the character. +.PP +Unicode also defines various \fIproperties\fR for the characters, like +\&\*(L"uppercase\*(R" or \*(L"lowercase\*(R", \*(L"decimal digit\*(R", or \*(L"punctuation\*(R"; +these properties are independent of the names of the characters. +Furthermore, various operations on the characters like uppercasing, +lowercasing, and collating (sorting) are defined. +.PP +A Unicode \fIlogical\fR \*(L"character\*(R" can actually consist of more than one internal +\&\fIactual\fR \*(L"character\*(R" or code point. For Western languages, this is adequately +modelled by a \fIbase character\fR (like \f(CW\*(C`LATIN CAPITAL LETTER A\*(C'\fR) followed +by one or more \fImodifiers\fR (like \f(CW\*(C`COMBINING ACUTE ACCENT\*(C'\fR). This sequence of +base character and modifiers is called a \fIcombining character +sequence\fR. Some non-western languages require more complicated +models, so Unicode created the \fIgrapheme cluster\fR concept, which was +later further refined into the \fIextended grapheme cluster\fR. For +example, a Korean Hangul syllable is considered a single logical +character, but most often consists of three actual +Unicode characters: a leading consonant followed by an interior vowel followed +by a trailing consonant. +.PP +Whether to call these extended grapheme clusters \*(L"characters\*(R" depends on your +point of view. If you are a programmer, you probably would tend towards seeing +each element in the sequences as one unit, or \*(L"character\*(R". However from +the user's point of view, the whole sequence could be seen as one +\&\*(L"character\*(R" since that's probably what it looks like in the context of the +user's language. In this document, we take the programmer's point of +view: one \*(L"character\*(R" is one Unicode code point. +.PP +For some combinations of base character and modifiers, there are +\&\fIprecomposed\fR characters. There is a single character equivalent, for +example, for the sequence \f(CW\*(C`LATIN CAPITAL LETTER A\*(C'\fR followed by +\&\f(CW\*(C`COMBINING ACUTE ACCENT\*(C'\fR. It is called \f(CW\*(C`LATIN CAPITAL LETTER A WITH +ACUTE\*(C'\fR. These precomposed characters are, however, only available for +some combinations, and are mainly meant to support round-trip +conversions between Unicode and legacy standards (like \s-1ISO 8859\s0). Using +sequences, as Unicode does, allows for needing fewer basic building blocks +(code points) to express many more potential grapheme clusters. To +support conversion between equivalent forms, various \fInormalization +forms\fR are also defined. Thus, \f(CW\*(C`LATIN CAPITAL LETTER A WITH ACUTE\*(C'\fR is +in \fINormalization Form Composed\fR, (abbreviated \s-1NFC\s0), and the sequence +\&\f(CW\*(C`LATIN CAPITAL LETTER A\*(C'\fR followed by \f(CW\*(C`COMBINING ACUTE ACCENT\*(C'\fR +represents the same character in \fINormalization Form Decomposed\fR (\s-1NFD\s0). +.PP +Because of backward compatibility with legacy encodings, the \*(L"a unique +number for every character\*(R" idea breaks down a bit: instead, there is +\&\*(L"at least one number for every character\*(R". The same character could +be represented differently in several legacy encodings. The +converse is not true: some code points do not have an assigned +character. Firstly, there are unallocated code points within +otherwise used blocks. Secondly, there are special Unicode control +characters that do not represent true characters. +.PP +When Unicode was first conceived, it was thought that all the world's +characters could be represented using a 16\-bit word; that is a maximum of +\&\f(CW0x10000\fR (or 65,536) characters would be needed, from \f(CW0x0000\fR to +\&\f(CW0xFFFF\fR. This soon proved to be wrong, and since Unicode 2.0 (July +1996), Unicode has been defined all the way up to 21 bits (\f(CW0x10FFFF\fR), +and Unicode 3.1 (March 2001) defined the first characters above \f(CW0xFFFF\fR. +The first \f(CW0x10000\fR characters are called the \fIPlane 0\fR, or the +\&\fIBasic Multilingual Plane\fR (\s-1BMP\s0). With Unicode 3.1, 17 (yes, +seventeen) planes in all were defined\*(--but they are nowhere near full of +defined characters, yet. +.PP +When a new language is being encoded, Unicode generally will choose a +\&\f(CW\*(C`block\*(C'\fR of consecutive unallocated code points for its characters. So +far, the number of code points in these blocks has always been evenly +divisible by 16. Extras in a block, not currently needed, are left +unallocated, for future growth. But there have been occasions when +a later release needed more code points than the available extras, and a +new block had to allocated somewhere else, not contiguous to the initial +one, to handle the overflow. Thus, it became apparent early on that +\&\*(L"block\*(R" wasn't an adequate organizing principle, and so the \f(CW\*(C`Script\*(C'\fR +property was created. (Later an improved script property was added as +well, the \f(CW\*(C`Script_Extensions\*(C'\fR property.) Those code points that are in +overflow blocks can still +have the same script as the original ones. The script concept fits more +closely with natural language: there is \f(CW\*(C`Latin\*(C'\fR script, \f(CW\*(C`Greek\*(C'\fR +script, and so on; and there are several artificial scripts, like +\&\f(CW\*(C`Common\*(C'\fR for characters that are used in multiple scripts, such as +mathematical symbols. Scripts usually span varied parts of several +blocks. For more information about scripts, see \*(L"Scripts\*(R" in perlunicode. +The division into blocks exists, but it is almost completely +accidental\*(--an artifact of how the characters have been and still are +allocated. (Note that this paragraph has oversimplified things for the +sake of this being an introduction. Unicode doesn't really encode +languages, but the writing systems for them\*(--their scripts; and one +script can be used by many languages. Unicode also encodes things that +aren't really about languages, such as symbols like \f(CW\*(C`BAGGAGE CLAIM\*(C'\fR.) +.PP +The Unicode code points are just abstract numbers. To input and +output these abstract numbers, the numbers must be \fIencoded\fR or +\&\fIserialised\fR somehow. Unicode defines several \fIcharacter encoding +forms\fR, of which \fI\s-1UTF\-8\s0\fR is the most popular. \s-1UTF\-8\s0 is a +variable length encoding that encodes Unicode characters as 1 to 4 +bytes. Other encodings +include \s-1UTF\-16\s0 and \s-1UTF\-32\s0 and their big\- and little-endian variants +(\s-1UTF\-8\s0 is byte-order independent). The \s-1ISO/IEC 10646\s0 defines the \s-1UCS\-2\s0 +and \s-1UCS\-4\s0 encoding forms. +.PP +For more information about encodings\*(--for instance, to learn what +\&\fIsurrogates\fR and \fIbyte order marks\fR (BOMs) are\*(--see perlunicode. +.SS "Perl's Unicode Support" +.IX Subsection "Perl's Unicode Support" +Starting from Perl v5.6.0, Perl has had the capacity to handle Unicode +natively. Perl v5.8.0, however, is the first recommended release for +serious Unicode work. The maintenance release 5.6.1 fixed many of the +problems of the initial Unicode implementation, but for example +regular expressions still do not work with Unicode in 5.6.1. +Perl v5.14.0 is the first release where Unicode support is +(almost) seamlessly integrable without some gotchas. (There are a few +exceptions. Firstly, some differences in quotemeta +were fixed starting in Perl 5.16.0. Secondly, some differences in +the range operator were fixed starting in +Perl 5.26.0. Thirdly, some differences in split were fixed +started in Perl 5.28.0.) +.PP +To enable this +seamless support, you should \f(CW\*(C`use feature \*(Aqunicode_strings\*(Aq\*(C'\fR (which is +automatically selected if you \f(CW\*(C`use 5.012\*(C'\fR or higher). See feature. +(5.14 also fixes a number of bugs and departures from the Unicode +standard.) +.PP +Before Perl v5.8.0, the use of \f(CW\*(C`use utf8\*(C'\fR was used to declare +that operations in the current block or file would be Unicode-aware. +This model was found to be wrong, or at least clumsy: the \*(L"Unicodeness\*(R" +is now carried with the data, instead of being attached to the +operations. +Starting with Perl v5.8.0, only one case remains where an explicit \f(CW\*(C`use +utf8\*(C'\fR is needed: if your Perl script itself is encoded in \s-1UTF\-8,\s0 you can +use \s-1UTF\-8\s0 in your identifier names, and in string and regular expression +literals, by saying \f(CW\*(C`use utf8\*(C'\fR. This is not the default because +scripts with legacy 8\-bit data in them would break. See utf8. +.SS "Perl's Unicode Model" +.IX Subsection "Perl's Unicode Model" +Perl supports both pre\-5.6 strings of eight-bit native bytes, and +strings of Unicode characters. The general principle is that Perl tries +to keep its data as eight-bit bytes for as long as possible, but as soon +as Unicodeness cannot be avoided, the data is transparently upgraded +to Unicode. Prior to Perl v5.14.0, the upgrade was not completely +transparent (see \*(L"The \*(R"Unicode Bug"" in perlunicode), and for backwards +compatibility, full transparency is not gained unless \f(CW\*(C`use feature +\&\*(Aqunicode_strings\*(Aq\*(C'\fR (see feature) or \f(CW\*(C`use 5.012\*(C'\fR (or higher) is +selected. +.PP +Internally, Perl currently uses either whatever the native eight-bit +character set of the platform (for example Latin\-1) is, defaulting to +\&\s-1UTF\-8,\s0 to encode Unicode strings. Specifically, if all code points in +the string are \f(CW0xFF\fR or less, Perl uses the native eight-bit +character set. Otherwise, it uses \s-1UTF\-8.\s0 +.PP +A user of Perl does not normally need to know nor care how Perl +happens to encode its internal strings, but it becomes relevant when +outputting Unicode strings to a stream without a PerlIO layer (one with +the \*(L"default\*(R" encoding). In such a case, the raw bytes used internally +(the native character set or \s-1UTF\-8,\s0 as appropriate for each string) +will be used, and a \*(L"Wide character\*(R" warning will be issued if those +strings contain a character beyond 0x00FF. +.PP +For example, +.PP +.Vb 1 +\& perl \-e \*(Aqprint "\ex{DF}\en", "\ex{0100}\ex{DF}\en"\*(Aq +.Ve +.PP +produces a fairly useless mixture of native bytes and \s-1UTF\-8,\s0 as well +as a warning: +.PP +.Vb 1 +\& Wide character in print at ... +.Ve +.PP +To output \s-1UTF\-8,\s0 use the \f(CW\*(C`:encoding\*(C'\fR or \f(CW\*(C`:utf8\*(C'\fR output layer. Prepending +.PP +.Vb 1 +\& binmode(STDOUT, ":utf8"); +.Ve +.PP +to this sample program ensures that the output is completely \s-1UTF\-8,\s0 +and removes the program's warning. +.PP +You can enable automatic UTF\-8\-ification of your standard file +handles, default \f(CW\*(C`open()\*(C'\fR layer, and \f(CW@ARGV\fR by using either +the \f(CW\*(C`\-C\*(C'\fR command line switch or the \f(CW\*(C`PERL_UNICODE\*(C'\fR environment +variable, see perlrun for the +documentation of the \f(CW\*(C`\-C\*(C'\fR switch. +.PP +Note that this means that Perl expects other software to work the same +way: +if Perl has been led to believe that \s-1STDIN\s0 should be \s-1UTF\-8,\s0 but then +\&\s-1STDIN\s0 coming in from another command is not \s-1UTF\-8,\s0 Perl will likely +complain about the malformed \s-1UTF\-8.\s0 +.PP +All features that combine Unicode and I/O also require using the new +PerlIO feature. Almost all Perl 5.8 platforms do use PerlIO, though: +you can see whether yours is by running \*(L"perl \-V\*(R" and looking for +\&\f(CW\*(C`useperlio=define\*(C'\fR. +.SS "Unicode and \s-1EBCDIC\s0" +.IX Subsection "Unicode and EBCDIC" +Perl 5.8.0 added support for Unicode on \s-1EBCDIC\s0 platforms. This support +was allowed to lapse in later releases, but was revived in 5.22. +Unicode support is somewhat more complex to implement since additional +conversions are needed. See perlebcdic for more information. +.PP +On \s-1EBCDIC\s0 platforms, the internal Unicode encoding form is UTF-EBCDIC +instead of \s-1UTF\-8.\s0 The difference is that as \s-1UTF\-8\s0 is \*(L"ASCII-safe\*(R" in +that \s-1ASCII\s0 characters encode to \s-1UTF\-8\s0 as-is, while UTF-EBCDIC is +\&\*(L"EBCDIC-safe\*(R", in that all the basic characters (which includes all +those that have \s-1ASCII\s0 equivalents (like \f(CW"A"\fR, \f(CW"0"\fR, \f(CW"%"\fR, \fIetc.\fR) +are the same in both \s-1EBCDIC\s0 and UTF-EBCDIC. Often, documentation +will use the term \*(L"\s-1UTF\-8\*(R"\s0 to mean UTF-EBCDIC as well. This is the case +in this document. +.SS "Creating Unicode" +.IX Subsection "Creating Unicode" +This section applies fully to Perls starting with v5.22. Various +caveats for earlier releases are in the \*(L"Earlier releases caveats\*(R" +subsection below. +.PP +To create Unicode characters in literals, +use the \f(CW\*(C`\eN{...}\*(C'\fR notation in double-quoted strings: +.PP +.Vb 2 +\& my $smiley_from_name = "\eN{WHITE SMILING FACE}"; +\& my $smiley_from_code_point = "\eN{U+263a}"; +.Ve +.PP +Similarly, they can be used in regular expression literals +.PP +.Vb 2 +\& $smiley =~ /\eN{WHITE SMILING FACE}/; +\& $smiley =~ /\eN{U+263a}/; +.Ve +.PP +or, starting in v5.32: +.PP +.Vb 2 +\& $smiley =~ /\ep{Name=WHITE SMILING FACE}/; +\& $smiley =~ /\ep{Name=whitesmilingface}/; +.Ve +.PP +At run-time you can use: +.PP +.Vb 4 +\& use charnames (); +\& my $hebrew_alef_from_name +\& = charnames::string_vianame("HEBREW LETTER ALEF"); +\& my $hebrew_alef_from_code_point = charnames::string_vianame("U+05D0"); +.Ve +.PP +Naturally, \f(CW\*(C`ord()\*(C'\fR will do the reverse: it turns a character into +a code point. +.PP +There are other runtime options as well. You can use \f(CW\*(C`pack()\*(C'\fR: +.PP +.Vb 1 +\& my $hebrew_alef_from_code_point = pack("U", 0x05d0); +.Ve +.PP +Or you can use \f(CW\*(C`chr()\*(C'\fR, though it is less convenient in the general +case: +.PP +.Vb 2 +\& $hebrew_alef_from_code_point = chr(utf8::unicode_to_native(0x05d0)); +\& utf8::upgrade($hebrew_alef_from_code_point); +.Ve +.PP +The \f(CW\*(C`utf8::unicode_to_native()\*(C'\fR and \f(CW\*(C`utf8::upgrade()\*(C'\fR aren't needed if +the argument is above 0xFF, so the above could have been written as +.PP +.Vb 1 +\& $hebrew_alef_from_code_point = chr(0x05d0); +.Ve +.PP +since 0x5d0 is above 255. +.PP +\&\f(CW\*(C`\ex{}\*(C'\fR and \f(CW\*(C`\eo{}\*(C'\fR can also be used to specify code points at compile +time in double-quotish strings, but, for backward compatibility with +older Perls, the same rules apply as with \f(CW\*(C`chr()\*(C'\fR for code points less +than 256. +.PP +\&\f(CW\*(C`utf8::unicode_to_native()\*(C'\fR is used so that the Perl code is portable +to \s-1EBCDIC\s0 platforms. You can omit it if you're \fIreally\fR sure no one +will ever want to use your code on a non-ASCII platform. Starting in +Perl v5.22, calls to it on \s-1ASCII\s0 platforms are optimized out, so there's +no performance penalty at all in adding it. Or you can simply use the +other constructs that don't require it. +.PP +See \*(L"Further Resources\*(R" for how to find all these names and numeric +codes. +.PP +\fIEarlier releases caveats\fR +.IX Subsection "Earlier releases caveats" +.PP +On \s-1EBCDIC\s0 platforms, prior to v5.22, using \f(CW\*(C`\eN{U+...}\*(C'\fR doesn't work +properly. +.PP +Prior to v5.16, using \f(CW\*(C`\eN{...}\*(C'\fR with a character name (as opposed to a +\&\f(CW\*(C`U+...\*(C'\fR code point) required a \f(CW\*(C`use\ charnames\ :full\*(C'\fR. +.PP +Prior to v5.14, there were some bugs in \f(CW\*(C`\eN{...}\*(C'\fR with a character name +(as opposed to a \f(CW\*(C`U+...\*(C'\fR code point). +.PP +\&\f(CW\*(C`charnames::string_vianame()\*(C'\fR was introduced in v5.14. Prior to that, +\&\f(CW\*(C`charnames::vianame()\*(C'\fR should work, but only if the argument is of the +form \f(CW"U+..."\fR. Your best bet there for runtime Unicode by character +name is probably: +.PP +.Vb 3 +\& use charnames (); +\& my $hebrew_alef_from_name +\& = pack("U", charnames::vianame("HEBREW LETTER ALEF")); +.Ve +.SS "Handling Unicode" +.IX Subsection "Handling Unicode" +Handling Unicode is for the most part transparent: just use the +strings as usual. Functions like \f(CW\*(C`index()\*(C'\fR, \f(CW\*(C`length()\*(C'\fR, and +\&\f(CW\*(C`substr()\*(C'\fR will work on the Unicode characters; regular expressions +will work on the Unicode characters (see perlunicode and perlretut). +.PP +Note that Perl considers grapheme clusters to be separate characters, so for +example +.PP +.Vb 2 +\& print length("\eN{LATIN CAPITAL LETTER A}\eN{COMBINING ACUTE ACCENT}"), +\& "\en"; +.Ve +.PP +will print 2, not 1. The only exception is that regular expressions +have \f(CW\*(C`\eX\*(C'\fR for matching an extended grapheme cluster. (Thus \f(CW\*(C`\eX\*(C'\fR in a +regular expression would match the entire sequence of both the example +characters.) +.PP +Life is not quite so transparent, however, when working with legacy +encodings, I/O, and certain special cases: +.SS "Legacy Encodings" +.IX Subsection "Legacy Encodings" +When you combine legacy data and Unicode, the legacy data needs +to be upgraded to Unicode. Normally the legacy data is assumed to be +\&\s-1ISO 8859\-1\s0 (or \s-1EBCDIC,\s0 if applicable). +.PP +The \f(CW\*(C`Encode\*(C'\fR module knows about many encodings and has interfaces +for doing conversions between those encodings: +.PP +.Vb 2 +\& use Encode \*(Aqdecode\*(Aq; +\& $data = decode("iso\-8859\-3", $data); # convert from legacy +.Ve +.SS "Unicode I/O" +.IX Subsection "Unicode I/O" +Normally, writing out Unicode data +.PP +.Vb 1 +\& print FH $some_string_with_unicode, "\en"; +.Ve +.PP +produces raw bytes that Perl happens to use to internally encode the +Unicode string. Perl's internal encoding depends on the system as +well as what characters happen to be in the string at the time. If +any of the characters are at code points \f(CW0x100\fR or above, you will get +a warning. To ensure that the output is explicitly rendered in the +encoding you desire\*(--and to avoid the warning\*(--open the stream with +the desired encoding. Some examples: +.PP +.Vb 1 +\& open FH, ">:utf8", "file"; +\& +\& open FH, ">:encoding(ucs2)", "file"; +\& open FH, ">:encoding(UTF\-8)", "file"; +\& open FH, ">:encoding(shift_jis)", "file"; +.Ve +.PP +and on already open streams, use \f(CW\*(C`binmode()\*(C'\fR: +.PP +.Vb 1 +\& binmode(STDOUT, ":utf8"); +\& +\& binmode(STDOUT, ":encoding(ucs2)"); +\& binmode(STDOUT, ":encoding(UTF\-8)"); +\& binmode(STDOUT, ":encoding(shift_jis)"); +.Ve +.PP +The matching of encoding names is loose: case does not matter, and +many encodings have several aliases. Note that the \f(CW\*(C`:utf8\*(C'\fR layer +must always be specified exactly like that; it is \fInot\fR subject to +the loose matching of encoding names. Also note that currently \f(CW\*(C`:utf8\*(C'\fR is unsafe for +input, because it accepts the data without validating that it is indeed valid +\&\s-1UTF\-8\s0; you should instead use \f(CW\*(C`:encoding(UTF\-8)\*(C'\fR (with or without a +hyphen). +.PP +See PerlIO for the \f(CW\*(C`:utf8\*(C'\fR layer, PerlIO::encoding and +Encode::PerlIO for the \f(CW\*(C`:encoding()\*(C'\fR layer, and +Encode::Supported for many encodings supported by the \f(CW\*(C`Encode\*(C'\fR +module. +.PP +Reading in a file that you know happens to be encoded in one of the +Unicode or legacy encodings does not magically turn the data into +Unicode in Perl's eyes. To do that, specify the appropriate +layer when opening files +.PP +.Vb 2 +\& open(my $fh,\*(Aq<:encoding(UTF\-8)\*(Aq, \*(Aqanything\*(Aq); +\& my $line_of_unicode = <$fh>; +\& +\& open(my $fh,\*(Aq<:encoding(Big5)\*(Aq, \*(Aqanything\*(Aq); +\& my $line_of_unicode = <$fh>; +.Ve +.PP +The I/O layers can also be specified more flexibly with +the \f(CW\*(C`open\*(C'\fR pragma. See open, or look at the following example. +.PP +.Vb 8 +\& use open \*(Aq:encoding(UTF\-8)\*(Aq; # input/output default encoding will be +\& # UTF\-8 +\& open X, ">file"; +\& print X chr(0x100), "\en"; +\& close X; +\& open Y, "); # this should print 0x100 +\& close Y; +.Ve +.PP +With the \f(CW\*(C`open\*(C'\fR pragma you can use the \f(CW\*(C`:locale\*(C'\fR layer +.PP +.Vb 10 +\& BEGIN { $ENV{LC_ALL} = $ENV{LANG} = \*(Aqru_RU.KOI8\-R\*(Aq } +\& # the :locale will probe the locale environment variables like +\& # LC_ALL +\& use open OUT => \*(Aq:locale\*(Aq; # russki parusski +\& open(O, ">koi8"); +\& print O chr(0x430); # Unicode CYRILLIC SMALL LETTER A = KOI8\-R 0xc1 +\& close O; +\& open(I, "), "\en"; # this should print 0xc1 +\& close I; +.Ve +.PP +These methods install a transparent filter on the I/O stream that +converts data from the specified encoding when it is read in from the +stream. The result is always Unicode. +.PP +The open pragma affects all the \f(CW\*(C`open()\*(C'\fR calls after the pragma by +setting default layers. If you want to affect only certain +streams, use explicit layers directly in the \f(CW\*(C`open()\*(C'\fR call. +.PP +You can switch encodings on an already opened stream by using +\&\f(CW\*(C`binmode()\*(C'\fR; see \*(L"binmode\*(R" in perlfunc. +.PP +The \f(CW\*(C`:locale\*(C'\fR does not currently work with +\&\f(CW\*(C`open()\*(C'\fR and \f(CW\*(C`binmode()\*(C'\fR, only with the \f(CW\*(C`open\*(C'\fR pragma. The +\&\f(CW\*(C`:utf8\*(C'\fR and \f(CW\*(C`:encoding(...)\*(C'\fR methods do work with all of \f(CW\*(C`open()\*(C'\fR, +\&\f(CW\*(C`binmode()\*(C'\fR, and the \f(CW\*(C`open\*(C'\fR pragma. +.PP +Similarly, you may use these I/O layers on output streams to +automatically convert Unicode to the specified encoding when it is +written to the stream. For example, the following snippet copies the +contents of the file \*(L"text.jis\*(R" (encoded as \s-1ISO\-2022\-JP,\s0 aka \s-1JIS\s0) to +the file \*(L"text.utf8\*(R", encoded as \s-1UTF\-8:\s0 +.PP +.Vb 3 +\& open(my $nihongo, \*(Aq<:encoding(iso\-2022\-jp)\*(Aq, \*(Aqtext.jis\*(Aq); +\& open(my $unicode, \*(Aq>:utf8\*(Aq, \*(Aqtext.utf8\*(Aq); +\& while (<$nihongo>) { print $unicode $_ } +.Ve +.PP +The naming of encodings, both by the \f(CW\*(C`open()\*(C'\fR and by the \f(CW\*(C`open\*(C'\fR +pragma allows for flexible names: \f(CW\*(C`koi8\-r\*(C'\fR and \f(CW\*(C`KOI8R\*(C'\fR will both be +understood. +.PP +Common encodings recognized by \s-1ISO, MIME, IANA,\s0 and various other +standardisation organisations are recognised; for a more detailed +list see Encode::Supported. +.PP +\&\f(CW\*(C`read()\*(C'\fR reads characters and returns the number of characters. +\&\f(CW\*(C`seek()\*(C'\fR and \f(CW\*(C`tell()\*(C'\fR operate on byte counts, as does \f(CW\*(C`sysseek()\*(C'\fR. +.PP +\&\f(CW\*(C`sysread()\*(C'\fR and \f(CW\*(C`syswrite()\*(C'\fR should not be used on file handles with +character encoding layers, they behave badly, and that behaviour has +been deprecated since perl 5.24. +.PP +Notice that because of the default behaviour of not doing any +conversion upon input if there is no default layer, +it is easy to mistakenly write code that keeps on expanding a file +by repeatedly encoding the data: +.PP +.Vb 8 +\& # BAD CODE WARNING +\& open F, "file"; +\& local $/; ## read in the whole file of 8\-bit characters +\& $t = ; +\& close F; +\& open F, ">:encoding(UTF\-8)", "file"; +\& print F $t; ## convert to UTF\-8 on output +\& close F; +.Ve +.PP +If you run this code twice, the contents of the \fIfile\fR will be twice +\&\s-1UTF\-8\s0 encoded. A \f(CW\*(C`use open \*(Aq:encoding(UTF\-8)\*(Aq\*(C'\fR would have avoided the +bug, or explicitly opening also the \fIfile\fR for input as \s-1UTF\-8.\s0 +.PP +\&\fB\s-1NOTE\s0\fR: the \f(CW\*(C`:utf8\*(C'\fR and \f(CW\*(C`:encoding\*(C'\fR features work only if your +Perl has been built with PerlIO, which is the default +on most systems. +.SS "Displaying Unicode As Text" +.IX Subsection "Displaying Unicode As Text" +Sometimes you might want to display Perl scalars containing Unicode as +simple \s-1ASCII\s0 (or \s-1EBCDIC\s0) text. The following subroutine converts +its argument so that Unicode characters with code points greater than +255 are displayed as \f(CW\*(C`\ex{...}\*(C'\fR, control characters (like \f(CW\*(C`\en\*(C'\fR) are +displayed as \f(CW\*(C`\ex..\*(C'\fR, and the rest of the characters as themselves: +.PP +.Vb 9 +\& sub nice_string { +\& join("", +\& map { $_ > 255 # if wide character... +\& ? sprintf("\e\ex{%04X}", $_) # \ex{...} +\& : chr($_) =~ /[[:cntrl:]]/ # else if control character... +\& ? sprintf("\e\ex%02X", $_) # \ex.. +\& : quotemeta(chr($_)) # else quoted or as themselves +\& } unpack("W*", $_[0])); # unpack Unicode characters +\& } +.Ve +.PP +For example, +.PP +.Vb 1 +\& nice_string("foo\ex{100}bar\en") +.Ve +.PP +returns the string +.PP +.Vb 1 +\& \*(Aqfoo\ex{0100}bar\ex0A\*(Aq +.Ve +.PP +which is ready to be printed. +.PP +(\f(CW\*(C`\e\ex{}\*(C'\fR is used here instead of \f(CW\*(C`\e\eN{}\*(C'\fR, since it's most likely that +you want to see what the native values are.) +.SS "Special Cases" +.IX Subsection "Special Cases" +.IP "\(bu" 4 +Starting in Perl 5.28, it is illegal for bit operators, like \f(CW\*(C`~\*(C'\fR, to +operate on strings containing code points above 255. +.IP "\(bu" 4 +The \fBvec()\fR function may produce surprising results if +used on strings containing characters with ordinal values above +255. In such a case, the results are consistent with the internal +encoding of the characters, but not with much else. So don't do +that, and starting in Perl 5.28, a deprecation message is issued if you +do so, becoming illegal in Perl 5.32. +.IP "\(bu" 4 +Peeking At Perl's Internal Encoding +.Sp +Normal users of Perl should never care how Perl encodes any particular +Unicode string (because the normal ways to get at the contents of a +string with Unicode\*(--via input and output\*(--should always be via +explicitly-defined I/O layers). But if you must, there are two +ways of looking behind the scenes. +.Sp +One way of peeking inside the internal encoding of Unicode characters +is to use \f(CW\*(C`unpack("C*", ...\*(C'\fR to get the bytes of whatever the string +encoding happens to be, or \f(CW\*(C`unpack("U0..", ...)\*(C'\fR to get the bytes of the +\&\s-1UTF\-8\s0 encoding: +.Sp +.Vb 2 +\& # this prints c4 80 for the UTF\-8 bytes 0xc4 0x80 +\& print join(" ", unpack("U0(H2)*", pack("U", 0x100))), "\en"; +.Ve +.Sp +Yet another way would be to use the Devel::Peek module: +.Sp +.Vb 1 +\& perl \-MDevel::Peek \-e \*(AqDump(chr(0x100))\*(Aq +.Ve +.Sp +That shows the \f(CW\*(C`UTF8\*(C'\fR flag in \s-1FLAGS\s0 and both the \s-1UTF\-8\s0 bytes +and Unicode characters in \f(CW\*(C`PV\*(C'\fR. See also later in this document +the discussion about the \f(CW\*(C`utf8::is_utf8()\*(C'\fR function. +.SS "Advanced Topics" +.IX Subsection "Advanced Topics" +.IP "\(bu" 4 +String Equivalence +.Sp +The question of string equivalence turns somewhat complicated +in Unicode: what do you mean by \*(L"equal\*(R"? +.Sp +(Is \f(CW\*(C`LATIN CAPITAL LETTER A WITH ACUTE\*(C'\fR equal to +\&\f(CW\*(C`LATIN CAPITAL LETTER A\*(C'\fR?) +.Sp +The short answer is that by default Perl compares equivalence (\f(CW\*(C`eq\*(C'\fR, +\&\f(CW\*(C`ne\*(C'\fR) based only on code points of the characters. In the above +case, the answer is no (because 0x00C1 != 0x0041). But sometimes, any +\&\s-1CAPITAL LETTER A\s0's should be considered equal, or even A's of any case. +.Sp +The long answer is that you need to consider character normalization +and casing issues: see Unicode::Normalize, Unicode Technical Report #15, +Unicode Normalization Forms and +sections on case mapping in the Unicode Standard . +.Sp +As of Perl 5.8.0, the \*(L"Full\*(R" case-folding of \fICase +Mappings/SpecialCasing\fR is implemented, but bugs remain in \f(CW\*(C`qr//i\*(C'\fR with them, +mostly fixed by 5.14, and essentially entirely by 5.18. +.IP "\(bu" 4 +String Collation +.Sp +People like to see their strings nicely sorted\*(--or as Unicode +parlance goes, collated. But again, what do you mean by collate? +.Sp +(Does \f(CW\*(C`LATIN CAPITAL LETTER A WITH ACUTE\*(C'\fR come before or after +\&\f(CW\*(C`LATIN CAPITAL LETTER A WITH GRAVE\*(C'\fR?) +.Sp +The short answer is that by default, Perl compares strings (\f(CW\*(C`lt\*(C'\fR, +\&\f(CW\*(C`le\*(C'\fR, \f(CW\*(C`cmp\*(C'\fR, \f(CW\*(C`ge\*(C'\fR, \f(CW\*(C`gt\*(C'\fR) based only on the code points of the +characters. In the above case, the answer is \*(L"after\*(R", since +\&\f(CW0x00C1\fR > \f(CW0x00C0\fR. +.Sp +The long answer is that \*(L"it depends\*(R", and a good answer cannot be +given without knowing (at the very least) the language context. +See Unicode::Collate, and \fIUnicode Collation Algorithm\fR + +.SS "Miscellaneous" +.IX Subsection "Miscellaneous" +.IP "\(bu" 4 +Character Ranges and Classes +.Sp +Character ranges in regular expression bracketed character classes ( e.g., +\&\f(CW\*(C`/[a\-z]/\*(C'\fR) and in the \f(CW\*(C`tr///\*(C'\fR (also known as \f(CW\*(C`y///\*(C'\fR) operator are not +magically Unicode-aware. What this means is that \f(CW\*(C`[A\-Za\-z]\*(C'\fR will not +magically start to mean \*(L"all alphabetic letters\*(R" (not that it does mean that +even for 8\-bit characters; for those, if you are using locales (perllocale), +use \f(CW\*(C`/[[:alpha:]]/\*(C'\fR; and if not, use the 8\-bit\-aware property \f(CW\*(C`\ep{alpha}\*(C'\fR). +.Sp +All the properties that begin with \f(CW\*(C`\ep\*(C'\fR (and its inverse \f(CW\*(C`\eP\*(C'\fR) are actually +character classes that are Unicode-aware. There are dozens of them, see +perluniprops. +.Sp +Starting in v5.22, you can use Unicode code points as the end points of +regular expression pattern character ranges, and the range will include +all Unicode code points that lie between those end points, inclusive. +.Sp +.Vb 1 +\& qr/ [ \eN{U+03} \- \eN{U+20} ] /xx +.Ve +.Sp +includes the code points +\&\f(CW\*(C`\eN{U+03}\*(C'\fR, \f(CW\*(C`\eN{U+04}\*(C'\fR, ..., \f(CW\*(C`\eN{U+20}\*(C'\fR. +.Sp +This also works for ranges in \f(CW\*(C`tr///\*(C'\fR starting in Perl v5.24. +.IP "\(bu" 4 +String-To-Number Conversions +.Sp +Unicode does define several other decimal\*(--and numeric\*(--characters +besides the familiar 0 to 9, such as the Arabic and Indic digits. +Perl does not support string-to-number conversion for digits other +than \s-1ASCII\s0 \f(CW0\fR to \f(CW9\fR (and \s-1ASCII\s0 \f(CW\*(C`a\*(C'\fR to \f(CW\*(C`f\*(C'\fR for hexadecimal). +To get safe conversions from any Unicode string, use +\&\*(L"\fBnum()\fR\*(R" in Unicode::UCD. +.SS "Questions With Answers" +.IX Subsection "Questions With Answers" +.IP "\(bu" 4 +Will My Old Scripts Break? +.Sp +Very probably not. Unless you are generating Unicode characters +somehow, old behaviour should be preserved. About the only behaviour +that has changed and which could start generating Unicode is the old +behaviour of \f(CW\*(C`chr()\*(C'\fR where supplying an argument more than 255 +produced a character modulo 255. \f(CW\*(C`chr(300)\*(C'\fR, for example, was equal +to \f(CW\*(C`chr(45)\*(C'\fR or \*(L"\-\*(R" (in \s-1ASCII\s0), now it is \s-1LATIN CAPITAL LETTER I WITH +BREVE.\s0 +.IP "\(bu" 4 +How Do I Make My Scripts Work With Unicode? +.Sp +Very little work should be needed since nothing changes until you +generate Unicode data. The most important thing is getting input as +Unicode; for that, see the earlier I/O discussion. +To get full seamless Unicode support, add +\&\f(CW\*(C`use feature \*(Aqunicode_strings\*(Aq\*(C'\fR (or \f(CW\*(C`use 5.012\*(C'\fR or higher) to your +script. +.IP "\(bu" 4 +How Do I Know Whether My String Is In Unicode? +.Sp +You shouldn't have to care. But you may if your Perl is before 5.14.0 +or you haven't specified \f(CW\*(C`use feature \*(Aqunicode_strings\*(Aq\*(C'\fR or \f(CW\*(C`use +5.012\*(C'\fR (or higher) because otherwise the rules for the code points +in the range 128 to 255 are different depending on +whether the string they are contained within is in Unicode or not. +(See \*(L"When Unicode Does Not Happen\*(R" in perlunicode.) +.Sp +To determine if a string is in Unicode, use: +.Sp +.Vb 1 +\& print utf8::is_utf8($string) ? 1 : 0, "\en"; +.Ve +.Sp +But note that this doesn't mean that any of the characters in the +string are necessary \s-1UTF\-8\s0 encoded, or that any of the characters have +code points greater than 0xFF (255) or even 0x80 (128), or that the +string has any characters at all. All the \f(CW\*(C`is_utf8()\*(C'\fR does is to +return the value of the internal \*(L"utf8ness\*(R" flag attached to the +\&\f(CW$string\fR. If the flag is off, the bytes in the scalar are interpreted +as a single byte encoding. If the flag is on, the bytes in the scalar +are interpreted as the (variable-length, potentially multi-byte) \s-1UTF\-8\s0 encoded +code points of the characters. Bytes added to a \s-1UTF\-8\s0 encoded string are +automatically upgraded to \s-1UTF\-8.\s0 If mixed non\-UTF\-8 and \s-1UTF\-8\s0 scalars +are merged (double-quoted interpolation, explicit concatenation, or +printf/sprintf parameter substitution), the result will be \s-1UTF\-8\s0 encoded +as if copies of the byte strings were upgraded to \s-1UTF\-8:\s0 for example, +.Sp +.Vb 3 +\& $a = "ab\ex80c"; +\& $b = "\ex{100}"; +\& print "$a = $b\en"; +.Ve +.Sp +the output string will be UTF\-8\-encoded \f(CW\*(C`ab\ex80c = \ex{100}\en\*(C'\fR, but +\&\f(CW$a\fR will stay byte-encoded. +.Sp +Sometimes you might really need to know the byte length of a string +instead of the character length. For that use the \f(CW\*(C`bytes\*(C'\fR pragma +and the \f(CW\*(C`length()\*(C'\fR function: +.Sp +.Vb 6 +\& my $unicode = chr(0x100); +\& print length($unicode), "\en"; # will print 1 +\& use bytes; +\& print length($unicode), "\en"; # will print 2 +\& # (the 0xC4 0x80 of the UTF\-8) +\& no bytes; +.Ve +.IP "\(bu" 4 +How Do I Find Out What Encoding a File Has? +.Sp +You might try Encode::Guess, but it has a number of limitations. +.IP "\(bu" 4 +How Do I Detect Data That's Not Valid In a Particular Encoding? +.Sp +Use the \f(CW\*(C`Encode\*(C'\fR package to try converting it. +For example, +.Sp +.Vb 1 +\& use Encode \*(Aqdecode\*(Aq; +\& +\& if (eval { decode(\*(AqUTF\-8\*(Aq, $string, Encode::FB_CROAK); 1 }) { +\& # $string is valid UTF\-8 +\& } else { +\& # $string is not valid UTF\-8 +\& } +.Ve +.Sp +Or use \f(CW\*(C`unpack\*(C'\fR to try decoding it: +.Sp +.Vb 2 +\& use warnings; +\& @chars = unpack("C0U*", $string_of_bytes_that_I_think_is_utf8); +.Ve +.Sp +If invalid, a \f(CW\*(C`Malformed UTF\-8 character\*(C'\fR warning is produced. The \*(L"C0\*(R" means +\&\*(L"process the string character per character\*(R". Without that, the +\&\f(CW\*(C`unpack("U*", ...)\*(C'\fR would work in \f(CW\*(C`U0\*(C'\fR mode (the default if the format +string starts with \f(CW\*(C`U\*(C'\fR) and it would return the bytes making up the \s-1UTF\-8\s0 +encoding of the target string, something that will always work. +.IP "\(bu" 4 +How Do I Convert Binary Data Into a Particular Encoding, Or Vice Versa? +.Sp +This probably isn't as useful as you might think. +Normally, you shouldn't need to. +.Sp +In one sense, what you are asking doesn't make much sense: encodings +are for characters, and binary data are not \*(L"characters\*(R", so converting +\&\*(L"data\*(R" into some encoding isn't meaningful unless you know in what +character set and encoding the binary data is in, in which case it's +not just binary data, now is it? +.Sp +If you have a raw sequence of bytes that you know should be +interpreted via a particular encoding, you can use \f(CW\*(C`Encode\*(C'\fR: +.Sp +.Vb 2 +\& use Encode \*(Aqfrom_to\*(Aq; +\& from_to($data, "iso\-8859\-1", "UTF\-8"); # from latin\-1 to UTF\-8 +.Ve +.Sp +The call to \f(CW\*(C`from_to()\*(C'\fR changes the bytes in \f(CW$data\fR, but nothing +material about the nature of the string has changed as far as Perl is +concerned. Both before and after the call, the string \f(CW$data\fR +contains just a bunch of 8\-bit bytes. As far as Perl is concerned, +the encoding of the string remains as \*(L"system-native 8\-bit bytes\*(R". +.Sp +You might relate this to a fictional 'Translate' module: +.Sp +.Vb 4 +\& use Translate; +\& my $phrase = "Yes"; +\& Translate::from_to($phrase, \*(Aqenglish\*(Aq, \*(Aqdeutsch\*(Aq); +\& ## phrase now contains "Ja" +.Ve +.Sp +The contents of the string changes, but not the nature of the string. +Perl doesn't know any more after the call than before that the +contents of the string indicates the affirmative. +.Sp +Back to converting data. If you have (or want) data in your system's +native 8\-bit encoding (e.g. Latin\-1, \s-1EBCDIC,\s0 etc.), you can use +pack/unpack to convert to/from Unicode. +.Sp +.Vb 2 +\& $native_string = pack("W*", unpack("U*", $Unicode_string)); +\& $Unicode_string = pack("U*", unpack("W*", $native_string)); +.Ve +.Sp +If you have a sequence of bytes you \fBknow\fR is valid \s-1UTF\-8,\s0 +but Perl doesn't know it yet, you can make Perl a believer, too: +.Sp +.Vb 2 +\& $Unicode = $bytes; +\& utf8::decode($Unicode); +.Ve +.Sp +or: +.Sp +.Vb 1 +\& $Unicode = pack("U0a*", $bytes); +.Ve +.Sp +You can find the bytes that make up a \s-1UTF\-8\s0 sequence with +.Sp +.Vb 1 +\& @bytes = unpack("C*", $Unicode_string) +.Ve +.Sp +and you can create well-formed Unicode with +.Sp +.Vb 1 +\& $Unicode_string = pack("U*", 0xff, ...) +.Ve +.IP "\(bu" 4 +How Do I Display Unicode? How Do I Input Unicode? +.Sp +See and + +.IP "\(bu" 4 +How Does Unicode Work With Traditional Locales? +.Sp +If your locale is a \s-1UTF\-8\s0 locale, starting in Perl v5.26, Perl works +well for all categories; before this, starting with Perl v5.20, it works +for all categories but \f(CW\*(C`LC_COLLATE\*(C'\fR, which deals with +sorting and the \f(CW\*(C`cmp\*(C'\fR operator. But note that the standard +\&\f(CW\*(C`Unicode::Collate\*(C'\fR and \f(CW\*(C`Unicode::Collate::Locale\*(C'\fR modules offer +much more powerful solutions to collation issues, and work on earlier +releases. +.Sp +For other locales, starting in Perl 5.16, you can specify +.Sp +.Vb 1 +\& use locale \*(Aq:not_characters\*(Aq; +.Ve +.Sp +to get Perl to work well with them. The catch is that you +have to translate from the locale character set to/from Unicode +yourself. See \*(L"Unicode I/O\*(R" above for how to +.Sp +.Vb 1 +\& use open \*(Aq:locale\*(Aq; +.Ve +.Sp +to accomplish this, but full details are in \*(L"Unicode and +\&\s-1UTF\-8\*(R"\s0 in perllocale, including gotchas that happen if you don't specify +\&\f(CW\*(C`:not_characters\*(C'\fR. +.SS "Hexadecimal Notation" +.IX Subsection "Hexadecimal Notation" +The Unicode standard prefers using hexadecimal notation because +that more clearly shows the division of Unicode into blocks of 256 characters. +Hexadecimal is also simply shorter than decimal. You can use decimal +notation, too, but learning to use hexadecimal just makes life easier +with the Unicode standard. The \f(CW\*(C`U+HHHH\*(C'\fR notation uses hexadecimal, +for example. +.PP +The \f(CW\*(C`0x\*(C'\fR prefix means a hexadecimal number, the digits are 0\-9 \fIand\fR +a\-f (or A\-F, case doesn't matter). Each hexadecimal digit represents +four bits, or half a byte. \f(CW\*(C`print 0x..., "\en"\*(C'\fR will show a +hexadecimal number in decimal, and \f(CW\*(C`printf "%x\en", $decimal\*(C'\fR will +show a decimal number in hexadecimal. If you have just the +\&\*(L"hex digits\*(R" of a hexadecimal number, you can use the \f(CW\*(C`hex()\*(C'\fR function. +.PP +.Vb 6 +\& print 0x0009, "\en"; # 9 +\& print 0x000a, "\en"; # 10 +\& print 0x000f, "\en"; # 15 +\& print 0x0010, "\en"; # 16 +\& print 0x0011, "\en"; # 17 +\& print 0x0100, "\en"; # 256 +\& +\& print 0x0041, "\en"; # 65 +\& +\& printf "%x\en", 65; # 41 +\& printf "%#x\en", 65; # 0x41 +\& +\& print hex("41"), "\en"; # 65 +.Ve +.SS "Further Resources" +.IX Subsection "Further Resources" +.IP "\(bu" 4 +Unicode Consortium +.Sp + +.IP "\(bu" 4 +Unicode \s-1FAQ\s0 +.Sp + +.IP "\(bu" 4 +Unicode Glossary +.Sp + +.IP "\(bu" 4 +Unicode Recommended Reading List +.Sp +The Unicode Consortium has a list of articles and books, some of which +give a much more in depth treatment of Unicode: + +.IP "\(bu" 4 +Unicode Useful Resources +.Sp + +.IP "\(bu" 4 +Unicode and Multilingual Support in \s-1HTML,\s0 Fonts, Web Browsers and Other Applications +.Sp + +.IP "\(bu" 4 +\&\s-1UTF\-8\s0 and Unicode \s-1FAQ\s0 for Unix/Linux +.Sp + +.IP "\(bu" 4 +Legacy Character Sets +.Sp + + +.IP "\(bu" 4 +You can explore various information from the Unicode data files using +the \f(CW\*(C`Unicode::UCD\*(C'\fR module. +.SH "UNICODE IN OLDER PERLS" +.IX Header "UNICODE IN OLDER PERLS" +If you cannot upgrade your Perl to 5.8.0 or later, you can still +do some Unicode processing by using the modules \f(CW\*(C`Unicode::String\*(C'\fR, +\&\f(CW\*(C`Unicode::Map8\*(C'\fR, and \f(CW\*(C`Unicode::Map\*(C'\fR, available from \s-1CPAN.\s0 +If you have the \s-1GNU\s0 recode installed, you can also use the +Perl front-end \f(CW\*(C`Convert::Recode\*(C'\fR for character conversions. +.PP +The following are fast conversions from \s-1ISO 8859\-1\s0 (Latin\-1) bytes +to \s-1UTF\-8\s0 bytes and back, the code works even with older Perl 5 versions. +.PP +.Vb 2 +\& # ISO 8859\-1 to UTF\-8 +\& s/([\ex80\-\exFF])/chr(0xC0|ord($1)>>6).chr(0x80|ord($1)&0x3F)/eg; +\& +\& # UTF\-8 to ISO 8859\-1 +\& s/([\exC2\exC3])([\ex80\-\exBF])/chr(ord($1)<<6&0xC0|ord($2)&0x3F)/eg; +.Ve +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perlunitut, perlunicode, Encode, open, utf8, bytes, +perlretut, perlrun, Unicode::Collate, Unicode::Normalize, +Unicode::UCD +.SH "ACKNOWLEDGMENTS" +.IX Header "ACKNOWLEDGMENTS" +Thanks to the kind readers of the perl5\-porters@perl.org, +perl\-unicode@perl.org, linux\-utf8@nl.linux.org, and unicore@unicode.org +mailing lists for their valuable feedback. +.SH "AUTHOR, COPYRIGHT, AND LICENSE" +.IX Header "AUTHOR, COPYRIGHT, AND LICENSE" +Copyright 2001\-2011 Jarkko Hietaniemi . +Now maintained by Perl 5 Porters. +.PP +This document may be distributed under the same terms as Perl itself. diff --git a/data/miniconda3/man/man1/perluniprops.1 b/data/miniconda3/man/man1/perluniprops.1 new file mode 100644 index 0000000000000000000000000000000000000000..93fdf924f95427d682daf38f8c7e90246c559676 --- /dev/null +++ b/data/miniconda3/man/man1/perluniprops.1 @@ -0,0 +1,7739 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLUNIPROPS 1" +.TH PERLUNIPROPS 1 "2023-12-23" "perl v5.32.1" "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" +perluniprops \- Index of Unicode Version 13.0.0 character properties in Perl +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This document provides information about the portion of the Unicode database +that deals with character properties, that is the portion that is defined on +single code points. (\*(L"Other information in the Unicode data base\*(R" +below briefly mentions other data that Unicode provides.) +.PP +Perl can provide access to all non-provisional Unicode character properties, +though not all are enabled by default. The omitted ones are the Unihan +properties (accessible via the \s-1CPAN\s0 module Unicode::Unihan) and certain +deprecated or Unicode-internal properties. (An installation may choose to +recompile Perl's tables to change this. See \*(L"Unicode character +properties that are \s-1NOT\s0 accepted by Perl\*(R".) +.PP +For most purposes, access to Unicode properties from the Perl core is through +regular expression matches, as described in the next section. +For some special purposes, and to access the properties that are not suitable +for regular expression matching, all the Unicode character properties that +Perl handles are accessible via the standard Unicode::UCD module, as +described in the section \*(L"Properties accessible through Unicode::UCD\*(R". +.PP +Perl also provides some additional extensions and short-cut synonyms +for Unicode properties. +.PP +This document merely lists all available properties and does not attempt to +explain what each property really means. There is a brief description of each +Perl extension; see \*(L"Other Properties\*(R" in perlunicode for more information on +these. There is some detail about Blocks, Scripts, General_Category, +and Bidi_Class in perlunicode, but to find out about the intricacies of the +official Unicode properties, refer to the Unicode standard. A good starting +place is . +.PP +Note that you can define your own properties; see +\&\*(L"User-Defined Character Properties\*(R" in perlunicode. +.ie n .SH "Properties accessible through ""\ep{}"" and ""\eP{}""" +.el .SH "Properties accessible through \f(CW\ep{}\fP and \f(CW\eP{}\fP" +.IX Header "Properties accessible through p{} and P{}" +The Perl regular expression \f(CW\*(C`\ep{}\*(C'\fR and \f(CW\*(C`\eP{}\*(C'\fR constructs give access to +most of the Unicode character properties. The table below shows all these +constructs, both single and compound forms. +.PP +\&\fBCompound forms\fR consist of two components, separated by an equals sign or a +colon. The first component is the property name, and the second component is +the particular value of the property to match against, for example, +\&\f(CW\*(C`\ep{Script_Extensions: Greek}\*(C'\fR and \f(CW\*(C`\ep{Script_Extensions=Greek}\*(C'\fR both mean +to match characters whose Script_Extensions property value is Greek. +(\f(CW\*(C`Script_Extensions\*(C'\fR is an improved version of the \f(CW\*(C`Script\*(C'\fR property.) +.PP +\&\fBSingle forms\fR, like \f(CW\*(C`\ep{Greek}\*(C'\fR, are mostly Perl-defined shortcuts for +their equivalent compound forms. The table shows these equivalences. (In our +example, \f(CW\*(C`\ep{Greek}\*(C'\fR is a just a shortcut for +\&\f(CW\*(C`\ep{Script_Extensions=Greek}\*(C'\fR). There are also a few Perl-defined single +forms that are not shortcuts for a compound form. One such is \f(CW\*(C`\ep{Word}\*(C'\fR. +These are also listed in the table. +.PP +In parsing these constructs, Perl always ignores Upper/lower case differences +everywhere within the {braces}. Thus \f(CW\*(C`\ep{Greek}\*(C'\fR means the same thing as +\&\f(CW\*(C`\ep{greek}\*(C'\fR. But note that changing the case of the \f(CW"p"\fR or \f(CW"P"\fR before +the left brace completely changes the meaning of the construct, from \*(L"match\*(R" +(for \f(CW\*(C`\ep{}\*(C'\fR) to \*(L"doesn't match\*(R" (for \f(CW\*(C`\eP{}\*(C'\fR). Casing in this document is +for improved legibility. +.PP +Also, white space, hyphens, and underscores are normally ignored +everywhere between the {braces}, and hence can be freely added or removed +even if the \f(CW\*(C`/x\*(C'\fR modifier hasn't been specified on the regular expression. +But in the table below a '\fBT\fR' at the beginning of an entry +means that tighter (stricter) rules are used for that entry: +.RS 4 +.ie n .IP "Single form (""\ep{name}"") tighter rules:" 4 +.el .IP "Single form (\f(CW\ep{name}\fR) tighter rules:" 4 +.IX Item "Single form (p{name}) tighter rules:" +White space, hyphens, and underscores \s-1ARE\s0 significant +except for: +.RS 4 +.IP "\(bu" 4 +white space adjacent to a non-word character +.IP "\(bu" 4 +underscores separating digits in numbers +.RE +.RS 4 +.Sp +That means, for example, that you can freely add or remove white space +adjacent to (but within) the braces without affecting the meaning. +.RE +.ie n .IP "Compound form (""\ep{name=value}"" or ""\ep{name:value}"") tighter rules:" 4 +.el .IP "Compound form (\f(CW\ep{name=value}\fR or \f(CW\ep{name:value}\fR) tighter rules:" 4 +.IX Item "Compound form (p{name=value} or p{name:value}) tighter rules:" +The tighter rules given above for the single form apply to everything to the +right of the colon or equals; the looser rules still apply to everything to +the left. +.Sp +That means, for example, that you can freely add or remove white space +adjacent to (but within) the braces and the colon or equal sign. +.RE +.RS 4 +.RE +.PP +Some properties are considered obsolete by Unicode, but still available. +There are several varieties of obsolescence: +.RS 4 +.IP "Stabilized" 4 +.IX Item "Stabilized" +A property may be stabilized. Such a determination does not indicate +that the property should or should not be used; instead it is a declaration +that the property will not be maintained nor extended for newly encoded +characters. Such properties are marked with an '\fBS\fR' in the +table. +.IP "Deprecated" 4 +.IX Item "Deprecated" +A property may be deprecated, perhaps because its original intent +has been replaced by another property, or because its specification was +somehow defective. This means that its use is strongly +discouraged, so much so that a warning will be issued if used, unless the +regular expression is in the scope of a \f(CW\*(C`no\ warnings\ \*(Aqdeprecated\*(Aq\*(C'\fR +statement. A '\fBD\fR' flags each such entry in the table, and +the entry there for the longest, most descriptive version of the property will +give the reason it is deprecated, and perhaps advice. Perl may issue such a +warning, even for properties that aren't officially deprecated by Unicode, +when there used to be characters or code points that were matched by them, but +no longer. This is to warn you that your program may not work like it did on +earlier Unicode releases. +.Sp +A deprecated property may be made unavailable in a future Perl version, so it +is best to move away from them. +.Sp +A deprecated property may also be stabilized, but this fact is not shown. +.IP "Obsolete" 4 +.IX Item "Obsolete" +Properties marked with an '\fBO\fR' in the table are considered (plain) +obsolete. Generally this designation is given to properties that Unicode once +used for internal purposes (but not any longer). +.IP "Discouraged" 4 +.IX Item "Discouraged" +This is not actually a Unicode-specified obsolescence, but applies to certain +Perl extensions that are present for backwards compatibility, but are +discouraged from being used. These are not obsolete, but their meanings are +not stable. Future Unicode versions could force any of these extensions to be +removed without warning, replaced by another property with the same name that +means something different. An '\fBX\fR' flags each such entry in the +table. Use the equivalent shown instead. +.Sp +In particular, matches in the Block property have single forms +defined by Perl that begin with \f(CW"In_"\fR, \f(CW\*(C`"Is_\*(C'\fR, or even with no prefix at +all, Like all \fB\s-1DISCOURAGED\s0\fR forms, these are not stable. For example, +\&\f(CW\*(C`\ep{Block=Deseret}\*(C'\fR can currently be written as \f(CW\*(C`\ep{In_Deseret}\*(C'\fR, +\&\f(CW\*(C`\ep{Is_Deseret}\*(C'\fR, or \f(CW\*(C`\ep{Deseret}\*(C'\fR. But, a new Unicode version may +come along that would force Perl to change the meaning of one or more of +these, and your program would no longer be correct. Currently there are no +such conflicts with the form that begins \f(CW"In_"\fR, but there are many with the +other two shortcuts, and Unicode continues to define new properties that begin +with \f(CW"In"\fR, so it's quite possible that a conflict will occur in the future. +The compound form is guaranteed to not become obsolete, and its meaning is +clearer anyway. See \*(L"Blocks\*(R" in perlunicode for more information about this. +.Sp +User-defined properties must begin with \*(L"In\*(R" or \*(L"Is\*(R". These override any +Unicode property of the same name. +.RE +.RS 4 +.RE +.PP +The table below has two columns. The left column contains the \f(CW\*(C`\ep{}\*(C'\fR +constructs to look up, possibly preceded by the flags mentioned above; and +the right column contains information about them, like a description, or +synonyms. The table shows both the single and compound forms for each +property that has them. If the left column is a short name for a property, +the right column will give its longer, more descriptive name; and if the left +column is the longest name, the right column will show any equivalent shortest +name, in both single and compound forms if applicable. +.PP +If braces are not needed to specify a property (e.g., \f(CW\*(C`\epL\*(C'\fR), the left +column contains both forms, with and without braces. +.PP +The right column will also caution you if a property means something different +than what might normally be expected. +.PP +All single forms are Perl extensions; a few compound forms are as well, and +are noted as such. +.PP +Numbers in (parentheses) indicate the total number of Unicode code points +matched by the property. For the entries that give the longest, most +descriptive version of the property, the count is followed by a list of some +of the code points matched by it. The list includes all the matched +characters in the 0\-255 range, enclosed in the familiar [brackets] the same as +a regular expression bracketed character class. Following that, the next few +higher matching ranges are also given. To avoid visual ambiguity, the \s-1SPACE\s0 +character is represented as \f(CW\*(C`\ex20\*(C'\fR. +.PP +For emphasis, those properties that match no code points at all are listed as +well in a separate section following the table. +.PP +Most properties match the same code points regardless of whether \f(CW"/i"\fR +case-insensitive matching is specified or not. But a few properties are +affected. These are shown with the notation \f(CW\*(C`(/i=\ \f(CIother_property\f(CW)\*(C'\fR +in the second column. Under case-insensitive matching they match the +same code pode points as the property \fIother_property\fR. +.PP +There is no description given for most non-Perl defined properties (See + for that). +.PP +For compactness, '\fB*\fR' is used as a wildcard instead of showing all possible +combinations. For example, entries like: +.PP +.Vb 1 +\& \ep{Gc: *} \ep{General_Category: *} +.Ve +.PP +mean that 'Gc' is a synonym for 'General_Category', and anything that is valid +for the latter is also valid for the former. Similarly, +.PP +.Vb 1 +\& \ep{Is_*} \ep{*} +.Ve +.PP +means that if and only if, for example, \f(CW\*(C`\ep{Foo}\*(C'\fR exists, then +\&\f(CW\*(C`\ep{Is_Foo}\*(C'\fR and \f(CW\*(C`\ep{IsFoo}\*(C'\fR are also valid and all mean the same thing. +And similarly, \f(CW\*(C`\ep{Foo=Bar}\*(C'\fR means the same as \f(CW\*(C`\ep{Is_Foo=Bar}\*(C'\fR and +\&\f(CW\*(C`\ep{IsFoo=Bar}\*(C'\fR. \*(L"*\*(R" here is restricted to something not beginning with an +underscore. +.PP +Also, in binary properties, 'Yes', 'T', and 'True' are all synonyms for 'Y'. +And 'No', 'F', and 'False' are all synonyms for 'N'. The table shows 'Y*' and +\&'N*' to indicate this, and doesn't have separate entries for the other +possibilities. Note that not all properties which have values 'Yes' and 'No' +are binary, and they have all their values spelled out without using this wild +card, and a \f(CW\*(C`NOT\*(C'\fR clause in their description that highlights their not being +binary. These also require the compound form to match them, whereas true +binary properties have both single and compound forms available. +.PP +Note that all non-essential underscores are removed in the display of the +short names below. +.PP +\&\fBLegend summary:\fR +.IP "\fB*\fR is a wild-card" 4 +.IX Item "* is a wild-card" +.PD 0 +.IP "\fB(\ed+)\fR in the info column gives the number of Unicode code points matched by this property." 4 +.IX Item "(d+) in the info column gives the number of Unicode code points matched by this property." +.IP "\fBD\fR means this is deprecated." 4 +.IX Item "D means this is deprecated." +.IP "\fBO\fR means this is obsolete." 4 +.IX Item "O means this is obsolete." +.IP "\fBS\fR means this is stabilized." 4 +.IX Item "S means this is stabilized." +.IP "\fBT\fR means tighter (stricter) name matching applies." 4 +.IX Item "T means tighter (stricter) name matching applies." +.IP "\fBX\fR means use of this form is discouraged, and may not be stable." 4 +.IX Item "X means use of this form is discouraged, and may not be stable." +.PD +.PP +.Vb 1 +\& NAME INFO +\& +\& \ep{Adlam} \ep{Script_Extensions=Adlam} (Short: +\& \ep{Adlm}; NOT \ep{Block=Adlam}) (89) +\& \ep{Adlm} \ep{Adlam} (= \ep{Script_Extensions=Adlam}) +\& (NOT \ep{Block=Adlam}) (89) +\& X \ep{Aegean_Numbers} \ep{Block=Aegean_Numbers} (64) +\& T \ep{Age: 1.1} \ep{Age=V1_1} (33_979) +\& \ep{Age: V1_1} Code point\*(Aqs usage introduced in version +\& 1.1 (33_979: U+0000..01F5, U+01FA..0217, +\& U+0250..02A8, U+02B0..02DE, +\& U+02E0..02E9, U+0300..0345 ...) +\& T \ep{Age: 2.0} \ep{Age=V2_0} (144_521) +\& \ep{Age: V2_0} Code point\*(Aqs usage was introduced in +\& version 2.0; See also Property +\& \*(AqPresent_In\*(Aq (144_521: U+0591..05A1, +\& U+05A3..05AF, U+05C4, U+0F00..0F47, +\& U+0F49..0F69, U+0F71..0F8B ...) +\& T \ep{Age: 2.1} \ep{Age=V2_1} (2) +\& \ep{Age: V2_1} Code point\*(Aqs usage was introduced in +\& version 2.1; See also Property +\& \*(AqPresent_In\*(Aq (2: U+20AC, U+FFFC) +\& T \ep{Age: 3.0} \ep{Age=V3_0} (10_307) +\& \ep{Age: V3_0} Code point\*(Aqs usage was introduced in +\& version 3.0; See also Property +\& \*(AqPresent_In\*(Aq (10_307: U+01F6..01F9, +\& U+0218..021F, U+0222..0233, +\& U+02A9..02AD, U+02DF, U+02EA..02EE ...) +\& T \ep{Age: 3.1} \ep{Age=V3_1} (44_978) +\& \ep{Age: V3_1} Code point\*(Aqs usage was introduced in +\& version 3.1; See also Property +\& \*(AqPresent_In\*(Aq (44_978: U+03F4..03F5, +\& U+FDD0..FDEF, U+10300..1031E, +\& U+10320..10323, U+10330..1034A, +\& U+10400..10425 ...) +\& T \ep{Age: 3.2} \ep{Age=V3_2} (1016) +\& \ep{Age: V3_2} Code point\*(Aqs usage was introduced in +\& version 3.2; See also Property +\& \*(AqPresent_In\*(Aq (1016: U+0220, U+034F, +\& U+0363..036F, U+03D8..03D9, U+03F6, +\& U+048A..048B ...) +\& T \ep{Age: 4.0} \ep{Age=V4_0} (1226) +\& \ep{Age: V4_0} Code point\*(Aqs usage was introduced in +\& version 4.0; See also Property +\& \*(AqPresent_In\*(Aq (1226: U+0221, +\& U+0234..0236, U+02AE..02AF, +\& U+02EF..02FF, U+0350..0357, U+035D..035F +\& ...) +\& T \ep{Age: 4.1} \ep{Age=V4_1} (1273) +\& \ep{Age: V4_1} Code point\*(Aqs usage was introduced in +\& version 4.1; See also Property +\& \*(AqPresent_In\*(Aq (1273: U+0237..0241, +\& U+0358..035C, U+03FC..03FF, +\& U+04F6..04F7, U+05A2, U+05C5..05C7 ...) +\& T \ep{Age: 5.0} \ep{Age=V5_0} (1369) +\& \ep{Age: V5_0} Code point\*(Aqs usage was introduced in +\& version 5.0; See also Property +\& \*(AqPresent_In\*(Aq (1369: U+0242..024F, +\& U+037B..037D, U+04CF, U+04FA..04FF, +\& U+0510..0513, U+05BA ...) +\& T \ep{Age: 5.1} \ep{Age=V5_1} (1624) +\& \ep{Age: V5_1} Code point\*(Aqs usage was introduced in +\& version 5.1; See also Property +\& \*(AqPresent_In\*(Aq (1624: U+0370..0373, +\& U+0376..0377, U+03CF, U+0487, +\& U+0514..0523, U+0606..060A ...) +\& T \ep{Age: 5.2} \ep{Age=V5_2} (6648) +\& \ep{Age: V5_2} Code point\*(Aqs usage was introduced in +\& version 5.2; See also Property +\& \*(AqPresent_In\*(Aq (6648: U+0524..0525, +\& U+0800..082D, U+0830..083E, U+0900, +\& U+094E, U+0955 ...) +\& T \ep{Age: 6.0} \ep{Age=V6_0} (2088) +\& \ep{Age: V6_0} Code point\*(Aqs usage was introduced in +\& version 6.0; See also Property +\& \*(AqPresent_In\*(Aq (2088: U+0526..0527, +\& U+0620, U+065F, U+0840..085B, U+085E, +\& U+093A..093B ...) +\& T \ep{Age: 6.1} \ep{Age=V6_1} (732) +\& \ep{Age: V6_1} Code point\*(Aqs usage was introduced in +\& version 6.1; See also Property +\& \*(AqPresent_In\*(Aq (732: U+058F, U+0604, +\& U+08A0, U+08A2..08AC, U+08E4..08FE, +\& U+0AF0 ...) +\& T \ep{Age: 6.2} \ep{Age=V6_2} (1) +\& \ep{Age: V6_2} Code point\*(Aqs usage was introduced in +\& version 6.2; See also Property +\& \*(AqPresent_In\*(Aq (1: U+20BA) +\& T \ep{Age: 6.3} \ep{Age=V6_3} (5) +\& \ep{Age: V6_3} Code point\*(Aqs usage was introduced in +\& version 6.3; See also Property +\& \*(AqPresent_In\*(Aq (5: U+061C, U+2066..2069) +\& T \ep{Age: 7.0} \ep{Age=V7_0} (2834) +\& \ep{Age: V7_0} Code point\*(Aqs usage was introduced in +\& version 7.0; See also Property +\& \*(AqPresent_In\*(Aq (2834: U+037F, +\& U+0528..052F, U+058D..058E, U+0605, +\& U+08A1, U+08AD..08B2 ...) +\& T \ep{Age: 8.0} \ep{Age=V8_0} (7716) +\& \ep{Age: V8_0} Code point\*(Aqs usage was introduced in +\& version 8.0; See also Property +\& \*(AqPresent_In\*(Aq (7716: U+08B3..08B4, +\& U+08E3, U+0AF9, U+0C5A, U+0D5F, U+13F5 +\& ...) +\& T \ep{Age: 9.0} \ep{Age=V9_0} (7500) +\& \ep{Age: V9_0} Code point\*(Aqs usage was introduced in +\& version 9.0; See also Property +\& \*(AqPresent_In\*(Aq (7500: U+08B6..08BD, +\& U+08D4..08E2, U+0C80, U+0D4F, +\& U+0D54..0D56, U+0D58..0D5E ...) +\& T \ep{Age: 10.0} \ep{Age=V10_0} (8518) +\& \ep{Age: V10_0} Code point\*(Aqs usage was introduced in +\& version 10.0; See also Property +\& \*(AqPresent_In\*(Aq (8518: U+0860..086A, +\& U+09FC..09FD, U+0AFA..0AFF, U+0D00, +\& U+0D3B..0D3C, U+1CF7 ...) +\& T \ep{Age: 11.0} \ep{Age=V11_0} (684) +\& \ep{Age: V11_0} Code point\*(Aqs usage was introduced in +\& version 11.0; See also Property +\& \*(AqPresent_In\*(Aq (684: U+0560, U+0588, +\& U+05EF, U+07FD..07FF, U+08D3, U+09FE ...) +\& T \ep{Age: 12.0} \ep{Age=V12_0} (554) +\& \ep{Age: V12_0} Code point\*(Aqs usage was introduced in +\& version 12.0; See also Property +\& \*(AqPresent_In\*(Aq (554: U+0C77, U+0E86, +\& U+0E89, U+0E8C, U+0E8E..0E93, U+0E98 ...) +\& T \ep{Age: 12.1} \ep{Age=V12_1} (1) +\& \ep{Age: V12_1} Code point\*(Aqs usage was introduced in +\& version 12.1; See also Property +\& \*(AqPresent_In\*(Aq (1: U+32FF) +\& T \ep{Age: 13.0} \ep{Age=V13_0} (5930) +\& \ep{Age: V13_0} Code point\*(Aqs usage was introduced in +\& version 13.0; See also Property +\& \*(AqPresent_In\*(Aq (5930: U+08BE..08C7, +\& U+0B55, U+0D04, U+0D81, U+1ABF..1AC0, +\& U+2B97 ...) +\& \ep{Age: NA} \ep{Age=Unassigned} (830_606 plus all +\& above\-Unicode code points) +\& \ep{Age: Unassigned} Code point\*(Aqs usage has not been assigned +\& in any Unicode release thus far. +\& (Short: \ep{Age=NA}) (830_606 plus all above\-Unicode code points: +\& U+0378..0379, U+0380..0383, U+038B, +\& U+038D, U+03A2, U+0530 ...) +\& \ep{Aghb} \ep{Caucasian_Albanian} (= +\& \ep{Script_Extensions= +\& Caucasian_Albanian}) (NOT \ep{Block= +\& Caucasian_Albanian}) (53) +\& \ep{AHex} \ep{PosixXDigit} (= \ep{ASCII_Hex_Digit=Y}) +\& (22) +\& \ep{AHex: *} \ep{ASCII_Hex_Digit: *} +\& \ep{Ahom} \ep{Script_Extensions=Ahom} (NOT \ep{Block= +\& Ahom}) (58) +\& X \ep{Alchemical} \ep{Alchemical_Symbols} (= \ep{Block= +\& Alchemical_Symbols}) (128) +\& X \ep{Alchemical_Symbols} \ep{Block=Alchemical_Symbols} (Short: +\& \ep{InAlchemical}) (128) +\& \ep{All} All code points, including those above +\& Unicode. Same as qr/./s (1_114_112 plus +\& all above\-Unicode code points: +\& U+0000..infinity) +\& \ep{Alnum} \ep{XPosixAlnum} (133_525) +\& \ep{Alpha} \ep{XPosixAlpha} (= \ep{Alphabetic=Y}) +\& (132_875) +\& \ep{Alpha: *} \ep{Alphabetic: *} +\& \ep{Alphabetic} \ep{XPosixAlpha} (= \ep{Alphabetic=Y}) +\& (132_875) +\& \ep{Alphabetic: N*} (Short: \ep{Alpha=N}, \eP{Alpha}) (981_237 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<= +\& >?\e@\e[\e\e\e]\e^_\`\e{\e|\e}~\ex7f\-\exa9\exab\-\exb4 +\& \exb6\-\exb9\exbb\-\exbf\exd7\exf7], +\& U+02C2..02C5, U+02D2..02DF, +\& U+02E5..02EB, U+02ED, U+02EF..0344 ...) +\& \ep{Alphabetic: Y*} (Short: \ep{Alpha=Y}, \ep{Alpha}) (132_875: +\& [A\-Za\-z\exaa\exb5\exba\exc0\-\exd6\exd8\-\exf6 +\& \exf8\-\exff], U+0100..02C1, U+02C6..02D1, +\& U+02E0..02E4, U+02EC, U+02EE ...) +\& X \ep{Alphabetic_PF} \ep{Alphabetic_Presentation_Forms} (= +\& \ep{Block=Alphabetic_Presentation_Forms}) +\& (80) +\& X \ep{Alphabetic_Presentation_Forms} \ep{Block= +\& Alphabetic_Presentation_Forms} (Short: +\& \ep{InAlphabeticPF}) (80) +\& \ep{Anatolian_Hieroglyphs} \ep{Script_Extensions= +\& Anatolian_Hieroglyphs} (Short: \ep{Hluw}; +\& NOT \ep{Block=Anatolian_Hieroglyphs}) +\& (583) +\& X \ep{Ancient_Greek_Music} \ep{Ancient_Greek_Musical_Notation} (= +\& \ep{Block= +\& Ancient_Greek_Musical_Notation}) (80) +\& X \ep{Ancient_Greek_Musical_Notation} \ep{Block= +\& Ancient_Greek_Musical_Notation} (Short: +\& \ep{InAncientGreekMusic}) (80) +\& X \ep{Ancient_Greek_Numbers} \ep{Block=Ancient_Greek_Numbers} (80) +\& X \ep{Ancient_Symbols} \ep{Block=Ancient_Symbols} (64) +\& \ep{Any} All Unicode code points (1_114_112: +\& U+0000..10FFFF) +\& \ep{Arab} \ep{Arabic} (= \ep{Script_Extensions= +\& Arabic}) (NOT \ep{Block=Arabic}) (1335) +\& \ep{Arabic} \ep{Script_Extensions=Arabic} (Short: +\& \ep{Arab}; NOT \ep{Block=Arabic}) (1335) +\& X \ep{Arabic_Ext_A} \ep{Arabic_Extended_A} (= \ep{Block= +\& Arabic_Extended_A}) (96) +\& X \ep{Arabic_Extended_A} \ep{Block=Arabic_Extended_A} (Short: +\& \ep{InArabicExtA}) (96) +\& X \ep{Arabic_Math} \ep{Arabic_Mathematical_Alphabetic_Symbols} +\& (= \ep{Block= +\& Arabic_Mathematical_Alphabetic_Symbols}) +\& (256) +\& X \ep{Arabic_Mathematical_Alphabetic_Symbols} \ep{Block= +\& Arabic_Mathematical_Alphabetic_Symbols} +\& (Short: \ep{InArabicMath}) (256) +\& X \ep{Arabic_PF_A} \ep{Arabic_Presentation_Forms_A} (= +\& \ep{Block=Arabic_Presentation_Forms_A}) +\& (688) +\& X \ep{Arabic_PF_B} \ep{Arabic_Presentation_Forms_B} (= +\& \ep{Block=Arabic_Presentation_Forms_B}) +\& (144) +\& X \ep{Arabic_Presentation_Forms_A} \ep{Block= +\& Arabic_Presentation_Forms_A} (Short: +\& \ep{InArabicPFA}) (688) +\& X \ep{Arabic_Presentation_Forms_B} \ep{Block= +\& Arabic_Presentation_Forms_B} (Short: +\& \ep{InArabicPFB}) (144) +\& X \ep{Arabic_Sup} \ep{Arabic_Supplement} (= \ep{Block= +\& Arabic_Supplement}) (48) +\& X \ep{Arabic_Supplement} \ep{Block=Arabic_Supplement} (Short: +\& \ep{InArabicSup}) (48) +\& \ep{Armenian} \ep{Script_Extensions=Armenian} (Short: +\& \ep{Armn}; NOT \ep{Block=Armenian}) (96) +\& \ep{Armi} \ep{Imperial_Aramaic} (= +\& \ep{Script_Extensions=Imperial_Aramaic}) +\& (NOT \ep{Block=Imperial_Aramaic}) (31) +\& \ep{Armn} \ep{Armenian} (= \ep{Script_Extensions= +\& Armenian}) (NOT \ep{Block=Armenian}) (96) +\& X \ep{Arrows} \ep{Block=Arrows} (112) +\& \ep{ASCII} \ep{Block=Basic_Latin} (128) +\& \ep{ASCII_Hex_Digit} \ep{PosixXDigit} (= \ep{ASCII_Hex_Digit=Y}) +\& (22) +\& \ep{ASCII_Hex_Digit: N*} (Short: \ep{AHex=N}, \eP{AHex}) (1_114_090 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<=>? +\& \e@G\-Z\e[\e\e\e]\e^_\`g\-z\e{\e|\e}~\ex7f\-\exff], +\& U+0100..infinity) +\& \ep{ASCII_Hex_Digit: Y*} (Short: \ep{AHex=Y}, \ep{AHex}) (22: [0\-9A\- +\& Fa\-f]) +\& \ep{Assigned} All assigned code points (283_440: +\& U+0000..0377, U+037A..037F, +\& U+0384..038A, U+038C, U+038E..03A1, +\& U+03A3..052F ...) +\& \ep{Avestan} \ep{Script_Extensions=Avestan} (Short: +\& \ep{Avst}; NOT \ep{Block=Avestan}) (61) +\& \ep{Avst} \ep{Avestan} (= \ep{Script_Extensions= +\& Avestan}) (NOT \ep{Block=Avestan}) (61) +\& \ep{Bali} \ep{Balinese} (= \ep{Script_Extensions= +\& Balinese}) (NOT \ep{Block=Balinese}) (121) +\& \ep{Balinese} \ep{Script_Extensions=Balinese} (Short: +\& \ep{Bali}; NOT \ep{Block=Balinese}) (121) +\& \ep{Bamu} \ep{Bamum} (= \ep{Script_Extensions=Bamum}) +\& (NOT \ep{Block=Bamum}) (657) +\& \ep{Bamum} \ep{Script_Extensions=Bamum} (Short: +\& \ep{Bamu}; NOT \ep{Block=Bamum}) (657) +\& X \ep{Bamum_Sup} \ep{Bamum_Supplement} (= \ep{Block= +\& Bamum_Supplement}) (576) +\& X \ep{Bamum_Supplement} \ep{Block=Bamum_Supplement} (Short: +\& \ep{InBamumSup}) (576) +\& X \ep{Basic_Latin} \ep{ASCII} (= \ep{Block=Basic_Latin}) (128) +\& \ep{Bass} \ep{Bassa_Vah} (= \ep{Script_Extensions= +\& Bassa_Vah}) (NOT \ep{Block=Bassa_Vah}) +\& (36) +\& \ep{Bassa_Vah} \ep{Script_Extensions=Bassa_Vah} (Short: +\& \ep{Bass}; NOT \ep{Block=Bassa_Vah}) (36) +\& \ep{Batak} \ep{Script_Extensions=Batak} (Short: +\& \ep{Batk}; NOT \ep{Block=Batak}) (56) +\& \ep{Batk} \ep{Batak} (= \ep{Script_Extensions=Batak}) +\& (NOT \ep{Block=Batak}) (56) +\& \ep{Bc: *} \ep{Bidi_Class: *} +\& \ep{Beng} \ep{Bengali} (= \ep{Script_Extensions= +\& Bengali}) (NOT \ep{Block=Bengali}) (113) +\& \ep{Bengali} \ep{Script_Extensions=Bengali} (Short: +\& \ep{Beng}; NOT \ep{Block=Bengali}) (113) +\& \ep{Bhaiksuki} \ep{Script_Extensions=Bhaiksuki} (Short: +\& \ep{Bhks}; NOT \ep{Block=Bhaiksuki}) (97) +\& \ep{Bhks} \ep{Bhaiksuki} (= \ep{Script_Extensions= +\& Bhaiksuki}) (NOT \ep{Block=Bhaiksuki}) +\& (97) +\& \ep{Bidi_C} \ep{Bidi_Control} (= \ep{Bidi_Control=Y}) +\& (12) +\& \ep{Bidi_C: *} \ep{Bidi_Control: *} +\& \ep{Bidi_Class: AL} \ep{Bidi_Class=Arabic_Letter} (1698) +\& \ep{Bidi_Class: AN} \ep{Bidi_Class=Arabic_Number} (61) +\& \ep{Bidi_Class: Arabic_Letter} (Short: \ep{Bc=AL}) (1698: U+0608, +\& U+060B, U+060D, U+061B..064A, +\& U+066D..066F, U+0671..06D5 ...) +\& \ep{Bidi_Class: Arabic_Number} (Short: \ep{Bc=AN}) (61: +\& U+0600..0605, U+0660..0669, +\& U+066B..066C, U+06DD, U+08E2, +\& U+10D30..10D39 ...) +\& \ep{Bidi_Class: B} \ep{Bidi_Class=Paragraph_Separator} (7) +\& \ep{Bidi_Class: BN} \ep{Bidi_Class=Boundary_Neutral} (4016) +\& \ep{Bidi_Class: Boundary_Neutral} (Short: \ep{Bc=BN}) (4016: [^\et\en +\& \ecK\ef\er\ex1c\-\ex7e\ex85\exa0\-\exac\exae\-\exff], +\& U+180E, U+200B..200D, U+2060..2065, +\& U+206A..206F, U+FDD0..FDEF ...) +\& \ep{Bidi_Class: Common_Separator} (Short: \ep{Bc=CS}) (15: [,.\e/: +\& \exa0], U+060C, U+202F, U+2044, U+FE50, +\& U+FE52 ...) +\& \ep{Bidi_Class: CS} \ep{Bidi_Class=Common_Separator} (15) +\& \ep{Bidi_Class: EN} \ep{Bidi_Class=European_Number} (168) +\& \ep{Bidi_Class: ES} \ep{Bidi_Class=European_Separator} (12) +\& \ep{Bidi_Class: ET} \ep{Bidi_Class=European_Terminator} (92) +\& \ep{Bidi_Class: European_Number} (Short: \ep{Bc=EN}) (168: [0\-9\exb2\- +\& \exb3\exb9], U+06F0..06F9, U+2070, +\& U+2074..2079, U+2080..2089, U+2488..249B +\& ...) +\& \ep{Bidi_Class: European_Separator} (Short: \ep{Bc=ES}) (12: [+\e\-], +\& U+207A..207B, U+208A..208B, U+2212, +\& U+FB29, U+FE62..FE63 ...) +\& \ep{Bidi_Class: European_Terminator} (Short: \ep{Bc=ET}) (92: [#\e$ +\& \e%\exa2\-\exa5\exb0\-\exb1], U+058F, +\& U+0609..060A, U+066A, U+09F2..09F3, +\& U+09FB ...) +\& \ep{Bidi_Class: First_Strong_Isolate} (Short: \ep{Bc=FSI}) (1: +\& U+2068) +\& \ep{Bidi_Class: FSI} \ep{Bidi_Class=First_Strong_Isolate} (1) +\& \ep{Bidi_Class: L} \ep{Bidi_Class=Left_To_Right} (1_096_473 +\& plus all above\-Unicode code points) +\& \ep{Bidi_Class: Left_To_Right} (Short: \ep{Bc=L}) (1_096_473 plus +\& all above\-Unicode code points: [A\-Za\-z +\& \exaa\exb5\exba\exc0\-\exd6\exd8\-\exf6\exf8\- +\& \exff], U+0100..02B8, U+02BB..02C1, +\& U+02D0..02D1, U+02E0..02E4, U+02EE ...) +\& \ep{Bidi_Class: Left_To_Right_Embedding} (Short: \ep{Bc=LRE}) (1: +\& U+202A) +\& \ep{Bidi_Class: Left_To_Right_Isolate} (Short: \ep{Bc=LRI}) (1: +\& U+2066) +\& \ep{Bidi_Class: Left_To_Right_Override} (Short: \ep{Bc=LRO}) (1: +\& U+202D) +\& \ep{Bidi_Class: LRE} \ep{Bidi_Class=Left_To_Right_Embedding} (1) +\& \ep{Bidi_Class: LRI} \ep{Bidi_Class=Left_To_Right_Isolate} (1) +\& \ep{Bidi_Class: LRO} \ep{Bidi_Class=Left_To_Right_Override} (1) +\& \ep{Bidi_Class: Nonspacing_Mark} (Short: \ep{Bc=NSM}) (1847: +\& U+0300..036F, U+0483..0489, +\& U+0591..05BD, U+05BF, U+05C1..05C2, +\& U+05C4..05C5 ...) +\& \ep{Bidi_Class: NSM} \ep{Bidi_Class=Nonspacing_Mark} (1847) +\& \ep{Bidi_Class: ON} \ep{Bidi_Class=Other_Neutral} (5931) +\& \ep{Bidi_Class: Other_Neutral} (Short: \ep{Bc=ON}) (5931: [!\e"&\e\*(Aq +\& \e(\e)*;<=>?\e@\e[\e\e\e]\e^_\`\e{\e|\e}~\exa1\exa6\- +\& \exa9\exab\-\exac\exae\-\exaf\exb4\exb6\-\exb8\exbb\- +\& \exbf\exd7\exf7], U+02B9..02BA, +\& U+02C2..02CF, U+02D2..02DF, +\& U+02E5..02ED, U+02EF..02FF ...) +\& \ep{Bidi_Class: Paragraph_Separator} (Short: \ep{Bc=B}) (7: [\en\er +\& \ex1c\-\ex1e\ex85], U+2029) +\& \ep{Bidi_Class: PDF} \ep{Bidi_Class=Pop_Directional_Format} (1) +\& \ep{Bidi_Class: PDI} \ep{Bidi_Class=Pop_Directional_Isolate} (1) +\& \ep{Bidi_Class: Pop_Directional_Format} (Short: \ep{Bc=PDF}) (1: +\& U+202C) +\& \ep{Bidi_Class: Pop_Directional_Isolate} (Short: \ep{Bc=PDI}) (1: +\& U+2069) +\& \ep{Bidi_Class: R} \ep{Bidi_Class=Right_To_Left} (3763) +\& \ep{Bidi_Class: Right_To_Left} (Short: \ep{Bc=R}) (3763: U+0590, +\& U+05BE, U+05C0, U+05C3, U+05C6, +\& U+05C8..05FF ...) +\& \ep{Bidi_Class: Right_To_Left_Embedding} (Short: \ep{Bc=RLE}) (1: +\& U+202B) +\& \ep{Bidi_Class: Right_To_Left_Isolate} (Short: \ep{Bc=RLI}) (1: +\& U+2067) +\& \ep{Bidi_Class: Right_To_Left_Override} (Short: \ep{Bc=RLO}) (1: +\& U+202E) +\& \ep{Bidi_Class: RLE} \ep{Bidi_Class=Right_To_Left_Embedding} (1) +\& \ep{Bidi_Class: RLI} \ep{Bidi_Class=Right_To_Left_Isolate} (1) +\& \ep{Bidi_Class: RLO} \ep{Bidi_Class=Right_To_Left_Override} (1) +\& \ep{Bidi_Class: S} \ep{Bidi_Class=Segment_Separator} (3) +\& \ep{Bidi_Class: Segment_Separator} (Short: \ep{Bc=S}) (3: [\et\ecK +\& \ex1f]) +\& \ep{Bidi_Class: White_Space} (Short: \ep{Bc=WS}) (17: [\ef\ex20], +\& U+1680, U+2000..200A, U+2028, U+205F, +\& U+3000) +\& \ep{Bidi_Class: WS} \ep{Bidi_Class=White_Space} (17) +\& \ep{Bidi_Control} \ep{Bidi_Control=Y} (Short: \ep{BidiC}) (12) +\& \ep{Bidi_Control: N*} (Short: \ep{BidiC=N}, \eP{BidiC}) (1_114_100 +\& plus all above\-Unicode code points: +\& U+0000..061B, U+061D..200D, +\& U+2010..2029, U+202F..2065, +\& U+206A..infinity) +\& \ep{Bidi_Control: Y*} (Short: \ep{BidiC=Y}, \ep{BidiC}) (12: +\& U+061C, U+200E..200F, U+202A..202E, +\& U+2066..2069) +\& \ep{Bidi_M} \ep{Bidi_Mirrored} (= \ep{Bidi_Mirrored=Y}) +\& (545) +\& \ep{Bidi_M: *} \ep{Bidi_Mirrored: *} +\& \ep{Bidi_Mirrored} \ep{Bidi_Mirrored=Y} (Short: \ep{BidiM}) +\& (545) +\& \ep{Bidi_Mirrored: N*} (Short: \ep{BidiM=N}, \eP{BidiM}) (1_113_567 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq*+,\e\-.\e/0\-9:;=?\e@A\- +\& Z\e\e\e^_\`a\-z\e|~\ex7f\-\exaa\exac\-\exba\exbc\- +\& \exff], U+0100..0F39, U+0F3E..169A, +\& U+169D..2038, U+203B..2044, U+2047..207C +\& ...) +\& \ep{Bidi_Mirrored: Y*} (Short: \ep{BidiM=Y}, \ep{BidiM}) (545: +\& [\e(\e)<>\e[\e]\e{\e}\exab\exbb], U+0F3A..0F3D, +\& U+169B..169C, U+2039..203A, +\& U+2045..2046, U+207D..207E ...) +\& \ep{Bidi_Paired_Bracket_Type: C} \ep{Bidi_Paired_Bracket_Type=Close} +\& (60) +\& \ep{Bidi_Paired_Bracket_Type: Close} (Short: \ep{Bpt=C}) (60: [\e)\e] +\& \e}], U+0F3B, U+0F3D, U+169C, U+2046, +\& U+207E ...) +\& \ep{Bidi_Paired_Bracket_Type: N} \ep{Bidi_Paired_Bracket_Type=None} +\& (1_113_992 plus all above\-Unicode code +\& points) +\& \ep{Bidi_Paired_Bracket_Type: None} (Short: \ep{Bpt=N}) (1_113_992 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq*+,\e\-.\e/0\-9:;<=>? +\& \e@A\-Z\e\e\e^_\`a\-z\e|~\ex7f\-\exff], +\& U+0100..0F39, U+0F3E..169A, +\& U+169D..2044, U+2047..207C, U+207F..208C +\& ...) +\& \ep{Bidi_Paired_Bracket_Type: O} \ep{Bidi_Paired_Bracket_Type=Open} +\& (60) +\& \ep{Bidi_Paired_Bracket_Type: Open} (Short: \ep{Bpt=O}) (60: +\& [\e(\e[\e{], U+0F3A, U+0F3C, U+169B, +\& U+2045, U+207D ...) +\& \ep{Blank} \ep{XPosixBlank} (18) +\& \ep{Blk: *} \ep{Block: *} +\& \ep{Block: Adlam} (NOT \ep{Adlam} NOR \ep{Is_Adlam}) (96: +\& U+1E900..1E95F) +\& \ep{Block: Aegean_Numbers} (64: U+10100..1013F) +\& \ep{Block: Ahom} (NOT \ep{Ahom} NOR \ep{Is_Ahom}) (64: +\& U+11700..1173F) +\& \ep{Block: Alchemical} \ep{Block=Alchemical_Symbols} (128) +\& \ep{Block: Alchemical_Symbols} (Short: \ep{Blk=Alchemical}) (128: +\& U+1F700..1F77F) +\& \ep{Block: Alphabetic_PF} \ep{Block=Alphabetic_Presentation_Forms} +\& (80) +\& \ep{Block: Alphabetic_Presentation_Forms} (Short: \ep{Blk= +\& AlphabeticPF}) (80: U+FB00..FB4F) +\& \ep{Block: Anatolian_Hieroglyphs} (NOT \ep{Anatolian_Hieroglyphs} +\& NOR \ep{Is_Anatolian_Hieroglyphs}) (640: +\& U+14400..1467F) +\& \ep{Block: Ancient_Greek_Music} \ep{Block= +\& Ancient_Greek_Musical_Notation} (80) +\& \ep{Block: Ancient_Greek_Musical_Notation} (Short: \ep{Blk= +\& AncientGreekMusic}) (80: U+1D200..1D24F) +\& \ep{Block: Ancient_Greek_Numbers} (80: U+10140..1018F) +\& \ep{Block: Ancient_Symbols} (64: U+10190..101CF) +\& \ep{Block: Arabic} (NOT \ep{Arabic} NOR \ep{Is_Arabic}) (256: +\& U+0600..06FF) +\& \ep{Block: Arabic_Ext_A} \ep{Block=Arabic_Extended_A} (96) +\& \ep{Block: Arabic_Extended_A} (Short: \ep{Blk=ArabicExtA}) (96: +\& U+08A0..08FF) +\& \ep{Block: Arabic_Math} \ep{Block= +\& Arabic_Mathematical_Alphabetic_Symbols} +\& (256) +\& \ep{Block: Arabic_Mathematical_Alphabetic_Symbols} (Short: \ep{Blk= +\& ArabicMath}) (256: U+1EE00..1EEFF) +\& \ep{Block: Arabic_PF_A} \ep{Block=Arabic_Presentation_Forms_A} (688) +\& \ep{Block: Arabic_PF_B} \ep{Block=Arabic_Presentation_Forms_B} (144) +\& \ep{Block: Arabic_Presentation_Forms_A} (Short: \ep{Blk=ArabicPFA}) +\& (688: U+FB50..FDFF) +\& \ep{Block: Arabic_Presentation_Forms_B} (Short: \ep{Blk=ArabicPFB}) +\& (144: U+FE70..FEFF) +\& \ep{Block: Arabic_Sup} \ep{Block=Arabic_Supplement} (48) +\& \ep{Block: Arabic_Supplement} (Short: \ep{Blk=ArabicSup}) (48: +\& U+0750..077F) +\& \ep{Block: Armenian} (NOT \ep{Armenian} NOR \ep{Is_Armenian}) +\& (96: U+0530..058F) +\& \ep{Block: Arrows} (112: U+2190..21FF) +\& \ep{Block: ASCII} \ep{Block=Basic_Latin} (128) +\& \ep{Block: Avestan} (NOT \ep{Avestan} NOR \ep{Is_Avestan}) (64: +\& U+10B00..10B3F) +\& \ep{Block: Balinese} (NOT \ep{Balinese} NOR \ep{Is_Balinese}) +\& (128: U+1B00..1B7F) +\& \ep{Block: Bamum} (NOT \ep{Bamum} NOR \ep{Is_Bamum}) (96: +\& U+A6A0..A6FF) +\& \ep{Block: Bamum_Sup} \ep{Block=Bamum_Supplement} (576) +\& \ep{Block: Bamum_Supplement} (Short: \ep{Blk=BamumSup}) (576: +\& U+16800..16A3F) +\& \ep{Block: Basic_Latin} (Short: \ep{Blk=ASCII}) (128: [\ex00\-\ex7f]) +\& \ep{Block: Bassa_Vah} (NOT \ep{Bassa_Vah} NOR \ep{Is_Bassa_Vah}) +\& (48: U+16AD0..16AFF) +\& \ep{Block: Batak} (NOT \ep{Batak} NOR \ep{Is_Batak}) (64: +\& U+1BC0..1BFF) +\& \ep{Block: Bengali} (NOT \ep{Bengali} NOR \ep{Is_Bengali}) (128: +\& U+0980..09FF) +\& \ep{Block: Bhaiksuki} (NOT \ep{Bhaiksuki} NOR \ep{Is_Bhaiksuki}) +\& (112: U+11C00..11C6F) +\& \ep{Block: Block_Elements} (32: U+2580..259F) +\& \ep{Block: Bopomofo} (NOT \ep{Bopomofo} NOR \ep{Is_Bopomofo}) +\& (48: U+3100..312F) +\& \ep{Block: Bopomofo_Ext} \ep{Block=Bopomofo_Extended} (32) +\& \ep{Block: Bopomofo_Extended} (Short: \ep{Blk=BopomofoExt}) (32: +\& U+31A0..31BF) +\& \ep{Block: Box_Drawing} (128: U+2500..257F) +\& \ep{Block: Brahmi} (NOT \ep{Brahmi} NOR \ep{Is_Brahmi}) (128: +\& U+11000..1107F) +\& \ep{Block: Braille} \ep{Block=Braille_Patterns} (256) +\& \ep{Block: Braille_Patterns} (Short: \ep{Blk=Braille}) (256: +\& U+2800..28FF) +\& \ep{Block: Buginese} (NOT \ep{Buginese} NOR \ep{Is_Buginese}) +\& (32: U+1A00..1A1F) +\& \ep{Block: Buhid} (NOT \ep{Buhid} NOR \ep{Is_Buhid}) (32: +\& U+1740..175F) +\& \ep{Block: Byzantine_Music} \ep{Block=Byzantine_Musical_Symbols} +\& (256) +\& \ep{Block: Byzantine_Musical_Symbols} (Short: \ep{Blk= +\& ByzantineMusic}) (256: U+1D000..1D0FF) +\& \ep{Block: Canadian_Syllabics} \ep{Block= +\& Unified_Canadian_Aboriginal_Syllabics} +\& (640) +\& \ep{Block: Carian} (NOT \ep{Carian} NOR \ep{Is_Carian}) (64: +\& U+102A0..102DF) +\& \ep{Block: Caucasian_Albanian} (NOT \ep{Caucasian_Albanian} NOR +\& \ep{Is_Caucasian_Albanian}) (64: +\& U+10530..1056F) +\& \ep{Block: Chakma} (NOT \ep{Chakma} NOR \ep{Is_Chakma}) (80: +\& U+11100..1114F) +\& \ep{Block: Cham} (NOT \ep{Cham} NOR \ep{Is_Cham}) (96: +\& U+AA00..AA5F) +\& \ep{Block: Cherokee} (NOT \ep{Cherokee} NOR \ep{Is_Cherokee}) +\& (96: U+13A0..13FF) +\& \ep{Block: Cherokee_Sup} \ep{Block=Cherokee_Supplement} (80) +\& \ep{Block: Cherokee_Supplement} (Short: \ep{Blk=CherokeeSup}) (80: +\& U+AB70..ABBF) +\& \ep{Block: Chess_Symbols} (112: U+1FA00..1FA6F) +\& \ep{Block: Chorasmian} (NOT \ep{Chorasmian} NOR \ep{Is_Chorasmian}) +\& (48: U+10FB0..10FDF) +\& \ep{Block: CJK} \ep{Block=CJK_Unified_Ideographs} (20_992) +\& \ep{Block: CJK_Compat} \ep{Block=CJK_Compatibility} (256) +\& \ep{Block: CJK_Compat_Forms} \ep{Block=CJK_Compatibility_Forms} (32) +\& \ep{Block: CJK_Compat_Ideographs} \ep{Block= +\& CJK_Compatibility_Ideographs} (512) +\& \ep{Block: CJK_Compat_Ideographs_Sup} \ep{Block= +\& CJK_Compatibility_Ideographs_Supplement} +\& (544) +\& \ep{Block: CJK_Compatibility} (Short: \ep{Blk=CJKCompat}) (256: +\& U+3300..33FF) +\& \ep{Block: CJK_Compatibility_Forms} (Short: \ep{Blk=CJKCompatForms}) +\& (32: U+FE30..FE4F) +\& \ep{Block: CJK_Compatibility_Ideographs} (Short: \ep{Blk= +\& CJKCompatIdeographs}) (512: U+F900..FAFF) +\& \ep{Block: CJK_Compatibility_Ideographs_Supplement} (Short: \ep{Blk= +\& CJKCompatIdeographsSup}) (544: +\& U+2F800..2FA1F) +\& \ep{Block: CJK_Ext_A} \ep{Block= +\& CJK_Unified_Ideographs_Extension_A} +\& (6592) +\& \ep{Block: CJK_Ext_B} \ep{Block= +\& CJK_Unified_Ideographs_Extension_B} +\& (42_720) +\& \ep{Block: CJK_Ext_C} \ep{Block= +\& CJK_Unified_Ideographs_Extension_C} +\& (4160) +\& \ep{Block: CJK_Ext_D} \ep{Block= +\& CJK_Unified_Ideographs_Extension_D} (224) +\& \ep{Block: CJK_Ext_E} \ep{Block= +\& CJK_Unified_Ideographs_Extension_E} +\& (5776) +\& \ep{Block: CJK_Ext_F} \ep{Block= +\& CJK_Unified_Ideographs_Extension_F} +\& (7488) +\& \ep{Block: CJK_Ext_G} \ep{Block= +\& CJK_Unified_Ideographs_Extension_G} +\& (4944) +\& \ep{Block: CJK_Radicals_Sup} \ep{Block=CJK_Radicals_Supplement} (128) +\& \ep{Block: CJK_Radicals_Supplement} (Short: \ep{Blk=CJKRadicalsSup}) +\& (128: U+2E80..2EFF) +\& \ep{Block: CJK_Strokes} (48: U+31C0..31EF) +\& \ep{Block: CJK_Symbols} \ep{Block=CJK_Symbols_And_Punctuation} (64) +\& \ep{Block: CJK_Symbols_And_Punctuation} (Short: \ep{Blk=CJKSymbols}) +\& (64: U+3000..303F) +\& \ep{Block: CJK_Unified_Ideographs} (Short: \ep{Blk=CJK}) (20_992: +\& U+4E00..9FFF) +\& \ep{Block: CJK_Unified_Ideographs_Extension_A} (Short: \ep{Blk= +\& CJKExtA}) (6592: U+3400..4DBF) +\& \ep{Block: CJK_Unified_Ideographs_Extension_B} (Short: \ep{Blk= +\& CJKExtB}) (42_720: U+20000..2A6DF) +\& \ep{Block: CJK_Unified_Ideographs_Extension_C} (Short: \ep{Blk= +\& CJKExtC}) (4160: U+2A700..2B73F) +\& \ep{Block: CJK_Unified_Ideographs_Extension_D} (Short: \ep{Blk= +\& CJKExtD}) (224: U+2B740..2B81F) +\& \ep{Block: CJK_Unified_Ideographs_Extension_E} (Short: \ep{Blk= +\& CJKExtE}) (5776: U+2B820..2CEAF) +\& \ep{Block: CJK_Unified_Ideographs_Extension_F} (Short: \ep{Blk= +\& CJKExtF}) (7488: U+2CEB0..2EBEF) +\& \ep{Block: CJK_Unified_Ideographs_Extension_G} (Short: \ep{Blk= +\& CJKExtG}) (4944: U+30000..3134F) +\& \ep{Block: Combining_Diacritical_Marks} (Short: \ep{Blk= +\& Diacriticals}) (112: U+0300..036F) +\& \ep{Block: Combining_Diacritical_Marks_Extended} (Short: \ep{Blk= +\& DiacriticalsExt}) (80: U+1AB0..1AFF) +\& \ep{Block: Combining_Diacritical_Marks_For_Symbols} (Short: \ep{Blk= +\& DiacriticalsForSymbols}) (48: +\& U+20D0..20FF) +\& \ep{Block: Combining_Diacritical_Marks_Supplement} (Short: \ep{Blk= +\& DiacriticalsSup}) (64: U+1DC0..1DFF) +\& \ep{Block: Combining_Half_Marks} (Short: \ep{Blk=HalfMarks}) (16: +\& U+FE20..FE2F) +\& \ep{Block: Combining_Marks_For_Symbols} \ep{Block= +\& Combining_Diacritical_Marks_For_Symbols} +\& (48) +\& \ep{Block: Common_Indic_Number_Forms} (Short: \ep{Blk= +\& IndicNumberForms}) (16: U+A830..A83F) +\& \ep{Block: Compat_Jamo} \ep{Block=Hangul_Compatibility_Jamo} (96) +\& \ep{Block: Control_Pictures} (64: U+2400..243F) +\& \ep{Block: Coptic} (NOT \ep{Coptic} NOR \ep{Is_Coptic}) (128: +\& U+2C80..2CFF) +\& \ep{Block: Coptic_Epact_Numbers} (32: U+102E0..102FF) +\& \ep{Block: Counting_Rod} \ep{Block=Counting_Rod_Numerals} (32) +\& \ep{Block: Counting_Rod_Numerals} (Short: \ep{Blk=CountingRod}) (32: +\& U+1D360..1D37F) +\& \ep{Block: Cuneiform} (NOT \ep{Cuneiform} NOR \ep{Is_Cuneiform}) +\& (1024: U+12000..123FF) +\& \ep{Block: Cuneiform_Numbers} \ep{Block= +\& Cuneiform_Numbers_And_Punctuation} (128) +\& \ep{Block: Cuneiform_Numbers_And_Punctuation} (Short: \ep{Blk= +\& CuneiformNumbers}) (128: U+12400..1247F) +\& \ep{Block: Currency_Symbols} (48: U+20A0..20CF) +\& \ep{Block: Cypriot_Syllabary} (64: U+10800..1083F) +\& \ep{Block: Cyrillic} (NOT \ep{Cyrillic} NOR \ep{Is_Cyrillic}) +\& (256: U+0400..04FF) +\& \ep{Block: Cyrillic_Ext_A} \ep{Block=Cyrillic_Extended_A} (32) +\& \ep{Block: Cyrillic_Ext_B} \ep{Block=Cyrillic_Extended_B} (96) +\& \ep{Block: Cyrillic_Ext_C} \ep{Block=Cyrillic_Extended_C} (16) +\& \ep{Block: Cyrillic_Extended_A} (Short: \ep{Blk=CyrillicExtA}) (32: +\& U+2DE0..2DFF) +\& \ep{Block: Cyrillic_Extended_B} (Short: \ep{Blk=CyrillicExtB}) (96: +\& U+A640..A69F) +\& \ep{Block: Cyrillic_Extended_C} (Short: \ep{Blk=CyrillicExtC}) (16: +\& U+1C80..1C8F) +\& \ep{Block: Cyrillic_Sup} \ep{Block=Cyrillic_Supplement} (48) +\& \ep{Block: Cyrillic_Supplement} (Short: \ep{Blk=CyrillicSup}) (48: +\& U+0500..052F) +\& \ep{Block: Cyrillic_Supplementary} \ep{Block=Cyrillic_Supplement} +\& (48) +\& \ep{Block: Deseret} (80: U+10400..1044F) +\& \ep{Block: Devanagari} (NOT \ep{Devanagari} NOR \ep{Is_Devanagari}) +\& (128: U+0900..097F) +\& \ep{Block: Devanagari_Ext} \ep{Block=Devanagari_Extended} (32) +\& \ep{Block: Devanagari_Extended} (Short: \ep{Blk=DevanagariExt}) (32: +\& U+A8E0..A8FF) +\& \ep{Block: Diacriticals} \ep{Block=Combining_Diacritical_Marks} (112) +\& \ep{Block: Diacriticals_Ext} \ep{Block= +\& Combining_Diacritical_Marks_Extended} +\& (80) +\& \ep{Block: Diacriticals_For_Symbols} \ep{Block= +\& Combining_Diacritical_Marks_For_Symbols} +\& (48) +\& \ep{Block: Diacriticals_Sup} \ep{Block= +\& Combining_Diacritical_Marks_Supplement} +\& (64) +\& \ep{Block: Dingbats} (192: U+2700..27BF) +\& \ep{Block: Dives_Akuru} (NOT \ep{Dives_Akuru} NOR +\& \ep{Is_Dives_Akuru}) (96: U+11900..1195F) +\& \ep{Block: Dogra} (NOT \ep{Dogra} NOR \ep{Is_Dogra}) (80: +\& U+11800..1184F) +\& \ep{Block: Domino} \ep{Block=Domino_Tiles} (112) +\& \ep{Block: Domino_Tiles} (Short: \ep{Blk=Domino}) (112: +\& U+1F030..1F09F) +\& \ep{Block: Duployan} (NOT \ep{Duployan} NOR \ep{Is_Duployan}) +\& (160: U+1BC00..1BC9F) +\& \ep{Block: Early_Dynastic_Cuneiform} (208: U+12480..1254F) +\& \ep{Block: Egyptian_Hieroglyph_Format_Controls} (16: U+13430..1343F) +\& \ep{Block: Egyptian_Hieroglyphs} (NOT \ep{Egyptian_Hieroglyphs} NOR +\& \ep{Is_Egyptian_Hieroglyphs}) (1072: +\& U+13000..1342F) +\& \ep{Block: Elbasan} (NOT \ep{Elbasan} NOR \ep{Is_Elbasan}) (48: +\& U+10500..1052F) +\& \ep{Block: Elymaic} (NOT \ep{Elymaic} NOR \ep{Is_Elymaic}) (32: +\& U+10FE0..10FFF) +\& \ep{Block: Emoticons} (80: U+1F600..1F64F) +\& \ep{Block: Enclosed_Alphanum} \ep{Block=Enclosed_Alphanumerics} (160) +\& \ep{Block: Enclosed_Alphanum_Sup} \ep{Block= +\& Enclosed_Alphanumeric_Supplement} (256) +\& \ep{Block: Enclosed_Alphanumeric_Supplement} (Short: \ep{Blk= +\& EnclosedAlphanumSup}) (256: +\& U+1F100..1F1FF) +\& \ep{Block: Enclosed_Alphanumerics} (Short: \ep{Blk= +\& EnclosedAlphanum}) (160: U+2460..24FF) +\& \ep{Block: Enclosed_CJK} \ep{Block=Enclosed_CJK_Letters_And_Months} +\& (256) +\& \ep{Block: Enclosed_CJK_Letters_And_Months} (Short: \ep{Blk= +\& EnclosedCJK}) (256: U+3200..32FF) +\& \ep{Block: Enclosed_Ideographic_Sup} \ep{Block= +\& Enclosed_Ideographic_Supplement} (256) +\& \ep{Block: Enclosed_Ideographic_Supplement} (Short: \ep{Blk= +\& EnclosedIdeographicSup}) (256: +\& U+1F200..1F2FF) +\& \ep{Block: Ethiopic} (NOT \ep{Ethiopic} NOR \ep{Is_Ethiopic}) +\& (384: U+1200..137F) +\& \ep{Block: Ethiopic_Ext} \ep{Block=Ethiopic_Extended} (96) +\& \ep{Block: Ethiopic_Ext_A} \ep{Block=Ethiopic_Extended_A} (48) +\& \ep{Block: Ethiopic_Extended} (Short: \ep{Blk=EthiopicExt}) (96: +\& U+2D80..2DDF) +\& \ep{Block: Ethiopic_Extended_A} (Short: \ep{Blk=EthiopicExtA}) (48: +\& U+AB00..AB2F) +\& \ep{Block: Ethiopic_Sup} \ep{Block=Ethiopic_Supplement} (32) +\& \ep{Block: Ethiopic_Supplement} (Short: \ep{Blk=EthiopicSup}) (32: +\& U+1380..139F) +\& \ep{Block: General_Punctuation} (Short: \ep{Blk=Punctuation}; NOT +\& \ep{Punct} NOR \ep{Is_Punctuation}) (112: +\& U+2000..206F) +\& \ep{Block: Geometric_Shapes} (96: U+25A0..25FF) +\& \ep{Block: Geometric_Shapes_Ext} \ep{Block= +\& Geometric_Shapes_Extended} (128) +\& \ep{Block: Geometric_Shapes_Extended} (Short: \ep{Blk= +\& GeometricShapesExt}) (128: +\& U+1F780..1F7FF) +\& \ep{Block: Georgian} (NOT \ep{Georgian} NOR \ep{Is_Georgian}) +\& (96: U+10A0..10FF) +\& \ep{Block: Georgian_Ext} \ep{Block=Georgian_Extended} (48) +\& \ep{Block: Georgian_Extended} (Short: \ep{Blk=GeorgianExt}) (48: +\& U+1C90..1CBF) +\& \ep{Block: Georgian_Sup} \ep{Block=Georgian_Supplement} (48) +\& \ep{Block: Georgian_Supplement} (Short: \ep{Blk=GeorgianSup}) (48: +\& U+2D00..2D2F) +\& \ep{Block: Glagolitic} (NOT \ep{Glagolitic} NOR \ep{Is_Glagolitic}) +\& (96: U+2C00..2C5F) +\& \ep{Block: Glagolitic_Sup} \ep{Block=Glagolitic_Supplement} (48) +\& \ep{Block: Glagolitic_Supplement} (Short: \ep{Blk=GlagoliticSup}) +\& (48: U+1E000..1E02F) +\& \ep{Block: Gothic} (NOT \ep{Gothic} NOR \ep{Is_Gothic}) (32: +\& U+10330..1034F) +\& \ep{Block: Grantha} (NOT \ep{Grantha} NOR \ep{Is_Grantha}) (128: +\& U+11300..1137F) +\& \ep{Block: Greek} \ep{Block=Greek_And_Coptic} (NOT \ep{Greek} +\& NOR \ep{Is_Greek}) (144) +\& \ep{Block: Greek_And_Coptic} (Short: \ep{Blk=Greek}; NOT \ep{Greek} +\& NOR \ep{Is_Greek}) (144: U+0370..03FF) +\& \ep{Block: Greek_Ext} \ep{Block=Greek_Extended} (256) +\& \ep{Block: Greek_Extended} (Short: \ep{Blk=GreekExt}) (256: +\& U+1F00..1FFF) +\& \ep{Block: Gujarati} (NOT \ep{Gujarati} NOR \ep{Is_Gujarati}) +\& (128: U+0A80..0AFF) +\& \ep{Block: Gunjala_Gondi} (NOT \ep{Gunjala_Gondi} NOR +\& \ep{Is_Gunjala_Gondi}) (80: +\& U+11D60..11DAF) +\& \ep{Block: Gurmukhi} (NOT \ep{Gurmukhi} NOR \ep{Is_Gurmukhi}) +\& (128: U+0A00..0A7F) +\& \ep{Block: Half_And_Full_Forms} \ep{Block= +\& Halfwidth_And_Fullwidth_Forms} (240) +\& \ep{Block: Half_Marks} \ep{Block=Combining_Half_Marks} (16) +\& \ep{Block: Halfwidth_And_Fullwidth_Forms} (Short: \ep{Blk= +\& HalfAndFullForms}) (240: U+FF00..FFEF) +\& \ep{Block: Hangul} \ep{Block=Hangul_Syllables} (NOT \ep{Hangul} +\& NOR \ep{Is_Hangul}) (11_184) +\& \ep{Block: Hangul_Compatibility_Jamo} (Short: \ep{Blk=CompatJamo}) +\& (96: U+3130..318F) +\& \ep{Block: Hangul_Jamo} (Short: \ep{Blk=Jamo}) (256: U+1100..11FF) +\& \ep{Block: Hangul_Jamo_Extended_A} (Short: \ep{Blk=JamoExtA}) (32: +\& U+A960..A97F) +\& \ep{Block: Hangul_Jamo_Extended_B} (Short: \ep{Blk=JamoExtB}) (80: +\& U+D7B0..D7FF) +\& \ep{Block: Hangul_Syllables} (Short: \ep{Blk=Hangul}; NOT \ep{Hangul} +\& NOR \ep{Is_Hangul}) (11_184: U+AC00..D7AF) +\& \ep{Block: Hanifi_Rohingya} (NOT \ep{Hanifi_Rohingya} NOR +\& \ep{Is_Hanifi_Rohingya}) (64: +\& U+10D00..10D3F) +\& \ep{Block: Hanunoo} (NOT \ep{Hanunoo} NOR \ep{Is_Hanunoo}) (32: +\& U+1720..173F) +\& \ep{Block: Hatran} (NOT \ep{Hatran} NOR \ep{Is_Hatran}) (32: +\& U+108E0..108FF) +\& \ep{Block: Hebrew} (NOT \ep{Hebrew} NOR \ep{Is_Hebrew}) (112: +\& U+0590..05FF) +\& \ep{Block: High_Private_Use_Surrogates} (Short: \ep{Blk= +\& HighPUSurrogates}) (128: U+DB80..DBFF) +\& \ep{Block: High_PU_Surrogates} \ep{Block= +\& High_Private_Use_Surrogates} (128) +\& \ep{Block: High_Surrogates} (896: U+D800..DB7F) +\& \ep{Block: Hiragana} (NOT \ep{Hiragana} NOR \ep{Is_Hiragana}) +\& (96: U+3040..309F) +\& \ep{Block: IDC} \ep{Block= +\& Ideographic_Description_Characters} (NOT +\& \ep{ID_Continue} NOR \ep{Is_IDC}) (16) +\& \ep{Block: Ideographic_Description_Characters} (Short: \ep{Blk=IDC}; +\& NOT \ep{ID_Continue} NOR \ep{Is_IDC}) (16: +\& U+2FF0..2FFF) +\& \ep{Block: Ideographic_Symbols} \ep{Block= +\& Ideographic_Symbols_And_Punctuation} (32) +\& \ep{Block: Ideographic_Symbols_And_Punctuation} (Short: \ep{Blk= +\& IdeographicSymbols}) (32: U+16FE0..16FFF) +\& \ep{Block: Imperial_Aramaic} (NOT \ep{Imperial_Aramaic} NOR +\& \ep{Is_Imperial_Aramaic}) (32: +\& U+10840..1085F) +\& \ep{Block: Indic_Number_Forms} \ep{Block=Common_Indic_Number_Forms} +\& (16) +\& \ep{Block: Indic_Siyaq_Numbers} (80: U+1EC70..1ECBF) +\& \ep{Block: Inscriptional_Pahlavi} (NOT \ep{Inscriptional_Pahlavi} +\& NOR \ep{Is_Inscriptional_Pahlavi}) (32: +\& U+10B60..10B7F) +\& \ep{Block: Inscriptional_Parthian} (NOT \ep{Inscriptional_Parthian} +\& NOR \ep{Is_Inscriptional_Parthian}) (32: +\& U+10B40..10B5F) +\& \ep{Block: IPA_Ext} \ep{Block=IPA_Extensions} (96) +\& \ep{Block: IPA_Extensions} (Short: \ep{Blk=IPAExt}) (96: +\& U+0250..02AF) +\& \ep{Block: Jamo} \ep{Block=Hangul_Jamo} (256) +\& \ep{Block: Jamo_Ext_A} \ep{Block=Hangul_Jamo_Extended_A} (32) +\& \ep{Block: Jamo_Ext_B} \ep{Block=Hangul_Jamo_Extended_B} (80) +\& \ep{Block: Javanese} (NOT \ep{Javanese} NOR \ep{Is_Javanese}) +\& (96: U+A980..A9DF) +\& \ep{Block: Kaithi} (NOT \ep{Kaithi} NOR \ep{Is_Kaithi}) (80: +\& U+11080..110CF) +\& \ep{Block: Kana_Ext_A} \ep{Block=Kana_Extended_A} (48) +\& \ep{Block: Kana_Extended_A} (Short: \ep{Blk=KanaExtA}) (48: +\& U+1B100..1B12F) +\& \ep{Block: Kana_Sup} \ep{Block=Kana_Supplement} (256) +\& \ep{Block: Kana_Supplement} (Short: \ep{Blk=KanaSup}) (256: +\& U+1B000..1B0FF) +\& \ep{Block: Kanbun} (16: U+3190..319F) +\& \ep{Block: Kangxi} \ep{Block=Kangxi_Radicals} (224) +\& \ep{Block: Kangxi_Radicals} (Short: \ep{Blk=Kangxi}) (224: +\& U+2F00..2FDF) +\& \ep{Block: Kannada} (NOT \ep{Kannada} NOR \ep{Is_Kannada}) (128: +\& U+0C80..0CFF) +\& \ep{Block: Katakana} (NOT \ep{Katakana} NOR \ep{Is_Katakana}) +\& (96: U+30A0..30FF) +\& \ep{Block: Katakana_Ext} \ep{Block=Katakana_Phonetic_Extensions} (16) +\& \ep{Block: Katakana_Phonetic_Extensions} (Short: \ep{Blk= +\& KatakanaExt}) (16: U+31F0..31FF) +\& \ep{Block: Kayah_Li} (48: U+A900..A92F) +\& \ep{Block: Kharoshthi} (NOT \ep{Kharoshthi} NOR \ep{Is_Kharoshthi}) +\& (96: U+10A00..10A5F) +\& \ep{Block: Khitan_Small_Script} (NOT \ep{Khitan_Small_Script} NOR +\& \ep{Is_Khitan_Small_Script}) (512: +\& U+18B00..18CFF) +\& \ep{Block: Khmer} (NOT \ep{Khmer} NOR \ep{Is_Khmer}) (128: +\& U+1780..17FF) +\& \ep{Block: Khmer_Symbols} (32: U+19E0..19FF) +\& \ep{Block: Khojki} (NOT \ep{Khojki} NOR \ep{Is_Khojki}) (80: +\& U+11200..1124F) +\& \ep{Block: Khudawadi} (NOT \ep{Khudawadi} NOR \ep{Is_Khudawadi}) +\& (80: U+112B0..112FF) +\& \ep{Block: Lao} (NOT \ep{Lao} NOR \ep{Is_Lao}) (128: +\& U+0E80..0EFF) +\& \ep{Block: Latin_1} \ep{Block=Latin_1_Supplement} (128) +\& \ep{Block: Latin_1_Sup} \ep{Block=Latin_1_Supplement} (128) +\& \ep{Block: Latin_1_Supplement} (Short: \ep{Blk=Latin1}) (128: [\ex80\- +\& \exff]) +\& \ep{Block: Latin_Ext_A} \ep{Block=Latin_Extended_A} (128) +\& \ep{Block: Latin_Ext_Additional} \ep{Block= +\& Latin_Extended_Additional} (256) +\& \ep{Block: Latin_Ext_B} \ep{Block=Latin_Extended_B} (208) +\& \ep{Block: Latin_Ext_C} \ep{Block=Latin_Extended_C} (32) +\& \ep{Block: Latin_Ext_D} \ep{Block=Latin_Extended_D} (224) +\& \ep{Block: Latin_Ext_E} \ep{Block=Latin_Extended_E} (64) +\& \ep{Block: Latin_Extended_A} (Short: \ep{Blk=LatinExtA}) (128: +\& U+0100..017F) +\& \ep{Block: Latin_Extended_Additional} (Short: \ep{Blk= +\& LatinExtAdditional}) (256: U+1E00..1EFF) +\& \ep{Block: Latin_Extended_B} (Short: \ep{Blk=LatinExtB}) (208: +\& U+0180..024F) +\& \ep{Block: Latin_Extended_C} (Short: \ep{Blk=LatinExtC}) (32: +\& U+2C60..2C7F) +\& \ep{Block: Latin_Extended_D} (Short: \ep{Blk=LatinExtD}) (224: +\& U+A720..A7FF) +\& \ep{Block: Latin_Extended_E} (Short: \ep{Blk=LatinExtE}) (64: +\& U+AB30..AB6F) +\& \ep{Block: Lepcha} (NOT \ep{Lepcha} NOR \ep{Is_Lepcha}) (80: +\& U+1C00..1C4F) +\& \ep{Block: Letterlike_Symbols} (80: U+2100..214F) +\& \ep{Block: Limbu} (NOT \ep{Limbu} NOR \ep{Is_Limbu}) (80: +\& U+1900..194F) +\& \ep{Block: Linear_A} (NOT \ep{Linear_A} NOR \ep{Is_Linear_A}) +\& (384: U+10600..1077F) +\& \ep{Block: Linear_B_Ideograms} (128: U+10080..100FF) +\& \ep{Block: Linear_B_Syllabary} (128: U+10000..1007F) +\& \ep{Block: Lisu} (NOT \ep{Lisu} NOR \ep{Is_Lisu}) (48: +\& U+A4D0..A4FF) +\& \ep{Block: Lisu_Sup} \ep{Block=Lisu_Supplement} (16) +\& \ep{Block: Lisu_Supplement} (Short: \ep{Blk=LisuSup}) (16: +\& U+11FB0..11FBF) +\& \ep{Block: Low_Surrogates} (1024: U+DC00..DFFF) +\& \ep{Block: Lycian} (NOT \ep{Lycian} NOR \ep{Is_Lycian}) (32: +\& U+10280..1029F) +\& \ep{Block: Lydian} (NOT \ep{Lydian} NOR \ep{Is_Lydian}) (32: +\& U+10920..1093F) +\& \ep{Block: Mahajani} (NOT \ep{Mahajani} NOR \ep{Is_Mahajani}) +\& (48: U+11150..1117F) +\& \ep{Block: Mahjong} \ep{Block=Mahjong_Tiles} (48) +\& \ep{Block: Mahjong_Tiles} (Short: \ep{Blk=Mahjong}) (48: +\& U+1F000..1F02F) +\& \ep{Block: Makasar} (NOT \ep{Makasar} NOR \ep{Is_Makasar}) (32: +\& U+11EE0..11EFF) +\& \ep{Block: Malayalam} (NOT \ep{Malayalam} NOR \ep{Is_Malayalam}) +\& (128: U+0D00..0D7F) +\& \ep{Block: Mandaic} (NOT \ep{Mandaic} NOR \ep{Is_Mandaic}) (32: +\& U+0840..085F) +\& \ep{Block: Manichaean} (NOT \ep{Manichaean} NOR \ep{Is_Manichaean}) +\& (64: U+10AC0..10AFF) +\& \ep{Block: Marchen} (NOT \ep{Marchen} NOR \ep{Is_Marchen}) (80: +\& U+11C70..11CBF) +\& \ep{Block: Masaram_Gondi} (NOT \ep{Masaram_Gondi} NOR +\& \ep{Is_Masaram_Gondi}) (96: +\& U+11D00..11D5F) +\& \ep{Block: Math_Alphanum} \ep{Block= +\& Mathematical_Alphanumeric_Symbols} (1024) +\& \ep{Block: Math_Operators} \ep{Block=Mathematical_Operators} (256) +\& \ep{Block: Mathematical_Alphanumeric_Symbols} (Short: \ep{Blk= +\& MathAlphanum}) (1024: U+1D400..1D7FF) +\& \ep{Block: Mathematical_Operators} (Short: \ep{Blk=MathOperators}) +\& (256: U+2200..22FF) +\& \ep{Block: Mayan_Numerals} (32: U+1D2E0..1D2FF) +\& \ep{Block: Medefaidrin} (NOT \ep{Medefaidrin} NOR +\& \ep{Is_Medefaidrin}) (96: U+16E40..16E9F) +\& \ep{Block: Meetei_Mayek} (NOT \ep{Meetei_Mayek} NOR +\& \ep{Is_Meetei_Mayek}) (64: U+ABC0..ABFF) +\& \ep{Block: Meetei_Mayek_Ext} \ep{Block=Meetei_Mayek_Extensions} (32) +\& \ep{Block: Meetei_Mayek_Extensions} (Short: \ep{Blk=MeeteiMayekExt}) +\& (32: U+AAE0..AAFF) +\& \ep{Block: Mende_Kikakui} (NOT \ep{Mende_Kikakui} NOR +\& \ep{Is_Mende_Kikakui}) (224: +\& U+1E800..1E8DF) +\& \ep{Block: Meroitic_Cursive} (NOT \ep{Meroitic_Cursive} NOR +\& \ep{Is_Meroitic_Cursive}) (96: +\& U+109A0..109FF) +\& \ep{Block: Meroitic_Hieroglyphs} (32: U+10980..1099F) +\& \ep{Block: Miao} (NOT \ep{Miao} NOR \ep{Is_Miao}) (160: +\& U+16F00..16F9F) +\& \ep{Block: Misc_Arrows} \ep{Block=Miscellaneous_Symbols_And_Arrows} +\& (256) +\& \ep{Block: Misc_Math_Symbols_A} \ep{Block= +\& Miscellaneous_Mathematical_Symbols_A} +\& (48) +\& \ep{Block: Misc_Math_Symbols_B} \ep{Block= +\& Miscellaneous_Mathematical_Symbols_B} +\& (128) +\& \ep{Block: Misc_Pictographs} \ep{Block= +\& Miscellaneous_Symbols_And_Pictographs} +\& (768) +\& \ep{Block: Misc_Symbols} \ep{Block=Miscellaneous_Symbols} (256) +\& \ep{Block: Misc_Technical} \ep{Block=Miscellaneous_Technical} (256) +\& \ep{Block: Miscellaneous_Mathematical_Symbols_A} (Short: \ep{Blk= +\& MiscMathSymbolsA}) (48: U+27C0..27EF) +\& \ep{Block: Miscellaneous_Mathematical_Symbols_B} (Short: \ep{Blk= +\& MiscMathSymbolsB}) (128: U+2980..29FF) +\& \ep{Block: Miscellaneous_Symbols} (Short: \ep{Blk=MiscSymbols}) +\& (256: U+2600..26FF) +\& \ep{Block: Miscellaneous_Symbols_And_Arrows} (Short: \ep{Blk= +\& MiscArrows}) (256: U+2B00..2BFF) +\& \ep{Block: Miscellaneous_Symbols_And_Pictographs} (Short: \ep{Blk= +\& MiscPictographs}) (768: U+1F300..1F5FF) +\& \ep{Block: Miscellaneous_Technical} (Short: \ep{Blk=MiscTechnical}) +\& (256: U+2300..23FF) +\& \ep{Block: Modi} (NOT \ep{Modi} NOR \ep{Is_Modi}) (96: +\& U+11600..1165F) +\& \ep{Block: Modifier_Letters} \ep{Block=Spacing_Modifier_Letters} (80) +\& \ep{Block: Modifier_Tone_Letters} (32: U+A700..A71F) +\& \ep{Block: Mongolian} (NOT \ep{Mongolian} NOR \ep{Is_Mongolian}) +\& (176: U+1800..18AF) +\& \ep{Block: Mongolian_Sup} \ep{Block=Mongolian_Supplement} (32) +\& \ep{Block: Mongolian_Supplement} (Short: \ep{Blk=MongolianSup}) (32: +\& U+11660..1167F) +\& \ep{Block: Mro} (NOT \ep{Mro} NOR \ep{Is_Mro}) (48: +\& U+16A40..16A6F) +\& \ep{Block: Multani} (NOT \ep{Multani} NOR \ep{Is_Multani}) (48: +\& U+11280..112AF) +\& \ep{Block: Music} \ep{Block=Musical_Symbols} (256) +\& \ep{Block: Musical_Symbols} (Short: \ep{Blk=Music}) (256: +\& U+1D100..1D1FF) +\& \ep{Block: Myanmar} (NOT \ep{Myanmar} NOR \ep{Is_Myanmar}) (160: +\& U+1000..109F) +\& \ep{Block: Myanmar_Ext_A} \ep{Block=Myanmar_Extended_A} (32) +\& \ep{Block: Myanmar_Ext_B} \ep{Block=Myanmar_Extended_B} (32) +\& \ep{Block: Myanmar_Extended_A} (Short: \ep{Blk=MyanmarExtA}) (32: +\& U+AA60..AA7F) +\& \ep{Block: Myanmar_Extended_B} (Short: \ep{Blk=MyanmarExtB}) (32: +\& U+A9E0..A9FF) +\& \ep{Block: Nabataean} (NOT \ep{Nabataean} NOR \ep{Is_Nabataean}) +\& (48: U+10880..108AF) +\& \ep{Block: Nandinagari} (NOT \ep{Nandinagari} NOR +\& \ep{Is_Nandinagari}) (96: U+119A0..119FF) +\& \ep{Block: NB} \ep{Block=No_Block} (826_640 plus all +\& above\-Unicode code points) +\& \ep{Block: New_Tai_Lue} (NOT \ep{New_Tai_Lue} NOR +\& \ep{Is_New_Tai_Lue}) (96: U+1980..19DF) +\& \ep{Block: Newa} (NOT \ep{Newa} NOR \ep{Is_Newa}) (128: +\& U+11400..1147F) +\& \ep{Block: NKo} (NOT \ep{Nko} NOR \ep{Is_NKo}) (64: +\& U+07C0..07FF) +\& \ep{Block: No_Block} (Short: \ep{Blk=NB}) (826_640 plus all +\& above\-Unicode code points: U+0870..089F, +\& U+2FE0..2FEF, U+10200..1027F, +\& U+103E0..103FF, U+10570..105FF, +\& U+10780..107FF ...) +\& \ep{Block: Number_Forms} (64: U+2150..218F) +\& \ep{Block: Nushu} (NOT \ep{Nushu} NOR \ep{Is_Nushu}) (400: +\& U+1B170..1B2FF) +\& \ep{Block: Nyiakeng_Puachue_Hmong} (NOT \ep{Nyiakeng_Puachue_Hmong} +\& NOR \ep{Is_Nyiakeng_Puachue_Hmong}) (80: +\& U+1E100..1E14F) +\& \ep{Block: OCR} \ep{Block=Optical_Character_Recognition} +\& (32) +\& \ep{Block: Ogham} (NOT \ep{Ogham} NOR \ep{Is_Ogham}) (32: +\& U+1680..169F) +\& \ep{Block: Ol_Chiki} (48: U+1C50..1C7F) +\& \ep{Block: Old_Hungarian} (NOT \ep{Old_Hungarian} NOR +\& \ep{Is_Old_Hungarian}) (128: +\& U+10C80..10CFF) +\& \ep{Block: Old_Italic} (NOT \ep{Old_Italic} NOR \ep{Is_Old_Italic}) +\& (48: U+10300..1032F) +\& \ep{Block: Old_North_Arabian} (32: U+10A80..10A9F) +\& \ep{Block: Old_Permic} (NOT \ep{Old_Permic} NOR \ep{Is_Old_Permic}) +\& (48: U+10350..1037F) +\& \ep{Block: Old_Persian} (NOT \ep{Old_Persian} NOR +\& \ep{Is_Old_Persian}) (64: U+103A0..103DF) +\& \ep{Block: Old_Sogdian} (NOT \ep{Old_Sogdian} NOR +\& \ep{Is_Old_Sogdian}) (48: U+10F00..10F2F) +\& \ep{Block: Old_South_Arabian} (32: U+10A60..10A7F) +\& \ep{Block: Old_Turkic} (NOT \ep{Old_Turkic} NOR \ep{Is_Old_Turkic}) +\& (80: U+10C00..10C4F) +\& \ep{Block: Optical_Character_Recognition} (Short: \ep{Blk=OCR}) (32: +\& U+2440..245F) +\& \ep{Block: Oriya} (NOT \ep{Oriya} NOR \ep{Is_Oriya}) (128: +\& U+0B00..0B7F) +\& \ep{Block: Ornamental_Dingbats} (48: U+1F650..1F67F) +\& \ep{Block: Osage} (NOT \ep{Osage} NOR \ep{Is_Osage}) (80: +\& U+104B0..104FF) +\& \ep{Block: Osmanya} (NOT \ep{Osmanya} NOR \ep{Is_Osmanya}) (48: +\& U+10480..104AF) +\& \ep{Block: Ottoman_Siyaq_Numbers} (80: U+1ED00..1ED4F) +\& \ep{Block: Pahawh_Hmong} (NOT \ep{Pahawh_Hmong} NOR +\& \ep{Is_Pahawh_Hmong}) (144: +\& U+16B00..16B8F) +\& \ep{Block: Palmyrene} (32: U+10860..1087F) +\& \ep{Block: Pau_Cin_Hau} (NOT \ep{Pau_Cin_Hau} NOR +\& \ep{Is_Pau_Cin_Hau}) (64: U+11AC0..11AFF) +\& \ep{Block: Phags_Pa} (NOT \ep{Phags_Pa} NOR \ep{Is_Phags_Pa}) +\& (64: U+A840..A87F) +\& \ep{Block: Phaistos} \ep{Block=Phaistos_Disc} (48) +\& \ep{Block: Phaistos_Disc} (Short: \ep{Blk=Phaistos}) (48: +\& U+101D0..101FF) +\& \ep{Block: Phoenician} (NOT \ep{Phoenician} NOR \ep{Is_Phoenician}) +\& (32: U+10900..1091F) +\& \ep{Block: Phonetic_Ext} \ep{Block=Phonetic_Extensions} (128) +\& \ep{Block: Phonetic_Ext_Sup} \ep{Block= +\& Phonetic_Extensions_Supplement} (64) +\& \ep{Block: Phonetic_Extensions} (Short: \ep{Blk=PhoneticExt}) (128: +\& U+1D00..1D7F) +\& \ep{Block: Phonetic_Extensions_Supplement} (Short: \ep{Blk= +\& PhoneticExtSup}) (64: U+1D80..1DBF) +\& \ep{Block: Playing_Cards} (96: U+1F0A0..1F0FF) +\& \ep{Block: Private_Use} \ep{Block=Private_Use_Area} (NOT +\& \ep{Private_Use} NOR \ep{Is_Private_Use}) +\& (6400) +\& \ep{Block: Private_Use_Area} (Short: \ep{Blk=PUA}; NOT +\& \ep{Private_Use} NOR \ep{Is_Private_Use}) +\& (6400: U+E000..F8FF) +\& \ep{Block: Psalter_Pahlavi} (NOT \ep{Psalter_Pahlavi} NOR +\& \ep{Is_Psalter_Pahlavi}) (48: +\& U+10B80..10BAF) +\& \ep{Block: PUA} \ep{Block=Private_Use_Area} (NOT +\& \ep{Private_Use} NOR \ep{Is_Private_Use}) +\& (6400) +\& \ep{Block: Punctuation} \ep{Block=General_Punctuation} (NOT +\& \ep{Punct} NOR \ep{Is_Punctuation}) (112) +\& \ep{Block: Rejang} (NOT \ep{Rejang} NOR \ep{Is_Rejang}) (48: +\& U+A930..A95F) +\& \ep{Block: Rumi} \ep{Block=Rumi_Numeral_Symbols} (32) +\& \ep{Block: Rumi_Numeral_Symbols} (Short: \ep{Blk=Rumi}) (32: +\& U+10E60..10E7F) +\& \ep{Block: Runic} (NOT \ep{Runic} NOR \ep{Is_Runic}) (96: +\& U+16A0..16FF) +\& \ep{Block: Samaritan} (NOT \ep{Samaritan} NOR \ep{Is_Samaritan}) +\& (64: U+0800..083F) +\& \ep{Block: Saurashtra} (NOT \ep{Saurashtra} NOR \ep{Is_Saurashtra}) +\& (96: U+A880..A8DF) +\& \ep{Block: Sharada} (NOT \ep{Sharada} NOR \ep{Is_Sharada}) (96: +\& U+11180..111DF) +\& \ep{Block: Shavian} (48: U+10450..1047F) +\& \ep{Block: Shorthand_Format_Controls} (16: U+1BCA0..1BCAF) +\& \ep{Block: Siddham} (NOT \ep{Siddham} NOR \ep{Is_Siddham}) (128: +\& U+11580..115FF) +\& \ep{Block: Sinhala} (NOT \ep{Sinhala} NOR \ep{Is_Sinhala}) (128: +\& U+0D80..0DFF) +\& \ep{Block: Sinhala_Archaic_Numbers} (32: U+111E0..111FF) +\& \ep{Block: Small_Form_Variants} (Short: \ep{Blk=SmallForms}) (32: +\& U+FE50..FE6F) +\& \ep{Block: Small_Forms} \ep{Block=Small_Form_Variants} (32) +\& \ep{Block: Small_Kana_Ext} \ep{Block=Small_Kana_Extension} (64) +\& \ep{Block: Small_Kana_Extension} (Short: \ep{Blk=SmallKanaExt}) (64: +\& U+1B130..1B16F) +\& \ep{Block: Sogdian} (NOT \ep{Sogdian} NOR \ep{Is_Sogdian}) (64: +\& U+10F30..10F6F) +\& \ep{Block: Sora_Sompeng} (NOT \ep{Sora_Sompeng} NOR +\& \ep{Is_Sora_Sompeng}) (48: U+110D0..110FF) +\& \ep{Block: Soyombo} (NOT \ep{Soyombo} NOR \ep{Is_Soyombo}) (96: +\& U+11A50..11AAF) +\& \ep{Block: Spacing_Modifier_Letters} (Short: \ep{Blk= +\& ModifierLetters}) (80: U+02B0..02FF) +\& \ep{Block: Specials} (16: U+FFF0..FFFF) +\& \ep{Block: Sundanese} (NOT \ep{Sundanese} NOR \ep{Is_Sundanese}) +\& (64: U+1B80..1BBF) +\& \ep{Block: Sundanese_Sup} \ep{Block=Sundanese_Supplement} (16) +\& \ep{Block: Sundanese_Supplement} (Short: \ep{Blk=SundaneseSup}) (16: +\& U+1CC0..1CCF) +\& \ep{Block: Sup_Arrows_A} \ep{Block=Supplemental_Arrows_A} (16) +\& \ep{Block: Sup_Arrows_B} \ep{Block=Supplemental_Arrows_B} (128) +\& \ep{Block: Sup_Arrows_C} \ep{Block=Supplemental_Arrows_C} (256) +\& \ep{Block: Sup_Math_Operators} \ep{Block= +\& Supplemental_Mathematical_Operators} +\& (256) +\& \ep{Block: Sup_PUA_A} \ep{Block=Supplementary_Private_Use_Area_A} +\& (65_536) +\& \ep{Block: Sup_PUA_B} \ep{Block=Supplementary_Private_Use_Area_B} +\& (65_536) +\& \ep{Block: Sup_Punctuation} \ep{Block=Supplemental_Punctuation} (128) +\& \ep{Block: Sup_Symbols_And_Pictographs} \ep{Block= +\& Supplemental_Symbols_And_Pictographs} +\& (256) +\& \ep{Block: Super_And_Sub} \ep{Block=Superscripts_And_Subscripts} (48) +\& \ep{Block: Superscripts_And_Subscripts} (Short: \ep{Blk= +\& SuperAndSub}) (48: U+2070..209F) +\& \ep{Block: Supplemental_Arrows_A} (Short: \ep{Blk=SupArrowsA}) (16: +\& U+27F0..27FF) +\& \ep{Block: Supplemental_Arrows_B} (Short: \ep{Blk=SupArrowsB}) (128: +\& U+2900..297F) +\& \ep{Block: Supplemental_Arrows_C} (Short: \ep{Blk=SupArrowsC}) (256: +\& U+1F800..1F8FF) +\& \ep{Block: Supplemental_Mathematical_Operators} (Short: \ep{Blk= +\& SupMathOperators}) (256: U+2A00..2AFF) +\& \ep{Block: Supplemental_Punctuation} (Short: \ep{Blk= +\& SupPunctuation}) (128: U+2E00..2E7F) +\& \ep{Block: Supplemental_Symbols_And_Pictographs} (Short: \ep{Blk= +\& SupSymbolsAndPictographs}) (256: +\& U+1F900..1F9FF) +\& \ep{Block: Supplementary_Private_Use_Area_A} (Short: \ep{Blk= +\& SupPUAA}) (65_536: U+F0000..FFFFF) +\& \ep{Block: Supplementary_Private_Use_Area_B} (Short: \ep{Blk= +\& SupPUAB}) (65_536: U+100000..10FFFF) +\& \ep{Block: Sutton_SignWriting} (688: U+1D800..1DAAF) +\& \ep{Block: Syloti_Nagri} (NOT \ep{Syloti_Nagri} NOR +\& \ep{Is_Syloti_Nagri}) (48: U+A800..A82F) +\& \ep{Block: Symbols_And_Pictographs_Ext_A} \ep{Block= +\& Symbols_And_Pictographs_Extended_A} (144) +\& \ep{Block: Symbols_And_Pictographs_Extended_A} (Short: \ep{Blk= +\& SymbolsAndPictographsExtA}) (144: +\& U+1FA70..1FAFF) +\& \ep{Block: Symbols_For_Legacy_Computing} (256: U+1FB00..1FBFF) +\& \ep{Block: Syriac} (NOT \ep{Syriac} NOR \ep{Is_Syriac}) (80: +\& U+0700..074F) +\& \ep{Block: Syriac_Sup} \ep{Block=Syriac_Supplement} (16) +\& \ep{Block: Syriac_Supplement} (Short: \ep{Blk=SyriacSup}) (16: +\& U+0860..086F) +\& \ep{Block: Tagalog} (NOT \ep{Tagalog} NOR \ep{Is_Tagalog}) (32: +\& U+1700..171F) +\& \ep{Block: Tagbanwa} (NOT \ep{Tagbanwa} NOR \ep{Is_Tagbanwa}) +\& (32: U+1760..177F) +\& \ep{Block: Tags} (128: U+E0000..E007F) +\& \ep{Block: Tai_Le} (NOT \ep{Tai_Le} NOR \ep{Is_Tai_Le}) (48: +\& U+1950..197F) +\& \ep{Block: Tai_Tham} (NOT \ep{Tai_Tham} NOR \ep{Is_Tai_Tham}) +\& (144: U+1A20..1AAF) +\& \ep{Block: Tai_Viet} (NOT \ep{Tai_Viet} NOR \ep{Is_Tai_Viet}) +\& (96: U+AA80..AADF) +\& \ep{Block: Tai_Xuan_Jing} \ep{Block=Tai_Xuan_Jing_Symbols} (96) +\& \ep{Block: Tai_Xuan_Jing_Symbols} (Short: \ep{Blk=TaiXuanJing}) (96: +\& U+1D300..1D35F) +\& \ep{Block: Takri} (NOT \ep{Takri} NOR \ep{Is_Takri}) (80: +\& U+11680..116CF) +\& \ep{Block: Tamil} (NOT \ep{Tamil} NOR \ep{Is_Tamil}) (128: +\& U+0B80..0BFF) +\& \ep{Block: Tamil_Sup} \ep{Block=Tamil_Supplement} (64) +\& \ep{Block: Tamil_Supplement} (Short: \ep{Blk=TamilSup}) (64: +\& U+11FC0..11FFF) +\& \ep{Block: Tangut} (NOT \ep{Tangut} NOR \ep{Is_Tangut}) (6144: +\& U+17000..187FF) +\& \ep{Block: Tangut_Components} (768: U+18800..18AFF) +\& \ep{Block: Tangut_Sup} \ep{Block=Tangut_Supplement} (144) +\& \ep{Block: Tangut_Supplement} (Short: \ep{Blk=TangutSup}) (144: +\& U+18D00..18D8F) +\& \ep{Block: Telugu} (NOT \ep{Telugu} NOR \ep{Is_Telugu}) (128: +\& U+0C00..0C7F) +\& \ep{Block: Thaana} (NOT \ep{Thaana} NOR \ep{Is_Thaana}) (64: +\& U+0780..07BF) +\& \ep{Block: Thai} (NOT \ep{Thai} NOR \ep{Is_Thai}) (128: +\& U+0E00..0E7F) +\& \ep{Block: Tibetan} (NOT \ep{Tibetan} NOR \ep{Is_Tibetan}) (256: +\& U+0F00..0FFF) +\& \ep{Block: Tifinagh} (NOT \ep{Tifinagh} NOR \ep{Is_Tifinagh}) +\& (80: U+2D30..2D7F) +\& \ep{Block: Tirhuta} (NOT \ep{Tirhuta} NOR \ep{Is_Tirhuta}) (96: +\& U+11480..114DF) +\& \ep{Block: Transport_And_Map} \ep{Block=Transport_And_Map_Symbols} +\& (128) +\& \ep{Block: Transport_And_Map_Symbols} (Short: \ep{Blk= +\& TransportAndMap}) (128: U+1F680..1F6FF) +\& \ep{Block: UCAS} \ep{Block= +\& Unified_Canadian_Aboriginal_Syllabics} +\& (640) +\& \ep{Block: UCAS_Ext} \ep{Block= +\& Unified_Canadian_Aboriginal_Syllabics_\- +\& Extended} (80) +\& \ep{Block: Ugaritic} (NOT \ep{Ugaritic} NOR \ep{Is_Ugaritic}) +\& (32: U+10380..1039F) +\& \ep{Block: Unified_Canadian_Aboriginal_Syllabics} (Short: \ep{Blk= +\& UCAS}) (640: U+1400..167F) +\& \ep{Block: Unified_Canadian_Aboriginal_Syllabics_Extended} (Short: +\& \ep{Blk=UCASExt}) (80: U+18B0..18FF) +\& \ep{Block: Vai} (NOT \ep{Vai} NOR \ep{Is_Vai}) (320: +\& U+A500..A63F) +\& \ep{Block: Variation_Selectors} (Short: \ep{Blk=VS}; NOT +\& \ep{Variation_Selector} NOR \ep{Is_VS}) +\& (16: U+FE00..FE0F) +\& \ep{Block: Variation_Selectors_Supplement} (Short: \ep{Blk=VSSup}) +\& (240: U+E0100..E01EF) +\& \ep{Block: Vedic_Ext} \ep{Block=Vedic_Extensions} (48) +\& \ep{Block: Vedic_Extensions} (Short: \ep{Blk=VedicExt}) (48: +\& U+1CD0..1CFF) +\& \ep{Block: Vertical_Forms} (16: U+FE10..FE1F) +\& \ep{Block: VS} \ep{Block=Variation_Selectors} (NOT +\& \ep{Variation_Selector} NOR \ep{Is_VS}) +\& (16) +\& \ep{Block: VS_Sup} \ep{Block=Variation_Selectors_Supplement} +\& (240) +\& \ep{Block: Wancho} (NOT \ep{Wancho} NOR \ep{Is_Wancho}) (64: +\& U+1E2C0..1E2FF) +\& \ep{Block: Warang_Citi} (NOT \ep{Warang_Citi} NOR +\& \ep{Is_Warang_Citi}) (96: U+118A0..118FF) +\& \ep{Block: Yezidi} (NOT \ep{Yezidi} NOR \ep{Is_Yezidi}) (64: +\& U+10E80..10EBF) +\& \ep{Block: Yi_Radicals} (64: U+A490..A4CF) +\& \ep{Block: Yi_Syllables} (1168: U+A000..A48F) +\& \ep{Block: Yijing} \ep{Block=Yijing_Hexagram_Symbols} (64) +\& \ep{Block: Yijing_Hexagram_Symbols} (Short: \ep{Blk=Yijing}) (64: +\& U+4DC0..4DFF) +\& \ep{Block: Zanabazar_Square} (NOT \ep{Zanabazar_Square} NOR +\& \ep{Is_Zanabazar_Square}) (80: +\& U+11A00..11A4F) +\& X \ep{Block_Elements} \ep{Block=Block_Elements} (32) +\& \ep{Bopo} \ep{Bopomofo} (= \ep{Script_Extensions= +\& Bopomofo}) (NOT \ep{Block=Bopomofo}) (117) +\& \ep{Bopomofo} \ep{Script_Extensions=Bopomofo} (Short: +\& \ep{Bopo}; NOT \ep{Block=Bopomofo}) (117) +\& X \ep{Bopomofo_Ext} \ep{Bopomofo_Extended} (= \ep{Block= +\& Bopomofo_Extended}) (32) +\& X \ep{Bopomofo_Extended} \ep{Block=Bopomofo_Extended} (Short: +\& \ep{InBopomofoExt}) (32) +\& X \ep{Box_Drawing} \ep{Block=Box_Drawing} (128) +\& \ep{Bpt: *} \ep{Bidi_Paired_Bracket_Type: *} +\& \ep{Brah} \ep{Brahmi} (= \ep{Script_Extensions= +\& Brahmi}) (NOT \ep{Block=Brahmi}) (109) +\& \ep{Brahmi} \ep{Script_Extensions=Brahmi} (Short: +\& \ep{Brah}; NOT \ep{Block=Brahmi}) (109) +\& \ep{Brai} \ep{Braille} (= \ep{Script_Extensions= +\& Braille}) (256) +\& \ep{Braille} \ep{Script_Extensions=Braille} (Short: +\& \ep{Brai}) (256) +\& X \ep{Braille_Patterns} \ep{Block=Braille_Patterns} (Short: +\& \ep{InBraille}) (256) +\& \ep{Bugi} \ep{Buginese} (= \ep{Script_Extensions= +\& Buginese}) (NOT \ep{Block=Buginese}) (31) +\& \ep{Buginese} \ep{Script_Extensions=Buginese} (Short: +\& \ep{Bugi}; NOT \ep{Block=Buginese}) (31) +\& \ep{Buhd} \ep{Buhid} (= \ep{Script_Extensions=Buhid}) +\& (NOT \ep{Block=Buhid}) (22) +\& \ep{Buhid} \ep{Script_Extensions=Buhid} (Short: +\& \ep{Buhd}; NOT \ep{Block=Buhid}) (22) +\& X \ep{Byzantine_Music} \ep{Byzantine_Musical_Symbols} (= \ep{Block= +\& Byzantine_Musical_Symbols}) (256) +\& X \ep{Byzantine_Musical_Symbols} \ep{Block=Byzantine_Musical_Symbols} +\& (Short: \ep{InByzantineMusic}) (256) +\& \ep{C} \epC \ep{Other} (= \ep{General_Category=Other}) +\& (970_414 plus all above\-Unicode code +\& points) +\& \ep{Cakm} \ep{Chakma} (= \ep{Script_Extensions= +\& Chakma}) (NOT \ep{Block=Chakma}) (91) +\& \ep{Canadian_Aboriginal} \ep{Script_Extensions=Canadian_Aboriginal} +\& (Short: \ep{Cans}) (710) +\& X \ep{Canadian_Syllabics} \ep{Unified_Canadian_Aboriginal_Syllabics} +\& (= \ep{Block= +\& Unified_Canadian_Aboriginal_Syllabics}) +\& (640) +\& T \ep{Canonical_Combining_Class: 0} \ep{Canonical_Combining_Class= +\& Not_Reordered} (1_113_240 plus all +\& above\-Unicode code points) +\& T \ep{Canonical_Combining_Class: 1} \ep{Canonical_Combining_Class= +\& Overlay} (32) +\& T \ep{Canonical_Combining_Class: 6} \ep{Canonical_Combining_Class= +\& Han_Reading} (2) +\& T \ep{Canonical_Combining_Class: 7} \ep{Canonical_Combining_Class= +\& Nukta} (26) +\& T \ep{Canonical_Combining_Class: 8} \ep{Canonical_Combining_Class= +\& Kana_Voicing} (2) +\& T \ep{Canonical_Combining_Class: 9} \ep{Canonical_Combining_Class= +\& Virama} (61) +\& T \ep{Canonical_Combining_Class: 10} \ep{Canonical_Combining_Class= +\& CCC10} (1) +\& \ep{Canonical_Combining_Class: CCC10} (Short: \ep{Ccc=CCC10}) (1: +\& U+05B0) +\& T \ep{Canonical_Combining_Class: 11} \ep{Canonical_Combining_Class= +\& CCC11} (1) +\& \ep{Canonical_Combining_Class: CCC11} (Short: \ep{Ccc=CCC11}) (1: +\& U+05B1) +\& T \ep{Canonical_Combining_Class: 12} \ep{Canonical_Combining_Class= +\& CCC12} (1) +\& \ep{Canonical_Combining_Class: CCC12} (Short: \ep{Ccc=CCC12}) (1: +\& U+05B2) +\& T \ep{Canonical_Combining_Class: 13} \ep{Canonical_Combining_Class= +\& CCC13} (1) +\& \ep{Canonical_Combining_Class: CCC13} (Short: \ep{Ccc=CCC13}) (1: +\& U+05B3) +\& T \ep{Canonical_Combining_Class: 14} \ep{Canonical_Combining_Class= +\& CCC14} (1) +\& \ep{Canonical_Combining_Class: CCC14} (Short: \ep{Ccc=CCC14}) (1: +\& U+05B4) +\& T \ep{Canonical_Combining_Class: 15} \ep{Canonical_Combining_Class= +\& CCC15} (1) +\& \ep{Canonical_Combining_Class: CCC15} (Short: \ep{Ccc=CCC15}) (1: +\& U+05B5) +\& T \ep{Canonical_Combining_Class: 16} \ep{Canonical_Combining_Class= +\& CCC16} (1) +\& \ep{Canonical_Combining_Class: CCC16} (Short: \ep{Ccc=CCC16}) (1: +\& U+05B6) +\& T \ep{Canonical_Combining_Class: 17} \ep{Canonical_Combining_Class= +\& CCC17} (1) +\& \ep{Canonical_Combining_Class: CCC17} (Short: \ep{Ccc=CCC17}) (1: +\& U+05B7) +\& T \ep{Canonical_Combining_Class: 18} \ep{Canonical_Combining_Class= +\& CCC18} (2) +\& \ep{Canonical_Combining_Class: CCC18} (Short: \ep{Ccc=CCC18}) (2: +\& U+05B8, U+05C7) +\& T \ep{Canonical_Combining_Class: 19} \ep{Canonical_Combining_Class= +\& CCC19} (2) +\& \ep{Canonical_Combining_Class: CCC19} (Short: \ep{Ccc=CCC19}) (2: +\& U+05B9..05BA) +\& T \ep{Canonical_Combining_Class: 20} \ep{Canonical_Combining_Class= +\& CCC20} (1) +\& \ep{Canonical_Combining_Class: CCC20} (Short: \ep{Ccc=CCC20}) (1: +\& U+05BB) +\& T \ep{Canonical_Combining_Class: 21} \ep{Canonical_Combining_Class= +\& CCC21} (1) +\& \ep{Canonical_Combining_Class: CCC21} (Short: \ep{Ccc=CCC21}) (1: +\& U+05BC) +\& T \ep{Canonical_Combining_Class: 22} \ep{Canonical_Combining_Class= +\& CCC22} (1) +\& \ep{Canonical_Combining_Class: CCC22} (Short: \ep{Ccc=CCC22}) (1: +\& U+05BD) +\& T \ep{Canonical_Combining_Class: 23} \ep{Canonical_Combining_Class= +\& CCC23} (1) +\& \ep{Canonical_Combining_Class: CCC23} (Short: \ep{Ccc=CCC23}) (1: +\& U+05BF) +\& T \ep{Canonical_Combining_Class: 24} \ep{Canonical_Combining_Class= +\& CCC24} (1) +\& \ep{Canonical_Combining_Class: CCC24} (Short: \ep{Ccc=CCC24}) (1: +\& U+05C1) +\& T \ep{Canonical_Combining_Class: 25} \ep{Canonical_Combining_Class= +\& CCC25} (1) +\& \ep{Canonical_Combining_Class: CCC25} (Short: \ep{Ccc=CCC25}) (1: +\& U+05C2) +\& T \ep{Canonical_Combining_Class: 26} \ep{Canonical_Combining_Class= +\& CCC26} (1) +\& \ep{Canonical_Combining_Class: CCC26} (Short: \ep{Ccc=CCC26}) (1: +\& U+FB1E) +\& T \ep{Canonical_Combining_Class: 27} \ep{Canonical_Combining_Class= +\& CCC27} (2) +\& \ep{Canonical_Combining_Class: CCC27} (Short: \ep{Ccc=CCC27}) (2: +\& U+064B, U+08F0) +\& T \ep{Canonical_Combining_Class: 28} \ep{Canonical_Combining_Class= +\& CCC28} (2) +\& \ep{Canonical_Combining_Class: CCC28} (Short: \ep{Ccc=CCC28}) (2: +\& U+064C, U+08F1) +\& T \ep{Canonical_Combining_Class: 29} \ep{Canonical_Combining_Class= +\& CCC29} (2) +\& \ep{Canonical_Combining_Class: CCC29} (Short: \ep{Ccc=CCC29}) (2: +\& U+064D, U+08F2) +\& T \ep{Canonical_Combining_Class: 30} \ep{Canonical_Combining_Class= +\& CCC30} (2) +\& \ep{Canonical_Combining_Class: CCC30} (Short: \ep{Ccc=CCC30}) (2: +\& U+0618, U+064E) +\& T \ep{Canonical_Combining_Class: 31} \ep{Canonical_Combining_Class= +\& CCC31} (2) +\& \ep{Canonical_Combining_Class: CCC31} (Short: \ep{Ccc=CCC31}) (2: +\& U+0619, U+064F) +\& T \ep{Canonical_Combining_Class: 32} \ep{Canonical_Combining_Class= +\& CCC32} (2) +\& \ep{Canonical_Combining_Class: CCC32} (Short: \ep{Ccc=CCC32}) (2: +\& U+061A, U+0650) +\& T \ep{Canonical_Combining_Class: 33} \ep{Canonical_Combining_Class= +\& CCC33} (1) +\& \ep{Canonical_Combining_Class: CCC33} (Short: \ep{Ccc=CCC33}) (1: +\& U+0651) +\& T \ep{Canonical_Combining_Class: 34} \ep{Canonical_Combining_Class= +\& CCC34} (1) +\& \ep{Canonical_Combining_Class: CCC34} (Short: \ep{Ccc=CCC34}) (1: +\& U+0652) +\& T \ep{Canonical_Combining_Class: 35} \ep{Canonical_Combining_Class= +\& CCC35} (1) +\& \ep{Canonical_Combining_Class: CCC35} (Short: \ep{Ccc=CCC35}) (1: +\& U+0670) +\& T \ep{Canonical_Combining_Class: 36} \ep{Canonical_Combining_Class= +\& CCC36} (1) +\& \ep{Canonical_Combining_Class: CCC36} (Short: \ep{Ccc=CCC36}) (1: +\& U+0711) +\& T \ep{Canonical_Combining_Class: 84} \ep{Canonical_Combining_Class= +\& CCC84} (1) +\& \ep{Canonical_Combining_Class: CCC84} (Short: \ep{Ccc=CCC84}) (1: +\& U+0C55) +\& T \ep{Canonical_Combining_Class: 91} \ep{Canonical_Combining_Class= +\& CCC91} (1) +\& \ep{Canonical_Combining_Class: CCC91} (Short: \ep{Ccc=CCC91}) (1: +\& U+0C56) +\& T \ep{Canonical_Combining_Class: 103} \ep{Canonical_Combining_Class= +\& CCC103} (2) +\& \ep{Canonical_Combining_Class: CCC103} (Short: \ep{Ccc=CCC103}) (2: +\& U+0E38..0E39) +\& T \ep{Canonical_Combining_Class: 107} \ep{Canonical_Combining_Class= +\& CCC107} (4) +\& \ep{Canonical_Combining_Class: CCC107} (Short: \ep{Ccc=CCC107}) (4: +\& U+0E48..0E4B) +\& T \ep{Canonical_Combining_Class: 118} \ep{Canonical_Combining_Class= +\& CCC118} (2) +\& \ep{Canonical_Combining_Class: CCC118} (Short: \ep{Ccc=CCC118}) (2: +\& U+0EB8..0EB9) +\& T \ep{Canonical_Combining_Class: 122} \ep{Canonical_Combining_Class= +\& CCC122} (4) +\& \ep{Canonical_Combining_Class: CCC122} (Short: \ep{Ccc=CCC122}) (4: +\& U+0EC8..0ECB) +\& T \ep{Canonical_Combining_Class: 129} \ep{Canonical_Combining_Class= +\& CCC129} (1) +\& \ep{Canonical_Combining_Class: CCC129} (Short: \ep{Ccc=CCC129}) (1: +\& U+0F71) +\& T \ep{Canonical_Combining_Class: 130} \ep{Canonical_Combining_Class= +\& CCC130} (6) +\& \ep{Canonical_Combining_Class: CCC130} (Short: \ep{Ccc=CCC130}) (6: +\& U+0F72, U+0F7A..0F7D, U+0F80) +\& T \ep{Canonical_Combining_Class: 132} \ep{Canonical_Combining_Class= +\& CCC132} (1) +\& \ep{Canonical_Combining_Class: CCC132} (Short: \ep{Ccc=CCC132}) (1: +\& U+0F74) +\& T \ep{Canonical_Combining_Class: 133} \ep{Canonical_Combining_Class= +\& CCC133} (0) +\& \ep{Canonical_Combining_Class: CCC133} (Short: \ep{Ccc=CCC133}) (0) +\& T \ep{Canonical_Combining_Class: 200} \ep{Canonical_Combining_Class= +\& Attached_Below_Left} (0) +\& T \ep{Canonical_Combining_Class: 202} \ep{Canonical_Combining_Class= +\& Attached_Below} (5) +\& T \ep{Canonical_Combining_Class: 214} \ep{Canonical_Combining_Class= +\& Attached_Above} (1) +\& T \ep{Canonical_Combining_Class: 216} \ep{Canonical_Combining_Class= +\& Attached_Above_Right} (9) +\& T \ep{Canonical_Combining_Class: 218} \ep{Canonical_Combining_Class= +\& Below_Left} (1) +\& T \ep{Canonical_Combining_Class: 220} \ep{Canonical_Combining_Class= +\& Below} (165) +\& T \ep{Canonical_Combining_Class: 222} \ep{Canonical_Combining_Class= +\& Below_Right} (4) +\& T \ep{Canonical_Combining_Class: 224} \ep{Canonical_Combining_Class= +\& Left} (2) +\& T \ep{Canonical_Combining_Class: 226} \ep{Canonical_Combining_Class= +\& Right} (1) +\& T \ep{Canonical_Combining_Class: 228} \ep{Canonical_Combining_Class= +\& Above_Left} (5) +\& T \ep{Canonical_Combining_Class: 230} \ep{Canonical_Combining_Class= +\& Above} (484) +\& T \ep{Canonical_Combining_Class: 232} \ep{Canonical_Combining_Class= +\& Above_Right} (5) +\& T \ep{Canonical_Combining_Class: 233} \ep{Canonical_Combining_Class= +\& Double_Below} (4) +\& T \ep{Canonical_Combining_Class: 234} \ep{Canonical_Combining_Class= +\& Double_Above} (5) +\& T \ep{Canonical_Combining_Class: 240} \ep{Canonical_Combining_Class= +\& Iota_Subscript} (1) +\& \ep{Canonical_Combining_Class: A} \ep{Canonical_Combining_Class= +\& Above} (484) +\& \ep{Canonical_Combining_Class: Above} (Short: \ep{Ccc=A}) (484: +\& U+0300..0314, U+033D..0344, U+0346, +\& U+034A..034C, U+0350..0352, U+0357 ...) +\& \ep{Canonical_Combining_Class: Above_Left} (Short: \ep{Ccc=AL}) (5: +\& U+05AE, U+18A9, U+1DF7..1DF8, U+302B) +\& \ep{Canonical_Combining_Class: Above_Right} (Short: \ep{Ccc=AR}) (5: +\& U+0315, U+031A, U+0358, U+1DF6, U+302C) +\& \ep{Canonical_Combining_Class: AL} \ep{Canonical_Combining_Class= +\& Above_Left} (5) +\& \ep{Canonical_Combining_Class: AR} \ep{Canonical_Combining_Class= +\& Above_Right} (5) +\& \ep{Canonical_Combining_Class: ATA} \ep{Canonical_Combining_Class= +\& Attached_Above} (1) +\& \ep{Canonical_Combining_Class: ATAR} \ep{Canonical_Combining_Class= +\& Attached_Above_Right} (9) +\& \ep{Canonical_Combining_Class: ATB} \ep{Canonical_Combining_Class= +\& Attached_Below} (5) +\& \ep{Canonical_Combining_Class: ATBL} \ep{Canonical_Combining_Class= +\& Attached_Below_Left} (0) +\& \ep{Canonical_Combining_Class: Attached_Above} (Short: \ep{Ccc=ATA}) +\& (1: U+1DCE) +\& \ep{Canonical_Combining_Class: Attached_Above_Right} (Short: +\& \ep{Ccc=ATAR}) (9: U+031B, U+0F39, +\& U+1D165..1D166, U+1D16E..1D172) +\& \ep{Canonical_Combining_Class: Attached_Below} (Short: \ep{Ccc=ATB}) +\& (5: U+0321..0322, U+0327..0328, U+1DD0) +\& \ep{Canonical_Combining_Class: Attached_Below_Left} (Short: \ep{Ccc= +\& ATBL}) (0) +\& \ep{Canonical_Combining_Class: B} \ep{Canonical_Combining_Class= +\& Below} (165) +\& \ep{Canonical_Combining_Class: Below} (Short: \ep{Ccc=B}) (165: +\& U+0316..0319, U+031C..0320, +\& U+0323..0326, U+0329..0333, +\& U+0339..033C, U+0347..0349 ...) +\& \ep{Canonical_Combining_Class: Below_Left} (Short: \ep{Ccc=BL}) (1: +\& U+302A) +\& \ep{Canonical_Combining_Class: Below_Right} (Short: \ep{Ccc=BR}) (4: +\& U+059A, U+05AD, U+1939, U+302D) +\& \ep{Canonical_Combining_Class: BL} \ep{Canonical_Combining_Class= +\& Below_Left} (1) +\& \ep{Canonical_Combining_Class: BR} \ep{Canonical_Combining_Class= +\& Below_Right} (4) +\& \ep{Canonical_Combining_Class: DA} \ep{Canonical_Combining_Class= +\& Double_Above} (5) +\& \ep{Canonical_Combining_Class: DB} \ep{Canonical_Combining_Class= +\& Double_Below} (4) +\& \ep{Canonical_Combining_Class: Double_Above} (Short: \ep{Ccc=DA}) +\& (5: U+035D..035E, U+0360..0361, U+1DCD) +\& \ep{Canonical_Combining_Class: Double_Below} (Short: \ep{Ccc=DB}) +\& (4: U+035C, U+035F, U+0362, U+1DFC) +\& \ep{Canonical_Combining_Class: Han_Reading} (Short: \ep{Ccc=HANR}) +\& (2: U+16FF0..16FF1) +\& \ep{Canonical_Combining_Class: HANR} \ep{Canonical_Combining_Class= +\& Han_Reading} (2) +\& \ep{Canonical_Combining_Class: Iota_Subscript} (Short: \ep{Ccc=IS}) +\& (1: U+0345) +\& \ep{Canonical_Combining_Class: IS} \ep{Canonical_Combining_Class= +\& Iota_Subscript} (1) +\& \ep{Canonical_Combining_Class: Kana_Voicing} (Short: \ep{Ccc=KV}) +\& (2: U+3099..309A) +\& \ep{Canonical_Combining_Class: KV} \ep{Canonical_Combining_Class= +\& Kana_Voicing} (2) +\& \ep{Canonical_Combining_Class: L} \ep{Canonical_Combining_Class= +\& Left} (2) +\& \ep{Canonical_Combining_Class: Left} (Short: \ep{Ccc=L}) (2: +\& U+302E..302F) +\& \ep{Canonical_Combining_Class: NK} \ep{Canonical_Combining_Class= +\& Nukta} (26) +\& \ep{Canonical_Combining_Class: Not_Reordered} (Short: \ep{Ccc=NR}) +\& (1_113_240 plus all above\-Unicode code +\& points: U+0000..02FF, U+034F, +\& U+0370..0482, U+0488..0590, U+05BE, +\& U+05C0 ...) +\& \ep{Canonical_Combining_Class: NR} \ep{Canonical_Combining_Class= +\& Not_Reordered} (1_113_240 plus all +\& above\-Unicode code points) +\& \ep{Canonical_Combining_Class: Nukta} (Short: \ep{Ccc=NK}) (26: +\& U+093C, U+09BC, U+0A3C, U+0ABC, U+0B3C, +\& U+0CBC ...) +\& \ep{Canonical_Combining_Class: OV} \ep{Canonical_Combining_Class= +\& Overlay} (32) +\& \ep{Canonical_Combining_Class: Overlay} (Short: \ep{Ccc=OV}) (32: +\& U+0334..0338, U+1CD4, U+1CE2..1CE8, +\& U+20D2..20D3, U+20D8..20DA, U+20E5..20E6 +\& ...) +\& \ep{Canonical_Combining_Class: R} \ep{Canonical_Combining_Class= +\& Right} (1) +\& \ep{Canonical_Combining_Class: Right} (Short: \ep{Ccc=R}) (1: +\& U+1D16D) +\& \ep{Canonical_Combining_Class: Virama} (Short: \ep{Ccc=VR}) (61: +\& U+094D, U+09CD, U+0A4D, U+0ACD, U+0B4D, +\& U+0BCD ...) +\& \ep{Canonical_Combining_Class: VR} \ep{Canonical_Combining_Class= +\& Virama} (61) +\& \ep{Cans} \ep{Canadian_Aboriginal} (= +\& \ep{Script_Extensions= +\& Canadian_Aboriginal}) (710) +\& \ep{Cari} \ep{Carian} (= \ep{Script_Extensions= +\& Carian}) (NOT \ep{Block=Carian}) (49) +\& \ep{Carian} \ep{Script_Extensions=Carian} (Short: +\& \ep{Cari}; NOT \ep{Block=Carian}) (49) +\& \ep{Case_Ignorable} \ep{Case_Ignorable=Y} (Short: \ep{CI}) (2413) +\& \ep{Case_Ignorable: N*} (Short: \ep{CI=N}, \eP{CI}) (1_111_699 plus +\& all above\-Unicode code points: [\ex00\- +\& \ex20!\e"#\e$\e%&\e(\e)*+,\e\-\e/0\-9;<=>?\e@A\-Z +\& \e[\e\e\e]_a\-z\e{\e|\e}~\ex7f\-\exa7\exa9\-\exac\exae +\& \exb0\-\exb3\exb5\-\exb6\exb9\-\exff], +\& U+0100..02AF, U+0370..0373, +\& U+0376..0379, U+037B..0383, U+0386 ...) +\& \ep{Case_Ignorable: Y*} (Short: \ep{CI=Y}, \ep{CI}) (2413: [\e\*(Aq.:\e^\` +\& \exa8\exad\exaf\exb4\exb7\-\exb8], +\& U+02B0..036F, U+0374..0375, U+037A, +\& U+0384..0385, U+0387 ...) +\& \ep{Cased} \ep{Cased=Y} (4286) +\& \ep{Cased: N*} (Single: \eP{Cased}) (1_109_826 plus all +\& above\-Unicode code points: [\ex00\-\ex20! +\& \e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<=>?\e@\e[\e\e\e] +\& \e^_\`\e{\e|\e}~\ex7f\-\exa9\exab\-\exb4\exb6\-\exb9 +\& \exbb\-\exbf\exd7\exf7], U+01BB, +\& U+01C0..01C3, U+0294, U+02B9..02BF, +\& U+02C2..02DF ...) +\& \ep{Cased: Y*} (Single: \ep{Cased}) (4286: [A\-Za\-z\exaa +\& \exb5\exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..01BA, U+01BC..01BF, +\& U+01C4..0293, U+0295..02B8, U+02C0..02C1 +\& ...) +\& \ep{Cased_Letter} \ep{General_Category=Cased_Letter} (Short: +\& \ep{LC}) (3977) +\& \ep{Category: *} \ep{General_Category: *} +\& \ep{Caucasian_Albanian} \ep{Script_Extensions=Caucasian_Albanian} +\& (Short: \ep{Aghb}; NOT \ep{Block= +\& Caucasian_Albanian}) (53) +\& \ep{Cc} \ep{XPosixCntrl} (= \ep{General_Category= +\& Control}) (65) +\& \ep{Ccc: *} \ep{Canonical_Combining_Class: *} +\& \ep{CE} \ep{Composition_Exclusion} (= +\& \ep{Composition_Exclusion=Y}) (81) +\& \ep{CE: *} \ep{Composition_Exclusion: *} +\& \ep{Cf} \ep{Format} (= \ep{General_Category=Format}) +\& (161) +\& \ep{Chakma} \ep{Script_Extensions=Chakma} (Short: +\& \ep{Cakm}; NOT \ep{Block=Chakma}) (91) +\& \ep{Cham} \ep{Script_Extensions=Cham} (NOT \ep{Block= +\& Cham}) (83) +\& \ep{Changes_When_Casefolded} \ep{Changes_When_Casefolded=Y} (Short: +\& \ep{CWCF}) (1466) +\& \ep{Changes_When_Casefolded: N*} (Short: \ep{CWCF=N}, \eP{CWCF}) +\& (1_112_646 plus all above\-Unicode code +\& points: [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-. +\& \e/0\-9:;<=>?\e@\e[\e\e\e]\e^_\`a\-z\e{\e|\e}~\ex7f\- +\& \exb4\exb6\-\exbf\exd7\exe0\-\exff], U+0101, +\& U+0103, U+0105, U+0107, U+0109 ...) +\& \ep{Changes_When_Casefolded: Y*} (Short: \ep{CWCF=Y}, \ep{CWCF}) +\& (1466: [A\-Z\exb5\exc0\-\exd6\exd8\-\exdf], +\& U+0100, U+0102, U+0104, U+0106, U+0108 +\& ...) +\& \ep{Changes_When_Casemapped} \ep{Changes_When_Casemapped=Y} (Short: +\& \ep{CWCM}) (2847) +\& \ep{Changes_When_Casemapped: N*} (Short: \ep{CWCM=N}, \eP{CWCM}) +\& (1_111_265 plus all above\-Unicode code +\& points: [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-. +\& \e/0\-9:;<=>?\e@\e[\e\e\e]\e^_\`\e{\e|\e}~\ex7f\-\exb4 +\& \exb6\-\exbf\exd7\exf7], U+0138, U+018D, +\& U+019B, U+01AA..01AB, U+01BA..01BB ...) +\& \ep{Changes_When_Casemapped: Y*} (Short: \ep{CWCM=Y}, \ep{CWCM}) +\& (2847: [A\-Za\-z\exb5\exc0\-\exd6\exd8\-\exf6 +\& \exf8\-\exff], U+0100..0137, U+0139..018C, +\& U+018E..019A, U+019C..01A9, U+01AC..01B9 +\& ...) +\& \ep{Changes_When_Lowercased} \ep{Changes_When_Lowercased=Y} (Short: +\& \ep{CWL}) (1393) +\& \ep{Changes_When_Lowercased: N*} (Short: \ep{CWL=N}, \eP{CWL}) +\& (1_112_719 plus all above\-Unicode code +\& points: [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-. +\& \e/0\-9:;<=>?\e@\e[\e\e\e]\e^_\`a\-z\e{\e|\e}~\ex7f\- +\& \exbf\exd7\exdf\-\exff], U+0101, U+0103, +\& U+0105, U+0107, U+0109 ...) +\& \ep{Changes_When_Lowercased: Y*} (Short: \ep{CWL=Y}, \ep{CWL}) (1393: +\& [A\-Z\exc0\-\exd6\exd8\-\exde], U+0100, U+0102, +\& U+0104, U+0106, U+0108 ...) +\& \ep{Changes_When_NFKC_Casefolded} \ep{Changes_When_NFKC_Casefolded= +\& Y} (Short: \ep{CWKCF}) (10_329) +\& \ep{Changes_When_NFKC_Casefolded: N*} (Short: \ep{CWKCF=N}, +\& \eP{CWKCF}) (1_103_783 plus all above\- +\& Unicode code points: [\ex00\-\ex20!\e"#\e$ +\& \e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<=>?\e@\e[\e\e\e]\e^_\`a\- +\& z\e{\e|\e}~\ex7f\-\ex9f\exa1\-\exa7\exa9\exab\-\exac +\& \exae\exb0\-\exb1\exb6\-\exb7\exbb\exbf\exd7\exe0\- +\& \exff], U+0101, U+0103, U+0105, U+0107, +\& U+0109 ...) +\& \ep{Changes_When_NFKC_Casefolded: Y*} (Short: \ep{CWKCF=Y}, +\& \ep{CWKCF}) (10_329: [A\-Z\exa0\exa8\exaa +\& \exad\exaf\exb2\-\exb5\exb8\-\exba\exbc\-\exbe\exc0\- +\& \exd6\exd8\-\exdf], U+0100, U+0102, U+0104, +\& U+0106, U+0108 ...) +\& \ep{Changes_When_Titlecased} \ep{Changes_When_Titlecased=Y} (Short: +\& \ep{CWT}) (1412) +\& \ep{Changes_When_Titlecased: N*} (Short: \ep{CWT=N}, \eP{CWT}) +\& (1_112_700 plus all above\-Unicode code +\& points: [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-. +\& \e/0\-9:;<=>?\e@A\-Z\e[\e\e\e]\e^_\`\e{\e|\e}~\ex7f\- +\& \exb4\exb6\-\exde\exf7], U+0100, U+0102, +\& U+0104, U+0106, U+0108 ...) +\& \ep{Changes_When_Titlecased: Y*} (Short: \ep{CWT=Y}, \ep{CWT}) (1412: +\& [a\-z\exb5\exdf\-\exf6\exf8\-\exff], U+0101, +\& U+0103, U+0105, U+0107, U+0109 ...) +\& \ep{Changes_When_Uppercased} \ep{Changes_When_Uppercased=Y} (Short: +\& \ep{CWU}) (1485) +\& \ep{Changes_When_Uppercased: N*} (Short: \ep{CWU=N}, \eP{CWU}) +\& (1_112_627 plus all above\-Unicode code +\& points: [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-. +\& \e/0\-9:;<=>?\e@A\-Z\e[\e\e\e]\e^_\`\e{\e|\e}~\ex7f\- +\& \exb4\exb6\-\exde\exf7], U+0100, U+0102, +\& U+0104, U+0106, U+0108 ...) +\& \ep{Changes_When_Uppercased: Y*} (Short: \ep{CWU=Y}, \ep{CWU}) (1485: +\& [a\-z\exb5\exdf\-\exf6\exf8\-\exff], U+0101, +\& U+0103, U+0105, U+0107, U+0109 ...) +\& \ep{Cher} \ep{Cherokee} (= \ep{Script_Extensions= +\& Cherokee}) (NOT \ep{Block=Cherokee}) (172) +\& \ep{Cherokee} \ep{Script_Extensions=Cherokee} (Short: +\& \ep{Cher}; NOT \ep{Block=Cherokee}) (172) +\& X \ep{Cherokee_Sup} \ep{Cherokee_Supplement} (= \ep{Block= +\& Cherokee_Supplement}) (80) +\& X \ep{Cherokee_Supplement} \ep{Block=Cherokee_Supplement} (Short: +\& \ep{InCherokeeSup}) (80) +\& X \ep{Chess_Symbols} \ep{Block=Chess_Symbols} (112) +\& \ep{Chorasmian} \ep{Script_Extensions=Chorasmian} (Short: +\& \ep{Chrs}; NOT \ep{Block=Chorasmian}) (28) +\& \ep{Chrs} \ep{Chorasmian} (= \ep{Script_Extensions= +\& Chorasmian}) (NOT \ep{Block=Chorasmian}) +\& (28) +\& \ep{CI} \ep{Case_Ignorable} (= \ep{Case_Ignorable= +\& Y}) (2413) +\& \ep{CI: *} \ep{Case_Ignorable: *} +\& X \ep{CJK} \ep{CJK_Unified_Ideographs} (= \ep{Block= +\& CJK_Unified_Ideographs}) (20_992) +\& X \ep{CJK_Compat} \ep{CJK_Compatibility} (= \ep{Block= +\& CJK_Compatibility}) (256) +\& X \ep{CJK_Compat_Forms} \ep{CJK_Compatibility_Forms} (= \ep{Block= +\& CJK_Compatibility_Forms}) (32) +\& X \ep{CJK_Compat_Ideographs} \ep{CJK_Compatibility_Ideographs} (= +\& \ep{Block=CJK_Compatibility_Ideographs}) +\& (512) +\& X \ep{CJK_Compat_Ideographs_Sup} +\& \ep{CJK_Compatibility_Ideographs_\- +\& Supplement} (= \ep{Block= +\& CJK_Compatibility_Ideographs_\- +\& Supplement}) (544) +\& X \ep{CJK_Compatibility} \ep{Block=CJK_Compatibility} (Short: +\& \ep{InCJKCompat}) (256) +\& X \ep{CJK_Compatibility_Forms} \ep{Block=CJK_Compatibility_Forms} +\& (Short: \ep{InCJKCompatForms}) (32) +\& X \ep{CJK_Compatibility_Ideographs} \ep{Block= +\& CJK_Compatibility_Ideographs} (Short: +\& \ep{InCJKCompatIdeographs}) (512) +\& X \ep{CJK_Compatibility_Ideographs_Supplement} \ep{Block= +\& CJK_Compatibility_Ideographs_Supplement} +\& (Short: \ep{InCJKCompatIdeographsSup}) +\& (544) +\& X \ep{CJK_Ext_A} \ep{CJK_Unified_Ideographs_Extension_A} (= +\& \ep{Block= +\& CJK_Unified_Ideographs_Extension_A}) +\& (6592) +\& X \ep{CJK_Ext_B} \ep{CJK_Unified_Ideographs_Extension_B} (= +\& \ep{Block= +\& CJK_Unified_Ideographs_Extension_B}) +\& (42_720) +\& X \ep{CJK_Ext_C} \ep{CJK_Unified_Ideographs_Extension_C} (= +\& \ep{Block= +\& CJK_Unified_Ideographs_Extension_C}) +\& (4160) +\& X \ep{CJK_Ext_D} \ep{CJK_Unified_Ideographs_Extension_D} (= +\& \ep{Block= +\& CJK_Unified_Ideographs_Extension_D}) +\& (224) +\& X \ep{CJK_Ext_E} \ep{CJK_Unified_Ideographs_Extension_E} (= +\& \ep{Block= +\& CJK_Unified_Ideographs_Extension_E}) +\& (5776) +\& X \ep{CJK_Ext_F} \ep{CJK_Unified_Ideographs_Extension_F} (= +\& \ep{Block= +\& CJK_Unified_Ideographs_Extension_F}) +\& (7488) +\& X \ep{CJK_Ext_G} \ep{CJK_Unified_Ideographs_Extension_G} (= +\& \ep{Block= +\& CJK_Unified_Ideographs_Extension_G}) +\& (4944) +\& X \ep{CJK_Radicals_Sup} \ep{CJK_Radicals_Supplement} (= \ep{Block= +\& CJK_Radicals_Supplement}) (128) +\& X \ep{CJK_Radicals_Supplement} \ep{Block=CJK_Radicals_Supplement} +\& (Short: \ep{InCJKRadicalsSup}) (128) +\& X \ep{CJK_Strokes} \ep{Block=CJK_Strokes} (48) +\& X \ep{CJK_Symbols} \ep{CJK_Symbols_And_Punctuation} (= +\& \ep{Block=CJK_Symbols_And_Punctuation}) +\& (64) +\& X \ep{CJK_Symbols_And_Punctuation} \ep{Block= +\& CJK_Symbols_And_Punctuation} (Short: +\& \ep{InCJKSymbols}) (64) +\& X \ep{CJK_Unified_Ideographs} \ep{Block=CJK_Unified_Ideographs} +\& (Short: \ep{InCJK}) (20_992) +\& X \ep{CJK_Unified_Ideographs_Extension_A} \ep{Block= +\& CJK_Unified_Ideographs_Extension_A} +\& (Short: \ep{InCJKExtA}) (6592) +\& X \ep{CJK_Unified_Ideographs_Extension_B} \ep{Block= +\& CJK_Unified_Ideographs_Extension_B} +\& (Short: \ep{InCJKExtB}) (42_720) +\& X \ep{CJK_Unified_Ideographs_Extension_C} \ep{Block= +\& CJK_Unified_Ideographs_Extension_C} +\& (Short: \ep{InCJKExtC}) (4160) +\& X \ep{CJK_Unified_Ideographs_Extension_D} \ep{Block= +\& CJK_Unified_Ideographs_Extension_D} +\& (Short: \ep{InCJKExtD}) (224) +\& X \ep{CJK_Unified_Ideographs_Extension_E} \ep{Block= +\& CJK_Unified_Ideographs_Extension_E} +\& (Short: \ep{InCJKExtE}) (5776) +\& X \ep{CJK_Unified_Ideographs_Extension_F} \ep{Block= +\& CJK_Unified_Ideographs_Extension_F} +\& (Short: \ep{InCJKExtF}) (7488) +\& X \ep{CJK_Unified_Ideographs_Extension_G} \ep{Block= +\& CJK_Unified_Ideographs_Extension_G} +\& (Short: \ep{InCJKExtG}) (4944) +\& \ep{Close_Punctuation} \ep{General_Category=Close_Punctuation} +\& (Short: \ep{Pe}) (73) +\& \ep{Cn} \ep{Unassigned} (= \ep{General_Category= +\& Unassigned}) (830_672 plus all above\- +\& Unicode code points) +\& \ep{Cntrl} \ep{XPosixCntrl} (= \ep{General_Category= +\& Control}) (65) +\& \ep{Co} \ep{Private_Use} (= \ep{General_Category= +\& Private_Use}) (NOT \ep{Private_Use_Area}) +\& (137_468) +\& X \ep{Combining_Diacritical_Marks} \ep{Block= +\& Combining_Diacritical_Marks} (Short: +\& \ep{InDiacriticals}) (112) +\& X \ep{Combining_Diacritical_Marks_Extended} \ep{Block= +\& Combining_Diacritical_Marks_Extended} +\& (Short: \ep{InDiacriticalsExt}) (80) +\& X \ep{Combining_Diacritical_Marks_For_Symbols} \ep{Block= +\& Combining_Diacritical_Marks_For_Symbols} +\& (Short: \ep{InDiacriticalsForSymbols}) +\& (48) +\& X \ep{Combining_Diacritical_Marks_Supplement} \ep{Block= +\& Combining_Diacritical_Marks_Supplement} +\& (Short: \ep{InDiacriticalsSup}) (64) +\& X \ep{Combining_Half_Marks} \ep{Block=Combining_Half_Marks} (Short: +\& \ep{InHalfMarks}) (16) +\& \ep{Combining_Mark} \ep{Mark} (= \ep{General_Category=Mark}) +\& (2295) +\& X \ep{Combining_Marks_For_Symbols} +\& \ep{Combining_Diacritical_Marks_For_\- +\& Symbols} (= \ep{Block= +\& Combining_Diacritical_Marks_For_\- +\& Symbols}) (48) +\& \ep{Common} \ep{Script_Extensions=Common} (Short: +\& \ep{Zyyy}) (7661) +\& X \ep{Common_Indic_Number_Forms} \ep{Block=Common_Indic_Number_Forms} +\& (Short: \ep{InIndicNumberForms}) (16) +\& \ep{Comp_Ex} \ep{Full_Composition_Exclusion} (= +\& \ep{Full_Composition_Exclusion=Y}) (1120) +\& \ep{Comp_Ex: *} \ep{Full_Composition_Exclusion: *} +\& X \ep{Compat_Jamo} \ep{Hangul_Compatibility_Jamo} (= \ep{Block= +\& Hangul_Compatibility_Jamo}) (96) +\& \ep{Composition_Exclusion} \ep{Composition_Exclusion=Y} (Short: +\& \ep{CE}) (81) +\& \ep{Composition_Exclusion: N*} (Short: \ep{CE=N}, \eP{CE}) (1_114_031 +\& plus all above\-Unicode code points: +\& U+0000..0957, U+0960..09DB, U+09DE, +\& U+09E0..0A32, U+0A34..0A35, U+0A37..0A58 +\& ...) +\& \ep{Composition_Exclusion: Y*} (Short: \ep{CE=Y}, \ep{CE}) (81: +\& U+0958..095F, U+09DC..09DD, U+09DF, +\& U+0A33, U+0A36, U+0A59..0A5B ...) +\& \ep{Connector_Punctuation} \ep{General_Category= +\& Connector_Punctuation} (Short: \ep{Pc}) +\& (10) +\& \ep{Control} \ep{XPosixCntrl} (= \ep{General_Category= +\& Control}) (65) +\& X \ep{Control_Pictures} \ep{Block=Control_Pictures} (64) +\& \ep{Copt} \ep{Coptic} (= \ep{Script_Extensions= +\& Coptic}) (NOT \ep{Block=Coptic}) (165) +\& \ep{Coptic} \ep{Script_Extensions=Coptic} (Short: +\& \ep{Copt}; NOT \ep{Block=Coptic}) (165) +\& X \ep{Coptic_Epact_Numbers} \ep{Block=Coptic_Epact_Numbers} (32) +\& X \ep{Counting_Rod} \ep{Counting_Rod_Numerals} (= \ep{Block= +\& Counting_Rod_Numerals}) (32) +\& X \ep{Counting_Rod_Numerals} \ep{Block=Counting_Rod_Numerals} (Short: +\& \ep{InCountingRod}) (32) +\& \ep{Cprt} \ep{Cypriot} (= \ep{Script_Extensions= +\& Cypriot}) (112) +\& \ep{Cs} \ep{Surrogate} (= \ep{General_Category= +\& Surrogate}) (2048) +\& \ep{Cuneiform} \ep{Script_Extensions=Cuneiform} (Short: +\& \ep{Xsux}; NOT \ep{Block=Cuneiform}) (1234) +\& X \ep{Cuneiform_Numbers} \ep{Cuneiform_Numbers_And_Punctuation} (= +\& \ep{Block= +\& Cuneiform_Numbers_And_Punctuation}) (128) +\& X \ep{Cuneiform_Numbers_And_Punctuation} \ep{Block= +\& Cuneiform_Numbers_And_Punctuation} +\& (Short: \ep{InCuneiformNumbers}) (128) +\& \ep{Currency_Symbol} \ep{General_Category=Currency_Symbol} +\& (Short: \ep{Sc}) (62) +\& X \ep{Currency_Symbols} \ep{Block=Currency_Symbols} (48) +\& \ep{CWCF} \ep{Changes_When_Casefolded} (= +\& \ep{Changes_When_Casefolded=Y}) (1466) +\& \ep{CWCF: *} \ep{Changes_When_Casefolded: *} +\& \ep{CWCM} \ep{Changes_When_Casemapped} (= +\& \ep{Changes_When_Casemapped=Y}) (2847) +\& \ep{CWCM: *} \ep{Changes_When_Casemapped: *} +\& \ep{CWKCF} \ep{Changes_When_NFKC_Casefolded} (= +\& \ep{Changes_When_NFKC_Casefolded=Y}) +\& (10_329) +\& \ep{CWKCF: *} \ep{Changes_When_NFKC_Casefolded: *} +\& \ep{CWL} \ep{Changes_When_Lowercased} (= +\& \ep{Changes_When_Lowercased=Y}) (1393) +\& \ep{CWL: *} \ep{Changes_When_Lowercased: *} +\& \ep{CWT} \ep{Changes_When_Titlecased} (= +\& \ep{Changes_When_Titlecased=Y}) (1412) +\& \ep{CWT: *} \ep{Changes_When_Titlecased: *} +\& \ep{CWU} \ep{Changes_When_Uppercased} (= +\& \ep{Changes_When_Uppercased=Y}) (1485) +\& \ep{CWU: *} \ep{Changes_When_Uppercased: *} +\& \ep{Cypriot} \ep{Script_Extensions=Cypriot} (Short: +\& \ep{Cprt}) (112) +\& X \ep{Cypriot_Syllabary} \ep{Block=Cypriot_Syllabary} (64) +\& \ep{Cyrillic} \ep{Script_Extensions=Cyrillic} (Short: +\& \ep{Cyrl}; NOT \ep{Block=Cyrillic}) (447) +\& X \ep{Cyrillic_Ext_A} \ep{Cyrillic_Extended_A} (= \ep{Block= +\& Cyrillic_Extended_A}) (32) +\& X \ep{Cyrillic_Ext_B} \ep{Cyrillic_Extended_B} (= \ep{Block= +\& Cyrillic_Extended_B}) (96) +\& X \ep{Cyrillic_Ext_C} \ep{Cyrillic_Extended_C} (= \ep{Block= +\& Cyrillic_Extended_C}) (16) +\& X \ep{Cyrillic_Extended_A} \ep{Block=Cyrillic_Extended_A} (Short: +\& \ep{InCyrillicExtA}) (32) +\& X \ep{Cyrillic_Extended_B} \ep{Block=Cyrillic_Extended_B} (Short: +\& \ep{InCyrillicExtB}) (96) +\& X \ep{Cyrillic_Extended_C} \ep{Block=Cyrillic_Extended_C} (Short: +\& \ep{InCyrillicExtC}) (16) +\& X \ep{Cyrillic_Sup} \ep{Cyrillic_Supplement} (= \ep{Block= +\& Cyrillic_Supplement}) (48) +\& X \ep{Cyrillic_Supplement} \ep{Block=Cyrillic_Supplement} (Short: +\& \ep{InCyrillicSup}) (48) +\& X \ep{Cyrillic_Supplementary} \ep{Cyrillic_Supplement} (= \ep{Block= +\& Cyrillic_Supplement}) (48) +\& \ep{Cyrl} \ep{Cyrillic} (= \ep{Script_Extensions= +\& Cyrillic}) (NOT \ep{Block=Cyrillic}) (447) +\& \ep{Dash} \ep{Dash=Y} (29) +\& \ep{Dash: N*} (Single: \eP{Dash}) (1_114_083 plus all +\& above\-Unicode code points: [\ex00\-\ex20! +\& \e"#\e$\e%&\e\*(Aq\e(\e)*+,.\e/0\-9:;<=>?\e@A\-Z +\& \e[\e\e\e]\e^_\`a\-z\e{\e|\e}~\ex7f\-\exff], +\& U+0100..0589, U+058B..05BD, +\& U+05BF..13FF, U+1401..1805, U+1807..200F +\& ...) +\& \ep{Dash: Y*} (Single: \ep{Dash}) (29: [\e\-], U+058A, +\& U+05BE, U+1400, U+1806, U+2010..2015 ...) +\& \ep{Dash_Punctuation} \ep{General_Category=Dash_Punctuation} +\& (Short: \ep{Pd}) (25) +\& \ep{Decimal_Number} \ep{XPosixDigit} (= \ep{General_Category= +\& Decimal_Number}) (650) +\& \ep{Decomposition_Type: Can} \ep{Decomposition_Type=Canonical} +\& (13_233) +\& \ep{Decomposition_Type: Canonical} (Short: \ep{Dt=Can}) (13_233: +\& [\exc0\-\exc5\exc7\-\excf\exd1\-\exd6\exd9\-\exdd +\& \exe0\-\exe5\exe7\-\exef\exf1\-\exf6\exf9\-\exfd +\& \exff], U+0100..010F, U+0112..0125, +\& U+0128..0130, U+0134..0137, U+0139..013E +\& ...) +\& \ep{Decomposition_Type: Circle} (Short: \ep{Dt=Enc}) (240: +\& U+2460..2473, U+24B6..24EA, +\& U+3244..3247, U+3251..327E, +\& U+3280..32BF, U+32D0..32FE ...) +\& \ep{Decomposition_Type: Com} \ep{Decomposition_Type=Compat} (720) +\& \ep{Decomposition_Type: Compat} (Short: \ep{Dt=Com}) (720: [\exa8 +\& \exaf\exb4\-\exb5\exb8], U+0132..0133, +\& U+013F..0140, U+0149, U+017F, +\& U+01C4..01CC ...) +\& \ep{Decomposition_Type: Enc} \ep{Decomposition_Type=Circle} (240) +\& \ep{Decomposition_Type: Fin} \ep{Decomposition_Type=Final} (240) +\& \ep{Decomposition_Type: Final} (Short: \ep{Dt=Fin}) (240: U+FB51, +\& U+FB53, U+FB57, U+FB5B, U+FB5F, U+FB63 +\& ...) +\& \ep{Decomposition_Type: Font} (Short: \ep{Dt=Font}) (1194: U+2102, +\& U+210A..2113, U+2115, U+2119..211D, +\& U+2124, U+2128 ...) +\& \ep{Decomposition_Type: Fra} \ep{Decomposition_Type=Fraction} (20) +\& \ep{Decomposition_Type: Fraction} (Short: \ep{Dt=Fra}) (20: [\exbc\- +\& \exbe], U+2150..215F, U+2189) +\& \ep{Decomposition_Type: Init} \ep{Decomposition_Type=Initial} (171) +\& \ep{Decomposition_Type: Initial} (Short: \ep{Dt=Init}) (171: U+FB54, +\& U+FB58, U+FB5C, U+FB60, U+FB64, U+FB68 +\& ...) +\& \ep{Decomposition_Type: Iso} \ep{Decomposition_Type=Isolated} (238) +\& \ep{Decomposition_Type: Isolated} (Short: \ep{Dt=Iso}) (238: U+FB50, +\& U+FB52, U+FB56, U+FB5A, U+FB5E, U+FB62 +\& ...) +\& \ep{Decomposition_Type: Med} \ep{Decomposition_Type=Medial} (82) +\& \ep{Decomposition_Type: Medial} (Short: \ep{Dt=Med}) (82: U+FB55, +\& U+FB59, U+FB5D, U+FB61, U+FB65, U+FB69 +\& ...) +\& \ep{Decomposition_Type: Nar} \ep{Decomposition_Type=Narrow} (122) +\& \ep{Decomposition_Type: Narrow} (Short: \ep{Dt=Nar}) (122: +\& U+FF61..FFBE, U+FFC2..FFC7, +\& U+FFCA..FFCF, U+FFD2..FFD7, +\& U+FFDA..FFDC, U+FFE8..FFEE) +\& \ep{Decomposition_Type: Nb} \ep{Decomposition_Type=Nobreak} (5) +\& \ep{Decomposition_Type: Nobreak} (Short: \ep{Dt=Nb}) (5: [\exa0], +\& U+0F0C, U+2007, U+2011, U+202F) +\& \ep{Decomposition_Type: Non_Canon} \ep{Decomposition_Type= +\& Non_Canonical} (Perl extension) (3675) +\& \ep{Decomposition_Type: Non_Canonical} Union of all non\-canonical +\& decompositions (Short: \ep{Dt=NonCanon}) +\& (Perl extension) (3675: [\exa0\exa8\exaa +\& \exaf\exb2\-\exb5\exb8\-\exba\exbc\-\exbe], +\& U+0132..0133, U+013F..0140, U+0149, +\& U+017F, U+01C4..01CC ...) +\& \ep{Decomposition_Type: None} (Short: \ep{Dt=None}) (1_097_204 plus +\& all above\-Unicode code points: [\ex00\- +\& \ex9f\exa1\-\exa7\exa9\exab\-\exae\exb0\-\exb1\exb6\- +\& \exb7\exbb\exbf\exc6\exd0\exd7\-\exd8\exde\-\exdf +\& \exe6\exf0\exf7\-\exf8\exfe], U+0110..0111, +\& U+0126..0127, U+0131, U+0138, +\& U+0141..0142 ...) +\& \ep{Decomposition_Type: Small} (Short: \ep{Dt=Sml}) (26: +\& U+FE50..FE52, U+FE54..FE66, U+FE68..FE6B) +\& \ep{Decomposition_Type: Sml} \ep{Decomposition_Type=Small} (26) +\& \ep{Decomposition_Type: Sqr} \ep{Decomposition_Type=Square} (286) +\& \ep{Decomposition_Type: Square} (Short: \ep{Dt=Sqr}) (286: U+3250, +\& U+32CC..32CF, U+32FF..3357, +\& U+3371..33DF, U+33FF, U+1F130..1F14F ...) +\& \ep{Decomposition_Type: Sub} (Short: \ep{Dt=Sub}) (38: U+1D62..1D6A, +\& U+2080..208E, U+2090..209C, U+2C7C) +\& \ep{Decomposition_Type: Sup} \ep{Decomposition_Type=Super} (154) +\& \ep{Decomposition_Type: Super} (Short: \ep{Dt=Sup}) (154: [\exaa\exb2\- +\& \exb3\exb9\-\exba], U+02B0..02B8, +\& U+02E0..02E4, U+10FC, U+1D2C..1D2E, +\& U+1D30..1D3A ...) +\& \ep{Decomposition_Type: Vert} \ep{Decomposition_Type=Vertical} (35) +\& \ep{Decomposition_Type: Vertical} (Short: \ep{Dt=Vert}) (35: U+309F, +\& U+30FF, U+FE10..FE19, U+FE30..FE44, +\& U+FE47..FE48) +\& \ep{Decomposition_Type: Wide} (Short: \ep{Dt=Wide}) (104: U+3000, +\& U+FF01..FF60, U+FFE0..FFE6) +\& \ep{Default_Ignorable_Code_Point} \ep{Default_Ignorable_Code_Point= +\& Y} (Short: \ep{DI}) (4173) +\& \ep{Default_Ignorable_Code_Point: N*} (Short: \ep{DI=N}, \eP{DI}) +\& (1_109_939 plus all above\-Unicode code +\& points: [\ex00\-\exac\exae\-\exff], +\& U+0100..034E, U+0350..061B, +\& U+061D..115E, U+1161..17B3, U+17B6..180A +\& ...) +\& \ep{Default_Ignorable_Code_Point: Y*} (Short: \ep{DI=Y}, \ep{DI}) +\& (4173: [\exad], U+034F, U+061C, +\& U+115F..1160, U+17B4..17B5, U+180B..180E +\& ...) +\& \ep{Dep} \ep{Deprecated} (= \ep{Deprecated=Y}) (15) +\& \ep{Dep: *} \ep{Deprecated: *} +\& \ep{Deprecated} \ep{Deprecated=Y} (Short: \ep{Dep}) (15) +\& \ep{Deprecated: N*} (Short: \ep{Dep=N}, \eP{Dep}) (1_114_097 +\& plus all above\-Unicode code points: +\& U+0000..0148, U+014A..0672, +\& U+0674..0F76, U+0F78, U+0F7A..17A2, +\& U+17A5..2069 ...) +\& \ep{Deprecated: Y*} (Short: \ep{Dep=Y}, \ep{Dep}) (15: U+0149, +\& U+0673, U+0F77, U+0F79, U+17A3..17A4, +\& U+206A..206F ...) +\& \ep{Deseret} \ep{Script_Extensions=Deseret} (Short: +\& \ep{Dsrt}) (80) +\& \ep{Deva} \ep{Devanagari} (= \ep{Script_Extensions= +\& Devanagari}) (NOT \ep{Block=Devanagari}) +\& (210) +\& \ep{Devanagari} \ep{Script_Extensions=Devanagari} (Short: +\& \ep{Deva}; NOT \ep{Block=Devanagari}) (210) +\& X \ep{Devanagari_Ext} \ep{Devanagari_Extended} (= \ep{Block= +\& Devanagari_Extended}) (32) +\& X \ep{Devanagari_Extended} \ep{Block=Devanagari_Extended} (Short: +\& \ep{InDevanagariExt}) (32) +\& \ep{DI} \ep{Default_Ignorable_Code_Point} (= +\& \ep{Default_Ignorable_Code_Point=Y}) +\& (4173) +\& \ep{DI: *} \ep{Default_Ignorable_Code_Point: *} +\& \ep{Dia} \ep{Diacritic} (= \ep{Diacritic=Y}) (882) +\& \ep{Dia: *} \ep{Diacritic: *} +\& \ep{Diacritic} \ep{Diacritic=Y} (Short: \ep{Dia}) (882) +\& \ep{Diacritic: N*} (Short: \ep{Dia=N}, \eP{Dia}) (1_113_230 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<= +\& >?\e@A\-Z\e[\e\e\e]_a\-z\e{\e|\e}~\ex7f\-\exa7\exa9\- +\& \exae\exb0\-\exb3\exb5\-\exb6\exb9\-\exff], +\& U+0100..02AF, U+034F, U+0358..035C, +\& U+0363..0373, U+0376..0379 ...) +\& \ep{Diacritic: Y*} (Short: \ep{Dia=Y}, \ep{Dia}) (882: [\e^\` +\& \exa8\exaf\exb4\exb7\-\exb8], U+02B0..034E, +\& U+0350..0357, U+035D..0362, +\& U+0374..0375, U+037A ...) +\& X \ep{Diacriticals} \ep{Combining_Diacritical_Marks} (= +\& \ep{Block=Combining_Diacritical_Marks}) +\& (112) +\& X \ep{Diacriticals_Ext} \ep{Combining_Diacritical_Marks_Extended} +\& (= \ep{Block= +\& Combining_Diacritical_Marks_Extended}) +\& (80) +\& X \ep{Diacriticals_For_Symbols} +\& \ep{Combining_Diacritical_Marks_For_\- +\& Symbols} (= \ep{Block= +\& Combining_Diacritical_Marks_For_\- +\& Symbols}) (48) +\& X \ep{Diacriticals_Sup} \ep{Combining_Diacritical_Marks_Supplement} +\& (= \ep{Block= +\& Combining_Diacritical_Marks_Supplement}) +\& (64) +\& \ep{Diak} \ep{Dives_Akuru} (= \ep{Script_Extensions= +\& Dives_Akuru}) (NOT \ep{Block= +\& Dives_Akuru}) (72) +\& \ep{Digit} \ep{XPosixDigit} (= \ep{General_Category= +\& Decimal_Number}) (650) +\& X \ep{Dingbats} \ep{Block=Dingbats} (192) +\& \ep{Dives_Akuru} \ep{Script_Extensions=Dives_Akuru} (Short: +\& \ep{Diak}; NOT \ep{Block=Dives_Akuru}) (72) +\& \ep{Dogr} \ep{Dogra} (= \ep{Script_Extensions=Dogra}) +\& (NOT \ep{Block=Dogra}) (82) +\& \ep{Dogra} \ep{Script_Extensions=Dogra} (Short: +\& \ep{Dogr}; NOT \ep{Block=Dogra}) (82) +\& X \ep{Domino} \ep{Domino_Tiles} (= \ep{Block= +\& Domino_Tiles}) (112) +\& X \ep{Domino_Tiles} \ep{Block=Domino_Tiles} (Short: +\& \ep{InDomino}) (112) +\& \ep{Dsrt} \ep{Deseret} (= \ep{Script_Extensions= +\& Deseret}) (80) +\& \ep{Dt: *} \ep{Decomposition_Type: *} +\& \ep{Dupl} \ep{Duployan} (= \ep{Script_Extensions= +\& Duployan}) (NOT \ep{Block=Duployan}) (147) +\& \ep{Duployan} \ep{Script_Extensions=Duployan} (Short: +\& \ep{Dupl}; NOT \ep{Block=Duployan}) (147) +\& \ep{Ea: *} \ep{East_Asian_Width: *} +\& X \ep{Early_Dynastic_Cuneiform} \ep{Block=Early_Dynastic_Cuneiform} +\& (208) +\& \ep{East_Asian_Width: A} \ep{East_Asian_Width=Ambiguous} (138_739) +\& \ep{East_Asian_Width: Ambiguous} (Short: \ep{Ea=A}) (138_739: [\exa1 +\& \exa4\exa7\-\exa8\exaa\exad\-\exae\exb0\-\exb4\exb6\- +\& \exba\exbc\-\exbf\exc6\exd0\exd7\-\exd8\exde\-\exe1 +\& \exe6\exe8\-\exea\exec\-\exed\exf0\exf2\-\exf3\exf7\- +\& \exfa\exfc\exfe], U+0101, U+0111, U+0113, +\& U+011B, U+0126..0127 ...) +\& \ep{East_Asian_Width: F} \ep{East_Asian_Width=Fullwidth} (104) +\& \ep{East_Asian_Width: Fullwidth} (Short: \ep{Ea=F}) (104: U+3000, +\& U+FF01..FF60, U+FFE0..FFE6) +\& \ep{East_Asian_Width: H} \ep{East_Asian_Width=Halfwidth} (123) +\& \ep{East_Asian_Width: Halfwidth} (Short: \ep{Ea=H}) (123: U+20A9, +\& U+FF61..FFBE, U+FFC2..FFC7, +\& U+FFCA..FFCF, U+FFD2..FFD7, U+FFDA..FFDC +\& ...) +\& \ep{East_Asian_Width: N} \ep{East_Asian_Width=Neutral} (792_699 plus +\& all above\-Unicode code points) +\& \ep{East_Asian_Width: Na} \ep{East_Asian_Width=Narrow} (111) +\& \ep{East_Asian_Width: Narrow} (Short: \ep{Ea=Na}) (111: [\ex20\-\ex7e +\& \exa2\-\exa3\exa5\-\exa6\exac\exaf], +\& U+27E6..27ED, U+2985..2986) +\& \ep{East_Asian_Width: Neutral} (Short: \ep{Ea=N}) (792_699 plus all +\& above\-Unicode code points: [\ex00\-\ex1f +\& \ex7f\-\exa0\exa9\exab\exb5\exbb\exc0\-\exc5\exc7\- +\& \excf\exd1\-\exd6\exd9\-\exdd\exe2\-\exe5\exe7\exeb +\& \exee\-\exef\exf1\exf4\-\exf6\exfb\exfd\exff], +\& U+00FF..0100, U+0102..0110, U+0112, +\& U+0114..011A, U+011C..0125 ...) +\& \ep{East_Asian_Width: W} \ep{East_Asian_Width=Wide} (182_336) +\& \ep{East_Asian_Width: Wide} (Short: \ep{Ea=W}) (182_336: +\& U+1100..115F, U+231A..231B, +\& U+2329..232A, U+23E9..23EC, U+23F0, +\& U+23F3 ...) +\& \ep{EBase} \ep{Emoji_Modifier_Base} (= +\& \ep{Emoji_Modifier_Base=Y}) (122) +\& \ep{EBase: *} \ep{Emoji_Modifier_Base: *} +\& \ep{EComp} \ep{Emoji_Component} (= \ep{Emoji_Component= +\& Y}) (146) +\& \ep{EComp: *} \ep{Emoji_Component: *} +\& \ep{Egyp} \ep{Egyptian_Hieroglyphs} (= +\& \ep{Script_Extensions= +\& Egyptian_Hieroglyphs}) (NOT \ep{Block= +\& Egyptian_Hieroglyphs}) (1080) +\& X \ep{Egyptian_Hieroglyph_Format_Controls} \ep{Block= +\& Egyptian_Hieroglyph_Format_Controls} (16) +\& \ep{Egyptian_Hieroglyphs} \ep{Script_Extensions= +\& Egyptian_Hieroglyphs} (Short: \ep{Egyp}; +\& NOT \ep{Block=Egyptian_Hieroglyphs}) +\& (1080) +\& \ep{Elba} \ep{Elbasan} (= \ep{Script_Extensions= +\& Elbasan}) (NOT \ep{Block=Elbasan}) (40) +\& \ep{Elbasan} \ep{Script_Extensions=Elbasan} (Short: +\& \ep{Elba}; NOT \ep{Block=Elbasan}) (40) +\& \ep{Elym} \ep{Elymaic} (= \ep{Script_Extensions= +\& Elymaic}) (NOT \ep{Block=Elymaic}) (23) +\& \ep{Elymaic} \ep{Script_Extensions=Elymaic} (Short: +\& \ep{Elym}; NOT \ep{Block=Elymaic}) (23) +\& \ep{EMod} \ep{Emoji_Modifier} (= \ep{Emoji_Modifier= +\& Y}) (5) +\& \ep{EMod: *} \ep{Emoji_Modifier: *} +\& \ep{Emoji} \ep{Emoji=Y} (1367) +\& \ep{Emoji: N*} (Single: \eP{Emoji}) (1_112_745 plus all +\& above\-Unicode code points: [\ex00\-\ex20! +\& \e"\e$\e%&\e\*(Aq\e(\e)+,\e\-.\e/:;<=>?\e@A\-Z\e[\e\e\e] +\& \e^_\`a\-z\e{\e|\e}~\ex7f\-\exa8\exaa\-\exad\exaf\- +\& \exff], U+0100..203B, U+203D..2048, +\& U+204A..2121, U+2123..2138, U+213A..2193 +\& ...) +\& \ep{Emoji: Y*} (Single: \ep{Emoji}) (1367: [#*0\-9\exa9 +\& \exae], U+203C, U+2049, U+2122, U+2139, +\& U+2194..2199 ...) +\& \ep{Emoji_Component} \ep{Emoji_Component=Y} (Short: \ep{EComp}) +\& (146) +\& \ep{Emoji_Component: N*} (Short: \ep{EComp=N}, \eP{EComp}) (1_113_966 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!\e"\e$\e%&\e\*(Aq\e(\e)+,\e\-.\e/:;<=>? +\& \e@A\-Z\e[\e\e\e]\e^_\`a\-z\e{\e|\e}~\ex7f\-\exff], +\& U+0100..200C, U+200E..20E2, +\& U+20E4..FE0E, U+FE10..1F1E5, +\& U+1F200..1F3FA ...) +\& \ep{Emoji_Component: Y*} (Short: \ep{EComp=Y}, \ep{EComp}) (146: +\& [#*0\-9], U+200D, U+20E3, U+FE0F, +\& U+1F1E6..1F1FF, U+1F3FB..1F3FF ...) +\& \ep{Emoji_Modifier} \ep{Emoji_Modifier=Y} (Short: \ep{EMod}) (5) +\& \ep{Emoji_Modifier: N*} (Short: \ep{EMod=N}, \eP{EMod}) (1_114_107 +\& plus all above\-Unicode code points: +\& U+0000..1F3FA, U+1F400..infinity) +\& \ep{Emoji_Modifier: Y*} (Short: \ep{EMod=Y}, \ep{EMod}) (5: +\& U+1F3FB..1F3FF) +\& \ep{Emoji_Modifier_Base} \ep{Emoji_Modifier_Base=Y} (Short: +\& \ep{EBase}) (122) +\& \ep{Emoji_Modifier_Base: N*} (Short: \ep{EBase=N}, \eP{EBase}) +\& (1_113_990 plus all above\-Unicode code +\& points: U+0000..261C, U+261E..26F8, +\& U+26FA..2709, U+270E..1F384, +\& U+1F386..1F3C1, U+1F3C5..1F3C6 ...) +\& \ep{Emoji_Modifier_Base: Y*} (Short: \ep{EBase=Y}, \ep{EBase}) (122: +\& U+261D, U+26F9, U+270A..270D, U+1F385, +\& U+1F3C2..1F3C4, U+1F3C7 ...) +\& \ep{Emoji_Presentation} \ep{Emoji_Presentation=Y} (Short: +\& \ep{EPres}) (1148) +\& \ep{Emoji_Presentation: N*} (Short: \ep{EPres=N}, \eP{EPres}) +\& (1_112_964 plus all above\-Unicode code +\& points: U+0000..2319, U+231C..23E8, +\& U+23ED..23EF, U+23F1..23F2, +\& U+23F4..25FC, U+25FF..2613 ...) +\& \ep{Emoji_Presentation: Y*} (Short: \ep{EPres=Y}, \ep{EPres}) (1148: +\& U+231A..231B, U+23E9..23EC, U+23F0, +\& U+23F3, U+25FD..25FE, U+2614..2615 ...) +\& X \ep{Emoticons} \ep{Block=Emoticons} (80) +\& X \ep{Enclosed_Alphanum} \ep{Enclosed_Alphanumerics} (= \ep{Block= +\& Enclosed_Alphanumerics}) (160) +\& X \ep{Enclosed_Alphanum_Sup} \ep{Enclosed_Alphanumeric_Supplement} (= +\& \ep{Block= +\& Enclosed_Alphanumeric_Supplement}) (256) +\& X \ep{Enclosed_Alphanumeric_Supplement} \ep{Block= +\& Enclosed_Alphanumeric_Supplement} +\& (Short: \ep{InEnclosedAlphanumSup}) (256) +\& X \ep{Enclosed_Alphanumerics} \ep{Block=Enclosed_Alphanumerics} +\& (Short: \ep{InEnclosedAlphanum}) (160) +\& X \ep{Enclosed_CJK} \ep{Enclosed_CJK_Letters_And_Months} (= +\& \ep{Block= +\& Enclosed_CJK_Letters_And_Months}) (256) +\& X \ep{Enclosed_CJK_Letters_And_Months} \ep{Block= +\& Enclosed_CJK_Letters_And_Months} (Short: +\& \ep{InEnclosedCJK}) (256) +\& X \ep{Enclosed_Ideographic_Sup} \ep{Enclosed_Ideographic_Supplement} +\& (= \ep{Block= +\& Enclosed_Ideographic_Supplement}) (256) +\& X \ep{Enclosed_Ideographic_Supplement} \ep{Block= +\& Enclosed_Ideographic_Supplement} (Short: +\& \ep{InEnclosedIdeographicSup}) (256) +\& \ep{Enclosing_Mark} \ep{General_Category=Enclosing_Mark} +\& (Short: \ep{Me}) (13) +\& \ep{EPres} \ep{Emoji_Presentation} (= +\& \ep{Emoji_Presentation=Y}) (1148) +\& \ep{EPres: *} \ep{Emoji_Presentation: *} +\& \ep{Ethi} \ep{Ethiopic} (= \ep{Script_Extensions= +\& Ethiopic}) (NOT \ep{Block=Ethiopic}) (495) +\& \ep{Ethiopic} \ep{Script_Extensions=Ethiopic} (Short: +\& \ep{Ethi}; NOT \ep{Block=Ethiopic}) (495) +\& X \ep{Ethiopic_Ext} \ep{Ethiopic_Extended} (= \ep{Block= +\& Ethiopic_Extended}) (96) +\& X \ep{Ethiopic_Ext_A} \ep{Ethiopic_Extended_A} (= \ep{Block= +\& Ethiopic_Extended_A}) (48) +\& X \ep{Ethiopic_Extended} \ep{Block=Ethiopic_Extended} (Short: +\& \ep{InEthiopicExt}) (96) +\& X \ep{Ethiopic_Extended_A} \ep{Block=Ethiopic_Extended_A} (Short: +\& \ep{InEthiopicExtA}) (48) +\& X \ep{Ethiopic_Sup} \ep{Ethiopic_Supplement} (= \ep{Block= +\& Ethiopic_Supplement}) (32) +\& X \ep{Ethiopic_Supplement} \ep{Block=Ethiopic_Supplement} (Short: +\& \ep{InEthiopicSup}) (32) +\& \ep{Ext} \ep{Extender} (= \ep{Extender=Y}) (48) +\& \ep{Ext: *} \ep{Extender: *} +\& \ep{Extended_Pictographic} \ep{Extended_Pictographic=Y} (Short: +\& \ep{ExtPict}) (3537) +\& \ep{Extended_Pictographic: N*} (Short: \ep{ExtPict=N}, \eP{ExtPict}) +\& (1_110_575 plus all above\-Unicode code +\& points: [\ex00\-\exa8\exaa\-\exad\exaf\-\exff], +\& U+0100..203B, U+203D..2048, +\& U+204A..2121, U+2123..2138, U+213A..2193 +\& ...) +\& \ep{Extended_Pictographic: Y*} (Short: \ep{ExtPict=Y}, \ep{ExtPict}) +\& (3537: [\exa9\exae], U+203C, U+2049, +\& U+2122, U+2139, U+2194..2199 ...) +\& \ep{Extender} \ep{Extender=Y} (Short: \ep{Ext}) (48) +\& \ep{Extender: N*} (Short: \ep{Ext=N}, \eP{Ext}) (1_114_064 +\& plus all above\-Unicode code points: +\& [\ex00\-\exb6\exb8\-\exff], U+0100..02CF, +\& U+02D2..063F, U+0641..07F9, +\& U+07FB..0B54, U+0B56..0E45 ...) +\& \ep{Extender: Y*} (Short: \ep{Ext=Y}, \ep{Ext}) (48: [\exb7], +\& U+02D0..02D1, U+0640, U+07FA, U+0B55, +\& U+0E46 ...) +\& \ep{ExtPict} \ep{Extended_Pictographic} (= +\& \ep{Extended_Pictographic=Y}) (3537) +\& \ep{ExtPict: *} \ep{Extended_Pictographic: *} +\& \ep{Final_Punctuation} \ep{General_Category=Final_Punctuation} +\& (Short: \ep{Pf}) (10) +\& \ep{Format} \ep{General_Category=Format} (Short: +\& \ep{Cf}) (161) +\& \ep{Full_Composition_Exclusion} \ep{Full_Composition_Exclusion=Y} +\& (Short: \ep{CompEx}) (1120) +\& \ep{Full_Composition_Exclusion: N*} (Short: \ep{CompEx=N}, +\& \eP{CompEx}) (1_112_992 plus all above\- +\& Unicode code points: U+0000..033F, +\& U+0342, U+0345..0373, U+0375..037D, +\& U+037F..0386, U+0388..0957 ...) +\& \ep{Full_Composition_Exclusion: Y*} (Short: \ep{CompEx=Y}, +\& \ep{CompEx}) (1120: U+0340..0341, +\& U+0343..0344, U+0374, U+037E, U+0387, +\& U+0958..095F ...) +\& \ep{Gc: *} \ep{General_Category: *} +\& \ep{GCB: *} \ep{Grapheme_Cluster_Break: *} +\& \ep{General_Category: C} \ep{General_Category=Other} (970_414 plus +\& all above\-Unicode code points) +\& \ep{General_Category: Cased_Letter} [\ep{Ll}\ep{Lu}\ep{Lt}] (Short: +\& \ep{Gc=LC}, \ep{LC}) (3977: [A\-Za\-z\exb5 +\& \exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..01BA, U+01BC..01BF, +\& U+01C4..0293, U+0295..02AF, U+0370..0373 +\& ...) +\& \ep{General_Category: Cc} \ep{General_Category=Control} (65) +\& \ep{General_Category: Cf} \ep{General_Category=Format} (161) +\& \ep{General_Category: Close_Punctuation} (Short: \ep{Gc=Pe}, \ep{Pe}) +\& (73: [\e)\e]\e}], U+0F3B, U+0F3D, U+169C, +\& U+2046, U+207E ...) +\& \ep{General_Category: Cn} \ep{General_Category=Unassigned} (830_672 +\& plus all above\-Unicode code points) +\& \ep{General_Category: Cntrl} \ep{General_Category=Control} (65) +\& \ep{General_Category: Co} \ep{General_Category=Private_Use} (137_468) +\& \ep{General_Category: Combining_Mark} \ep{General_Category=Mark} +\& (2295) +\& \ep{General_Category: Connector_Punctuation} (Short: \ep{Gc=Pc}, +\& \ep{Pc}) (10: [_], U+203F..2040, U+2054, +\& U+FE33..FE34, U+FE4D..FE4F, U+FF3F) +\& \ep{General_Category: Control} (Short: \ep{Gc=Cc}, \ep{Cc}) (65: +\& [\ex00\-\ex1f\ex7f\-\ex9f]) +\& \ep{General_Category: Cs} \ep{General_Category=Surrogate} (2048) +\& \ep{General_Category: Currency_Symbol} (Short: \ep{Gc=Sc}, \ep{Sc}) +\& (62: [\e$\exa2\-\exa5], U+058F, U+060B, +\& U+07FE..07FF, U+09F2..09F3, U+09FB ...) +\& \ep{General_Category: Dash_Punctuation} (Short: \ep{Gc=Pd}, \ep{Pd}) +\& (25: [\e\-], U+058A, U+05BE, U+1400, +\& U+1806, U+2010..2015 ...) +\& \ep{General_Category: Decimal_Number} (Short: \ep{Gc=Nd}, \ep{Nd}) +\& (650: [0\-9], U+0660..0669, U+06F0..06F9, +\& U+07C0..07C9, U+0966..096F, U+09E6..09EF +\& ...) +\& \ep{General_Category: Digit} \ep{General_Category=Decimal_Number} +\& (650) +\& \ep{General_Category: Enclosing_Mark} (Short: \ep{Gc=Me}, \ep{Me}) +\& (13: U+0488..0489, U+1ABE, U+20DD..20E0, +\& U+20E2..20E4, U+A670..A672) +\& \ep{General_Category: Final_Punctuation} (Short: \ep{Gc=Pf}, \ep{Pf}) +\& (10: [\exbb], U+2019, U+201D, U+203A, +\& U+2E03, U+2E05 ...) +\& \ep{General_Category: Format} (Short: \ep{Gc=Cf}, \ep{Cf}) (161: +\& [\exad], U+0600..0605, U+061C, U+06DD, +\& U+070F, U+08E2 ...) +\& \ep{General_Category: Initial_Punctuation} (Short: \ep{Gc=Pi}, +\& \ep{Pi}) (12: [\exab], U+2018, +\& U+201B..201C, U+201F, U+2039, U+2E02 ...) +\& \ep{General_Category: L} \ep{General_Category=Letter} (131_241) +\& X \ep{General_Category: L&} \ep{General_Category=Cased_Letter} (3977) +\& X \ep{General_Category: L_} \ep{General_Category=Cased_Letter} Note +\& the trailing \*(Aq_\*(Aq matters in spite of +\& loose matching rules. (3977) +\& \ep{General_Category: LC} \ep{General_Category=Cased_Letter} (3977) +\& \ep{General_Category: Letter} (Short: \ep{Gc=L}, \ep{L}) (131_241: +\& [A\-Za\-z\exaa\exb5\exba\exc0\-\exd6\exd8\-\exf6 +\& \exf8\-\exff], U+0100..02C1, U+02C6..02D1, +\& U+02E0..02E4, U+02EC, U+02EE ...) +\& \ep{General_Category: Letter_Number} (Short: \ep{Gc=Nl}, \ep{Nl}) +\& (236: U+16EE..16F0, U+2160..2182, +\& U+2185..2188, U+3007, U+3021..3029, +\& U+3038..303A ...) +\& \ep{General_Category: Line_Separator} (Short: \ep{Gc=Zl}, \ep{Zl}) +\& (1: U+2028) +\& \ep{General_Category: Ll} \ep{General_Category=Lowercase_Letter} +\& (/i= General_Category=Cased_Letter) +\& (2155) +\& \ep{General_Category: Lm} \ep{General_Category=Modifier_Letter} (260) +\& \ep{General_Category: Lo} \ep{General_Category=Other_Letter} +\& (127_004) +\& \ep{General_Category: Lowercase_Letter} (Short: \ep{Gc=Ll}, \ep{Ll}; +\& /i= General_Category=Cased_Letter) +\& (2155: [a\-z\exb5\exdf\-\exf6\exf8\-\exff], +\& U+0101, U+0103, U+0105, U+0107, U+0109 +\& ...) +\& \ep{General_Category: Lt} \ep{General_Category=Titlecase_Letter} +\& (/i= General_Category=Cased_Letter) (31) +\& \ep{General_Category: Lu} \ep{General_Category=Uppercase_Letter} +\& (/i= General_Category=Cased_Letter) +\& (1791) +\& \ep{General_Category: M} \ep{General_Category=Mark} (2295) +\& \ep{General_Category: Mark} (Short: \ep{Gc=M}, \ep{M}) (2295: +\& U+0300..036F, U+0483..0489, +\& U+0591..05BD, U+05BF, U+05C1..05C2, +\& U+05C4..05C5 ...) +\& \ep{General_Category: Math_Symbol} (Short: \ep{Gc=Sm}, \ep{Sm}) (948: +\& [+<=>\e|~\exac\exb1\exd7\exf7], U+03F6, +\& U+0606..0608, U+2044, U+2052, +\& U+207A..207C ...) +\& \ep{General_Category: Mc} \ep{General_Category=Spacing_Mark} (443) +\& \ep{General_Category: Me} \ep{General_Category=Enclosing_Mark} (13) +\& \ep{General_Category: Mn} \ep{General_Category=Nonspacing_Mark} +\& (1839) +\& \ep{General_Category: Modifier_Letter} (Short: \ep{Gc=Lm}, \ep{Lm}) +\& (260: U+02B0..02C1, U+02C6..02D1, +\& U+02E0..02E4, U+02EC, U+02EE, U+0374 ...) +\& \ep{General_Category: Modifier_Symbol} (Short: \ep{Gc=Sk}, \ep{Sk}) +\& (123: [\e^\`\exa8\exaf\exb4\exb8], +\& U+02C2..02C5, U+02D2..02DF, +\& U+02E5..02EB, U+02ED, U+02EF..02FF ...) +\& \ep{General_Category: N} \ep{General_Category=Number} (1781) +\& \ep{General_Category: Nd} \ep{General_Category=Decimal_Number} (650) +\& \ep{General_Category: Nl} \ep{General_Category=Letter_Number} (236) +\& \ep{General_Category: No} \ep{General_Category=Other_Number} (895) +\& \ep{General_Category: Nonspacing_Mark} (Short: \ep{Gc=Mn}, \ep{Mn}) +\& (1839: U+0300..036F, U+0483..0487, +\& U+0591..05BD, U+05BF, U+05C1..05C2, +\& U+05C4..05C5 ...) +\& \ep{General_Category: Number} (Short: \ep{Gc=N}, \ep{N}) (1781: [0\-9 +\& \exb2\-\exb3\exb9\exbc\-\exbe], U+0660..0669, +\& U+06F0..06F9, U+07C0..07C9, +\& U+0966..096F, U+09E6..09EF ...) +\& \ep{General_Category: Open_Punctuation} (Short: \ep{Gc=Ps}, \ep{Ps}) +\& (75: [\e(\e[\e{], U+0F3A, U+0F3C, U+169B, +\& U+201A, U+201E ...) +\& \ep{General_Category: Other} (Short: \ep{Gc=C}, \ep{C}) (970_414 plus +\& all above\-Unicode code points: [\ex00\- +\& \ex1f\ex7f\-\ex9f\exad], U+0378..0379, +\& U+0380..0383, U+038B, U+038D, U+03A2 ...) +\& \ep{General_Category: Other_Letter} (Short: \ep{Gc=Lo}, \ep{Lo}) +\& (127_004: [\exaa\exba], U+01BB, +\& U+01C0..01C3, U+0294, U+05D0..05EA, +\& U+05EF..05F2 ...) +\& \ep{General_Category: Other_Number} (Short: \ep{Gc=No}, \ep{No}) +\& (895: [\exb2\-\exb3\exb9\exbc\-\exbe], +\& U+09F4..09F9, U+0B72..0B77, +\& U+0BF0..0BF2, U+0C78..0C7E, U+0D58..0D5E +\& ...) +\& \ep{General_Category: Other_Punctuation} (Short: \ep{Gc=Po}, \ep{Po}) +\& (593: [!\e"#\e%&\e\*(Aq*,.\e/:;?\e@\e\e\exa1\exa7 +\& \exb6\-\exb7\exbf], U+037E, U+0387, +\& U+055A..055F, U+0589, U+05C0 ...) +\& \ep{General_Category: Other_Symbol} (Short: \ep{Gc=So}, \ep{So}) +\& (6431: [\exa6\exa9\exae\exb0], U+0482, +\& U+058D..058E, U+060E..060F, U+06DE, +\& U+06E9 ...) +\& \ep{General_Category: P} \ep{General_Category=Punctuation} (798) +\& \ep{General_Category: Paragraph_Separator} (Short: \ep{Gc=Zp}, +\& \ep{Zp}) (1: U+2029) +\& \ep{General_Category: Pc} \ep{General_Category= +\& Connector_Punctuation} (10) +\& \ep{General_Category: Pd} \ep{General_Category=Dash_Punctuation} (25) +\& \ep{General_Category: Pe} \ep{General_Category=Close_Punctuation} +\& (73) +\& \ep{General_Category: Pf} \ep{General_Category=Final_Punctuation} +\& (10) +\& \ep{General_Category: Pi} \ep{General_Category=Initial_Punctuation} +\& (12) +\& \ep{General_Category: Po} \ep{General_Category=Other_Punctuation} +\& (593) +\& \ep{General_Category: Private_Use} (Short: \ep{Gc=Co}, \ep{Co}) +\& (137_468: U+E000..F8FF, U+F0000..FFFFD, +\& U+100000..10FFFD) +\& \ep{General_Category: Ps} \ep{General_Category=Open_Punctuation} (75) +\& \ep{General_Category: Punct} \ep{General_Category=Punctuation} (798) +\& \ep{General_Category: Punctuation} (Short: \ep{Gc=P}, \ep{P}) (798: +\& [!\e"#\e%&\e\*(Aq\e(\e)*,\e\-.\e/:;?\e@\e[\e\e\e]_\e{\e} +\& \exa1\exa7\exab\exb6\-\exb7\exbb\exbf], U+037E, +\& U+0387, U+055A..055F, U+0589..058A, +\& U+05BE ...) +\& \ep{General_Category: S} \ep{General_Category=Symbol} (7564) +\& \ep{General_Category: Sc} \ep{General_Category=Currency_Symbol} (62) +\& \ep{General_Category: Separator} (Short: \ep{Gc=Z}, \ep{Z}) (19: +\& [\ex20\exa0], U+1680, U+2000..200A, +\& U+2028..2029, U+202F, U+205F ...) +\& \ep{General_Category: Sk} \ep{General_Category=Modifier_Symbol} (123) +\& \ep{General_Category: Sm} \ep{General_Category=Math_Symbol} (948) +\& \ep{General_Category: So} \ep{General_Category=Other_Symbol} (6431) +\& \ep{General_Category: Space_Separator} (Short: \ep{Gc=Zs}, \ep{Zs}) +\& (17: [\ex20\exa0], U+1680, U+2000..200A, +\& U+202F, U+205F, U+3000) +\& \ep{General_Category: Spacing_Mark} (Short: \ep{Gc=Mc}, \ep{Mc}) +\& (443: U+0903, U+093B, U+093E..0940, +\& U+0949..094C, U+094E..094F, U+0982..0983 +\& ...) +\& \ep{General_Category: Surrogate} (Short: \ep{Gc=Cs}, \ep{Cs}) (2048: +\& U+D800..DFFF) +\& \ep{General_Category: Symbol} (Short: \ep{Gc=S}, \ep{S}) (7564: +\& [\e$+<=>\e^\`\e|~\exa2\-\exa6\exa8\-\exa9\exac\exae\- +\& \exb1\exb4\exb8\exd7\exf7], U+02C2..02C5, +\& U+02D2..02DF, U+02E5..02EB, U+02ED, +\& U+02EF..02FF ...) +\& \ep{General_Category: Titlecase_Letter} (Short: \ep{Gc=Lt}, \ep{Lt}; +\& /i= General_Category=Cased_Letter) (31: +\& U+01C5, U+01C8, U+01CB, U+01F2, +\& U+1F88..1F8F, U+1F98..1F9F ...) +\& \ep{General_Category: Unassigned} (Short: \ep{Gc=Cn}, \ep{Cn}) +\& (830_672 plus all above\-Unicode code +\& points: U+0378..0379, U+0380..0383, +\& U+038B, U+038D, U+03A2, U+0530 ...) +\& \ep{General_Category: Uppercase_Letter} (Short: \ep{Gc=Lu}, \ep{Lu}; +\& /i= General_Category=Cased_Letter) +\& (1791: [A\-Z\exc0\-\exd6\exd8\-\exde], U+0100, +\& U+0102, U+0104, U+0106, U+0108 ...) +\& \ep{General_Category: Z} \ep{General_Category=Separator} (19) +\& \ep{General_Category: Zl} \ep{General_Category=Line_Separator} (1) +\& \ep{General_Category: Zp} \ep{General_Category=Paragraph_Separator} +\& (1) +\& \ep{General_Category: Zs} \ep{General_Category=Space_Separator} (17) +\& X \ep{General_Punctuation} \ep{Block=General_Punctuation} (Short: +\& \ep{InPunctuation}) (112) +\& X \ep{Geometric_Shapes} \ep{Block=Geometric_Shapes} (96) +\& X \ep{Geometric_Shapes_Ext} \ep{Geometric_Shapes_Extended} (= +\& \ep{Block=Geometric_Shapes_Extended}) +\& (128) +\& X \ep{Geometric_Shapes_Extended} \ep{Block=Geometric_Shapes_Extended} +\& (Short: \ep{InGeometricShapesExt}) (128) +\& \ep{Geor} \ep{Georgian} (= \ep{Script_Extensions= +\& Georgian}) (NOT \ep{Block=Georgian}) (174) +\& \ep{Georgian} \ep{Script_Extensions=Georgian} (Short: +\& \ep{Geor}; NOT \ep{Block=Georgian}) (174) +\& X \ep{Georgian_Ext} \ep{Georgian_Extended} (= \ep{Block= +\& Georgian_Extended}) (48) +\& X \ep{Georgian_Extended} \ep{Block=Georgian_Extended} (Short: +\& \ep{InGeorgianExt}) (48) +\& X \ep{Georgian_Sup} \ep{Georgian_Supplement} (= \ep{Block= +\& Georgian_Supplement}) (48) +\& X \ep{Georgian_Supplement} \ep{Block=Georgian_Supplement} (Short: +\& \ep{InGeorgianSup}) (48) +\& \ep{Glag} \ep{Glagolitic} (= \ep{Script_Extensions= +\& Glagolitic}) (NOT \ep{Block=Glagolitic}) +\& (136) +\& \ep{Glagolitic} \ep{Script_Extensions=Glagolitic} (Short: +\& \ep{Glag}; NOT \ep{Block=Glagolitic}) (136) +\& X \ep{Glagolitic_Sup} \ep{Glagolitic_Supplement} (= \ep{Block= +\& Glagolitic_Supplement}) (48) +\& X \ep{Glagolitic_Supplement} \ep{Block=Glagolitic_Supplement} (Short: +\& \ep{InGlagoliticSup}) (48) +\& \ep{Gong} \ep{Gunjala_Gondi} (= \ep{Script_Extensions= +\& Gunjala_Gondi}) (NOT \ep{Block= +\& Gunjala_Gondi}) (65) +\& \ep{Gonm} \ep{Masaram_Gondi} (= \ep{Script_Extensions= +\& Masaram_Gondi}) (NOT \ep{Block= +\& Masaram_Gondi}) (77) +\& \ep{Goth} \ep{Gothic} (= \ep{Script_Extensions= +\& Gothic}) (NOT \ep{Block=Gothic}) (27) +\& \ep{Gothic} \ep{Script_Extensions=Gothic} (Short: +\& \ep{Goth}; NOT \ep{Block=Gothic}) (27) +\& \ep{Gr_Base} \ep{Grapheme_Base} (= \ep{Grapheme_Base=Y}) +\& (141_814) +\& \ep{Gr_Base: *} \ep{Grapheme_Base: *} +\& \ep{Gr_Ext} \ep{Grapheme_Extend} (= \ep{Grapheme_Extend= +\& Y}) (1979) +\& \ep{Gr_Ext: *} \ep{Grapheme_Extend: *} +\& \ep{Gran} \ep{Grantha} (= \ep{Script_Extensions= +\& Grantha}) (NOT \ep{Block=Grantha}) (116) +\& \ep{Grantha} \ep{Script_Extensions=Grantha} (Short: +\& \ep{Gran}; NOT \ep{Block=Grantha}) (116) +\& \ep{Graph} \ep{XPosixGraph} (281_308) +\& \ep{Grapheme_Base} \ep{Grapheme_Base=Y} (Short: \ep{GrBase}) +\& (141_814) +\& \ep{Grapheme_Base: N*} (Short: \ep{GrBase=N}, \eP{GrBase}) (972_298 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex1f\ex7f\-\ex9f\exad], U+0300..036F, +\& U+0378..0379, U+0380..0383, U+038B, +\& U+038D ...) +\& \ep{Grapheme_Base: Y*} (Short: \ep{GrBase=Y}, \ep{GrBase}) +\& (141_814: [\ex20\-\ex7e\exa0\-\exac\exae\-\exff], +\& U+0100..02FF, U+0370..0377, +\& U+037A..037F, U+0384..038A, U+038C ...) +\& \ep{Grapheme_Cluster_Break: CN} \ep{Grapheme_Cluster_Break=Control} +\& (3886) +\& \ep{Grapheme_Cluster_Break: Control} (Short: \ep{GCB=CN}) (3886: [^ +\& \en\er\ex20\-\ex7e\exa0\-\exac\exae\-\exff], +\& U+061C, U+180E, U+200B, U+200E..200F, +\& U+2028..202E ...) +\& \ep{Grapheme_Cluster_Break: CR} (Short: \ep{GCB=CR}) (1: [\er]) +\& \ep{Grapheme_Cluster_Break: E_Base} (Short: \ep{GCB=EB}) (0) +\& \ep{Grapheme_Cluster_Break: E_Base_GAZ} (Short: \ep{GCB=EBG}) (0) +\& \ep{Grapheme_Cluster_Break: E_Modifier} (Short: \ep{GCB=EM}) (0) +\& \ep{Grapheme_Cluster_Break: EB} \ep{Grapheme_Cluster_Break=E_Base} +\& (0) +\& \ep{Grapheme_Cluster_Break: EBG} \ep{Grapheme_Cluster_Break= +\& E_Base_GAZ} (0) +\& \ep{Grapheme_Cluster_Break: EM} \ep{Grapheme_Cluster_Break= +\& E_Modifier} (0) +\& \ep{Grapheme_Cluster_Break: EX} \ep{Grapheme_Cluster_Break=Extend} +\& (1984) +\& \ep{Grapheme_Cluster_Break: Extend} (Short: \ep{GCB=EX}) (1984: +\& U+0300..036F, U+0483..0489, +\& U+0591..05BD, U+05BF, U+05C1..05C2, +\& U+05C4..05C5 ...) +\& \ep{Grapheme_Cluster_Break: GAZ} \ep{Grapheme_Cluster_Break= +\& Glue_After_Zwj} (0) +\& \ep{Grapheme_Cluster_Break: Glue_After_Zwj} (Short: \ep{GCB=GAZ}) (0) +\& \ep{Grapheme_Cluster_Break: L} (Short: \ep{GCB=L}) (125: +\& U+1100..115F, U+A960..A97C) +\& \ep{Grapheme_Cluster_Break: LF} (Short: \ep{GCB=LF}) (1: [\en]) +\& \ep{Grapheme_Cluster_Break: LV} (Short: \ep{GCB=LV}) (399: U+AC00, +\& U+AC1C, U+AC38, U+AC54, U+AC70, U+AC8C +\& ...) +\& \ep{Grapheme_Cluster_Break: LVT} (Short: \ep{GCB=LVT}) (10_773: +\& U+AC01..AC1B, U+AC1D..AC37, +\& U+AC39..AC53, U+AC55..AC6F, +\& U+AC71..AC8B, U+AC8D..ACA7 ...) +\& \ep{Grapheme_Cluster_Break: Other} (Short: \ep{GCB=XX}) (1_096_272 +\& plus all above\-Unicode code points: +\& [\ex20\-\ex7e\exa0\-\exac\exae\-\exff], +\& U+0100..02FF, U+0370..0482, +\& U+048A..0590, U+05BE, U+05C0 ...) +\& \ep{Grapheme_Cluster_Break: PP} \ep{Grapheme_Cluster_Break=Prepend} +\& (24) +\& \ep{Grapheme_Cluster_Break: Prepend} (Short: \ep{GCB=PP}) (24: +\& U+0600..0605, U+06DD, U+070F, U+08E2, +\& U+0D4E, U+110BD ...) +\& \ep{Grapheme_Cluster_Break: Regional_Indicator} (Short: \ep{GCB=RI}) +\& (26: U+1F1E6..1F1FF) +\& \ep{Grapheme_Cluster_Break: RI} \ep{Grapheme_Cluster_Break= +\& Regional_Indicator} (26) +\& \ep{Grapheme_Cluster_Break: SM} \ep{Grapheme_Cluster_Break= +\& SpacingMark} (388) +\& \ep{Grapheme_Cluster_Break: SpacingMark} (Short: \ep{GCB=SM}) (388: +\& U+0903, U+093B, U+093E..0940, +\& U+0949..094C, U+094E..094F, U+0982..0983 +\& ...) +\& \ep{Grapheme_Cluster_Break: T} (Short: \ep{GCB=T}) (137: +\& U+11A8..11FF, U+D7CB..D7FB) +\& \ep{Grapheme_Cluster_Break: V} (Short: \ep{GCB=V}) (95: +\& U+1160..11A7, U+D7B0..D7C6) +\& \ep{Grapheme_Cluster_Break: XX} \ep{Grapheme_Cluster_Break=Other} +\& (1_096_272 plus all above\-Unicode code +\& points) +\& \ep{Grapheme_Cluster_Break: ZWJ} (Short: \ep{GCB=ZWJ}) (1: U+200D) +\& \ep{Grapheme_Extend} \ep{Grapheme_Extend=Y} (Short: \ep{GrExt}) +\& (1979) +\& \ep{Grapheme_Extend: N*} (Short: \ep{GrExt=N}, \eP{GrExt}) (1_112_133 +\& plus all above\-Unicode code points: +\& U+0000..02FF, U+0370..0482, +\& U+048A..0590, U+05BE, U+05C0, U+05C3 ...) +\& \ep{Grapheme_Extend: Y*} (Short: \ep{GrExt=Y}, \ep{GrExt}) (1979: +\& U+0300..036F, U+0483..0489, +\& U+0591..05BD, U+05BF, U+05C1..05C2, +\& U+05C4..05C5 ...) +\& \ep{Greek} \ep{Script_Extensions=Greek} (Short: +\& \ep{Grek}; NOT \ep{Greek_And_Coptic}) (522) +\& X \ep{Greek_And_Coptic} \ep{Block=Greek_And_Coptic} (Short: +\& \ep{InGreek}) (144) +\& X \ep{Greek_Ext} \ep{Greek_Extended} (= \ep{Block= +\& Greek_Extended}) (256) +\& X \ep{Greek_Extended} \ep{Block=Greek_Extended} (Short: +\& \ep{InGreekExt}) (256) +\& \ep{Grek} \ep{Greek} (= \ep{Script_Extensions=Greek}) +\& (NOT \ep{Greek_And_Coptic}) (522) +\& \ep{Gujarati} \ep{Script_Extensions=Gujarati} (Short: +\& \ep{Gujr}; NOT \ep{Block=Gujarati}) (105) +\& \ep{Gujr} \ep{Gujarati} (= \ep{Script_Extensions= +\& Gujarati}) (NOT \ep{Block=Gujarati}) (105) +\& \ep{Gunjala_Gondi} \ep{Script_Extensions=Gunjala_Gondi} +\& (Short: \ep{Gong}; NOT \ep{Block= +\& Gunjala_Gondi}) (65) +\& \ep{Gurmukhi} \ep{Script_Extensions=Gurmukhi} (Short: +\& \ep{Guru}; NOT \ep{Block=Gurmukhi}) (94) +\& \ep{Guru} \ep{Gurmukhi} (= \ep{Script_Extensions= +\& Gurmukhi}) (NOT \ep{Block=Gurmukhi}) (94) +\& X \ep{Half_And_Full_Forms} \ep{Halfwidth_And_Fullwidth_Forms} (= +\& \ep{Block=Halfwidth_And_Fullwidth_Forms}) +\& (240) +\& X \ep{Half_Marks} \ep{Combining_Half_Marks} (= \ep{Block= +\& Combining_Half_Marks}) (16) +\& X \ep{Halfwidth_And_Fullwidth_Forms} \ep{Block= +\& Halfwidth_And_Fullwidth_Forms} (Short: +\& \ep{InHalfAndFullForms}) (240) +\& \ep{Han} \ep{Script_Extensions=Han} (94_492) +\& \ep{Hang} \ep{Hangul} (= \ep{Script_Extensions= +\& Hangul}) (NOT \ep{Hangul_Syllables}) +\& (11_775) +\& \ep{Hangul} \ep{Script_Extensions=Hangul} (Short: +\& \ep{Hang}; NOT \ep{Hangul_Syllables}) +\& (11_775) +\& X \ep{Hangul_Compatibility_Jamo} \ep{Block=Hangul_Compatibility_Jamo} +\& (Short: \ep{InCompatJamo}) (96) +\& X \ep{Hangul_Jamo} \ep{Block=Hangul_Jamo} (Short: \ep{InJamo}) +\& (256) +\& X \ep{Hangul_Jamo_Extended_A} \ep{Block=Hangul_Jamo_Extended_A} +\& (Short: \ep{InJamoExtA}) (32) +\& X \ep{Hangul_Jamo_Extended_B} \ep{Block=Hangul_Jamo_Extended_B} +\& (Short: \ep{InJamoExtB}) (80) +\& \ep{Hangul_Syllable_Type: L} \ep{Hangul_Syllable_Type=Leading_Jamo} +\& (125) +\& \ep{Hangul_Syllable_Type: Leading_Jamo} (Short: \ep{Hst=L}) (125: +\& U+1100..115F, U+A960..A97C) +\& \ep{Hangul_Syllable_Type: LV} \ep{Hangul_Syllable_Type=LV_Syllable} +\& (399) +\& \ep{Hangul_Syllable_Type: LV_Syllable} (Short: \ep{Hst=LV}) (399: +\& U+AC00, U+AC1C, U+AC38, U+AC54, U+AC70, +\& U+AC8C ...) +\& \ep{Hangul_Syllable_Type: LVT} \ep{Hangul_Syllable_Type= +\& LVT_Syllable} (10_773) +\& \ep{Hangul_Syllable_Type: LVT_Syllable} (Short: \ep{Hst=LVT}) +\& (10_773: U+AC01..AC1B, U+AC1D..AC37, +\& U+AC39..AC53, U+AC55..AC6F, +\& U+AC71..AC8B, U+AC8D..ACA7 ...) +\& \ep{Hangul_Syllable_Type: NA} \ep{Hangul_Syllable_Type= +\& Not_Applicable} (1_102_583 plus all +\& above\-Unicode code points) +\& \ep{Hangul_Syllable_Type: Not_Applicable} (Short: \ep{Hst=NA}) +\& (1_102_583 plus all above\-Unicode code +\& points: U+0000..10FF, U+1200..A95F, +\& U+A97D..ABFF, U+D7A4..D7AF, +\& U+D7C7..D7CA, U+D7FC..infinity) +\& \ep{Hangul_Syllable_Type: T} \ep{Hangul_Syllable_Type=Trailing_Jamo} +\& (137) +\& \ep{Hangul_Syllable_Type: Trailing_Jamo} (Short: \ep{Hst=T}) (137: +\& U+11A8..11FF, U+D7CB..D7FB) +\& \ep{Hangul_Syllable_Type: V} \ep{Hangul_Syllable_Type=Vowel_Jamo} +\& (95) +\& \ep{Hangul_Syllable_Type: Vowel_Jamo} (Short: \ep{Hst=V}) (95: +\& U+1160..11A7, U+D7B0..D7C6) +\& X \ep{Hangul_Syllables} \ep{Block=Hangul_Syllables} (Short: +\& \ep{InHangul}) (11_184) +\& \ep{Hani} \ep{Han} (= \ep{Script_Extensions=Han}) +\& (94_492) +\& \ep{Hanifi_Rohingya} \ep{Script_Extensions=Hanifi_Rohingya} +\& (Short: \ep{Rohg}; NOT \ep{Block= +\& Hanifi_Rohingya}) (55) +\& \ep{Hano} \ep{Hanunoo} (= \ep{Script_Extensions= +\& Hanunoo}) (NOT \ep{Block=Hanunoo}) (23) +\& \ep{Hanunoo} \ep{Script_Extensions=Hanunoo} (Short: +\& \ep{Hano}; NOT \ep{Block=Hanunoo}) (23) +\& \ep{Hatr} \ep{Hatran} (= \ep{Script_Extensions= +\& Hatran}) (NOT \ep{Block=Hatran}) (26) +\& \ep{Hatran} \ep{Script_Extensions=Hatran} (Short: +\& \ep{Hatr}; NOT \ep{Block=Hatran}) (26) +\& \ep{Hebr} \ep{Hebrew} (= \ep{Script_Extensions= +\& Hebrew}) (NOT \ep{Block=Hebrew}) (134) +\& \ep{Hebrew} \ep{Script_Extensions=Hebrew} (Short: +\& \ep{Hebr}; NOT \ep{Block=Hebrew}) (134) +\& \ep{Hex} \ep{XPosixXDigit} (= \ep{Hex_Digit=Y}) (44) +\& \ep{Hex: *} \ep{Hex_Digit: *} +\& \ep{Hex_Digit} \ep{XPosixXDigit} (= \ep{Hex_Digit=Y}) (44) +\& \ep{Hex_Digit: N*} (Short: \ep{Hex=N}, \eP{Hex}) (1_114_068 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<=>? +\& \e@G\-Z\e[\e\e\e]\e^_\`g\-z\e{\e|\e}~\ex7f\-\exff], +\& U+0100..FF0F, U+FF1A..FF20, +\& U+FF27..FF40, U+FF47..infinity) +\& \ep{Hex_Digit: Y*} (Short: \ep{Hex=Y}, \ep{Hex}) (44: [0\-9A\-Fa\- +\& f], U+FF10..FF19, U+FF21..FF26, +\& U+FF41..FF46) +\& X \ep{High_Private_Use_Surrogates} \ep{Block= +\& High_Private_Use_Surrogates} (Short: +\& \ep{InHighPUSurrogates}) (128) +\& X \ep{High_PU_Surrogates} \ep{High_Private_Use_Surrogates} (= +\& \ep{Block=High_Private_Use_Surrogates}) +\& (128) +\& X \ep{High_Surrogates} \ep{Block=High_Surrogates} (896) +\& \ep{Hira} \ep{Hiragana} (= \ep{Script_Extensions= +\& Hiragana}) (NOT \ep{Block=Hiragana}) (431) +\& \ep{Hiragana} \ep{Script_Extensions=Hiragana} (Short: +\& \ep{Hira}; NOT \ep{Block=Hiragana}) (431) +\& \ep{Hluw} \ep{Anatolian_Hieroglyphs} (= +\& \ep{Script_Extensions= +\& Anatolian_Hieroglyphs}) (NOT \ep{Block= +\& Anatolian_Hieroglyphs}) (583) +\& \ep{Hmng} \ep{Pahawh_Hmong} (= \ep{Script_Extensions= +\& Pahawh_Hmong}) (NOT \ep{Block= +\& Pahawh_Hmong}) (127) +\& \ep{Hmnp} \ep{Nyiakeng_Puachue_Hmong} (= +\& \ep{Script_Extensions= +\& Nyiakeng_Puachue_Hmong}) (NOT \ep{Block= +\& Nyiakeng_Puachue_Hmong}) (71) +\& \ep{HorizSpace} \ep{XPosixBlank} (18) +\& \ep{Hst: *} \ep{Hangul_Syllable_Type: *} +\& \ep{Hung} \ep{Old_Hungarian} (= \ep{Script_Extensions= +\& Old_Hungarian}) (NOT \ep{Block= +\& Old_Hungarian}) (108) +\& D \ep{Hyphen} \ep{Hyphen=Y} (11) +\& D \ep{Hyphen: N*} Supplanted by Line_Break property values; +\& see www.unicode.org/reports/tr14 +\& (Single: \eP{Hyphen}) (1_114_101 plus all +\& above\-Unicode code points: [\ex00\-\ex20! +\& \e"#\e$\e%&\e\*(Aq\e(\e)*+,.\e/0\-9:;<=>?\e@A\-Z +\& \e[\e\e\e]\e^_\`a\-z\e{\e|\e}~\ex7f\-\exac\exae\-\exff], +\& U+0100..0589, U+058B..1805, +\& U+1807..200F, U+2012..2E16, U+2E18..30FA +\& ...) +\& D \ep{Hyphen: Y*} Supplanted by Line_Break property values; +\& see www.unicode.org/reports/tr14 +\& (Single: \ep{Hyphen}) (11: [\e\-\exad], +\& U+058A, U+1806, U+2010..2011, U+2E17, +\& U+30FB ...) +\& \ep{ID_Continue} \ep{ID_Continue=Y} (Short: \ep{IDC}; NOT +\& \ep{Ideographic_Description_Characters}) +\& (134_434) +\& \ep{ID_Continue: N*} (Short: \ep{IDC=N}, \eP{IDC}) (979_678 plus +\& all above\-Unicode code points: [\ex00\- +\& \ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<=>?\e@ +\& \e[\e\e\e]\e^\`\e{\e|\e}~\ex7f\-\exa9\exab\-\exb4\exb6 +\& \exb8\-\exb9\exbb\-\exbf\exd7\exf7], +\& U+02C2..02C5, U+02D2..02DF, +\& U+02E5..02EB, U+02ED, U+02EF..02FF ...) +\& \ep{ID_Continue: Y*} (Short: \ep{IDC=Y}, \ep{IDC}) (134_434: +\& [0\-9A\-Z_a\-z\exaa\exb5\exb7\exba\exc0\-\exd6 +\& \exd8\-\exf6\exf8\-\exff], U+0100..02C1, +\& U+02C6..02D1, U+02E0..02E4, U+02EC, +\& U+02EE ...) +\& \ep{ID_Start} \ep{ID_Start=Y} (Short: \ep{IDS}) (131_482) +\& \ep{ID_Start: N*} (Short: \ep{IDS=N}, \eP{IDS}) (982_630 plus +\& all above\-Unicode code points: [\ex00\- +\& \ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<=>?\e@ +\& \e[\e\e\e]\e^_\`\e{\e|\e}~\ex7f\-\exa9\exab\-\exb4\exb6\- +\& \exb9\exbb\-\exbf\exd7\exf7], U+02C2..02C5, +\& U+02D2..02DF, U+02E5..02EB, U+02ED, +\& U+02EF..036F ...) +\& \ep{ID_Start: Y*} (Short: \ep{IDS=Y}, \ep{IDS}) (131_482: [A\- +\& Za\-z\exaa\exb5\exba\exc0\-\exd6\exd8\-\exf6\exf8\- +\& \exff], U+0100..02C1, U+02C6..02D1, +\& U+02E0..02E4, U+02EC, U+02EE ...) +\& \ep{IDC} \ep{ID_Continue} (= \ep{ID_Continue=Y}) (NOT +\& \ep{Ideographic_Description_Characters}) +\& (134_434) +\& \ep{IDC: *} \ep{ID_Continue: *} +\& \ep{Identifier_Status: Allowed} (107_835: [\e\*(Aq\e\-.0\-9:A\-Z_a\-z\exb7 +\& \exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..0131, U+0134..013E, +\& U+0141..0148, U+014A..017E, U+018F ...) +\& \ep{Identifier_Status: Restricted} (1_006_277 plus all above\- +\& Unicode code points: [\ex00\-\ex20!\e"#\e$ +\& \e%&\e(\e)*+,\e/;<=>?\e@\e[\e\e\e]\e^\`\e{\e|\e}~\ex7f\- +\& \exb6\exb8\-\exbf\exd7\exf7], U+0132..0133, +\& U+013F..0140, U+0149, U+017F..018E, +\& U+0190..019F ...) +\& \ep{Identifier_Type: Default_Ignorable} (395: [\exad], U+034F, +\& U+061C, U+115F..1160, U+17B4..17B5, +\& U+180B..180E ...) +\& \ep{Identifier_Type: Deprecated} (15: U+0149, U+0673, U+0F77, +\& U+0F79, U+17A3..17A4, U+206A..206F ...) +\& \ep{Identifier_Type: Exclusion} (16_745: U+03E2..03EF, +\& U+0800..082D, U+0830..083E, +\& U+1680..169C, U+16A0..16EA, U+16EE..16F8 +\& ...) +\& \ep{Identifier_Type: Inclusion} (19: [\e\*(Aq\e\-.:\exb7], U+0375, U+058A, +\& U+05F3..05F4, U+06FD..06FE, U+0F0B ...) +\& \ep{Identifier_Type: Limited_Use} (5248: U+0700..070D, +\& U+070F..074A, U+074D..074F, +\& U+07C0..07FA, U+07FD..07FF, U+0840..085B +\& ...) +\& \ep{Identifier_Type: Not_Character} (970_247 plus all above\-Unicode +\& code points: [^\et\en\ecK\ef\er\ex20\-\ex7e\ex85 +\& \exa0\-\exff], U+0378..0379, U+0380..0383, +\& U+038B, U+038D, U+03A2 ...) +\& \ep{Identifier_Type: Not_NFKC} (4800: [\exa0\exa8\exaa\exaf\exb2\-\exb5 +\& \exb8\-\exba\exbc\-\exbe], U+0132..0133, +\& U+013F..0140, U+017F, U+01C4..01CC, +\& U+01F1..01F3 ...) +\& \ep{Identifier_Type: Not_XID} (7998: [\et\en\ecK\ef\er\ex20!\e"#\e$\e%& +\& \e(\e)*+,\e/;<=>?\e@\e[\e\e\e]\e^\`\e{\e|\e}~\ex85 +\& \exa1\-\exa7\exa9\exab\-\exac\exae\exb0\-\exb1\exb6 +\& \exbb\exbf\exd7\exf7], U+02C2..02C5, +\& U+02D2..02D7, U+02DE..02DF, +\& U+02E5..02EB, U+02ED ...) +\& \ep{Identifier_Type: Obsolete} (1611: U+018D, U+01AA..01AB, +\& U+01B9..01BB, U+01BE..01BF, +\& U+01F6..01F7, U+021C..021D ...) +\& \ep{Identifier_Type: Recommended} (107_816: [0\-9A\-Z_a\-z\exc0\-\exd6 +\& \exd8\-\exf6\exf8\-\exff], U+0100..0131, +\& U+0134..013E, U+0141..0148, +\& U+014A..017E, U+018F ...) +\& \ep{Identifier_Type: Technical} (1463: U+0180, U+018D, +\& U+01AA..01AB, U+01BA..01BB, U+01BE, +\& U+01C0..01C3 ...) +\& \ep{Identifier_Type: Uncommon_Use} (348: U+0181..018C, U+018E, +\& U+0190..019F, U+01A2..01A9, +\& U+01AC..01AE, U+01B1..01B8 ...) +\& \ep{Ideo} \ep{Ideographic} (= \ep{Ideographic=Y}) +\& (101_652) +\& \ep{Ideo: *} \ep{Ideographic: *} +\& \ep{Ideographic} \ep{Ideographic=Y} (Short: \ep{Ideo}) +\& (101_652) +\& \ep{Ideographic: N*} (Short: \ep{Ideo=N}, \eP{Ideo}) (1_012_460 +\& plus all above\-Unicode code points: +\& U+0000..3005, U+3008..3020, +\& U+302A..3037, U+303B..33FF, +\& U+4DC0..4DFF, U+9FFD..F8FF ...) +\& \ep{Ideographic: Y*} (Short: \ep{Ideo=Y}, \ep{Ideo}) (101_652: +\& U+3006..3007, U+3021..3029, +\& U+3038..303A, U+3400..4DBF, +\& U+4E00..9FFC, U+F900..FA6D ...) +\& X \ep{Ideographic_Description_Characters} \ep{Block= +\& Ideographic_Description_Characters} +\& (Short: \ep{InIDC}) (16) +\& X \ep{Ideographic_Symbols} \ep{Ideographic_Symbols_And_Punctuation} (= +\& \ep{Block= +\& Ideographic_Symbols_And_Punctuation}) +\& (32) +\& X \ep{Ideographic_Symbols_And_Punctuation} \ep{Block= +\& Ideographic_Symbols_And_Punctuation} +\& (Short: \ep{InIdeographicSymbols}) (32) +\& \ep{IDS} \ep{ID_Start} (= \ep{ID_Start=Y}) (131_482) +\& \ep{IDS: *} \ep{ID_Start: *} +\& \ep{IDS_Binary_Operator} \ep{IDS_Binary_Operator=Y} (Short: +\& \ep{IDSB}) (10) +\& \ep{IDS_Binary_Operator: N*} (Short: \ep{IDSB=N}, \eP{IDSB}) +\& (1_114_102 plus all above\-Unicode code +\& points: U+0000..2FEF, U+2FF2..2FF3, +\& U+2FFC..infinity) +\& \ep{IDS_Binary_Operator: Y*} (Short: \ep{IDSB=Y}, \ep{IDSB}) (10: +\& U+2FF0..2FF1, U+2FF4..2FFB) +\& \ep{IDS_Trinary_Operator} \ep{IDS_Trinary_Operator=Y} (Short: +\& \ep{IDST}) (2) +\& \ep{IDS_Trinary_Operator: N*} (Short: \ep{IDST=N}, \eP{IDST}) +\& (1_114_110 plus all above\-Unicode code +\& points: U+0000..2FF1, U+2FF4..infinity) +\& \ep{IDS_Trinary_Operator: Y*} (Short: \ep{IDST=Y}, \ep{IDST}) (2: +\& U+2FF2..2FF3) +\& \ep{IDSB} \ep{IDS_Binary_Operator} (= +\& \ep{IDS_Binary_Operator=Y}) (10) +\& \ep{IDSB: *} \ep{IDS_Binary_Operator: *} +\& \ep{IDST} \ep{IDS_Trinary_Operator} (= +\& \ep{IDS_Trinary_Operator=Y}) (2) +\& \ep{IDST: *} \ep{IDS_Trinary_Operator: *} +\& \ep{Imperial_Aramaic} \ep{Script_Extensions=Imperial_Aramaic} +\& (Short: \ep{Armi}; NOT \ep{Block= +\& Imperial_Aramaic}) (31) +\& \ep{In: *} \ep{Present_In: *} (Perl extension) +\& X \ep{In_*} \ep{Block: *} +\& X \ep{Indic_Number_Forms} \ep{Common_Indic_Number_Forms} (= \ep{Block= +\& Common_Indic_Number_Forms}) (16) +\& \ep{Indic_Positional_Category: Bottom} (Short: \ep{InPC=Bottom}) +\& (351: U+093C, U+0941..0944, U+094D, +\& U+0952, U+0956..0957, U+0962..0963 ...) +\& \ep{Indic_Positional_Category: Bottom_And_Left} (Short: \ep{InPC= +\& BottomAndLeft}) (1: U+A9BF) +\& \ep{Indic_Positional_Category: Bottom_And_Right} (Short: \ep{InPC= +\& BottomAndRight}) (4: U+1B3B, U+A9BE, +\& U+A9C0, U+11942) +\& \ep{Indic_Positional_Category: Left} (Short: \ep{InPC=Left}) (64: +\& U+093F, U+094E, U+09BF, U+09C7..09C8, +\& U+0A3F, U+0ABF ...) +\& \ep{Indic_Positional_Category: Left_And_Right} (Short: \ep{InPC= +\& LeftAndRight}) (22: U+09CB..09CC, +\& U+0B4B, U+0BCA..0BCC, U+0D4A..0D4C, +\& U+0DDC, U+0DDE ...) +\& \ep{Indic_Positional_Category: NA} (Short: \ep{InPC=NA}) (1_112_902 +\& plus all above\-Unicode code points: +\& U+0000..08FF, U+0904..0939, U+093D, +\& U+0950, U+0958..0961, U+0964..0980 ...) +\& \ep{Indic_Positional_Category: Overstruck} (Short: \ep{InPC= +\& Overstruck}) (10: U+1CD4, U+1CE2..1CE8, +\& U+10A01, U+10A06) +\& \ep{Indic_Positional_Category: Right} (Short: \ep{InPC=Right}) (288: +\& U+0903, U+093B, U+093E, U+0940, +\& U+0949..094C, U+094F ...) +\& \ep{Indic_Positional_Category: Top} (Short: \ep{InPC=Top}) (415: +\& U+0900..0902, U+093A, U+0945..0948, +\& U+0951, U+0953..0955, U+0981 ...) +\& \ep{Indic_Positional_Category: Top_And_Bottom} (Short: \ep{InPC= +\& TopAndBottom}) (10: U+0C48, U+0F73, +\& U+0F76..0F79, U+0F81, U+1B3C, +\& U+1112E..1112F) +\& \ep{Indic_Positional_Category: Top_And_Bottom_And_Left} (Short: +\& \ep{InPC=TopAndBottomAndLeft}) (2: +\& U+103C, U+1171E) +\& \ep{Indic_Positional_Category: Top_And_Bottom_And_Right} (Short: +\& \ep{InPC=TopAndBottomAndRight}) (1: +\& U+1B3D) +\& \ep{Indic_Positional_Category: Top_And_Left} (Short: \ep{InPC= +\& TopAndLeft}) (6: U+0B48, U+0DDA, U+17BE, +\& U+1C29, U+114BB, U+115B9) +\& \ep{Indic_Positional_Category: Top_And_Left_And_Right} (Short: +\& \ep{InPC=TopAndLeftAndRight}) (4: U+0B4C, +\& U+0DDD, U+17BF, U+115BB) +\& \ep{Indic_Positional_Category: Top_And_Right} (Short: \ep{InPC= +\& TopAndRight}) (13: U+0AC9, U+0B57, +\& U+0CC0, U+0CC7..0CC8, U+0CCA..0CCB, +\& U+1925..1926 ...) +\& \ep{Indic_Positional_Category: Visual_Order_Left} (Short: \ep{InPC= +\& VisualOrderLeft}) (19: U+0E40..0E44, +\& U+0EC0..0EC4, U+19B5..19B7, U+19BA, +\& U+AAB5..AAB6, U+AAB9 ...) +\& X \ep{Indic_Siyaq_Numbers} \ep{Block=Indic_Siyaq_Numbers} (80) +\& \ep{Indic_Syllabic_Category: Avagraha} (Short: \ep{InSC=Avagraha}) +\& (17: U+093D, U+09BD, U+0ABD, U+0B3D, +\& U+0C3D, U+0CBD ...) +\& \ep{Indic_Syllabic_Category: Bindu} (Short: \ep{InSC=Bindu}) (91: +\& U+0900..0902, U+0981..0982, U+09FC, +\& U+0A01..0A02, U+0A70, U+0A81..0A82 ...) +\& \ep{Indic_Syllabic_Category: Brahmi_Joining_Number} (Short: +\& \ep{InSC=BrahmiJoiningNumber}) (20: +\& U+11052..11065) +\& \ep{Indic_Syllabic_Category: Cantillation_Mark} (Short: \ep{InSC= +\& CantillationMark}) (59: U+0951..0952, +\& U+0A51, U+0AFA..0AFC, U+1CD0..1CD2, +\& U+1CD4..1CE1, U+1CF4 ...) +\& \ep{Indic_Syllabic_Category: Consonant} (Short: \ep{InSC=Consonant}) +\& (2195: U+0915..0939, U+0958..095F, +\& U+0978..097F, U+0995..09A8, +\& U+09AA..09B0, U+09B2 ...) +\& \ep{Indic_Syllabic_Category: Consonant_Dead} (Short: \ep{InSC= +\& ConsonantDead}) (12: U+09CE, +\& U+0D54..0D56, U+0D7A..0D7F, U+1CF2..1CF3) +\& \ep{Indic_Syllabic_Category: Consonant_Final} (Short: \ep{InSC= +\& ConsonantFinal}) (67: U+1930..1931, +\& U+1933..1939, U+19C1..19C7, +\& U+1A58..1A59, U+1BBE..1BBF, U+1BF0..1BF1 +\& ...) +\& \ep{Indic_Syllabic_Category: Consonant_Head_Letter} (Short: +\& \ep{InSC=ConsonantHeadLetter}) (5: +\& U+0F88..0F8C) +\& \ep{Indic_Syllabic_Category: Consonant_Initial_Postfixed} (Short: +\& \ep{InSC=ConsonantInitialPostfixed}) (1: +\& U+1A5A) +\& \ep{Indic_Syllabic_Category: Consonant_Killer} (Short: \ep{InSC= +\& ConsonantKiller}) (2: U+0E4C, U+17CD) +\& \ep{Indic_Syllabic_Category: Consonant_Medial} (Short: \ep{InSC= +\& ConsonantMedial}) (31: U+0A75, +\& U+0EBC..0EBD, U+103B..103E, +\& U+105E..1060, U+1082, U+1A55..1A56 ...) +\& \ep{Indic_Syllabic_Category: Consonant_Placeholder} (Short: +\& \ep{InSC=ConsonantPlaceholder}) (22: [\e\- +\& \exa0\exd7], U+0980, U+0A72..0A73, U+104B, +\& U+104E, U+1900 ...) +\& \ep{Indic_Syllabic_Category: Consonant_Preceding_Repha} (Short: +\& \ep{InSC=ConsonantPrecedingRepha}) (3: +\& U+0D4E, U+11941, U+11D46) +\& \ep{Indic_Syllabic_Category: Consonant_Prefixed} (Short: \ep{InSC= +\& ConsonantPrefixed}) (10: U+111C2..111C3, +\& U+1193F, U+11A3A, U+11A84..11A89) +\& \ep{Indic_Syllabic_Category: Consonant_Subjoined} (Short: \ep{InSC= +\& ConsonantSubjoined}) (94: U+0F8D..0F97, +\& U+0F99..0FBC, U+1929..192B, U+1A57, +\& U+1A5B..1A5E, U+1BA1..1BA3 ...) +\& \ep{Indic_Syllabic_Category: Consonant_Succeeding_Repha} (Short: +\& \ep{InSC=ConsonantSucceedingRepha}) (4: +\& U+17CC, U+1B03, U+1B81, U+A982) +\& \ep{Indic_Syllabic_Category: Consonant_With_Stacker} (Short: +\& \ep{InSC=ConsonantWithStacker}) (8: +\& U+0CF1..0CF2, U+1CF5..1CF6, +\& U+11003..11004, U+11460..11461) +\& \ep{Indic_Syllabic_Category: Gemination_Mark} (Short: \ep{InSC= +\& GeminationMark}) (3: U+0A71, U+11237, +\& U+11A98) +\& \ep{Indic_Syllabic_Category: Invisible_Stacker} (Short: \ep{InSC= +\& InvisibleStacker}) (12: U+1039, U+17D2, +\& U+1A60, U+1BAB, U+AAF6, U+10A3F ...) +\& \ep{Indic_Syllabic_Category: Joiner} (Short: \ep{InSC=Joiner}) (1: +\& U+200D) +\& \ep{Indic_Syllabic_Category: Modifying_Letter} (Short: \ep{InSC= +\& ModifyingLetter}) (1: U+0B83) +\& \ep{Indic_Syllabic_Category: Non_Joiner} (Short: \ep{InSC= +\& NonJoiner}) (1: U+200C) +\& \ep{Indic_Syllabic_Category: Nukta} (Short: \ep{InSC=Nukta}) (31: +\& U+093C, U+09BC, U+0A3C, U+0ABC, +\& U+0AFD..0AFF, U+0B3C ...) +\& \ep{Indic_Syllabic_Category: Number} (Short: \ep{InSC=Number}) (491: +\& [0\-9], U+0966..096F, U+09E6..09EF, +\& U+0A66..0A6F, U+0AE6..0AEF, U+0B66..0B6F +\& ...) +\& \ep{Indic_Syllabic_Category: Number_Joiner} (Short: \ep{InSC= +\& NumberJoiner}) (1: U+1107F) +\& \ep{Indic_Syllabic_Category: Other} (Short: \ep{InSC=Other}) +\& (1_109_572 plus all above\-Unicode code +\& points: [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,. +\& \e/:;<=>?\e@A\-Z\e[\e\e\e]\e^_\`a\-z\e{\e|\e}~\ex7f\- +\& \ex9f\exa1\-\exb1\exb4\-\exd6\exd8\-\exff], +\& U+0100..08FF, U+0950, U+0953..0954, +\& U+0964..0965, U+0970..0971 ...) +\& \ep{Indic_Syllabic_Category: Pure_Killer} (Short: \ep{InSC= +\& PureKiller}) (23: U+0D3B..0D3C, U+0E3A, +\& U+0E4E, U+0EBA, U+0F84, U+103A ...) +\& \ep{Indic_Syllabic_Category: Register_Shifter} (Short: \ep{InSC= +\& RegisterShifter}) (2: U+17C9..17CA) +\& \ep{Indic_Syllabic_Category: Syllable_Modifier} (Short: \ep{InSC= +\& SyllableModifier}) (25: [\exb2\-\exb3], +\& U+09FE, U+0F35, U+0F37, U+0FC6, U+17CB +\& ...) +\& \ep{Indic_Syllabic_Category: Tone_Letter} (Short: \ep{InSC= +\& ToneLetter}) (7: U+1970..1974, U+AAC0, +\& U+AAC2) +\& \ep{Indic_Syllabic_Category: Tone_Mark} (Short: \ep{InSC=ToneMark}) +\& (42: U+0E48..0E4B, U+0EC8..0ECB, U+1037, +\& U+1063..1064, U+1069..106D, U+1087..108D +\& ...) +\& \ep{Indic_Syllabic_Category: Virama} (Short: \ep{InSC=Virama}) (27: +\& U+094D, U+09CD, U+0A4D, U+0ACD, U+0B4D, +\& U+0BCD ...) +\& \ep{Indic_Syllabic_Category: Visarga} (Short: \ep{InSC=Visarga}) +\& (35: U+0903, U+0983, U+0A03, U+0A83, +\& U+0B03, U+0C03 ...) +\& \ep{Indic_Syllabic_Category: Vowel} (Short: \ep{InSC=Vowel}) (30: +\& U+1963..196D, U+A85E..A861, U+A866, +\& U+A922..A92A, U+11150..11154) +\& \ep{Indic_Syllabic_Category: Vowel_Dependent} (Short: \ep{InSC= +\& VowelDependent}) (683: U+093A..093B, +\& U+093E..094C, U+094E..094F, +\& U+0955..0957, U+0962..0963, U+09BE..09C4 +\& ...) +\& \ep{Indic_Syllabic_Category: Vowel_Independent} (Short: \ep{InSC= +\& VowelIndependent}) (484: U+0904..0914, +\& U+0960..0961, U+0972..0977, +\& U+0985..098C, U+098F..0990, U+0993..0994 +\& ...) +\& \ep{Inherited} \ep{Script_Extensions=Inherited} (Short: +\& \ep{Zinh}) (503) +\& \ep{Initial_Punctuation} \ep{General_Category=Initial_Punctuation} +\& (Short: \ep{Pi}) (12) +\& \ep{InPC: *} \ep{Indic_Positional_Category: *} +\& \ep{InSC: *} \ep{Indic_Syllabic_Category: *} +\& \ep{Inscriptional_Pahlavi} \ep{Script_Extensions= +\& Inscriptional_Pahlavi} (Short: \ep{Phli}; +\& NOT \ep{Block=Inscriptional_Pahlavi}) (27) +\& \ep{Inscriptional_Parthian} \ep{Script_Extensions= +\& Inscriptional_Parthian} (Short: +\& \ep{Prti}; NOT \ep{Block= +\& Inscriptional_Parthian}) (30) +\& X \ep{IPA_Ext} \ep{IPA_Extensions} (= \ep{Block= +\& IPA_Extensions}) (96) +\& X \ep{IPA_Extensions} \ep{Block=IPA_Extensions} (Short: +\& \ep{InIPAExt}) (96) +\& \ep{Is_*} \ep{*} (Any exceptions are individually +\& noted beginning with the word NOT.) If +\& an entry has flag(s) at its beginning, +\& like "D", the "Is_" form has the same +\& flag(s) +\& \ep{Ital} \ep{Old_Italic} (= \ep{Script_Extensions= +\& Old_Italic}) (NOT \ep{Block=Old_Italic}) +\& (39) +\& X \ep{Jamo} \ep{Hangul_Jamo} (= \ep{Block=Hangul_Jamo}) +\& (256) +\& X \ep{Jamo_Ext_A} \ep{Hangul_Jamo_Extended_A} (= \ep{Block= +\& Hangul_Jamo_Extended_A}) (32) +\& X \ep{Jamo_Ext_B} \ep{Hangul_Jamo_Extended_B} (= \ep{Block= +\& Hangul_Jamo_Extended_B}) (80) +\& \ep{Java} \ep{Javanese} (= \ep{Script_Extensions= +\& Javanese}) (NOT \ep{Block=Javanese}) (91) +\& \ep{Javanese} \ep{Script_Extensions=Javanese} (Short: +\& \ep{Java}; NOT \ep{Block=Javanese}) (91) +\& \ep{Jg: *} \ep{Joining_Group: *} +\& \ep{Join_C} \ep{Join_Control} (= \ep{Join_Control=Y}) (2) +\& \ep{Join_C: *} \ep{Join_Control: *} +\& \ep{Join_Control} \ep{Join_Control=Y} (Short: \ep{JoinC}) (2) +\& \ep{Join_Control: N*} (Short: \ep{JoinC=N}, \eP{JoinC}) (1_114_110 +\& plus all above\-Unicode code points: +\& U+0000..200B, U+200E..infinity) +\& \ep{Join_Control: Y*} (Short: \ep{JoinC=Y}, \ep{JoinC}) (2: +\& U+200C..200D) +\& \ep{Joining_Group: African_Feh} (Short: \ep{Jg=AfricanFeh}) (1: +\& U+08BB) +\& \ep{Joining_Group: African_Noon} (Short: \ep{Jg=AfricanNoon}) (1: +\& U+08BD) +\& \ep{Joining_Group: African_Qaf} (Short: \ep{Jg=AfricanQaf}) (2: +\& U+08BC, U+08C4) +\& \ep{Joining_Group: Ain} (Short: \ep{Jg=Ain}) (9: U+0639..063A, +\& U+06A0, U+06FC, U+075D..075F, U+08B3, +\& U+08C3) +\& \ep{Joining_Group: Alaph} (Short: \ep{Jg=Alaph}) (1: U+0710) +\& \ep{Joining_Group: Alef} (Short: \ep{Jg=Alef}) (10: U+0622..0623, +\& U+0625, U+0627, U+0671..0673, U+0675, +\& U+0773..0774) +\& \ep{Joining_Group: Beh} (Short: \ep{Jg=Beh}) (27: U+0628, +\& U+062A..062B, U+066E, U+0679..0680, +\& U+0750..0756, U+08A0..08A1 ...) +\& \ep{Joining_Group: Beth} (Short: \ep{Jg=Beth}) (2: U+0712, U+072D) +\& \ep{Joining_Group: Burushaski_Yeh_Barree} (Short: \ep{Jg= +\& BurushaskiYehBarree}) (2: U+077A..077B) +\& \ep{Joining_Group: Dal} (Short: \ep{Jg=Dal}) (15: U+062F..0630, +\& U+0688..0690, U+06EE, U+0759..075A, +\& U+08AE) +\& \ep{Joining_Group: Dalath_Rish} (Short: \ep{Jg=DalathRish}) (4: +\& U+0715..0716, U+072A, U+072F) +\& \ep{Joining_Group: E} (Short: \ep{Jg=E}) (1: U+0725) +\& \ep{Joining_Group: Farsi_Yeh} (Short: \ep{Jg=FarsiYeh}) (7: +\& U+063D..063F, U+06CC, U+06CE, +\& U+0775..0776) +\& \ep{Joining_Group: Fe} (Short: \ep{Jg=Fe}) (1: U+074F) +\& \ep{Joining_Group: Feh} (Short: \ep{Jg=Feh}) (10: U+0641, +\& U+06A1..06A6, U+0760..0761, U+08A4) +\& \ep{Joining_Group: Final_Semkath} (Short: \ep{Jg=FinalSemkath}) (1: +\& U+0724) +\& \ep{Joining_Group: Gaf} (Short: \ep{Jg=Gaf}) (15: U+063B..063C, +\& U+06A9, U+06AB, U+06AF..06B4, +\& U+0762..0764, U+08B0 ...) +\& \ep{Joining_Group: Gamal} (Short: \ep{Jg=Gamal}) (3: U+0713..0714, +\& U+072E) +\& \ep{Joining_Group: Hah} (Short: \ep{Jg=Hah}) (21: U+062C..062E, +\& U+0681..0687, U+06BF, U+0757..0758, +\& U+076E..076F, U+0772 ...) +\& \ep{Joining_Group: Hamza_On_Heh_Goal} (Short: \ep{Jg= +\& HamzaOnHehGoal}) (1: U+06C3) +\& \ep{Joining_Group: Hanifi_Rohingya_Kinna_Ya} (Short: \ep{Jg= +\& HanifiRohingyaKinnaYa}) (4: U+10D19, +\& U+10D1E, U+10D20, U+10D23) +\& \ep{Joining_Group: Hanifi_Rohingya_Pa} (Short: \ep{Jg= +\& HanifiRohingyaPa}) (3: U+10D02, U+10D09, +\& U+10D1C) +\& \ep{Joining_Group: He} (Short: \ep{Jg=He}) (1: U+0717) +\& \ep{Joining_Group: Heh} (Short: \ep{Jg=Heh}) (1: U+0647) +\& \ep{Joining_Group: Heh_Goal} (Short: \ep{Jg=HehGoal}) (2: +\& U+06C1..06C2) +\& \ep{Joining_Group: Heth} (Short: \ep{Jg=Heth}) (1: U+071A) +\& \ep{Joining_Group: Kaf} (Short: \ep{Jg=Kaf}) (6: U+0643, +\& U+06AC..06AE, U+077F, U+08B4) +\& \ep{Joining_Group: Kaph} (Short: \ep{Jg=Kaph}) (1: U+071F) +\& \ep{Joining_Group: Khaph} (Short: \ep{Jg=Khaph}) (1: U+074E) +\& \ep{Joining_Group: Knotted_Heh} (Short: \ep{Jg=KnottedHeh}) (2: +\& U+06BE, U+06FF) +\& \ep{Joining_Group: Lam} (Short: \ep{Jg=Lam}) (8: U+0644, +\& U+06B5..06B8, U+076A, U+08A6, U+08C7) +\& \ep{Joining_Group: Lamadh} (Short: \ep{Jg=Lamadh}) (1: U+0720) +\& \ep{Joining_Group: Malayalam_Bha} (Short: \ep{Jg=MalayalamBha}) (1: +\& U+0866) +\& \ep{Joining_Group: Malayalam_Ja} (Short: \ep{Jg=MalayalamJa}) (1: +\& U+0861) +\& \ep{Joining_Group: Malayalam_Lla} (Short: \ep{Jg=MalayalamLla}) (1: +\& U+0868) +\& \ep{Joining_Group: Malayalam_Llla} (Short: \ep{Jg=MalayalamLlla}) +\& (1: U+0869) +\& \ep{Joining_Group: Malayalam_Nga} (Short: \ep{Jg=MalayalamNga}) (1: +\& U+0860) +\& \ep{Joining_Group: Malayalam_Nna} (Short: \ep{Jg=MalayalamNna}) (1: +\& U+0864) +\& \ep{Joining_Group: Malayalam_Nnna} (Short: \ep{Jg=MalayalamNnna}) +\& (1: U+0865) +\& \ep{Joining_Group: Malayalam_Nya} (Short: \ep{Jg=MalayalamNya}) (1: +\& U+0862) +\& \ep{Joining_Group: Malayalam_Ra} (Short: \ep{Jg=MalayalamRa}) (1: +\& U+0867) +\& \ep{Joining_Group: Malayalam_Ssa} (Short: \ep{Jg=MalayalamSsa}) (1: +\& U+086A) +\& \ep{Joining_Group: Malayalam_Tta} (Short: \ep{Jg=MalayalamTta}) (1: +\& U+0863) +\& \ep{Joining_Group: Manichaean_Aleph} (Short: \ep{Jg= +\& ManichaeanAleph}) (1: U+10AC0) +\& \ep{Joining_Group: Manichaean_Ayin} (Short: \ep{Jg=ManichaeanAyin}) +\& (2: U+10AD9..10ADA) +\& \ep{Joining_Group: Manichaean_Beth} (Short: \ep{Jg=ManichaeanBeth}) +\& (2: U+10AC1..10AC2) +\& \ep{Joining_Group: Manichaean_Daleth} (Short: \ep{Jg= +\& ManichaeanDaleth}) (1: U+10AC5) +\& \ep{Joining_Group: Manichaean_Dhamedh} (Short: \ep{Jg= +\& ManichaeanDhamedh}) (1: U+10AD4) +\& \ep{Joining_Group: Manichaean_Five} (Short: \ep{Jg=ManichaeanFive}) +\& (1: U+10AEC) +\& \ep{Joining_Group: Manichaean_Gimel} (Short: \ep{Jg= +\& ManichaeanGimel}) (2: U+10AC3..10AC4) +\& \ep{Joining_Group: Manichaean_Heth} (Short: \ep{Jg=ManichaeanHeth}) +\& (1: U+10ACD) +\& \ep{Joining_Group: Manichaean_Hundred} (Short: \ep{Jg= +\& ManichaeanHundred}) (1: U+10AEF) +\& \ep{Joining_Group: Manichaean_Kaph} (Short: \ep{Jg=ManichaeanKaph}) +\& (3: U+10AD0..10AD2) +\& \ep{Joining_Group: Manichaean_Lamedh} (Short: \ep{Jg= +\& ManichaeanLamedh}) (1: U+10AD3) +\& \ep{Joining_Group: Manichaean_Mem} (Short: \ep{Jg=ManichaeanMem}) +\& (1: U+10AD6) +\& \ep{Joining_Group: Manichaean_Nun} (Short: \ep{Jg=ManichaeanNun}) +\& (1: U+10AD7) +\& \ep{Joining_Group: Manichaean_One} (Short: \ep{Jg=ManichaeanOne}) +\& (1: U+10AEB) +\& \ep{Joining_Group: Manichaean_Pe} (Short: \ep{Jg=ManichaeanPe}) (2: +\& U+10ADB..10ADC) +\& \ep{Joining_Group: Manichaean_Qoph} (Short: \ep{Jg=ManichaeanQoph}) +\& (3: U+10ADE..10AE0) +\& \ep{Joining_Group: Manichaean_Resh} (Short: \ep{Jg=ManichaeanResh}) +\& (1: U+10AE1) +\& \ep{Joining_Group: Manichaean_Sadhe} (Short: \ep{Jg= +\& ManichaeanSadhe}) (1: U+10ADD) +\& \ep{Joining_Group: Manichaean_Samekh} (Short: \ep{Jg= +\& ManichaeanSamekh}) (1: U+10AD8) +\& \ep{Joining_Group: Manichaean_Taw} (Short: \ep{Jg=ManichaeanTaw}) +\& (1: U+10AE4) +\& \ep{Joining_Group: Manichaean_Ten} (Short: \ep{Jg=ManichaeanTen}) +\& (1: U+10AED) +\& \ep{Joining_Group: Manichaean_Teth} (Short: \ep{Jg=ManichaeanTeth}) +\& (1: U+10ACE) +\& \ep{Joining_Group: Manichaean_Thamedh} (Short: \ep{Jg= +\& ManichaeanThamedh}) (1: U+10AD5) +\& \ep{Joining_Group: Manichaean_Twenty} (Short: \ep{Jg= +\& ManichaeanTwenty}) (1: U+10AEE) +\& \ep{Joining_Group: Manichaean_Waw} (Short: \ep{Jg=ManichaeanWaw}) +\& (1: U+10AC7) +\& \ep{Joining_Group: Manichaean_Yodh} (Short: \ep{Jg=ManichaeanYodh}) +\& (1: U+10ACF) +\& \ep{Joining_Group: Manichaean_Zayin} (Short: \ep{Jg= +\& ManichaeanZayin}) (2: U+10AC9..10ACA) +\& \ep{Joining_Group: Meem} (Short: \ep{Jg=Meem}) (4: U+0645, +\& U+0765..0766, U+08A7) +\& \ep{Joining_Group: Mim} (Short: \ep{Jg=Mim}) (1: U+0721) +\& \ep{Joining_Group: No_Joining_Group} (Short: \ep{Jg=NoJoiningGroup}) +\& (1_113_790 plus all above\-Unicode code +\& points: U+0000..061F, U+0621, U+0640, +\& U+064B..066D, U+0670, U+0674 ...) +\& \ep{Joining_Group: Noon} (Short: \ep{Jg=Noon}) (8: U+0646, +\& U+06B9..06BC, U+0767..0769) +\& \ep{Joining_Group: Nun} (Short: \ep{Jg=Nun}) (1: U+0722) +\& \ep{Joining_Group: Nya} (Short: \ep{Jg=Nya}) (1: U+06BD) +\& \ep{Joining_Group: Pe} (Short: \ep{Jg=Pe}) (1: U+0726) +\& \ep{Joining_Group: Qaf} (Short: \ep{Jg=Qaf}) (5: U+0642, U+066F, +\& U+06A7..06A8, U+08A5) +\& \ep{Joining_Group: Qaph} (Short: \ep{Jg=Qaph}) (1: U+0729) +\& \ep{Joining_Group: Reh} (Short: \ep{Jg=Reh}) (19: U+0631..0632, +\& U+0691..0699, U+06EF, U+075B, +\& U+076B..076C, U+0771 ...) +\& \ep{Joining_Group: Reversed_Pe} (Short: \ep{Jg=ReversedPe}) (1: +\& U+0727) +\& \ep{Joining_Group: Rohingya_Yeh} (Short: \ep{Jg=RohingyaYeh}) (1: +\& U+08AC) +\& \ep{Joining_Group: Sad} (Short: \ep{Jg=Sad}) (6: U+0635..0636, +\& U+069D..069E, U+06FB, U+08AF) +\& \ep{Joining_Group: Sadhe} (Short: \ep{Jg=Sadhe}) (1: U+0728) +\& \ep{Joining_Group: Seen} (Short: \ep{Jg=Seen}) (11: U+0633..0634, +\& U+069A..069C, U+06FA, U+075C, U+076D, +\& U+0770 ...) +\& \ep{Joining_Group: Semkath} (Short: \ep{Jg=Semkath}) (1: U+0723) +\& \ep{Joining_Group: Shin} (Short: \ep{Jg=Shin}) (1: U+072B) +\& \ep{Joining_Group: Straight_Waw} (Short: \ep{Jg=StraightWaw}) (1: +\& U+08B1) +\& \ep{Joining_Group: Swash_Kaf} (Short: \ep{Jg=SwashKaf}) (1: U+06AA) +\& \ep{Joining_Group: Syriac_Waw} (Short: \ep{Jg=SyriacWaw}) (1: U+0718) +\& \ep{Joining_Group: Tah} (Short: \ep{Jg=Tah}) (4: U+0637..0638, +\& U+069F, U+08A3) +\& \ep{Joining_Group: Taw} (Short: \ep{Jg=Taw}) (1: U+072C) +\& \ep{Joining_Group: Teh_Marbuta} (Short: \ep{Jg=TehMarbuta}) (3: +\& U+0629, U+06C0, U+06D5) +\& \ep{Joining_Group: Teh_Marbuta_Goal} \ep{Joining_Group= +\& Hamza_On_Heh_Goal} (1) +\& \ep{Joining_Group: Teth} (Short: \ep{Jg=Teth}) (2: U+071B..071C) +\& \ep{Joining_Group: Waw} (Short: \ep{Jg=Waw}) (16: U+0624, U+0648, +\& U+0676..0677, U+06C4..06CB, U+06CF, +\& U+0778..0779 ...) +\& \ep{Joining_Group: Yeh} (Short: \ep{Jg=Yeh}) (11: U+0620, U+0626, +\& U+0649..064A, U+0678, U+06D0..06D1, +\& U+0777 ...) +\& \ep{Joining_Group: Yeh_Barree} (Short: \ep{Jg=YehBarree}) (2: +\& U+06D2..06D3) +\& \ep{Joining_Group: Yeh_With_Tail} (Short: \ep{Jg=YehWithTail}) (1: +\& U+06CD) +\& \ep{Joining_Group: Yudh} (Short: \ep{Jg=Yudh}) (1: U+071D) +\& \ep{Joining_Group: Yudh_He} (Short: \ep{Jg=YudhHe}) (1: U+071E) +\& \ep{Joining_Group: Zain} (Short: \ep{Jg=Zain}) (1: U+0719) +\& \ep{Joining_Group: Zhain} (Short: \ep{Jg=Zhain}) (1: U+074D) +\& \ep{Joining_Type: C} \ep{Joining_Type=Join_Causing} (4) +\& \ep{Joining_Type: D} \ep{Joining_Type=Dual_Joining} (586) +\& \ep{Joining_Type: Dual_Joining} (Short: \ep{Jt=D}) (586: U+0620, +\& U+0626, U+0628, U+062A..062E, +\& U+0633..063F, U+0641..0647 ...) +\& \ep{Joining_Type: Join_Causing} (Short: \ep{Jt=C}) (4: U+0640, +\& U+07FA, U+180A, U+200D) +\& \ep{Joining_Type: L} \ep{Joining_Type=Left_Joining} (5) +\& \ep{Joining_Type: Left_Joining} (Short: \ep{Jt=L}) (5: U+A872, +\& U+10ACD, U+10AD7, U+10D00, U+10FCB) +\& \ep{Joining_Type: Non_Joining} (Short: \ep{Jt=U}) (1_111_390 plus +\& all above\-Unicode code points: [\ex00\- +\& \exac\exae\-\exff], U+0100..02FF, +\& U+0370..0482, U+048A..0590, U+05BE, +\& U+05C0 ...) +\& \ep{Joining_Type: R} \ep{Joining_Type=Right_Joining} (130) +\& \ep{Joining_Type: Right_Joining} (Short: \ep{Jt=R}) (130: +\& U+0622..0625, U+0627, U+0629, +\& U+062F..0632, U+0648, U+0671..0673 ...) +\& \ep{Joining_Type: T} \ep{Joining_Type=Transparent} (1997) +\& \ep{Joining_Type: Transparent} (Short: \ep{Jt=T}) (1997: [\exad], +\& U+0300..036F, U+0483..0489, +\& U+0591..05BD, U+05BF, U+05C1..05C2 ...) +\& \ep{Joining_Type: U} \ep{Joining_Type=Non_Joining} (1_111_390 +\& plus all above\-Unicode code points) +\& \ep{Jt: *} \ep{Joining_Type: *} +\& \ep{Kaithi} \ep{Script_Extensions=Kaithi} (Short: +\& \ep{Kthi}; NOT \ep{Block=Kaithi}) (87) +\& \ep{Kali} \ep{Kayah_Li} (= \ep{Script_Extensions= +\& Kayah_Li}) (48) +\& \ep{Kana} \ep{Katakana} (= \ep{Script_Extensions= +\& Katakana}) (NOT \ep{Block=Katakana}) (356) +\& X \ep{Kana_Ext_A} \ep{Kana_Extended_A} (= \ep{Block= +\& Kana_Extended_A}) (48) +\& X \ep{Kana_Extended_A} \ep{Block=Kana_Extended_A} (Short: +\& \ep{InKanaExtA}) (48) +\& X \ep{Kana_Sup} \ep{Kana_Supplement} (= \ep{Block= +\& Kana_Supplement}) (256) +\& X \ep{Kana_Supplement} \ep{Block=Kana_Supplement} (Short: +\& \ep{InKanaSup}) (256) +\& X \ep{Kanbun} \ep{Block=Kanbun} (16) +\& X \ep{Kangxi} \ep{Kangxi_Radicals} (= \ep{Block= +\& Kangxi_Radicals}) (224) +\& X \ep{Kangxi_Radicals} \ep{Block=Kangxi_Radicals} (Short: +\& \ep{InKangxi}) (224) +\& \ep{Kannada} \ep{Script_Extensions=Kannada} (Short: +\& \ep{Knda}; NOT \ep{Block=Kannada}) (104) +\& \ep{Katakana} \ep{Script_Extensions=Katakana} (Short: +\& \ep{Kana}; NOT \ep{Block=Katakana}) (356) +\& X \ep{Katakana_Ext} \ep{Katakana_Phonetic_Extensions} (= +\& \ep{Block=Katakana_Phonetic_Extensions}) +\& (16) +\& X \ep{Katakana_Phonetic_Extensions} \ep{Block= +\& Katakana_Phonetic_Extensions} (Short: +\& \ep{InKatakanaExt}) (16) +\& \ep{Kayah_Li} \ep{Script_Extensions=Kayah_Li} (Short: +\& \ep{Kali}) (48) +\& \ep{Khar} \ep{Kharoshthi} (= \ep{Script_Extensions= +\& Kharoshthi}) (NOT \ep{Block=Kharoshthi}) +\& (68) +\& \ep{Kharoshthi} \ep{Script_Extensions=Kharoshthi} (Short: +\& \ep{Khar}; NOT \ep{Block=Kharoshthi}) (68) +\& \ep{Khitan_Small_Script} \ep{Script_Extensions=Khitan_Small_Script} +\& (Short: \ep{Kits}; NOT \ep{Block= +\& Khitan_Small_Script}) (471) +\& \ep{Khmer} \ep{Script_Extensions=Khmer} (Short: +\& \ep{Khmr}; NOT \ep{Block=Khmer}) (146) +\& X \ep{Khmer_Symbols} \ep{Block=Khmer_Symbols} (32) +\& \ep{Khmr} \ep{Khmer} (= \ep{Script_Extensions=Khmer}) +\& (NOT \ep{Block=Khmer}) (146) +\& \ep{Khoj} \ep{Khojki} (= \ep{Script_Extensions= +\& Khojki}) (NOT \ep{Block=Khojki}) (82) +\& \ep{Khojki} \ep{Script_Extensions=Khojki} (Short: +\& \ep{Khoj}; NOT \ep{Block=Khojki}) (82) +\& \ep{Khudawadi} \ep{Script_Extensions=Khudawadi} (Short: +\& \ep{Sind}; NOT \ep{Block=Khudawadi}) (81) +\& \ep{Kits} \ep{Khitan_Small_Script} (= +\& \ep{Script_Extensions= +\& Khitan_Small_Script}) (NOT \ep{Block= +\& Khitan_Small_Script}) (471) +\& \ep{Knda} \ep{Kannada} (= \ep{Script_Extensions= +\& Kannada}) (NOT \ep{Block=Kannada}) (104) +\& \ep{Kthi} \ep{Kaithi} (= \ep{Script_Extensions= +\& Kaithi}) (NOT \ep{Block=Kaithi}) (87) +\& \ep{L} \epL \ep{Letter} (= \ep{General_Category=Letter}) +\& (131_241) +\& X \ep{L&} \ep{Cased_Letter} (= \ep{General_Category= +\& Cased_Letter}) (3977) +\& X \ep{L_} \ep{Cased_Letter} (= \ep{General_Category= +\& Cased_Letter}) Note the trailing \*(Aq_\*(Aq +\& matters in spite of loose matching +\& rules. (3977) +\& \ep{Lana} \ep{Tai_Tham} (= \ep{Script_Extensions= +\& Tai_Tham}) (NOT \ep{Block=Tai_Tham}) (127) +\& \ep{Lao} \ep{Script_Extensions=Lao} (NOT \ep{Block= +\& Lao}) (82) +\& \ep{Laoo} \ep{Lao} (= \ep{Script_Extensions=Lao}) (NOT +\& \ep{Block=Lao}) (82) +\& \ep{Latin} \ep{Script_Extensions=Latin} (Short: +\& \ep{Latn}) (1403) +\& X \ep{Latin_1} \ep{Latin_1_Supplement} (= \ep{Block= +\& Latin_1_Supplement}) (128) +\& X \ep{Latin_1_Sup} \ep{Latin_1_Supplement} (= \ep{Block= +\& Latin_1_Supplement}) (128) +\& X \ep{Latin_1_Supplement} \ep{Block=Latin_1_Supplement} (Short: +\& \ep{InLatin1}) (128) +\& X \ep{Latin_Ext_A} \ep{Latin_Extended_A} (= \ep{Block= +\& Latin_Extended_A}) (128) +\& X \ep{Latin_Ext_Additional} \ep{Latin_Extended_Additional} (= +\& \ep{Block=Latin_Extended_Additional}) +\& (256) +\& X \ep{Latin_Ext_B} \ep{Latin_Extended_B} (= \ep{Block= +\& Latin_Extended_B}) (208) +\& X \ep{Latin_Ext_C} \ep{Latin_Extended_C} (= \ep{Block= +\& Latin_Extended_C}) (32) +\& X \ep{Latin_Ext_D} \ep{Latin_Extended_D} (= \ep{Block= +\& Latin_Extended_D}) (224) +\& X \ep{Latin_Ext_E} \ep{Latin_Extended_E} (= \ep{Block= +\& Latin_Extended_E}) (64) +\& X \ep{Latin_Extended_A} \ep{Block=Latin_Extended_A} (Short: +\& \ep{InLatinExtA}) (128) +\& X \ep{Latin_Extended_Additional} \ep{Block=Latin_Extended_Additional} +\& (Short: \ep{InLatinExtAdditional}) (256) +\& X \ep{Latin_Extended_B} \ep{Block=Latin_Extended_B} (Short: +\& \ep{InLatinExtB}) (208) +\& X \ep{Latin_Extended_C} \ep{Block=Latin_Extended_C} (Short: +\& \ep{InLatinExtC}) (32) +\& X \ep{Latin_Extended_D} \ep{Block=Latin_Extended_D} (Short: +\& \ep{InLatinExtD}) (224) +\& X \ep{Latin_Extended_E} \ep{Block=Latin_Extended_E} (Short: +\& \ep{InLatinExtE}) (64) +\& \ep{Latn} \ep{Latin} (= \ep{Script_Extensions=Latin}) +\& (1403) +\& \ep{Lb: *} \ep{Line_Break: *} +\& \ep{LC} \ep{Cased_Letter} (= \ep{General_Category= +\& Cased_Letter}) (3977) +\& \ep{Lepc} \ep{Lepcha} (= \ep{Script_Extensions= +\& Lepcha}) (NOT \ep{Block=Lepcha}) (74) +\& \ep{Lepcha} \ep{Script_Extensions=Lepcha} (Short: +\& \ep{Lepc}; NOT \ep{Block=Lepcha}) (74) +\& \ep{Letter} \ep{General_Category=Letter} (Short: \ep{L}) +\& (131_241) +\& \ep{Letter_Number} \ep{General_Category=Letter_Number} (Short: +\& \ep{Nl}) (236) +\& X \ep{Letterlike_Symbols} \ep{Block=Letterlike_Symbols} (80) +\& \ep{Limb} \ep{Limbu} (= \ep{Script_Extensions=Limbu}) +\& (NOT \ep{Block=Limbu}) (69) +\& \ep{Limbu} \ep{Script_Extensions=Limbu} (Short: +\& \ep{Limb}; NOT \ep{Block=Limbu}) (69) +\& \ep{Lina} \ep{Linear_A} (= \ep{Script_Extensions= +\& Linear_A}) (NOT \ep{Block=Linear_A}) (386) +\& \ep{Linb} \ep{Linear_B} (= \ep{Script_Extensions= +\& Linear_B}) (268) +\& \ep{Line_Break: AI} \ep{Line_Break=Ambiguous} (707) +\& \ep{Line_Break: AL} \ep{Line_Break=Alphabetic} (21_400) +\& \ep{Line_Break: Alphabetic} (Short: \ep{Lb=AL}) (21_400: [#&*<=>\e@A\- +\& Z\e^_\`a\-z~\exa6\exa9\exac\exae\-\exaf\exb5\exc0\- +\& \exd6\exd8\-\exf6\exf8\-\exff], U+0100..02C6, +\& U+02CE..02CF, U+02D1..02D7, U+02DC, +\& U+02DE ...) +\& \ep{Line_Break: Ambiguous} (Short: \ep{Lb=AI}) (707: [\exa7\-\exa8\exaa +\& \exb2\-\exb3\exb6\-\exba\exbc\-\exbe\exd7\exf7], +\& U+02C7, U+02C9..02CB, U+02CD, U+02D0, +\& U+02D8..02DB ...) +\& \ep{Line_Break: B2} \ep{Line_Break=Break_Both} (3) +\& \ep{Line_Break: BA} \ep{Line_Break=Break_After} (244) +\& \ep{Line_Break: BB} \ep{Line_Break=Break_Before} (45) +\& \ep{Line_Break: BK} \ep{Line_Break=Mandatory_Break} (4) +\& \ep{Line_Break: Break_After} (Short: \ep{Lb=BA}) (244: [\et\e|\exad], +\& U+058A, U+05BE, U+0964..0965, +\& U+0E5A..0E5B, U+0F0B ...) +\& \ep{Line_Break: Break_Before} (Short: \ep{Lb=BB}) (45: [\exb4], +\& U+02C8, U+02CC, U+02DF, U+0C77, U+0C84 +\& ...) +\& \ep{Line_Break: Break_Both} (Short: \ep{Lb=B2}) (3: U+2014, +\& U+2E3A..2E3B) +\& \ep{Line_Break: Break_Symbols} (Short: \ep{Lb=SY}) (1: [\e/]) +\& \ep{Line_Break: Carriage_Return} (Short: \ep{Lb=CR}) (1: [\er]) +\& \ep{Line_Break: CB} \ep{Line_Break=Contingent_Break} (1) +\& \ep{Line_Break: CJ} \ep{Line_Break= +\& Conditional_Japanese_Starter} (58) +\& \ep{Line_Break: CL} \ep{Line_Break=Close_Punctuation} (91) +\& \ep{Line_Break: Close_Parenthesis} (Short: \ep{Lb=CP}) (2: [\e)\e]]) +\& \ep{Line_Break: Close_Punctuation} (Short: \ep{Lb=CL}) (91: [\e}], +\& U+0F3B, U+0F3D, U+169C, U+2046, U+207E +\& ...) +\& \ep{Line_Break: CM} \ep{Line_Break=Combining_Mark} (2286) +\& \ep{Line_Break: Combining_Mark} (Short: \ep{Lb=CM}) (2286: [^\et\en +\& \ecK\ef\er\ex20\-\ex7e\ex85\exa0\-\exff], +\& U+0300..034E, U+0350..035B, +\& U+0363..036F, U+0483..0489, U+0591..05BD +\& ...) +\& \ep{Line_Break: Complex_Context} (Short: \ep{Lb=SA}) (750: +\& U+0E01..0E3A, U+0E40..0E4E, +\& U+0E81..0E82, U+0E84, U+0E86..0E8A, +\& U+0E8C..0EA3 ...) +\& \ep{Line_Break: Conditional_Japanese_Starter} (Short: \ep{Lb=CJ}) +\& (58: U+3041, U+3043, U+3045, U+3047, +\& U+3049, U+3063 ...) +\& \ep{Line_Break: Contingent_Break} (Short: \ep{Lb=CB}) (1: U+FFFC) +\& \ep{Line_Break: CP} \ep{Line_Break=Close_Parenthesis} (2) +\& \ep{Line_Break: CR} \ep{Line_Break=Carriage_Return} (1) +\& \ep{Line_Break: E_Base} (Short: \ep{Lb=EB}) (122: U+261D, U+26F9, +\& U+270A..270D, U+1F385, U+1F3C2..1F3C4, +\& U+1F3C7 ...) +\& \ep{Line_Break: E_Modifier} (Short: \ep{Lb=EM}) (5: U+1F3FB..1F3FF) +\& \ep{Line_Break: EB} \ep{Line_Break=E_Base} (122) +\& \ep{Line_Break: EM} \ep{Line_Break=E_Modifier} (5) +\& \ep{Line_Break: EX} \ep{Line_Break=Exclamation} (37) +\& \ep{Line_Break: Exclamation} (Short: \ep{Lb=EX}) (37: [!?], U+05C6, +\& U+061B, U+061E..061F, U+06D4, U+07F9 ...) +\& \ep{Line_Break: GL} \ep{Line_Break=Glue} (26) +\& \ep{Line_Break: Glue} (Short: \ep{Lb=GL}) (26: [\exa0], U+034F, +\& U+035C..0362, U+0F08, U+0F0C, U+0F12 ...) +\& \ep{Line_Break: H2} (Short: \ep{Lb=H2}) (399: U+AC00, U+AC1C, +\& U+AC38, U+AC54, U+AC70, U+AC8C ...) +\& \ep{Line_Break: H3} (Short: \ep{Lb=H3}) (10_773: U+AC01..AC1B, +\& U+AC1D..AC37, U+AC39..AC53, +\& U+AC55..AC6F, U+AC71..AC8B, U+AC8D..ACA7 +\& ...) +\& \ep{Line_Break: Hebrew_Letter} (Short: \ep{Lb=HL}) (75: +\& U+05D0..05EA, U+05EF..05F2, U+FB1D, +\& U+FB1F..FB28, U+FB2A..FB36, U+FB38..FB3C +\& ...) +\& \ep{Line_Break: HL} \ep{Line_Break=Hebrew_Letter} (75) +\& \ep{Line_Break: HY} \ep{Line_Break=Hyphen} (1) +\& \ep{Line_Break: Hyphen} (Short: \ep{Lb=HY}) (1: [\e\-]) +\& \ep{Line_Break: ID} \ep{Line_Break=Ideographic} (172_462) +\& \ep{Line_Break: Ideographic} (Short: \ep{Lb=ID}) (172_462: +\& U+231A..231B, U+23F0..23F3, +\& U+2600..2603, U+2614..2615, U+2618, +\& U+261A..261C ...) +\& \ep{Line_Break: IN} \ep{Line_Break=Inseparable} (6) +\& \ep{Line_Break: Infix_Numeric} (Short: \ep{Lb=IS}) (13: [,.:;], +\& U+037E, U+0589, U+060C..060D, U+07F8, +\& U+2044 ...) +\& \ep{Line_Break: Inseparable} (Short: \ep{Lb=IN}) (6: U+2024..2026, +\& U+22EF, U+FE19, U+10AF6) +\& \ep{Line_Break: Inseperable} \ep{Line_Break=Inseparable} (6) +\& \ep{Line_Break: IS} \ep{Line_Break=Infix_Numeric} (13) +\& \ep{Line_Break: JL} (Short: \ep{Lb=JL}) (125: U+1100..115F, +\& U+A960..A97C) +\& \ep{Line_Break: JT} (Short: \ep{Lb=JT}) (137: U+11A8..11FF, +\& U+D7CB..D7FB) +\& \ep{Line_Break: JV} (Short: \ep{Lb=JV}) (95: U+1160..11A7, +\& U+D7B0..D7C6) +\& \ep{Line_Break: LF} \ep{Line_Break=Line_Feed} (1) +\& \ep{Line_Break: Line_Feed} (Short: \ep{Lb=LF}) (1: [\en]) +\& \ep{Line_Break: Mandatory_Break} (Short: \ep{Lb=BK}) (4: [\ecK\ef], +\& U+2028..2029) +\& \ep{Line_Break: Next_Line} (Short: \ep{Lb=NL}) (1: [\ex85]) +\& \ep{Line_Break: NL} \ep{Line_Break=Next_Line} (1) +\& \ep{Line_Break: Nonstarter} (Short: \ep{Lb=NS}) (33: U+17D6, +\& U+203C..203D, U+2047..2049, U+3005, +\& U+301C, U+303B..303C ...) +\& \ep{Line_Break: NS} \ep{Line_Break=Nonstarter} (33) +\& \ep{Line_Break: NU} \ep{Line_Break=Numeric} (642) +\& \ep{Line_Break: Numeric} (Short: \ep{Lb=NU}) (642: [0\-9], +\& U+0660..0669, U+066B..066C, +\& U+06F0..06F9, U+07C0..07C9, U+0966..096F +\& ...) +\& \ep{Line_Break: OP} \ep{Line_Break=Open_Punctuation} (88) +\& \ep{Line_Break: Open_Punctuation} (Short: \ep{Lb=OP}) (88: [\e(\e[\e{ +\& \exa1\exbf], U+0F3A, U+0F3C, U+169B, +\& U+201A, U+201E ...) +\& \ep{Line_Break: PO} \ep{Line_Break=Postfix_Numeric} (36) +\& \ep{Line_Break: Postfix_Numeric} (Short: \ep{Lb=PO}) (36: [\e%\exa2 +\& \exb0], U+0609..060B, U+066A, +\& U+09F2..09F3, U+09F9, U+0D79 ...) +\& \ep{Line_Break: PR} \ep{Line_Break=Prefix_Numeric} (68) +\& \ep{Line_Break: Prefix_Numeric} (Short: \ep{Lb=PR}) (68: [\e$+\e\e\exa3\- +\& \exa5\exb1], U+058F, U+07FE..07FF, U+09FB, +\& U+0AF1, U+0BF9 ...) +\& \ep{Line_Break: QU} \ep{Line_Break=Quotation} (39) +\& \ep{Line_Break: Quotation} (Short: \ep{Lb=QU}) (39: [\e"\e\*(Aq\exab\exbb], +\& U+2018..2019, U+201B..201D, U+201F, +\& U+2039..203A, U+275B..2760 ...) +\& \ep{Line_Break: Regional_Indicator} (Short: \ep{Lb=RI}) (26: +\& U+1F1E6..1F1FF) +\& \ep{Line_Break: RI} \ep{Line_Break=Regional_Indicator} (26) +\& \ep{Line_Break: SA} \ep{Line_Break=Complex_Context} (750) +\& D \ep{Line_Break: SG} \ep{Line_Break=Surrogate} (2048) +\& \ep{Line_Break: SP} \ep{Line_Break=Space} (1) +\& \ep{Line_Break: Space} (Short: \ep{Lb=SP}) (1: [\ex20]) +\& D \ep{Line_Break: Surrogate} Surrogates should never appear in well\- +\& formed text, and therefore shouldn\*(Aqt be +\& the basis for line breaking (Short: +\& \ep{Lb=SG}) (2048: U+D800..DFFF) +\& \ep{Line_Break: SY} \ep{Line_Break=Break_Symbols} (1) +\& \ep{Line_Break: Unknown} (Short: \ep{Lb=XX}) (901_256 plus all +\& above\-Unicode code points: U+0378..0379, +\& U+0380..0383, U+038B, U+038D, U+03A2, +\& U+0530 ...) +\& \ep{Line_Break: WJ} \ep{Line_Break=Word_Joiner} (2) +\& \ep{Line_Break: Word_Joiner} (Short: \ep{Lb=WJ}) (2: U+2060, U+FEFF) +\& \ep{Line_Break: XX} \ep{Line_Break=Unknown} (901_256 plus all +\& above\-Unicode code points) +\& \ep{Line_Break: ZW} \ep{Line_Break=ZWSpace} (1) +\& \ep{Line_Break: ZWJ} (Short: \ep{Lb=ZWJ}) (1: U+200D) +\& \ep{Line_Break: ZWSpace} (Short: \ep{Lb=ZW}) (1: U+200B) +\& \ep{Line_Separator} \ep{General_Category=Line_Separator} +\& (Short: \ep{Zl}) (1) +\& \ep{Linear_A} \ep{Script_Extensions=Linear_A} (Short: +\& \ep{Lina}; NOT \ep{Block=Linear_A}) (386) +\& \ep{Linear_B} \ep{Script_Extensions=Linear_B} (Short: +\& \ep{Linb}) (268) +\& X \ep{Linear_B_Ideograms} \ep{Block=Linear_B_Ideograms} (128) +\& X \ep{Linear_B_Syllabary} \ep{Block=Linear_B_Syllabary} (128) +\& \ep{Lisu} \ep{Script_Extensions=Lisu} (NOT \ep{Block= +\& Lisu}) (49) +\& X \ep{Lisu_Sup} \ep{Lisu_Supplement} (= \ep{Block= +\& Lisu_Supplement}) (16) +\& X \ep{Lisu_Supplement} \ep{Block=Lisu_Supplement} (Short: +\& \ep{InLisuSup}) (16) +\& \ep{Ll} \ep{Lowercase_Letter} (= +\& \ep{General_Category=Lowercase_Letter}) +\& (/i= General_Category=Cased_Letter) +\& (2155) +\& \ep{Lm} \ep{Modifier_Letter} (= +\& \ep{General_Category=Modifier_Letter}) +\& (260) +\& \ep{Lo} \ep{Other_Letter} (= \ep{General_Category= +\& Other_Letter}) (127_004) +\& \ep{LOE} \ep{Logical_Order_Exception} (= +\& \ep{Logical_Order_Exception=Y}) (19) +\& \ep{LOE: *} \ep{Logical_Order_Exception: *} +\& \ep{Logical_Order_Exception} \ep{Logical_Order_Exception=Y} (Short: +\& \ep{LOE}) (19) +\& \ep{Logical_Order_Exception: N*} (Short: \ep{LOE=N}, \eP{LOE}) +\& (1_114_093 plus all above\-Unicode code +\& points: U+0000..0E3F, U+0E45..0EBF, +\& U+0EC5..19B4, U+19B8..19B9, +\& U+19BB..AAB4, U+AAB7..AAB8 ...) +\& \ep{Logical_Order_Exception: Y*} (Short: \ep{LOE=Y}, \ep{LOE}) (19: +\& U+0E40..0E44, U+0EC0..0EC4, +\& U+19B5..19B7, U+19BA, U+AAB5..AAB6, +\& U+AAB9 ...) +\& X \ep{Low_Surrogates} \ep{Block=Low_Surrogates} (1024) +\& \ep{Lower} \ep{XPosixLower} (= \ep{Lowercase=Y}) (/i= +\& Cased=Yes) (2344) +\& \ep{Lower: *} \ep{Lowercase: *} +\& \ep{Lowercase} \ep{XPosixLower} (= \ep{Lowercase=Y}) (/i= +\& Cased=Yes) (2344) +\& \ep{Lowercase: N*} (Short: \ep{Lower=N}, \eP{Lower}; /i= Cased= +\& No) (1_111_768 plus all above\-Unicode +\& code points: [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq +\& \e(\e)*+,\e\-.\e/0\-9:;<=>?\e@A\-Z\e[\e\e\e]\e^_\`\e{ +\& \e|\e}~\ex7f\-\exa9\exab\-\exb4\exb6\-\exb9\exbb\- +\& \exde\exf7], U+0100, U+0102, U+0104, +\& U+0106, U+0108 ...) +\& \ep{Lowercase: Y*} (Short: \ep{Lower=Y}, \ep{Lower}; /i= Cased= +\& Yes) (2344: [a\-z\exaa\exb5\exba\exdf\-\exf6 +\& \exf8\-\exff], U+0101, U+0103, U+0105, +\& U+0107, U+0109 ...) +\& \ep{Lowercase_Letter} \ep{General_Category=Lowercase_Letter} +\& (Short: \ep{Ll}; /i= General_Category= +\& Cased_Letter) (2155) +\& \ep{Lt} \ep{Titlecase_Letter} (= +\& \ep{General_Category=Titlecase_Letter}) +\& (/i= General_Category=Cased_Letter) (31) +\& \ep{Lu} \ep{Uppercase_Letter} (= +\& \ep{General_Category=Uppercase_Letter}) +\& (/i= General_Category=Cased_Letter) +\& (1791) +\& \ep{Lyci} \ep{Lycian} (= \ep{Script_Extensions= +\& Lycian}) (NOT \ep{Block=Lycian}) (29) +\& \ep{Lycian} \ep{Script_Extensions=Lycian} (Short: +\& \ep{Lyci}; NOT \ep{Block=Lycian}) (29) +\& \ep{Lydi} \ep{Lydian} (= \ep{Script_Extensions= +\& Lydian}) (NOT \ep{Block=Lydian}) (27) +\& \ep{Lydian} \ep{Script_Extensions=Lydian} (Short: +\& \ep{Lydi}; NOT \ep{Block=Lydian}) (27) +\& \ep{M} \epM \ep{Mark} (= \ep{General_Category=Mark}) +\& (2295) +\& \ep{Mahajani} \ep{Script_Extensions=Mahajani} (Short: +\& \ep{Mahj}; NOT \ep{Block=Mahajani}) (61) +\& \ep{Mahj} \ep{Mahajani} (= \ep{Script_Extensions= +\& Mahajani}) (NOT \ep{Block=Mahajani}) (61) +\& X \ep{Mahjong} \ep{Mahjong_Tiles} (= \ep{Block= +\& Mahjong_Tiles}) (48) +\& X \ep{Mahjong_Tiles} \ep{Block=Mahjong_Tiles} (Short: +\& \ep{InMahjong}) (48) +\& \ep{Maka} \ep{Makasar} (= \ep{Script_Extensions= +\& Makasar}) (NOT \ep{Block=Makasar}) (25) +\& \ep{Makasar} \ep{Script_Extensions=Makasar} (Short: +\& \ep{Maka}; NOT \ep{Block=Makasar}) (25) +\& \ep{Malayalam} \ep{Script_Extensions=Malayalam} (Short: +\& \ep{Mlym}; NOT \ep{Block=Malayalam}) (126) +\& \ep{Mand} \ep{Mandaic} (= \ep{Script_Extensions= +\& Mandaic}) (NOT \ep{Block=Mandaic}) (30) +\& \ep{Mandaic} \ep{Script_Extensions=Mandaic} (Short: +\& \ep{Mand}; NOT \ep{Block=Mandaic}) (30) +\& \ep{Mani} \ep{Manichaean} (= \ep{Script_Extensions= +\& Manichaean}) (NOT \ep{Block=Manichaean}) +\& (52) +\& \ep{Manichaean} \ep{Script_Extensions=Manichaean} (Short: +\& \ep{Mani}; NOT \ep{Block=Manichaean}) (52) +\& \ep{Marc} \ep{Marchen} (= \ep{Script_Extensions= +\& Marchen}) (NOT \ep{Block=Marchen}) (68) +\& \ep{Marchen} \ep{Script_Extensions=Marchen} (Short: +\& \ep{Marc}; NOT \ep{Block=Marchen}) (68) +\& \ep{Mark} \ep{General_Category=Mark} (Short: \ep{M}) +\& (2295) +\& \ep{Masaram_Gondi} \ep{Script_Extensions=Masaram_Gondi} +\& (Short: \ep{Gonm}; NOT \ep{Block= +\& Masaram_Gondi}) (77) +\& \ep{Math} \ep{Math=Y} (2310) +\& \ep{Math: N*} (Single: \eP{Math}) (1_111_802 plus all +\& above\-Unicode code points: [\ex00\-\ex20! +\& \e"#\e$\e%&\e\*(Aq\e(\e)*,\e\-.\e/0\-9:;?\e@A\-Z +\& \e[\e\e\e]_\`a\-z\e{\e}\ex7f\-\exab\exad\-\exb0\exb2\- +\& \exd6\exd8\-\exf6\exf8\-\exff], U+0100..03CF, +\& U+03D3..03D4, U+03D6..03EF, +\& U+03F2..03F3, U+03F7..0605 ...) +\& \ep{Math: Y*} (Single: \ep{Math}) (2310: [+<=>\e^\e|~\exac +\& \exb1\exd7\exf7], U+03D0..03D2, U+03D5, +\& U+03F0..03F1, U+03F4..03F6, U+0606..0608 +\& ...) +\& X \ep{Math_Alphanum} \ep{Mathematical_Alphanumeric_Symbols} (= +\& \ep{Block= +\& Mathematical_Alphanumeric_Symbols}) +\& (1024) +\& X \ep{Math_Operators} \ep{Mathematical_Operators} (= \ep{Block= +\& Mathematical_Operators}) (256) +\& \ep{Math_Symbol} \ep{General_Category=Math_Symbol} (Short: +\& \ep{Sm}) (948) +\& X \ep{Mathematical_Alphanumeric_Symbols} \ep{Block= +\& Mathematical_Alphanumeric_Symbols} +\& (Short: \ep{InMathAlphanum}) (1024) +\& X \ep{Mathematical_Operators} \ep{Block=Mathematical_Operators} +\& (Short: \ep{InMathOperators}) (256) +\& X \ep{Mayan_Numerals} \ep{Block=Mayan_Numerals} (32) +\& \ep{Mc} \ep{Spacing_Mark} (= \ep{General_Category= +\& Spacing_Mark}) (443) +\& \ep{Me} \ep{Enclosing_Mark} (= \ep{General_Category= +\& Enclosing_Mark}) (13) +\& \ep{Medefaidrin} \ep{Script_Extensions=Medefaidrin} (Short: +\& \ep{Medf}; NOT \ep{Block=Medefaidrin}) (91) +\& \ep{Medf} \ep{Medefaidrin} (= \ep{Script_Extensions= +\& Medefaidrin}) (NOT \ep{Block= +\& Medefaidrin}) (91) +\& \ep{Meetei_Mayek} \ep{Script_Extensions=Meetei_Mayek} (Short: +\& \ep{Mtei}; NOT \ep{Block=Meetei_Mayek}) +\& (79) +\& X \ep{Meetei_Mayek_Ext} \ep{Meetei_Mayek_Extensions} (= \ep{Block= +\& Meetei_Mayek_Extensions}) (32) +\& X \ep{Meetei_Mayek_Extensions} \ep{Block=Meetei_Mayek_Extensions} +\& (Short: \ep{InMeeteiMayekExt}) (32) +\& \ep{Mend} \ep{Mende_Kikakui} (= \ep{Script_Extensions= +\& Mende_Kikakui}) (NOT \ep{Block= +\& Mende_Kikakui}) (213) +\& \ep{Mende_Kikakui} \ep{Script_Extensions=Mende_Kikakui} +\& (Short: \ep{Mend}; NOT \ep{Block= +\& Mende_Kikakui}) (213) +\& \ep{Merc} \ep{Meroitic_Cursive} (= +\& \ep{Script_Extensions=Meroitic_Cursive}) +\& (NOT \ep{Block=Meroitic_Cursive}) (90) +\& \ep{Mero} \ep{Meroitic_Hieroglyphs} (= +\& \ep{Script_Extensions= +\& Meroitic_Hieroglyphs}) (32) +\& \ep{Meroitic_Cursive} \ep{Script_Extensions=Meroitic_Cursive} +\& (Short: \ep{Merc}; NOT \ep{Block= +\& Meroitic_Cursive}) (90) +\& \ep{Meroitic_Hieroglyphs} \ep{Script_Extensions= +\& Meroitic_Hieroglyphs} (Short: \ep{Mero}) +\& (32) +\& \ep{Miao} \ep{Script_Extensions=Miao} (NOT \ep{Block= +\& Miao}) (149) +\& X \ep{Misc_Arrows} \ep{Miscellaneous_Symbols_And_Arrows} (= +\& \ep{Block= +\& Miscellaneous_Symbols_And_Arrows}) (256) +\& X \ep{Misc_Math_Symbols_A} \ep{Miscellaneous_Mathematical_Symbols_A} +\& (= \ep{Block= +\& Miscellaneous_Mathematical_Symbols_A}) +\& (48) +\& X \ep{Misc_Math_Symbols_B} \ep{Miscellaneous_Mathematical_Symbols_B} +\& (= \ep{Block= +\& Miscellaneous_Mathematical_Symbols_B}) +\& (128) +\& X \ep{Misc_Pictographs} \ep{Miscellaneous_Symbols_And_Pictographs} +\& (= \ep{Block= +\& Miscellaneous_Symbols_And_Pictographs}) +\& (768) +\& X \ep{Misc_Symbols} \ep{Miscellaneous_Symbols} (= \ep{Block= +\& Miscellaneous_Symbols}) (256) +\& X \ep{Misc_Technical} \ep{Miscellaneous_Technical} (= \ep{Block= +\& Miscellaneous_Technical}) (256) +\& X \ep{Miscellaneous_Mathematical_Symbols_A} \ep{Block= +\& Miscellaneous_Mathematical_Symbols_A} +\& (Short: \ep{InMiscMathSymbolsA}) (48) +\& X \ep{Miscellaneous_Mathematical_Symbols_B} \ep{Block= +\& Miscellaneous_Mathematical_Symbols_B} +\& (Short: \ep{InMiscMathSymbolsB}) (128) +\& X \ep{Miscellaneous_Symbols} \ep{Block=Miscellaneous_Symbols} (Short: +\& \ep{InMiscSymbols}) (256) +\& X \ep{Miscellaneous_Symbols_And_Arrows} \ep{Block= +\& Miscellaneous_Symbols_And_Arrows} +\& (Short: \ep{InMiscArrows}) (256) +\& X \ep{Miscellaneous_Symbols_And_Pictographs} \ep{Block= +\& Miscellaneous_Symbols_And_Pictographs} +\& (Short: \ep{InMiscPictographs}) (768) +\& X \ep{Miscellaneous_Technical} \ep{Block=Miscellaneous_Technical} +\& (Short: \ep{InMiscTechnical}) (256) +\& \ep{Mlym} \ep{Malayalam} (= \ep{Script_Extensions= +\& Malayalam}) (NOT \ep{Block=Malayalam}) +\& (126) +\& \ep{Mn} \ep{Nonspacing_Mark} (= +\& \ep{General_Category=Nonspacing_Mark}) +\& (1839) +\& \ep{Modi} \ep{Script_Extensions=Modi} (NOT \ep{Block= +\& Modi}) (89) +\& \ep{Modifier_Letter} \ep{General_Category=Modifier_Letter} +\& (Short: \ep{Lm}) (260) +\& X \ep{Modifier_Letters} \ep{Spacing_Modifier_Letters} (= \ep{Block= +\& Spacing_Modifier_Letters}) (80) +\& \ep{Modifier_Symbol} \ep{General_Category=Modifier_Symbol} +\& (Short: \ep{Sk}) (123) +\& X \ep{Modifier_Tone_Letters} \ep{Block=Modifier_Tone_Letters} (32) +\& \ep{Mong} \ep{Mongolian} (= \ep{Script_Extensions= +\& Mongolian}) (NOT \ep{Block=Mongolian}) +\& (171) +\& \ep{Mongolian} \ep{Script_Extensions=Mongolian} (Short: +\& \ep{Mong}; NOT \ep{Block=Mongolian}) (171) +\& X \ep{Mongolian_Sup} \ep{Mongolian_Supplement} (= \ep{Block= +\& Mongolian_Supplement}) (32) +\& X \ep{Mongolian_Supplement} \ep{Block=Mongolian_Supplement} (Short: +\& \ep{InMongolianSup}) (32) +\& \ep{Mro} \ep{Script_Extensions=Mro} (NOT \ep{Block= +\& Mro}) (43) +\& \ep{Mroo} \ep{Mro} (= \ep{Script_Extensions=Mro}) (NOT +\& \ep{Block=Mro}) (43) +\& \ep{Mtei} \ep{Meetei_Mayek} (= \ep{Script_Extensions= +\& Meetei_Mayek}) (NOT \ep{Block= +\& Meetei_Mayek}) (79) +\& \ep{Mult} \ep{Multani} (= \ep{Script_Extensions= +\& Multani}) (NOT \ep{Block=Multani}) (48) +\& \ep{Multani} \ep{Script_Extensions=Multani} (Short: +\& \ep{Mult}; NOT \ep{Block=Multani}) (48) +\& X \ep{Music} \ep{Musical_Symbols} (= \ep{Block= +\& Musical_Symbols}) (256) +\& X \ep{Musical_Symbols} \ep{Block=Musical_Symbols} (Short: +\& \ep{InMusic}) (256) +\& \ep{Myanmar} \ep{Script_Extensions=Myanmar} (Short: +\& \ep{Mymr}; NOT \ep{Block=Myanmar}) (224) +\& X \ep{Myanmar_Ext_A} \ep{Myanmar_Extended_A} (= \ep{Block= +\& Myanmar_Extended_A}) (32) +\& X \ep{Myanmar_Ext_B} \ep{Myanmar_Extended_B} (= \ep{Block= +\& Myanmar_Extended_B}) (32) +\& X \ep{Myanmar_Extended_A} \ep{Block=Myanmar_Extended_A} (Short: +\& \ep{InMyanmarExtA}) (32) +\& X \ep{Myanmar_Extended_B} \ep{Block=Myanmar_Extended_B} (Short: +\& \ep{InMyanmarExtB}) (32) +\& \ep{Mymr} \ep{Myanmar} (= \ep{Script_Extensions= +\& Myanmar}) (NOT \ep{Block=Myanmar}) (224) +\& \ep{N} \epN \ep{Number} (= \ep{General_Category=Number}) +\& (1781) +\& \ep{Na=*} \ep{Name=*} +\& \ep{Nabataean} \ep{Script_Extensions=Nabataean} (Short: +\& \ep{Nbat}; NOT \ep{Block=Nabataean}) (40) +\& \ep{Name=*} Combination of Name and Name_Alias +\& properties; has special loose matching +\& rules, for which see Unicode UAX #44 +\& \ep{Nand} \ep{Nandinagari} (= \ep{Script_Extensions= +\& Nandinagari}) (NOT \ep{Block= +\& Nandinagari}) (86) +\& \ep{Nandinagari} \ep{Script_Extensions=Nandinagari} (Short: +\& \ep{Nand}; NOT \ep{Block=Nandinagari}) (86) +\& \ep{Narb} \ep{Old_North_Arabian} (= +\& \ep{Script_Extensions=Old_North_Arabian}) +\& (32) +\& X \ep{NB} \ep{No_Block} (= \ep{Block=No_Block}) +\& (826_640 plus all above\-Unicode code +\& points) +\& \ep{Nbat} \ep{Nabataean} (= \ep{Script_Extensions= +\& Nabataean}) (NOT \ep{Block=Nabataean}) +\& (40) +\& \ep{NChar} \ep{Noncharacter_Code_Point} (= +\& \ep{Noncharacter_Code_Point=Y}) (66) +\& \ep{NChar: *} \ep{Noncharacter_Code_Point: *} +\& \ep{Nd} \ep{XPosixDigit} (= \ep{General_Category= +\& Decimal_Number}) (650) +\& \ep{New_Tai_Lue} \ep{Script_Extensions=New_Tai_Lue} (Short: +\& \ep{Talu}; NOT \ep{Block=New_Tai_Lue}) (83) +\& \ep{Newa} \ep{Script_Extensions=Newa} (NOT \ep{Block= +\& Newa}) (97) +\& \ep{NFC_QC: *} \ep{NFC_Quick_Check: *} +\& \ep{NFC_Quick_Check: M} \ep{NFC_Quick_Check=Maybe} (111) +\& \ep{NFC_Quick_Check: Maybe} (Short: \ep{NFCQC=M}) (111: +\& U+0300..0304, U+0306..030C, U+030F, +\& U+0311, U+0313..0314, U+031B ...) +\& \ep{NFC_Quick_Check: N} \ep{NFC_Quick_Check=No} (NOT +\& \eP{NFC_Quick_Check} NOR \eP{NFC_QC}) +\& (1120) +\& \ep{NFC_Quick_Check: No} (Short: \ep{NFCQC=N}; NOT +\& \eP{NFC_Quick_Check} NOR \eP{NFC_QC}) +\& (1120: U+0340..0341, U+0343..0344, +\& U+0374, U+037E, U+0387, U+0958..095F ...) +\& \ep{NFC_Quick_Check: Y} \ep{NFC_Quick_Check=Yes} (NOT +\& \ep{NFC_Quick_Check} NOR \ep{NFC_QC}) +\& (1_112_881 plus all above\-Unicode code +\& points) +\& \ep{NFC_Quick_Check: Yes} (Short: \ep{NFCQC=Y}; NOT +\& \ep{NFC_Quick_Check} NOR \ep{NFC_QC}) +\& (1_112_881 plus all above\-Unicode code +\& points: U+0000..02FF, U+0305, +\& U+030D..030E, U+0310, U+0312, +\& U+0315..031A ...) +\& \ep{NFD_QC: *} \ep{NFD_Quick_Check: *} +\& \ep{NFD_Quick_Check: N} \ep{NFD_Quick_Check=No} (NOT +\& \eP{NFD_Quick_Check} NOR \eP{NFD_QC}) +\& (13_233) +\& \ep{NFD_Quick_Check: No} (Short: \ep{NFDQC=N}; NOT +\& \eP{NFD_Quick_Check} NOR \eP{NFD_QC}) +\& (13_233: [\exc0\-\exc5\exc7\-\excf\exd1\-\exd6 +\& \exd9\-\exdd\exe0\-\exe5\exe7\-\exef\exf1\-\exf6 +\& \exf9\-\exfd\exff], U+0100..010F, +\& U+0112..0125, U+0128..0130, +\& U+0134..0137, U+0139..013E ...) +\& \ep{NFD_Quick_Check: Y} \ep{NFD_Quick_Check=Yes} (NOT +\& \ep{NFD_Quick_Check} NOR \ep{NFD_QC}) +\& (1_100_879 plus all above\-Unicode code +\& points) +\& \ep{NFD_Quick_Check: Yes} (Short: \ep{NFDQC=Y}; NOT +\& \ep{NFD_Quick_Check} NOR \ep{NFD_QC}) +\& (1_100_879 plus all above\-Unicode code +\& points: [\ex00\-\exbf\exc6\exd0\exd7\-\exd8\exde\- +\& \exdf\exe6\exf0\exf7\-\exf8\exfe], +\& U+0110..0111, U+0126..0127, +\& U+0131..0133, U+0138, U+013F..0142 ...) +\& \ep{NFKC_QC: *} \ep{NFKC_Quick_Check: *} +\& \ep{NFKC_Quick_Check: M} \ep{NFKC_Quick_Check=Maybe} (111) +\& \ep{NFKC_Quick_Check: Maybe} (Short: \ep{NFKCQC=M}) (111: +\& U+0300..0304, U+0306..030C, U+030F, +\& U+0311, U+0313..0314, U+031B ...) +\& \ep{NFKC_Quick_Check: N} \ep{NFKC_Quick_Check=No} (NOT +\& \eP{NFKC_Quick_Check} NOR \eP{NFKC_QC}) +\& (4807) +\& \ep{NFKC_Quick_Check: No} (Short: \ep{NFKCQC=N}; NOT +\& \eP{NFKC_Quick_Check} NOR \eP{NFKC_QC}) +\& (4807: [\exa0\exa8\exaa\exaf\exb2\-\exb5\exb8\- +\& \exba\exbc\-\exbe], U+0132..0133, +\& U+013F..0140, U+0149, U+017F, +\& U+01C4..01CC ...) +\& \ep{NFKC_Quick_Check: Y} \ep{NFKC_Quick_Check=Yes} (NOT +\& \ep{NFKC_Quick_Check} NOR \ep{NFKC_QC}) +\& (1_109_194 plus all above\-Unicode code +\& points) +\& \ep{NFKC_Quick_Check: Yes} (Short: \ep{NFKCQC=Y}; NOT +\& \ep{NFKC_Quick_Check} NOR \ep{NFKC_QC}) +\& (1_109_194 plus all above\-Unicode code +\& points: [\ex00\-\ex9f\exa1\-\exa7\exa9\exab\- +\& \exae\exb0\-\exb1\exb6\-\exb7\exbb\exbf\-\exff], +\& U+0100..0131, U+0134..013E, +\& U+0141..0148, U+014A..017E, U+0180..01C3 +\& ...) +\& \ep{NFKD_QC: *} \ep{NFKD_Quick_Check: *} +\& \ep{NFKD_Quick_Check: N} \ep{NFKD_Quick_Check=No} (NOT +\& \eP{NFKD_Quick_Check} NOR \eP{NFKD_QC}) +\& (16_908) +\& \ep{NFKD_Quick_Check: No} (Short: \ep{NFKDQC=N}; NOT +\& \eP{NFKD_Quick_Check} NOR \eP{NFKD_QC}) +\& (16_908: [\exa0\exa8\exaa\exaf\exb2\-\exb5\exb8\- +\& \exba\exbc\-\exbe\exc0\-\exc5\exc7\-\excf\exd1\- +\& \exd6\exd9\-\exdd\exe0\-\exe5\exe7\-\exef\exf1\- +\& \exf6\exf9\-\exfd\exff], U+0100..010F, +\& U+0112..0125, U+0128..0130, +\& U+0132..0137, U+0139..0140 ...) +\& \ep{NFKD_Quick_Check: Y} \ep{NFKD_Quick_Check=Yes} (NOT +\& \ep{NFKD_Quick_Check} NOR \ep{NFKD_QC}) +\& (1_097_204 plus all above\-Unicode code +\& points) +\& \ep{NFKD_Quick_Check: Yes} (Short: \ep{NFKDQC=Y}; NOT +\& \ep{NFKD_Quick_Check} NOR \ep{NFKD_QC}) +\& (1_097_204 plus all above\-Unicode code +\& points: [\ex00\-\ex9f\exa1\-\exa7\exa9\exab\- +\& \exae\exb0\-\exb1\exb6\-\exb7\exbb\exbf\exc6\exd0 +\& \exd7\-\exd8\exde\-\exdf\exe6\exf0\exf7\-\exf8 +\& \exfe], U+0110..0111, U+0126..0127, +\& U+0131, U+0138, U+0141..0142 ...) +\& \ep{Nko} \ep{Script_Extensions=Nko} (NOT \ep{Block= +\& NKo}) (62) +\& \ep{Nkoo} \ep{Nko} (= \ep{Script_Extensions=Nko}) (NOT +\& \ep{Block=NKo}) (62) +\& \ep{Nl} \ep{Letter_Number} (= \ep{General_Category= +\& Letter_Number}) (236) +\& \ep{No} \ep{Other_Number} (= \ep{General_Category= +\& Other_Number}) (895) +\& X \ep{No_Block} \ep{Block=No_Block} (Short: \ep{InNB}) +\& (826_640 plus all above\-Unicode code +\& points) +\& \ep{Noncharacter_Code_Point} \ep{Noncharacter_Code_Point=Y} (Short: +\& \ep{NChar}) (66) +\& \ep{Noncharacter_Code_Point: N*} (Short: \ep{NChar=N}, \eP{NChar}) +\& (1_114_046 plus all above\-Unicode code +\& points: U+0000..FDCF, U+FDF0..FFFD, +\& U+10000..1FFFD, U+20000..2FFFD, +\& U+30000..3FFFD, U+40000..4FFFD ...) +\& \ep{Noncharacter_Code_Point: Y*} (Short: \ep{NChar=Y}, \ep{NChar}) +\& (66: U+FDD0..FDEF, U+FFFE..FFFF, +\& U+1FFFE..1FFFF, U+2FFFE..2FFFF, +\& U+3FFFE..3FFFF, U+4FFFE..4FFFF ...) +\& \ep{Nonspacing_Mark} \ep{General_Category=Nonspacing_Mark} +\& (Short: \ep{Mn}) (1839) +\& \ep{Nshu} \ep{Nushu} (= \ep{Script_Extensions=Nushu}) +\& (NOT \ep{Block=Nushu}) (397) +\& \ep{Nt: *} \ep{Numeric_Type: *} +\& \ep{Number} \ep{General_Category=Number} (Short: \ep{N}) +\& (1781) +\& X \ep{Number_Forms} \ep{Block=Number_Forms} (64) +\& \ep{Numeric_Type: De} \ep{Numeric_Type=Decimal} (650) +\& \ep{Numeric_Type: Decimal} (Short: \ep{Nt=De}) (650: [0\-9], +\& U+0660..0669, U+06F0..06F9, +\& U+07C0..07C9, U+0966..096F, U+09E6..09EF +\& ...) +\& \ep{Numeric_Type: Di} \ep{Numeric_Type=Digit} (128) +\& \ep{Numeric_Type: Digit} (Short: \ep{Nt=Di}) (128: [\exb2\-\exb3\exb9], +\& U+1369..1371, U+19DA, U+2070, +\& U+2074..2079, U+2080..2089 ...) +\& \ep{Numeric_Type: None} (Short: \ep{Nt=None}) (1_112_250 plus all +\& above\-Unicode code points: [\ex00\-\ex20! +\& \e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<=>?\e@A\-Z\e[\e\e\e] +\& \e^_\`a\-z\e{\e|\e}~\ex7f\-\exb1\exb4\-\exb8\exba\- +\& \exbb\exbf\-\exff], U+0100..065F, +\& U+066A..06EF, U+06FA..07BF, +\& U+07CA..0965, U+0970..09E5 ...) +\& \ep{Numeric_Type: Nu} \ep{Numeric_Type=Numeric} (1084) +\& \ep{Numeric_Type: Numeric} (Short: \ep{Nt=Nu}) (1084: [\exbc\-\exbe], +\& U+09F4..09F9, U+0B72..0B77, +\& U+0BF0..0BF2, U+0C78..0C7E, U+0D58..0D5E +\& ...) +\& T \ep{Numeric_Value: \-1/2} (Short: \ep{Nv=\-1/2}) (1: U+0F33) +\& T \ep{Numeric_Value: 0} (Short: \ep{Nv=0}) (83: [0], U+0660, +\& U+06F0, U+07C0, U+0966, U+09E6 ...) +\& T \ep{Numeric_Value: 1/320} (Short: \ep{Nv=1/320}) (2: U+11FC0, +\& U+11FD4) +\& T \ep{Numeric_Value: 1/160} (Short: \ep{Nv=1/160}) (2: U+0D58, U+11FC1) +\& T \ep{Numeric_Value: 1/80} (Short: \ep{Nv=1/80}) (1: U+11FC2) +\& T \ep{Numeric_Value: 1/64} (Short: \ep{Nv=1/64}) (1: U+11FC3) +\& T \ep{Numeric_Value: 1/40} (Short: \ep{Nv=1/40}) (2: U+0D59, U+11FC4) +\& T \ep{Numeric_Value: 1/32} (Short: \ep{Nv=1/32}) (1: U+11FC5) +\& T \ep{Numeric_Value: 3/80} (Short: \ep{Nv=3/80}) (2: U+0D5A, U+11FC6) +\& T \ep{Numeric_Value: 3/64} (Short: \ep{Nv=3/64}) (1: U+11FC7) +\& T \ep{Numeric_Value: 1/20} (Short: \ep{Nv=1/20}) (2: U+0D5B, U+11FC8) +\& T \ep{Numeric_Value: 1/16} (Short: \ep{Nv=1/16}) (6: U+09F4, U+0B75, +\& U+0D76, U+A833, U+11FC9..11FCA) +\& T \ep{Numeric_Value: 1/12} (Short: \ep{Nv=1/12}) (1: U+109F6) +\& T \ep{Numeric_Value: 1/10} (Short: \ep{Nv=1/10}) (3: U+0D5C, U+2152, +\& U+11FCB) +\& T \ep{Numeric_Value: 1/9} (Short: \ep{Nv=1/9}) (1: U+2151) +\& T \ep{Numeric_Value: 1/8} (Short: \ep{Nv=1/8}) (7: U+09F5, U+0B76, +\& U+0D77, U+215B, U+A834, U+11FCC ...) +\& T \ep{Numeric_Value: 1/7} (Short: \ep{Nv=1/7}) (1: U+2150) +\& T \ep{Numeric_Value: 3/20} (Short: \ep{Nv=3/20}) (2: U+0D5D, U+11FCD) +\& T \ep{Numeric_Value: 1/6} (Short: \ep{Nv=1/6}) (4: U+2159, U+109F7, +\& U+12461, U+1ED3D) +\& T \ep{Numeric_Value: 3/16} (Short: \ep{Nv=3/16}) (5: U+09F6, U+0B77, +\& U+0D78, U+A835, U+11FCE) +\& T \ep{Numeric_Value: 1/5} (Short: \ep{Nv=1/5}) (3: U+0D5E, U+2155, +\& U+11FCF) +\& T \ep{Numeric_Value: 1/4} (Short: \ep{Nv=1/4}) (14: [\exbc], U+09F7, +\& U+0B72, U+0D73, U+A830, U+10140 ...) +\& T \ep{Numeric_Value: 1/3} (Short: \ep{Nv=1/3}) (6: U+2153, U+109F9, +\& U+10E7D, U+1245A, U+1245D, U+12465) +\& T \ep{Numeric_Value: 3/8} (Short: \ep{Nv=3/8}) (1: U+215C) +\& T \ep{Numeric_Value: 2/5} (Short: \ep{Nv=2/5}) (1: U+2156) +\& T \ep{Numeric_Value: 5/12} (Short: \ep{Nv=5/12}) (1: U+109FA) +\& T \ep{Numeric_Value: 1/2} (Short: \ep{Nv=1/2}) (19: [\exbd], U+0B73, +\& U+0D74, U+0F2A, U+2CFD, U+A831 ...) +\& T \ep{Numeric_Value: 7/12} (Short: \ep{Nv=7/12}) (1: U+109FC) +\& T \ep{Numeric_Value: 3/5} (Short: \ep{Nv=3/5}) (1: U+2157) +\& T \ep{Numeric_Value: 5/8} (Short: \ep{Nv=5/8}) (1: U+215D) +\& T \ep{Numeric_Value: 2/3} (Short: \ep{Nv=2/3}) (7: U+2154, U+10177, +\& U+109FD, U+10E7E, U+1245B, U+1245E ...) +\& T \ep{Numeric_Value: 3/4} (Short: \ep{Nv=3/4}) (9: [\exbe], U+09F8, +\& U+0B74, U+0D75, U+A832, U+10178 ...) +\& T \ep{Numeric_Value: 4/5} (Short: \ep{Nv=4/5}) (1: U+2158) +\& T \ep{Numeric_Value: 5/6} (Short: \ep{Nv=5/6}) (3: U+215A, U+109FF, +\& U+1245C) +\& T \ep{Numeric_Value: 7/8} (Short: \ep{Nv=7/8}) (1: U+215E) +\& T \ep{Numeric_Value: 11/12} (Short: \ep{Nv=11/12}) (1: U+109BC) +\& T \ep{Numeric_Value: 1} (Short: \ep{Nv=1}) (140: [1\exb9], U+0661, +\& U+06F1, U+07C1, U+0967, U+09E7 ...) +\& T \ep{Numeric_Value: 3/2} (Short: \ep{Nv=3/2}) (1: U+0F2B) +\& T \ep{Numeric_Value: 2} (Short: \ep{Nv=2}) (139: [2\exb2], U+0662, +\& U+06F2, U+07C2, U+0968, U+09E8 ...) +\& T \ep{Numeric_Value: 5/2} (Short: \ep{Nv=5/2}) (1: U+0F2C) +\& T \ep{Numeric_Value: 3} (Short: \ep{Nv=3}) (140: [3\exb3], U+0663, +\& U+06F3, U+07C3, U+0969, U+09E9 ...) +\& T \ep{Numeric_Value: 7/2} (Short: \ep{Nv=7/2}) (1: U+0F2D) +\& T \ep{Numeric_Value: 4} (Short: \ep{Nv=4}) (131: [4], U+0664, +\& U+06F4, U+07C4, U+096A, U+09EA ...) +\& T \ep{Numeric_Value: 9/2} (Short: \ep{Nv=9/2}) (1: U+0F2E) +\& T \ep{Numeric_Value: 5} (Short: \ep{Nv=5}) (129: [5], U+0665, +\& U+06F5, U+07C5, U+096B, U+09EB ...) +\& T \ep{Numeric_Value: 11/2} (Short: \ep{Nv=11/2}) (1: U+0F2F) +\& T \ep{Numeric_Value: 6} (Short: \ep{Nv=6}) (113: [6], U+0666, +\& U+06F6, U+07C6, U+096C, U+09EC ...) +\& T \ep{Numeric_Value: 13/2} (Short: \ep{Nv=13/2}) (1: U+0F30) +\& T \ep{Numeric_Value: 7} (Short: \ep{Nv=7}) (112: [7], U+0667, +\& U+06F7, U+07C7, U+096D, U+09ED ...) +\& T \ep{Numeric_Value: 15/2} (Short: \ep{Nv=15/2}) (1: U+0F31) +\& T \ep{Numeric_Value: 8} (Short: \ep{Nv=8}) (108: [8], U+0668, +\& U+06F8, U+07C8, U+096E, U+09EE ...) +\& T \ep{Numeric_Value: 17/2} (Short: \ep{Nv=17/2}) (1: U+0F32) +\& T \ep{Numeric_Value: 9} (Short: \ep{Nv=9}) (112: [9], U+0669, +\& U+06F9, U+07C9, U+096F, U+09EF ...) +\& T \ep{Numeric_Value: 10} (Short: \ep{Nv=10}) (62: U+0BF0, U+0D70, +\& U+1372, U+2169, U+2179, U+2469 ...) +\& T \ep{Numeric_Value: 11} (Short: \ep{Nv=11}) (8: U+216A, U+217A, +\& U+246A, U+247E, U+2492, U+24EB ...) +\& T \ep{Numeric_Value: 12} (Short: \ep{Nv=12}) (8: U+216B, U+217B, +\& U+246B, U+247F, U+2493, U+24EC ...) +\& T \ep{Numeric_Value: 13} (Short: \ep{Nv=13}) (6: U+246C, U+2480, +\& U+2494, U+24ED, U+16E8D, U+1D2ED) +\& T \ep{Numeric_Value: 14} (Short: \ep{Nv=14}) (6: U+246D, U+2481, +\& U+2495, U+24EE, U+16E8E, U+1D2EE) +\& T \ep{Numeric_Value: 15} (Short: \ep{Nv=15}) (6: U+246E, U+2482, +\& U+2496, U+24EF, U+16E8F, U+1D2EF) +\& T \ep{Numeric_Value: 16} (Short: \ep{Nv=16}) (7: U+09F9, U+246F, +\& U+2483, U+2497, U+24F0, U+16E90 ...) +\& T \ep{Numeric_Value: 17} (Short: \ep{Nv=17}) (7: U+16EE, U+2470, +\& U+2484, U+2498, U+24F1, U+16E91 ...) +\& T \ep{Numeric_Value: 18} (Short: \ep{Nv=18}) (7: U+16EF, U+2471, +\& U+2485, U+2499, U+24F2, U+16E92 ...) +\& T \ep{Numeric_Value: 19} (Short: \ep{Nv=19}) (7: U+16F0, U+2472, +\& U+2486, U+249A, U+24F3, U+16E93 ...) +\& T \ep{Numeric_Value: 20} (Short: \ep{Nv=20}) (36: U+1373, U+2473, +\& U+2487, U+249B, U+24F4, U+3039 ...) +\& T \ep{Numeric_Value: 21} (Short: \ep{Nv=21}) (1: U+3251) +\& T \ep{Numeric_Value: 22} (Short: \ep{Nv=22}) (1: U+3252) +\& T \ep{Numeric_Value: 23} (Short: \ep{Nv=23}) (1: U+3253) +\& T \ep{Numeric_Value: 24} (Short: \ep{Nv=24}) (1: U+3254) +\& T \ep{Numeric_Value: 25} (Short: \ep{Nv=25}) (1: U+3255) +\& T \ep{Numeric_Value: 26} (Short: \ep{Nv=26}) (1: U+3256) +\& T \ep{Numeric_Value: 27} (Short: \ep{Nv=27}) (1: U+3257) +\& T \ep{Numeric_Value: 28} (Short: \ep{Nv=28}) (1: U+3258) +\& T \ep{Numeric_Value: 29} (Short: \ep{Nv=29}) (1: U+3259) +\& T \ep{Numeric_Value: 30} (Short: \ep{Nv=30}) (19: U+1374, U+303A, +\& U+324A, U+325A, U+5345, U+10112 ...) +\& T \ep{Numeric_Value: 31} (Short: \ep{Nv=31}) (1: U+325B) +\& T \ep{Numeric_Value: 32} (Short: \ep{Nv=32}) (1: U+325C) +\& T \ep{Numeric_Value: 33} (Short: \ep{Nv=33}) (1: U+325D) +\& T \ep{Numeric_Value: 34} (Short: \ep{Nv=34}) (1: U+325E) +\& T \ep{Numeric_Value: 35} (Short: \ep{Nv=35}) (1: U+325F) +\& T \ep{Numeric_Value: 36} (Short: \ep{Nv=36}) (1: U+32B1) +\& T \ep{Numeric_Value: 37} (Short: \ep{Nv=37}) (1: U+32B2) +\& T \ep{Numeric_Value: 38} (Short: \ep{Nv=38}) (1: U+32B3) +\& T \ep{Numeric_Value: 39} (Short: \ep{Nv=39}) (1: U+32B4) +\& T \ep{Numeric_Value: 40} (Short: \ep{Nv=40}) (18: U+1375, U+324B, +\& U+32B5, U+534C, U+10113, U+102ED ...) +\& T \ep{Numeric_Value: 41} (Short: \ep{Nv=41}) (1: U+32B6) +\& T \ep{Numeric_Value: 42} (Short: \ep{Nv=42}) (1: U+32B7) +\& T \ep{Numeric_Value: 43} (Short: \ep{Nv=43}) (1: U+32B8) +\& T \ep{Numeric_Value: 44} (Short: \ep{Nv=44}) (1: U+32B9) +\& T \ep{Numeric_Value: 45} (Short: \ep{Nv=45}) (1: U+32BA) +\& T \ep{Numeric_Value: 46} (Short: \ep{Nv=46}) (1: U+32BB) +\& T \ep{Numeric_Value: 47} (Short: \ep{Nv=47}) (1: U+32BC) +\& T \ep{Numeric_Value: 48} (Short: \ep{Nv=48}) (1: U+32BD) +\& T \ep{Numeric_Value: 49} (Short: \ep{Nv=49}) (1: U+32BE) +\& T \ep{Numeric_Value: 50} (Short: \ep{Nv=50}) (29: U+1376, U+216C, +\& U+217C, U+2186, U+324C, U+32BF ...) +\& T \ep{Numeric_Value: 60} (Short: \ep{Nv=60}) (13: U+1377, U+324D, +\& U+10115, U+102EF, U+109CE, U+10E6E ...) +\& T \ep{Numeric_Value: 70} (Short: \ep{Nv=70}) (13: U+1378, U+324E, +\& U+10116, U+102F0, U+109CF, U+10E6F ...) +\& T \ep{Numeric_Value: 80} (Short: \ep{Nv=80}) (12: U+1379, U+324F, +\& U+10117, U+102F1, U+10E70, U+11062 ...) +\& T \ep{Numeric_Value: 90} (Short: \ep{Nv=90}) (12: U+137A, U+10118, +\& U+102F2, U+10341, U+10E71, U+11063 ...) +\& T \ep{Numeric_Value: 100} (Short: \ep{Nv=100}) (35: U+0BF1, U+0D71, +\& U+137B, U+216D, U+217D, U+4F70 ...) +\& T \ep{Numeric_Value: 200} (Short: \ep{Nv=200}) (6: U+1011A, U+102F4, +\& U+109D3, U+10E73, U+1EC84, U+1ED14) +\& T \ep{Numeric_Value: 300} (Short: \ep{Nv=300}) (7: U+1011B, U+1016B, +\& U+102F5, U+109D4, U+10E74, U+1EC85 ...) +\& T \ep{Numeric_Value: 400} (Short: \ep{Nv=400}) (7: U+1011C, U+102F6, +\& U+109D5, U+10E75, U+1EC86, U+1ED16 ...) +\& T \ep{Numeric_Value: 500} (Short: \ep{Nv=500}) (16: U+216E, U+217E, +\& U+1011D, U+10145, U+1014C, U+10153 ...) +\& T \ep{Numeric_Value: 600} (Short: \ep{Nv=600}) (7: U+1011E, U+102F8, +\& U+109D7, U+10E77, U+1EC88, U+1ED18 ...) +\& T \ep{Numeric_Value: 700} (Short: \ep{Nv=700}) (6: U+1011F, U+102F9, +\& U+109D8, U+10E78, U+1EC89, U+1ED19) +\& T \ep{Numeric_Value: 800} (Short: \ep{Nv=800}) (6: U+10120, U+102FA, +\& U+109D9, U+10E79, U+1EC8A, U+1ED1A) +\& T \ep{Numeric_Value: 900} (Short: \ep{Nv=900}) (7: U+10121, U+102FB, +\& U+1034A, U+109DA, U+10E7A, U+1EC8B ...) +\& T \ep{Numeric_Value: 1000} (Short: \ep{Nv=1000}) (22: U+0BF2, U+0D72, +\& U+216F, U+217F..2180, U+4EDF, U+5343 ...) +\& T \ep{Numeric_Value: 2000} (Short: \ep{Nv=2000}) (5: U+10123, U+109DC, +\& U+1EC8D, U+1ED1D, U+1ED3A) +\& T \ep{Numeric_Value: 3000} (Short: \ep{Nv=3000}) (4: U+10124, U+109DD, +\& U+1EC8E, U+1ED1E) +\& T \ep{Numeric_Value: 4000} (Short: \ep{Nv=4000}) (4: U+10125, U+109DE, +\& U+1EC8F, U+1ED1F) +\& T \ep{Numeric_Value: 5000} (Short: \ep{Nv=5000}) (8: U+2181, U+10126, +\& U+10146, U+1014E, U+10172, U+109DF ...) +\& T \ep{Numeric_Value: 6000} (Short: \ep{Nv=6000}) (4: U+10127, U+109E0, +\& U+1EC91, U+1ED21) +\& T \ep{Numeric_Value: 7000} (Short: \ep{Nv=7000}) (4: U+10128, U+109E1, +\& U+1EC92, U+1ED22) +\& T \ep{Numeric_Value: 8000} (Short: \ep{Nv=8000}) (4: U+10129, U+109E2, +\& U+1EC93, U+1ED23) +\& T \ep{Numeric_Value: 9000} (Short: \ep{Nv=9000}) (4: U+1012A, U+109E3, +\& U+1EC94, U+1ED24) +\& T \ep{Numeric_Value: 10000} (= 1.0e+04) (Short: \ep{Nv=10000}) (13: +\& U+137C, U+2182, U+4E07, U+842C, U+1012B, +\& U+10155 ...) +\& T \ep{Numeric_Value: 20000} (= 2.0e+04) (Short: \ep{Nv=20000}) (4: +\& U+1012C, U+109E5, U+1EC96, U+1ED26) +\& T \ep{Numeric_Value: 30000} (= 3.0e+04) (Short: \ep{Nv=30000}) (4: +\& U+1012D, U+109E6, U+1EC97, U+1ED27) +\& T \ep{Numeric_Value: 40000} (= 4.0e+04) (Short: \ep{Nv=40000}) (4: +\& U+1012E, U+109E7, U+1EC98, U+1ED28) +\& T \ep{Numeric_Value: 50000} (= 5.0e+04) (Short: \ep{Nv=50000}) (7: +\& U+2187, U+1012F, U+10147, U+10156, +\& U+109E8, U+1EC99 ...) +\& T \ep{Numeric_Value: 60000} (= 6.0e+04) (Short: \ep{Nv=60000}) (4: +\& U+10130, U+109E9, U+1EC9A, U+1ED2A) +\& T \ep{Numeric_Value: 70000} (= 7.0e+04) (Short: \ep{Nv=70000}) (4: +\& U+10131, U+109EA, U+1EC9B, U+1ED2B) +\& T \ep{Numeric_Value: 80000} (= 8.0e+04) (Short: \ep{Nv=80000}) (4: +\& U+10132, U+109EB, U+1EC9C, U+1ED2C) +\& T \ep{Numeric_Value: 90000} (= 9.0e+04) (Short: \ep{Nv=90000}) (4: +\& U+10133, U+109EC, U+1EC9D, U+1ED2D) +\& T \ep{Numeric_Value: 100000} (= 1.0e+05) (Short: \ep{Nv=100000}) (5: +\& U+2188, U+109ED, U+1EC9E, U+1ECA0, +\& U+1ECB4) +\& T \ep{Numeric_Value: 200000} (= 2.0e+05) (Short: \ep{Nv=200000}) (2: +\& U+109EE, U+1EC9F) +\& T \ep{Numeric_Value: 216000} (= 2.2e+05) (Short: \ep{Nv=216000}) (1: +\& U+12432) +\& T \ep{Numeric_Value: 300000} (= 3.0e+05) (Short: \ep{Nv=300000}) (1: +\& U+109EF) +\& T \ep{Numeric_Value: 400000} (= 4.0e+05) (Short: \ep{Nv=400000}) (1: +\& U+109F0) +\& T \ep{Numeric_Value: 432000} (= 4.3e+05) (Short: \ep{Nv=432000}) (1: +\& U+12433) +\& T \ep{Numeric_Value: 500000} (= 5.0e+05) (Short: \ep{Nv=500000}) (1: +\& U+109F1) +\& T \ep{Numeric_Value: 600000} (= 6.0e+05) (Short: \ep{Nv=600000}) (1: +\& U+109F2) +\& T \ep{Numeric_Value: 700000} (= 7.0e+05) (Short: \ep{Nv=700000}) (1: +\& U+109F3) +\& T \ep{Numeric_Value: 800000} (= 8.0e+05) (Short: \ep{Nv=800000}) (1: +\& U+109F4) +\& T \ep{Numeric_Value: 900000} (= 9.0e+05) (Short: \ep{Nv=900000}) (1: +\& U+109F5) +\& T \ep{Numeric_Value: 1000000} (= 1.0e+06) (Short: \ep{Nv=1000000}) (1: +\& U+16B5E) +\& T \ep{Numeric_Value: 10000000} (= 1.0e+07) (Short: \ep{Nv=10000000}) +\& (1: U+1ECA1) +\& T \ep{Numeric_Value: 20000000} (= 2.0e+07) (Short: \ep{Nv=20000000}) +\& (1: U+1ECA2) +\& T \ep{Numeric_Value: 100000000} (= 1.0e+08) (Short: \ep{Nv=100000000}) +\& (3: U+4EBF, U+5104, U+16B5F) +\& T \ep{Numeric_Value: 10000000000} (= 1.0e+10) (Short: \ep{Nv= +\& 10000000000}) (1: U+16B60) +\& T \ep{Numeric_Value: 1000000000000} (= 1.0e+12) (Short: \ep{Nv= +\& 1000000000000}) (2: U+5146, U+16B61) +\& \ep{Numeric_Value: NaN} (Short: \ep{Nv=NaN}) (1_112_250 plus all +\& above\-Unicode code points: [\ex00\-\ex20! +\& \e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<=>?\e@A\-Z\e[\e\e\e] +\& \e^_\`a\-z\e{\e|\e}~\ex7f\-\exb1\exb4\-\exb8\exba\- +\& \exbb\exbf\-\exff], U+0100..065F, +\& U+066A..06EF, U+06FA..07BF, +\& U+07CA..0965, U+0970..09E5 ...) +\& \ep{Nushu} \ep{Script_Extensions=Nushu} (Short: +\& \ep{Nshu}; NOT \ep{Block=Nushu}) (397) +\& \ep{Nv: *} \ep{Numeric_Value: *} +\& \ep{Nyiakeng_Puachue_Hmong} \ep{Script_Extensions= +\& Nyiakeng_Puachue_Hmong} (Short: +\& \ep{Hmnp}; NOT \ep{Block= +\& Nyiakeng_Puachue_Hmong}) (71) +\& X \ep{OCR} \ep{Optical_Character_Recognition} (= +\& \ep{Block=Optical_Character_Recognition}) +\& (32) +\& \ep{Ogam} \ep{Ogham} (= \ep{Script_Extensions=Ogham}) +\& (NOT \ep{Block=Ogham}) (29) +\& \ep{Ogham} \ep{Script_Extensions=Ogham} (Short: +\& \ep{Ogam}; NOT \ep{Block=Ogham}) (29) +\& \ep{Ol_Chiki} \ep{Script_Extensions=Ol_Chiki} (Short: +\& \ep{Olck}) (48) +\& \ep{Olck} \ep{Ol_Chiki} (= \ep{Script_Extensions= +\& Ol_Chiki}) (48) +\& \ep{Old_Hungarian} \ep{Script_Extensions=Old_Hungarian} +\& (Short: \ep{Hung}; NOT \ep{Block= +\& Old_Hungarian}) (108) +\& \ep{Old_Italic} \ep{Script_Extensions=Old_Italic} (Short: +\& \ep{Ital}; NOT \ep{Block=Old_Italic}) (39) +\& \ep{Old_North_Arabian} \ep{Script_Extensions=Old_North_Arabian} +\& (Short: \ep{Narb}) (32) +\& \ep{Old_Permic} \ep{Script_Extensions=Old_Permic} (Short: +\& \ep{Perm}; NOT \ep{Block=Old_Permic}) (44) +\& \ep{Old_Persian} \ep{Script_Extensions=Old_Persian} (Short: +\& \ep{Xpeo}; NOT \ep{Block=Old_Persian}) (50) +\& \ep{Old_Sogdian} \ep{Script_Extensions=Old_Sogdian} (Short: +\& \ep{Sogo}; NOT \ep{Block=Old_Sogdian}) (40) +\& \ep{Old_South_Arabian} \ep{Script_Extensions=Old_South_Arabian} +\& (Short: \ep{Sarb}) (32) +\& \ep{Old_Turkic} \ep{Script_Extensions=Old_Turkic} (Short: +\& \ep{Orkh}; NOT \ep{Block=Old_Turkic}) (73) +\& \ep{Open_Punctuation} \ep{General_Category=Open_Punctuation} +\& (Short: \ep{Ps}) (75) +\& X \ep{Optical_Character_Recognition} \ep{Block= +\& Optical_Character_Recognition} (Short: +\& \ep{InOCR}) (32) +\& \ep{Oriya} \ep{Script_Extensions=Oriya} (Short: +\& \ep{Orya}; NOT \ep{Block=Oriya}) (97) +\& \ep{Orkh} \ep{Old_Turkic} (= \ep{Script_Extensions= +\& Old_Turkic}) (NOT \ep{Block=Old_Turkic}) +\& (73) +\& X \ep{Ornamental_Dingbats} \ep{Block=Ornamental_Dingbats} (48) +\& \ep{Orya} \ep{Oriya} (= \ep{Script_Extensions=Oriya}) +\& (NOT \ep{Block=Oriya}) (97) +\& \ep{Osage} \ep{Script_Extensions=Osage} (Short: +\& \ep{Osge}; NOT \ep{Block=Osage}) (72) +\& \ep{Osge} \ep{Osage} (= \ep{Script_Extensions=Osage}) +\& (NOT \ep{Block=Osage}) (72) +\& \ep{Osma} \ep{Osmanya} (= \ep{Script_Extensions= +\& Osmanya}) (NOT \ep{Block=Osmanya}) (40) +\& \ep{Osmanya} \ep{Script_Extensions=Osmanya} (Short: +\& \ep{Osma}; NOT \ep{Block=Osmanya}) (40) +\& \ep{Other} \ep{General_Category=Other} (Short: \ep{C}) +\& (970_414 plus all above\-Unicode code +\& points) +\& \ep{Other_Letter} \ep{General_Category=Other_Letter} (Short: +\& \ep{Lo}) (127_004) +\& \ep{Other_Number} \ep{General_Category=Other_Number} (Short: +\& \ep{No}) (895) +\& \ep{Other_Punctuation} \ep{General_Category=Other_Punctuation} +\& (Short: \ep{Po}) (593) +\& \ep{Other_Symbol} \ep{General_Category=Other_Symbol} (Short: +\& \ep{So}) (6431) +\& X \ep{Ottoman_Siyaq_Numbers} \ep{Block=Ottoman_Siyaq_Numbers} (80) +\& \ep{P} \epP \ep{Punct} (= \ep{General_Category= +\& Punctuation}) (NOT +\& \ep{General_Punctuation}) (798) +\& \ep{Pahawh_Hmong} \ep{Script_Extensions=Pahawh_Hmong} (Short: +\& \ep{Hmng}; NOT \ep{Block=Pahawh_Hmong}) +\& (127) +\& \ep{Palm} \ep{Palmyrene} (= \ep{Script_Extensions= +\& Palmyrene}) (32) +\& \ep{Palmyrene} \ep{Script_Extensions=Palmyrene} (Short: +\& \ep{Palm}) (32) +\& \ep{Paragraph_Separator} \ep{General_Category=Paragraph_Separator} +\& (Short: \ep{Zp}) (1) +\& \ep{Pat_Syn} \ep{Pattern_Syntax} (= \ep{Pattern_Syntax= +\& Y}) (2760) +\& \ep{Pat_Syn: *} \ep{Pattern_Syntax: *} +\& \ep{Pat_WS} \ep{Pattern_White_Space} (= +\& \ep{Pattern_White_Space=Y}) (11) +\& \ep{Pat_WS: *} \ep{Pattern_White_Space: *} +\& \ep{Pattern_Syntax} \ep{Pattern_Syntax=Y} (Short: \ep{PatSyn}) +\& (2760) +\& \ep{Pattern_Syntax: N*} (Short: \ep{PatSyn=N}, \eP{PatSyn}) +\& (1_111_352 plus all above\-Unicode code +\& points: [\ex00\-\ex200\-9A\-Z_a\-z\ex7f\-\exa0 +\& \exa8\exaa\exad\exaf\exb2\-\exb5\exb7\-\exba\exbc\- +\& \exbe\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..200F, U+2028..202F, +\& U+203F..2040, U+2054, U+205F..218F ...) +\& \ep{Pattern_Syntax: Y*} (Short: \ep{PatSyn=Y}, \ep{PatSyn}) (2760: +\& [!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<=>?\e@\e[\e\e\e] +\& \e^\`\e{\e|\e}~\exa1\-\exa7\exa9\exab\-\exac\exae +\& \exb0\-\exb1\exb6\exbb\exbf\exd7\exf7], +\& U+2010..2027, U+2030..203E, +\& U+2041..2053, U+2055..205E, U+2190..245F +\& ...) +\& \ep{Pattern_White_Space} \ep{Pattern_White_Space=Y} (Short: +\& \ep{PatWS}) (11) +\& \ep{Pattern_White_Space: N*} (Short: \ep{PatWS=N}, \eP{PatWS}) +\& (1_114_101 plus all above\-Unicode code +\& points: [^\et\en\ecK\ef\er\ex20\ex85], +\& U+0100..200D, U+2010..2027, +\& U+202A..infinity) +\& \ep{Pattern_White_Space: Y*} (Short: \ep{PatWS=Y}, \ep{PatWS}) (11: +\& [\et\en\ecK\ef\er\ex20\ex85], U+200E..200F, +\& U+2028..2029) +\& \ep{Pau_Cin_Hau} \ep{Script_Extensions=Pau_Cin_Hau} (Short: +\& \ep{Pauc}; NOT \ep{Block=Pau_Cin_Hau}) (57) +\& \ep{Pauc} \ep{Pau_Cin_Hau} (= \ep{Script_Extensions= +\& Pau_Cin_Hau}) (NOT \ep{Block= +\& Pau_Cin_Hau}) (57) +\& \ep{Pc} \ep{Connector_Punctuation} (= +\& \ep{General_Category= +\& Connector_Punctuation}) (10) +\& \ep{PCM} \ep{Prepended_Concatenation_Mark} (= +\& \ep{Prepended_Concatenation_Mark=Y}) (11) +\& \ep{PCM: *} \ep{Prepended_Concatenation_Mark: *} +\& \ep{Pd} \ep{Dash_Punctuation} (= +\& \ep{General_Category=Dash_Punctuation}) +\& (25) +\& \ep{Pe} \ep{Close_Punctuation} (= +\& \ep{General_Category=Close_Punctuation}) +\& (73) +\& \ep{PerlSpace} \ep{PosixSpace} (6) +\& \ep{PerlWord} \ep{PosixWord} (63) +\& \ep{Perm} \ep{Old_Permic} (= \ep{Script_Extensions= +\& Old_Permic}) (NOT \ep{Block=Old_Permic}) +\& (44) +\& \ep{Pf} \ep{Final_Punctuation} (= +\& \ep{General_Category=Final_Punctuation}) +\& (10) +\& \ep{Phag} \ep{Phags_Pa} (= \ep{Script_Extensions= +\& Phags_Pa}) (NOT \ep{Block=Phags_Pa}) (59) +\& \ep{Phags_Pa} \ep{Script_Extensions=Phags_Pa} (Short: +\& \ep{Phag}; NOT \ep{Block=Phags_Pa}) (59) +\& X \ep{Phaistos} \ep{Phaistos_Disc} (= \ep{Block= +\& Phaistos_Disc}) (48) +\& X \ep{Phaistos_Disc} \ep{Block=Phaistos_Disc} (Short: +\& \ep{InPhaistos}) (48) +\& \ep{Phli} \ep{Inscriptional_Pahlavi} (= +\& \ep{Script_Extensions= +\& Inscriptional_Pahlavi}) (NOT \ep{Block= +\& Inscriptional_Pahlavi}) (27) +\& \ep{Phlp} \ep{Psalter_Pahlavi} (= +\& \ep{Script_Extensions=Psalter_Pahlavi}) +\& (NOT \ep{Block=Psalter_Pahlavi}) (30) +\& \ep{Phnx} \ep{Phoenician} (= \ep{Script_Extensions= +\& Phoenician}) (NOT \ep{Block=Phoenician}) +\& (29) +\& \ep{Phoenician} \ep{Script_Extensions=Phoenician} (Short: +\& \ep{Phnx}; NOT \ep{Block=Phoenician}) (29) +\& X \ep{Phonetic_Ext} \ep{Phonetic_Extensions} (= \ep{Block= +\& Phonetic_Extensions}) (128) +\& X \ep{Phonetic_Ext_Sup} \ep{Phonetic_Extensions_Supplement} (= +\& \ep{Block= +\& Phonetic_Extensions_Supplement}) (64) +\& X \ep{Phonetic_Extensions} \ep{Block=Phonetic_Extensions} (Short: +\& \ep{InPhoneticExt}) (128) +\& X \ep{Phonetic_Extensions_Supplement} \ep{Block= +\& Phonetic_Extensions_Supplement} (Short: +\& \ep{InPhoneticExtSup}) (64) +\& \ep{Pi} \ep{Initial_Punctuation} (= +\& \ep{General_Category= +\& Initial_Punctuation}) (12) +\& X \ep{Playing_Cards} \ep{Block=Playing_Cards} (96) +\& \ep{Plrd} \ep{Miao} (= \ep{Script_Extensions=Miao}) +\& (NOT \ep{Block=Miao}) (149) +\& \ep{Po} \ep{Other_Punctuation} (= +\& \ep{General_Category=Other_Punctuation}) +\& (593) +\& \ep{PosixAlnum} (62: [0\-9A\-Za\-z]) +\& \ep{PosixAlpha} (52: [A\-Za\-z]) +\& \ep{PosixBlank} (2: [\et\ex20]) +\& \ep{PosixCntrl} ASCII control characters (33: ACK, BEL, +\& BS, CAN, CR, DC1, DC2, DC3, DC4, DEL, +\& DLE, ENQ, EOM, EOT, ESC, ETB, ETX, FF, +\& FS, GS, HT, LF, NAK, NUL, RS, SI, SO, +\& SOH, STX, SUB, SYN, US, VT) +\& \ep{PosixDigit} (10: [0\-9]) +\& \ep{PosixGraph} (94: [!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<=>?\e@A\- +\& Z\e[\e\e\e]\e^_\`a\-z\e{\e|\e}~]) +\& \ep{PosixLower} (/i= PosixAlpha) (26: [a\-z]) +\& \ep{PosixPrint} (95: [\ex20\-\ex7e]) +\& \ep{PosixPunct} (32: [!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<=>?\e@ +\& \e[\e\e\e]\e^_\`\e{\e|\e}~]) +\& \ep{PosixSpace} (Short: \ep{PerlSpace}) (6: [\et\en\ecK\ef\er +\& \ex20]) +\& \ep{PosixUpper} (/i= PosixAlpha) (26: [A\-Z]) +\& \ep{PosixWord} \ew, restricted to ASCII (Short: +\& \ep{PerlWord}) (63: [0\-9A\-Z_a\-z]) +\& \ep{PosixXDigit} \ep{ASCII_Hex_Digit=Y} (Short: \ep{AHex}) +\& (22) +\& \ep{Prepended_Concatenation_Mark} \ep{Prepended_Concatenation_Mark= +\& Y} (Short: \ep{PCM}) (11) +\& \ep{Prepended_Concatenation_Mark: N*} (Short: \ep{PCM=N}, \eP{PCM}) +\& (1_114_101 plus all above\-Unicode code +\& points: U+0000..05FF, U+0606..06DC, +\& U+06DE..070E, U+0710..08E1, +\& U+08E3..110BC, U+110BE..110CC ...) +\& \ep{Prepended_Concatenation_Mark: Y*} (Short: \ep{PCM=Y}, \ep{PCM}) +\& (11: U+0600..0605, U+06DD, U+070F, +\& U+08E2, U+110BD, U+110CD) +\& T \ep{Present_In: 1.1} \ep{Age=V1_1} (Short: \ep{In=1.1}) (Perl +\& extension) (33_979) +\& T \ep{Present_In: 2.0} Code point\*(Aqs usage introduced in version +\& 2.0 or earlier (Short: \ep{In=2.0}) (Perl +\& extension) (178_500: U+0000..01F5, +\& U+01FA..0217, U+0250..02A8, +\& U+02B0..02DE, U+02E0..02E9, U+0300..0345 +\& ...) +\& \ep{Present_In: V2_0} \ep{Present_In=2.0} (Perl extension) +\& (178_500) +\& T \ep{Present_In: 2.1} Code point\*(Aqs usage introduced in version +\& 2.1 or earlier (Short: \ep{In=2.1}) (Perl +\& extension) (178_502: U+0000..01F5, +\& U+01FA..0217, U+0250..02A8, +\& U+02B0..02DE, U+02E0..02E9, U+0300..0345 +\& ...) +\& \ep{Present_In: V2_1} \ep{Present_In=2.1} (Perl extension) +\& (178_502) +\& T \ep{Present_In: 3.0} Code point\*(Aqs usage introduced in version +\& 3.0 or earlier (Short: \ep{In=3.0}) (Perl +\& extension) (188_809: U+0000..021F, +\& U+0222..0233, U+0250..02AD, +\& U+02B0..02EE, U+0300..034E, U+0360..0362 +\& ...) +\& \ep{Present_In: V3_0} \ep{Present_In=3.0} (Perl extension) +\& (188_809) +\& T \ep{Present_In: 3.1} Code point\*(Aqs usage introduced in version +\& 3.1 or earlier (Short: \ep{In=3.1}) (Perl +\& extension) (233_787: U+0000..021F, +\& U+0222..0233, U+0250..02AD, +\& U+02B0..02EE, U+0300..034E, U+0360..0362 +\& ...) +\& \ep{Present_In: V3_1} \ep{Present_In=3.1} (Perl extension) +\& (233_787) +\& T \ep{Present_In: 3.2} Code point\*(Aqs usage introduced in version +\& 3.2 or earlier (Short: \ep{In=3.2}) (Perl +\& extension) (234_803: U+0000..0220, +\& U+0222..0233, U+0250..02AD, +\& U+02B0..02EE, U+0300..034F, U+0360..036F +\& ...) +\& \ep{Present_In: V3_2} \ep{Present_In=3.2} (Perl extension) +\& (234_803) +\& T \ep{Present_In: 4.0} Code point\*(Aqs usage introduced in version +\& 4.0 or earlier (Short: \ep{In=4.0}) (Perl +\& extension) (236_029: U+0000..0236, +\& U+0250..0357, U+035D..036F, +\& U+0374..0375, U+037A, U+037E ...) +\& \ep{Present_In: V4_0} \ep{Present_In=4.0} (Perl extension) +\& (236_029) +\& T \ep{Present_In: 4.1} Code point\*(Aqs usage introduced in version +\& 4.1 or earlier (Short: \ep{In=4.1}) (Perl +\& extension) (237_302: U+0000..0241, +\& U+0250..036F, U+0374..0375, U+037A, +\& U+037E, U+0384..038A ...) +\& \ep{Present_In: V4_1} \ep{Present_In=4.1} (Perl extension) +\& (237_302) +\& T \ep{Present_In: 5.0} Code point\*(Aqs usage introduced in version +\& 5.0 or earlier (Short: \ep{In=5.0}) (Perl +\& extension) (238_671: U+0000..036F, +\& U+0374..0375, U+037A..037E, +\& U+0384..038A, U+038C, U+038E..03A1 ...) +\& \ep{Present_In: V5_0} \ep{Present_In=5.0} (Perl extension) +\& (238_671) +\& T \ep{Present_In: 5.1} Code point\*(Aqs usage introduced in version +\& 5.1 or earlier (Short: \ep{In=5.1}) (Perl +\& extension) (240_295: U+0000..0377, +\& U+037A..037E, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..0523 ...) +\& \ep{Present_In: V5_1} \ep{Present_In=5.1} (Perl extension) +\& (240_295) +\& T \ep{Present_In: 5.2} Code point\*(Aqs usage introduced in version +\& 5.2 or earlier (Short: \ep{In=5.2}) (Perl +\& extension) (246_943: U+0000..0377, +\& U+037A..037E, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..0525 ...) +\& \ep{Present_In: V5_2} \ep{Present_In=5.2} (Perl extension) +\& (246_943) +\& T \ep{Present_In: 6.0} Code point\*(Aqs usage introduced in version +\& 6.0 or earlier (Short: \ep{In=6.0}) (Perl +\& extension) (249_031: U+0000..0377, +\& U+037A..037E, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..0527 ...) +\& \ep{Present_In: V6_0} \ep{Present_In=6.0} (Perl extension) +\& (249_031) +\& T \ep{Present_In: 6.1} Code point\*(Aqs usage introduced in version +\& 6.1 or earlier (Short: \ep{In=6.1}) (Perl +\& extension) (249_763: U+0000..0377, +\& U+037A..037E, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..0527 ...) +\& \ep{Present_In: V6_1} \ep{Present_In=6.1} (Perl extension) +\& (249_763) +\& T \ep{Present_In: 6.2} Code point\*(Aqs usage introduced in version +\& 6.2 or earlier (Short: \ep{In=6.2}) (Perl +\& extension) (249_764: U+0000..0377, +\& U+037A..037E, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..0527 ...) +\& \ep{Present_In: V6_2} \ep{Present_In=6.2} (Perl extension) +\& (249_764) +\& T \ep{Present_In: 6.3} Code point\*(Aqs usage introduced in version +\& 6.3 or earlier (Short: \ep{In=6.3}) (Perl +\& extension) (249_769: U+0000..0377, +\& U+037A..037E, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..0527 ...) +\& \ep{Present_In: V6_3} \ep{Present_In=6.3} (Perl extension) +\& (249_769) +\& T \ep{Present_In: 7.0} Code point\*(Aqs usage introduced in version +\& 7.0 or earlier (Short: \ep{In=7.0}) (Perl +\& extension) (252_603: U+0000..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..052F ...) +\& \ep{Present_In: V7_0} \ep{Present_In=7.0} (Perl extension) +\& (252_603) +\& T \ep{Present_In: 8.0} Code point\*(Aqs usage introduced in version +\& 8.0 or earlier (Short: \ep{In=8.0}) (Perl +\& extension) (260_319: U+0000..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..052F ...) +\& \ep{Present_In: V8_0} \ep{Present_In=8.0} (Perl extension) +\& (260_319) +\& T \ep{Present_In: 9.0} Code point\*(Aqs usage introduced in version +\& 9.0 or earlier (Short: \ep{In=9.0}) (Perl +\& extension) (267_819: U+0000..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..052F ...) +\& \ep{Present_In: V9_0} \ep{Present_In=9.0} (Perl extension) +\& (267_819) +\& T \ep{Present_In: 10.0} Code point\*(Aqs usage introduced in version +\& 10.0 or earlier (Short: \ep{In=10.0}) +\& (Perl extension) (276_337: U+0000..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..052F ...) +\& \ep{Present_In: V10_0} \ep{Present_In=10.0} (Perl extension) +\& (276_337) +\& T \ep{Present_In: 11.0} Code point\*(Aqs usage introduced in version +\& 11.0 or earlier (Short: \ep{In=11.0}) +\& (Perl extension) (277_021: U+0000..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..052F ...) +\& \ep{Present_In: V11_0} \ep{Present_In=11.0} (Perl extension) +\& (277_021) +\& T \ep{Present_In: 12.0} Code point\*(Aqs usage introduced in version +\& 12.0 or earlier (Short: \ep{In=12.0}) +\& (Perl extension) (277_575: U+0000..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..052F ...) +\& \ep{Present_In: V12_0} \ep{Present_In=12.0} (Perl extension) +\& (277_575) +\& T \ep{Present_In: 12.1} Code point\*(Aqs usage introduced in version +\& 12.1 or earlier (Short: \ep{In=12.1}) +\& (Perl extension) (277_576: U+0000..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..052F ...) +\& \ep{Present_In: V12_1} \ep{Present_In=12.1} (Perl extension) +\& (277_576) +\& T \ep{Present_In: 13.0} Code point\*(Aqs usage introduced in version +\& 13.0 or earlier (Short: \ep{In=13.0}) +\& (Perl extension) (283_506: U+0000..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1, U+03A3..052F ...) +\& \ep{Present_In: V13_0} \ep{Present_In=13.0} (Perl extension) +\& (283_506) +\& \ep{Present_In: Unassigned} \ep{Age=Unassigned} (Short: \ep{In= +\& Unassigned}) (Perl extension) (830_606 +\& plus all above\-Unicode code points) +\& \ep{Print} \ep{XPosixPrint} (281_325) +\& \ep{Private_Use} \ep{General_Category=Private_Use} (Short: +\& \ep{Co}; NOT \ep{Private_Use_Area}) +\& (137_468) +\& X \ep{Private_Use_Area} \ep{Block=Private_Use_Area} (Short: +\& \ep{InPUA}) (6400) +\& \ep{Prti} \ep{Inscriptional_Parthian} (= +\& \ep{Script_Extensions= +\& Inscriptional_Parthian}) (NOT \ep{Block= +\& Inscriptional_Parthian}) (30) +\& \ep{Ps} \ep{Open_Punctuation} (= +\& \ep{General_Category=Open_Punctuation}) +\& (75) +\& \ep{Psalter_Pahlavi} \ep{Script_Extensions=Psalter_Pahlavi} +\& (Short: \ep{Phlp}; NOT \ep{Block= +\& Psalter_Pahlavi}) (30) +\& X \ep{PUA} \ep{Private_Use_Area} (= \ep{Block= +\& Private_Use_Area}) (6400) +\& \ep{Punct} \ep{General_Category=Punctuation} (Short: +\& \ep{P}; NOT \ep{General_Punctuation}) (798) +\& \ep{Punctuation} \ep{Punct} (= \ep{General_Category= +\& Punctuation}) (NOT +\& \ep{General_Punctuation}) (798) +\& \ep{Qaac} \ep{Coptic} (= \ep{Script_Extensions= +\& Coptic}) (NOT \ep{Block=Coptic}) (165) +\& \ep{Qaai} \ep{Inherited} (= \ep{Script_Extensions= +\& Inherited}) (503) +\& \ep{QMark} \ep{Quotation_Mark} (= \ep{Quotation_Mark= +\& Y}) (30) +\& \ep{QMark: *} \ep{Quotation_Mark: *} +\& \ep{Quotation_Mark} \ep{Quotation_Mark=Y} (Short: \ep{QMark}) +\& (30) +\& \ep{Quotation_Mark: N*} (Short: \ep{QMark=N}, \eP{QMark}) (1_114_082 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!#\e$\e%&\e(\e)*+,\e\-.\e/0\-9:;<=>? +\& \e@A\-Z\e[\e\e\e]\e^_\`a\-z\e{\e|\e}~\ex7f\-\exaa\exac\- +\& \exba\exbc\-\exff], U+0100..2017, +\& U+2020..2038, U+203B..2E41, +\& U+2E43..300B, U+3010..301C ...) +\& \ep{Quotation_Mark: Y*} (Short: \ep{QMark=Y}, \ep{QMark}) (30: [\e" +\& \e\*(Aq\exab\exbb], U+2018..201F, U+2039..203A, +\& U+2E42, U+300C..300F, U+301D..301F ...) +\& \ep{Radical} \ep{Radical=Y} (329) +\& \ep{Radical: N*} (Single: \eP{Radical}) (1_113_783 plus all +\& above\-Unicode code points: U+0000..2E7F, +\& U+2E9A, U+2EF4..2EFF, U+2FD6..infinity) +\& \ep{Radical: Y*} (Single: \ep{Radical}) (329: U+2E80..2E99, +\& U+2E9B..2EF3, U+2F00..2FD5) +\& \ep{Regional_Indicator} \ep{Regional_Indicator=Y} (Short: \ep{RI}) +\& (26) +\& \ep{Regional_Indicator: N*} (Short: \ep{RI=N}, \eP{RI}) (1_114_086 +\& plus all above\-Unicode code points: +\& U+0000..1F1E5, U+1F200..infinity) +\& \ep{Regional_Indicator: Y*} (Short: \ep{RI=Y}, \ep{RI}) (26: +\& U+1F1E6..1F1FF) +\& \ep{Rejang} \ep{Script_Extensions=Rejang} (Short: +\& \ep{Rjng}; NOT \ep{Block=Rejang}) (37) +\& \ep{RI} \ep{Regional_Indicator} (= +\& \ep{Regional_Indicator=Y}) (26) +\& \ep{RI: *} \ep{Regional_Indicator: *} +\& \ep{Rjng} \ep{Rejang} (= \ep{Script_Extensions= +\& Rejang}) (NOT \ep{Block=Rejang}) (37) +\& \ep{Rohg} \ep{Hanifi_Rohingya} (= +\& \ep{Script_Extensions=Hanifi_Rohingya}) +\& (NOT \ep{Block=Hanifi_Rohingya}) (55) +\& X \ep{Rumi} \ep{Rumi_Numeral_Symbols} (= \ep{Block= +\& Rumi_Numeral_Symbols}) (32) +\& X \ep{Rumi_Numeral_Symbols} \ep{Block=Rumi_Numeral_Symbols} (Short: +\& \ep{InRumi}) (32) +\& \ep{Runic} \ep{Script_Extensions=Runic} (Short: +\& \ep{Runr}; NOT \ep{Block=Runic}) (86) +\& \ep{Runr} \ep{Runic} (= \ep{Script_Extensions=Runic}) +\& (NOT \ep{Block=Runic}) (86) +\& \ep{S} \epS \ep{Symbol} (= \ep{General_Category=Symbol}) +\& (7564) +\& \ep{Samaritan} \ep{Script_Extensions=Samaritan} (Short: +\& \ep{Samr}; NOT \ep{Block=Samaritan}) (61) +\& \ep{Samr} \ep{Samaritan} (= \ep{Script_Extensions= +\& Samaritan}) (NOT \ep{Block=Samaritan}) +\& (61) +\& \ep{Sarb} \ep{Old_South_Arabian} (= +\& \ep{Script_Extensions=Old_South_Arabian}) +\& (32) +\& \ep{Saur} \ep{Saurashtra} (= \ep{Script_Extensions= +\& Saurashtra}) (NOT \ep{Block=Saurashtra}) +\& (82) +\& \ep{Saurashtra} \ep{Script_Extensions=Saurashtra} (Short: +\& \ep{Saur}; NOT \ep{Block=Saurashtra}) (82) +\& \ep{SB: *} \ep{Sentence_Break: *} +\& \ep{Sc} \ep{Currency_Symbol} (= +\& \ep{General_Category=Currency_Symbol}) +\& (62) +\& \ep{Sc: *} \ep{Script: *} +\& \ep{Script: Adlam} (Short: \ep{Sc=Adlm}) (88: U+1E900..1E94B, +\& U+1E950..1E959, U+1E95E..1E95F) +\& \ep{Script: Adlm} \ep{Script=Adlam} (88) +\& \ep{Script: Aghb} \ep{Script=Caucasian_Albanian} (= +\& \ep{Script_Extensions= +\& Caucasian_Albanian}) (53) +\& \ep{Script: Ahom} \ep{Script_Extensions=Ahom} (Short: \ep{Sc= +\& Ahom}, \ep{Ahom}) (58) +\& \ep{Script: Anatolian_Hieroglyphs} \ep{Script_Extensions= +\& Anatolian_Hieroglyphs} (Short: \ep{Sc= +\& Hluw}, \ep{Hluw}) (583) +\& \ep{Script: Arab} \ep{Script=Arabic} (1291) +\& \ep{Script: Arabic} (Short: \ep{Sc=Arab}) (1291: U+0600..0604, +\& U+0606..060B, U+060D..061A, U+061C, +\& U+061E, U+0620..063F ...) +\& \ep{Script: Armenian} \ep{Script_Extensions=Armenian} (Short: +\& \ep{Sc=Armn}, \ep{Armn}) (96) +\& \ep{Script: Armi} \ep{Script=Imperial_Aramaic} (= +\& \ep{Script_Extensions=Imperial_Aramaic}) +\& (31) +\& \ep{Script: Armn} \ep{Script=Armenian} (= +\& \ep{Script_Extensions=Armenian}) (96) +\& \ep{Script: Avestan} \ep{Script_Extensions=Avestan} (Short: +\& \ep{Sc=Avst}, \ep{Avst}) (61) +\& \ep{Script: Avst} \ep{Script=Avestan} (= +\& \ep{Script_Extensions=Avestan}) (61) +\& \ep{Script: Bali} \ep{Script=Balinese} (= +\& \ep{Script_Extensions=Balinese}) (121) +\& \ep{Script: Balinese} \ep{Script_Extensions=Balinese} (Short: +\& \ep{Sc=Bali}, \ep{Bali}) (121) +\& \ep{Script: Bamu} \ep{Script=Bamum} (= \ep{Script_Extensions= +\& Bamum}) (657) +\& \ep{Script: Bamum} \ep{Script_Extensions=Bamum} (Short: \ep{Sc= +\& Bamu}, \ep{Bamu}) (657) +\& \ep{Script: Bass} \ep{Script=Bassa_Vah} (= +\& \ep{Script_Extensions=Bassa_Vah}) (36) +\& \ep{Script: Bassa_Vah} \ep{Script_Extensions=Bassa_Vah} (Short: +\& \ep{Sc=Bass}, \ep{Bass}) (36) +\& \ep{Script: Batak} \ep{Script_Extensions=Batak} (Short: \ep{Sc= +\& Batk}, \ep{Batk}) (56) +\& \ep{Script: Batk} \ep{Script=Batak} (= \ep{Script_Extensions= +\& Batak}) (56) +\& \ep{Script: Beng} \ep{Script=Bengali} (96) +\& \ep{Script: Bengali} (Short: \ep{Sc=Beng}) (96: U+0980..0983, +\& U+0985..098C, U+098F..0990, +\& U+0993..09A8, U+09AA..09B0, U+09B2 ...) +\& \ep{Script: Bhaiksuki} \ep{Script_Extensions=Bhaiksuki} (Short: +\& \ep{Sc=Bhks}, \ep{Bhks}) (97) +\& \ep{Script: Bhks} \ep{Script=Bhaiksuki} (= +\& \ep{Script_Extensions=Bhaiksuki}) (97) +\& \ep{Script: Bopo} \ep{Script=Bopomofo} (77) +\& \ep{Script: Bopomofo} (Short: \ep{Sc=Bopo}) (77: U+02EA..02EB, +\& U+3105..312F, U+31A0..31BF) +\& \ep{Script: Brah} \ep{Script=Brahmi} (= \ep{Script_Extensions= +\& Brahmi}) (109) +\& \ep{Script: Brahmi} \ep{Script_Extensions=Brahmi} (Short: +\& \ep{Sc=Brah}, \ep{Brah}) (109) +\& \ep{Script: Brai} \ep{Script=Braille} (= +\& \ep{Script_Extensions=Braille}) (256) +\& \ep{Script: Braille} \ep{Script_Extensions=Braille} (Short: +\& \ep{Sc=Brai}, \ep{Brai}) (256) +\& \ep{Script: Bugi} \ep{Script=Buginese} (30) +\& \ep{Script: Buginese} (Short: \ep{Sc=Bugi}) (30: U+1A00..1A1B, +\& U+1A1E..1A1F) +\& \ep{Script: Buhd} \ep{Script=Buhid} (20) +\& \ep{Script: Buhid} (Short: \ep{Sc=Buhd}) (20: U+1740..1753) +\& \ep{Script: Cakm} \ep{Script=Chakma} (71) +\& \ep{Script: Canadian_Aboriginal} \ep{Script_Extensions= +\& Canadian_Aboriginal} (Short: \ep{Sc= +\& Cans}, \ep{Cans}) (710) +\& \ep{Script: Cans} \ep{Script=Canadian_Aboriginal} (= +\& \ep{Script_Extensions= +\& Canadian_Aboriginal}) (710) +\& \ep{Script: Cari} \ep{Script=Carian} (= \ep{Script_Extensions= +\& Carian}) (49) +\& \ep{Script: Carian} \ep{Script_Extensions=Carian} (Short: +\& \ep{Sc=Cari}, \ep{Cari}) (49) +\& \ep{Script: Caucasian_Albanian} \ep{Script_Extensions= +\& Caucasian_Albanian} (Short: \ep{Sc=Aghb}, +\& \ep{Aghb}) (53) +\& \ep{Script: Chakma} (Short: \ep{Sc=Cakm}) (71: U+11100..11134, +\& U+11136..11147) +\& \ep{Script: Cham} \ep{Script_Extensions=Cham} (Short: \ep{Sc= +\& Cham}, \ep{Cham}) (83) +\& \ep{Script: Cher} \ep{Script=Cherokee} (= +\& \ep{Script_Extensions=Cherokee}) (172) +\& \ep{Script: Cherokee} \ep{Script_Extensions=Cherokee} (Short: +\& \ep{Sc=Cher}, \ep{Cher}) (172) +\& \ep{Script: Chorasmian} \ep{Script_Extensions=Chorasmian} (Short: +\& \ep{Sc=Chrs}, \ep{Chrs}) (28) +\& \ep{Script: Chrs} \ep{Script=Chorasmian} (= +\& \ep{Script_Extensions=Chorasmian}) (28) +\& \ep{Script: Common} (Short: \ep{Sc=Zyyy}) (8087: [\ex00\-\ex20! +\& \e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<=>?\e@\e[\e\e\e] +\& \e^_\`\e{\e|\e}~\ex7f\-\exa9\exab\-\exb9\exbb\-\exbf +\& \exd7\exf7], U+02B9..02DF, U+02E5..02E9, +\& U+02EC..02FF, U+0374, U+037E ...) +\& \ep{Script: Copt} \ep{Script=Coptic} (137) +\& \ep{Script: Coptic} (Short: \ep{Sc=Copt}) (137: U+03E2..03EF, +\& U+2C80..2CF3, U+2CF9..2CFF) +\& \ep{Script: Cprt} \ep{Script=Cypriot} (55) +\& \ep{Script: Cuneiform} \ep{Script_Extensions=Cuneiform} (Short: +\& \ep{Sc=Xsux}, \ep{Xsux}) (1234) +\& \ep{Script: Cypriot} (Short: \ep{Sc=Cprt}) (55: U+10800..10805, +\& U+10808, U+1080A..10835, U+10837..10838, +\& U+1083C, U+1083F) +\& \ep{Script: Cyrillic} (Short: \ep{Sc=Cyrl}) (443: U+0400..0484, +\& U+0487..052F, U+1C80..1C88, U+1D2B, +\& U+1D78, U+2DE0..2DFF ...) +\& \ep{Script: Cyrl} \ep{Script=Cyrillic} (443) +\& \ep{Script: Deseret} \ep{Script_Extensions=Deseret} (Short: +\& \ep{Sc=Dsrt}, \ep{Dsrt}) (80) +\& \ep{Script: Deva} \ep{Script=Devanagari} (154) +\& \ep{Script: Devanagari} (Short: \ep{Sc=Deva}) (154: U+0900..0950, +\& U+0955..0963, U+0966..097F, U+A8E0..A8FF) +\& \ep{Script: Diak} \ep{Script=Dives_Akuru} (= +\& \ep{Script_Extensions=Dives_Akuru}) (72) +\& \ep{Script: Dives_Akuru} \ep{Script_Extensions=Dives_Akuru} (Short: +\& \ep{Sc=Diak}, \ep{Diak}) (72) +\& \ep{Script: Dogr} \ep{Script=Dogra} (60) +\& \ep{Script: Dogra} (Short: \ep{Sc=Dogr}) (60: U+11800..1183B) +\& \ep{Script: Dsrt} \ep{Script=Deseret} (= +\& \ep{Script_Extensions=Deseret}) (80) +\& \ep{Script: Dupl} \ep{Script=Duployan} (143) +\& \ep{Script: Duployan} (Short: \ep{Sc=Dupl}) (143: U+1BC00..1BC6A, +\& U+1BC70..1BC7C, U+1BC80..1BC88, +\& U+1BC90..1BC99, U+1BC9C..1BC9F) +\& \ep{Script: Egyp} \ep{Script=Egyptian_Hieroglyphs} (= +\& \ep{Script_Extensions= +\& Egyptian_Hieroglyphs}) (1080) +\& \ep{Script: Egyptian_Hieroglyphs} \ep{Script_Extensions= +\& Egyptian_Hieroglyphs} (Short: \ep{Sc= +\& Egyp}, \ep{Egyp}) (1080) +\& \ep{Script: Elba} \ep{Script=Elbasan} (= +\& \ep{Script_Extensions=Elbasan}) (40) +\& \ep{Script: Elbasan} \ep{Script_Extensions=Elbasan} (Short: +\& \ep{Sc=Elba}, \ep{Elba}) (40) +\& \ep{Script: Elym} \ep{Script=Elymaic} (= +\& \ep{Script_Extensions=Elymaic}) (23) +\& \ep{Script: Elymaic} \ep{Script_Extensions=Elymaic} (Short: +\& \ep{Sc=Elym}, \ep{Elym}) (23) +\& \ep{Script: Ethi} \ep{Script=Ethiopic} (= +\& \ep{Script_Extensions=Ethiopic}) (495) +\& \ep{Script: Ethiopic} \ep{Script_Extensions=Ethiopic} (Short: +\& \ep{Sc=Ethi}, \ep{Ethi}) (495) +\& \ep{Script: Geor} \ep{Script=Georgian} (173) +\& \ep{Script: Georgian} (Short: \ep{Sc=Geor}) (173: U+10A0..10C5, +\& U+10C7, U+10CD, U+10D0..10FA, +\& U+10FC..10FF, U+1C90..1CBA ...) +\& \ep{Script: Glag} \ep{Script=Glagolitic} (132) +\& \ep{Script: Glagolitic} (Short: \ep{Sc=Glag}) (132: U+2C00..2C2E, +\& U+2C30..2C5E, U+1E000..1E006, +\& U+1E008..1E018, U+1E01B..1E021, +\& U+1E023..1E024 ...) +\& \ep{Script: Gong} \ep{Script=Gunjala_Gondi} (63) +\& \ep{Script: Gonm} \ep{Script=Masaram_Gondi} (75) +\& \ep{Script: Goth} \ep{Script=Gothic} (= \ep{Script_Extensions= +\& Gothic}) (27) +\& \ep{Script: Gothic} \ep{Script_Extensions=Gothic} (Short: +\& \ep{Sc=Goth}, \ep{Goth}) (27) +\& \ep{Script: Gran} \ep{Script=Grantha} (85) +\& \ep{Script: Grantha} (Short: \ep{Sc=Gran}) (85: U+11300..11303, +\& U+11305..1130C, U+1130F..11310, +\& U+11313..11328, U+1132A..11330, +\& U+11332..11333 ...) +\& \ep{Script: Greek} (Short: \ep{Sc=Grek}) (518: U+0370..0373, +\& U+0375..0377, U+037A..037D, U+037F, +\& U+0384, U+0386 ...) +\& \ep{Script: Grek} \ep{Script=Greek} (518) +\& \ep{Script: Gujarati} (Short: \ep{Sc=Gujr}) (91: U+0A81..0A83, +\& U+0A85..0A8D, U+0A8F..0A91, +\& U+0A93..0AA8, U+0AAA..0AB0, U+0AB2..0AB3 +\& ...) +\& \ep{Script: Gujr} \ep{Script=Gujarati} (91) +\& \ep{Script: Gunjala_Gondi} (Short: \ep{Sc=Gong}) (63: +\& U+11D60..11D65, U+11D67..11D68, +\& U+11D6A..11D8E, U+11D90..11D91, +\& U+11D93..11D98, U+11DA0..11DA9) +\& \ep{Script: Gurmukhi} (Short: \ep{Sc=Guru}) (80: U+0A01..0A03, +\& U+0A05..0A0A, U+0A0F..0A10, +\& U+0A13..0A28, U+0A2A..0A30, U+0A32..0A33 +\& ...) +\& \ep{Script: Guru} \ep{Script=Gurmukhi} (80) +\& \ep{Script: Han} (Short: \ep{Sc=Han}) (94_204: U+2E80..2E99, +\& U+2E9B..2EF3, U+2F00..2FD5, U+3005, +\& U+3007, U+3021..3029 ...) +\& \ep{Script: Hang} \ep{Script=Hangul} (11_739) +\& \ep{Script: Hangul} (Short: \ep{Sc=Hang}) (11_739: +\& U+1100..11FF, U+302E..302F, +\& U+3131..318E, U+3200..321E, +\& U+3260..327E, U+A960..A97C ...) +\& \ep{Script: Hani} \ep{Script=Han} (94_204) +\& \ep{Script: Hanifi_Rohingya} (Short: \ep{Sc=Rohg}) (50: +\& U+10D00..10D27, U+10D30..10D39) +\& \ep{Script: Hano} \ep{Script=Hanunoo} (21) +\& \ep{Script: Hanunoo} (Short: \ep{Sc=Hano}) (21: U+1720..1734) +\& \ep{Script: Hatr} \ep{Script=Hatran} (= \ep{Script_Extensions= +\& Hatran}) (26) +\& \ep{Script: Hatran} \ep{Script_Extensions=Hatran} (Short: +\& \ep{Sc=Hatr}, \ep{Hatr}) (26) +\& \ep{Script: Hebr} \ep{Script=Hebrew} (= \ep{Script_Extensions= +\& Hebrew}) (134) +\& \ep{Script: Hebrew} \ep{Script_Extensions=Hebrew} (Short: +\& \ep{Sc=Hebr}, \ep{Hebr}) (134) +\& \ep{Script: Hira} \ep{Script=Hiragana} (379) +\& \ep{Script: Hiragana} (Short: \ep{Sc=Hira}) (379: U+3041..3096, +\& U+309D..309F, U+1B001..1B11E, +\& U+1B150..1B152, U+1F200) +\& \ep{Script: Hluw} \ep{Script=Anatolian_Hieroglyphs} (= +\& \ep{Script_Extensions= +\& Anatolian_Hieroglyphs}) (583) +\& \ep{Script: Hmng} \ep{Script=Pahawh_Hmong} (= +\& \ep{Script_Extensions=Pahawh_Hmong}) (127) +\& \ep{Script: Hmnp} \ep{Script=Nyiakeng_Puachue_Hmong} (= +\& \ep{Script_Extensions= +\& Nyiakeng_Puachue_Hmong}) (71) +\& \ep{Script: Hung} \ep{Script=Old_Hungarian} (= +\& \ep{Script_Extensions=Old_Hungarian}) +\& (108) +\& \ep{Script: Imperial_Aramaic} \ep{Script_Extensions= +\& Imperial_Aramaic} (Short: \ep{Sc=Armi}, +\& \ep{Armi}) (31) +\& \ep{Script: Inherited} (Short: \ep{Sc=Zinh}) (573: U+0300..036F, +\& U+0485..0486, U+064B..0655, U+0670, +\& U+0951..0954, U+1AB0..1AC0 ...) +\& \ep{Script: Inscriptional_Pahlavi} \ep{Script_Extensions= +\& Inscriptional_Pahlavi} (Short: \ep{Sc= +\& Phli}, \ep{Phli}) (27) +\& \ep{Script: Inscriptional_Parthian} \ep{Script_Extensions= +\& Inscriptional_Parthian} (Short: \ep{Sc= +\& Prti}, \ep{Prti}) (30) +\& \ep{Script: Ital} \ep{Script=Old_Italic} (= +\& \ep{Script_Extensions=Old_Italic}) (39) +\& \ep{Script: Java} \ep{Script=Javanese} (90) +\& \ep{Script: Javanese} (Short: \ep{Sc=Java}) (90: U+A980..A9CD, +\& U+A9D0..A9D9, U+A9DE..A9DF) +\& \ep{Script: Kaithi} (Short: \ep{Sc=Kthi}) (67: U+11080..110C1, +\& U+110CD) +\& \ep{Script: Kali} \ep{Script=Kayah_Li} (47) +\& \ep{Script: Kana} \ep{Script=Katakana} (304) +\& \ep{Script: Kannada} (Short: \ep{Sc=Knda}) (89: U+0C80..0C8C, +\& U+0C8E..0C90, U+0C92..0CA8, +\& U+0CAA..0CB3, U+0CB5..0CB9, U+0CBC..0CC4 +\& ...) +\& \ep{Script: Katakana} (Short: \ep{Sc=Kana}) (304: U+30A1..30FA, +\& U+30FD..30FF, U+31F0..31FF, +\& U+32D0..32FE, U+3300..3357, U+FF66..FF6F +\& ...) +\& \ep{Script: Kayah_Li} (Short: \ep{Sc=Kali}) (47: U+A900..A92D, +\& U+A92F) +\& \ep{Script: Khar} \ep{Script=Kharoshthi} (= +\& \ep{Script_Extensions=Kharoshthi}) (68) +\& \ep{Script: Kharoshthi} \ep{Script_Extensions=Kharoshthi} (Short: +\& \ep{Sc=Khar}, \ep{Khar}) (68) +\& \ep{Script: Khitan_Small_Script} \ep{Script_Extensions= +\& Khitan_Small_Script} (Short: \ep{Sc= +\& Kits}, \ep{Kits}) (471) +\& \ep{Script: Khmer} \ep{Script_Extensions=Khmer} (Short: \ep{Sc= +\& Khmr}, \ep{Khmr}) (146) +\& \ep{Script: Khmr} \ep{Script=Khmer} (= \ep{Script_Extensions= +\& Khmer}) (146) +\& \ep{Script: Khoj} \ep{Script=Khojki} (62) +\& \ep{Script: Khojki} (Short: \ep{Sc=Khoj}) (62: U+11200..11211, +\& U+11213..1123E) +\& \ep{Script: Khudawadi} (Short: \ep{Sc=Sind}) (69: U+112B0..112EA, +\& U+112F0..112F9) +\& \ep{Script: Kits} \ep{Script=Khitan_Small_Script} (= +\& \ep{Script_Extensions= +\& Khitan_Small_Script}) (471) +\& \ep{Script: Knda} \ep{Script=Kannada} (89) +\& \ep{Script: Kthi} \ep{Script=Kaithi} (67) +\& \ep{Script: Lana} \ep{Script=Tai_Tham} (= +\& \ep{Script_Extensions=Tai_Tham}) (127) +\& \ep{Script: Lao} \ep{Script_Extensions=Lao} (Short: \ep{Sc= +\& Lao}, \ep{Lao}) (82) +\& \ep{Script: Laoo} \ep{Script=Lao} (= \ep{Script_Extensions= +\& Lao}) (82) +\& \ep{Script: Latin} (Short: \ep{Sc=Latn}) (1374: [A\-Za\-z\exaa +\& \exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..02B8, U+02E0..02E4, +\& U+1D00..1D25, U+1D2C..1D5C, U+1D62..1D65 +\& ...) +\& \ep{Script: Latn} \ep{Script=Latin} (1374) +\& \ep{Script: Lepc} \ep{Script=Lepcha} (= \ep{Script_Extensions= +\& Lepcha}) (74) +\& \ep{Script: Lepcha} \ep{Script_Extensions=Lepcha} (Short: +\& \ep{Sc=Lepc}, \ep{Lepc}) (74) +\& \ep{Script: Limb} \ep{Script=Limbu} (68) +\& \ep{Script: Limbu} (Short: \ep{Sc=Limb}) (68: U+1900..191E, +\& U+1920..192B, U+1930..193B, U+1940, +\& U+1944..194F) +\& \ep{Script: Lina} \ep{Script=Linear_A} (341) +\& \ep{Script: Linb} \ep{Script=Linear_B} (211) +\& \ep{Script: Linear_A} (Short: \ep{Sc=Lina}) (341: U+10600..10736, +\& U+10740..10755, U+10760..10767) +\& \ep{Script: Linear_B} (Short: \ep{Sc=Linb}) (211: U+10000..1000B, +\& U+1000D..10026, U+10028..1003A, +\& U+1003C..1003D, U+1003F..1004D, +\& U+10050..1005D ...) +\& \ep{Script: Lisu} \ep{Script_Extensions=Lisu} (Short: \ep{Sc= +\& Lisu}, \ep{Lisu}) (49) +\& \ep{Script: Lyci} \ep{Script=Lycian} (= \ep{Script_Extensions= +\& Lycian}) (29) +\& \ep{Script: Lycian} \ep{Script_Extensions=Lycian} (Short: +\& \ep{Sc=Lyci}, \ep{Lyci}) (29) +\& \ep{Script: Lydi} \ep{Script=Lydian} (= \ep{Script_Extensions= +\& Lydian}) (27) +\& \ep{Script: Lydian} \ep{Script_Extensions=Lydian} (Short: +\& \ep{Sc=Lydi}, \ep{Lydi}) (27) +\& \ep{Script: Mahajani} (Short: \ep{Sc=Mahj}) (39: U+11150..11176) +\& \ep{Script: Mahj} \ep{Script=Mahajani} (39) +\& \ep{Script: Maka} \ep{Script=Makasar} (= +\& \ep{Script_Extensions=Makasar}) (25) +\& \ep{Script: Makasar} \ep{Script_Extensions=Makasar} (Short: +\& \ep{Sc=Maka}, \ep{Maka}) (25) +\& \ep{Script: Malayalam} (Short: \ep{Sc=Mlym}) (118: U+0D00..0D0C, +\& U+0D0E..0D10, U+0D12..0D44, +\& U+0D46..0D48, U+0D4A..0D4F, U+0D54..0D63 +\& ...) +\& \ep{Script: Mand} \ep{Script=Mandaic} (29) +\& \ep{Script: Mandaic} (Short: \ep{Sc=Mand}) (29: U+0840..085B, +\& U+085E) +\& \ep{Script: Mani} \ep{Script=Manichaean} (51) +\& \ep{Script: Manichaean} (Short: \ep{Sc=Mani}) (51: U+10AC0..10AE6, +\& U+10AEB..10AF6) +\& \ep{Script: Marc} \ep{Script=Marchen} (= +\& \ep{Script_Extensions=Marchen}) (68) +\& \ep{Script: Marchen} \ep{Script_Extensions=Marchen} (Short: +\& \ep{Sc=Marc}, \ep{Marc}) (68) +\& \ep{Script: Masaram_Gondi} (Short: \ep{Sc=Gonm}) (75: +\& U+11D00..11D06, U+11D08..11D09, +\& U+11D0B..11D36, U+11D3A, U+11D3C..11D3D, +\& U+11D3F..11D47 ...) +\& \ep{Script: Medefaidrin} \ep{Script_Extensions=Medefaidrin} (Short: +\& \ep{Sc=Medf}, \ep{Medf}) (91) +\& \ep{Script: Medf} \ep{Script=Medefaidrin} (= +\& \ep{Script_Extensions=Medefaidrin}) (91) +\& \ep{Script: Meetei_Mayek} \ep{Script_Extensions=Meetei_Mayek} +\& (Short: \ep{Sc=Mtei}, \ep{Mtei}) (79) +\& \ep{Script: Mend} \ep{Script=Mende_Kikakui} (= +\& \ep{Script_Extensions=Mende_Kikakui}) +\& (213) +\& \ep{Script: Mende_Kikakui} \ep{Script_Extensions=Mende_Kikakui} +\& (Short: \ep{Sc=Mend}, \ep{Mend}) (213) +\& \ep{Script: Merc} \ep{Script=Meroitic_Cursive} (= +\& \ep{Script_Extensions=Meroitic_Cursive}) +\& (90) +\& \ep{Script: Mero} \ep{Script=Meroitic_Hieroglyphs} (= +\& \ep{Script_Extensions= +\& Meroitic_Hieroglyphs}) (32) +\& \ep{Script: Meroitic_Cursive} \ep{Script_Extensions= +\& Meroitic_Cursive} (Short: \ep{Sc=Merc}, +\& \ep{Merc}) (90) +\& \ep{Script: Meroitic_Hieroglyphs} \ep{Script_Extensions= +\& Meroitic_Hieroglyphs} (Short: \ep{Sc= +\& Mero}, \ep{Mero}) (32) +\& \ep{Script: Miao} \ep{Script_Extensions=Miao} (Short: \ep{Sc= +\& Miao}, \ep{Miao}) (149) +\& \ep{Script: Mlym} \ep{Script=Malayalam} (118) +\& \ep{Script: Modi} (Short: \ep{Sc=Modi}) (79: U+11600..11644, +\& U+11650..11659) +\& \ep{Script: Mong} \ep{Script=Mongolian} (167) +\& \ep{Script: Mongolian} (Short: \ep{Sc=Mong}) (167: U+1800..1801, +\& U+1804, U+1806..180E, U+1810..1819, +\& U+1820..1878, U+1880..18AA ...) +\& \ep{Script: Mro} \ep{Script_Extensions=Mro} (Short: \ep{Sc= +\& Mro}, \ep{Mro}) (43) +\& \ep{Script: Mroo} \ep{Script=Mro} (= \ep{Script_Extensions= +\& Mro}) (43) +\& \ep{Script: Mtei} \ep{Script=Meetei_Mayek} (= +\& \ep{Script_Extensions=Meetei_Mayek}) (79) +\& \ep{Script: Mult} \ep{Script=Multani} (38) +\& \ep{Script: Multani} (Short: \ep{Sc=Mult}) (38: U+11280..11286, +\& U+11288, U+1128A..1128D, U+1128F..1129D, +\& U+1129F..112A9) +\& \ep{Script: Myanmar} (Short: \ep{Sc=Mymr}) (223: U+1000..109F, +\& U+A9E0..A9FE, U+AA60..AA7F) +\& \ep{Script: Mymr} \ep{Script=Myanmar} (223) +\& \ep{Script: Nabataean} \ep{Script_Extensions=Nabataean} (Short: +\& \ep{Sc=Nbat}, \ep{Nbat}) (40) +\& \ep{Script: Nand} \ep{Script=Nandinagari} (65) +\& \ep{Script: Nandinagari} (Short: \ep{Sc=Nand}) (65: U+119A0..119A7, +\& U+119AA..119D7, U+119DA..119E4) +\& \ep{Script: Narb} \ep{Script=Old_North_Arabian} (= +\& \ep{Script_Extensions=Old_North_Arabian}) +\& (32) +\& \ep{Script: Nbat} \ep{Script=Nabataean} (= +\& \ep{Script_Extensions=Nabataean}) (40) +\& \ep{Script: New_Tai_Lue} \ep{Script_Extensions=New_Tai_Lue} (Short: +\& \ep{Sc=Talu}, \ep{Talu}) (83) +\& \ep{Script: Newa} \ep{Script_Extensions=Newa} (Short: \ep{Sc= +\& Newa}, \ep{Newa}) (97) +\& \ep{Script: Nko} \ep{Script_Extensions=Nko} (Short: \ep{Sc= +\& Nko}, \ep{Nko}) (62) +\& \ep{Script: Nkoo} \ep{Script=Nko} (= \ep{Script_Extensions= +\& Nko}) (62) +\& \ep{Script: Nshu} \ep{Script=Nushu} (= \ep{Script_Extensions= +\& Nushu}) (397) +\& \ep{Script: Nushu} \ep{Script_Extensions=Nushu} (Short: \ep{Sc= +\& Nshu}, \ep{Nshu}) (397) +\& \ep{Script: Nyiakeng_Puachue_Hmong} \ep{Script_Extensions= +\& Nyiakeng_Puachue_Hmong} (Short: \ep{Sc= +\& Hmnp}, \ep{Hmnp}) (71) +\& \ep{Script: Ogam} \ep{Script=Ogham} (= \ep{Script_Extensions= +\& Ogham}) (29) +\& \ep{Script: Ogham} \ep{Script_Extensions=Ogham} (Short: \ep{Sc= +\& Ogam}, \ep{Ogam}) (29) +\& \ep{Script: Ol_Chiki} \ep{Script_Extensions=Ol_Chiki} (Short: +\& \ep{Sc=Olck}, \ep{Olck}) (48) +\& \ep{Script: Olck} \ep{Script=Ol_Chiki} (= +\& \ep{Script_Extensions=Ol_Chiki}) (48) +\& \ep{Script: Old_Hungarian} \ep{Script_Extensions=Old_Hungarian} +\& (Short: \ep{Sc=Hung}, \ep{Hung}) (108) +\& \ep{Script: Old_Italic} \ep{Script_Extensions=Old_Italic} (Short: +\& \ep{Sc=Ital}, \ep{Ital}) (39) +\& \ep{Script: Old_North_Arabian} \ep{Script_Extensions= +\& Old_North_Arabian} (Short: \ep{Sc=Narb}, +\& \ep{Narb}) (32) +\& \ep{Script: Old_Permic} (Short: \ep{Sc=Perm}) (43: U+10350..1037A) +\& \ep{Script: Old_Persian} \ep{Script_Extensions=Old_Persian} (Short: +\& \ep{Sc=Xpeo}, \ep{Xpeo}) (50) +\& \ep{Script: Old_Sogdian} \ep{Script_Extensions=Old_Sogdian} (Short: +\& \ep{Sc=Sogo}, \ep{Sogo}) (40) +\& \ep{Script: Old_South_Arabian} \ep{Script_Extensions= +\& Old_South_Arabian} (Short: \ep{Sc=Sarb}, +\& \ep{Sarb}) (32) +\& \ep{Script: Old_Turkic} \ep{Script_Extensions=Old_Turkic} (Short: +\& \ep{Sc=Orkh}, \ep{Orkh}) (73) +\& \ep{Script: Oriya} (Short: \ep{Sc=Orya}) (91: U+0B01..0B03, +\& U+0B05..0B0C, U+0B0F..0B10, +\& U+0B13..0B28, U+0B2A..0B30, U+0B32..0B33 +\& ...) +\& \ep{Script: Orkh} \ep{Script=Old_Turkic} (= +\& \ep{Script_Extensions=Old_Turkic}) (73) +\& \ep{Script: Orya} \ep{Script=Oriya} (91) +\& \ep{Script: Osage} \ep{Script_Extensions=Osage} (Short: \ep{Sc= +\& Osge}, \ep{Osge}) (72) +\& \ep{Script: Osge} \ep{Script=Osage} (= \ep{Script_Extensions= +\& Osage}) (72) +\& \ep{Script: Osma} \ep{Script=Osmanya} (= +\& \ep{Script_Extensions=Osmanya}) (40) +\& \ep{Script: Osmanya} \ep{Script_Extensions=Osmanya} (Short: +\& \ep{Sc=Osma}, \ep{Osma}) (40) +\& \ep{Script: Pahawh_Hmong} \ep{Script_Extensions=Pahawh_Hmong} +\& (Short: \ep{Sc=Hmng}, \ep{Hmng}) (127) +\& \ep{Script: Palm} \ep{Script=Palmyrene} (= +\& \ep{Script_Extensions=Palmyrene}) (32) +\& \ep{Script: Palmyrene} \ep{Script_Extensions=Palmyrene} (Short: +\& \ep{Sc=Palm}, \ep{Palm}) (32) +\& \ep{Script: Pau_Cin_Hau} \ep{Script_Extensions=Pau_Cin_Hau} (Short: +\& \ep{Sc=Pauc}, \ep{Pauc}) (57) +\& \ep{Script: Pauc} \ep{Script=Pau_Cin_Hau} (= +\& \ep{Script_Extensions=Pau_Cin_Hau}) (57) +\& \ep{Script: Perm} \ep{Script=Old_Permic} (43) +\& \ep{Script: Phag} \ep{Script=Phags_Pa} (56) +\& \ep{Script: Phags_Pa} (Short: \ep{Sc=Phag}) (56: U+A840..A877) +\& \ep{Script: Phli} \ep{Script=Inscriptional_Pahlavi} (= +\& \ep{Script_Extensions= +\& Inscriptional_Pahlavi}) (27) +\& \ep{Script: Phlp} \ep{Script=Psalter_Pahlavi} (29) +\& \ep{Script: Phnx} \ep{Script=Phoenician} (= +\& \ep{Script_Extensions=Phoenician}) (29) +\& \ep{Script: Phoenician} \ep{Script_Extensions=Phoenician} (Short: +\& \ep{Sc=Phnx}, \ep{Phnx}) (29) +\& \ep{Script: Plrd} \ep{Script=Miao} (= \ep{Script_Extensions= +\& Miao}) (149) +\& \ep{Script: Prti} \ep{Script=Inscriptional_Parthian} (= +\& \ep{Script_Extensions= +\& Inscriptional_Parthian}) (30) +\& \ep{Script: Psalter_Pahlavi} (Short: \ep{Sc=Phlp}) (29: +\& U+10B80..10B91, U+10B99..10B9C, +\& U+10BA9..10BAF) +\& \ep{Script: Qaac} \ep{Script=Coptic} (137) +\& \ep{Script: Qaai} \ep{Script=Inherited} (573) +\& \ep{Script: Rejang} \ep{Script_Extensions=Rejang} (Short: +\& \ep{Sc=Rjng}, \ep{Rjng}) (37) +\& \ep{Script: Rjng} \ep{Script=Rejang} (= \ep{Script_Extensions= +\& Rejang}) (37) +\& \ep{Script: Rohg} \ep{Script=Hanifi_Rohingya} (50) +\& \ep{Script: Runic} \ep{Script_Extensions=Runic} (Short: \ep{Sc= +\& Runr}, \ep{Runr}) (86) +\& \ep{Script: Runr} \ep{Script=Runic} (= \ep{Script_Extensions= +\& Runic}) (86) +\& \ep{Script: Samaritan} \ep{Script_Extensions=Samaritan} (Short: +\& \ep{Sc=Samr}, \ep{Samr}) (61) +\& \ep{Script: Samr} \ep{Script=Samaritan} (= +\& \ep{Script_Extensions=Samaritan}) (61) +\& \ep{Script: Sarb} \ep{Script=Old_South_Arabian} (= +\& \ep{Script_Extensions=Old_South_Arabian}) +\& (32) +\& \ep{Script: Saur} \ep{Script=Saurashtra} (= +\& \ep{Script_Extensions=Saurashtra}) (82) +\& \ep{Script: Saurashtra} \ep{Script_Extensions=Saurashtra} (Short: +\& \ep{Sc=Saur}, \ep{Saur}) (82) +\& \ep{Script: Sgnw} \ep{Script=SignWriting} (= +\& \ep{Script_Extensions=SignWriting}) (672) +\& \ep{Script: Sharada} (Short: \ep{Sc=Shrd}) (96: U+11180..111DF) +\& \ep{Script: Shavian} \ep{Script_Extensions=Shavian} (Short: +\& \ep{Sc=Shaw}, \ep{Shaw}) (48) +\& \ep{Script: Shaw} \ep{Script=Shavian} (= +\& \ep{Script_Extensions=Shavian}) (48) +\& \ep{Script: Shrd} \ep{Script=Sharada} (96) +\& \ep{Script: Sidd} \ep{Script=Siddham} (= +\& \ep{Script_Extensions=Siddham}) (92) +\& \ep{Script: Siddham} \ep{Script_Extensions=Siddham} (Short: +\& \ep{Sc=Sidd}, \ep{Sidd}) (92) +\& \ep{Script: SignWriting} \ep{Script_Extensions=SignWriting} (Short: +\& \ep{Sc=Sgnw}, \ep{Sgnw}) (672) +\& \ep{Script: Sind} \ep{Script=Khudawadi} (69) +\& \ep{Script: Sinh} \ep{Script=Sinhala} (111) +\& \ep{Script: Sinhala} (Short: \ep{Sc=Sinh}) (111: U+0D81..0D83, +\& U+0D85..0D96, U+0D9A..0DB1, +\& U+0DB3..0DBB, U+0DBD, U+0DC0..0DC6 ...) +\& \ep{Script: Sogd} \ep{Script=Sogdian} (42) +\& \ep{Script: Sogdian} (Short: \ep{Sc=Sogd}) (42: U+10F30..10F59) +\& \ep{Script: Sogo} \ep{Script=Old_Sogdian} (= +\& \ep{Script_Extensions=Old_Sogdian}) (40) +\& \ep{Script: Sora} \ep{Script=Sora_Sompeng} (= +\& \ep{Script_Extensions=Sora_Sompeng}) (35) +\& \ep{Script: Sora_Sompeng} \ep{Script_Extensions=Sora_Sompeng} +\& (Short: \ep{Sc=Sora}, \ep{Sora}) (35) +\& \ep{Script: Soyo} \ep{Script=Soyombo} (= +\& \ep{Script_Extensions=Soyombo}) (83) +\& \ep{Script: Soyombo} \ep{Script_Extensions=Soyombo} (Short: +\& \ep{Sc=Soyo}, \ep{Soyo}) (83) +\& \ep{Script: Sund} \ep{Script=Sundanese} (= +\& \ep{Script_Extensions=Sundanese}) (72) +\& \ep{Script: Sundanese} \ep{Script_Extensions=Sundanese} (Short: +\& \ep{Sc=Sund}, \ep{Sund}) (72) +\& \ep{Script: Sylo} \ep{Script=Syloti_Nagri} (45) +\& \ep{Script: Syloti_Nagri} (Short: \ep{Sc=Sylo}) (45: U+A800..A82C) +\& \ep{Script: Syrc} \ep{Script=Syriac} (88) +\& \ep{Script: Syriac} (Short: \ep{Sc=Syrc}) (88: U+0700..070D, +\& U+070F..074A, U+074D..074F, U+0860..086A) +\& \ep{Script: Tagalog} (Short: \ep{Sc=Tglg}) (20: U+1700..170C, +\& U+170E..1714) +\& \ep{Script: Tagb} \ep{Script=Tagbanwa} (18) +\& \ep{Script: Tagbanwa} (Short: \ep{Sc=Tagb}) (18: U+1760..176C, +\& U+176E..1770, U+1772..1773) +\& \ep{Script: Tai_Le} (Short: \ep{Sc=Tale}) (35: U+1950..196D, +\& U+1970..1974) +\& \ep{Script: Tai_Tham} \ep{Script_Extensions=Tai_Tham} (Short: +\& \ep{Sc=Lana}, \ep{Lana}) (127) +\& \ep{Script: Tai_Viet} \ep{Script_Extensions=Tai_Viet} (Short: +\& \ep{Sc=Tavt}, \ep{Tavt}) (72) +\& \ep{Script: Takr} \ep{Script=Takri} (67) +\& \ep{Script: Takri} (Short: \ep{Sc=Takr}) (67: U+11680..116B8, +\& U+116C0..116C9) +\& \ep{Script: Tale} \ep{Script=Tai_Le} (35) +\& \ep{Script: Talu} \ep{Script=New_Tai_Lue} (= +\& \ep{Script_Extensions=New_Tai_Lue}) (83) +\& \ep{Script: Tamil} (Short: \ep{Sc=Taml}) (123: U+0B82..0B83, +\& U+0B85..0B8A, U+0B8E..0B90, +\& U+0B92..0B95, U+0B99..0B9A, U+0B9C ...) +\& \ep{Script: Taml} \ep{Script=Tamil} (123) +\& \ep{Script: Tang} \ep{Script=Tangut} (= \ep{Script_Extensions= +\& Tangut}) (6914) +\& \ep{Script: Tangut} \ep{Script_Extensions=Tangut} (Short: +\& \ep{Sc=Tang}, \ep{Tang}) (6914) +\& \ep{Script: Tavt} \ep{Script=Tai_Viet} (= +\& \ep{Script_Extensions=Tai_Viet}) (72) +\& \ep{Script: Telu} \ep{Script=Telugu} (98) +\& \ep{Script: Telugu} (Short: \ep{Sc=Telu}) (98: U+0C00..0C0C, +\& U+0C0E..0C10, U+0C12..0C28, +\& U+0C2A..0C39, U+0C3D..0C44, U+0C46..0C48 +\& ...) +\& \ep{Script: Tfng} \ep{Script=Tifinagh} (= +\& \ep{Script_Extensions=Tifinagh}) (59) +\& \ep{Script: Tglg} \ep{Script=Tagalog} (20) +\& \ep{Script: Thaa} \ep{Script=Thaana} (50) +\& \ep{Script: Thaana} (Short: \ep{Sc=Thaa}) (50: U+0780..07B1) +\& \ep{Script: Thai} \ep{Script_Extensions=Thai} (Short: \ep{Sc= +\& Thai}, \ep{Thai}) (86) +\& \ep{Script: Tibetan} \ep{Script_Extensions=Tibetan} (Short: +\& \ep{Sc=Tibt}, \ep{Tibt}) (207) +\& \ep{Script: Tibt} \ep{Script=Tibetan} (= +\& \ep{Script_Extensions=Tibetan}) (207) +\& \ep{Script: Tifinagh} \ep{Script_Extensions=Tifinagh} (Short: +\& \ep{Sc=Tfng}, \ep{Tfng}) (59) +\& \ep{Script: Tirh} \ep{Script=Tirhuta} (82) +\& \ep{Script: Tirhuta} (Short: \ep{Sc=Tirh}) (82: U+11480..114C7, +\& U+114D0..114D9) +\& \ep{Script: Ugar} \ep{Script=Ugaritic} (= +\& \ep{Script_Extensions=Ugaritic}) (31) +\& \ep{Script: Ugaritic} \ep{Script_Extensions=Ugaritic} (Short: +\& \ep{Sc=Ugar}, \ep{Ugar}) (31) +\& \ep{Script: Unknown} \ep{Script_Extensions=Unknown} (Short: +\& \ep{Sc=Zzzz}, \ep{Zzzz}) (970_188 plus all +\& above\-Unicode code points) +\& \ep{Script: Vai} \ep{Script_Extensions=Vai} (Short: \ep{Sc= +\& Vai}, \ep{Vai}) (300) +\& \ep{Script: Vaii} \ep{Script=Vai} (= \ep{Script_Extensions= +\& Vai}) (300) +\& \ep{Script: Wancho} \ep{Script_Extensions=Wancho} (Short: +\& \ep{Sc=Wcho}, \ep{Wcho}) (59) +\& \ep{Script: Wara} \ep{Script=Warang_Citi} (= +\& \ep{Script_Extensions=Warang_Citi}) (84) +\& \ep{Script: Warang_Citi} \ep{Script_Extensions=Warang_Citi} (Short: +\& \ep{Sc=Wara}, \ep{Wara}) (84) +\& \ep{Script: Wcho} \ep{Script=Wancho} (= \ep{Script_Extensions= +\& Wancho}) (59) +\& \ep{Script: Xpeo} \ep{Script=Old_Persian} (= +\& \ep{Script_Extensions=Old_Persian}) (50) +\& \ep{Script: Xsux} \ep{Script=Cuneiform} (= +\& \ep{Script_Extensions=Cuneiform}) (1234) +\& \ep{Script: Yezi} \ep{Script=Yezidi} (47) +\& \ep{Script: Yezidi} (Short: \ep{Sc=Yezi}) (47: U+10E80..10EA9, +\& U+10EAB..10EAD, U+10EB0..10EB1) +\& \ep{Script: Yi} (Short: \ep{Sc=Yi}) (1220: U+A000..A48C, +\& U+A490..A4C6) +\& \ep{Script: Yiii} \ep{Script=Yi} (1220) +\& \ep{Script: Zanabazar_Square} \ep{Script_Extensions= +\& Zanabazar_Square} (Short: \ep{Sc=Zanb}, +\& \ep{Zanb}) (72) +\& \ep{Script: Zanb} \ep{Script=Zanabazar_Square} (= +\& \ep{Script_Extensions=Zanabazar_Square}) +\& (72) +\& \ep{Script: Zinh} \ep{Script=Inherited} (573) +\& \ep{Script: Zyyy} \ep{Script=Common} (8087) +\& \ep{Script: Zzzz} \ep{Script=Unknown} (= +\& \ep{Script_Extensions=Unknown}) (970_188 +\& plus all above\-Unicode code points) +\& \ep{Script_Extensions: Adlam} (Short: \ep{Scx=Adlm}, \ep{Adlm}) (89: +\& U+0640, U+1E900..1E94B, U+1E950..1E959, +\& U+1E95E..1E95F) +\& \ep{Script_Extensions: Adlm} \ep{Script_Extensions=Adlam} (89) +\& \ep{Script_Extensions: Aghb} \ep{Script_Extensions= +\& Caucasian_Albanian} (53) +\& \ep{Script_Extensions: Ahom} (Short: \ep{Scx=Ahom}, \ep{Ahom}) (58: +\& U+11700..1171A, U+1171D..1172B, +\& U+11730..1173F) +\& \ep{Script_Extensions: Anatolian_Hieroglyphs} (Short: \ep{Scx=Hluw}, +\& \ep{Hluw}) (583: U+14400..14646) +\& \ep{Script_Extensions: Arab} \ep{Script_Extensions=Arabic} (1335) +\& \ep{Script_Extensions: Arabic} (Short: \ep{Scx=Arab}, \ep{Arab}) +\& (1335: U+0600..0604, U+0606..061C, +\& U+061E..06DC, U+06DE..06FF, +\& U+0750..077F, U+08A0..08B4 ...) +\& \ep{Script_Extensions: Armenian} (Short: \ep{Scx=Armn}, \ep{Armn}) +\& (96: U+0531..0556, U+0559..058A, +\& U+058D..058F, U+FB13..FB17) +\& \ep{Script_Extensions: Armi} \ep{Script_Extensions=Imperial_Aramaic} +\& (31) +\& \ep{Script_Extensions: Armn} \ep{Script_Extensions=Armenian} (96) +\& \ep{Script_Extensions: Avestan} (Short: \ep{Scx=Avst}, \ep{Avst}) +\& (61: U+10B00..10B35, U+10B39..10B3F) +\& \ep{Script_Extensions: Avst} \ep{Script_Extensions=Avestan} (61) +\& \ep{Script_Extensions: Bali} \ep{Script_Extensions=Balinese} (121) +\& \ep{Script_Extensions: Balinese} (Short: \ep{Scx=Bali}, \ep{Bali}) +\& (121: U+1B00..1B4B, U+1B50..1B7C) +\& \ep{Script_Extensions: Bamu} \ep{Script_Extensions=Bamum} (657) +\& \ep{Script_Extensions: Bamum} (Short: \ep{Scx=Bamu}, \ep{Bamu}) (657: +\& U+A6A0..A6F7, U+16800..16A38) +\& \ep{Script_Extensions: Bass} \ep{Script_Extensions=Bassa_Vah} (36) +\& \ep{Script_Extensions: Bassa_Vah} (Short: \ep{Scx=Bass}, \ep{Bass}) +\& (36: U+16AD0..16AED, U+16AF0..16AF5) +\& \ep{Script_Extensions: Batak} (Short: \ep{Scx=Batk}, \ep{Batk}) (56: +\& U+1BC0..1BF3, U+1BFC..1BFF) +\& \ep{Script_Extensions: Batk} \ep{Script_Extensions=Batak} (56) +\& \ep{Script_Extensions: Beng} \ep{Script_Extensions=Bengali} (113) +\& \ep{Script_Extensions: Bengali} (Short: \ep{Scx=Beng}, \ep{Beng}) +\& (113: U+0951..0952, U+0964..0965, +\& U+0980..0983, U+0985..098C, +\& U+098F..0990, U+0993..09A8 ...) +\& \ep{Script_Extensions: Bhaiksuki} (Short: \ep{Scx=Bhks}, \ep{Bhks}) +\& (97: U+11C00..11C08, U+11C0A..11C36, +\& U+11C38..11C45, U+11C50..11C6C) +\& \ep{Script_Extensions: Bhks} \ep{Script_Extensions=Bhaiksuki} (97) +\& \ep{Script_Extensions: Bopo} \ep{Script_Extensions=Bopomofo} (117) +\& \ep{Script_Extensions: Bopomofo} (Short: \ep{Scx=Bopo}, \ep{Bopo}) +\& (117: U+02EA..02EB, U+3001..3003, +\& U+3008..3011, U+3013..301F, +\& U+302A..302D, U+3030 ...) +\& \ep{Script_Extensions: Brah} \ep{Script_Extensions=Brahmi} (109) +\& \ep{Script_Extensions: Brahmi} (Short: \ep{Scx=Brah}, \ep{Brah}) +\& (109: U+11000..1104D, U+11052..1106F, +\& U+1107F) +\& \ep{Script_Extensions: Brai} \ep{Script_Extensions=Braille} (256) +\& \ep{Script_Extensions: Braille} (Short: \ep{Scx=Brai}, \ep{Brai}) +\& (256: U+2800..28FF) +\& \ep{Script_Extensions: Bugi} \ep{Script_Extensions=Buginese} (31) +\& \ep{Script_Extensions: Buginese} (Short: \ep{Scx=Bugi}, \ep{Bugi}) +\& (31: U+1A00..1A1B, U+1A1E..1A1F, U+A9CF) +\& \ep{Script_Extensions: Buhd} \ep{Script_Extensions=Buhid} (22) +\& \ep{Script_Extensions: Buhid} (Short: \ep{Scx=Buhd}, \ep{Buhd}) (22: +\& U+1735..1736, U+1740..1753) +\& \ep{Script_Extensions: Cakm} \ep{Script_Extensions=Chakma} (91) +\& \ep{Script_Extensions: Canadian_Aboriginal} (Short: \ep{Scx=Cans}, +\& \ep{Cans}) (710: U+1400..167F, +\& U+18B0..18F5) +\& \ep{Script_Extensions: Cans} \ep{Script_Extensions= +\& Canadian_Aboriginal} (710) +\& \ep{Script_Extensions: Cari} \ep{Script_Extensions=Carian} (49) +\& \ep{Script_Extensions: Carian} (Short: \ep{Scx=Cari}, \ep{Cari}) (49: +\& U+102A0..102D0) +\& \ep{Script_Extensions: Caucasian_Albanian} (Short: \ep{Scx=Aghb}, +\& \ep{Aghb}) (53: U+10530..10563, U+1056F) +\& \ep{Script_Extensions: Chakma} (Short: \ep{Scx=Cakm}, \ep{Cakm}) (91: +\& U+09E6..09EF, U+1040..1049, +\& U+11100..11134, U+11136..11147) +\& \ep{Script_Extensions: Cham} (Short: \ep{Scx=Cham}, \ep{Cham}) (83: +\& U+AA00..AA36, U+AA40..AA4D, +\& U+AA50..AA59, U+AA5C..AA5F) +\& \ep{Script_Extensions: Cher} \ep{Script_Extensions=Cherokee} (172) +\& \ep{Script_Extensions: Cherokee} (Short: \ep{Scx=Cher}, \ep{Cher}) +\& (172: U+13A0..13F5, U+13F8..13FD, +\& U+AB70..ABBF) +\& \ep{Script_Extensions: Chorasmian} (Short: \ep{Scx=Chrs}, \ep{Chrs}) +\& (28: U+10FB0..10FCB) +\& \ep{Script_Extensions: Chrs} \ep{Script_Extensions=Chorasmian} (28) +\& \ep{Script_Extensions: Common} (Short: \ep{Scx=Zyyy}, \ep{Zyyy}) +\& (7661: [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-. +\& \e/0\-9:;<=>?\e@\e[\e\e\e]\e^_\`\e{\e|\e}~\ex7f\-\exa9 +\& \exab\-\exb9\exbb\-\exbf\exd7\exf7], +\& U+02B9..02DF, U+02E5..02E9, +\& U+02EC..02FF, U+0374, U+037E ...) +\& \ep{Script_Extensions: Copt} \ep{Script_Extensions=Coptic} (165) +\& \ep{Script_Extensions: Coptic} (Short: \ep{Scx=Copt}, \ep{Copt}) +\& (165: U+03E2..03EF, U+2C80..2CF3, +\& U+2CF9..2CFF, U+102E0..102FB) +\& \ep{Script_Extensions: Cprt} \ep{Script_Extensions=Cypriot} (112) +\& \ep{Script_Extensions: Cuneiform} (Short: \ep{Scx=Xsux}, \ep{Xsux}) +\& (1234: U+12000..12399, U+12400..1246E, +\& U+12470..12474, U+12480..12543) +\& \ep{Script_Extensions: Cypriot} (Short: \ep{Scx=Cprt}, \ep{Cprt}) +\& (112: U+10100..10102, U+10107..10133, +\& U+10137..1013F, U+10800..10805, U+10808, +\& U+1080A..10835 ...) +\& \ep{Script_Extensions: Cyrillic} (Short: \ep{Scx=Cyrl}, \ep{Cyrl}) +\& (447: U+0400..052F, U+1C80..1C88, +\& U+1D2B, U+1D78, U+1DF8, U+2DE0..2DFF ...) +\& \ep{Script_Extensions: Cyrl} \ep{Script_Extensions=Cyrillic} (447) +\& \ep{Script_Extensions: Deseret} (Short: \ep{Scx=Dsrt}, \ep{Dsrt}) +\& (80: U+10400..1044F) +\& \ep{Script_Extensions: Deva} \ep{Script_Extensions=Devanagari} (210) +\& \ep{Script_Extensions: Devanagari} (Short: \ep{Scx=Deva}, \ep{Deva}) +\& (210: U+0900..0952, U+0955..097F, +\& U+1CD0..1CF6, U+1CF8..1CF9, U+20F0, +\& U+A830..A839 ...) +\& \ep{Script_Extensions: Diak} \ep{Script_Extensions=Dives_Akuru} (72) +\& \ep{Script_Extensions: Dives_Akuru} (Short: \ep{Scx=Diak}, \ep{Diak}) +\& (72: U+11900..11906, U+11909, +\& U+1190C..11913, U+11915..11916, +\& U+11918..11935, U+11937..11938 ...) +\& \ep{Script_Extensions: Dogr} \ep{Script_Extensions=Dogra} (82) +\& \ep{Script_Extensions: Dogra} (Short: \ep{Scx=Dogr}, \ep{Dogr}) (82: +\& U+0964..096F, U+A830..A839, +\& U+11800..1183B) +\& \ep{Script_Extensions: Dsrt} \ep{Script_Extensions=Deseret} (80) +\& \ep{Script_Extensions: Dupl} \ep{Script_Extensions=Duployan} (147) +\& \ep{Script_Extensions: Duployan} (Short: \ep{Scx=Dupl}, \ep{Dupl}) +\& (147: U+1BC00..1BC6A, U+1BC70..1BC7C, +\& U+1BC80..1BC88, U+1BC90..1BC99, +\& U+1BC9C..1BCA3) +\& \ep{Script_Extensions: Egyp} \ep{Script_Extensions= +\& Egyptian_Hieroglyphs} (1080) +\& \ep{Script_Extensions: Egyptian_Hieroglyphs} (Short: \ep{Scx=Egyp}, +\& \ep{Egyp}) (1080: U+13000..1342E, +\& U+13430..13438) +\& \ep{Script_Extensions: Elba} \ep{Script_Extensions=Elbasan} (40) +\& \ep{Script_Extensions: Elbasan} (Short: \ep{Scx=Elba}, \ep{Elba}) +\& (40: U+10500..10527) +\& \ep{Script_Extensions: Elym} \ep{Script_Extensions=Elymaic} (23) +\& \ep{Script_Extensions: Elymaic} (Short: \ep{Scx=Elym}, \ep{Elym}) +\& (23: U+10FE0..10FF6) +\& \ep{Script_Extensions: Ethi} \ep{Script_Extensions=Ethiopic} (495) +\& \ep{Script_Extensions: Ethiopic} (Short: \ep{Scx=Ethi}, \ep{Ethi}) +\& (495: U+1200..1248, U+124A..124D, +\& U+1250..1256, U+1258, U+125A..125D, +\& U+1260..1288 ...) +\& \ep{Script_Extensions: Geor} \ep{Script_Extensions=Georgian} (174) +\& \ep{Script_Extensions: Georgian} (Short: \ep{Scx=Geor}, \ep{Geor}) +\& (174: U+10A0..10C5, U+10C7, U+10CD, +\& U+10D0..10FF, U+1C90..1CBA, U+1CBD..1CBF +\& ...) +\& \ep{Script_Extensions: Glag} \ep{Script_Extensions=Glagolitic} (136) +\& \ep{Script_Extensions: Glagolitic} (Short: \ep{Scx=Glag}, \ep{Glag}) +\& (136: U+0484, U+0487, U+2C00..2C2E, +\& U+2C30..2C5E, U+2E43, U+A66F ...) +\& \ep{Script_Extensions: Gong} \ep{Script_Extensions=Gunjala_Gondi} +\& (65) +\& \ep{Script_Extensions: Gonm} \ep{Script_Extensions=Masaram_Gondi} +\& (77) +\& \ep{Script_Extensions: Goth} \ep{Script_Extensions=Gothic} (27) +\& \ep{Script_Extensions: Gothic} (Short: \ep{Scx=Goth}, \ep{Goth}) (27: +\& U+10330..1034A) +\& \ep{Script_Extensions: Gran} \ep{Script_Extensions=Grantha} (116) +\& \ep{Script_Extensions: Grantha} (Short: \ep{Scx=Gran}, \ep{Gran}) +\& (116: U+0951..0952, U+0964..0965, +\& U+0BE6..0BF3, U+1CD0, U+1CD2..1CD3, +\& U+1CF2..1CF4 ...) +\& \ep{Script_Extensions: Greek} (Short: \ep{Scx=Grek}, \ep{Grek}) (522: +\& U+0342, U+0345, U+0370..0373, +\& U+0375..0377, U+037A..037D, U+037F ...) +\& \ep{Script_Extensions: Grek} \ep{Script_Extensions=Greek} (522) +\& \ep{Script_Extensions: Gujarati} (Short: \ep{Scx=Gujr}, \ep{Gujr}) +\& (105: U+0951..0952, U+0964..0965, +\& U+0A81..0A83, U+0A85..0A8D, +\& U+0A8F..0A91, U+0A93..0AA8 ...) +\& \ep{Script_Extensions: Gujr} \ep{Script_Extensions=Gujarati} (105) +\& \ep{Script_Extensions: Gunjala_Gondi} (Short: \ep{Scx=Gong}, +\& \ep{Gong}) (65: U+0964..0965, +\& U+11D60..11D65, U+11D67..11D68, +\& U+11D6A..11D8E, U+11D90..11D91, +\& U+11D93..11D98 ...) +\& \ep{Script_Extensions: Gurmukhi} (Short: \ep{Scx=Guru}, \ep{Guru}) +\& (94: U+0951..0952, U+0964..0965, +\& U+0A01..0A03, U+0A05..0A0A, +\& U+0A0F..0A10, U+0A13..0A28 ...) +\& \ep{Script_Extensions: Guru} \ep{Script_Extensions=Gurmukhi} (94) +\& \ep{Script_Extensions: Han} (Short: \ep{Scx=Han}, \ep{Han}) (94_492: +\& U+2E80..2E99, U+2E9B..2EF3, +\& U+2F00..2FD5, U+3001..3003, +\& U+3005..3011, U+3013..301F ...) +\& \ep{Script_Extensions: Hang} \ep{Script_Extensions=Hangul} (11_775) +\& \ep{Script_Extensions: Hangul} (Short: \ep{Scx=Hang}, \ep{Hang}) +\& (11_775: U+1100..11FF, U+3001..3003, +\& U+3008..3011, U+3013..301F, +\& U+302E..3030, U+3037 ...) +\& \ep{Script_Extensions: Hani} \ep{Script_Extensions=Han} (94_492) +\& \ep{Script_Extensions: Hanifi_Rohingya} (Short: \ep{Scx=Rohg}, +\& \ep{Rohg}) (55: U+060C, U+061B, U+061F, +\& U+0640, U+06D4, U+10D00..10D27 ...) +\& \ep{Script_Extensions: Hano} \ep{Script_Extensions=Hanunoo} (23) +\& \ep{Script_Extensions: Hanunoo} (Short: \ep{Scx=Hano}, \ep{Hano}) +\& (23: U+1720..1736) +\& \ep{Script_Extensions: Hatr} \ep{Script_Extensions=Hatran} (26) +\& \ep{Script_Extensions: Hatran} (Short: \ep{Scx=Hatr}, \ep{Hatr}) (26: +\& U+108E0..108F2, U+108F4..108F5, +\& U+108FB..108FF) +\& \ep{Script_Extensions: Hebr} \ep{Script_Extensions=Hebrew} (134) +\& \ep{Script_Extensions: Hebrew} (Short: \ep{Scx=Hebr}, \ep{Hebr}) +\& (134: U+0591..05C7, U+05D0..05EA, +\& U+05EF..05F4, U+FB1D..FB36, +\& U+FB38..FB3C, U+FB3E ...) +\& \ep{Script_Extensions: Hira} \ep{Script_Extensions=Hiragana} (431) +\& \ep{Script_Extensions: Hiragana} (Short: \ep{Scx=Hira}, \ep{Hira}) +\& (431: U+3001..3003, U+3008..3011, +\& U+3013..301F, U+3030..3035, U+3037, +\& U+303C..303D ...) +\& \ep{Script_Extensions: Hluw} \ep{Script_Extensions= +\& Anatolian_Hieroglyphs} (583) +\& \ep{Script_Extensions: Hmng} \ep{Script_Extensions=Pahawh_Hmong} +\& (127) +\& \ep{Script_Extensions: Hmnp} \ep{Script_Extensions= +\& Nyiakeng_Puachue_Hmong} (71) +\& \ep{Script_Extensions: Hung} \ep{Script_Extensions=Old_Hungarian} +\& (108) +\& \ep{Script_Extensions: Imperial_Aramaic} (Short: \ep{Scx=Armi}, +\& \ep{Armi}) (31: U+10840..10855, +\& U+10857..1085F) +\& \ep{Script_Extensions: Inherited} (Short: \ep{Scx=Zinh}, \ep{Zinh}) +\& (503: U+0300..0341, U+0343..0344, +\& U+0346..0362, U+0953..0954, +\& U+1AB0..1AC0, U+1DC2..1DF7 ...) +\& \ep{Script_Extensions: Inscriptional_Pahlavi} (Short: \ep{Scx=Phli}, +\& \ep{Phli}) (27: U+10B60..10B72, +\& U+10B78..10B7F) +\& \ep{Script_Extensions: Inscriptional_Parthian} (Short: \ep{Scx= +\& Prti}, \ep{Prti}) (30: U+10B40..10B55, +\& U+10B58..10B5F) +\& \ep{Script_Extensions: Ital} \ep{Script_Extensions=Old_Italic} (39) +\& \ep{Script_Extensions: Java} \ep{Script_Extensions=Javanese} (91) +\& \ep{Script_Extensions: Javanese} (Short: \ep{Scx=Java}, \ep{Java}) +\& (91: U+A980..A9CD, U+A9CF..A9D9, +\& U+A9DE..A9DF) +\& \ep{Script_Extensions: Kaithi} (Short: \ep{Scx=Kthi}, \ep{Kthi}) (87: +\& U+0966..096F, U+A830..A839, +\& U+11080..110C1, U+110CD) +\& \ep{Script_Extensions: Kali} \ep{Script_Extensions=Kayah_Li} (48) +\& \ep{Script_Extensions: Kana} \ep{Script_Extensions=Katakana} (356) +\& \ep{Script_Extensions: Kannada} (Short: \ep{Scx=Knda}, \ep{Knda}) +\& (104: U+0951..0952, U+0964..0965, +\& U+0C80..0C8C, U+0C8E..0C90, +\& U+0C92..0CA8, U+0CAA..0CB3 ...) +\& \ep{Script_Extensions: Katakana} (Short: \ep{Scx=Kana}, \ep{Kana}) +\& (356: U+3001..3003, U+3008..3011, +\& U+3013..301F, U+3030..3035, U+3037, +\& U+303C..303D ...) +\& \ep{Script_Extensions: Kayah_Li} (Short: \ep{Scx=Kali}, \ep{Kali}) +\& (48: U+A900..A92F) +\& \ep{Script_Extensions: Khar} \ep{Script_Extensions=Kharoshthi} (68) +\& \ep{Script_Extensions: Kharoshthi} (Short: \ep{Scx=Khar}, \ep{Khar}) +\& (68: U+10A00..10A03, U+10A05..10A06, +\& U+10A0C..10A13, U+10A15..10A17, +\& U+10A19..10A35, U+10A38..10A3A ...) +\& \ep{Script_Extensions: Khitan_Small_Script} (Short: \ep{Scx=Kits}, +\& \ep{Kits}) (471: U+16FE4, U+18B00..18CD5) +\& \ep{Script_Extensions: Khmer} (Short: \ep{Scx=Khmr}, \ep{Khmr}) (146: +\& U+1780..17DD, U+17E0..17E9, +\& U+17F0..17F9, U+19E0..19FF) +\& \ep{Script_Extensions: Khmr} \ep{Script_Extensions=Khmer} (146) +\& \ep{Script_Extensions: Khoj} \ep{Script_Extensions=Khojki} (82) +\& \ep{Script_Extensions: Khojki} (Short: \ep{Scx=Khoj}, \ep{Khoj}) (82: +\& U+0AE6..0AEF, U+A830..A839, +\& U+11200..11211, U+11213..1123E) +\& \ep{Script_Extensions: Khudawadi} (Short: \ep{Scx=Sind}, \ep{Sind}) +\& (81: U+0964..0965, U+A830..A839, +\& U+112B0..112EA, U+112F0..112F9) +\& \ep{Script_Extensions: Kits} \ep{Script_Extensions= +\& Khitan_Small_Script} (471) +\& \ep{Script_Extensions: Knda} \ep{Script_Extensions=Kannada} (104) +\& \ep{Script_Extensions: Kthi} \ep{Script_Extensions=Kaithi} (87) +\& \ep{Script_Extensions: Lana} \ep{Script_Extensions=Tai_Tham} (127) +\& \ep{Script_Extensions: Lao} (Short: \ep{Scx=Lao}, \ep{Lao}) (82: +\& U+0E81..0E82, U+0E84, U+0E86..0E8A, +\& U+0E8C..0EA3, U+0EA5, U+0EA7..0EBD ...) +\& \ep{Script_Extensions: Laoo} \ep{Script_Extensions=Lao} (82) +\& \ep{Script_Extensions: Latin} (Short: \ep{Scx=Latn}, \ep{Latn}) +\& (1403: [A\-Za\-z\exaa\exba\exc0\-\exd6\exd8\- +\& \exf6\exf8\-\exff], U+0100..02B8, +\& U+02E0..02E4, U+0363..036F, +\& U+0485..0486, U+0951..0952 ...) +\& \ep{Script_Extensions: Latn} \ep{Script_Extensions=Latin} (1403) +\& \ep{Script_Extensions: Lepc} \ep{Script_Extensions=Lepcha} (74) +\& \ep{Script_Extensions: Lepcha} (Short: \ep{Scx=Lepc}, \ep{Lepc}) (74: +\& U+1C00..1C37, U+1C3B..1C49, U+1C4D..1C4F) +\& \ep{Script_Extensions: Limb} \ep{Script_Extensions=Limbu} (69) +\& \ep{Script_Extensions: Limbu} (Short: \ep{Scx=Limb}, \ep{Limb}) (69: +\& U+0965, U+1900..191E, U+1920..192B, +\& U+1930..193B, U+1940, U+1944..194F) +\& \ep{Script_Extensions: Lina} \ep{Script_Extensions=Linear_A} (386) +\& \ep{Script_Extensions: Linb} \ep{Script_Extensions=Linear_B} (268) +\& \ep{Script_Extensions: Linear_A} (Short: \ep{Scx=Lina}, \ep{Lina}) +\& (386: U+10107..10133, U+10600..10736, +\& U+10740..10755, U+10760..10767) +\& \ep{Script_Extensions: Linear_B} (Short: \ep{Scx=Linb}, \ep{Linb}) +\& (268: U+10000..1000B, U+1000D..10026, +\& U+10028..1003A, U+1003C..1003D, +\& U+1003F..1004D, U+10050..1005D ...) +\& \ep{Script_Extensions: Lisu} (Short: \ep{Scx=Lisu}, \ep{Lisu}) (49: +\& U+A4D0..A4FF, U+11FB0) +\& \ep{Script_Extensions: Lyci} \ep{Script_Extensions=Lycian} (29) +\& \ep{Script_Extensions: Lycian} (Short: \ep{Scx=Lyci}, \ep{Lyci}) (29: +\& U+10280..1029C) +\& \ep{Script_Extensions: Lydi} \ep{Script_Extensions=Lydian} (27) +\& \ep{Script_Extensions: Lydian} (Short: \ep{Scx=Lydi}, \ep{Lydi}) (27: +\& U+10920..10939, U+1093F) +\& \ep{Script_Extensions: Mahajani} (Short: \ep{Scx=Mahj}, \ep{Mahj}) +\& (61: U+0964..096F, U+A830..A839, +\& U+11150..11176) +\& \ep{Script_Extensions: Mahj} \ep{Script_Extensions=Mahajani} (61) +\& \ep{Script_Extensions: Maka} \ep{Script_Extensions=Makasar} (25) +\& \ep{Script_Extensions: Makasar} (Short: \ep{Scx=Maka}, \ep{Maka}) +\& (25: U+11EE0..11EF8) +\& \ep{Script_Extensions: Malayalam} (Short: \ep{Scx=Mlym}, \ep{Mlym}) +\& (126: U+0951..0952, U+0964..0965, +\& U+0D00..0D0C, U+0D0E..0D10, +\& U+0D12..0D44, U+0D46..0D48 ...) +\& \ep{Script_Extensions: Mand} \ep{Script_Extensions=Mandaic} (30) +\& \ep{Script_Extensions: Mandaic} (Short: \ep{Scx=Mand}, \ep{Mand}) +\& (30: U+0640, U+0840..085B, U+085E) +\& \ep{Script_Extensions: Mani} \ep{Script_Extensions=Manichaean} (52) +\& \ep{Script_Extensions: Manichaean} (Short: \ep{Scx=Mani}, \ep{Mani}) +\& (52: U+0640, U+10AC0..10AE6, +\& U+10AEB..10AF6) +\& \ep{Script_Extensions: Marc} \ep{Script_Extensions=Marchen} (68) +\& \ep{Script_Extensions: Marchen} (Short: \ep{Scx=Marc}, \ep{Marc}) +\& (68: U+11C70..11C8F, U+11C92..11CA7, +\& U+11CA9..11CB6) +\& \ep{Script_Extensions: Masaram_Gondi} (Short: \ep{Scx=Gonm}, +\& \ep{Gonm}) (77: U+0964..0965, +\& U+11D00..11D06, U+11D08..11D09, +\& U+11D0B..11D36, U+11D3A, U+11D3C..11D3D +\& ...) +\& \ep{Script_Extensions: Medefaidrin} (Short: \ep{Scx=Medf}, \ep{Medf}) +\& (91: U+16E40..16E9A) +\& \ep{Script_Extensions: Medf} \ep{Script_Extensions=Medefaidrin} (91) +\& \ep{Script_Extensions: Meetei_Mayek} (Short: \ep{Scx=Mtei}, +\& \ep{Mtei}) (79: U+AAE0..AAF6, +\& U+ABC0..ABED, U+ABF0..ABF9) +\& \ep{Script_Extensions: Mend} \ep{Script_Extensions=Mende_Kikakui} +\& (213) +\& \ep{Script_Extensions: Mende_Kikakui} (Short: \ep{Scx=Mend}, +\& \ep{Mend}) (213: U+1E800..1E8C4, +\& U+1E8C7..1E8D6) +\& \ep{Script_Extensions: Merc} \ep{Script_Extensions=Meroitic_Cursive} +\& (90) +\& \ep{Script_Extensions: Mero} \ep{Script_Extensions= +\& Meroitic_Hieroglyphs} (32) +\& \ep{Script_Extensions: Meroitic_Cursive} (Short: \ep{Scx=Merc}, +\& \ep{Merc}) (90: U+109A0..109B7, +\& U+109BC..109CF, U+109D2..109FF) +\& \ep{Script_Extensions: Meroitic_Hieroglyphs} (Short: \ep{Scx=Mero}, +\& \ep{Mero}) (32: U+10980..1099F) +\& \ep{Script_Extensions: Miao} (Short: \ep{Scx=Miao}, \ep{Miao}) (149: +\& U+16F00..16F4A, U+16F4F..16F87, +\& U+16F8F..16F9F) +\& \ep{Script_Extensions: Mlym} \ep{Script_Extensions=Malayalam} (126) +\& \ep{Script_Extensions: Modi} (Short: \ep{Scx=Modi}, \ep{Modi}) (89: +\& U+A830..A839, U+11600..11644, +\& U+11650..11659) +\& \ep{Script_Extensions: Mong} \ep{Script_Extensions=Mongolian} (171) +\& \ep{Script_Extensions: Mongolian} (Short: \ep{Scx=Mong}, \ep{Mong}) +\& (171: U+1800..180E, U+1810..1819, +\& U+1820..1878, U+1880..18AA, U+202F, +\& U+11660..1166C) +\& \ep{Script_Extensions: Mro} (Short: \ep{Scx=Mro}, \ep{Mro}) (43: +\& U+16A40..16A5E, U+16A60..16A69, +\& U+16A6E..16A6F) +\& \ep{Script_Extensions: Mroo} \ep{Script_Extensions=Mro} (43) +\& \ep{Script_Extensions: Mtei} \ep{Script_Extensions=Meetei_Mayek} (79) +\& \ep{Script_Extensions: Mult} \ep{Script_Extensions=Multani} (48) +\& \ep{Script_Extensions: Multani} (Short: \ep{Scx=Mult}, \ep{Mult}) +\& (48: U+0A66..0A6F, U+11280..11286, +\& U+11288, U+1128A..1128D, U+1128F..1129D, +\& U+1129F..112A9) +\& \ep{Script_Extensions: Myanmar} (Short: \ep{Scx=Mymr}, \ep{Mymr}) +\& (224: U+1000..109F, U+A92E, +\& U+A9E0..A9FE, U+AA60..AA7F) +\& \ep{Script_Extensions: Mymr} \ep{Script_Extensions=Myanmar} (224) +\& \ep{Script_Extensions: Nabataean} (Short: \ep{Scx=Nbat}, \ep{Nbat}) +\& (40: U+10880..1089E, U+108A7..108AF) +\& \ep{Script_Extensions: Nand} \ep{Script_Extensions=Nandinagari} (86) +\& \ep{Script_Extensions: Nandinagari} (Short: \ep{Scx=Nand}, \ep{Nand}) +\& (86: U+0964..0965, U+0CE6..0CEF, U+1CE9, +\& U+1CF2, U+1CFA, U+A830..A835 ...) +\& \ep{Script_Extensions: Narb} \ep{Script_Extensions= +\& Old_North_Arabian} (32) +\& \ep{Script_Extensions: Nbat} \ep{Script_Extensions=Nabataean} (40) +\& \ep{Script_Extensions: New_Tai_Lue} (Short: \ep{Scx=Talu}, \ep{Talu}) +\& (83: U+1980..19AB, U+19B0..19C9, +\& U+19D0..19DA, U+19DE..19DF) +\& \ep{Script_Extensions: Newa} (Short: \ep{Scx=Newa}, \ep{Newa}) (97: +\& U+11400..1145B, U+1145D..11461) +\& \ep{Script_Extensions: Nko} (Short: \ep{Scx=Nko}, \ep{Nko}) (62: +\& U+07C0..07FA, U+07FD..07FF) +\& \ep{Script_Extensions: Nkoo} \ep{Script_Extensions=Nko} (62) +\& \ep{Script_Extensions: Nshu} \ep{Script_Extensions=Nushu} (397) +\& \ep{Script_Extensions: Nushu} (Short: \ep{Scx=Nshu}, \ep{Nshu}) (397: +\& U+16FE1, U+1B170..1B2FB) +\& \ep{Script_Extensions: Nyiakeng_Puachue_Hmong} (Short: \ep{Scx= +\& Hmnp}, \ep{Hmnp}) (71: U+1E100..1E12C, +\& U+1E130..1E13D, U+1E140..1E149, +\& U+1E14E..1E14F) +\& \ep{Script_Extensions: Ogam} \ep{Script_Extensions=Ogham} (29) +\& \ep{Script_Extensions: Ogham} (Short: \ep{Scx=Ogam}, \ep{Ogam}) (29: +\& U+1680..169C) +\& \ep{Script_Extensions: Ol_Chiki} (Short: \ep{Scx=Olck}, \ep{Olck}) +\& (48: U+1C50..1C7F) +\& \ep{Script_Extensions: Olck} \ep{Script_Extensions=Ol_Chiki} (48) +\& \ep{Script_Extensions: Old_Hungarian} (Short: \ep{Scx=Hung}, +\& \ep{Hung}) (108: U+10C80..10CB2, +\& U+10CC0..10CF2, U+10CFA..10CFF) +\& \ep{Script_Extensions: Old_Italic} (Short: \ep{Scx=Ital}, \ep{Ital}) +\& (39: U+10300..10323, U+1032D..1032F) +\& \ep{Script_Extensions: Old_North_Arabian} (Short: \ep{Scx=Narb}, +\& \ep{Narb}) (32: U+10A80..10A9F) +\& \ep{Script_Extensions: Old_Permic} (Short: \ep{Scx=Perm}, \ep{Perm}) +\& (44: U+0483, U+10350..1037A) +\& \ep{Script_Extensions: Old_Persian} (Short: \ep{Scx=Xpeo}, \ep{Xpeo}) +\& (50: U+103A0..103C3, U+103C8..103D5) +\& \ep{Script_Extensions: Old_Sogdian} (Short: \ep{Scx=Sogo}, \ep{Sogo}) +\& (40: U+10F00..10F27) +\& \ep{Script_Extensions: Old_South_Arabian} (Short: \ep{Scx=Sarb}, +\& \ep{Sarb}) (32: U+10A60..10A7F) +\& \ep{Script_Extensions: Old_Turkic} (Short: \ep{Scx=Orkh}, \ep{Orkh}) +\& (73: U+10C00..10C48) +\& \ep{Script_Extensions: Oriya} (Short: \ep{Scx=Orya}, \ep{Orya}) (97: +\& U+0951..0952, U+0964..0965, +\& U+0B01..0B03, U+0B05..0B0C, +\& U+0B0F..0B10, U+0B13..0B28 ...) +\& \ep{Script_Extensions: Orkh} \ep{Script_Extensions=Old_Turkic} (73) +\& \ep{Script_Extensions: Orya} \ep{Script_Extensions=Oriya} (97) +\& \ep{Script_Extensions: Osage} (Short: \ep{Scx=Osge}, \ep{Osge}) (72: +\& U+104B0..104D3, U+104D8..104FB) +\& \ep{Script_Extensions: Osge} \ep{Script_Extensions=Osage} (72) +\& \ep{Script_Extensions: Osma} \ep{Script_Extensions=Osmanya} (40) +\& \ep{Script_Extensions: Osmanya} (Short: \ep{Scx=Osma}, \ep{Osma}) +\& (40: U+10480..1049D, U+104A0..104A9) +\& \ep{Script_Extensions: Pahawh_Hmong} (Short: \ep{Scx=Hmng}, +\& \ep{Hmng}) (127: U+16B00..16B45, +\& U+16B50..16B59, U+16B5B..16B61, +\& U+16B63..16B77, U+16B7D..16B8F) +\& \ep{Script_Extensions: Palm} \ep{Script_Extensions=Palmyrene} (32) +\& \ep{Script_Extensions: Palmyrene} (Short: \ep{Scx=Palm}, \ep{Palm}) +\& (32: U+10860..1087F) +\& \ep{Script_Extensions: Pau_Cin_Hau} (Short: \ep{Scx=Pauc}, \ep{Pauc}) +\& (57: U+11AC0..11AF8) +\& \ep{Script_Extensions: Pauc} \ep{Script_Extensions=Pau_Cin_Hau} (57) +\& \ep{Script_Extensions: Perm} \ep{Script_Extensions=Old_Permic} (44) +\& \ep{Script_Extensions: Phag} \ep{Script_Extensions=Phags_Pa} (59) +\& \ep{Script_Extensions: Phags_Pa} (Short: \ep{Scx=Phag}, \ep{Phag}) +\& (59: U+1802..1803, U+1805, U+A840..A877) +\& \ep{Script_Extensions: Phli} \ep{Script_Extensions= +\& Inscriptional_Pahlavi} (27) +\& \ep{Script_Extensions: Phlp} \ep{Script_Extensions=Psalter_Pahlavi} +\& (30) +\& \ep{Script_Extensions: Phnx} \ep{Script_Extensions=Phoenician} (29) +\& \ep{Script_Extensions: Phoenician} (Short: \ep{Scx=Phnx}, \ep{Phnx}) +\& (29: U+10900..1091B, U+1091F) +\& \ep{Script_Extensions: Plrd} \ep{Script_Extensions=Miao} (149) +\& \ep{Script_Extensions: Prti} \ep{Script_Extensions= +\& Inscriptional_Parthian} (30) +\& \ep{Script_Extensions: Psalter_Pahlavi} (Short: \ep{Scx=Phlp}, +\& \ep{Phlp}) (30: U+0640, U+10B80..10B91, +\& U+10B99..10B9C, U+10BA9..10BAF) +\& \ep{Script_Extensions: Qaac} \ep{Script_Extensions=Coptic} (165) +\& \ep{Script_Extensions: Qaai} \ep{Script_Extensions=Inherited} (503) +\& \ep{Script_Extensions: Rejang} (Short: \ep{Scx=Rjng}, \ep{Rjng}) (37: +\& U+A930..A953, U+A95F) +\& \ep{Script_Extensions: Rjng} \ep{Script_Extensions=Rejang} (37) +\& \ep{Script_Extensions: Rohg} \ep{Script_Extensions=Hanifi_Rohingya} +\& (55) +\& \ep{Script_Extensions: Runic} (Short: \ep{Scx=Runr}, \ep{Runr}) (86: +\& U+16A0..16EA, U+16EE..16F8) +\& \ep{Script_Extensions: Runr} \ep{Script_Extensions=Runic} (86) +\& \ep{Script_Extensions: Samaritan} (Short: \ep{Scx=Samr}, \ep{Samr}) +\& (61: U+0800..082D, U+0830..083E) +\& \ep{Script_Extensions: Samr} \ep{Script_Extensions=Samaritan} (61) +\& \ep{Script_Extensions: Sarb} \ep{Script_Extensions= +\& Old_South_Arabian} (32) +\& \ep{Script_Extensions: Saur} \ep{Script_Extensions=Saurashtra} (82) +\& \ep{Script_Extensions: Saurashtra} (Short: \ep{Scx=Saur}, \ep{Saur}) +\& (82: U+A880..A8C5, U+A8CE..A8D9) +\& \ep{Script_Extensions: Sgnw} \ep{Script_Extensions=SignWriting} (672) +\& \ep{Script_Extensions: Sharada} (Short: \ep{Scx=Shrd}, \ep{Shrd}) +\& (102: U+0951, U+1CD7, U+1CD9, +\& U+1CDC..1CDD, U+1CE0, U+11180..111DF) +\& \ep{Script_Extensions: Shavian} (Short: \ep{Scx=Shaw}, \ep{Shaw}) +\& (48: U+10450..1047F) +\& \ep{Script_Extensions: Shaw} \ep{Script_Extensions=Shavian} (48) +\& \ep{Script_Extensions: Shrd} \ep{Script_Extensions=Sharada} (102) +\& \ep{Script_Extensions: Sidd} \ep{Script_Extensions=Siddham} (92) +\& \ep{Script_Extensions: Siddham} (Short: \ep{Scx=Sidd}, \ep{Sidd}) +\& (92: U+11580..115B5, U+115B8..115DD) +\& \ep{Script_Extensions: SignWriting} (Short: \ep{Scx=Sgnw}, \ep{Sgnw}) +\& (672: U+1D800..1DA8B, U+1DA9B..1DA9F, +\& U+1DAA1..1DAAF) +\& \ep{Script_Extensions: Sind} \ep{Script_Extensions=Khudawadi} (81) +\& \ep{Script_Extensions: Sinh} \ep{Script_Extensions=Sinhala} (113) +\& \ep{Script_Extensions: Sinhala} (Short: \ep{Scx=Sinh}, \ep{Sinh}) +\& (113: U+0964..0965, U+0D81..0D83, +\& U+0D85..0D96, U+0D9A..0DB1, +\& U+0DB3..0DBB, U+0DBD ...) +\& \ep{Script_Extensions: Sogd} \ep{Script_Extensions=Sogdian} (43) +\& \ep{Script_Extensions: Sogdian} (Short: \ep{Scx=Sogd}, \ep{Sogd}) +\& (43: U+0640, U+10F30..10F59) +\& \ep{Script_Extensions: Sogo} \ep{Script_Extensions=Old_Sogdian} (40) +\& \ep{Script_Extensions: Sora} \ep{Script_Extensions=Sora_Sompeng} (35) +\& \ep{Script_Extensions: Sora_Sompeng} (Short: \ep{Scx=Sora}, +\& \ep{Sora}) (35: U+110D0..110E8, +\& U+110F0..110F9) +\& \ep{Script_Extensions: Soyo} \ep{Script_Extensions=Soyombo} (83) +\& \ep{Script_Extensions: Soyombo} (Short: \ep{Scx=Soyo}, \ep{Soyo}) +\& (83: U+11A50..11AA2) +\& \ep{Script_Extensions: Sund} \ep{Script_Extensions=Sundanese} (72) +\& \ep{Script_Extensions: Sundanese} (Short: \ep{Scx=Sund}, \ep{Sund}) +\& (72: U+1B80..1BBF, U+1CC0..1CC7) +\& \ep{Script_Extensions: Sylo} \ep{Script_Extensions=Syloti_Nagri} (57) +\& \ep{Script_Extensions: Syloti_Nagri} (Short: \ep{Scx=Sylo}, +\& \ep{Sylo}) (57: U+0964..0965, +\& U+09E6..09EF, U+A800..A82C) +\& \ep{Script_Extensions: Syrc} \ep{Script_Extensions=Syriac} (106) +\& \ep{Script_Extensions: Syriac} (Short: \ep{Scx=Syrc}, \ep{Syrc}) +\& (106: U+060C, U+061B..061C, U+061F, +\& U+0640, U+064B..0655, U+0670 ...) +\& \ep{Script_Extensions: Tagalog} (Short: \ep{Scx=Tglg}, \ep{Tglg}) +\& (22: U+1700..170C, U+170E..1714, +\& U+1735..1736) +\& \ep{Script_Extensions: Tagb} \ep{Script_Extensions=Tagbanwa} (20) +\& \ep{Script_Extensions: Tagbanwa} (Short: \ep{Scx=Tagb}, \ep{Tagb}) +\& (20: U+1735..1736, U+1760..176C, +\& U+176E..1770, U+1772..1773) +\& \ep{Script_Extensions: Tai_Le} (Short: \ep{Scx=Tale}, \ep{Tale}) (45: +\& U+1040..1049, U+1950..196D, U+1970..1974) +\& \ep{Script_Extensions: Tai_Tham} (Short: \ep{Scx=Lana}, \ep{Lana}) +\& (127: U+1A20..1A5E, U+1A60..1A7C, +\& U+1A7F..1A89, U+1A90..1A99, U+1AA0..1AAD) +\& \ep{Script_Extensions: Tai_Viet} (Short: \ep{Scx=Tavt}, \ep{Tavt}) +\& (72: U+AA80..AAC2, U+AADB..AADF) +\& \ep{Script_Extensions: Takr} \ep{Script_Extensions=Takri} (79) +\& \ep{Script_Extensions: Takri} (Short: \ep{Scx=Takr}, \ep{Takr}) (79: +\& U+0964..0965, U+A830..A839, +\& U+11680..116B8, U+116C0..116C9) +\& \ep{Script_Extensions: Tale} \ep{Script_Extensions=Tai_Le} (45) +\& \ep{Script_Extensions: Talu} \ep{Script_Extensions=New_Tai_Lue} (83) +\& \ep{Script_Extensions: Tamil} (Short: \ep{Scx=Taml}, \ep{Taml}) (133: +\& U+0951..0952, U+0964..0965, +\& U+0B82..0B83, U+0B85..0B8A, +\& U+0B8E..0B90, U+0B92..0B95 ...) +\& \ep{Script_Extensions: Taml} \ep{Script_Extensions=Tamil} (133) +\& \ep{Script_Extensions: Tang} \ep{Script_Extensions=Tangut} (6914) +\& \ep{Script_Extensions: Tangut} (Short: \ep{Scx=Tang}, \ep{Tang}) +\& (6914: U+16FE0, U+17000..187F7, +\& U+18800..18AFF, U+18D00..18D08) +\& \ep{Script_Extensions: Tavt} \ep{Script_Extensions=Tai_Viet} (72) +\& \ep{Script_Extensions: Telu} \ep{Script_Extensions=Telugu} (104) +\& \ep{Script_Extensions: Telugu} (Short: \ep{Scx=Telu}, \ep{Telu}) +\& (104: U+0951..0952, U+0964..0965, +\& U+0C00..0C0C, U+0C0E..0C10, +\& U+0C12..0C28, U+0C2A..0C39 ...) +\& \ep{Script_Extensions: Tfng} \ep{Script_Extensions=Tifinagh} (59) +\& \ep{Script_Extensions: Tglg} \ep{Script_Extensions=Tagalog} (22) +\& \ep{Script_Extensions: Thaa} \ep{Script_Extensions=Thaana} (66) +\& \ep{Script_Extensions: Thaana} (Short: \ep{Scx=Thaa}, \ep{Thaa}) (66: +\& U+060C, U+061B..061C, U+061F, +\& U+0660..0669, U+0780..07B1, U+FDF2 ...) +\& \ep{Script_Extensions: Thai} (Short: \ep{Scx=Thai}, \ep{Thai}) (86: +\& U+0E01..0E3A, U+0E40..0E5B) +\& \ep{Script_Extensions: Tibetan} (Short: \ep{Scx=Tibt}, \ep{Tibt}) +\& (207: U+0F00..0F47, U+0F49..0F6C, +\& U+0F71..0F97, U+0F99..0FBC, +\& U+0FBE..0FCC, U+0FCE..0FD4 ...) +\& \ep{Script_Extensions: Tibt} \ep{Script_Extensions=Tibetan} (207) +\& \ep{Script_Extensions: Tifinagh} (Short: \ep{Scx=Tfng}, \ep{Tfng}) +\& (59: U+2D30..2D67, U+2D6F..2D70, U+2D7F) +\& \ep{Script_Extensions: Tirh} \ep{Script_Extensions=Tirhuta} (97) +\& \ep{Script_Extensions: Tirhuta} (Short: \ep{Scx=Tirh}, \ep{Tirh}) +\& (97: U+0951..0952, U+0964..0965, U+1CF2, +\& U+A830..A839, U+11480..114C7, +\& U+114D0..114D9) +\& \ep{Script_Extensions: Ugar} \ep{Script_Extensions=Ugaritic} (31) +\& \ep{Script_Extensions: Ugaritic} (Short: \ep{Scx=Ugar}, \ep{Ugar}) +\& (31: U+10380..1039D, U+1039F) +\& \ep{Script_Extensions: Unknown} (Short: \ep{Scx=Zzzz}, \ep{Zzzz}) +\& (970_188 plus all above\-Unicode code +\& points: U+0378..0379, U+0380..0383, +\& U+038B, U+038D, U+03A2, U+0530 ...) +\& \ep{Script_Extensions: Vai} (Short: \ep{Scx=Vai}, \ep{Vai}) (300: +\& U+A500..A62B) +\& \ep{Script_Extensions: Vaii} \ep{Script_Extensions=Vai} (300) +\& \ep{Script_Extensions: Wancho} (Short: \ep{Scx=Wcho}, \ep{Wcho}) (59: +\& U+1E2C0..1E2F9, U+1E2FF) +\& \ep{Script_Extensions: Wara} \ep{Script_Extensions=Warang_Citi} (84) +\& \ep{Script_Extensions: Warang_Citi} (Short: \ep{Scx=Wara}, \ep{Wara}) +\& (84: U+118A0..118F2, U+118FF) +\& \ep{Script_Extensions: Wcho} \ep{Script_Extensions=Wancho} (59) +\& \ep{Script_Extensions: Xpeo} \ep{Script_Extensions=Old_Persian} (50) +\& \ep{Script_Extensions: Xsux} \ep{Script_Extensions=Cuneiform} (1234) +\& \ep{Script_Extensions: Yezi} \ep{Script_Extensions=Yezidi} (60) +\& \ep{Script_Extensions: Yezidi} (Short: \ep{Scx=Yezi}, \ep{Yezi}) (60: +\& U+060C, U+061B, U+061F, U+0660..0669, +\& U+10E80..10EA9, U+10EAB..10EAD ...) +\& \ep{Script_Extensions: Yi} (Short: \ep{Scx=Yi}, \ep{Yi}) (1246: +\& U+3001..3002, U+3008..3011, +\& U+3014..301B, U+30FB, U+A000..A48C, +\& U+A490..A4C6 ...) +\& \ep{Script_Extensions: Yiii} \ep{Script_Extensions=Yi} (1246) +\& \ep{Script_Extensions: Zanabazar_Square} (Short: \ep{Scx=Zanb}, +\& \ep{Zanb}) (72: U+11A00..11A47) +\& \ep{Script_Extensions: Zanb} \ep{Script_Extensions=Zanabazar_Square} +\& (72) +\& \ep{Script_Extensions: Zinh} \ep{Script_Extensions=Inherited} (503) +\& \ep{Script_Extensions: Zyyy} \ep{Script_Extensions=Common} (7661) +\& \ep{Script_Extensions: Zzzz} \ep{Script_Extensions=Unknown} (970_188 +\& plus all above\-Unicode code points) +\& \ep{Scx: *} \ep{Script_Extensions: *} +\& \ep{SD} \ep{Soft_Dotted} (= \ep{Soft_Dotted=Y}) (46) +\& \ep{SD: *} \ep{Soft_Dotted: *} +\& \ep{Sentence_Break: AT} \ep{Sentence_Break=ATerm} (4) +\& \ep{Sentence_Break: ATerm} (Short: \ep{SB=AT}) (4: [.], U+2024, +\& U+FE52, U+FF0E) +\& \ep{Sentence_Break: CL} \ep{Sentence_Break=Close} (187) +\& \ep{Sentence_Break: Close} (Short: \ep{SB=CL}) (187: [\e"\e\*(Aq\e(\e)\e[\e] +\& \e{\e}\exab\exbb], U+0F3A..0F3D, +\& U+169B..169C, U+2018..201F, +\& U+2039..203A, U+2045..2046 ...) +\& \ep{Sentence_Break: CR} (Short: \ep{SB=CR}) (1: [\er]) +\& \ep{Sentence_Break: EX} \ep{Sentence_Break=Extend} (2395) +\& \ep{Sentence_Break: Extend} (Short: \ep{SB=EX}) (2395: U+0300..036F, +\& U+0483..0489, U+0591..05BD, U+05BF, +\& U+05C1..05C2, U+05C4..05C5 ...) +\& \ep{Sentence_Break: FO} \ep{Sentence_Break=Format} (63) +\& \ep{Sentence_Break: Format} (Short: \ep{SB=FO}) (63: [\exad], +\& U+0600..0605, U+061C, U+06DD, U+070F, +\& U+08E2 ...) +\& \ep{Sentence_Break: LE} \ep{Sentence_Break=OLetter} (127_413) +\& \ep{Sentence_Break: LF} (Short: \ep{SB=LF}) (1: [\en]) +\& \ep{Sentence_Break: LO} \ep{Sentence_Break=Lower} (2297) +\& \ep{Sentence_Break: Lower} (Short: \ep{SB=LO}) (2297: [a\-z\exaa\exb5 +\& \exba\exdf\-\exf6\exf8\-\exff], U+0101, U+0103, +\& U+0105, U+0107, U+0109 ...) +\& \ep{Sentence_Break: NU} \ep{Sentence_Break=Numeric} (652) +\& \ep{Sentence_Break: Numeric} (Short: \ep{SB=NU}) (652: [0\-9], +\& U+0660..0669, U+066B..066C, +\& U+06F0..06F9, U+07C0..07C9, U+0966..096F +\& ...) +\& \ep{Sentence_Break: OLetter} (Short: \ep{SB=LE}) (127_413: U+01BB, +\& U+01C0..01C3, U+0294, U+02B9..02BF, +\& U+02C6..02D1, U+02EC ...) +\& \ep{Sentence_Break: Other} (Short: \ep{SB=XX}) (979_014 plus all +\& above\-Unicode code points: [^\et\en\ecK\ef +\& \er\ex20!\e"\e\*(Aq\e(\e),\e\-.0\-9:?A\-Z\e[\e]a\-z\e{\e} +\& \ex85\exa0\exaa\-\exab\exad\exb5\exba\-\exbb\exc0\- +\& \exd6\exd8\-\exf6\exf8\-\exff], U+02C2..02C5, +\& U+02D2..02DF, U+02E5..02EB, U+02ED, +\& U+02EF..02FF ...) +\& \ep{Sentence_Break: SC} \ep{Sentence_Break=SContinue} (26) +\& \ep{Sentence_Break: SContinue} (Short: \ep{SB=SC}) (26: [,\e\-:], +\& U+055D, U+060C..060D, U+07F8, U+1802, +\& U+1808 ...) +\& \ep{Sentence_Break: SE} \ep{Sentence_Break=Sep} (3) +\& \ep{Sentence_Break: Sep} (Short: \ep{SB=SE}) (3: [\ex85], +\& U+2028..2029) +\& \ep{Sentence_Break: Sp} (Short: \ep{SB=Sp}) (20: [\et\ecK\ef\ex20\exa0], +\& U+1680, U+2000..200A, U+202F, U+205F, +\& U+3000) +\& \ep{Sentence_Break: ST} \ep{Sentence_Break=STerm} (140) +\& \ep{Sentence_Break: STerm} (Short: \ep{SB=ST}) (140: [!?], U+0589, +\& U+061E..061F, U+06D4, U+0700..0702, +\& U+07F9 ...) +\& \ep{Sentence_Break: UP} \ep{Sentence_Break=Upper} (1896) +\& \ep{Sentence_Break: Upper} (Short: \ep{SB=UP}) (1896: [A\-Z\exc0\-\exd6 +\& \exd8\-\exde], U+0100, U+0102, U+0104, +\& U+0106, U+0108 ...) +\& \ep{Sentence_Break: XX} \ep{Sentence_Break=Other} (979_014 plus all +\& above\-Unicode code points) +\& \ep{Sentence_Terminal} \ep{Sentence_Terminal=Y} (Short: \ep{STerm}) +\& (143) +\& \ep{Sentence_Terminal: N*} (Short: \ep{STerm=N}, \eP{STerm}) +\& (1_113_969 plus all above\-Unicode code +\& points: [\ex00\-\ex20\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\- +\& \e/0\-9:;<=>\e@A\-Z\e[\e\e\e]\e^_\`a\-z\e{\e|\e}~\ex7f\- +\& \exff], U+0100..0588, U+058A..061D, +\& U+0620..06D3, U+06D5..06FF, U+0703..07F8 +\& ...) +\& \ep{Sentence_Terminal: Y*} (Short: \ep{STerm=Y}, \ep{STerm}) (143: +\& [!.?], U+0589, U+061E..061F, U+06D4, +\& U+0700..0702, U+07F9 ...) +\& \ep{Separator} \ep{General_Category=Separator} (Short: +\& \ep{Z}) (19) +\& \ep{Sgnw} \ep{SignWriting} (= \ep{Script_Extensions= +\& SignWriting}) (672) +\& \ep{Sharada} \ep{Script_Extensions=Sharada} (Short: +\& \ep{Shrd}; NOT \ep{Block=Sharada}) (102) +\& \ep{Shavian} \ep{Script_Extensions=Shavian} (Short: +\& \ep{Shaw}) (48) +\& \ep{Shaw} \ep{Shavian} (= \ep{Script_Extensions= +\& Shavian}) (48) +\& X \ep{Shorthand_Format_Controls} \ep{Block=Shorthand_Format_Controls} +\& (16) +\& \ep{Shrd} \ep{Sharada} (= \ep{Script_Extensions= +\& Sharada}) (NOT \ep{Block=Sharada}) (102) +\& \ep{Sidd} \ep{Siddham} (= \ep{Script_Extensions= +\& Siddham}) (NOT \ep{Block=Siddham}) (92) +\& \ep{Siddham} \ep{Script_Extensions=Siddham} (Short: +\& \ep{Sidd}; NOT \ep{Block=Siddham}) (92) +\& \ep{SignWriting} \ep{Script_Extensions=SignWriting} (Short: +\& \ep{Sgnw}) (672) +\& \ep{Sind} \ep{Khudawadi} (= \ep{Script_Extensions= +\& Khudawadi}) (NOT \ep{Block=Khudawadi}) +\& (81) +\& \ep{Sinh} \ep{Sinhala} (= \ep{Script_Extensions= +\& Sinhala}) (NOT \ep{Block=Sinhala}) (113) +\& \ep{Sinhala} \ep{Script_Extensions=Sinhala} (Short: +\& \ep{Sinh}; NOT \ep{Block=Sinhala}) (113) +\& X \ep{Sinhala_Archaic_Numbers} \ep{Block=Sinhala_Archaic_Numbers} (32) +\& \ep{Sk} \ep{Modifier_Symbol} (= +\& \ep{General_Category=Modifier_Symbol}) +\& (123) +\& \ep{Sm} \ep{Math_Symbol} (= \ep{General_Category= +\& Math_Symbol}) (948) +\& X \ep{Small_Form_Variants} \ep{Block=Small_Form_Variants} (Short: +\& \ep{InSmallForms}) (32) +\& X \ep{Small_Forms} \ep{Small_Form_Variants} (= \ep{Block= +\& Small_Form_Variants}) (32) +\& X \ep{Small_Kana_Ext} \ep{Small_Kana_Extension} (= \ep{Block= +\& Small_Kana_Extension}) (64) +\& X \ep{Small_Kana_Extension} \ep{Block=Small_Kana_Extension} (Short: +\& \ep{InSmallKanaExt}) (64) +\& \ep{So} \ep{Other_Symbol} (= \ep{General_Category= +\& Other_Symbol}) (6431) +\& \ep{Soft_Dotted} \ep{Soft_Dotted=Y} (Short: \ep{SD}) (46) +\& \ep{Soft_Dotted: N*} (Short: \ep{SD=N}, \eP{SD}) (1_114_066 plus +\& all above\-Unicode code points: [\ex00\- +\& \ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<=>?\e@A\- +\& Z\e[\e\e\e]\e^_\`a\-hk\-z\e{\e|\e}~\ex7f\-\exff], +\& U+0100..012E, U+0130..0248, +\& U+024A..0267, U+0269..029C, U+029E..02B1 +\& ...) +\& \ep{Soft_Dotted: Y*} (Short: \ep{SD=Y}, \ep{SD}) (46: [i\-j], +\& U+012F, U+0249, U+0268, U+029D, U+02B2 +\& ...) +\& \ep{Sogd} \ep{Sogdian} (= \ep{Script_Extensions= +\& Sogdian}) (NOT \ep{Block=Sogdian}) (43) +\& \ep{Sogdian} \ep{Script_Extensions=Sogdian} (Short: +\& \ep{Sogd}; NOT \ep{Block=Sogdian}) (43) +\& \ep{Sogo} \ep{Old_Sogdian} (= \ep{Script_Extensions= +\& Old_Sogdian}) (NOT \ep{Block= +\& Old_Sogdian}) (40) +\& \ep{Sora} \ep{Sora_Sompeng} (= \ep{Script_Extensions= +\& Sora_Sompeng}) (NOT \ep{Block= +\& Sora_Sompeng}) (35) +\& \ep{Sora_Sompeng} \ep{Script_Extensions=Sora_Sompeng} (Short: +\& \ep{Sora}; NOT \ep{Block=Sora_Sompeng}) +\& (35) +\& \ep{Soyo} \ep{Soyombo} (= \ep{Script_Extensions= +\& Soyombo}) (NOT \ep{Block=Soyombo}) (83) +\& \ep{Soyombo} \ep{Script_Extensions=Soyombo} (Short: +\& \ep{Soyo}; NOT \ep{Block=Soyombo}) (83) +\& \ep{Space} \ep{White_Space} (= \ep{White_Space=Y}) (25) +\& \ep{Space: *} \ep{White_Space: *} +\& \ep{Space_Separator} \ep{General_Category=Space_Separator} +\& (Short: \ep{Zs}) (17) +\& \ep{SpacePerl} \ep{XPosixSpace} (25) +\& \ep{Spacing_Mark} \ep{General_Category=Spacing_Mark} (Short: +\& \ep{Mc}) (443) +\& X \ep{Spacing_Modifier_Letters} \ep{Block=Spacing_Modifier_Letters} +\& (Short: \ep{InModifierLetters}) (80) +\& X \ep{Specials} \ep{Block=Specials} (16) +\& \ep{STerm} \ep{Sentence_Terminal} (= +\& \ep{Sentence_Terminal=Y}) (143) +\& \ep{STerm: *} \ep{Sentence_Terminal: *} +\& \ep{Sund} \ep{Sundanese} (= \ep{Script_Extensions= +\& Sundanese}) (NOT \ep{Block=Sundanese}) +\& (72) +\& \ep{Sundanese} \ep{Script_Extensions=Sundanese} (Short: +\& \ep{Sund}; NOT \ep{Block=Sundanese}) (72) +\& X \ep{Sundanese_Sup} \ep{Sundanese_Supplement} (= \ep{Block= +\& Sundanese_Supplement}) (16) +\& X \ep{Sundanese_Supplement} \ep{Block=Sundanese_Supplement} (Short: +\& \ep{InSundaneseSup}) (16) +\& X \ep{Sup_Arrows_A} \ep{Supplemental_Arrows_A} (= \ep{Block= +\& Supplemental_Arrows_A}) (16) +\& X \ep{Sup_Arrows_B} \ep{Supplemental_Arrows_B} (= \ep{Block= +\& Supplemental_Arrows_B}) (128) +\& X \ep{Sup_Arrows_C} \ep{Supplemental_Arrows_C} (= \ep{Block= +\& Supplemental_Arrows_C}) (256) +\& X \ep{Sup_Math_Operators} \ep{Supplemental_Mathematical_Operators} (= +\& \ep{Block= +\& Supplemental_Mathematical_Operators}) +\& (256) +\& X \ep{Sup_PUA_A} \ep{Supplementary_Private_Use_Area_A} (= +\& \ep{Block= +\& Supplementary_Private_Use_Area_A}) +\& (65_536) +\& X \ep{Sup_PUA_B} \ep{Supplementary_Private_Use_Area_B} (= +\& \ep{Block= +\& Supplementary_Private_Use_Area_B}) +\& (65_536) +\& X \ep{Sup_Punctuation} \ep{Supplemental_Punctuation} (= \ep{Block= +\& Supplemental_Punctuation}) (128) +\& X \ep{Sup_Symbols_And_Pictographs} +\& \ep{Supplemental_Symbols_And_Pictographs} +\& (= \ep{Block= +\& Supplemental_Symbols_And_Pictographs}) +\& (256) +\& X \ep{Super_And_Sub} \ep{Superscripts_And_Subscripts} (= +\& \ep{Block=Superscripts_And_Subscripts}) +\& (48) +\& X \ep{Superscripts_And_Subscripts} \ep{Block= +\& Superscripts_And_Subscripts} (Short: +\& \ep{InSuperAndSub}) (48) +\& X \ep{Supplemental_Arrows_A} \ep{Block=Supplemental_Arrows_A} (Short: +\& \ep{InSupArrowsA}) (16) +\& X \ep{Supplemental_Arrows_B} \ep{Block=Supplemental_Arrows_B} (Short: +\& \ep{InSupArrowsB}) (128) +\& X \ep{Supplemental_Arrows_C} \ep{Block=Supplemental_Arrows_C} (Short: +\& \ep{InSupArrowsC}) (256) +\& X \ep{Supplemental_Mathematical_Operators} \ep{Block= +\& Supplemental_Mathematical_Operators} +\& (Short: \ep{InSupMathOperators}) (256) +\& X \ep{Supplemental_Punctuation} \ep{Block=Supplemental_Punctuation} +\& (Short: \ep{InSupPunctuation}) (128) +\& X \ep{Supplemental_Symbols_And_Pictographs} \ep{Block= +\& Supplemental_Symbols_And_Pictographs} +\& (Short: \ep{InSupSymbolsAndPictographs}) +\& (256) +\& X \ep{Supplementary_Private_Use_Area_A} \ep{Block= +\& Supplementary_Private_Use_Area_A} +\& (Short: \ep{InSupPUAA}) (65_536) +\& X \ep{Supplementary_Private_Use_Area_B} \ep{Block= +\& Supplementary_Private_Use_Area_B} +\& (Short: \ep{InSupPUAB}) (65_536) +\& \ep{Surrogate} \ep{General_Category=Surrogate} (Short: +\& \ep{Cs}) (2048) +\& X \ep{Sutton_SignWriting} \ep{Block=Sutton_SignWriting} (688) +\& \ep{Sylo} \ep{Syloti_Nagri} (= \ep{Script_Extensions= +\& Syloti_Nagri}) (NOT \ep{Block= +\& Syloti_Nagri}) (57) +\& \ep{Syloti_Nagri} \ep{Script_Extensions=Syloti_Nagri} (Short: +\& \ep{Sylo}; NOT \ep{Block=Syloti_Nagri}) +\& (57) +\& \ep{Symbol} \ep{General_Category=Symbol} (Short: \ep{S}) +\& (7564) +\& X \ep{Symbols_And_Pictographs_Ext_A} +\& \ep{Symbols_And_Pictographs_Extended_A} +\& (= \ep{Block= +\& Symbols_And_Pictographs_Extended_A}) +\& (144) +\& X \ep{Symbols_And_Pictographs_Extended_A} \ep{Block= +\& Symbols_And_Pictographs_Extended_A} (144) +\& X \ep{Symbols_For_Legacy_Computing} \ep{Block= +\& Symbols_For_Legacy_Computing} (256) +\& \ep{Syrc} \ep{Syriac} (= \ep{Script_Extensions= +\& Syriac}) (NOT \ep{Block=Syriac}) (106) +\& \ep{Syriac} \ep{Script_Extensions=Syriac} (Short: +\& \ep{Syrc}; NOT \ep{Block=Syriac}) (106) +\& X \ep{Syriac_Sup} \ep{Syriac_Supplement} (= \ep{Block= +\& Syriac_Supplement}) (16) +\& X \ep{Syriac_Supplement} \ep{Block=Syriac_Supplement} (Short: +\& \ep{InSyriacSup}) (16) +\& \ep{Tagalog} \ep{Script_Extensions=Tagalog} (Short: +\& \ep{Tglg}; NOT \ep{Block=Tagalog}) (22) +\& \ep{Tagb} \ep{Tagbanwa} (= \ep{Script_Extensions= +\& Tagbanwa}) (NOT \ep{Block=Tagbanwa}) (20) +\& \ep{Tagbanwa} \ep{Script_Extensions=Tagbanwa} (Short: +\& \ep{Tagb}; NOT \ep{Block=Tagbanwa}) (20) +\& X \ep{Tags} \ep{Block=Tags} (128) +\& \ep{Tai_Le} \ep{Script_Extensions=Tai_Le} (Short: +\& \ep{Tale}; NOT \ep{Block=Tai_Le}) (45) +\& \ep{Tai_Tham} \ep{Script_Extensions=Tai_Tham} (Short: +\& \ep{Lana}; NOT \ep{Block=Tai_Tham}) (127) +\& \ep{Tai_Viet} \ep{Script_Extensions=Tai_Viet} (Short: +\& \ep{Tavt}; NOT \ep{Block=Tai_Viet}) (72) +\& X \ep{Tai_Xuan_Jing} \ep{Tai_Xuan_Jing_Symbols} (= \ep{Block= +\& Tai_Xuan_Jing_Symbols}) (96) +\& X \ep{Tai_Xuan_Jing_Symbols} \ep{Block=Tai_Xuan_Jing_Symbols} (Short: +\& \ep{InTaiXuanJing}) (96) +\& \ep{Takr} \ep{Takri} (= \ep{Script_Extensions=Takri}) +\& (NOT \ep{Block=Takri}) (79) +\& \ep{Takri} \ep{Script_Extensions=Takri} (Short: +\& \ep{Takr}; NOT \ep{Block=Takri}) (79) +\& \ep{Tale} \ep{Tai_Le} (= \ep{Script_Extensions= +\& Tai_Le}) (NOT \ep{Block=Tai_Le}) (45) +\& \ep{Talu} \ep{New_Tai_Lue} (= \ep{Script_Extensions= +\& New_Tai_Lue}) (NOT \ep{Block= +\& New_Tai_Lue}) (83) +\& \ep{Tamil} \ep{Script_Extensions=Tamil} (Short: +\& \ep{Taml}; NOT \ep{Block=Tamil}) (133) +\& X \ep{Tamil_Sup} \ep{Tamil_Supplement} (= \ep{Block= +\& Tamil_Supplement}) (64) +\& X \ep{Tamil_Supplement} \ep{Block=Tamil_Supplement} (Short: +\& \ep{InTamilSup}) (64) +\& \ep{Taml} \ep{Tamil} (= \ep{Script_Extensions=Tamil}) +\& (NOT \ep{Block=Tamil}) (133) +\& \ep{Tang} \ep{Tangut} (= \ep{Script_Extensions= +\& Tangut}) (NOT \ep{Block=Tangut}) (6914) +\& \ep{Tangut} \ep{Script_Extensions=Tangut} (Short: +\& \ep{Tang}; NOT \ep{Block=Tangut}) (6914) +\& X \ep{Tangut_Components} \ep{Block=Tangut_Components} (768) +\& X \ep{Tangut_Sup} \ep{Tangut_Supplement} (= \ep{Block= +\& Tangut_Supplement}) (144) +\& X \ep{Tangut_Supplement} \ep{Block=Tangut_Supplement} (Short: +\& \ep{InTangutSup}) (144) +\& \ep{Tavt} \ep{Tai_Viet} (= \ep{Script_Extensions= +\& Tai_Viet}) (NOT \ep{Block=Tai_Viet}) (72) +\& \ep{Telu} \ep{Telugu} (= \ep{Script_Extensions= +\& Telugu}) (NOT \ep{Block=Telugu}) (104) +\& \ep{Telugu} \ep{Script_Extensions=Telugu} (Short: +\& \ep{Telu}; NOT \ep{Block=Telugu}) (104) +\& \ep{Term} \ep{Terminal_Punctuation} (= +\& \ep{Terminal_Punctuation=Y}) (267) +\& \ep{Term: *} \ep{Terminal_Punctuation: *} +\& \ep{Terminal_Punctuation} \ep{Terminal_Punctuation=Y} (Short: +\& \ep{Term}) (267) +\& \ep{Terminal_Punctuation: N*} (Short: \ep{Term=N}, \eP{Term}) +\& (1_113_845 plus all above\-Unicode code +\& points: [\ex00\-\ex20\e"#\e$\e%&\e\*(Aq\e(\e)*+\e\-\e/0\- +\& 9<=>\e@A\-Z\e[\e\e\e]\e^_\`a\-z\e{\e|\e}~\ex7f\-\exff], +\& U+0100..037D, U+037F..0386, +\& U+0388..0588, U+058A..05C2, U+05C4..060B +\& ...) +\& \ep{Terminal_Punctuation: Y*} (Short: \ep{Term=Y}, \ep{Term}) (267: +\& [!,.:;?], U+037E, U+0387, U+0589, +\& U+05C3, U+060C ...) +\& \ep{Tfng} \ep{Tifinagh} (= \ep{Script_Extensions= +\& Tifinagh}) (NOT \ep{Block=Tifinagh}) (59) +\& \ep{Tglg} \ep{Tagalog} (= \ep{Script_Extensions= +\& Tagalog}) (NOT \ep{Block=Tagalog}) (22) +\& \ep{Thaa} \ep{Thaana} (= \ep{Script_Extensions= +\& Thaana}) (NOT \ep{Block=Thaana}) (66) +\& \ep{Thaana} \ep{Script_Extensions=Thaana} (Short: +\& \ep{Thaa}; NOT \ep{Block=Thaana}) (66) +\& \ep{Thai} \ep{Script_Extensions=Thai} (NOT \ep{Block= +\& Thai}) (86) +\& \ep{Tibetan} \ep{Script_Extensions=Tibetan} (Short: +\& \ep{Tibt}; NOT \ep{Block=Tibetan}) (207) +\& \ep{Tibt} \ep{Tibetan} (= \ep{Script_Extensions= +\& Tibetan}) (NOT \ep{Block=Tibetan}) (207) +\& \ep{Tifinagh} \ep{Script_Extensions=Tifinagh} (Short: +\& \ep{Tfng}; NOT \ep{Block=Tifinagh}) (59) +\& \ep{Tirh} \ep{Tirhuta} (= \ep{Script_Extensions= +\& Tirhuta}) (NOT \ep{Block=Tirhuta}) (97) +\& \ep{Tirhuta} \ep{Script_Extensions=Tirhuta} (Short: +\& \ep{Tirh}; NOT \ep{Block=Tirhuta}) (97) +\& \ep{Title} \ep{Titlecase} (/i= Cased=Yes) (31) +\& \ep{Titlecase} (= \ep{Gc=Lt}) (Short: \ep{Title}; /i= +\& Cased=Yes) (31: U+01C5, U+01C8, U+01CB, +\& U+01F2, U+1F88..1F8F, U+1F98..1F9F ...) +\& \ep{Titlecase_Letter} \ep{General_Category=Titlecase_Letter} +\& (Short: \ep{Lt}; /i= General_Category= +\& Cased_Letter) (31) +\& X \ep{Transport_And_Map} \ep{Transport_And_Map_Symbols} (= \ep{Block= +\& Transport_And_Map_Symbols}) (128) +\& X \ep{Transport_And_Map_Symbols} \ep{Block=Transport_And_Map_Symbols} +\& (Short: \ep{InTransportAndMap}) (128) +\& X \ep{UCAS} \ep{Unified_Canadian_Aboriginal_Syllabics} +\& (= \ep{Block= +\& Unified_Canadian_Aboriginal_Syllabics}) +\& (640) +\& X \ep{UCAS_Ext} \ep{Unified_Canadian_Aboriginal_Syllabics_\- +\& Extended} (= \ep{Block= +\& Unified_Canadian_Aboriginal_Syllabics_\- +\& Extended}) (80) +\& \ep{Ugar} \ep{Ugaritic} (= \ep{Script_Extensions= +\& Ugaritic}) (NOT \ep{Block=Ugaritic}) (31) +\& \ep{Ugaritic} \ep{Script_Extensions=Ugaritic} (Short: +\& \ep{Ugar}; NOT \ep{Block=Ugaritic}) (31) +\& \ep{UIdeo} \ep{Unified_Ideograph} (= +\& \ep{Unified_Ideograph=Y}) (92_856) +\& \ep{UIdeo: *} \ep{Unified_Ideograph: *} +\& \ep{Unassigned} \ep{General_Category=Unassigned} (Short: +\& \ep{Cn}) (830_672 plus all above\-Unicode +\& code points) +\& \ep{Unicode} \ep{Any} (1_114_112) +\& X \ep{Unified_Canadian_Aboriginal_Syllabics} \ep{Block= +\& Unified_Canadian_Aboriginal_Syllabics} +\& (Short: \ep{InUCAS}) (640) +\& X \ep{Unified_Canadian_Aboriginal_Syllabics_Extended} \ep{Block= +\& Unified_Canadian_Aboriginal_Syllabics_\- +\& Extended} (Short: \ep{InUCASExt}) (80) +\& \ep{Unified_Ideograph} \ep{Unified_Ideograph=Y} (Short: \ep{UIdeo}) +\& (92_856) +\& \ep{Unified_Ideograph: N*} (Short: \ep{UIdeo=N}, \eP{UIdeo}) +\& (1_021_256 plus all above\-Unicode code +\& points: U+0000..33FF, U+4DC0..4DFF, +\& U+9FFD..FA0D, U+FA10, U+FA12, +\& U+FA15..FA1E ...) +\& \ep{Unified_Ideograph: Y*} (Short: \ep{UIdeo=Y}, \ep{UIdeo}) (92_856: +\& U+3400..4DBF, U+4E00..9FFC, +\& U+FA0E..FA0F, U+FA11, U+FA13..FA14, +\& U+FA1F ...) +\& \ep{Unknown} \ep{Script_Extensions=Unknown} (Short: +\& \ep{Zzzz}) (970_188 plus all above\- +\& Unicode code points) +\& \ep{Upper} \ep{XPosixUpper} (= \ep{Uppercase=Y}) (/i= +\& Cased=Yes) (1911) +\& \ep{Upper: *} \ep{Uppercase: *} +\& \ep{Uppercase} \ep{XPosixUpper} (= \ep{Uppercase=Y}) (/i= +\& Cased=Yes) (1911) +\& \ep{Uppercase: N*} (Short: \ep{Upper=N}, \eP{Upper}; /i= Cased= +\& No) (1_112_201 plus all above\-Unicode +\& code points: [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq +\& \e(\e)*+,\e\-.\e/0\-9:;<=>?\e@\e[\e\e\e]\e^_\`a\-z\e{ +\& \e|\e}~\ex7f\-\exbf\exd7\exdf\-\exff], U+0101, +\& U+0103, U+0105, U+0107, U+0109 ...) +\& \ep{Uppercase: Y*} (Short: \ep{Upper=Y}, \ep{Upper}; /i= Cased= +\& Yes) (1911: [A\-Z\exc0\-\exd6\exd8\-\exde], +\& U+0100, U+0102, U+0104, U+0106, U+0108 +\& ...) +\& \ep{Uppercase_Letter} \ep{General_Category=Uppercase_Letter} +\& (Short: \ep{Lu}; /i= General_Category= +\& Cased_Letter) (1791) +\& \ep{Vai} \ep{Script_Extensions=Vai} (NOT \ep{Block= +\& Vai}) (300) +\& \ep{Vaii} \ep{Vai} (= \ep{Script_Extensions=Vai}) (NOT +\& \ep{Block=Vai}) (300) +\& \ep{Variation_Selector} \ep{Variation_Selector=Y} (Short: \ep{VS}; +\& NOT \ep{Variation_Selectors}) (259) +\& \ep{Variation_Selector: N*} (Short: \ep{VS=N}, \eP{VS}) (1_113_853 +\& plus all above\-Unicode code points: +\& U+0000..180A, U+180E..FDFF, +\& U+FE10..E00FF, U+E01F0..infinity) +\& \ep{Variation_Selector: Y*} (Short: \ep{VS=Y}, \ep{VS}) (259: +\& U+180B..180D, U+FE00..FE0F, +\& U+E0100..E01EF) +\& X \ep{Variation_Selectors} \ep{Block=Variation_Selectors} (Short: +\& \ep{InVS}) (16) +\& X \ep{Variation_Selectors_Supplement} \ep{Block= +\& Variation_Selectors_Supplement} (Short: +\& \ep{InVSSup}) (240) +\& X \ep{Vedic_Ext} \ep{Vedic_Extensions} (= \ep{Block= +\& Vedic_Extensions}) (48) +\& X \ep{Vedic_Extensions} \ep{Block=Vedic_Extensions} (Short: +\& \ep{InVedicExt}) (48) +\& X \ep{Vertical_Forms} \ep{Block=Vertical_Forms} (16) +\& \ep{Vertical_Orientation: R} \ep{Vertical_Orientation=Rotated} +\& (786_865 plus all above\-Unicode code +\& points) +\& \ep{Vertical_Orientation: Rotated} (Short: \ep{Vo=R}) (786_865 plus +\& all above\-Unicode code points: [\ex00\- +\& \exa6\exa8\exaa\-\exad\exaf\-\exb0\exb2\-\exbb\exbf\- +\& \exd6\exd8\-\exf6\exf8\-\exff], U+0100..02E9, +\& U+02EC..10FF, U+1200..1400, +\& U+1680..18AF, U+1900..2015 ...) +\& \ep{Vertical_Orientation: Tr} \ep{Vertical_Orientation= +\& Transformed_Rotated} (47) +\& \ep{Vertical_Orientation: Transformed_Rotated} (Short: \ep{Vo=Tr}) +\& (47: U+2329..232A, U+3008..3011, +\& U+3014..301F, U+3030, U+30A0, U+30FC ...) +\& \ep{Vertical_Orientation: Transformed_Upright} (Short: \ep{Vo=Tu}) +\& (148: U+3001..3002, U+3041, U+3043, +\& U+3045, U+3047, U+3049 ...) +\& \ep{Vertical_Orientation: Tu} \ep{Vertical_Orientation= +\& Transformed_Upright} (148) +\& \ep{Vertical_Orientation: U} \ep{Vertical_Orientation=Upright} +\& (327_052) +\& \ep{Vertical_Orientation: Upright} (Short: \ep{Vo=U}) (327_052: +\& [\exa7\exa9\exae\exb1\exbc\-\exbe\exd7\exf7], +\& U+02EA..02EB, U+1100..11FF, +\& U+1401..167F, U+18B0..18FF, U+2016 ...) +\& \ep{VertSpace} \ev (7: [\en\ecK\ef\er\ex85], U+2028..2029) +\& \ep{Vo: *} \ep{Vertical_Orientation: *} +\& \ep{VS} \ep{Variation_Selector} (= +\& \ep{Variation_Selector=Y}) (NOT +\& \ep{Variation_Selectors}) (259) +\& \ep{VS: *} \ep{Variation_Selector: *} +\& X \ep{VS_Sup} \ep{Variation_Selectors_Supplement} (= +\& \ep{Block= +\& Variation_Selectors_Supplement}) (240) +\& \ep{Wancho} \ep{Script_Extensions=Wancho} (Short: +\& \ep{Wcho}; NOT \ep{Block=Wancho}) (59) +\& \ep{Wara} \ep{Warang_Citi} (= \ep{Script_Extensions= +\& Warang_Citi}) (NOT \ep{Block= +\& Warang_Citi}) (84) +\& \ep{Warang_Citi} \ep{Script_Extensions=Warang_Citi} (Short: +\& \ep{Wara}; NOT \ep{Block=Warang_Citi}) (84) +\& \ep{WB: *} \ep{Word_Break: *} +\& \ep{Wcho} \ep{Wancho} (= \ep{Script_Extensions= +\& Wancho}) (NOT \ep{Block=Wancho}) (59) +\& \ep{White_Space} \ep{White_Space=Y} (Short: \ep{Space}) (25) +\& \ep{White_Space: N*} (Short: \ep{Space=N}, \eP{Space}) (1_114_087 +\& plus all above\-Unicode code points: [^ +\& \et\en\ecK\ef\er\ex20\ex85\exa0], U+0100..167F, +\& U+1681..1FFF, U+200B..2027, +\& U+202A..202E, U+2030..205E ...) +\& \ep{White_Space: Y*} (Short: \ep{Space=Y}, \ep{Space}) (25: [\et +\& \en\ecK\ef\er\ex20\ex85\exa0], U+1680, +\& U+2000..200A, U+2028..2029, U+202F, +\& U+205F ...) +\& \ep{Word} \ep{XPosixWord} (134_564) +\& \ep{Word_Break: ALetter} (Short: \ep{WB=LE}) (28_854: [A\-Za\-z\exaa +\& \exb5\exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..02D7, U+02DE..02FF, +\& U+0370..0374, U+0376..0377, U+037A..037D +\& ...) +\& \ep{Word_Break: CR} (Short: \ep{WB=CR}) (1: [\er]) +\& \ep{Word_Break: Double_Quote} (Short: \ep{WB=DQ}) (1: [\e"]) +\& \ep{Word_Break: DQ} \ep{Word_Break=Double_Quote} (1) +\& \ep{Word_Break: E_Base} (Short: \ep{WB=EB}) (0) +\& \ep{Word_Break: E_Base_GAZ} (Short: \ep{WB=EBG}) (0) +\& \ep{Word_Break: E_Modifier} (Short: \ep{WB=EM}) (0) +\& \ep{Word_Break: EB} \ep{Word_Break=E_Base} (0) +\& \ep{Word_Break: EBG} \ep{Word_Break=E_Base_GAZ} (0) +\& \ep{Word_Break: EM} \ep{Word_Break=E_Modifier} (0) +\& \ep{Word_Break: EX} \ep{Word_Break=ExtendNumLet} (11) +\& \ep{Word_Break: Extend} (Short: \ep{WB=Extend}) (2399: +\& U+0300..036F, U+0483..0489, +\& U+0591..05BD, U+05BF, U+05C1..05C2, +\& U+05C4..05C5 ...) +\& \ep{Word_Break: ExtendNumLet} (Short: \ep{WB=EX}) (11: [_], U+202F, +\& U+203F..2040, U+2054, U+FE33..FE34, +\& U+FE4D..FE4F ...) +\& \ep{Word_Break: FO} \ep{Word_Break=Format} (62) +\& \ep{Word_Break: Format} (Short: \ep{WB=FO}) (62: [\exad], +\& U+0600..0605, U+061C, U+06DD, U+070F, +\& U+08E2 ...) +\& \ep{Word_Break: GAZ} \ep{Word_Break=Glue_After_Zwj} (0) +\& \ep{Word_Break: Glue_After_Zwj} (Short: \ep{WB=GAZ}) (0) +\& \ep{Word_Break: Hebrew_Letter} (Short: \ep{WB=HL}) (75: +\& U+05D0..05EA, U+05EF..05F2, U+FB1D, +\& U+FB1F..FB28, U+FB2A..FB36, U+FB38..FB3C +\& ...) +\& \ep{Word_Break: HL} \ep{Word_Break=Hebrew_Letter} (75) +\& \ep{Word_Break: KA} \ep{Word_Break=Katakana} (314) +\& \ep{Word_Break: Katakana} (Short: \ep{WB=KA}) (314: U+3031..3035, +\& U+309B..309C, U+30A0..30FA, +\& U+30FC..30FF, U+31F0..31FF, U+32D0..32FE +\& ...) +\& \ep{Word_Break: LE} \ep{Word_Break=ALetter} (28_854) +\& \ep{Word_Break: LF} (Short: \ep{WB=LF}) (1: [\en]) +\& \ep{Word_Break: MB} \ep{Word_Break=MidNumLet} (7) +\& \ep{Word_Break: MidLetter} (Short: \ep{WB=ML}) (9: [:\exb7], U+0387, +\& U+055F, U+05F4, U+2027, U+FE13 ...) +\& \ep{Word_Break: MidNum} (Short: \ep{WB=MN}) (15: [,;], U+037E, +\& U+0589, U+060C..060D, U+066C, U+07F8 ...) +\& \ep{Word_Break: MidNumLet} (Short: \ep{WB=MB}) (7: [.], +\& U+2018..2019, U+2024, U+FE52, U+FF07, +\& U+FF0E) +\& \ep{Word_Break: ML} \ep{Word_Break=MidLetter} (9) +\& \ep{Word_Break: MN} \ep{Word_Break=MidNum} (15) +\& \ep{Word_Break: Newline} (Short: \ep{WB=NL}) (5: [\ecK\ef\ex85], +\& U+2028..2029) +\& \ep{Word_Break: NL} \ep{Word_Break=Newline} (5) +\& \ep{Word_Break: NU} \ep{Word_Break=Numeric} (651) +\& \ep{Word_Break: Numeric} (Short: \ep{WB=NU}) (651: [0\-9], +\& U+0660..0669, U+066B, U+06F0..06F9, +\& U+07C0..07C9, U+0966..096F ...) +\& \ep{Word_Break: Other} (Short: \ep{WB=XX}) (1_081_665 plus all +\& above\-Unicode code points: [^\en\ecK\ef\er +\& \ex20\e"\e\*(Aq,.0\-9:;A\-Z_a\-z\ex85\exaa\exad\exb5 +\& \exb7\exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+02D8..02DD, U+0375, U+0378..0379, +\& U+0380..0385, U+038B ...) +\& \ep{Word_Break: Regional_Indicator} (Short: \ep{WB=RI}) (26: +\& U+1F1E6..1F1FF) +\& \ep{Word_Break: RI} \ep{Word_Break=Regional_Indicator} (26) +\& \ep{Word_Break: Single_Quote} (Short: \ep{WB=SQ}) (1: [\e\*(Aq]) +\& \ep{Word_Break: SQ} \ep{Word_Break=Single_Quote} (1) +\& \ep{Word_Break: WSegSpace} (Short: \ep{WB=WSegSpace}) (14: [\ex20], +\& U+1680, U+2000..2006, U+2008..200A, +\& U+205F, U+3000) +\& \ep{Word_Break: XX} \ep{Word_Break=Other} (1_081_665 plus all +\& above\-Unicode code points) +\& \ep{Word_Break: ZWJ} (Short: \ep{WB=ZWJ}) (1: U+200D) +\& \ep{WSpace} \ep{White_Space} (= \ep{White_Space=Y}) (25) +\& \ep{WSpace: *} \ep{White_Space: *} +\& \ep{XDigit} \ep{XPosixXDigit} (= \ep{Hex_Digit=Y}) (44) +\& \ep{XID_Continue} \ep{XID_Continue=Y} (Short: \ep{XIDC}) +\& (134_415) +\& \ep{XID_Continue: N*} (Short: \ep{XIDC=N}, \eP{XIDC}) (979_697 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<=>? +\& \e@\e[\e\e\e]\e^\`\e{\e|\e}~\ex7f\-\exa9\exab\-\exb4 +\& \exb6\exb8\-\exb9\exbb\-\exbf\exd7\exf7], +\& U+02C2..02C5, U+02D2..02DF, +\& U+02E5..02EB, U+02ED, U+02EF..02FF ...) +\& \ep{XID_Continue: Y*} (Short: \ep{XIDC=Y}, \ep{XIDC}) (134_415: +\& [0\-9A\-Z_a\-z\exaa\exb5\exb7\exba\exc0\-\exd6 +\& \exd8\-\exf6\exf8\-\exff], U+0100..02C1, +\& U+02C6..02D1, U+02E0..02E4, U+02EC, +\& U+02EE ...) +\& \ep{XID_Start} \ep{XID_Start=Y} (Short: \ep{XIDS}) (131_459) +\& \ep{XID_Start: N*} (Short: \ep{XIDS=N}, \eP{XIDS}) (982_653 +\& plus all above\-Unicode code points: +\& [\ex00\-\ex20!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<= +\& >?\e@\e[\e\e\e]\e^_\`\e{\e|\e}~\ex7f\-\exa9\exab\-\exb4 +\& \exb6\-\exb9\exbb\-\exbf\exd7\exf7], +\& U+02C2..02C5, U+02D2..02DF, +\& U+02E5..02EB, U+02ED, U+02EF..036F ...) +\& \ep{XID_Start: Y*} (Short: \ep{XIDS=Y}, \ep{XIDS}) (131_459: +\& [A\-Za\-z\exaa\exb5\exba\exc0\-\exd6\exd8\-\exf6 +\& \exf8\-\exff], U+0100..02C1, U+02C6..02D1, +\& U+02E0..02E4, U+02EC, U+02EE ...) +\& \ep{XIDC} \ep{XID_Continue} (= \ep{XID_Continue=Y}) +\& (134_415) +\& \ep{XIDC: *} \ep{XID_Continue: *} +\& \ep{XIDS} \ep{XID_Start} (= \ep{XID_Start=Y}) (131_459) +\& \ep{XIDS: *} \ep{XID_Start: *} +\& \ep{Xpeo} \ep{Old_Persian} (= \ep{Script_Extensions= +\& Old_Persian}) (NOT \ep{Block= +\& Old_Persian}) (50) +\& \ep{XPerlSpace} \ep{XPosixSpace} (25) +\& \ep{XPosixAlnum} Alphabetic and (decimal) Numeric (Short: +\& \ep{Alnum}) (133_525: [0\-9A\-Za\-z\exaa\exb5 +\& \exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..02C1, U+02C6..02D1, +\& U+02E0..02E4, U+02EC, U+02EE ...) +\& \ep{XPosixAlpha} \ep{Alphabetic=Y} (Short: \ep{Alpha}) +\& (132_875) +\& \ep{XPosixBlank} \eh, Horizontal white space (Short: +\& \ep{Blank}) (18: [\et\ex20\exa0], U+1680, +\& U+2000..200A, U+202F, U+205F, U+3000) +\& \ep{XPosixCntrl} \ep{General_Category=Control} Control +\& characters (Short: \ep{Cc}) (65) +\& \ep{XPosixDigit} \ep{General_Category=Decimal_Number} [0\-9] +\& + all other decimal digits (Short: +\& \ep{Nd}) (650) +\& \ep{XPosixGraph} Characters that are graphical (Short: +\& \ep{Graph}) (281_308: [!\e"#\e$\e%&\e\*(Aq +\& \e(\e)*+,\e\-.\e/0\-9:;<=>?\e@A\-Z\e[\e\e\e]\e^_\`a\-z +\& \e{\e|\e}~\exa1\-\exff], U+0100..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1 ...) +\& \ep{XPosixLower} \ep{Lowercase=Y} (Short: \ep{Lower}; /i= +\& Cased=Yes) (2344) +\& \ep{XPosixPrint} Characters that are graphical plus space +\& characters (but no controls) (Short: +\& \ep{Print}) (281_325: [\ex20\-\ex7e\exa0\- +\& \exff], U+0100..0377, U+037A..037F, +\& U+0384..038A, U+038C, U+038E..03A1 ...) +\& \ep{XPosixPunct} \ep{Punct} + ASCII\-range \ep{Symbol} (807: +\& [!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<=>?\e@\e[\e\e\e] +\& \e^_\`\e{\e|\e}~\exa1\exa7\exab\exb6\-\exb7\exbb +\& \exbf], U+037E, U+0387, U+055A..055F, +\& U+0589..058A, U+05BE ...) +\& \ep{XPosixSpace} \es including beyond ASCII and vertical tab +\& (Short: \ep{SpacePerl}) (25: [\et\en\ecK\ef +\& \er\ex20\ex85\exa0], U+1680, U+2000..200A, +\& U+2028..2029, U+202F, U+205F ...) +\& \ep{XPosixUpper} \ep{Uppercase=Y} (Short: \ep{Upper}; /i= +\& Cased=Yes) (1911) +\& \ep{XPosixWord} \ew, including beyond ASCII; = \ep{Alnum} + +\& \epM + \ep{Pc} + \ep{Join_Control} (Short: +\& \ep{Word}) (134_564: [0\-9A\-Z_a\-z\exaa\exb5 +\& \exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..02C1, U+02C6..02D1, +\& U+02E0..02E4, U+02EC, U+02EE ...) +\& \ep{XPosixXDigit} \ep{Hex_Digit=Y} (Short: \ep{Hex}) (44) +\& \ep{Xsux} \ep{Cuneiform} (= \ep{Script_Extensions= +\& Cuneiform}) (NOT \ep{Block=Cuneiform}) +\& (1234) +\& \ep{Yezi} \ep{Yezidi} (= \ep{Script_Extensions= +\& Yezidi}) (NOT \ep{Block=Yezidi}) (60) +\& \ep{Yezidi} \ep{Script_Extensions=Yezidi} (Short: +\& \ep{Yezi}; NOT \ep{Block=Yezidi}) (60) +\& \ep{Yi} \ep{Script_Extensions=Yi} (1246) +\& X \ep{Yi_Radicals} \ep{Block=Yi_Radicals} (64) +\& X \ep{Yi_Syllables} \ep{Block=Yi_Syllables} (1168) +\& \ep{Yiii} \ep{Yi} (= \ep{Script_Extensions=Yi}) (1246) +\& X \ep{Yijing} \ep{Yijing_Hexagram_Symbols} (= \ep{Block= +\& Yijing_Hexagram_Symbols}) (64) +\& X \ep{Yijing_Hexagram_Symbols} \ep{Block=Yijing_Hexagram_Symbols} +\& (Short: \ep{InYijing}) (64) +\& \ep{Z} \epZ \ep{Separator} (= \ep{General_Category= +\& Separator}) (19) +\& \ep{Zanabazar_Square} \ep{Script_Extensions=Zanabazar_Square} +\& (Short: \ep{Zanb}; NOT \ep{Block= +\& Zanabazar_Square}) (72) +\& \ep{Zanb} \ep{Zanabazar_Square} (= +\& \ep{Script_Extensions=Zanabazar_Square}) +\& (NOT \ep{Block=Zanabazar_Square}) (72) +\& \ep{Zinh} \ep{Inherited} (= \ep{Script_Extensions= +\& Inherited}) (503) +\& \ep{Zl} \ep{Line_Separator} (= \ep{General_Category= +\& Line_Separator}) (1) +\& \ep{Zp} \ep{Paragraph_Separator} (= +\& \ep{General_Category= +\& Paragraph_Separator}) (1) +\& \ep{Zs} \ep{Space_Separator} (= +\& \ep{General_Category=Space_Separator}) +\& (17) +\& \ep{Zyyy} \ep{Common} (= \ep{Script_Extensions= +\& Common}) (7661) +\& \ep{Zzzz} \ep{Unknown} (= \ep{Script_Extensions= +\& Unknown}) (970_188 plus all above\- +\& Unicode code points) +.Ve +.ie n .SS "Legal ""\ep{}"" and ""\eP{}"" constructs that match no characters" +.el .SS "Legal \f(CW\ep{}\fP and \f(CW\eP{}\fP constructs that match no characters" +.IX Subsection "Legal p{} and P{} constructs that match no characters" +Unicode has some property-value pairs that currently don't match anything. +This happens generally either because they are obsolete, or they exist for +symmetry with other forms, but no language has yet been encoded that uses +them. In this version of Unicode, the following match zero code points: +.IP "\ep{Canonical_Combining_Class=Attached_Below_Left}" 4 +.IX Item "p{Canonical_Combining_Class=Attached_Below_Left}" +.PD 0 +.IP "\ep{Canonical_Combining_Class=CCC133}" 4 +.IX Item "p{Canonical_Combining_Class=CCC133}" +.IP "\ep{Grapheme_Cluster_Break=E_Base}" 4 +.IX Item "p{Grapheme_Cluster_Break=E_Base}" +.IP "\ep{Grapheme_Cluster_Break=E_Base_GAZ}" 4 +.IX Item "p{Grapheme_Cluster_Break=E_Base_GAZ}" +.IP "\ep{Grapheme_Cluster_Break=E_Modifier}" 4 +.IX Item "p{Grapheme_Cluster_Break=E_Modifier}" +.IP "\ep{Grapheme_Cluster_Break=Glue_After_Zwj}" 4 +.IX Item "p{Grapheme_Cluster_Break=Glue_After_Zwj}" +.IP "\ep{Word_Break=E_Base}" 4 +.IX Item "p{Word_Break=E_Base}" +.IP "\ep{Word_Break=E_Base_GAZ}" 4 +.IX Item "p{Word_Break=E_Base_GAZ}" +.IP "\ep{Word_Break=E_Modifier}" 4 +.IX Item "p{Word_Break=E_Modifier}" +.IP "\ep{Word_Break=Glue_After_Zwj}" 4 +.IX Item "p{Word_Break=Glue_After_Zwj}" +.PD +.SH "Properties accessible through Unicode::UCD" +.IX Header "Properties accessible through Unicode::UCD" +The value of any Unicode (not including Perl extensions) character +property mentioned above for any single code point is available through +\&\*(L"\fBcharprop()\fR\*(R" in Unicode::UCD. \*(L"\fBcharprops_all()\fR\*(R" in Unicode::UCD returns the +values of all the Unicode properties for a given code point. +.PP +Besides these, all the Unicode character properties mentioned above +(except for those marked as for internal use by Perl) are also +accessible by \*(L"\fBprop_invlist()\fR\*(R" in Unicode::UCD. +.PP +Due to their nature, not all Unicode character properties are suitable for +regular expression matches, nor \f(CW\*(C`prop_invlist()\*(C'\fR. The remaining +non-provisional, non-internal ones are accessible via +\&\*(L"\fBprop_invmap()\fR\*(R" in Unicode::UCD (except for those that this Perl installation +hasn't included; see below for which those are). +.PP +For compatibility with other parts of Perl, all the single forms given in the +table in the section above +are recognized. \s-1BUT,\s0 there are some ambiguities between some Perl extensions +and the Unicode properties, all of which are silently resolved in favor of the +official Unicode property. To avoid surprises, you should only use +\&\f(CW\*(C`prop_invmap()\*(C'\fR for forms listed in the table below, which omits the +non-recommended ones. The affected forms are the Perl single form equivalents +of Unicode properties, such as \f(CW\*(C`\ep{sc}\*(C'\fR being a single-form equivalent of +\&\f(CW\*(C`\ep{gc=sc}\*(C'\fR, which is treated by \f(CW\*(C`prop_invmap()\*(C'\fR as the \f(CW\*(C`Script\*(C'\fR property, +whose short name is \f(CW\*(C`sc\*(C'\fR. The table indicates the current ambiguities in the +\&\s-1INFO\s0 column, beginning with the word \f(CW"NOT"\fR. +.PP +The standard Unicode properties listed below are documented in +; Perl_Decimal_Digit is documented in +\&\*(L"\fBprop_invmap()\fR\*(R" in Unicode::UCD. The other Perl extensions are in +\&\*(L"Other Properties\*(R" in perlunicode; +.PP +The first column in the table is a name for the property; the second column is +an alternative name, if any, plus possibly some annotations. The alternative +name is the property's full name, unless that would simply repeat the first +column, in which case the second column indicates the property's short name +(if different). The annotations are given only in the entry for the full +name. The annotations for binary properties include a list of the first few +ranges that the property matches. To avoid any ambiguity, the \s-1SPACE\s0 character +is represented as \f(CW\*(C`\ex20\*(C'\fR. +.PP +If a property is obsolete, etc, the entry will be flagged with the same +characters used in the table in the section above, like \fBD\fR or \fBS\fR. +.PP +.Vb 1 +\& NAME INFO +\& +\& Age +\& AHex ASCII_Hex_Digit +\& All (Perl extension). All code points, +\& including those above Unicode. Same as +\& qr/./s. U+0000..infinity +\& Alnum XPosixAlnum. (Perl extension) +\& Alpha Alphabetic +\& Alphabetic (Short: Alpha). [A\-Za\-z\exaa\exb5\exba\exc0\- +\& \exd6\exd8\-\exf6\exf8\-\exff], U+0100..02C1, +\& U+02C6..02D1, U+02E0..02E4, U+02EC, U+02EE +\& ... +\& Any (Perl extension). All Unicode code +\& points. U+0000..10FFFF +\& ASCII Block=Basic_Latin. (Perl extension). +\& [\ex00\-\ex7f] +\& ASCII_Hex_Digit (Short: AHex). [0\-9A\-Fa\-f] +\& Assigned (Perl extension). All assigned code +\& points. U+0000..0377, U+037A..037F, +\& U+0384..038A, U+038C, U+038E..03A1, +\& U+03A3..052F ... +\& Bc Bidi_Class +\& Bidi_C Bidi_Control +\& Bidi_Class (Short: bc) +\& Bidi_Control (Short: Bidi_C). U+061C, U+200E..200F, +\& U+202A..202E, U+2066..2069 +\& Bidi_M Bidi_Mirrored +\& Bidi_Mirrored (Short: Bidi_M). [\e(\e)<>\e[\e]\e{\e}\exab +\& \exbb], U+0F3A..0F3D, U+169B..169C, +\& U+2039..203A, U+2045..2046, U+207D..207E +\& ... +\& Bidi_Mirroring_Glyph (Short: bmg) +\& Bidi_Paired_Bracket (Short: bpb) +\& Bidi_Paired_Bracket_Type (Short: bpt) +\& Blank XPosixBlank. (Perl extension) +\& Blk Block +\& Block (Short: blk) +\& Bmg Bidi_Mirroring_Glyph +\& Bpb Bidi_Paired_Bracket +\& Bpt Bidi_Paired_Bracket_Type +\& Canonical_Combining_Class (Short: ccc) +\& Case_Folding (Short: cf) +\& Case_Ignorable (Short: CI). [\e\*(Aq.:\e^\`\exa8\exad\exaf\exb4 +\& \exb7\-\exb8], U+02B0..036F, U+0374..0375, +\& U+037A, U+0384..0385, U+0387 ... +\& Cased [A\-Za\-z\exaa\exb5\exba\exc0\-\exd6\exd8\-\exf6\exf8\- +\& \exff], U+0100..01BA, U+01BC..01BF, +\& U+01C4..0293, U+0295..02B8, U+02C0..02C1 +\& ... +\& Category General_Category +\& Ccc Canonical_Combining_Class +\& CE Composition_Exclusion +\& Cf Case_Folding; NOT \*(Aqcf\*(Aq meaning +\& \*(AqGeneral_Category=Format\*(Aq +\& Changes_When_Casefolded (Short: CWCF). [A\-Z\exb5\exc0\-\exd6\exd8\- +\& \exdf], U+0100, U+0102, U+0104, U+0106, +\& U+0108 ... +\& Changes_When_Casemapped (Short: CWCM). [A\-Za\-z\exb5\exc0\-\exd6\exd8\- +\& \exf6\exf8\-\exff], U+0100..0137, +\& U+0139..018C, U+018E..019A, U+019C..01A9, +\& U+01AC..01B9 ... +\& Changes_When_Lowercased (Short: CWL). [A\-Z\exc0\-\exd6\exd8\-\exde], +\& U+0100, U+0102, U+0104, U+0106, U+0108 ... +\& Changes_When_NFKC_Casefolded (Short: CWKCF). [A\-Z\exa0\exa8\exaa +\& \exad\exaf\exb2\-\exb5\exb8\-\exba\exbc\-\exbe\exc0\- +\& \exd6\exd8\-\exdf], U+0100, U+0102, U+0104, +\& U+0106, U+0108 ... +\& Changes_When_Titlecased (Short: CWT). [a\-z\exb5\exdf\-\exf6\exf8\- +\& \exff], U+0101, U+0103, U+0105, U+0107, +\& U+0109 ... +\& Changes_When_Uppercased (Short: CWU). [a\-z\exb5\exdf\-\exf6\exf8\- +\& \exff], U+0101, U+0103, U+0105, U+0107, +\& U+0109 ... +\& CI Case_Ignorable +\& Cntrl XPosixCntrl (=General_Category=Control). +\& (Perl extension) +\& Comp_Ex Full_Composition_Exclusion +\& Composition_Exclusion (Short: CE). U+0958..095F, U+09DC..09DD, +\& U+09DF, U+0A33, U+0A36, U+0A59..0A5B ... +\& CWCF Changes_When_Casefolded +\& CWCM Changes_When_Casemapped +\& CWKCF Changes_When_NFKC_Casefolded +\& CWL Changes_When_Lowercased +\& CWT Changes_When_Titlecased +\& CWU Changes_When_Uppercased +\& Dash [\e\-], U+058A, U+05BE, U+1400, U+1806, +\& U+2010..2015 ... +\& Decomposition_Mapping (Short: dm) +\& Decomposition_Type (Short: dt) +\& Default_Ignorable_Code_Point (Short: DI). [\exad], U+034F, U+061C, +\& U+115F..1160, U+17B4..17B5, U+180B..180E +\& ... +\& Dep Deprecated +\& Deprecated (Short: Dep). U+0149, U+0673, U+0F77, +\& U+0F79, U+17A3..17A4, U+206A..206F ... +\& DI Default_Ignorable_Code_Point +\& Dia Diacritic +\& Diacritic (Short: Dia). [\e^\`\exa8\exaf\exb4\exb7\-\exb8], +\& U+02B0..034E, U+0350..0357, U+035D..0362, +\& U+0374..0375, U+037A ... +\& Digit XPosixDigit (=General_Category= +\& Decimal_Number). (Perl extension) +\& Dm Decomposition_Mapping +\& Dt Decomposition_Type +\& Ea East_Asian_Width +\& East_Asian_Width (Short: ea) +\& EBase Emoji_Modifier_Base +\& EComp Emoji_Component +\& EMod Emoji_Modifier +\& Emoji [#*0\-9\exa9\exae], U+203C, U+2049, U+2122, +\& U+2139, U+2194..2199 ... +\& Emoji_Component (Short: EComp). [#*0\-9], U+200D, U+20E3, +\& U+FE0F, U+1F1E6..1F1FF, U+1F3FB..1F3FF ... +\& Emoji_Modifier (Short: EMod). U+1F3FB..1F3FF +\& Emoji_Modifier_Base (Short: EBase). U+261D, U+26F9, +\& U+270A..270D, U+1F385, U+1F3C2..1F3C4, +\& U+1F3C7 ... +\& Emoji_Presentation (Short: EPres). U+231A..231B, +\& U+23E9..23EC, U+23F0, U+23F3, +\& U+25FD..25FE, U+2614..2615 ... +\& EPres Emoji_Presentation +\& EqUIdeo Equivalent_Unified_Ideograph +\& Equivalent_Unified_Ideograph (Short: EqUIdeo) +\& Ext Extender +\& Extended_Pictographic (Short: ExtPict). [\exa9\exae], U+203C, +\& U+2049, U+2122, U+2139, U+2194..2199 ... +\& Extender (Short: Ext). [\exb7], U+02D0..02D1, +\& U+0640, U+07FA, U+0B55, U+0E46 ... +\& ExtPict Extended_Pictographic +\& Full_Composition_Exclusion (Short: Comp_Ex). U+0340..0341, +\& U+0343..0344, U+0374, U+037E, U+0387, +\& U+0958..095F ... +\& Gc General_Category +\& GCB Grapheme_Cluster_Break +\& General_Category (Short: gc) +\& Gr_Base Grapheme_Base +\& Gr_Ext Grapheme_Extend +\& Graph XPosixGraph. (Perl extension) +\& Grapheme_Base (Short: Gr_Base). [\ex20\-\ex7e\exa0\-\exac +\& \exae\-\exff], U+0100..02FF, U+0370..0377, +\& U+037A..037F, U+0384..038A, U+038C ... +\& Grapheme_Cluster_Break (Short: GCB) +\& Grapheme_Extend (Short: Gr_Ext). U+0300..036F, +\& U+0483..0489, U+0591..05BD, U+05BF, +\& U+05C1..05C2, U+05C4..05C5 ... +\& Hangul_Syllable_Type (Short: hst) +\& Hex Hex_Digit +\& Hex_Digit (Short: Hex). [0\-9A\-Fa\-f], U+FF10..FF19, +\& U+FF21..FF26, U+FF41..FF46 +\& HorizSpace XPosixBlank. (Perl extension) +\& Hst Hangul_Syllable_Type +\& D Hyphen [\e\-\exad], U+058A, U+1806, U+2010..2011, +\& U+2E17, U+30FB ... Supplanted by +\& Line_Break property values; see +\& www.unicode.org/reports/tr14 +\& ID_Continue (Short: IDC). [0\-9A\-Z_a\-z\exaa\exb5\exb7 +\& \exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..02C1, U+02C6..02D1, U+02E0..02E4, +\& U+02EC, U+02EE ... +\& ID_Start (Short: IDS). [A\-Za\-z\exaa\exb5\exba\exc0\- +\& \exd6\exd8\-\exf6\exf8\-\exff], U+0100..02C1, +\& U+02C6..02D1, U+02E0..02E4, U+02EC, U+02EE +\& ... +\& IDC ID_Continue +\& Identifier_Status +\& Identifier_Type +\& Ideo Ideographic +\& Ideographic (Short: Ideo). U+3006..3007, +\& U+3021..3029, U+3038..303A, U+3400..4DBF, +\& U+4E00..9FFC, U+F900..FA6D ... +\& IDS ID_Start +\& IDS_Binary_Operator (Short: IDSB). U+2FF0..2FF1, U+2FF4..2FFB +\& IDS_Trinary_Operator (Short: IDST). U+2FF2..2FF3 +\& IDSB IDS_Binary_Operator +\& IDST IDS_Trinary_Operator +\& In Present_In. (Perl extension) +\& Indic_Positional_Category (Short: InPC) +\& Indic_Syllabic_Category (Short: InSC) +\& InPC Indic_Positional_Category +\& InSC Indic_Syllabic_Category +\& Isc ISO_Comment; NOT \*(Aqisc\*(Aq meaning +\& \*(AqGeneral_Category=Other\*(Aq +\& ISO_Comment (Short: isc) +\& Jg Joining_Group +\& Join_C Join_Control +\& Join_Control (Short: Join_C). U+200C..200D +\& Joining_Group (Short: jg) +\& Joining_Type (Short: jt) +\& Jt Joining_Type +\& Lb Line_Break +\& Lc Lowercase_Mapping; NOT \*(Aqlc\*(Aq meaning +\& \*(AqGeneral_Category=Cased_Letter\*(Aq +\& Line_Break (Short: lb) +\& LOE Logical_Order_Exception +\& Logical_Order_Exception (Short: LOE). U+0E40..0E44, U+0EC0..0EC4, +\& U+19B5..19B7, U+19BA, U+AAB5..AAB6, U+AAB9 +\& ... +\& Lower Lowercase +\& Lowercase (Short: Lower). [a\-z\exaa\exb5\exba\exdf\- +\& \exf6\exf8\-\exff], U+0101, U+0103, U+0105, +\& U+0107, U+0109 ... +\& Lowercase_Mapping (Short: lc) +\& Math [+<=>\e^\e|~\exac\exb1\exd7\exf7], U+03D0..03D2, +\& U+03D5, U+03F0..03F1, U+03F4..03F6, +\& U+0606..0608 ... +\& Na Name +\& Na1 Unicode_1_Name +\& Name (Short: na) +\& Name_Alias +\& NChar Noncharacter_Code_Point +\& NFC_QC NFC_Quick_Check +\& NFC_Quick_Check (Short: NFC_QC) +\& NFD_QC NFD_Quick_Check +\& NFD_Quick_Check (Short: NFD_QC) +\& NFKC_Casefold (Short: NFKC_CF) +\& NFKC_CF NFKC_Casefold +\& NFKC_QC NFKC_Quick_Check +\& NFKC_Quick_Check (Short: NFKC_QC) +\& NFKD_QC NFKD_Quick_Check +\& NFKD_Quick_Check (Short: NFKD_QC) +\& Noncharacter_Code_Point (Short: NChar). U+FDD0..FDEF, +\& U+FFFE..FFFF, U+1FFFE..1FFFF, +\& U+2FFFE..2FFFF, U+3FFFE..3FFFF, +\& U+4FFFE..4FFFF ... +\& Nt Numeric_Type +\& Numeric_Type (Short: nt) +\& Numeric_Value (Short: nv) +\& Nv Numeric_Value +\& Pat_Syn Pattern_Syntax +\& Pat_WS Pattern_White_Space +\& Pattern_Syntax (Short: Pat_Syn). [!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-. +\& \e/:;<=>?\e@\e[\e\e\e]\e^\`\e{\e|\e}~\exa1\-\exa7\exa9 +\& \exab\-\exac\exae\exb0\-\exb1\exb6\exbb\exbf\exd7 +\& \exf7], U+2010..2027, U+2030..203E, +\& U+2041..2053, U+2055..205E, U+2190..245F +\& ... +\& Pattern_White_Space (Short: Pat_WS). [\et\en\ecK\ef\er\ex20\ex85], +\& U+200E..200F, U+2028..2029 +\& PCM Prepended_Concatenation_Mark +\& Perl_Decimal_Digit (Perl extension) +\& PerlSpace PosixSpace. (Perl extension) +\& PerlWord PosixWord. (Perl extension) +\& PosixAlnum (Perl extension). [0\-9A\-Za\-z] +\& PosixAlpha (Perl extension). [A\-Za\-z] +\& PosixBlank (Perl extension). [\et\ex20] +\& PosixCntrl (Perl extension). ASCII control +\& characters. ACK, BEL, BS, CAN, CR, DC1, +\& DC2, DC3, DC4, DEL, DLE, ENQ, EOM, EOT, +\& ESC, ETB, ETX, FF, FS, GS, HT, LF, NAK, +\& NUL, RS, SI, SO, SOH, STX, SUB, SYN, US, VT +\& PosixDigit (Perl extension). [0\-9] +\& PosixGraph (Perl extension). [!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-. +\& \e/0\-9:;<=>?\e@A\-Z\e[\e\e\e]\e^_\`a\-z\e{\e|\e}~] +\& PosixLower (Perl extension). [a\-z] +\& PosixPrint (Perl extension). [\ex20\-\ex7e] +\& PosixPunct (Perl extension). [!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-. +\& \e/:;<=>?\e@\e[\e\e\e]\e^_\`\e{\e|\e}~] +\& PosixSpace (Perl extension). [\et\en\ecK\ef\er\ex20] +\& PosixUpper (Perl extension). [A\-Z] +\& PosixWord (Perl extension). \ew, restricted to +\& ASCII. [0\-9A\-Z_a\-z] +\& PosixXDigit ASCII_Hex_Digit. (Perl extension). +\& [0\-9A\-Fa\-f] +\& Prepended_Concatenation_Mark (Short: PCM). U+0600..0605, U+06DD, +\& U+070F, U+08E2, U+110BD, U+110CD +\& Present_In (Short: In). (Perl extension) +\& Print XPosixPrint. (Perl extension) +\& Punct General_Category=Punctuation. (Perl +\& extension). [!\e"#\e%&\e\*(Aq\e(\e)*,\e\-.\e/:;?\e@ +\& \e[\e\e\e]_\e{\e}\exa1\exa7\exab\exb6\-\exb7\exbb\exbf], +\& U+037E, U+0387, U+055A..055F, +\& U+0589..058A, U+05BE ... +\& QMark Quotation_Mark +\& Quotation_Mark (Short: QMark). [\e"\e\*(Aq\exab\exbb], +\& U+2018..201F, U+2039..203A, U+2E42, +\& U+300C..300F, U+301D..301F ... +\& Radical U+2E80..2E99, U+2E9B..2EF3, U+2F00..2FD5 +\& Regional_Indicator (Short: RI). U+1F1E6..1F1FF +\& RI Regional_Indicator +\& SB Sentence_Break +\& Sc Script; NOT \*(Aqsc\*(Aq meaning +\& \*(AqGeneral_Category=Currency_Symbol\*(Aq +\& Scf Simple_Case_Folding +\& Script (Short: sc) +\& Script_Extensions (Short: scx) +\& Scx Script_Extensions +\& SD Soft_Dotted +\& Sentence_Break (Short: SB) +\& Sentence_Terminal (Short: STerm). [!.?], U+0589, +\& U+061E..061F, U+06D4, U+0700..0702, U+07F9 +\& ... +\& Sfc Simple_Case_Folding +\& Simple_Case_Folding (Short: scf) +\& Simple_Lowercase_Mapping (Short: slc) +\& Simple_Titlecase_Mapping (Short: stc) +\& Simple_Uppercase_Mapping (Short: suc) +\& Slc Simple_Lowercase_Mapping +\& Soft_Dotted (Short: SD). [i\-j], U+012F, U+0249, +\& U+0268, U+029D, U+02B2 ... +\& Space White_Space +\& SpacePerl XPosixSpace. (Perl extension) +\& Stc Simple_Titlecase_Mapping +\& STerm Sentence_Terminal +\& Suc Simple_Uppercase_Mapping +\& Tc Titlecase_Mapping +\& Term Terminal_Punctuation +\& Terminal_Punctuation (Short: Term). [!,.:;?], U+037E, U+0387, +\& U+0589, U+05C3, U+060C ... +\& Title Titlecase. (Perl extension) +\& Titlecase (Short: Title). (Perl extension). (= +\& \ep{Gc=Lt}). U+01C5, U+01C8, U+01CB, +\& U+01F2, U+1F88..1F8F, U+1F98..1F9F ... +\& Titlecase_Mapping (Short: tc) +\& Uc Uppercase_Mapping +\& UIdeo Unified_Ideograph +\& Unicode Any. (Perl extension) +\& Unicode_1_Name (Short: na1) +\& Unified_Ideograph (Short: UIdeo). U+3400..4DBF, +\& U+4E00..9FFC, U+FA0E..FA0F, U+FA11, +\& U+FA13..FA14, U+FA1F ... +\& Upper Uppercase +\& Uppercase (Short: Upper). [A\-Z\exc0\-\exd6\exd8\-\exde], +\& U+0100, U+0102, U+0104, U+0106, U+0108 ... +\& Uppercase_Mapping (Short: uc) +\& Variation_Selector (Short: VS). U+180B..180D, U+FE00..FE0F, +\& U+E0100..E01EF +\& Vertical_Orientation (Short: vo) +\& VertSpace (Perl extension). \ev. [\en\ecK\ef\er\ex85], +\& U+2028..2029 +\& Vo Vertical_Orientation +\& VS Variation_Selector +\& WB Word_Break +\& White_Space (Short: WSpace). [\et\en\ecK\ef\er\ex20\ex85 +\& \exa0], U+1680, U+2000..200A, U+2028..2029, +\& U+202F, U+205F ... +\& Word XPosixWord. (Perl extension) +\& Word_Break (Short: WB) +\& WSpace White_Space +\& XDigit XPosixXDigit (=Hex_Digit). (Perl +\& extension) +\& XID_Continue (Short: XIDC). [0\-9A\-Z_a\-z\exaa\exb5\exb7 +\& \exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..02C1, U+02C6..02D1, U+02E0..02E4, +\& U+02EC, U+02EE ... +\& XID_Start (Short: XIDS). [A\-Za\-z\exaa\exb5\exba\exc0\- +\& \exd6\exd8\-\exf6\exf8\-\exff], U+0100..02C1, +\& U+02C6..02D1, U+02E0..02E4, U+02EC, U+02EE +\& ... +\& XIDC XID_Continue +\& XIDS XID_Start +\& XPerlSpace XPosixSpace. (Perl extension) +\& XPosixAlnum (Short: Alnum). (Perl extension). +\& Alphabetic and (decimal) Numeric. [0\-9A\- +\& Za\-z\exaa\exb5\exba\exc0\-\exd6\exd8\-\exf6\exf8\- +\& \exff], U+0100..02C1, U+02C6..02D1, +\& U+02E0..02E4, U+02EC, U+02EE ... +\& XPosixAlpha Alphabetic. (Perl extension). [A\-Za\-z +\& \exaa\exb5\exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..02C1, U+02C6..02D1, U+02E0..02E4, +\& U+02EC, U+02EE ... +\& XPosixBlank (Short: Blank). (Perl extension). \eh, +\& Horizontal white space. [\et\ex20\exa0], +\& U+1680, U+2000..200A, U+202F, U+205F, +\& U+3000 +\& XPosixCntrl General_Category=Control (Short: Cntrl). +\& (Perl extension). Control characters. +\& [\ex00\-\ex1f\ex7f\-\ex9f] +\& XPosixDigit General_Category=Decimal_Number (Short: +\& Digit). (Perl extension). [0\-9] + all +\& other decimal digits. [0\-9], +\& U+0660..0669, U+06F0..06F9, U+07C0..07C9, +\& U+0966..096F, U+09E6..09EF ... +\& XPosixGraph (Short: Graph). (Perl extension). +\& Characters that are graphical. [!\e"#\e$ +\& \e%&\e\*(Aq\e(\e)*+,\e\-.\e/0\-9:;<=>?\e@A\-Z\e[\e\e\e] +\& \e^_\`a\-z\e{\e|\e}~\exa1\-\exff], U+0100..0377, +\& U+037A..037F, U+0384..038A, U+038C, +\& U+038E..03A1 ... +\& XPosixLower Lowercase. (Perl extension). [a\-z\exaa +\& \exb5\exba\exdf\-\exf6\exf8\-\exff], U+0101, +\& U+0103, U+0105, U+0107, U+0109 ... +\& XPosixPrint (Short: Print). (Perl extension). +\& Characters that are graphical plus space +\& characters (but no controls). [\ex20\-\ex7e +\& \exa0\-\exff], U+0100..0377, U+037A..037F, +\& U+0384..038A, U+038C, U+038E..03A1 ... +\& XPosixPunct (Perl extension). \ep{Punct} + ASCII\-range +\& \ep{Symbol}. [!\e"#\e$\e%&\e\*(Aq\e(\e)*+,\e\-.\e/:;<= +\& >?\e@\e[\e\e\e]\e^_\`\e{\e|\e}~\exa1\exa7\exab\exb6\- +\& \exb7\exbb\exbf], U+037E, U+0387, +\& U+055A..055F, U+0589..058A, U+05BE ... +\& XPosixSpace (Perl extension). \es including beyond +\& ASCII and vertical tab. [\et\en\ecK\ef\er\ex20 +\& \ex85\exa0], U+1680, U+2000..200A, +\& U+2028..2029, U+202F, U+205F ... +\& XPosixUpper Uppercase. (Perl extension). [A\-Z\exc0\- +\& \exd6\exd8\-\exde], U+0100, U+0102, U+0104, +\& U+0106, U+0108 ... +\& XPosixWord (Short: Word). (Perl extension). \ew, +\& including beyond ASCII; = \ep{Alnum} + \epM +\& + \ep{Pc} + \ep{Join_Control}. [0\-9A\-Z_a\-z +\& \exaa\exb5\exba\exc0\-\exd6\exd8\-\exf6\exf8\-\exff], +\& U+0100..02C1, U+02C6..02D1, U+02E0..02E4, +\& U+02EC, U+02EE ... +\& XPosixXDigit Hex_Digit (Short: XDigit). (Perl +\& extension). [0\-9A\-Fa\-f], U+FF10..FF19, +\& U+FF21..FF26, U+FF41..FF46 +.Ve +.SH "Properties accessible through other means" +.IX Header "Properties accessible through other means" +Certain properties are accessible also via core function calls. These are: +.PP +.Vb 3 +\& Lowercase_Mapping lc() and lcfirst() +\& Titlecase_Mapping ucfirst() +\& Uppercase_Mapping uc() +.Ve +.PP +Also, Case_Folding is accessible through the \f(CW\*(C`/i\*(C'\fR modifier in regular +expressions, the \f(CW\*(C`\eF\*(C'\fR transliteration escape, and the \f(CW\*(C`fc\*(C'\fR +operator. +.PP +Besides being able to say \f(CW\*(C`\ep{Name=...}\*(C'\fR, the Name and Name_Aliases +properties are accessible through the \f(CW\*(C`\eN{}\*(C'\fR interpolation in double-quoted +strings and regular expressions; and functions \f(CW\*(C`charnames::viacode()\*(C'\fR, +\&\f(CW\*(C`charnames::vianame()\*(C'\fR, and \f(CW\*(C`charnames::string_vianame()\*(C'\fR (which require a +\&\f(CW\*(C`use charnames ();\*(C'\fR to be specified. +.PP +Finally, most properties related to decomposition are accessible via +Unicode::Normalize. +.SH "Unicode character properties that are NOT accepted by Perl" +.IX Header "Unicode character properties that are NOT accepted by Perl" +Perl will generate an error for a few character properties in Unicode when +used in a regular expression. The non-Unihan ones are listed below, with the +reasons they are not accepted, perhaps with work-arounds. The short names for +the properties are listed enclosed in (parentheses). +As described after the list, an installation can change the defaults and choose +to accept any of these. The list is machine generated based on the +choices made for the installation that generated this document. +.IP "\fIExpands_On_NFC\fR (\s-1XO_NFC\s0)" 4 +.IX Item "Expands_On_NFC (XO_NFC)" +.PD 0 +.IP "\fIExpands_On_NFD\fR (\s-1XO_NFD\s0)" 4 +.IX Item "Expands_On_NFD (XO_NFD)" +.IP "\fIExpands_On_NFKC\fR (\s-1XO_NFKC\s0)" 4 +.IX Item "Expands_On_NFKC (XO_NFKC)" +.IP "\fIExpands_On_NFKD\fR (\s-1XO_NFKD\s0)" 4 +.IX Item "Expands_On_NFKD (XO_NFKD)" +.PD +Deprecated by Unicode. These are characters that expand to more than one character in the specified normalization form, but whether they actually take up more bytes or not depends on the encoding being used. For example, a \s-1UTF\-8\s0 encoded character may expand to a different number of bytes than a \s-1UTF\-32\s0 encoded character. +.IP "\fIGrapheme_Link\fR (Gr_Link)" 4 +.IX Item "Grapheme_Link (Gr_Link)" +Duplicates ccc=vr (Canonical_Combining_Class=Virama) +.IP "\fIJamo_Short_Name\fR (\s-1JSN\s0)" 4 +.IX Item "Jamo_Short_Name (JSN)" +.PD 0 +.IP "\fIOther_Alphabetic\fR (OAlpha)" 4 +.IX Item "Other_Alphabetic (OAlpha)" +.IP "\fIOther_Default_Ignorable_Code_Point\fR (\s-1ODI\s0)" 4 +.IX Item "Other_Default_Ignorable_Code_Point (ODI)" +.IP "\fIOther_Grapheme_Extend\fR (OGr_Ext)" 4 +.IX Item "Other_Grapheme_Extend (OGr_Ext)" +.IP "\fIOther_ID_Continue\fR (\s-1OIDC\s0)" 4 +.IX Item "Other_ID_Continue (OIDC)" +.IP "\fIOther_ID_Start\fR (\s-1OIDS\s0)" 4 +.IX Item "Other_ID_Start (OIDS)" +.IP "\fIOther_Lowercase\fR (OLower)" 4 +.IX Item "Other_Lowercase (OLower)" +.IP "\fIOther_Math\fR (OMath)" 4 +.IX Item "Other_Math (OMath)" +.IP "\fIOther_Uppercase\fR (OUpper)" 4 +.IX Item "Other_Uppercase (OUpper)" +.PD +Used by Unicode internally for generating other properties and not intended to be used stand-alone +.IP "\fIScript=Katakana_Or_Hiragana\fR (sc=Hrkt)" 4 +.IX Item "Script=Katakana_Or_Hiragana (sc=Hrkt)" +Obsolete. All code points previously matched by this have been moved to \*(L"Script=Common\*(R". Consider instead using \*(L"Script_Extensions=Katakana\*(R" or \*(L"Script_Extensions=Hiragana\*(R" (or both) +.IP "\fIScript_Extensions=Katakana_Or_Hiragana\fR (scx=Hrkt)" 4 +.IX Item "Script_Extensions=Katakana_Or_Hiragana (scx=Hrkt)" +All code points that would be matched by this are matched by either \*(L"Script_Extensions=Katakana\*(R" or \*(L"Script_Extensions=Hiragana\*(R" +.PP +An installation can choose to allow any of these to be matched by downloading +the Unicode database from to +\&\f(CW$Config{privlib}\fR/\fIunicore/\fR in the Perl source tree, changing the +controlling lists contained in the program +\&\f(CW$Config{privlib}\fR/\fIunicore/mktables\fR and then re-compiling and installing. +(\f(CW%Config\fR is available from the Config module). +.PP +Also, perl can be recompiled to operate on an earlier version of the Unicode +standard. Further information is at +\&\f(CW$Config{privlib}\fR/\fIunicore/README.perl\fR. +.SH "Other information in the Unicode data base" +.IX Header "Other information in the Unicode data base" +The Unicode data base is delivered in two different formats. The \s-1XML\s0 version +is valid for more modern Unicode releases. The other version is a collection +of files. The two are intended to give equivalent information. Perl uses the +older form; this allows you to recompile Perl to use early Unicode releases. +.PP +The only non-character property that Perl currently supports is Named +Sequences, in which a sequence of code points +is given a name and generally treated as a single entity. (Perl supports +these via the \f(CW\*(C`\eN{...}\*(C'\fR double-quotish construct, +\&\*(L"charnames::string_vianame(name)\*(R" in charnames, and \*(L"\fBnamedseq()\fR\*(R" in Unicode::UCD. +.PP +Below is a list of the files in the Unicode data base that Perl doesn't +currently use, along with very brief descriptions of their purposes. +Some of the names of the files have been shortened from those that Unicode +uses, in order to allow them to be distinguishable from similarly named files +on file systems for which only the first 8 characters of a name are +significant. +.IP "\fIauxiliary/GraphemeBreakTest.html\fR" 4 +.IX Item "auxiliary/GraphemeBreakTest.html" +.PD 0 +.IP "\fIauxiliary/LineBreakTest.html\fR" 4 +.IX Item "auxiliary/LineBreakTest.html" +.IP "\fIauxiliary/SentenceBreakTest.html\fR" 4 +.IX Item "auxiliary/SentenceBreakTest.html" +.IP "\fIauxiliary/WordBreakTest.html\fR" 4 +.IX Item "auxiliary/WordBreakTest.html" +.PD +Documentation of validation Tests +.IP "\fIBidiCharacterTest.txt\fR" 4 +.IX Item "BidiCharacterTest.txt" +.PD 0 +.IP "\fIBidiTest.txt\fR" 4 +.IX Item "BidiTest.txt" +.IP "\fINormTest.txt\fR" 4 +.IX Item "NormTest.txt" +.PD +Validation Tests +.IP "\fICJKRadicals.txt\fR" 4 +.IX Item "CJKRadicals.txt" +Maps the kRSUnicode property values to corresponding code points +.IP "\fIemoji/ReadMe.txt\fR" 4 +.IX Item "emoji/ReadMe.txt" +.PD 0 +.IP "\fIReadMe.txt\fR" 4 +.IX Item "ReadMe.txt" +.PD +Documentation +.IP "\fIEmojiSources.txt\fR" 4 +.IX Item "EmojiSources.txt" +Maps certain Unicode code points to their legacy Japanese cell-phone values +.IP "\fIextracted/DName.txt\fR" 4 +.IX Item "extracted/DName.txt" +This file adds no new information not already present in other files +.IP "\fIIndex.txt\fR" 4 +.IX Item "Index.txt" +Alphabetical index of Unicode characters +.IP "\fINamedSqProv.txt\fR" 4 +.IX Item "NamedSqProv.txt" +Named sequences proposed for inclusion in a later version of the Unicode Standard; if you need them now, you can append this file to \fINamedSequences.txt\fR and recompile perl +.IP "\fINamesList.html\fR" 4 +.IX Item "NamesList.html" +Describes the format and contents of \fINamesList.txt\fR +.IP "\fINamesList.txt\fR" 4 +.IX Item "NamesList.txt" +Annotated list of characters +.IP "\fINormalizationCorrections.txt\fR" 4 +.IX Item "NormalizationCorrections.txt" +Documentation of corrections already incorporated into the Unicode data base +.IP "\fINushuSources.txt\fR" 4 +.IX Item "NushuSources.txt" +Specifies source material for Nushu characters +.IP "\fIStandardizedVariants.html\fR" 4 +.IX Item "StandardizedVariants.html" +Obsoleted as of Unicode 9.0, but previously provided a visual display of the standard variant sequences derived from \fIStandardizedVariants.txt\fR. +.IP "\fIStandardizedVariants.txt\fR" 4 +.IX Item "StandardizedVariants.txt" +Certain glyph variations for character display are standardized. This lists the non-Unihan ones; the Unihan ones are also not used by Perl, and are in a separate Unicode data base +.IP "\fITangutSources.txt\fR" 4 +.IX Item "TangutSources.txt" +Specifies source mappings for Tangut ideographs and components. This data file also includes informative radical-stroke values that are used internally by Unicode +.IP "\fIUSourceData.txt\fR" 4 +.IX Item "USourceData.txt" +Documentation of status and cross reference of proposals for encoding by Unicode of Unihan characters +.IP "\fIUSourceGlyphs.pdf\fR" 4 +.IX Item "USourceGlyphs.pdf" +Pictures of the characters in \fIUSourceData.txt\fR +.SH "SEE ALSO" +.IX Header "SEE ALSO" + +.PP +perlrecharclass +.PP +perlunicode diff --git a/data/miniconda3/man/man1/perlunitut.1 b/data/miniconda3/man/man1/perlunitut.1 new file mode 100644 index 0000000000000000000000000000000000000000..22d621fe7062cf79fbab54b1a751b53126403a4d --- /dev/null +++ b/data/miniconda3/man/man1/perlunitut.1 @@ -0,0 +1,363 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLUNITUT 1" +.TH PERLUNITUT 1 "2020-12-18" "perl v5.32.1" "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" +perlunitut \- Perl Unicode Tutorial +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The days of just flinging strings around are over. It's well established that +modern programs need to be capable of communicating funny accented letters, and +things like euro symbols. This means that programmers need new habits. It's +easy to program Unicode capable software, but it does require discipline to do +it right. +.PP +There's a lot to know about character sets, and text encodings. It's probably +best to spend a full day learning all this, but the basics can be learned in +minutes. +.PP +These are not the very basics, though. It is assumed that you already +know the difference between bytes and characters, and realise (and accept!) +that there are many different character sets and encodings, and that your +program has to be explicit about them. Recommended reading is \*(L"The Absolute +Minimum Every Software Developer Absolutely, Positively Must Know About Unicode +and Character Sets (No Excuses!)\*(R" by Joel Spolsky, at +. +.PP +This tutorial speaks in rather absolute terms, and provides only a limited view +of the wealth of character string related features that Perl has to offer. For +most projects, this information will probably suffice. +.SS "Definitions" +.IX Subsection "Definitions" +It's important to set a few things straight first. This is the most important +part of this tutorial. This view may conflict with other information that you +may have found on the web, but that's mostly because many sources are wrong. +.PP +You may have to re-read this entire section a few times... +.PP +\fIUnicode\fR +.IX Subsection "Unicode" +.PP +\&\fBUnicode\fR is a character set with room for lots of characters. The ordinal +value of a character is called a \fBcode point\fR. (But in practice, the +distinction between code point and character is blurred, so the terms often +are used interchangeably.) +.PP +There are many, many code points, but computers work with bytes, and a byte has +room for only 256 values. Unicode has many more characters than that, +so you need a method to make these accessible. +.PP +Unicode is encoded using several competing encodings, of which \s-1UTF\-8\s0 is the +most used. In a Unicode encoding, multiple subsequent bytes can be used to +store a single code point, or simply: character. +.PP +\fI\s-1UTF\-8\s0\fR +.IX Subsection "UTF-8" +.PP +\&\fB\s-1UTF\-8\s0\fR is a Unicode encoding. Many people think that Unicode and \s-1UTF\-8\s0 are +the same thing, but they're not. There are more Unicode encodings, but much of +the world has standardized on \s-1UTF\-8.\s0 +.PP +\&\s-1UTF\-8\s0 treats the first 128 codepoints, 0..127, the same as \s-1ASCII.\s0 They take +only one byte per character. All other characters are encoded as two to +four bytes using a complex scheme. Fortunately, Perl handles this for +us, so we don't have to worry about this. +.PP +\fIText strings (character strings)\fR +.IX Subsection "Text strings (character strings)" +.PP +\&\fBText strings\fR, or \fBcharacter strings\fR are made of characters. Bytes are +irrelevant here, and so are encodings. Each character is just that: the +character. +.PP +On a text string, you would do things like: +.PP +.Vb 4 +\& $text =~ s/foo/bar/; +\& if ($string =~ /^\ed+$/) { ... } +\& $text = ucfirst $text; +\& my $character_count = length $text; +.Ve +.PP +The value of a character (\f(CW\*(C`ord\*(C'\fR, \f(CW\*(C`chr\*(C'\fR) is the corresponding Unicode code +point. +.PP +\fIBinary strings (byte strings)\fR +.IX Subsection "Binary strings (byte strings)" +.PP +\&\fBBinary strings\fR, or \fBbyte strings\fR are made of bytes. Here, you don't have +characters, just bytes. All communication with the outside world (anything +outside of your current Perl process) is done in binary. +.PP +On a binary string, you would do things like: +.PP +.Vb 4 +\& my (@length_content) = unpack "(V/a)*", $binary; +\& $binary =~ s/\ex00\ex0F/\exFF\exF0/; # for the brave :) +\& print {$fh} $binary; +\& my $byte_count = length $binary; +.Ve +.PP +\fIEncoding\fR +.IX Subsection "Encoding" +.PP +\&\fBEncoding\fR (as a verb) is the conversion from \fItext\fR to \fIbinary\fR. To encode, +you have to supply the target encoding, for example \f(CW\*(C`iso\-8859\-1\*(C'\fR or \f(CW\*(C`UTF\-8\*(C'\fR. +Some encodings, like the \f(CW\*(C`iso\-8859\*(C'\fR (\*(L"latin\*(R") range, do not support the full +Unicode standard; characters that can't be represented are lost in the +conversion. +.PP +\fIDecoding\fR +.IX Subsection "Decoding" +.PP +\&\fBDecoding\fR is the conversion from \fIbinary\fR to \fItext\fR. To decode, you have to +know what encoding was used during the encoding phase. And most of all, it must +be something decodable. It doesn't make much sense to decode a \s-1PNG\s0 image into a +text string. +.PP +\fIInternal format\fR +.IX Subsection "Internal format" +.PP +Perl has an \fBinternal format\fR, an encoding that it uses to encode text strings +so it can store them in memory. All text strings are in this internal format. +In fact, text strings are never in any other format! +.PP +You shouldn't worry about what this format is, because conversion is +automatically done when you decode or encode. +.SS "Your new toolkit" +.IX Subsection "Your new toolkit" +Add to your standard heading the following line: +.PP +.Vb 1 +\& use Encode qw(encode decode); +.Ve +.PP +Or, if you're lazy, just: +.PP +.Vb 1 +\& use Encode; +.Ve +.SS "I/O flow (the actual 5 minute tutorial)" +.IX Subsection "I/O flow (the actual 5 minute tutorial)" +The typical input/output flow of a program is: +.PP +.Vb 3 +\& 1. Receive and decode +\& 2. Process +\& 3. Encode and output +.Ve +.PP +If your input is binary, and is supposed to remain binary, you shouldn't decode +it to a text string, of course. But in all other cases, you should decode it. +.PP +Decoding can't happen reliably if you don't know how the data was encoded. If +you get to choose, it's a good idea to standardize on \s-1UTF\-8.\s0 +.PP +.Vb 3 +\& my $foo = decode(\*(AqUTF\-8\*(Aq, get \*(Aqhttp://example.com/\*(Aq); +\& my $bar = decode(\*(AqISO\-8859\-1\*(Aq, readline STDIN); +\& my $xyzzy = decode(\*(AqWindows\-1251\*(Aq, $cgi\->param(\*(Aqfoo\*(Aq)); +.Ve +.PP +Processing happens as you knew before. The only difference is that you're now +using characters instead of bytes. That's very useful if you use things like +\&\f(CW\*(C`substr\*(C'\fR, or \f(CW\*(C`length\*(C'\fR. +.PP +It's important to realize that there are no bytes in a text string. Of course, +Perl has its internal encoding to store the string in memory, but ignore that. +If you have to do anything with the number of bytes, it's probably best to move +that part to step 3, just after you've encoded the string. Then you know +exactly how many bytes it will be in the destination string. +.PP +The syntax for encoding text strings to binary strings is as simple as decoding: +.PP +.Vb 1 +\& $body = encode(\*(AqUTF\-8\*(Aq, $body); +.Ve +.PP +If you needed to know the length of the string in bytes, now's the perfect time +for that. Because \f(CW$body\fR is now a byte string, \f(CW\*(C`length\*(C'\fR will report the +number of bytes, instead of the number of characters. The number of +characters is no longer known, because characters only exist in text strings. +.PP +.Vb 1 +\& my $byte_count = length $body; +.Ve +.PP +And if the protocol you're using supports a way of letting the recipient know +which character encoding you used, please help the receiving end by using that +feature! For example, E\-mail and \s-1HTTP\s0 support \s-1MIME\s0 headers, so you can use the +\&\f(CW\*(C`Content\-Type\*(C'\fR header. They can also have \f(CW\*(C`Content\-Length\*(C'\fR to indicate the +number of \fIbytes\fR, which is always a good idea to supply if the number is +known. +.PP +.Vb 2 +\& "Content\-Type: text/plain; charset=UTF\-8", +\& "Content\-Length: $byte_count" +.Ve +.SH "SUMMARY" +.IX Header "SUMMARY" +Decode everything you receive, encode everything you send out. (If it's text +data.) +.SH "Q and A (or FAQ)" +.IX Header "Q and A (or FAQ)" +After reading this document, you ought to read perlunifaq too, then +perluniintro. +.SH "ACKNOWLEDGEMENTS" +.IX Header "ACKNOWLEDGEMENTS" +Thanks to Johan Vromans from Squirrel Consultancy. His \s-1UTF\-8\s0 rants during the +Amsterdam Perl Mongers meetings got me interested and determined to find out +how to use character encodings in Perl in ways that don't break easily. +.PP +Thanks to Gerard Goossen from \s-1TTY.\s0 His presentation \*(L"\s-1UTF\-8\s0 in the wild\*(R" (Dutch +Perl Workshop 2006) inspired me to publish my thoughts and write this tutorial. +.PP +Thanks to the people who asked about this kind of stuff in several Perl \s-1IRC\s0 +channels, and have constantly reminded me that a simpler explanation was +needed. +.PP +Thanks to the people who reviewed this document for me, before it went public. +They are: Benjamin Smith, Jan-Pieter Cornet, Johan Vromans, Lukas Mai, Nathan +Gray. +.SH "AUTHOR" +.IX Header "AUTHOR" +Juerd Waalboer <#####@juerd.nl> +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perlunifaq, perlunicode, perluniintro, Encode diff --git a/data/miniconda3/man/man1/perlutil.1 b/data/miniconda3/man/man1/perlutil.1 new file mode 100644 index 0000000000000000000000000000000000000000..504a6793b2d746140cdc438837670292e94d7942 --- /dev/null +++ b/data/miniconda3/man/man1/perlutil.1 @@ -0,0 +1,319 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLUTIL 1" +.TH PERLUTIL 1 "2020-12-18" "perl v5.32.1" "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" +perlutil \- utilities packaged with the Perl distribution +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Along with the Perl interpreter itself, the Perl distribution installs a +range of utilities on your system. There are also several utilities +which are used by the Perl distribution itself as part of the install +process. This document exists to list all of these utilities, explain +what they are for and provide pointers to each module's documentation, +if appropriate. +.SH "LIST OF UTILITIES" +.IX Header "LIST OF UTILITIES" +.SS "Documentation" +.IX Subsection "Documentation" +.IP "perldoc" 3 +.IX Item "perldoc" +The main interface to Perl's documentation is \f(CW\*(C`perldoc\*(C'\fR, although +if you're reading this, it's more than likely that you've already found +it. \fIperldoc\fR will extract and format the documentation from any file +in the current directory, any Perl module installed on the system, or +any of the standard documentation pages, such as this one. Use +\&\f(CW\*(C`perldoc \*(C'\fR to get information on any of the utilities +described in this document. +.IP "pod2man and pod2text" 3 +.IX Item "pod2man and pod2text" +If it's run from a terminal, \fIperldoc\fR will usually call \fIpod2man\fR to +translate \s-1POD\s0 (Plain Old Documentation \- see perlpod for an +explanation) into a manpage, and then run \fIman\fR to display it; if +\&\fIman\fR isn't available, \fIpod2text\fR will be used instead and the output +piped through your favourite pager. +.IP "pod2html" 3 +.IX Item "pod2html" +As well as these two, there is another converter: \fIpod2html\fR will +produce \s-1HTML\s0 pages from \s-1POD.\s0 +.IP "pod2usage" 3 +.IX Item "pod2usage" +If you just want to know how to use the utilities described here, +\&\fIpod2usage\fR will just extract the \*(L"\s-1USAGE\*(R"\s0 section; some of +the utilities will automatically call \fIpod2usage\fR on themselves when +you call them with \f(CW\*(C`\-help\*(C'\fR. +.IP "podchecker" 3 +.IX Item "podchecker" +If you're writing your own documentation in \s-1POD,\s0 the \fIpodchecker\fR +utility will look for errors in your markup. +.IP "splain" 3 +.IX Item "splain" +\&\fIsplain\fR is an interface to perldiag \- paste in your error message +to it, and it'll explain it for you. +.ie n .IP """roffitall""" 3 +.el .IP "\f(CWroffitall\fR" 3 +.IX Item "roffitall" +The \f(CW\*(C`roffitall\*(C'\fR utility is not installed on your system but lives in +the \fIpod/\fR directory of your Perl source kit; it converts all the +documentation from the distribution to \fI*roff\fR format, and produces a +typeset PostScript or text file of the whole lot. +.SS "Converters" +.IX Subsection "Converters" +To help you convert legacy programs to more modern Perl, the +pl2pm utility will help you convert old-style Perl 4 libraries +to new-style Perl5 modules. +.SS "Administration" +.IX Subsection "Administration" +.IP "libnetcfg" 3 +.IX Item "libnetcfg" +To display and change the libnet configuration run the libnetcfg command. +.IP "perlivp" 3 +.IX Item "perlivp" +The \fIperlivp\fR program is set up at Perl source code build time to test +the Perl version it was built under. It can be used after running \f(CW\*(C`make +install\*(C'\fR (or your platform's equivalent procedure) to verify that perl +and its libraries have been installed correctly. +.SS "Development" +.IX Subsection "Development" +There are a set of utilities which help you in developing Perl programs, +and in particular, extending Perl with C. +.IP "perlbug" 3 +.IX Item "perlbug" +\&\fIperlbug\fR used to be the recommended way to report bugs in the perl +interpreter itself or any of the standard library modules back to the +developers; bug reports and patches should now be submitted to +. +.IP "perlthanks" 3 +.IX Item "perlthanks" +This program provides an easy way to send a thank-you message back to the +authors and maintainers of perl. It's just \fIperlbug\fR installed under +another name. +.IP "h2ph" 3 +.IX Item "h2ph" +Back before Perl had the \s-1XS\s0 system for connecting with C libraries, +programmers used to get library constants by reading through the C +header files. You may still see \f(CW\*(C`require \*(Aqsyscall.ph\*(Aq\*(C'\fR or similar +around \- the \fI.ph\fR file should be created by running \fIh2ph\fR on the +corresponding \fI.h\fR file. See the \fIh2ph\fR documentation for more on how +to convert a whole bunch of header files at once. +.IP "h2xs" 3 +.IX Item "h2xs" +\&\fIh2xs\fR converts C header files into \s-1XS\s0 modules, and will try and write +as much glue between C libraries and Perl modules as it can. It's also +very useful for creating skeletons of pure Perl modules. +.IP "enc2xs" 3 +.IX Item "enc2xs" +\&\fIenc2xs\fR builds a Perl extension for use by Encode from either +Unicode Character Mapping files (.ucm) or Tcl Encoding Files (.enc). +Besides being used internally during the build process of the Encode +module, you can use \fIenc2xs\fR to add your own encoding to perl. +No knowledge of \s-1XS\s0 is necessary. +.IP "xsubpp" 3 +.IX Item "xsubpp" +\&\fIxsubpp\fR is a compiler to convert Perl \s-1XS\s0 code into C code. +It is typically run by the makefiles created by ExtUtils::MakeMaker. +.Sp +\&\fIxsubpp\fR will compile \s-1XS\s0 code into C code by embedding the constructs +necessary to let C functions manipulate Perl values and creates the glue +necessary to let Perl access those functions. +.IP "prove" 3 +.IX Item "prove" +\&\fIprove\fR is a command-line interface to the test-running functionality +of \fITest::Harness\fR. It's an alternative to \f(CW\*(C`make test\*(C'\fR. +.IP "corelist" 3 +.IX Item "corelist" +A command-line front-end to \f(CW\*(C`Module::CoreList\*(C'\fR, to query what modules +were shipped with given versions of perl. +.SS "General tools" +.IX Subsection "General tools" +A few general-purpose tools are shipped with perl, mostly because they +came along modules included in the perl distribution. +.IP "piconv" 3 +.IX Item "piconv" +\&\fBpiconv\fR is a Perl version of \fBiconv\fR, a character encoding converter +widely available for various Unixen today. This script was primarily a +technology demonstrator for Perl v5.8.0, but you can use piconv in the +place of iconv for virtually any case. +.IP "ptar" 3 +.IX Item "ptar" +\&\fIptar\fR is a tar-like program, written in pure Perl. +.IP "ptardiff" 3 +.IX Item "ptardiff" +\&\fIptardiff\fR is a small utility that produces a diff between an extracted +archive and an unextracted one. (Note that this utility requires the +\&\f(CW\*(C`Text::Diff\*(C'\fR module to function properly; this module isn't distributed +with perl, but is available from the \s-1CPAN.\s0) +.IP "ptargrep" 3 +.IX Item "ptargrep" +\&\fIptargrep\fR is a utility to apply pattern matching to the contents of files +in a tar archive. +.IP "shasum" 3 +.IX Item "shasum" +This utility, that comes with the \f(CW\*(C`Digest::SHA\*(C'\fR module, is used to print +or verify \s-1SHA\s0 checksums. +.IP "zipdetails" 3 +.IX Item "zipdetails" +zipdetails displays information about the internal record structure of the zip file. +It is not concerned with displaying any details of the compressed data stored in the zip file. +.SS "Installation" +.IX Subsection "Installation" +These utilities help manage extra Perl modules that don't come with the perl +distribution. +.IP "cpan" 3 +.IX Item "cpan" +\&\fIcpan\fR is a command-line interface to \s-1CPAN\s0.pm. It allows you to install +modules or distributions from \s-1CPAN,\s0 or just get information about them, and +a lot more. It is similar to the command line mode of the \s-1CPAN\s0 module, +.Sp +.Vb 1 +\& perl \-MCPAN \-e shell +.Ve +.IP "instmodsh" 3 +.IX Item "instmodsh" +A little interface to ExtUtils::Installed to examine installed modules, +validate your packlists and even create a tarball from an installed module. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perldoc, pod2man, perlpod, +pod2html, pod2usage, +podchecker, splain, perldiag, +\&\f(CW\*(C`roffitall|roffitall\*(C'\fR, File::Find, pl2pm, +perlbug, h2ph, h2xs, enc2xs, +xsubpp, cpan, instmodsh, piconv, prove, corelist, ptar, +ptardiff, shasum, zipdetails diff --git a/data/miniconda3/man/man1/perlvar.1 b/data/miniconda3/man/man1/perlvar.1 new file mode 100644 index 0000000000000000000000000000000000000000..4e4715ef41557f5c7c925e78dd4437fb0cc361d9 --- /dev/null +++ b/data/miniconda3/man/man1/perlvar.1 @@ -0,0 +1,2734 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLVAR 1" +.TH PERLVAR 1 "2020-12-18" "perl v5.32.1" "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" +perlvar \- Perl predefined variables +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +.SS "The Syntax of Variable Names" +.IX Subsection "The Syntax of Variable Names" +Variable names in Perl can have several formats. Usually, they +must begin with a letter or underscore, in which case they can be +arbitrarily long (up to an internal limit of 251 characters) and +may contain letters, digits, underscores, or the special sequence +\&\f(CW\*(C`::\*(C'\fR or \f(CW\*(C`\*(Aq\*(C'\fR. In this case, the part before the last \f(CW\*(C`::\*(C'\fR or +\&\f(CW\*(C`\*(Aq\*(C'\fR is taken to be a \fIpackage qualifier\fR; see perlmod. +A Unicode letter that is not \s-1ASCII\s0 is not considered to be a letter +unless \f(CW"use\ utf8"\fR is in effect, and somewhat more complicated +rules apply; see \*(L"Identifier parsing\*(R" in perldata for details. +.PP +Perl variable names may also be a sequence of digits, a single +punctuation character, or the two-character sequence: \f(CW\*(C`^\*(C'\fR (caret or +\&\s-1CIRCUMFLEX ACCENT\s0) followed by any one of the characters \f(CW\*(C`[][A\-Z^_?\e]\*(C'\fR. +These names are all reserved for +special uses by Perl; for example, the all-digits names are used +to hold data captured by backreferences after a regular expression +match. +.PP +Since Perl v5.6.0, Perl variable names may also be alphanumeric strings +preceded by a caret. These must all be written in the form \f(CW\*(C`${^Foo}\*(C'\fR; +the braces are not optional. \f(CW\*(C`${^Foo}\*(C'\fR denotes the scalar variable +whose name is considered to be a control\-\f(CW\*(C`F\*(C'\fR followed by two \f(CW\*(C`o\*(C'\fR's. +These variables are +reserved for future special uses by Perl, except for the ones that +begin with \f(CW\*(C`^_\*(C'\fR (caret-underscore). No +name that begins with \f(CW\*(C`^_\*(C'\fR will acquire a special +meaning in any future version of Perl; such names may therefore be +used safely in programs. \f(CW$^_\fR itself, however, \fIis\fR reserved. +.PP +Perl identifiers that begin with digits or +punctuation characters are exempt from the effects of the \f(CW\*(C`package\*(C'\fR +declaration and are always forced to be in package \f(CW\*(C`main\*(C'\fR; they are +also exempt from \f(CW\*(C`strict \*(Aqvars\*(Aq\*(C'\fR errors. A few other names are also +exempt in these ways: +.PP +.Vb 5 +\& ENV STDIN +\& INC STDOUT +\& ARGV STDERR +\& ARGVOUT +\& SIG +.Ve +.PP +In particular, the special \f(CW\*(C`${^_XYZ}\*(C'\fR variables are always taken +to be in package \f(CW\*(C`main\*(C'\fR, regardless of any \f(CW\*(C`package\*(C'\fR declarations +presently in scope. +.SH "SPECIAL VARIABLES" +.IX Header "SPECIAL VARIABLES" +The following names have special meaning to Perl. Most punctuation +names have reasonable mnemonics, or analogs in the shells. +Nevertheless, if you wish to use long variable names, you need only say: +.PP +.Vb 1 +\& use English; +.Ve +.PP +at the top of your program. This aliases all the short names to the long +names in the current package. Some even have medium names, generally +borrowed from \fBawk\fR. For more info, please see English. +.PP +Before you continue, note the sort order for variables. In general, we +first list the variables in case-insensitive, almost-lexigraphical +order (ignoring the \f(CW\*(C`{\*(C'\fR or \f(CW\*(C`^\*(C'\fR preceding words, as in \f(CW\*(C`${^UNICODE}\*(C'\fR +or \f(CW$^T\fR), although \f(CW$_\fR and \f(CW@_\fR move up to the top of the pile. +For variables with the same identifier, we list it in order of scalar, +array, hash, and bareword. +.SS "General Variables" +.IX Subsection "General Variables" +.ie n .IP "$ARG" 8 +.el .IP "\f(CW$ARG\fR" 8 +.IX Item "$ARG" +.PD 0 +.ie n .IP "$_" 8 +.el .IP "\f(CW$_\fR" 8 +.IX Xref "$_ $ARG" +.IX Item "$_" +.PD +The default input and pattern-searching space. The following pairs are +equivalent: +.Sp +.Vb 2 +\& while (<>) {...} # equivalent only in while! +\& while (defined($_ = <>)) {...} +\& +\& /^Subject:/ +\& $_ =~ /^Subject:/ +\& +\& tr/a\-z/A\-Z/ +\& $_ =~ tr/a\-z/A\-Z/ +\& +\& chomp +\& chomp($_) +.Ve +.Sp +Here are the places where Perl will assume \f(CW$_\fR even if you don't use it: +.RS 8 +.IP "\(bu" 3 +The following functions use \f(CW$_\fR as a default argument: +.Sp +abs, alarm, chomp, chop, chr, chroot, +cos, defined, eval, evalbytes, exp, fc, glob, hex, int, lc, +lcfirst, length, log, lstat, mkdir, oct, ord, pos, print, printf, +quotemeta, readlink, readpipe, ref, require, reverse (in scalar context only), +rmdir, say, sin, split (for its second +argument), sqrt, stat, study, uc, ucfirst, +unlink, unpack. +.IP "\(bu" 3 +All file tests (\f(CW\*(C`\-f\*(C'\fR, \f(CW\*(C`\-d\*(C'\fR) except for \f(CW\*(C`\-t\*(C'\fR, which defaults to \s-1STDIN.\s0 +See \*(L"\-X\*(R" in perlfunc +.IP "\(bu" 3 +The pattern matching operations \f(CW\*(C`m//\*(C'\fR, \f(CW\*(C`s///\*(C'\fR and \f(CW\*(C`tr///\*(C'\fR (aka \f(CW\*(C`y///\*(C'\fR) +when used without an \f(CW\*(C`=~\*(C'\fR operator. +.IP "\(bu" 3 +The default iterator variable in a \f(CW\*(C`foreach\*(C'\fR loop if no other +variable is supplied. +.IP "\(bu" 3 +The implicit iterator variable in the \f(CW\*(C`grep()\*(C'\fR and \f(CW\*(C`map()\*(C'\fR functions. +.IP "\(bu" 3 +The implicit variable of \f(CW\*(C`given()\*(C'\fR. +.IP "\(bu" 3 +The default place to put the next value or input record +when a \f(CW\*(C`\*(C'\fR, \f(CW\*(C`readline\*(C'\fR, \f(CW\*(C`readdir\*(C'\fR or \f(CW\*(C`each\*(C'\fR +operation's result is tested by itself as the sole criterion of a \f(CW\*(C`while\*(C'\fR +test. Outside a \f(CW\*(C`while\*(C'\fR test, this will not happen. +.RE +.RS 8 +.Sp +\&\f(CW$_\fR is a global variable. +.Sp +However, between perl v5.10.0 and v5.24.0, it could be used lexically by +writing \f(CW\*(C`my $_\*(C'\fR. Making \f(CW$_\fR refer to the global \f(CW$_\fR in the same scope +was then possible with \f(CW\*(C`our $_\*(C'\fR. This experimental feature was removed and is +now a fatal error, but you may encounter it in older code. +.Sp +Mnemonic: underline is understood in certain operations. +.RE +.ie n .IP "@ARG" 8 +.el .IP "\f(CW@ARG\fR" 8 +.IX Item "@ARG" +.PD 0 +.ie n .IP "@_" 8 +.el .IP "\f(CW@_\fR" 8 +.IX Xref "@_ @ARG" +.IX Item "@_" +.PD +Within a subroutine the array \f(CW@_\fR contains the parameters passed to +that subroutine. Inside a subroutine, \f(CW@_\fR is the default array for +the array operators \f(CW\*(C`pop\*(C'\fR and \f(CW\*(C`shift\*(C'\fR. +.Sp +See perlsub. +.ie n .IP "$LIST_SEPARATOR" 8 +.el .IP "\f(CW$LIST_SEPARATOR\fR" 8 +.IX Item "$LIST_SEPARATOR" +.PD 0 +.IP "$""" 8 +.IX Xref "$"" $LIST_SEPARATOR" +.PD +When an array or an array slice is interpolated into a double-quoted +string or a similar context such as \f(CW\*(C`/.../\*(C'\fR, its elements are +separated by this value. Default is a space. For example, this: +.Sp +.Vb 1 +\& print "The array is: @array\en"; +.Ve +.Sp +is equivalent to this: +.Sp +.Vb 1 +\& print "The array is: " . join($", @array) . "\en"; +.Ve +.Sp +Mnemonic: works in double-quoted context. +.ie n .IP "$PROCESS_ID" 8 +.el .IP "\f(CW$PROCESS_ID\fR" 8 +.IX Item "$PROCESS_ID" +.PD 0 +.ie n .IP "$PID" 8 +.el .IP "\f(CW$PID\fR" 8 +.IX Item "$PID" +.IP "$$" 8 +.IX Xref "$$ $PID $PROCESS_ID" +.PD +The process number of the Perl running this script. Though you \fIcan\fR set +this variable, doing so is generally discouraged, although it can be +invaluable for some testing purposes. It will be reset automatically +across \f(CW\*(C`fork()\*(C'\fR calls. +.Sp +Note for Linux and Debian GNU/kFreeBSD users: Before Perl v5.16.0 perl +would emulate \s-1POSIX\s0 semantics on Linux systems using LinuxThreads, a +partial implementation of \s-1POSIX\s0 Threads that has since been superseded +by the Native \s-1POSIX\s0 Thread Library (\s-1NPTL\s0). +.Sp +LinuxThreads is now obsolete on Linux, and caching \f(CW\*(C`getpid()\*(C'\fR +like this made embedding perl unnecessarily complex (since you'd have +to manually update the value of $$), so now \f(CW$$\fR and \f(CW\*(C`getppid()\*(C'\fR +will always return the same values as the underlying C library. +.Sp +Debian GNU/kFreeBSD systems also used LinuxThreads up until and +including the 6.0 release, but after that moved to FreeBSD thread +semantics, which are POSIX-like. +.Sp +To see if your system is affected by this discrepancy check if +\&\f(CW\*(C`getconf GNU_LIBPTHREAD_VERSION | grep \-q NPTL\*(C'\fR returns a false +value. \s-1NTPL\s0 threads preserve the \s-1POSIX\s0 semantics. +.Sp +Mnemonic: same as shells. +.ie n .IP "$PROGRAM_NAME" 8 +.el .IP "\f(CW$PROGRAM_NAME\fR" 8 +.IX Item "$PROGRAM_NAME" +.PD 0 +.ie n .IP "$0" 8 +.el .IP "\f(CW$0\fR" 8 +.IX Xref "$0 $PROGRAM_NAME" +.IX Item "$0" +.PD +Contains the name of the program being executed. +.Sp +On some (but not all) operating systems assigning to \f(CW$0\fR modifies +the argument area that the \f(CW\*(C`ps\*(C'\fR program sees. On some platforms you +may have to use special \f(CW\*(C`ps\*(C'\fR options or a different \f(CW\*(C`ps\*(C'\fR to see the +changes. Modifying the \f(CW$0\fR is more useful as a way of indicating the +current program state than it is for hiding the program you're +running. +.Sp +Note that there are platform-specific limitations on the maximum +length of \f(CW$0\fR. In the most extreme case it may be limited to the +space occupied by the original \f(CW$0\fR. +.Sp +In some platforms there may be arbitrary amount of padding, for +example space characters, after the modified name as shown by \f(CW\*(C`ps\*(C'\fR. +In some platforms this padding may extend all the way to the original +length of the argument area, no matter what you do (this is the case +for example with Linux 2.2). +.Sp +Note for \s-1BSD\s0 users: setting \f(CW$0\fR does not completely remove \*(L"perl\*(R" +from the \fBps\fR\|(1) output. For example, setting \f(CW$0\fR to \f(CW"foobar"\fR may +result in \f(CW"perl: foobar (perl)"\fR (whether both the \f(CW"perl: "\fR prefix +and the \*(L" (perl)\*(R" suffix are shown depends on your exact \s-1BSD\s0 variant +and version). This is an operating system feature, Perl cannot help it. +.Sp +In multithreaded scripts Perl coordinates the threads so that any +thread may modify its copy of the \f(CW$0\fR and the change becomes visible +to \fBps\fR\|(1) (assuming the operating system plays along). Note that +the view of \f(CW$0\fR the other threads have will not change since they +have their own copies of it. +.Sp +If the program has been given to perl via the switches \f(CW\*(C`\-e\*(C'\fR or \f(CW\*(C`\-E\*(C'\fR, +\&\f(CW$0\fR will contain the string \f(CW"\-e"\fR. +.Sp +On Linux as of perl v5.14.0 the legacy process name will be set with +\&\f(CWprctl(2)\fR, in addition to altering the \s-1POSIX\s0 name via \f(CW\*(C`argv[0]\*(C'\fR as +perl has done since version 4.000. Now system utilities that read the +legacy process name such as ps, top and killall will recognize the +name you set when assigning to \f(CW$0\fR. The string you supply will be +cut off at 16 bytes, this is a limitation imposed by Linux. +.Sp +Mnemonic: same as \fBsh\fR and \fBksh\fR. +.ie n .IP "$REAL_GROUP_ID" 8 +.el .IP "\f(CW$REAL_GROUP_ID\fR" 8 +.IX Item "$REAL_GROUP_ID" +.PD 0 +.ie n .IP "$GID" 8 +.el .IP "\f(CW$GID\fR" 8 +.IX Item "$GID" +.IP "$(" 8 +.IX Xref "$( $GID $REAL_GROUP_ID" +.PD +The real gid of this process. If you are on a machine that supports +membership in multiple groups simultaneously, gives a space separated +list of groups you are in. The first number is the one returned by +\&\f(CW\*(C`getgid()\*(C'\fR, and the subsequent ones by \f(CW\*(C`getgroups()\*(C'\fR, one of which may be +the same as the first number. +.Sp +However, a value assigned to \f(CW$(\fR must be a single number used to +set the real gid. So the value given by \f(CW$(\fR should \fInot\fR be assigned +back to \f(CW$(\fR without being forced numeric, such as by adding zero. Note +that this is different to the effective gid (\f(CW$)\fR) which does take a +list. +.Sp +You can change both the real gid and the effective gid at the same +time by using \f(CW\*(C`POSIX::setgid()\*(C'\fR. Changes +to \f(CW$(\fR require a check to \f(CW$!\fR +to detect any possible errors after an attempted change. +.Sp +Mnemonic: parentheses are used to \fIgroup\fR things. The real gid is the +group you \fIleft\fR, if you're running setgid. +.ie n .IP "$EFFECTIVE_GROUP_ID" 8 +.el .IP "\f(CW$EFFECTIVE_GROUP_ID\fR" 8 +.IX Item "$EFFECTIVE_GROUP_ID" +.PD 0 +.ie n .IP "$EGID" 8 +.el .IP "\f(CW$EGID\fR" 8 +.IX Item "$EGID" +.IP "$)" 8 +.IX Xref "$) $EGID $EFFECTIVE_GROUP_ID" +.PD +The effective gid of this process. If you are on a machine that +supports membership in multiple groups simultaneously, gives a space +separated list of groups you are in. The first number is the one +returned by \f(CW\*(C`getegid()\*(C'\fR, and the subsequent ones by \f(CW\*(C`getgroups()\*(C'\fR, +one of which may be the same as the first number. +.Sp +Similarly, a value assigned to \f(CW$)\fR must also be a space-separated +list of numbers. The first number sets the effective gid, and +the rest (if any) are passed to \f(CW\*(C`setgroups()\*(C'\fR. To get the effect of an +empty list for \f(CW\*(C`setgroups()\*(C'\fR, just repeat the new effective gid; that is, +to force an effective gid of 5 and an effectively empty \f(CW\*(C`setgroups()\*(C'\fR +list, say \f(CW\*(C` $) = "5 5" \*(C'\fR. +.Sp +You can change both the effective gid and the real gid at the same +time by using \f(CW\*(C`POSIX::setgid()\*(C'\fR (use only a single numeric argument). +Changes to \f(CW$)\fR require a check to \f(CW$!\fR to detect any possible errors +after an attempted change. +.Sp +\&\f(CW$<\fR, \f(CW$>\fR, \f(CW$(\fR and \f(CW$)\fR can be set only on +machines that support the corresponding \fIset[re][ug]\f(BIid()\fI\fR routine. \f(CW$(\fR +and \f(CW$)\fR can be swapped only on machines supporting \f(CW\*(C`setregid()\*(C'\fR. +.Sp +Mnemonic: parentheses are used to \fIgroup\fR things. The effective gid +is the group that's \fIright\fR for you, if you're running setgid. +.ie n .IP "$REAL_USER_ID" 8 +.el .IP "\f(CW$REAL_USER_ID\fR" 8 +.IX Item "$REAL_USER_ID" +.PD 0 +.ie n .IP "$UID" 8 +.el .IP "\f(CW$UID\fR" 8 +.IX Item "$UID" +.IP "$<" 8 +.IX Xref "$< $UID $REAL_USER_ID" +.PD +The real uid of this process. You can change both the real uid and the +effective uid at the same time by using \f(CW\*(C`POSIX::setuid()\*(C'\fR. Since +changes to \f(CW$<\fR require a system call, check \f(CW$!\fR after a change +attempt to detect any possible errors. +.Sp +Mnemonic: it's the uid you came \fIfrom\fR, if you're running setuid. +.ie n .IP "$EFFECTIVE_USER_ID" 8 +.el .IP "\f(CW$EFFECTIVE_USER_ID\fR" 8 +.IX Item "$EFFECTIVE_USER_ID" +.PD 0 +.ie n .IP "$EUID" 8 +.el .IP "\f(CW$EUID\fR" 8 +.IX Item "$EUID" +.IP "$>" 8 +.IX Xref "$> $EUID $EFFECTIVE_USER_ID" +.PD +The effective uid of this process. For example: +.Sp +.Vb 2 +\& $< = $>; # set real to effective uid +\& ($<,$>) = ($>,$<); # swap real and effective uids +.Ve +.Sp +You can change both the effective uid and the real uid at the same +time by using \f(CW\*(C`POSIX::setuid()\*(C'\fR. Changes to \f(CW$>\fR require a check +to \f(CW$!\fR to detect any possible errors after an attempted change. +.Sp +\&\f(CW$<\fR and \f(CW$>\fR can be swapped only on machines +supporting \f(CW\*(C`setreuid()\*(C'\fR. +.Sp +Mnemonic: it's the uid you went \fIto\fR, if you're running setuid. +.ie n .IP "$SUBSCRIPT_SEPARATOR" 8 +.el .IP "\f(CW$SUBSCRIPT_SEPARATOR\fR" 8 +.IX Item "$SUBSCRIPT_SEPARATOR" +.PD 0 +.ie n .IP "$SUBSEP" 8 +.el .IP "\f(CW$SUBSEP\fR" 8 +.IX Item "$SUBSEP" +.IP "$;" 8 +.IX Xref "$; $SUBSEP SUBSCRIPT_SEPARATOR" +.PD +The subscript separator for multidimensional array emulation. If you +refer to a hash element as +.Sp +.Vb 1 +\& $foo{$x,$y,$z} +.Ve +.Sp +it really means +.Sp +.Vb 1 +\& $foo{join($;, $x, $y, $z)} +.Ve +.Sp +But don't put +.Sp +.Vb 1 +\& @foo{$x,$y,$z} # a slice\-\-note the @ +.Ve +.Sp +which means +.Sp +.Vb 1 +\& ($foo{$x},$foo{$y},$foo{$z}) +.Ve +.Sp +Default is \*(L"\e034\*(R", the same as \s-1SUBSEP\s0 in \fBawk\fR. If your keys contain +binary data there might not be any safe value for \f(CW$;\fR. +.Sp +Consider using \*(L"real\*(R" multidimensional arrays as described +in perllol. +.Sp +Mnemonic: comma (the syntactic subscript separator) is a semi-semicolon. +.ie n .IP "$a" 8 +.el .IP "\f(CW$a\fR" 8 +.IX Item "$a" +.PD 0 +.ie n .IP "$b" 8 +.el .IP "\f(CW$b\fR" 8 +.IX Xref "$a $b" +.IX Item "$b" +.PD +Special package variables when using \f(CW\*(C`sort()\*(C'\fR, see \*(L"sort\*(R" in perlfunc. +Because of this specialness \f(CW$a\fR and \f(CW$b\fR don't need to be declared +(using \f(CW\*(C`use vars\*(C'\fR, or \f(CW\*(C`our()\*(C'\fR) even when using the \f(CW\*(C`strict \*(Aqvars\*(Aq\*(C'\fR +pragma. Don't lexicalize them with \f(CW\*(C`my $a\*(C'\fR or \f(CW\*(C`my $b\*(C'\fR if you want to +be able to use them in the \f(CW\*(C`sort()\*(C'\fR comparison block or function. +.ie n .IP "%ENV" 8 +.el .IP "\f(CW%ENV\fR" 8 +.IX Xref "%ENV" +.IX Item "%ENV" +The hash \f(CW%ENV\fR contains your current environment. Setting a +value in \f(CW\*(C`ENV\*(C'\fR changes the environment for any child processes +you subsequently \f(CW\*(C`fork()\*(C'\fR off. +.Sp +As of v5.18.0, both keys and values stored in \f(CW%ENV\fR are stringified. +.Sp +.Vb 7 +\& my $foo = 1; +\& $ENV{\*(Aqbar\*(Aq} = \e$foo; +\& if( ref $ENV{\*(Aqbar\*(Aq} ) { +\& say "Pre 5.18.0 Behaviour"; +\& } else { +\& say "Post 5.18.0 Behaviour"; +\& } +.Ve +.Sp +Previously, only child processes received stringified values: +.Sp +.Vb 2 +\& my $foo = 1; +\& $ENV{\*(Aqbar\*(Aq} = \e$foo; +\& +\& # Always printed \*(Aqnon ref\*(Aq +\& system($^X, \*(Aq\-e\*(Aq, +\& q/print ( ref $ENV{\*(Aqbar\*(Aq} ? \*(Aqref\*(Aq : \*(Aqnon ref\*(Aq ) /); +.Ve +.Sp +This happens because you can't really share arbitrary data structures with +foreign processes. +.ie n .IP "$OLD_PERL_VERSION" 8 +.el .IP "\f(CW$OLD_PERL_VERSION\fR" 8 +.IX Item "$OLD_PERL_VERSION" +.PD 0 +.IP "$]" 8 +.IX Xref "$] $OLD_PERL_VERSION" +.PD +The revision, version, and subversion of the Perl interpreter, represented +as a decimal of the form 5.XXXYYY, where \s-1XXX\s0 is the version / 1e3 and \s-1YYY\s0 +is the subversion / 1e6. For example, Perl v5.10.1 would be \*(L"5.010001\*(R". +.Sp +This variable can be used to determine whether the Perl interpreter +executing a script is in the right range of versions: +.Sp +.Vb 1 +\& warn "No PerlIO!\en" if "$]" < 5.008; +.Ve +.Sp +When comparing \f(CW$]\fR, numeric comparison operators should be used, but the +variable should be stringified first to avoid issues where its original +numeric value is inaccurate. +.Sp +See also the documentation of \f(CW\*(C`use VERSION\*(C'\fR and \f(CW\*(C`require VERSION\*(C'\fR +for a convenient way to fail if the running Perl interpreter is too old. +.Sp +See \*(L"$^V\*(R" for a representation of the Perl version as a version +object, which allows more flexible string comparisons. +.Sp +The main advantage of \f(CW$]\fR over \f(CW$^V\fR is that it works the same on any +version of Perl. The disadvantages are that it can't easily be compared +to versions in other formats (e.g. literal v\-strings, \*(L"v1.2.3\*(R" or +version objects) and numeric comparisons are subject to the binary +floating point representation; it's good for numeric literal version +checks and bad for comparing to a variable that hasn't been +sanity-checked. +.Sp +The \f(CW$OLD_PERL_VERSION\fR form was added in Perl v5.20.0 for historical +reasons but its use is discouraged. (If your reason to use \f(CW$]\fR is to +run code on old perls then referring to it as \f(CW$OLD_PERL_VERSION\fR would +be self-defeating.) +.Sp +Mnemonic: Is this version of perl in the right bracket? +.ie n .IP "$SYSTEM_FD_MAX" 8 +.el .IP "\f(CW$SYSTEM_FD_MAX\fR" 8 +.IX Item "$SYSTEM_FD_MAX" +.PD 0 +.IP "$^F" 8 +.IX Xref "$^F $SYSTEM_FD_MAX" +.IX Item "$^F" +.PD +The maximum system file descriptor, ordinarily 2. System file +descriptors are passed to \f(CW\*(C`exec()\*(C'\fRed processes, while higher file +descriptors are not. Also, during an +\&\f(CW\*(C`open()\*(C'\fR, system file descriptors are +preserved even if the \f(CW\*(C`open()\*(C'\fR fails (ordinary file descriptors are +closed before the \f(CW\*(C`open()\*(C'\fR is attempted). The close-on-exec +status of a file descriptor will be decided according to the value of +\&\f(CW$^F\fR when the corresponding file, pipe, or socket was opened, not the +time of the \f(CW\*(C`exec()\*(C'\fR. +.ie n .IP "@F" 8 +.el .IP "\f(CW@F\fR" 8 +.IX Xref "@F" +.IX Item "@F" +The array \f(CW@F\fR contains the fields of each line read in when autosplit +mode is turned on. See perlrun for the \fB\-a\fR switch. This +array is package-specific, and must be declared or given a full package +name if not in package main when running under \f(CW\*(C`strict \*(Aqvars\*(Aq\*(C'\fR. +.ie n .IP "@INC" 8 +.el .IP "\f(CW@INC\fR" 8 +.IX Xref "@INC" +.IX Item "@INC" +The array \f(CW@INC\fR contains the list of places that the \f(CW\*(C`do EXPR\*(C'\fR, +\&\f(CW\*(C`require\*(C'\fR, or \f(CW\*(C`use\*(C'\fR constructs look for their library files. It +initially consists of the arguments to any \fB\-I\fR command-line +switches, followed by the default Perl library, probably +\&\fI/usr/local/lib/perl\fR. +Prior to Perl 5.26, \f(CW\*(C`.\*(C'\fR \-which represents the current directory, was included +in \f(CW@INC\fR; it has been removed. This change in behavior is documented +in \f(CW\*(C`PERL_USE_UNSAFE_INC\*(C'\fR and it is +not recommended that \f(CW\*(C`.\*(C'\fR be re-added to \f(CW@INC\fR. +If you need to modify \f(CW@INC\fR at runtime, you should use the \f(CW\*(C`use lib\*(C'\fR pragma +to get the machine-dependent library properly loaded as well: +.Sp +.Vb 2 +\& use lib \*(Aq/mypath/libdir/\*(Aq; +\& use SomeMod; +.Ve +.Sp +You can also insert hooks into the file inclusion system by putting Perl +code directly into \f(CW@INC\fR. Those hooks may be subroutine references, +array references or blessed objects. See \*(L"require\*(R" in perlfunc for details. +.ie n .IP "%INC" 8 +.el .IP "\f(CW%INC\fR" 8 +.IX Xref "%INC" +.IX Item "%INC" +The hash \f(CW%INC\fR contains entries for each filename included via the +\&\f(CW\*(C`do\*(C'\fR, \f(CW\*(C`require\*(C'\fR, or \f(CW\*(C`use\*(C'\fR operators. The key is the filename +you specified (with module names converted to pathnames), and the +value is the location of the file found. The \f(CW\*(C`require\*(C'\fR +operator uses this hash to determine whether a particular file has +already been included. +.Sp +If the file was loaded via a hook (e.g. a subroutine reference, see +\&\*(L"require\*(R" in perlfunc for a description of these hooks), this hook is +by default inserted into \f(CW%INC\fR in place of a filename. Note, however, +that the hook may have set the \f(CW%INC\fR entry by itself to provide some more +specific info. +.ie n .IP "$INPLACE_EDIT" 8 +.el .IP "\f(CW$INPLACE_EDIT\fR" 8 +.IX Item "$INPLACE_EDIT" +.PD 0 +.IP "$^I" 8 +.IX Xref "$^I $INPLACE_EDIT" +.IX Item "$^I" +.PD +The current value of the inplace-edit extension. Use \f(CW\*(C`undef\*(C'\fR to disable +inplace editing. +.Sp +Mnemonic: value of \fB\-i\fR switch. +.ie n .IP "@ISA" 8 +.el .IP "\f(CW@ISA\fR" 8 +.IX Xref "@ISA" +.IX Item "@ISA" +Each package contains a special array called \f(CW@ISA\fR which contains a list +of that class's parent classes, if any. This array is simply a list of +scalars, each of which is a string that corresponds to a package name. The +array is examined when Perl does method resolution, which is covered in +perlobj. +.Sp +To load packages while adding them to \f(CW@ISA\fR, see the parent pragma. The +discouraged base pragma does this as well, but should not be used except +when compatibility with the discouraged fields pragma is required. +.IP "$^M" 8 +.IX Xref "$^M" +.IX Item "$^M" +By default, running out of memory is an untrappable, fatal error. +However, if suitably built, Perl can use the contents of \f(CW$^M\fR +as an emergency memory pool after \f(CW\*(C`die()\*(C'\fRing. Suppose that your Perl +were compiled with \f(CW\*(C`\-DPERL_EMERGENCY_SBRK\*(C'\fR and used Perl's malloc. +Then +.Sp +.Vb 1 +\& $^M = \*(Aqa\*(Aq x (1 << 16); +.Ve +.Sp +would allocate a 64K buffer for use in an emergency. See the +\&\fI\s-1INSTALL\s0\fR file in the Perl distribution for information on how to +add custom C compilation flags when compiling perl. To discourage casual +use of this advanced feature, there is no English long name for +this variable. +.Sp +This variable was added in Perl 5.004. +.ie n .IP "$OSNAME" 8 +.el .IP "\f(CW$OSNAME\fR" 8 +.IX Item "$OSNAME" +.PD 0 +.IP "$^O" 8 +.IX Xref "$^O $OSNAME" +.IX Item "$^O" +.PD +The name of the operating system under which this copy of Perl was +built, as determined during the configuration process. For examples +see \*(L"\s-1PLATFORMS\*(R"\s0 in perlport. +.Sp +The value is identical to \f(CW$Config{\*(Aqosname\*(Aq}\fR. See also Config +and the \fB\-V\fR command-line switch documented in perlrun. +.Sp +In Windows platforms, \f(CW$^O\fR is not very helpful: since it is always +\&\f(CW\*(C`MSWin32\*(C'\fR, it doesn't tell the difference between +95/98/ME/NT/2000/XP/CE/.NET. Use \f(CW\*(C`Win32::GetOSName()\*(C'\fR or +\&\fBWin32::GetOSVersion()\fR (see Win32 and perlport) to distinguish +between the variants. +.Sp +This variable was added in Perl 5.003. +.ie n .IP "%SIG" 8 +.el .IP "\f(CW%SIG\fR" 8 +.IX Xref "%SIG" +.IX Item "%SIG" +The hash \f(CW%SIG\fR contains signal handlers for signals. For example: +.Sp +.Vb 6 +\& sub handler { # 1st argument is signal name +\& my($sig) = @_; +\& print "Caught a SIG$sig\-\-shutting down\en"; +\& close(LOG); +\& exit(0); +\& } +\& +\& $SIG{\*(AqINT\*(Aq} = \e&handler; +\& $SIG{\*(AqQUIT\*(Aq} = \e&handler; +\& ... +\& $SIG{\*(AqINT\*(Aq} = \*(AqDEFAULT\*(Aq; # restore default action +\& $SIG{\*(AqQUIT\*(Aq} = \*(AqIGNORE\*(Aq; # ignore SIGQUIT +.Ve +.Sp +Using a value of \f(CW\*(AqIGNORE\*(Aq\fR usually has the effect of ignoring the +signal, except for the \f(CW\*(C`CHLD\*(C'\fR signal. See perlipc for more about +this special case. Using an empty string or \f(CW\*(C`undef\*(C'\fR as the value has +the same effect as \f(CW\*(AqDEFAULT\*(Aq\fR. +.Sp +Here are some other examples: +.Sp +.Vb 7 +\& $SIG{"PIPE"} = "Plumber"; # assumes main::Plumber (not +\& # recommended) +\& $SIG{"PIPE"} = \e&Plumber; # just fine; assume current +\& # Plumber +\& $SIG{"PIPE"} = *Plumber; # somewhat esoteric +\& $SIG{"PIPE"} = Plumber(); # oops, what did Plumber() +\& # return?? +.Ve +.Sp +Be sure not to use a bareword as the name of a signal handler, +lest you inadvertently call it. +.Sp +Using a string that doesn't correspond to any existing function or a +glob that doesn't contain a code slot is equivalent to \f(CW\*(AqIGNORE\*(Aq\fR, +but a warning is emitted when the handler is being called (the warning +is not emitted for the internal hooks described below). +.Sp +If your system has the \f(CW\*(C`sigaction()\*(C'\fR function then signal handlers +are installed using it. This means you get reliable signal handling. +.Sp +The default delivery policy of signals changed in Perl v5.8.0 from +immediate (also known as \*(L"unsafe\*(R") to deferred, also known as \*(L"safe +signals\*(R". See perlipc for more information. +.Sp +Certain internal hooks can be also set using the \f(CW%SIG\fR hash. The +routine indicated by \f(CW$SIG{_\|_WARN_\|_}\fR is called when a warning +message is about to be printed. The warning message is passed as the +first argument. The presence of a \f(CW\*(C`_\|_WARN_\|_\*(C'\fR hook causes the +ordinary printing of warnings to \f(CW\*(C`STDERR\*(C'\fR to be suppressed. You can +use this to save warnings in a variable, or turn warnings into fatal +errors, like this: +.Sp +.Vb 2 +\& local $SIG{_\|_WARN_\|_} = sub { die $_[0] }; +\& eval $proggie; +.Ve +.Sp +As the \f(CW\*(AqIGNORE\*(Aq\fR hook is not supported by \f(CW\*(C`_\|_WARN_\|_\*(C'\fR, its effect is +the same as using \f(CW\*(AqDEFAULT\*(Aq\fR. You can disable warnings using the +empty subroutine: +.Sp +.Vb 1 +\& local $SIG{_\|_WARN_\|_} = sub {}; +.Ve +.Sp +The routine indicated by \f(CW$SIG{_\|_DIE_\|_}\fR is called when a fatal +exception is about to be thrown. The error message is passed as the +first argument. When a \f(CW\*(C`_\|_DIE_\|_\*(C'\fR hook routine returns, the exception +processing continues as it would have in the absence of the hook, +unless the hook routine itself exits via a \f(CW\*(C`goto &sub\*(C'\fR, a loop exit, +or a \f(CW\*(C`die()\*(C'\fR. The \f(CW\*(C`_\|_DIE_\|_\*(C'\fR handler is explicitly disabled during +the call, so that you can die from a \f(CW\*(C`_\|_DIE_\|_\*(C'\fR handler. Similarly +for \f(CW\*(C`_\|_WARN_\|_\*(C'\fR. +.Sp +The \f(CW$SIG{_\|_DIE_\|_}\fR hook is called even inside an \f(CW\*(C`eval()\*(C'\fR. It was +never intended to happen this way, but an implementation glitch made +this possible. This used to be deprecated, as it allowed strange action +at a distance like rewriting a pending exception in \f(CW$@\fR. Plans to +rectify this have been scrapped, as users found that rewriting a +pending exception is actually a useful feature, and not a bug. +.Sp +The \f(CW$SIG{_\|_DIE_\|_}\fR doesn't support \f(CW\*(AqIGNORE\*(Aq\fR; it has the same +effect as \f(CW\*(AqDEFAULT\*(Aq\fR. +.Sp +\&\f(CW\*(C`_\|_DIE_\|_\*(C'\fR/\f(CW\*(C`_\|_WARN_\|_\*(C'\fR handlers are very special in one respect: they +may be called to report (probable) errors found by the parser. In such +a case the parser may be in inconsistent state, so any attempt to +evaluate Perl code from such a handler will probably result in a +segfault. This means that warnings or errors that result from parsing +Perl should be used with extreme caution, like this: +.Sp +.Vb 5 +\& require Carp if defined $^S; +\& Carp::confess("Something wrong") if defined &Carp::confess; +\& die "Something wrong, but could not load Carp to give " +\& . "backtrace...\en\et" +\& . "To see backtrace try starting Perl with \-MCarp switch"; +.Ve +.Sp +Here the first line will load \f(CW\*(C`Carp\*(C'\fR \fIunless\fR it is the parser who +called the handler. The second line will print backtrace and die if +\&\f(CW\*(C`Carp\*(C'\fR was available. The third line will be executed only if \f(CW\*(C`Carp\*(C'\fR was +not available. +.Sp +Having to even think about the \f(CW$^S\fR variable in your exception +handlers is simply wrong. \f(CW$SIG{_\|_DIE_\|_}\fR as currently implemented +invites grievous and difficult to track down errors. Avoid it +and use an \f(CW\*(C`END{}\*(C'\fR or CORE::GLOBAL::die override instead. +.Sp +See \*(L"die\*(R" in perlfunc, \*(L"warn\*(R" in perlfunc, \*(L"eval\*(R" in perlfunc, and +warnings for additional information. +.ie n .IP "$BASETIME" 8 +.el .IP "\f(CW$BASETIME\fR" 8 +.IX Item "$BASETIME" +.PD 0 +.IP "$^T" 8 +.IX Xref "$^T $BASETIME" +.IX Item "$^T" +.PD +The time at which the program began running, in seconds since the +epoch (beginning of 1970). The values returned by the \fB\-M\fR, \fB\-A\fR, +and \fB\-C\fR filetests are based on this value. +.ie n .IP "$PERL_VERSION" 8 +.el .IP "\f(CW$PERL_VERSION\fR" 8 +.IX Item "$PERL_VERSION" +.PD 0 +.IP "$^V" 8 +.IX Xref "$^V $PERL_VERSION" +.IX Item "$^V" +.PD +The revision, version, and subversion of the Perl interpreter, +represented as a version object. +.Sp +This variable first appeared in perl v5.6.0; earlier versions of perl +will see an undefined value. Before perl v5.10.0 \f(CW$^V\fR was represented +as a v\-string rather than a version object. +.Sp +\&\f(CW$^V\fR can be used to determine whether the Perl interpreter executing +a script is in the right range of versions. For example: +.Sp +.Vb 1 +\& warn "Hashes not randomized!\en" if !$^V or $^V lt v5.8.1 +.Ve +.Sp +While version objects overload stringification, to portably convert +\&\f(CW$^V\fR into its string representation, use \f(CW\*(C`sprintf()\*(C'\fR's \f(CW"%vd"\fR +conversion, which works for both v\-strings or version objects: +.Sp +.Vb 1 +\& printf "version is v%vd\en", $^V; # Perl\*(Aqs version +.Ve +.Sp +See the documentation of \f(CW\*(C`use VERSION\*(C'\fR and \f(CW\*(C`require VERSION\*(C'\fR +for a convenient way to fail if the running Perl interpreter is too old. +.Sp +See also \f(CW"$]"\fR for a decimal representation of the Perl version. +.Sp +The main advantage of \f(CW$^V\fR over \f(CW$]\fR is that, for Perl v5.10.0 or +later, it overloads operators, allowing easy comparison against other +version representations (e.g. decimal, literal v\-string, \*(L"v1.2.3\*(R", or +objects). The disadvantage is that prior to v5.10.0, it was only a +literal v\-string, which can't be easily printed or compared, whereas +the behavior of \f(CW$]\fR is unchanged on all versions of Perl. +.Sp +Mnemonic: use ^V for a version object. +.IP "${^WIN32_SLOPPY_STAT}" 8 +.IX Xref "${^WIN32_SLOPPY_STAT} sitecustomize sitecustomize.pl" +.IX Item "${^WIN32_SLOPPY_STAT}" +If this variable is set to a true value, then \f(CW\*(C`stat()\*(C'\fR on Windows will +not try to open the file. This means that the link count cannot be +determined and file attributes may be out of date if additional +hardlinks to the file exist. On the other hand, not opening the file +is considerably faster, especially for files on network drives. +.Sp +This variable could be set in the \fIsitecustomize.pl\fR file to +configure the local Perl installation to use \*(L"sloppy\*(R" \f(CW\*(C`stat()\*(C'\fR by +default. See the documentation for \fB\-f\fR in perlrun +for more information about site customization. +.Sp +This variable was added in Perl v5.10.0. +.ie n .IP "$EXECUTABLE_NAME" 8 +.el .IP "\f(CW$EXECUTABLE_NAME\fR" 8 +.IX Item "$EXECUTABLE_NAME" +.PD 0 +.IP "$^X" 8 +.IX Xref "$^X $EXECUTABLE_NAME" +.IX Item "$^X" +.PD +The name used to execute the current copy of Perl, from C's +\&\f(CW\*(C`argv[0]\*(C'\fR or (where supported) \fI/proc/self/exe\fR. +.Sp +Depending on the host operating system, the value of \f(CW$^X\fR may be +a relative or absolute pathname of the perl program file, or may +be the string used to invoke perl but not the pathname of the +perl program file. Also, most operating systems permit invoking +programs that are not in the \s-1PATH\s0 environment variable, so there +is no guarantee that the value of \f(CW$^X\fR is in \s-1PATH.\s0 For \s-1VMS,\s0 the +value may or may not include a version number. +.Sp +You usually can use the value of \f(CW$^X\fR to re-invoke an independent +copy of the same perl that is currently running, e.g., +.Sp +.Vb 1 +\& @first_run = \`$^X \-le "print int rand 100 for 1..100"\`; +.Ve +.Sp +But recall that not all operating systems support forking or +capturing of the output of commands, so this complex statement +may not be portable. +.Sp +It is not safe to use the value of \f(CW$^X\fR as a path name of a file, +as some operating systems that have a mandatory suffix on +executable files do not require use of the suffix when invoking +a command. To convert the value of \f(CW$^X\fR to a path name, use the +following statements: +.Sp +.Vb 7 +\& # Build up a set of file names (not command names). +\& use Config; +\& my $this_perl = $^X; +\& if ($^O ne \*(AqVMS\*(Aq) { +\& $this_perl .= $Config{_exe} +\& unless $this_perl =~ m/$Config{_exe}$/i; +\& } +.Ve +.Sp +Because many operating systems permit anyone with read access to +the Perl program file to make a copy of it, patch the copy, and +then execute the copy, the security-conscious Perl programmer +should take care to invoke the installed copy of perl, not the +copy referenced by \f(CW$^X\fR. The following statements accomplish +this goal, and produce a pathname that can be invoked as a +command or referenced as a file. +.Sp +.Vb 6 +\& use Config; +\& my $secure_perl_path = $Config{perlpath}; +\& if ($^O ne \*(AqVMS\*(Aq) { +\& $secure_perl_path .= $Config{_exe} +\& unless $secure_perl_path =~ m/$Config{_exe}$/i; +\& } +.Ve +.SS "Variables related to regular expressions" +.IX Subsection "Variables related to regular expressions" +Most of the special variables related to regular expressions are side +effects. Perl sets these variables when it has a successful match, so +you should check the match result before using them. For instance: +.PP +.Vb 3 +\& if( /P(A)TT(ER)N/ ) { +\& print "I found $1 and $2\en"; +\& } +.Ve +.PP +These variables are read-only and dynamically-scoped, unless we note +otherwise. +.PP +The dynamic nature of the regular expression variables means that +their value is limited to the block that they are in, as demonstrated +by this bit of code: +.PP +.Vb 2 +\& my $outer = \*(AqWallace and Grommit\*(Aq; +\& my $inner = \*(AqMutt and Jeff\*(Aq; +\& +\& my $pattern = qr/(\eS+) and (\eS+)/; +\& +\& sub show_n { print "\e$1 is $1; \e$2 is $2\en" } +\& +\& { +\& OUTER: +\& show_n() if $outer =~ m/$pattern/; +\& +\& INNER: { +\& show_n() if $inner =~ m/$pattern/; +\& } +\& +\& show_n(); +\& } +.Ve +.PP +The output shows that while in the \f(CW\*(C`OUTER\*(C'\fR block, the values of \f(CW$1\fR +and \f(CW$2\fR are from the match against \f(CW$outer\fR. Inside the \f(CW\*(C`INNER\*(C'\fR +block, the values of \f(CW$1\fR and \f(CW$2\fR are from the match against +\&\f(CW$inner\fR, but only until the end of the block (i.e. the dynamic +scope). After the \f(CW\*(C`INNER\*(C'\fR block completes, the values of \f(CW$1\fR and +\&\f(CW$2\fR return to the values for the match against \f(CW$outer\fR even though +we have not made another match: +.PP +.Vb 3 +\& $1 is Wallace; $2 is Grommit +\& $1 is Mutt; $2 is Jeff +\& $1 is Wallace; $2 is Grommit +.Ve +.PP +\fIPerformance issues\fR +.IX Subsection "Performance issues" +.PP +Traditionally in Perl, any use of any of the three variables \f(CW\*(C`$\`\*(C'\fR, \f(CW$&\fR +or \f(CW\*(C`$\*(Aq\*(C'\fR (or their \f(CW\*(C`use English\*(C'\fR equivalents) anywhere in the code, caused +all subsequent successful pattern matches to make a copy of the matched +string, in case the code might subsequently access one of those variables. +This imposed a considerable performance penalty across the whole program, +so generally the use of these variables has been discouraged. +.PP +In Perl 5.6.0 the \f(CW\*(C`@\-\*(C'\fR and \f(CW\*(C`@+\*(C'\fR dynamic arrays were introduced that +supply the indices of successful matches. So you could for example do +this: +.PP +.Vb 1 +\& $str =~ /pattern/; +\& +\& print $\`, $&, $\*(Aq; # bad: performance hit +\& +\& print # good: no performance hit +\& substr($str, 0, $\-[0]), +\& substr($str, $\-[0], $+[0]\-$\-[0]), +\& substr($str, $+[0]); +.Ve +.PP +In Perl 5.10.0 the \f(CW\*(C`/p\*(C'\fR match operator flag and the \f(CW\*(C`${^PREMATCH}\*(C'\fR, +\&\f(CW\*(C`${^MATCH}\*(C'\fR, and \f(CW\*(C`${^POSTMATCH}\*(C'\fR variables were introduced, that allowed +you to suffer the penalties only on patterns marked with \f(CW\*(C`/p\*(C'\fR. +.PP +In Perl 5.18.0 onwards, perl started noting the presence of each of the +three variables separately, and only copied that part of the string +required; so in +.PP +.Vb 1 +\& $\`; $&; "abcdefgh" =~ /d/ +.Ve +.PP +perl would only copy the \*(L"abcd\*(R" part of the string. That could make a big +difference in something like +.PP +.Vb 3 +\& $str = \*(Aqx\*(Aq x 1_000_000; +\& $&; # whoops +\& $str =~ /x/g # one char copied a million times, not a million chars +.Ve +.PP +In Perl 5.20.0 a new copy-on-write system was enabled by default, which +finally fixes all performance issues with these three variables, and makes +them safe to use anywhere. +.PP +The \f(CW\*(C`Devel::NYTProf\*(C'\fR and \f(CW\*(C`Devel::FindAmpersand\*(C'\fR modules can help you +find uses of these problematic match variables in your code. +.ie n .IP "$<\fIdigits\fR> ($1, $2, ...)" 8 +.el .IP "$<\fIdigits\fR> ($1, \f(CW$2\fR, ...)" 8 +.IX Xref "$1 $2 $3 $\\f(ISdigits\\f(IE" +.IX Item "$ ($1, $2, ...)" +Contains the subpattern from the corresponding set of capturing +parentheses from the last successful pattern match, not counting patterns +matched in nested blocks that have been exited already. +.Sp +Note there is a distinction between a capture buffer which matches +the empty string a capture buffer which is optional. Eg, \f(CW\*(C`(x?)\*(C'\fR and +\&\f(CW\*(C`(x)?\*(C'\fR The latter may be undef, the former not. +.Sp +These variables are read-only and dynamically-scoped. +.Sp +Mnemonic: like \edigits. +.IP "@{^CAPTURE}" 8 +.IX Xref "@{^CAPTURE} @^CAPTURE" +.IX Item "@{^CAPTURE}" +An array which exposes the contents of the capture buffers, if any, of +the last successful pattern match, not counting patterns matched +in nested blocks that have been exited already. +.Sp +Note that the 0 index of @{^CAPTURE} is equivalent to \f(CW$1\fR, the 1 index +is equivalent to \f(CW$2\fR, etc. +.Sp +.Vb 3 +\& if ("foal"=~/(.)(.)(.)(.)/) { +\& print join "\-", @{^CAPTURE}; +\& } +.Ve +.Sp +should output \*(L"f\-o-a-l\*(R". +.Sp +See also "$<\fIdigits\fR> ($1, \f(CW$2\fR, ...)", \*(L"%{^CAPTURE}\*(R" and +\&\*(L"%{^CAPTURE_ALL}\*(R". +.Sp +Note that unlike most other regex magic variables there is no single +letter equivalent to \f(CW\*(C`@{^CAPTURE}\*(C'\fR. +.Sp +This variable was added in 5.25.7 +.ie n .IP "$MATCH" 8 +.el .IP "\f(CW$MATCH\fR" 8 +.IX Item "$MATCH" +.PD 0 +.IP "$&" 8 +.IX Xref "$& $MATCH" +.PD +The string matched by the last successful pattern match (not counting +any matches hidden within a \s-1BLOCK\s0 or \f(CW\*(C`eval()\*(C'\fR enclosed by the current +\&\s-1BLOCK\s0). +.Sp +See \*(L"Performance issues\*(R" above for the serious performance implications +of using this variable (even once) in your code. +.Sp +This variable is read-only and dynamically-scoped. +.Sp +Mnemonic: like \f(CW\*(C`&\*(C'\fR in some editors. +.IP "${^MATCH}" 8 +.IX Xref "${^MATCH}" +.IX Item "${^MATCH}" +This is similar to \f(CW$&\fR (\f(CW$MATCH\fR) except that it does not incur the +performance penalty associated with that variable. +.Sp +See \*(L"Performance issues\*(R" above. +.Sp +In Perl v5.18 and earlier, it is only guaranteed +to return a defined value when the pattern was compiled or executed with +the \f(CW\*(C`/p\*(C'\fR modifier. In Perl v5.20, the \f(CW\*(C`/p\*(C'\fR modifier does nothing, so +\&\f(CW\*(C`${^MATCH}\*(C'\fR does the same thing as \f(CW$MATCH\fR. +.Sp +This variable was added in Perl v5.10.0. +.Sp +This variable is read-only and dynamically-scoped. +.ie n .IP "$PREMATCH" 8 +.el .IP "\f(CW$PREMATCH\fR" 8 +.IX Item "$PREMATCH" +.PD 0 +.IP "$`" 8 +.IX Xref "$` $PREMATCH ${^PREMATCH}" +.PD +The string preceding whatever was matched by the last successful +pattern match, not counting any matches hidden within a \s-1BLOCK\s0 or \f(CW\*(C`eval\*(C'\fR +enclosed by the current \s-1BLOCK.\s0 +.Sp +See \*(L"Performance issues\*(R" above for the serious performance implications +of using this variable (even once) in your code. +.Sp +This variable is read-only and dynamically-scoped. +.Sp +Mnemonic: \f(CW\*(C`\`\*(C'\fR often precedes a quoted string. +.IP "${^PREMATCH}" 8 +.IX Xref "$` ${^PREMATCH}" +.IX Item "${^PREMATCH}" +This is similar to \f(CW\*(C`$\`\*(C'\fR ($PREMATCH) except that it does not incur the +performance penalty associated with that variable. +.Sp +See \*(L"Performance issues\*(R" above. +.Sp +In Perl v5.18 and earlier, it is only guaranteed +to return a defined value when the pattern was compiled or executed with +the \f(CW\*(C`/p\*(C'\fR modifier. In Perl v5.20, the \f(CW\*(C`/p\*(C'\fR modifier does nothing, so +\&\f(CW\*(C`${^PREMATCH}\*(C'\fR does the same thing as \f(CW$PREMATCH\fR. +.Sp +This variable was added in Perl v5.10.0. +.Sp +This variable is read-only and dynamically-scoped. +.ie n .IP "$POSTMATCH" 8 +.el .IP "\f(CW$POSTMATCH\fR" 8 +.IX Item "$POSTMATCH" +.PD 0 +.IP "$'" 8 +.IX Xref "$' $POSTMATCH ${^POSTMATCH} @-" +.PD +The string following whatever was matched by the last successful +pattern match (not counting any matches hidden within a \s-1BLOCK\s0 or \f(CW\*(C`eval()\*(C'\fR +enclosed by the current \s-1BLOCK\s0). Example: +.Sp +.Vb 3 +\& local $_ = \*(Aqabcdefghi\*(Aq; +\& /def/; +\& print "$\`:$&:$\*(Aq\en"; # prints abc:def:ghi +.Ve +.Sp +See \*(L"Performance issues\*(R" above for the serious performance implications +of using this variable (even once) in your code. +.Sp +This variable is read-only and dynamically-scoped. +.Sp +Mnemonic: \f(CW\*(C`\*(Aq\*(C'\fR often follows a quoted string. +.IP "${^POSTMATCH}" 8 +.IX Xref "${^POSTMATCH} $' $POSTMATCH" +.IX Item "${^POSTMATCH}" +This is similar to \f(CW\*(C`$\*(Aq\*(C'\fR (\f(CW$POSTMATCH\fR) except that it does not incur the +performance penalty associated with that variable. +.Sp +See \*(L"Performance issues\*(R" above. +.Sp +In Perl v5.18 and earlier, it is only guaranteed +to return a defined value when the pattern was compiled or executed with +the \f(CW\*(C`/p\*(C'\fR modifier. In Perl v5.20, the \f(CW\*(C`/p\*(C'\fR modifier does nothing, so +\&\f(CW\*(C`${^POSTMATCH}\*(C'\fR does the same thing as \f(CW$POSTMATCH\fR. +.Sp +This variable was added in Perl v5.10.0. +.Sp +This variable is read-only and dynamically-scoped. +.ie n .IP "$LAST_PAREN_MATCH" 8 +.el .IP "\f(CW$LAST_PAREN_MATCH\fR" 8 +.IX Item "$LAST_PAREN_MATCH" +.PD 0 +.IP "$+" 8 +.IX Xref "$+ $LAST_PAREN_MATCH" +.PD +The text matched by the highest used capture group of the last +successful search pattern. It is logically equivalent to the highest +numbered capture variable (\f(CW$1\fR, \f(CW$2\fR, ...) which has a defined value. +.Sp +This is useful if you don't know which one of a set of alternative patterns +matched. For example: +.Sp +.Vb 1 +\& /Version: (.*)|Revision: (.*)/ && ($rev = $+); +.Ve +.Sp +This variable is read-only and dynamically-scoped. +.Sp +Mnemonic: be positive and forward looking. +.ie n .IP "$LAST_SUBMATCH_RESULT" 8 +.el .IP "\f(CW$LAST_SUBMATCH_RESULT\fR" 8 +.IX Item "$LAST_SUBMATCH_RESULT" +.PD 0 +.IP "$^N" 8 +.IX Xref "$^N $LAST_SUBMATCH_RESULT" +.IX Item "$^N" +.PD +The text matched by the used group most-recently closed (i.e. the group +with the rightmost closing parenthesis) of the last successful search +pattern. This is subtly different from \f(CW$+\fR. For example in +.Sp +.Vb 1 +\& "ab" =~ /^((.)(.))$/ +.Ve +.Sp +we have +.Sp +.Vb 3 +\& $1,$^N have the value "ab" +\& $2 has the value "a" +\& $3,$+ have the value "b" +.Ve +.Sp +This is primarily used inside \f(CW\*(C`(?{...})\*(C'\fR blocks for examining text +recently matched. For example, to effectively capture text to a variable +(in addition to \f(CW$1\fR, \f(CW$2\fR, etc.), replace \f(CW\*(C`(...)\*(C'\fR with +.Sp +.Vb 1 +\& (?:(...)(?{ $var = $^N })) +.Ve +.Sp +By setting and then using \f(CW$var\fR in this way relieves you from having to +worry about exactly which numbered set of parentheses they are. +.Sp +This variable was added in Perl v5.8.0. +.Sp +Mnemonic: the (possibly) Nested parenthesis that most recently closed. +.ie n .IP "@LAST_MATCH_END" 8 +.el .IP "\f(CW@LAST_MATCH_END\fR" 8 +.IX Item "@LAST_MATCH_END" +.PD 0 +.IP "@+" 8 +.IX Xref "@+ @LAST_MATCH_END" +.PD +This array holds the offsets of the ends of the last successful +submatches in the currently active dynamic scope. \f(CW$+[0]\fR is +the offset into the string of the end of the entire match. This +is the same value as what the \f(CW\*(C`pos\*(C'\fR function returns when called +on the variable that was matched against. The \fIn\fRth element +of this array holds the offset of the \fIn\fRth submatch, so +\&\f(CW$+[1]\fR is the offset past where \f(CW$1\fR ends, \f(CW$+[2]\fR the offset +past where \f(CW$2\fR ends, and so on. You can use \f(CW$#+\fR to determine +how many subgroups were in the last successful match. See the +examples given for the \f(CW\*(C`@\-\*(C'\fR variable. +.Sp +This variable was added in Perl v5.6.0. +.IP "%{^CAPTURE}" 8 +.IX Item "%{^CAPTURE}" +.PD 0 +.ie n .IP "%LAST_PAREN_MATCH" 8 +.el .IP "\f(CW%LAST_PAREN_MATCH\fR" 8 +.IX Item "%LAST_PAREN_MATCH" +.IP "%+" 8 +.IX Xref "%+ %LAST_PAREN_MATCH %{^CAPTURE}" +.PD +Similar to \f(CW\*(C`@+\*(C'\fR, the \f(CW\*(C`%+\*(C'\fR hash allows access to the named capture +buffers, should they exist, in the last successful match in the +currently active dynamic scope. +.Sp +For example, \f(CW$+{foo}\fR is equivalent to \f(CW$1\fR after the following match: +.Sp +.Vb 1 +\& \*(Aqfoo\*(Aq =~ /(?foo)/; +.Ve +.Sp +The keys of the \f(CW\*(C`%+\*(C'\fR hash list only the names of buffers that have +captured (and that are thus associated to defined values). +.Sp +If multiple distinct capture groups have the same name, then +\&\f(CW$+{NAME}\fR will refer to the leftmost defined group in the match. +.Sp +The underlying behaviour of \f(CW\*(C`%+\*(C'\fR is provided by the +Tie::Hash::NamedCapture module. +.Sp +\&\fBNote:\fR \f(CW\*(C`%\-\*(C'\fR and \f(CW\*(C`%+\*(C'\fR are tied views into a common internal hash +associated with the last successful regular expression. Therefore mixing +iterative access to them via \f(CW\*(C`each\*(C'\fR may have unpredictable results. +Likewise, if the last successful match changes, then the results may be +surprising. +.Sp +This variable was added in Perl v5.10.0. The \f(CW\*(C`%{^CAPTURE}\*(C'\fR alias was +added in 5.25.7. +.Sp +This variable is read-only and dynamically-scoped. +.ie n .IP "@LAST_MATCH_START" 8 +.el .IP "\f(CW@LAST_MATCH_START\fR" 8 +.IX Item "@LAST_MATCH_START" +.PD 0 +.IP "@\-" 8 +.IX Xref "@- @LAST_MATCH_START" +.PD +\&\f(CW\*(C`$\-[0]\*(C'\fR is the offset of the start of the last successful match. +\&\f(CW\*(C`$\-[\f(CIn\f(CW]\*(C'\fR is the offset of the start of the substring matched by +\&\fIn\fR\-th subpattern, or undef if the subpattern did not match. +.Sp +Thus, after a match against \f(CW$_\fR, \f(CW$&\fR coincides with \f(CW\*(C`substr $_, $\-[0], +$+[0] \- $\-[0]\*(C'\fR. Similarly, $\fIn\fR coincides with \f(CW\*(C`substr $_, $\-[n], +$+[n] \- $\-[n]\*(C'\fR if \f(CW\*(C`$\-[n]\*(C'\fR is defined, and $+ coincides with +\&\f(CW\*(C`substr $_, $\-[$#\-], $+[$#\-] \- $\-[$#\-]\*(C'\fR. One can use \f(CW\*(C`$#\-\*(C'\fR to find the +last matched subgroup in the last successful match. Contrast with +\&\f(CW$#+\fR, the number of subgroups in the regular expression. Compare +with \f(CW\*(C`@+\*(C'\fR. +.Sp +This array holds the offsets of the beginnings of the last +successful submatches in the currently active dynamic scope. +\&\f(CW\*(C`$\-[0]\*(C'\fR is the offset into the string of the beginning of the +entire match. The \fIn\fRth element of this array holds the offset +of the \fIn\fRth submatch, so \f(CW\*(C`$\-[1]\*(C'\fR is the offset where \f(CW$1\fR +begins, \f(CW\*(C`$\-[2]\*(C'\fR the offset where \f(CW$2\fR begins, and so on. +.Sp +After a match against some variable \f(CW$var\fR: +.RS 8 +.ie n .IP """$\`"" is the same as ""substr($var, 0, $\-[0])""" 5 +.el .IP "\f(CW$\`\fR is the same as \f(CWsubstr($var, 0, $\-[0])\fR" 5 +.IX Item "$ is the same as substr($var, 0, $-[0])" +.PD 0 +.ie n .IP "$& is the same as ""substr($var, $\-[0], $+[0] \- $\-[0])""" 5 +.el .IP "\f(CW$&\fR is the same as \f(CWsubstr($var, $\-[0], $+[0] \- $\-[0])\fR" 5 +.IX Item "$& is the same as substr($var, $-[0], $+[0] - $-[0])" +.ie n .IP """$\*(Aq"" is the same as ""substr($var, $+[0])""" 5 +.el .IP "\f(CW$\*(Aq\fR is the same as \f(CWsubstr($var, $+[0])\fR" 5 +.IX Item "$ is the same as substr($var, $+[0])" +.ie n .IP "$1 is the same as ""substr($var, $\-[1], $+[1] \- $\-[1])""" 5 +.el .IP "\f(CW$1\fR is the same as \f(CWsubstr($var, $\-[1], $+[1] \- $\-[1])\fR" 5 +.IX Item "$1 is the same as substr($var, $-[1], $+[1] - $-[1])" +.ie n .IP "$2 is the same as ""substr($var, $\-[2], $+[2] \- $\-[2])""" 5 +.el .IP "\f(CW$2\fR is the same as \f(CWsubstr($var, $\-[2], $+[2] \- $\-[2])\fR" 5 +.IX Item "$2 is the same as substr($var, $-[2], $+[2] - $-[2])" +.ie n .IP "$3 is the same as ""substr($var, $\-[3], $+[3] \- $\-[3])""" 5 +.el .IP "\f(CW$3\fR is the same as \f(CWsubstr($var, $\-[3], $+[3] \- $\-[3])\fR" 5 +.IX Item "$3 is the same as substr($var, $-[3], $+[3] - $-[3])" +.RE +.RS 8 +.PD +.Sp +This variable was added in Perl v5.6.0. +.RE +.IP "%{^CAPTURE_ALL}" 8 +.IX Xref "%{^CAPTURE_ALL}" +.IX Item "%{^CAPTURE_ALL}" +.PD 0 +.IP "%\-" 8 +.IX Xref "%-" +.PD +Similar to \f(CW\*(C`%+\*(C'\fR, this variable allows access to the named capture groups +in the last successful match in the currently active dynamic scope. To +each capture group name found in the regular expression, it associates a +reference to an array containing the list of values captured by all +buffers with that name (should there be several of them), in the order +where they appear. +.Sp +Here's an example: +.Sp +.Vb 12 +\& if (\*(Aq1234\*(Aq =~ /(?1)(?2)(?3)(?4)/) { +\& foreach my $bufname (sort keys %\-) { +\& my $ary = $\-{$bufname}; +\& foreach my $idx (0..$#$ary) { +\& print "\e$\-{$bufname}[$idx] : ", +\& (defined($ary\->[$idx]) +\& ? "\*(Aq$ary\->[$idx]\*(Aq" +\& : "undef"), +\& "\en"; +\& } +\& } +\& } +.Ve +.Sp +would print out: +.Sp +.Vb 4 +\& $\-{A}[0] : \*(Aq1\*(Aq +\& $\-{A}[1] : \*(Aq3\*(Aq +\& $\-{B}[0] : \*(Aq2\*(Aq +\& $\-{B}[1] : \*(Aq4\*(Aq +.Ve +.Sp +The keys of the \f(CW\*(C`%\-\*(C'\fR hash correspond to all buffer names found in +the regular expression. +.Sp +The behaviour of \f(CW\*(C`%\-\*(C'\fR is implemented via the +Tie::Hash::NamedCapture module. +.Sp +\&\fBNote:\fR \f(CW\*(C`%\-\*(C'\fR and \f(CW\*(C`%+\*(C'\fR are tied views into a common internal hash +associated with the last successful regular expression. Therefore mixing +iterative access to them via \f(CW\*(C`each\*(C'\fR may have unpredictable results. +Likewise, if the last successful match changes, then the results may be +surprising. +.Sp +This variable was added in Perl v5.10.0. The \f(CW\*(C`%{^CAPTURE_ALL}\*(C'\fR alias was +added in 5.25.7. +.Sp +This variable is read-only and dynamically-scoped. +.ie n .IP "$LAST_REGEXP_CODE_RESULT" 8 +.el .IP "\f(CW$LAST_REGEXP_CODE_RESULT\fR" 8 +.IX Item "$LAST_REGEXP_CODE_RESULT" +.PD 0 +.IP "$^R" 8 +.IX Xref "$^R $LAST_REGEXP_CODE_RESULT" +.IX Item "$^R" +.PD +The result of evaluation of the last successful \f(CW\*(C`(?{ code })\*(C'\fR +regular expression assertion (see perlre). May be written to. +.Sp +This variable was added in Perl 5.005. +.IP "${^RE_COMPILE_RECURSION_LIMIT}" 8 +.IX Xref "${^RE_COMPILE_RECURSION_LIMIT}" +.IX Item "${^RE_COMPILE_RECURSION_LIMIT}" +The current value giving the maximum number of open but unclosed +parenthetical groups there may be at any point during a regular +expression compilation. The default is currently 1000 nested groups. +You may adjust it depending on your needs and the amount of memory +available. +.Sp +This variable was added in Perl v5.30.0. +.IP "${^RE_DEBUG_FLAGS}" 8 +.IX Xref "${^RE_DEBUG_FLAGS}" +.IX Item "${^RE_DEBUG_FLAGS}" +The current value of the regex debugging flags. Set to 0 for no debug output +even when the \f(CW\*(C`re \*(Aqdebug\*(Aq\*(C'\fR module is loaded. See re for details. +.Sp +This variable was added in Perl v5.10.0. +.IP "${^RE_TRIE_MAXBUF}" 8 +.IX Xref "${^RE_TRIE_MAXBUF}" +.IX Item "${^RE_TRIE_MAXBUF}" +Controls how certain regex optimisations are applied and how much memory they +utilize. This value by default is 65536 which corresponds to a 512kB +temporary cache. Set this to a higher value to trade +memory for speed when matching large alternations. Set +it to a lower value if you want the optimisations to +be as conservative of memory as possible but still occur, and set it to a +negative value to prevent the optimisation and conserve the most memory. +Under normal situations this variable should be of no interest to you. +.Sp +This variable was added in Perl v5.10.0. +.SS "Variables related to filehandles" +.IX Subsection "Variables related to filehandles" +Variables that depend on the currently selected filehandle may be set +by calling an appropriate object method on the \f(CW\*(C`IO::Handle\*(C'\fR object, +although this is less efficient than using the regular built-in +variables. (Summary lines below for this contain the word \s-1HANDLE.\s0) +First you must say +.PP +.Vb 1 +\& use IO::Handle; +.Ve +.PP +after which you may use either +.PP +.Vb 1 +\& method HANDLE EXPR +.Ve +.PP +or more safely, +.PP +.Vb 1 +\& HANDLE\->method(EXPR) +.Ve +.PP +Each method returns the old value of the \f(CW\*(C`IO::Handle\*(C'\fR attribute. The +methods each take an optional \s-1EXPR,\s0 which, if supplied, specifies the +new value for the \f(CW\*(C`IO::Handle\*(C'\fR attribute in question. If not +supplied, most methods do nothing to the current value\*(--except for +\&\f(CW\*(C`autoflush()\*(C'\fR, which will assume a 1 for you, just to be different. +.PP +Because loading in the \f(CW\*(C`IO::Handle\*(C'\fR class is an expensive operation, +you should learn how to use the regular built-in variables. +.PP +A few of these variables are considered \*(L"read-only\*(R". This means that +if you try to assign to this variable, either directly or indirectly +through a reference, you'll raise a run-time exception. +.PP +You should be very careful when modifying the default values of most +special variables described in this document. In most cases you want +to localize these variables before changing them, since if you don't, +the change may affect other modules which rely on the default values +of the special variables that you have changed. This is one of the +correct ways to read the whole file at once: +.PP +.Vb 4 +\& open my $fh, "<", "foo" or die $!; +\& local $/; # enable localized slurp mode +\& my $content = <$fh>; +\& close $fh; +.Ve +.PP +But the following code is quite bad: +.PP +.Vb 4 +\& open my $fh, "<", "foo" or die $!; +\& undef $/; # enable slurp mode +\& my $content = <$fh>; +\& close $fh; +.Ve +.PP +since some other module, may want to read data from some file in the +default \*(L"line mode\*(R", so if the code we have just presented has been +executed, the global value of \f(CW$/\fR is now changed for any other code +running inside the same Perl interpreter. +.PP +Usually when a variable is localized you want to make sure that this +change affects the shortest scope possible. So unless you are already +inside some short \f(CW\*(C`{}\*(C'\fR block, you should create one yourself. For +example: +.PP +.Vb 7 +\& my $content = \*(Aq\*(Aq; +\& open my $fh, "<", "foo" or die $!; +\& { +\& local $/; +\& $content = <$fh>; +\& } +\& close $fh; +.Ve +.PP +Here is an example of how your own code can go broken: +.PP +.Vb 5 +\& for ( 1..3 ){ +\& $\e = "\er\en"; +\& nasty_break(); +\& print "$_"; +\& } +\& +\& sub nasty_break { +\& $\e = "\ef"; +\& # do something with $_ +\& } +.Ve +.PP +You probably expect this code to print the equivalent of +.PP +.Vb 1 +\& "1\er\en2\er\en3\er\en" +.Ve +.PP +but instead you get: +.PP +.Vb 1 +\& "1\ef2\ef3\ef" +.Ve +.PP +Why? Because \f(CW\*(C`nasty_break()\*(C'\fR modifies \f(CW\*(C`$\e\*(C'\fR without localizing it +first. The value you set in \f(CW\*(C`nasty_break()\*(C'\fR is still there when you +return. The fix is to add \f(CW\*(C`local()\*(C'\fR so the value doesn't leak out of +\&\f(CW\*(C`nasty_break()\*(C'\fR: +.PP +.Vb 1 +\& local $\e = "\ef"; +.Ve +.PP +It's easy to notice the problem in such a short example, but in more +complicated code you are looking for trouble if you don't localize +changes to the special variables. +.ie n .IP "$ARGV" 8 +.el .IP "\f(CW$ARGV\fR" 8 +.IX Xref "$ARGV" +.IX Item "$ARGV" +Contains the name of the current file when reading from \f(CW\*(C`<>\*(C'\fR. +.ie n .IP "@ARGV" 8 +.el .IP "\f(CW@ARGV\fR" 8 +.IX Xref "@ARGV" +.IX Item "@ARGV" +The array \f(CW@ARGV\fR contains the command-line arguments intended for +the script. \f(CW$#ARGV\fR is generally the number of arguments minus +one, because \f(CW$ARGV[0]\fR is the first argument, \fInot\fR the program's +command name itself. See \*(L"$0\*(R" for the command name. +.IP "\s-1ARGV\s0" 8 +.IX Xref "ARGV" +.IX Item "ARGV" +The special filehandle that iterates over command-line filenames in +\&\f(CW@ARGV\fR. Usually written as the null filehandle in the angle operator +\&\f(CW\*(C`<>\*(C'\fR. Note that currently \f(CW\*(C`ARGV\*(C'\fR only has its magical effect +within the \f(CW\*(C`<>\*(C'\fR operator; elsewhere it is just a plain filehandle +corresponding to the last file opened by \f(CW\*(C`<>\*(C'\fR. In particular, +passing \f(CW\*(C`\e*ARGV\*(C'\fR as a parameter to a function that expects a filehandle +may not cause your function to automatically read the contents of all the +files in \f(CW@ARGV\fR. +.IP "\s-1ARGVOUT\s0" 8 +.IX Xref "ARGVOUT" +.IX Item "ARGVOUT" +The special filehandle that points to the currently open output file +when doing edit-in-place processing with \fB\-i\fR. Useful when you have +to do a lot of inserting and don't want to keep modifying \f(CW$_\fR. See +perlrun for the \fB\-i\fR switch. +.IP "IO::Handle\->output_field_separator( \s-1EXPR\s0 )" 8 +.IX Item "IO::Handle->output_field_separator( EXPR )" +.PD 0 +.ie n .IP "$OUTPUT_FIELD_SEPARATOR" 8 +.el .IP "\f(CW$OUTPUT_FIELD_SEPARATOR\fR" 8 +.IX Item "$OUTPUT_FIELD_SEPARATOR" +.ie n .IP "$OFS" 8 +.el .IP "\f(CW$OFS\fR" 8 +.IX Item "$OFS" +.IP "$," 8 +.IX Xref "$, $OFS $OUTPUT_FIELD_SEPARATOR" +.PD +The output field separator for the print operator. If defined, this +value is printed between each of print's arguments. Default is \f(CW\*(C`undef\*(C'\fR. +.Sp +You cannot call \f(CW\*(C`output_field_separator()\*(C'\fR on a handle, only as a +static method. See IO::Handle. +.Sp +Mnemonic: what is printed when there is a \*(L",\*(R" in your print statement. +.IP "\s-1HANDLE\-\s0>input_line_number( \s-1EXPR\s0 )" 8 +.IX Item "HANDLE->input_line_number( EXPR )" +.PD 0 +.ie n .IP "$INPUT_LINE_NUMBER" 8 +.el .IP "\f(CW$INPUT_LINE_NUMBER\fR" 8 +.IX Item "$INPUT_LINE_NUMBER" +.ie n .IP "$NR" 8 +.el .IP "\f(CW$NR\fR" 8 +.IX Item "$NR" +.IP "$." 8 +.IX Xref "$. $NR $INPUT_LINE_NUMBER line number" +.PD +Current line number for the last filehandle accessed. +.Sp +Each filehandle in Perl counts the number of lines that have been read +from it. (Depending on the value of \f(CW$/\fR, Perl's idea of what +constitutes a line may not match yours.) When a line is read from a +filehandle (via \f(CW\*(C`readline()\*(C'\fR or \f(CW\*(C`<>\*(C'\fR), or when \f(CW\*(C`tell()\*(C'\fR or +\&\f(CW\*(C`seek()\*(C'\fR is called on it, \f(CW$.\fR becomes an alias to the line counter +for that filehandle. +.Sp +You can adjust the counter by assigning to \f(CW$.\fR, but this will not +actually move the seek pointer. \fILocalizing \f(CI$.\fI will not localize +the filehandle's line count\fR. Instead, it will localize perl's notion +of which filehandle \f(CW$.\fR is currently aliased to. +.Sp +\&\f(CW$.\fR is reset when the filehandle is closed, but \fBnot\fR when an open +filehandle is reopened without an intervening \f(CW\*(C`close()\*(C'\fR. For more +details, see \*(L"I/O Operators\*(R" in perlop. Because \f(CW\*(C`<>\*(C'\fR never does +an explicit close, line numbers increase across \f(CW\*(C`ARGV\*(C'\fR files (but see +examples in \*(L"eof\*(R" in perlfunc). +.Sp +You can also use \f(CW\*(C`HANDLE\->input_line_number(EXPR)\*(C'\fR to access the +line counter for a given filehandle without having to worry about +which handle you last accessed. +.Sp +Mnemonic: many programs use \*(L".\*(R" to mean the current line number. +.IP "IO::Handle\->input_record_separator( \s-1EXPR\s0 )" 8 +.IX Item "IO::Handle->input_record_separator( EXPR )" +.PD 0 +.ie n .IP "$INPUT_RECORD_SEPARATOR" 8 +.el .IP "\f(CW$INPUT_RECORD_SEPARATOR\fR" 8 +.IX Item "$INPUT_RECORD_SEPARATOR" +.ie n .IP "$RS" 8 +.el .IP "\f(CW$RS\fR" 8 +.IX Item "$RS" +.IP "$/" 8 +.IX Xref "$ $RS $INPUT_RECORD_SEPARATOR" +.PD +The input record separator, newline by default. This influences Perl's +idea of what a \*(L"line\*(R" is. Works like \fBawk\fR's \s-1RS\s0 variable, including +treating empty lines as a terminator if set to the null string (an +empty line cannot contain any spaces or tabs). You may set it to a +multi-character string to match a multi-character terminator, or to +\&\f(CW\*(C`undef\*(C'\fR to read through the end of file. Setting it to \f(CW"\en\en"\fR +means something slightly different than setting to \f(CW""\fR, if the file +contains consecutive empty lines. Setting to \f(CW""\fR will treat two or +more consecutive empty lines as a single empty line. Setting to +\&\f(CW"\en\en"\fR will blindly assume that the next input character belongs to +the next paragraph, even if it's a newline. +.Sp +.Vb 3 +\& local $/; # enable "slurp" mode +\& local $_ = ; # whole file now here +\& s/\en[ \et]+/ /g; +.Ve +.Sp +Remember: the value of \f(CW$/\fR is a string, not a regex. \fBawk\fR has to +be better for something. :\-) +.Sp +Setting \f(CW$/\fR to an empty string \*(-- the so-called \fIparagraph mode\fR \*(-- merits +special attention. When \f(CW$/\fR is set to \f(CW""\fR and the entire file is read in +with that setting, any sequence of consecutive newlines \f(CW"\en\en"\fR at the +beginning of the file is discarded. With the exception of the final record in +the file, each sequence of characters ending in two or more newlines is +treated as one record and is read in to end in exactly two newlines. If the +last record in the file ends in zero or one consecutive newlines, that record +is read in with that number of newlines. If the last record ends in two or +more consecutive newlines, it is read in with two newlines like all preceding +records. +.Sp +Suppose we wrote the following string to a file: +.Sp +.Vb 4 +\& my $string = "\en\en\en"; +\& $string .= "alpha beta\engamma delta\en\en\en"; +\& $string .= "epsilon zeta eta\en\en"; +\& $string .= "theta\en"; +\& +\& my $file = \*(Aqsimple_file.txt\*(Aq; +\& open my $OUT, \*(Aq>\*(Aq, $file or die; +\& print $OUT $string; +\& close $OUT or die; +.Ve +.Sp +Now we read that file in paragraph mode: +.Sp +.Vb 4 +\& local $/ = ""; # paragraph mode +\& open my $IN, \*(Aq<\*(Aq, $file or die; +\& my @records = <$IN>; +\& close $IN or die; +.Ve +.Sp +\&\f(CW@records\fR will consist of these 3 strings: +.Sp +.Vb 5 +\& ( +\& "alpha beta\engamma delta\en\en", +\& "epsilon zeta eta\en\en", +\& "theta\en", +\& ) +.Ve +.Sp +Setting \f(CW$/\fR to a reference to an integer, scalar containing an +integer, or scalar that's convertible to an integer will attempt to +read records instead of lines, with the maximum record size being the +referenced integer number of characters. So this: +.Sp +.Vb 3 +\& local $/ = \e32768; # or \e"32768", or \e$var_containing_32768 +\& open my $fh, "<", $myfile or die $!; +\& local $_ = <$fh>; +.Ve +.Sp +will read a record of no more than 32768 characters from \f(CW$fh\fR. If you're +not reading from a record-oriented file (or your \s-1OS\s0 doesn't have +record-oriented files), then you'll likely get a full chunk of data +with every read. If a record is larger than the record size you've +set, you'll get the record back in pieces. Trying to set the record +size to zero or less is deprecated and will cause $/ to have the value +of \*(L"undef\*(R", which will cause reading in the (rest of the) whole file. +.Sp +As of 5.19.9 setting \f(CW$/\fR to any other form of reference will throw a +fatal exception. This is in preparation for supporting new ways to set +\&\f(CW$/\fR in the future. +.Sp +On \s-1VMS\s0 only, record reads bypass PerlIO layers and any associated +buffering, so you must not mix record and non-record reads on the +same filehandle. Record mode mixes with line mode only when the +same buffering layer is in use for both modes. +.Sp +You cannot call \f(CW\*(C`input_record_separator()\*(C'\fR on a handle, only as a +static method. See IO::Handle. +.Sp +See also \*(L"Newlines\*(R" in perlport. Also see \*(L"$.\*(R". +.Sp +Mnemonic: / delimits line boundaries when quoting poetry. +.IP "IO::Handle\->output_record_separator( \s-1EXPR\s0 )" 8 +.IX Item "IO::Handle->output_record_separator( EXPR )" +.PD 0 +.ie n .IP "$OUTPUT_RECORD_SEPARATOR" 8 +.el .IP "\f(CW$OUTPUT_RECORD_SEPARATOR\fR" 8 +.IX Item "$OUTPUT_RECORD_SEPARATOR" +.ie n .IP "$ORS" 8 +.el .IP "\f(CW$ORS\fR" 8 +.IX Item "$ORS" +.IP "$\e" 8 +.IX Xref "$\\ $ORS $OUTPUT_RECORD_SEPARATOR" +.IX Item "$" +.PD +The output record separator for the print operator. If defined, this +value is printed after the last of print's arguments. Default is \f(CW\*(C`undef\*(C'\fR. +.Sp +You cannot call \f(CW\*(C`output_record_separator()\*(C'\fR on a handle, only as a +static method. See IO::Handle. +.Sp +Mnemonic: you set \f(CW\*(C`$\e\*(C'\fR instead of adding \*(L"\en\*(R" at the end of the print. +Also, it's just like \f(CW$/\fR, but it's what you get \*(L"back\*(R" from Perl. +.IP "\s-1HANDLE\-\s0>autoflush( \s-1EXPR\s0 )" 8 +.IX Item "HANDLE->autoflush( EXPR )" +.PD 0 +.ie n .IP "$OUTPUT_AUTOFLUSH" 8 +.el .IP "\f(CW$OUTPUT_AUTOFLUSH\fR" 8 +.IX Item "$OUTPUT_AUTOFLUSH" +.IP "$|" 8 +.IX Xref "$| autoflush flush $OUTPUT_AUTOFLUSH" +.PD +If set to nonzero, forces a flush right away and after every write or +print on the currently selected output channel. Default is 0 +(regardless of whether the channel is really buffered by the system or +not; \f(CW$|\fR tells you only whether you've asked Perl explicitly to +flush after each write). \s-1STDOUT\s0 will typically be line buffered if +output is to the terminal and block buffered otherwise. Setting this +variable is useful primarily when you are outputting to a pipe or +socket, such as when you are running a Perl program under \fBrsh\fR and +want to see the output as it's happening. This has no effect on input +buffering. See \*(L"getc\*(R" in perlfunc for that. See \*(L"select\*(R" in perlfunc on +how to select the output channel. See also IO::Handle. +.Sp +Mnemonic: when you want your pipes to be piping hot. +.IP "${^LAST_FH}" 8 +.IX Xref "${^LAST_FH}" +.IX Item "${^LAST_FH}" +This read-only variable contains a reference to the last-read filehandle. +This is set by \f(CW\*(C`\*(C'\fR, \f(CW\*(C`readline\*(C'\fR, \f(CW\*(C`tell\*(C'\fR, \f(CW\*(C`eof\*(C'\fR and \f(CW\*(C`seek\*(C'\fR. +This is the same handle that \f(CW$.\fR and \f(CW\*(C`tell\*(C'\fR and \f(CW\*(C`eof\*(C'\fR without arguments +use. It is also the handle used when Perl appends \*(L", <\s-1STDIN\s0> line 1\*(R" to +an error or warning message. +.Sp +This variable was added in Perl v5.18.0. +.PP +\fIVariables related to formats\fR +.IX Subsection "Variables related to formats" +.PP +The special variables for formats are a subset of those for +filehandles. See perlform for more information about Perl's +formats. +.ie n .IP "$ACCUMULATOR" 8 +.el .IP "\f(CW$ACCUMULATOR\fR" 8 +.IX Item "$ACCUMULATOR" +.PD 0 +.IP "$^A" 8 +.IX Xref "$^A $ACCUMULATOR" +.IX Item "$^A" +.PD +The current value of the \f(CW\*(C`write()\*(C'\fR accumulator for \f(CW\*(C`format()\*(C'\fR lines. +A format contains \f(CW\*(C`formline()\*(C'\fR calls that put their result into +\&\f(CW$^A\fR. After calling its format, \f(CW\*(C`write()\*(C'\fR prints out the contents +of \f(CW$^A\fR and empties. So you never really see the contents of \f(CW$^A\fR +unless you call \f(CW\*(C`formline()\*(C'\fR yourself and then look at it. See +perlform and \*(L"formline \s-1PICTURE,LIST\*(R"\s0 in perlfunc. +.IP "IO::Handle\->format_formfeed(\s-1EXPR\s0)" 8 +.IX Item "IO::Handle->format_formfeed(EXPR)" +.PD 0 +.ie n .IP "$FORMAT_FORMFEED" 8 +.el .IP "\f(CW$FORMAT_FORMFEED\fR" 8 +.IX Item "$FORMAT_FORMFEED" +.IP "$^L" 8 +.IX Xref "$^L $FORMAT_FORMFEED" +.IX Item "$^L" +.PD +What formats output as a form feed. The default is \f(CW\*(C`\ef\*(C'\fR. +.Sp +You cannot call \f(CW\*(C`format_formfeed()\*(C'\fR on a handle, only as a static +method. See IO::Handle. +.IP "\s-1HANDLE\-\s0>format_page_number(\s-1EXPR\s0)" 8 +.IX Item "HANDLE->format_page_number(EXPR)" +.PD 0 +.ie n .IP "$FORMAT_PAGE_NUMBER" 8 +.el .IP "\f(CW$FORMAT_PAGE_NUMBER\fR" 8 +.IX Item "$FORMAT_PAGE_NUMBER" +.IP "$%" 8 +.IX Xref "$% $FORMAT_PAGE_NUMBER" +.PD +The current page number of the currently selected output channel. +.Sp +Mnemonic: \f(CW\*(C`%\*(C'\fR is page number in \fBnroff\fR. +.IP "\s-1HANDLE\-\s0>format_lines_left(\s-1EXPR\s0)" 8 +.IX Item "HANDLE->format_lines_left(EXPR)" +.PD 0 +.ie n .IP "$FORMAT_LINES_LEFT" 8 +.el .IP "\f(CW$FORMAT_LINES_LEFT\fR" 8 +.IX Item "$FORMAT_LINES_LEFT" +.IP "$\-" 8 +.IX Xref "$- $FORMAT_LINES_LEFT" +.PD +The number of lines left on the page of the currently selected output +channel. +.Sp +Mnemonic: lines_on_page \- lines_printed. +.IP "IO::Handle\->format_line_break_characters \s-1EXPR\s0" 8 +.IX Item "IO::Handle->format_line_break_characters EXPR" +.PD 0 +.ie n .IP "$FORMAT_LINE_BREAK_CHARACTERS" 8 +.el .IP "\f(CW$FORMAT_LINE_BREAK_CHARACTERS\fR" 8 +.IX Item "$FORMAT_LINE_BREAK_CHARACTERS" +.ie n .IP "$:" 8 +.el .IP "\f(CW$:\fR" 8 +.IX Xref "$: FORMAT_LINE_BREAK_CHARACTERS" +.IX Item "$:" +.PD +The current set of characters after which a string may be broken to +fill continuation fields (starting with \f(CW\*(C`^\*(C'\fR) in a format. The default is +\&\*(L"\ \en\-\*(R", to break on a space, newline, or a hyphen. +.Sp +You cannot call \f(CW\*(C`format_line_break_characters()\*(C'\fR on a handle, only as +a static method. See IO::Handle. +.Sp +Mnemonic: a \*(L"colon\*(R" in poetry is a part of a line. +.IP "\s-1HANDLE\-\s0>format_lines_per_page(\s-1EXPR\s0)" 8 +.IX Item "HANDLE->format_lines_per_page(EXPR)" +.PD 0 +.ie n .IP "$FORMAT_LINES_PER_PAGE" 8 +.el .IP "\f(CW$FORMAT_LINES_PER_PAGE\fR" 8 +.IX Item "$FORMAT_LINES_PER_PAGE" +.IP "$=" 8 +.IX Xref "$= $FORMAT_LINES_PER_PAGE" +.PD +The current page length (printable lines) of the currently selected +output channel. The default is 60. +.Sp +Mnemonic: = has horizontal lines. +.IP "\s-1HANDLE\-\s0>format_top_name(\s-1EXPR\s0)" 8 +.IX Item "HANDLE->format_top_name(EXPR)" +.PD 0 +.ie n .IP "$FORMAT_TOP_NAME" 8 +.el .IP "\f(CW$FORMAT_TOP_NAME\fR" 8 +.IX Item "$FORMAT_TOP_NAME" +.IP "$^" 8 +.IX Xref "$^ $FORMAT_TOP_NAME" +.PD +The name of the current top-of-page format for the currently selected +output channel. The default is the name of the filehandle with \f(CW\*(C`_TOP\*(C'\fR +appended. For example, the default format top name for the \f(CW\*(C`STDOUT\*(C'\fR +filehandle is \f(CW\*(C`STDOUT_TOP\*(C'\fR. +.Sp +Mnemonic: points to top of page. +.IP "\s-1HANDLE\-\s0>format_name(\s-1EXPR\s0)" 8 +.IX Item "HANDLE->format_name(EXPR)" +.PD 0 +.ie n .IP "$FORMAT_NAME" 8 +.el .IP "\f(CW$FORMAT_NAME\fR" 8 +.IX Item "$FORMAT_NAME" +.IP "$~" 8 +.IX Xref "$~ $FORMAT_NAME" +.PD +The name of the current report format for the currently selected +output channel. The default format name is the same as the filehandle +name. For example, the default format name for the \f(CW\*(C`STDOUT\*(C'\fR +filehandle is just \f(CW\*(C`STDOUT\*(C'\fR. +.Sp +Mnemonic: brother to \f(CW$^\fR. +.SS "Error Variables" +.IX Xref "error exception" +.IX Subsection "Error Variables" +The variables \f(CW$@\fR, \f(CW$!\fR, \f(CW$^E\fR, and \f(CW$?\fR contain information +about different types of error conditions that may appear during +execution of a Perl program. The variables are shown ordered by +the \*(L"distance\*(R" between the subsystem which reported the error and +the Perl process. They correspond to errors detected by the Perl +interpreter, C library, operating system, or an external program, +respectively. +.PP +To illustrate the differences between these variables, consider the +following Perl expression, which uses a single-quoted string. After +execution of this statement, perl may have set all four special error +variables: +.PP +.Vb 5 +\& eval q{ +\& open my $pipe, "/cdrom/install |" or die $!; +\& my @res = <$pipe>; +\& close $pipe or die "bad pipe: $?, $!"; +\& }; +.Ve +.PP +When perl executes the \f(CW\*(C`eval()\*(C'\fR expression, it translates the +\&\f(CW\*(C`open()\*(C'\fR, \f(CW\*(C`\*(C'\fR, and \f(CW\*(C`close\*(C'\fR calls in the C run-time library +and thence to the operating system kernel. perl sets \f(CW$!\fR to +the C library's \f(CW\*(C`errno\*(C'\fR if one of these calls fails. +.PP +\&\f(CW$@\fR is set if the string to be \f(CW\*(C`eval\*(C'\fR\-ed did not compile (this may +happen if \f(CW\*(C`open\*(C'\fR or \f(CW\*(C`close\*(C'\fR were imported with bad prototypes), or +if Perl code executed during evaluation \f(CW\*(C`die()\*(C'\fRd. In these cases the +value of \f(CW$@\fR is the compile error, or the argument to \f(CW\*(C`die\*(C'\fR (which +will interpolate \f(CW$!\fR and \f(CW$?\fR). (See also Fatal, though.) +.PP +Under a few operating systems, \f(CW$^E\fR may contain a more verbose error +indicator, such as in this case, \*(L"\s-1CDROM\s0 tray not closed.\*(R" Systems that +do not support extended error messages leave \f(CW$^E\fR the same as \f(CW$!\fR. +.PP +Finally, \f(CW$?\fR may be set to a non\-0 value if the external program +\&\fI/cdrom/install\fR fails. The upper eight bits reflect specific error +conditions encountered by the program (the program's \f(CW\*(C`exit()\*(C'\fR value). +The lower eight bits reflect mode of failure, like signal death and +core dump information. See \fBwait\fR\|(2) for details. In contrast to +\&\f(CW$!\fR and \f(CW$^E\fR, which are set only if an error condition is detected, +the variable \f(CW$?\fR is set on each \f(CW\*(C`wait\*(C'\fR or pipe \f(CW\*(C`close\*(C'\fR, +overwriting the old value. This is more like \f(CW$@\fR, which on every +\&\f(CW\*(C`eval()\*(C'\fR is always set on failure and cleared on success. +.PP +For more details, see the individual descriptions at \f(CW$@\fR, \f(CW$!\fR, +\&\f(CW$^E\fR, and \f(CW$?\fR. +.IP "${^CHILD_ERROR_NATIVE}" 8 +.IX Xref "$^CHILD_ERROR_NATIVE" +.IX Item "${^CHILD_ERROR_NATIVE}" +The native status returned by the last pipe close, backtick (\f(CW\*(C`\`\`\*(C'\fR) +command, successful call to \f(CW\*(C`wait()\*(C'\fR or \f(CW\*(C`waitpid()\*(C'\fR, or from the +\&\f(CW\*(C`system()\*(C'\fR operator. On POSIX-like systems this value can be decoded +with the \s-1WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WIFSTOPPED, +WSTOPSIG\s0 and \s-1WIFCONTINUED\s0 functions provided by the \s-1POSIX\s0 module. +.Sp +Under \s-1VMS\s0 this reflects the actual \s-1VMS\s0 exit status; i.e. it is the +same as \f(CW$?\fR when the pragma \f(CW\*(C`use vmsish \*(Aqstatus\*(Aq\*(C'\fR is in effect. +.Sp +This variable was added in Perl v5.10.0. +.ie n .IP "$EXTENDED_OS_ERROR" 8 +.el .IP "\f(CW$EXTENDED_OS_ERROR\fR" 8 +.IX Item "$EXTENDED_OS_ERROR" +.PD 0 +.IP "$^E" 8 +.IX Xref "$^E $EXTENDED_OS_ERROR" +.IX Item "$^E" +.PD +Error information specific to the current operating system. At the +moment, this differs from \f(CW"$!"\fR under only \s-1VMS, OS/2,\s0 and Win32 (and +for MacPerl). On all other platforms, \f(CW$^E\fR is always just the same +as \f(CW$!\fR. +.Sp +Under \s-1VMS,\s0 \f(CW$^E\fR provides the \s-1VMS\s0 status value from the last system +error. This is more specific information about the last system error +than that provided by \f(CW$!\fR. This is particularly important when \f(CW$!\fR +is set to \fB\s-1EVMSERR\s0\fR. +.Sp +Under \s-1OS/2,\s0 \f(CW$^E\fR is set to the error code of the last call to \s-1OS/2 +API\s0 either via \s-1CRT,\s0 or directly from perl. +.Sp +Under Win32, \f(CW$^E\fR always returns the last error information reported +by the Win32 call \f(CW\*(C`GetLastError()\*(C'\fR which describes the last error +from within the Win32 \s-1API.\s0 Most Win32\-specific code will report errors +via \f(CW$^E\fR. \s-1ANSI C\s0 and Unix-like calls set \f(CW\*(C`errno\*(C'\fR and so most +portable Perl code will report errors via \f(CW$!\fR. +.Sp +Caveats mentioned in the description of \f(CW"$!"\fR generally apply to +\&\f(CW$^E\fR, also. +.Sp +This variable was added in Perl 5.003. +.Sp +Mnemonic: Extra error explanation. +.ie n .IP "$EXCEPTIONS_BEING_CAUGHT" 8 +.el .IP "\f(CW$EXCEPTIONS_BEING_CAUGHT\fR" 8 +.IX Item "$EXCEPTIONS_BEING_CAUGHT" +.PD 0 +.IP "$^S" 8 +.IX Xref "$^S $EXCEPTIONS_BEING_CAUGHT" +.IX Item "$^S" +.PD +Current state of the interpreter. +.Sp +.Vb 5 +\& $^S State +\& \-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +\& undef Parsing module, eval, or main program +\& true (1) Executing an eval +\& false (0) Otherwise +.Ve +.Sp +The first state may happen in \f(CW$SIG{_\|_DIE_\|_}\fR and \f(CW$SIG{_\|_WARN_\|_}\fR +handlers. +.Sp +The English name \f(CW$EXCEPTIONS_BEING_CAUGHT\fR is slightly misleading, because +the \f(CW\*(C`undef\*(C'\fR value does not indicate whether exceptions are being caught, +since compilation of the main program does not catch exceptions. +.Sp +This variable was added in Perl 5.004. +.ie n .IP "$WARNING" 8 +.el .IP "\f(CW$WARNING\fR" 8 +.IX Item "$WARNING" +.PD 0 +.IP "$^W" 8 +.IX Xref "$^W $WARNING" +.IX Item "$^W" +.PD +The current value of the warning switch, initially true if \fB\-w\fR was +used, false otherwise, but directly modifiable. +.Sp +See also warnings. +.Sp +Mnemonic: related to the \fB\-w\fR switch. +.IP "${^WARNING_BITS}" 8 +.IX Xref "${^WARNING_BITS}" +.IX Item "${^WARNING_BITS}" +The current set of warning checks enabled by the \f(CW\*(C`use warnings\*(C'\fR pragma. +It has the same scoping as the \f(CW$^H\fR and \f(CW\*(C`%^H\*(C'\fR variables. The exact +values are considered internal to the warnings pragma and may change +between versions of Perl. +.Sp +This variable was added in Perl v5.6.0. +.ie n .IP "$OS_ERROR" 8 +.el .IP "\f(CW$OS_ERROR\fR" 8 +.IX Item "$OS_ERROR" +.PD 0 +.ie n .IP "$ERRNO" 8 +.el .IP "\f(CW$ERRNO\fR" 8 +.IX Item "$ERRNO" +.IP "$!" 8 +.IX Xref "$! $ERRNO $OS_ERROR" +.PD +When referenced, \f(CW$!\fR retrieves the current value +of the C \f(CW\*(C`errno\*(C'\fR integer variable. +If \f(CW$!\fR is assigned a numerical value, that value is stored in \f(CW\*(C`errno\*(C'\fR. +When referenced as a string, \f(CW$!\fR yields the system error string +corresponding to \f(CW\*(C`errno\*(C'\fR. +.Sp +Many system or library calls set \f(CW\*(C`errno\*(C'\fR if they fail, +to indicate the cause of failure. They usually do \fBnot\fR +set \f(CW\*(C`errno\*(C'\fR to zero if they succeed. This means \f(CW\*(C`errno\*(C'\fR, +hence \f(CW$!\fR, is meaningful only \fIimmediately\fR after a \fBfailure\fR: +.Sp +.Vb 11 +\& if (open my $fh, "<", $filename) { +\& # Here $! is meaningless. +\& ... +\& } +\& else { +\& # ONLY here is $! meaningful. +\& ... +\& # Already here $! might be meaningless. +\& } +\& # Since here we might have either success or failure, +\& # $! is meaningless. +.Ve +.Sp +Here, \fImeaningless\fR means that \f(CW$!\fR may be unrelated to the outcome +of the \f(CW\*(C`open()\*(C'\fR operator. Assignment to \f(CW$!\fR is similarly ephemeral. +It can be used immediately before invoking the \f(CW\*(C`die()\*(C'\fR operator, +to set the exit value, or to inspect the system error string +corresponding to error \fIn\fR, or to restore \f(CW$!\fR to a meaningful state. +.Sp +Mnemonic: What just went bang? +.ie n .IP "%OS_ERROR" 8 +.el .IP "\f(CW%OS_ERROR\fR" 8 +.IX Item "%OS_ERROR" +.PD 0 +.ie n .IP "%ERRNO" 8 +.el .IP "\f(CW%ERRNO\fR" 8 +.IX Item "%ERRNO" +.IP "%!" 8 +.IX Xref "%! %OS_ERROR %ERRNO" +.PD +Each element of \f(CW\*(C`%!\*(C'\fR has a true value only if \f(CW$!\fR is set to that +value. For example, \f(CW$!{ENOENT}\fR is true if and only if the current +value of \f(CW$!\fR is \f(CW\*(C`ENOENT\*(C'\fR; that is, if the most recent error was \*(L"No +such file or directory\*(R" (or its moral equivalent: not all operating +systems give that exact error, and certainly not all languages). The +specific true value is not guaranteed, but in the past has generally +been the numeric value of \f(CW$!\fR. To check if a particular key is +meaningful on your system, use \f(CW\*(C`exists $!{the_key}\*(C'\fR; for a list of legal +keys, use \f(CW\*(C`keys %!\*(C'\fR. See Errno for more information, and also see +\&\*(L"$!\*(R". +.Sp +This variable was added in Perl 5.005. +.ie n .IP "$CHILD_ERROR" 8 +.el .IP "\f(CW$CHILD_ERROR\fR" 8 +.IX Item "$CHILD_ERROR" +.PD 0 +.IP "$?" 8 +.IX Xref "$? $CHILD_ERROR" +.PD +The status returned by the last pipe close, backtick (\f(CW\*(C`\`\`\*(C'\fR) command, +successful call to \f(CW\*(C`wait()\*(C'\fR or \f(CW\*(C`waitpid()\*(C'\fR, or from the \f(CW\*(C`system()\*(C'\fR +operator. This is just the 16\-bit status word returned by the +traditional Unix \f(CW\*(C`wait()\*(C'\fR system call (or else is made up to look +like it). Thus, the exit value of the subprocess is really (\f(CW\*(C`$? >> +8\*(C'\fR), and \f(CW\*(C`$? & 127\*(C'\fR gives which signal, if any, the process died +from, and \f(CW\*(C`$? & 128\*(C'\fR reports whether there was a core dump. +.Sp +Additionally, if the \f(CW\*(C`h_errno\*(C'\fR variable is supported in C, its value +is returned via \f(CW$?\fR if any \f(CW\*(C`gethost*()\*(C'\fR function fails. +.Sp +If you have installed a signal handler for \f(CW\*(C`SIGCHLD\*(C'\fR, the +value of \f(CW$?\fR will usually be wrong outside that handler. +.Sp +Inside an \f(CW\*(C`END\*(C'\fR subroutine \f(CW$?\fR contains the value that is going to be +given to \f(CW\*(C`exit()\*(C'\fR. You can modify \f(CW$?\fR in an \f(CW\*(C`END\*(C'\fR subroutine to +change the exit status of your program. For example: +.Sp +.Vb 3 +\& END { +\& $? = 1 if $? == 255; # die would make it 255 +\& } +.Ve +.Sp +Under \s-1VMS,\s0 the pragma \f(CW\*(C`use vmsish \*(Aqstatus\*(Aq\*(C'\fR makes \f(CW$?\fR reflect the +actual \s-1VMS\s0 exit status, instead of the default emulation of \s-1POSIX\s0 +status; see \*(L"$?\*(R" in perlvms for details. +.Sp +Mnemonic: similar to \fBsh\fR and \fBksh\fR. +.ie n .IP "$EVAL_ERROR" 8 +.el .IP "\f(CW$EVAL_ERROR\fR" 8 +.IX Item "$EVAL_ERROR" +.PD 0 +.IP "$@" 8 +.IX Xref "$@ $EVAL_ERROR" +.PD +The Perl error from the last \f(CW\*(C`eval\*(C'\fR operator, i.e. the last exception that +was caught. For \f(CW\*(C`eval BLOCK\*(C'\fR, this is either a runtime error message or the +string or reference \f(CW\*(C`die\*(C'\fR was called with. The \f(CW\*(C`eval STRING\*(C'\fR form also +catches syntax errors and other compile time exceptions. +.Sp +If no error occurs, \f(CW\*(C`eval\*(C'\fR sets \f(CW$@\fR to the empty string. +.Sp +Warning messages are not collected in this variable. You can, however, +set up a routine to process warnings by setting \f(CW$SIG{_\|_WARN_\|_}\fR as +described in \*(L"%SIG\*(R". +.Sp +Mnemonic: Where was the error \*(L"at\*(R"? +.SS "Variables related to the interpreter state" +.IX Subsection "Variables related to the interpreter state" +These variables provide information about the current interpreter state. +.ie n .IP "$COMPILING" 8 +.el .IP "\f(CW$COMPILING\fR" 8 +.IX Item "$COMPILING" +.PD 0 +.IP "$^C" 8 +.IX Xref "$^C $COMPILING" +.IX Item "$^C" +.PD +The current value of the flag associated with the \fB\-c\fR switch. +Mainly of use with \fB\-MO=...\fR to allow code to alter its behavior +when being compiled, such as for example to \f(CW\*(C`AUTOLOAD\*(C'\fR at compile +time rather than normal, deferred loading. Setting +\&\f(CW\*(C`$^C = 1\*(C'\fR is similar to calling \f(CW\*(C`B::minus_c\*(C'\fR. +.Sp +This variable was added in Perl v5.6.0. +.ie n .IP "$DEBUGGING" 8 +.el .IP "\f(CW$DEBUGGING\fR" 8 +.IX Item "$DEBUGGING" +.PD 0 +.IP "$^D" 8 +.IX Xref "$^D $DEBUGGING" +.IX Item "$^D" +.PD +The current value of the debugging flags. May be read or set. Like its +command-line equivalent, you can use numeric +or symbolic values, e.g. \f(CW\*(C`$^D = 10\*(C'\fR or \f(CW\*(C`$^D = "st"\*(C'\fR. See +"\fB\-D\fR\fInumber\fR" in perlrun. The contents of this variable also affects the +debugger operation. See \*(L"Debugger Internals\*(R" in perldebguts. +.Sp +Mnemonic: value of \fB\-D\fR switch. +.IP "${^ENCODING}" 8 +.IX Xref "${^ENCODING}" +.IX Item "${^ENCODING}" +This variable is no longer supported. +.Sp +It used to hold the \fIobject reference\fR to the \f(CW\*(C`Encode\*(C'\fR object that was +used to convert the source code to Unicode. +.Sp +Its purpose was to allow your non-ASCII Perl +scripts not to have to be written in \s-1UTF\-8\s0; this was +useful before editors that worked on \s-1UTF\-8\s0 encoded text were common, but +that was long ago. It caused problems, such as affecting the operation +of other modules that weren't expecting it, causing general mayhem. +.Sp +If you need something like this functionality, it is recommended that use +you a simple source filter, such as Filter::Encoding. +.Sp +If you are coming here because code of yours is being adversely affected +by someone's use of this variable, you can usually work around it by +doing this: +.Sp +.Vb 1 +\& local ${^ENCODING}; +.Ve +.Sp +near the beginning of the functions that are getting broken. This +undefines the variable during the scope of execution of the including +function. +.Sp +This variable was added in Perl 5.8.2 and removed in 5.26.0. +Setting it to anything other than \f(CW\*(C`undef\*(C'\fR was made fatal in Perl 5.28.0. +.IP "${^GLOBAL_PHASE}" 8 +.IX Xref "${^GLOBAL_PHASE}" +.IX Item "${^GLOBAL_PHASE}" +The current phase of the perl interpreter. +.Sp +Possible values are: +.RS 8 +.IP "\s-1CONSTRUCT\s0" 8 +.IX Item "CONSTRUCT" +The \f(CW\*(C`PerlInterpreter*\*(C'\fR is being constructed via \f(CW\*(C`perl_construct\*(C'\fR. This +value is mostly there for completeness and for use via the +underlying C variable \f(CW\*(C`PL_phase\*(C'\fR. It's not really possible for Perl +code to be executed unless construction of the interpreter is +finished. +.IP "\s-1START\s0" 8 +.IX Item "START" +This is the global compile-time. That includes, basically, every +\&\f(CW\*(C`BEGIN\*(C'\fR block executed directly or indirectly from during the +compile-time of the top-level program. +.Sp +This phase is not called \*(L"\s-1BEGIN\*(R"\s0 to avoid confusion with +\&\f(CW\*(C`BEGIN\*(C'\fR\-blocks, as those are executed during compile-time of any +compilation unit, not just the top-level program. A new, localised +compile-time entered at run-time, for example by constructs as +\&\f(CW\*(C`eval "use SomeModule"\*(C'\fR are not global interpreter phases, and +therefore aren't reflected by \f(CW\*(C`${^GLOBAL_PHASE}\*(C'\fR. +.IP "\s-1CHECK\s0" 8 +.IX Item "CHECK" +Execution of any \f(CW\*(C`CHECK\*(C'\fR blocks. +.IP "\s-1INIT\s0" 8 +.IX Item "INIT" +Similar to \*(L"\s-1CHECK\*(R",\s0 but for \f(CW\*(C`INIT\*(C'\fR\-blocks, not \f(CW\*(C`CHECK\*(C'\fR blocks. +.IP "\s-1RUN\s0" 8 +.IX Item "RUN" +The main run-time, i.e. the execution of \f(CW\*(C`PL_main_root\*(C'\fR. +.IP "\s-1END\s0" 8 +.IX Item "END" +Execution of any \f(CW\*(C`END\*(C'\fR blocks. +.IP "\s-1DESTRUCT\s0" 8 +.IX Item "DESTRUCT" +Global destruction. +.RE +.RS 8 +.Sp +Also note that there's no value for UNITCHECK-blocks. That's because +those are run for each compilation unit individually, and therefore is +not a global interpreter phase. +.Sp +Not every program has to go through each of the possible phases, but +transition from one phase to another can only happen in the order +described in the above list. +.Sp +An example of all of the phases Perl code can see: +.Sp +.Vb 1 +\& BEGIN { print "compile\-time: ${^GLOBAL_PHASE}\en" } +\& +\& INIT { print "init\-time: ${^GLOBAL_PHASE}\en" } +\& +\& CHECK { print "check\-time: ${^GLOBAL_PHASE}\en" } +\& +\& { +\& package Print::Phase; +\& +\& sub new { +\& my ($class, $time) = @_; +\& return bless \e$time, $class; +\& } +\& +\& sub DESTROY { +\& my $self = shift; +\& print "$$self: ${^GLOBAL_PHASE}\en"; +\& } +\& } +\& +\& print "run\-time: ${^GLOBAL_PHASE}\en"; +\& +\& my $runtime = Print::Phase\->new( +\& "lexical variables are garbage collected before END" +\& ); +\& +\& END { print "end\-time: ${^GLOBAL_PHASE}\en" } +\& +\& our $destruct = Print::Phase\->new( +\& "package variables are garbage collected after END" +\& ); +.Ve +.Sp +This will print out +.Sp +.Vb 7 +\& compile\-time: START +\& check\-time: CHECK +\& init\-time: INIT +\& run\-time: RUN +\& lexical variables are garbage collected before END: RUN +\& end\-time: END +\& package variables are garbage collected after END: DESTRUCT +.Ve +.Sp +This variable was added in Perl 5.14.0. +.RE +.IP "$^H" 8 +.IX Xref "$^H" +.IX Item "$^H" +\&\s-1WARNING:\s0 This variable is strictly for +internal use only. Its availability, +behavior, and contents are subject to change without notice. +.Sp +This variable contains compile-time hints for the Perl interpreter. At the +end of compilation of a \s-1BLOCK\s0 the value of this variable is restored to the +value when the interpreter started to compile the \s-1BLOCK.\s0 +.Sp +When perl begins to parse any block construct that provides a lexical scope +(e.g., eval body, required file, subroutine body, loop body, or conditional +block), the existing value of \f(CW$^H\fR is saved, but its value is left unchanged. +When the compilation of the block is completed, it regains the saved value. +Between the points where its value is saved and restored, code that +executes within \s-1BEGIN\s0 blocks is free to change the value of \f(CW$^H\fR. +.Sp +This behavior provides the semantic of lexical scoping, and is used in, +for instance, the \f(CW\*(C`use strict\*(C'\fR pragma. +.Sp +The contents should be an integer; different bits of it are used for +different pragmatic flags. Here's an example: +.Sp +.Vb 1 +\& sub add_100 { $^H |= 0x100 } +\& +\& sub foo { +\& BEGIN { add_100() } +\& bar\->baz($boon); +\& } +.Ve +.Sp +Consider what happens during execution of the \s-1BEGIN\s0 block. At this point +the \s-1BEGIN\s0 block has already been compiled, but the body of \f(CW\*(C`foo()\*(C'\fR is still +being compiled. The new value of \f(CW$^H\fR +will therefore be visible only while +the body of \f(CW\*(C`foo()\*(C'\fR is being compiled. +.Sp +Substitution of \f(CW\*(C`BEGIN { add_100() }\*(C'\fR block with: +.Sp +.Vb 1 +\& BEGIN { require strict; strict\->import(\*(Aqvars\*(Aq) } +.Ve +.Sp +demonstrates how \f(CW\*(C`use strict \*(Aqvars\*(Aq\*(C'\fR is implemented. Here's a conditional +version of the same lexical pragma: +.Sp +.Vb 3 +\& BEGIN { +\& require strict; strict\->import(\*(Aqvars\*(Aq) if $condition +\& } +.Ve +.Sp +This variable was added in Perl 5.003. +.IP "%^H" 8 +.IX Xref "%^H" +.IX Item "%^H" +The \f(CW\*(C`%^H\*(C'\fR hash provides the same scoping semantic as \f(CW$^H\fR. This makes +it useful for implementation of lexically scoped pragmas. See +perlpragma. All the entries are stringified when accessed at +runtime, so only simple values can be accommodated. This means no +pointers to objects, for example. +.Sp +When putting items into \f(CW\*(C`%^H\*(C'\fR, in order to avoid conflicting with other +users of the hash there is a convention regarding which keys to use. +A module should use only keys that begin with the module's name (the +name of its main package) and a \*(L"/\*(R" character. For example, a module +\&\f(CW\*(C`Foo::Bar\*(C'\fR should use keys such as \f(CW\*(C`Foo::Bar/baz\*(C'\fR. +.Sp +This variable was added in Perl v5.6.0. +.IP "${^OPEN}" 8 +.IX Xref "${^OPEN}" +.IX Item "${^OPEN}" +An internal variable used by PerlIO. A string in two parts, separated +by a \f(CW\*(C`\e0\*(C'\fR byte, the first part describes the input layers, the second +part describes the output layers. +.Sp +This is the mechanism that applies the lexical effects of the open +pragma, and the main program scope effects of the \f(CW\*(C`io\*(C'\fR or \f(CW\*(C`D\*(C'\fR options +for the \-C command-line switch and +\&\s-1PERL_UNICODE\s0 environment variable. +.Sp +The functions \f(CW\*(C`accept()\*(C'\fR, \f(CW\*(C`open()\*(C'\fR, \f(CW\*(C`pipe()\*(C'\fR, \f(CW\*(C`readpipe()\*(C'\fR (as well +as the related \f(CW\*(C`qx\*(C'\fR and \f(CW\*(C`\`STRING\`\*(C'\fR operators), \f(CW\*(C`socket()\*(C'\fR, +\&\f(CW\*(C`socketpair()\*(C'\fR, and \f(CW\*(C`sysopen()\*(C'\fR are affected by the lexical value of +this variable. The implicit \*(L"\s-1ARGV\*(R"\s0 handle opened by \f(CW\*(C`readline()\*(C'\fR (or +the related \f(CW\*(C`<>\*(C'\fR and \f(CW\*(C`<<>>\*(C'\fR operators) on passed filenames is +also affected (but not if it opens \f(CW\*(C`STDIN\*(C'\fR). If this variable is not +set, these functions will set the default layers as described in +\&\*(L"Defaults and how to override them\*(R" in PerlIO. +.Sp +\&\f(CW\*(C`open()\*(C'\fR ignores this variable (and the default layers) when called with +3 arguments and explicit layers are specified. Indirect calls to these +functions via modules like IO::Handle are not affected as they occur +in a different lexical scope. Directory handles such as opened by +\&\f(CW\*(C`opendir()\*(C'\fR are not currently affected. +.Sp +This variable was added in Perl v5.8.0. +.ie n .IP "$PERLDB" 8 +.el .IP "\f(CW$PERLDB\fR" 8 +.IX Item "$PERLDB" +.PD 0 +.IP "$^P" 8 +.IX Xref "$^P $PERLDB" +.IX Item "$^P" +.PD +The internal variable for debugging support. The meanings of the +various bits are subject to change, but currently indicate: +.RS 8 +.IP "0x01" 6 +.IX Item "0x01" +Debug subroutine enter/exit. +.IP "0x02" 6 +.IX Item "0x02" +Line-by-line debugging. Causes \f(CW\*(C`DB::DB()\*(C'\fR subroutine to be called for +each statement executed. Also causes saving source code lines (like +0x400). +.IP "0x04" 6 +.IX Item "0x04" +Switch off optimizations. +.IP "0x08" 6 +.IX Item "0x08" +Preserve more data for future interactive inspections. +.IP "0x10" 6 +.IX Item "0x10" +Keep info about source lines on which a subroutine is defined. +.IP "0x20" 6 +.IX Item "0x20" +Start with single-step on. +.IP "0x40" 6 +.IX Item "0x40" +Use subroutine address instead of name when reporting. +.IP "0x80" 6 +.IX Item "0x80" +Report \f(CW\*(C`goto &subroutine\*(C'\fR as well. +.IP "0x100" 6 +.IX Item "0x100" +Provide informative \*(L"file\*(R" names for evals based on the place they were compiled. +.IP "0x200" 6 +.IX Item "0x200" +Provide informative names to anonymous subroutines based on the place they +were compiled. +.IP "0x400" 6 +.IX Item "0x400" +Save source code lines into \f(CW\*(C`@{"_<$filename"}\*(C'\fR. +.IP "0x800" 6 +.IX Item "0x800" +When saving source, include evals that generate no subroutines. +.IP "0x1000" 6 +.IX Item "0x1000" +When saving source, include source that did not compile. +.RE +.RS 8 +.Sp +Some bits may be relevant at compile-time only, some at +run-time only. This is a new mechanism and the details may change. +See also perldebguts. +.RE +.IP "${^TAINT}" 8 +.IX Xref "${^TAINT}" +.IX Item "${^TAINT}" +Reflects if taint mode is on or off. 1 for on (the program was run with +\&\fB\-T\fR), 0 for off, \-1 when only taint warnings are enabled (i.e. with +\&\fB\-t\fR or \fB\-TU\fR). +.Sp +This variable is read-only. +.Sp +This variable was added in Perl v5.8.0. +.IP "${^SAFE_LOCALES}" 8 +.IX Xref "${^SAFE_LOCALES}" +.IX Item "${^SAFE_LOCALES}" +Reflects if safe locale operations are available to this perl (when the +value is 1) or not (the value is 0). This variable is always 1 if the +perl has been compiled without threads. It is also 1 if this perl is +using thread-safe locale operations. Note that an individual thread may +choose to use the global locale (generally unsafe) by calling +\&\*(L"switch_to_global_locale\*(R" in perlapi. This variable currently is still +set to 1 in such threads. +.Sp +This variable is read-only. +.Sp +This variable was added in Perl v5.28.0. +.IP "${^UNICODE}" 8 +.IX Xref "${^UNICODE}" +.IX Item "${^UNICODE}" +Reflects certain Unicode settings of Perl. See +perlrun documentation for the \f(CW\*(C`\-C\*(C'\fR +switch for more information about the possible values. +.Sp +This variable is set during Perl startup and is thereafter read-only. +.Sp +This variable was added in Perl v5.8.2. +.IP "${^UTF8CACHE}" 8 +.IX Xref "${^UTF8CACHE}" +.IX Item "${^UTF8CACHE}" +This variable controls the state of the internal \s-1UTF\-8\s0 offset caching code. +1 for on (the default), 0 for off, \-1 to debug the caching code by checking +all its results against linear scans, and panicking on any discrepancy. +.Sp +This variable was added in Perl v5.8.9. It is subject to change or +removal without notice, but is currently used to avoid recalculating the +boundaries of multi-byte UTF\-8\-encoded characters. +.IP "${^UTF8LOCALE}" 8 +.IX Xref "${^UTF8LOCALE}" +.IX Item "${^UTF8LOCALE}" +This variable indicates whether a \s-1UTF\-8\s0 locale was detected by perl at +startup. This information is used by perl when it's in +adjust\-utf8ness\-to\-locale mode (as when run with the \f(CW\*(C`\-CL\*(C'\fR command-line +switch); see perlrun for more info on +this. +.Sp +This variable was added in Perl v5.8.8. +.SS "Deprecated and removed variables" +.IX Subsection "Deprecated and removed variables" +Deprecating a variable announces the intent of the perl maintainers to +eventually remove the variable from the language. It may still be +available despite its status. Using a deprecated variable triggers +a warning. +.PP +Once a variable is removed, its use triggers an error telling you +the variable is unsupported. +.PP +See perldiag for details about error messages. +.IP "$#" 8 +.IX Xref "$#" +\&\f(CW$#\fR was a variable that could be used to format printed numbers. +After a deprecation cycle, its magic was removed in Perl v5.10.0 and +using it now triggers a warning: \f(CW\*(C`$# is no longer supported\*(C'\fR. +.Sp +This is not the sigil you use in front of an array name to get the +last index, like \f(CW$#array\fR. That's still how you get the last index +of an array in Perl. The two have nothing to do with each other. +.Sp +Deprecated in Perl 5. +.Sp +Removed in Perl v5.10.0. +.IP "$*" 8 +.IX Xref "$*" +\&\f(CW$*\fR was a variable that you could use to enable multiline matching. +After a deprecation cycle, its magic was removed in Perl v5.10.0. +Using it now triggers a warning: \f(CW\*(C`$* is no longer supported\*(C'\fR. +You should use the \f(CW\*(C`/s\*(C'\fR and \f(CW\*(C`/m\*(C'\fR regexp modifiers instead. +.Sp +Deprecated in Perl 5. +.Sp +Removed in Perl v5.10.0. +.IP "$[" 8 +.IX Xref "$[" +This variable stores the index of the first element in an array, and +of the first character in a substring. The default is 0, but you could +theoretically set it to 1 to make Perl behave more like \fBawk\fR (or Fortran) +when subscripting and when evaluating the \fBindex()\fR and \fBsubstr()\fR functions. +.Sp +As of release 5 of Perl, assignment to \f(CW$[\fR is treated as a compiler +directive, and cannot influence the behavior of any other file. +(That's why you can only assign compile-time constants to it.) +Its use is highly discouraged. +.Sp +Prior to Perl v5.10.0, assignment to \f(CW$[\fR could be seen from outer lexical +scopes in the same file, unlike other compile-time directives (such as +strict). Using \fBlocal()\fR on it would bind its value strictly to a lexical +block. Now it is always lexically scoped. +.Sp +As of Perl v5.16.0, it is implemented by the arybase module. +.Sp +As of Perl v5.30.0, or under \f(CW\*(C`use v5.16\*(C'\fR, or \f(CW\*(C`no feature "array_base"\*(C'\fR, +\&\f(CW$[\fR no longer has any effect, and always contains 0. +Assigning 0 to it is permitted, but any other value will produce an error. +.Sp +Mnemonic: [ begins subscripts. +.Sp +Deprecated in Perl v5.12.0. diff --git a/data/miniconda3/man/man1/perlxs.1 b/data/miniconda3/man/man1/perlxs.1 new file mode 100644 index 0000000000000000000000000000000000000000..c17c51e323efbaa08c34be154bf207a39d35ec93 --- /dev/null +++ b/data/miniconda3/man/man1/perlxs.1 @@ -0,0 +1,2675 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLXS 1" +.TH PERLXS 1 "2020-12-18" "perl v5.32.1" "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" +perlxs \- XS language reference manual +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +.SS "Introduction" +.IX Subsection "Introduction" +\&\s-1XS\s0 is an interface description file format used to create an extension +interface between Perl and C code (or a C library) which one wishes +to use with Perl. The \s-1XS\s0 interface is combined with the library to +create a new library which can then be either dynamically loaded +or statically linked into perl. The \s-1XS\s0 interface description is +written in the \s-1XS\s0 language and is the core component of the Perl +extension interface. +.PP +Before writing \s-1XS,\s0 read the \*(L"\s-1CAVEATS\*(R"\s0 section below. +.PP +An \fB\s-1XSUB\s0\fR forms the basic unit of the \s-1XS\s0 interface. After compilation +by the \fBxsubpp\fR compiler, each \s-1XSUB\s0 amounts to a C function definition +which will provide the glue between Perl calling conventions and C +calling conventions. +.PP +The glue code pulls the arguments from the Perl stack, converts these +Perl values to the formats expected by a C function, call this C function, +transfers the return values of the C function back to Perl. +Return values here may be a conventional C return value or any C +function arguments that may serve as output parameters. These return +values may be passed back to Perl either by putting them on the +Perl stack, or by modifying the arguments supplied from the Perl side. +.PP +The above is a somewhat simplified view of what really happens. Since +Perl allows more flexible calling conventions than C, XSUBs may do much +more in practice, such as checking input parameters for validity, +throwing exceptions (or returning undef/empty list) if the return value +from the C function indicates failure, calling different C functions +based on numbers and types of the arguments, providing an object-oriented +interface, etc. +.PP +Of course, one could write such glue code directly in C. However, this +would be a tedious task, especially if one needs to write glue for +multiple C functions, and/or one is not familiar enough with the Perl +stack discipline and other such arcana. \s-1XS\s0 comes to the rescue here: +instead of writing this glue C code in long-hand, one can write +a more concise short-hand \fIdescription\fR of what should be done by +the glue, and let the \s-1XS\s0 compiler \fBxsubpp\fR handle the rest. +.PP +The \s-1XS\s0 language allows one to describe the mapping between how the C +routine is used, and how the corresponding Perl routine is used. It +also allows creation of Perl routines which are directly translated to +C code and which are not related to a pre-existing C function. In cases +when the C interface coincides with the Perl interface, the \s-1XSUB\s0 +declaration is almost identical to a declaration of a C function (in K&R +style). In such circumstances, there is another tool called \f(CW\*(C`h2xs\*(C'\fR +that is able to translate an entire C header file into a corresponding +\&\s-1XS\s0 file that will provide glue to the functions/macros described in +the header file. +.PP +The \s-1XS\s0 compiler is called \fBxsubpp\fR. This compiler creates +the constructs necessary to let an \s-1XSUB\s0 manipulate Perl values, and +creates the glue necessary to let Perl call the \s-1XSUB.\s0 The compiler +uses \fBtypemaps\fR to determine how to map C function parameters +and output values to Perl values and back. The default typemap +(which comes with Perl) handles many common C types. A supplementary +typemap may also be needed to handle any special structures and types +for the library being linked. For more information on typemaps, +see perlxstypemap. +.PP +A file in \s-1XS\s0 format starts with a C language section which goes until the +first \f(CW\*(C`MODULE =\*(C'\fR directive. Other \s-1XS\s0 directives and \s-1XSUB\s0 definitions +may follow this line. The \*(L"language\*(R" used in this part of the file +is usually referred to as the \s-1XS\s0 language. \fBxsubpp\fR recognizes and +skips \s-1POD\s0 (see perlpod) in both the C and \s-1XS\s0 language sections, which +allows the \s-1XS\s0 file to contain embedded documentation. +.PP +See perlxstut for a tutorial on the whole extension creation process. +.PP +Note: For some extensions, Dave Beazley's \s-1SWIG\s0 system may provide a +significantly more convenient mechanism for creating the extension +glue code. See for more information. +.PP +For simple bindings to C libraries as well as other machine code libraries, +consider instead using the much simpler +libffi interface via \s-1CPAN\s0 modules like +FFI::Platypus or FFI::Raw. +.SS "On The Road" +.IX Subsection "On The Road" +Many of the examples which follow will concentrate on creating an interface +between Perl and the \s-1ONC+ RPC\s0 bind library functions. The \fBrpcb_gettime()\fR +function is used to demonstrate many features of the \s-1XS\s0 language. This +function has two parameters; the first is an input parameter and the second +is an output parameter. The function also returns a status value. +.PP +.Vb 1 +\& bool_t rpcb_gettime(const char *host, time_t *timep); +.Ve +.PP +From C this function will be called with the following +statements. +.PP +.Vb 4 +\& #include +\& bool_t status; +\& time_t timep; +\& status = rpcb_gettime( "localhost", &timep ); +.Ve +.PP +If an \s-1XSUB\s0 is created to offer a direct translation between this function +and Perl, then this \s-1XSUB\s0 will be used from Perl with the following code. +The \f(CW$status\fR and \f(CW$timep\fR variables will contain the output of the function. +.PP +.Vb 2 +\& use RPC; +\& $status = rpcb_gettime( "localhost", $timep ); +.Ve +.PP +The following \s-1XS\s0 file shows an \s-1XS\s0 subroutine, or \s-1XSUB,\s0 which +demonstrates one possible interface to the \fBrpcb_gettime()\fR +function. This \s-1XSUB\s0 represents a direct translation between +C and Perl and so preserves the interface even from Perl. +This \s-1XSUB\s0 will be invoked from Perl with the usage shown +above. Note that the first three #include statements, for +\&\f(CW\*(C`EXTERN.h\*(C'\fR, \f(CW\*(C`perl.h\*(C'\fR, and \f(CW\*(C`XSUB.h\*(C'\fR, will always be present at the +beginning of an \s-1XS\s0 file. This approach and others will be +expanded later in this document. A #define for \f(CW\*(C`PERL_NO_GET_CONTEXT\*(C'\fR +should be present to fetch the interpreter context more efficiently, +see perlguts for details. +.PP +.Vb 5 +\& #define PERL_NO_GET_CONTEXT +\& #include "EXTERN.h" +\& #include "perl.h" +\& #include "XSUB.h" +\& #include +\& +\& MODULE = RPC PACKAGE = RPC +\& +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t &timep +\& OUTPUT: +\& timep +.Ve +.PP +Any extension to Perl, including those containing XSUBs, +should have a Perl module to serve as the bootstrap which +pulls the extension into Perl. This module will export the +extension's functions and variables to the Perl program and +will cause the extension's XSUBs to be linked into Perl. +The following module will be used for most of the examples +in this document and should be used from Perl with the \f(CW\*(C`use\*(C'\fR +command as shown earlier. Perl modules are explained in +more detail later in this document. +.PP +.Vb 1 +\& package RPC; +\& +\& require Exporter; +\& require DynaLoader; +\& @ISA = qw(Exporter DynaLoader); +\& @EXPORT = qw( rpcb_gettime ); +\& +\& bootstrap RPC; +\& 1; +.Ve +.PP +Throughout this document a variety of interfaces to the \fBrpcb_gettime()\fR +\&\s-1XSUB\s0 will be explored. The XSUBs will take their parameters in different +orders or will take different numbers of parameters. In each case the +\&\s-1XSUB\s0 is an abstraction between Perl and the real C \fBrpcb_gettime()\fR +function, and the \s-1XSUB\s0 must always ensure that the real \fBrpcb_gettime()\fR +function is called with the correct parameters. This abstraction will +allow the programmer to create a more Perl-like interface to the C +function. +.SS "The Anatomy of an \s-1XSUB\s0" +.IX Subsection "The Anatomy of an XSUB" +The simplest XSUBs consist of 3 parts: a description of the return +value, the name of the \s-1XSUB\s0 routine and the names of its arguments, +and a description of types or formats of the arguments. +.PP +The following \s-1XSUB\s0 allows a Perl program to access a C library function +called \fBsin()\fR. The \s-1XSUB\s0 will imitate the C function which takes a single +argument and returns a single value. +.PP +.Vb 3 +\& double +\& sin(x) +\& double x +.Ve +.PP +Optionally, one can merge the description of types and the list of +argument names, rewriting this as +.PP +.Vb 2 +\& double +\& sin(double x) +.Ve +.PP +This makes this \s-1XSUB\s0 look similar to an \s-1ANSI C\s0 declaration. An optional +semicolon is allowed after the argument list, as in +.PP +.Vb 2 +\& double +\& sin(double x); +.Ve +.PP +Parameters with C pointer types can have different semantic: C functions +with similar declarations +.PP +.Vb 2 +\& bool string_looks_as_a_number(char *s); +\& bool make_char_uppercase(char *c); +.Ve +.PP +are used in absolutely incompatible manner. Parameters to these functions +could be described \fBxsubpp\fR like this: +.PP +.Vb 2 +\& char * s +\& char &c +.Ve +.PP +Both these \s-1XS\s0 declarations correspond to the \f(CW\*(C`char*\*(C'\fR C type, but they have +different semantics, see \*(L"The & Unary Operator\*(R". +.PP +It is convenient to think that the indirection operator +\&\f(CW\*(C`*\*(C'\fR should be considered as a part of the type and the address operator \f(CW\*(C`&\*(C'\fR +should be considered part of the variable. See perlxstypemap +for more info about handling qualifiers and unary operators in C types. +.PP +The function name and the return type must be placed on +separate lines and should be flush left-adjusted. +.PP +.Vb 1 +\& INCORRECT CORRECT +\& +\& double sin(x) double +\& double x sin(x) +\& double x +.Ve +.PP +The rest of the function description may be indented or left-adjusted. The +following example shows a function with its body left-adjusted. Most +examples in this document will indent the body for better readability. +.PP +.Vb 1 +\& CORRECT +\& +\& double +\& sin(x) +\& double x +.Ve +.PP +More complicated XSUBs may contain many other sections. Each section of +an \s-1XSUB\s0 starts with the corresponding keyword, such as \s-1INIT:\s0 or \s-1CLEANUP:.\s0 +However, the first two lines of an \s-1XSUB\s0 always contain the same data: +descriptions of the return type and the names of the function and its +parameters. Whatever immediately follows these is considered to be +an \s-1INPUT:\s0 section unless explicitly marked with another keyword. +(See \*(L"The \s-1INPUT:\s0 Keyword\*(R".) +.PP +An \s-1XSUB\s0 section continues until another section-start keyword is found. +.SS "The Argument Stack" +.IX Subsection "The Argument Stack" +The Perl argument stack is used to store the values which are +sent as parameters to the \s-1XSUB\s0 and to store the \s-1XSUB\s0's +return value(s). In reality all Perl functions (including non-XSUB +ones) keep their values on this stack all the same time, each limited +to its own range of positions on the stack. In this document the +first position on that stack which belongs to the active +function will be referred to as position 0 for that function. +.PP +XSUBs refer to their stack arguments with the macro \fB\s-1ST\s0(x)\fR, where \fIx\fR +refers to a position in this \s-1XSUB\s0's part of the stack. Position 0 for that +function would be known to the \s-1XSUB\s0 as \s-1\fBST\s0\fR\|(0). The \s-1XSUB\s0's incoming +parameters and outgoing return values always begin at \s-1\fBST\s0\fR\|(0). For many +simple cases the \fBxsubpp\fR compiler will generate the code necessary to +handle the argument stack by embedding code fragments found in the +typemaps. In more complex cases the programmer must supply the code. +.SS "The \s-1RETVAL\s0 Variable" +.IX Subsection "The RETVAL Variable" +The \s-1RETVAL\s0 variable is a special C variable that is declared automatically +for you. The C type of \s-1RETVAL\s0 matches the return type of the C library +function. The \fBxsubpp\fR compiler will declare this variable in each \s-1XSUB\s0 +with non\-\f(CW\*(C`void\*(C'\fR return type. By default the generated C function +will use \s-1RETVAL\s0 to hold the return value of the C library function being +called. In simple cases the value of \s-1RETVAL\s0 will be placed in \s-1\fBST\s0\fR\|(0) of +the argument stack where it can be received by Perl as the return value +of the \s-1XSUB.\s0 +.PP +If the \s-1XSUB\s0 has a return type of \f(CW\*(C`void\*(C'\fR then the compiler will +not declare a \s-1RETVAL\s0 variable for that function. When using +a \s-1PPCODE:\s0 section no manipulation of the \s-1RETVAL\s0 variable is required, the +section may use direct stack manipulation to place output values on the stack. +.PP +If \s-1PPCODE:\s0 directive is not used, \f(CW\*(C`void\*(C'\fR return value should be used +only for subroutines which do not return a value, \fIeven if\fR \s-1CODE:\s0 +directive is used which sets \s-1\fBST\s0\fR\|(0) explicitly. +.PP +Older versions of this document recommended to use \f(CW\*(C`void\*(C'\fR return +value in such cases. It was discovered that this could lead to +segfaults in cases when \s-1XSUB\s0 was \fItruly\fR \f(CW\*(C`void\*(C'\fR. This practice is +now deprecated, and may be not supported at some future version. Use +the return value \f(CW\*(C`SV *\*(C'\fR in such cases. (Currently \f(CW\*(C`xsubpp\*(C'\fR contains +some heuristic code which tries to disambiguate between \*(L"truly-void\*(R" +and \*(L"old-practice-declared-as-void\*(R" functions. Hence your code is at +mercy of this heuristics unless you use \f(CW\*(C`SV *\*(C'\fR as return value.) +.SS "Returning SVs, AVs and HVs through \s-1RETVAL\s0" +.IX Subsection "Returning SVs, AVs and HVs through RETVAL" +When you're using \s-1RETVAL\s0 to return an \f(CW\*(C`SV *\*(C'\fR, there's some magic +going on behind the scenes that should be mentioned. When you're +manipulating the argument stack using the \s-1ST\s0(x) macro, for example, +you usually have to pay special attention to reference counts. (For +more about reference counts, see perlguts.) To make your life +easier, the typemap file automatically makes \f(CW\*(C`RETVAL\*(C'\fR mortal when +you're returning an \f(CW\*(C`SV *\*(C'\fR. Thus, the following two XSUBs are more +or less equivalent: +.PP +.Vb 6 +\& void +\& alpha() +\& PPCODE: +\& ST(0) = newSVpv("Hello World",0); +\& sv_2mortal(ST(0)); +\& XSRETURN(1); +\& +\& SV * +\& beta() +\& CODE: +\& RETVAL = newSVpv("Hello World",0); +\& OUTPUT: +\& RETVAL +.Ve +.PP +This is quite useful as it usually improves readability. While +this works fine for an \f(CW\*(C`SV *\*(C'\fR, it's unfortunately not as easy +to have \f(CW\*(C`AV *\*(C'\fR or \f(CW\*(C`HV *\*(C'\fR as a return value. You \fIshould\fR be +able to write: +.PP +.Vb 7 +\& AV * +\& array() +\& CODE: +\& RETVAL = newAV(); +\& /* do something with RETVAL */ +\& OUTPUT: +\& RETVAL +.Ve +.PP +But due to an unfixable bug (fixing it would break lots of existing +\&\s-1CPAN\s0 modules) in the typemap file, the reference count of the \f(CW\*(C`AV *\*(C'\fR +is not properly decremented. Thus, the above \s-1XSUB\s0 would leak memory +whenever it is being called. The same problem exists for \f(CW\*(C`HV *\*(C'\fR, +\&\f(CW\*(C`CV *\*(C'\fR, and \f(CW\*(C`SVREF\*(C'\fR (which indicates a scalar reference, not +a general \f(CW\*(C`SV *\*(C'\fR). +In \s-1XS\s0 code on perls starting with perl 5.16, you can override the +typemaps for any of these types with a version that has proper +handling of refcounts. In your \f(CW\*(C`TYPEMAP\*(C'\fR section, do +.PP +.Vb 1 +\& AV* T_AVREF_REFCOUNT_FIXED +.Ve +.PP +to get the repaired variant. For backward compatibility with older +versions of perl, you can instead decrement the reference count +manually when you're returning one of the aforementioned +types using \f(CW\*(C`sv_2mortal\*(C'\fR: +.PP +.Vb 8 +\& AV * +\& array() +\& CODE: +\& RETVAL = newAV(); +\& sv_2mortal((SV*)RETVAL); +\& /* do something with RETVAL */ +\& OUTPUT: +\& RETVAL +.Ve +.PP +Remember that you don't have to do this for an \f(CW\*(C`SV *\*(C'\fR. The reference +documentation for all core typemaps can be found in perlxstypemap. +.SS "The \s-1MODULE\s0 Keyword" +.IX Subsection "The MODULE Keyword" +The \s-1MODULE\s0 keyword is used to start the \s-1XS\s0 code and to specify the package +of the functions which are being defined. All text preceding the first +\&\s-1MODULE\s0 keyword is considered C code and is passed through to the output with +\&\s-1POD\s0 stripped, but otherwise untouched. Every \s-1XS\s0 module will have a +bootstrap function which is used to hook the XSUBs into Perl. The package +name of this bootstrap function will match the value of the last \s-1MODULE\s0 +statement in the \s-1XS\s0 source files. The value of \s-1MODULE\s0 should always remain +constant within the same \s-1XS\s0 file, though this is not required. +.PP +The following example will start the \s-1XS\s0 code and will place +all functions in a package named \s-1RPC.\s0 +.PP +.Vb 1 +\& MODULE = RPC +.Ve +.SS "The \s-1PACKAGE\s0 Keyword" +.IX Subsection "The PACKAGE Keyword" +When functions within an \s-1XS\s0 source file must be separated into packages +the \s-1PACKAGE\s0 keyword should be used. This keyword is used with the \s-1MODULE\s0 +keyword and must follow immediately after it when used. +.PP +.Vb 1 +\& MODULE = RPC PACKAGE = RPC +\& +\& [ XS code in package RPC ] +\& +\& MODULE = RPC PACKAGE = RPCB +\& +\& [ XS code in package RPCB ] +\& +\& MODULE = RPC PACKAGE = RPC +\& +\& [ XS code in package RPC ] +.Ve +.PP +The same package name can be used more than once, allowing for +non-contiguous code. This is useful if you have a stronger ordering +principle than package names. +.PP +Although this keyword is optional and in some cases provides redundant +information it should always be used. This keyword will ensure that the +XSUBs appear in the desired package. +.SS "The \s-1PREFIX\s0 Keyword" +.IX Subsection "The PREFIX Keyword" +The \s-1PREFIX\s0 keyword designates prefixes which should be +removed from the Perl function names. If the C function is +\&\f(CW\*(C`rpcb_gettime()\*(C'\fR and the \s-1PREFIX\s0 value is \f(CW\*(C`rpcb_\*(C'\fR then Perl will +see this function as \f(CW\*(C`gettime()\*(C'\fR. +.PP +This keyword should follow the \s-1PACKAGE\s0 keyword when used. +If \s-1PACKAGE\s0 is not used then \s-1PREFIX\s0 should follow the \s-1MODULE\s0 +keyword. +.PP +.Vb 1 +\& MODULE = RPC PREFIX = rpc_ +\& +\& MODULE = RPC PACKAGE = RPCB PREFIX = rpcb_ +.Ve +.SS "The \s-1OUTPUT:\s0 Keyword" +.IX Subsection "The OUTPUT: Keyword" +The \s-1OUTPUT:\s0 keyword indicates that certain function parameters should be +updated (new values made visible to Perl) when the \s-1XSUB\s0 terminates or that +certain values should be returned to the calling Perl function. For +simple functions which have no \s-1CODE:\s0 or \s-1PPCODE:\s0 section, +such as the \fBsin()\fR function above, the \s-1RETVAL\s0 variable is +automatically designated as an output value. For more complex functions +the \fBxsubpp\fR compiler will need help to determine which variables are output +variables. +.PP +This keyword will normally be used to complement the \s-1CODE:\s0 keyword. +The \s-1RETVAL\s0 variable is not recognized as an output variable when the +\&\s-1CODE:\s0 keyword is present. The \s-1OUTPUT:\s0 keyword is used in this +situation to tell the compiler that \s-1RETVAL\s0 really is an output +variable. +.PP +The \s-1OUTPUT:\s0 keyword can also be used to indicate that function parameters +are output variables. This may be necessary when a parameter has been +modified within the function and the programmer would like the update to +be seen by Perl. +.PP +.Vb 6 +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t &timep +\& OUTPUT: +\& timep +.Ve +.PP +The \s-1OUTPUT:\s0 keyword will also allow an output parameter to +be mapped to a matching piece of code rather than to a +typemap. +.PP +.Vb 6 +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t &timep +\& OUTPUT: +\& timep sv_setnv(ST(1), (double)timep); +.Ve +.PP +\&\fBxsubpp\fR emits an automatic \f(CW\*(C`SvSETMAGIC()\*(C'\fR for all parameters in the +\&\s-1OUTPUT\s0 section of the \s-1XSUB,\s0 except \s-1RETVAL.\s0 This is the usually desired +behavior, as it takes care of properly invoking 'set' magic on output +parameters (needed for hash or array element parameters that must be +created if they didn't exist). If for some reason, this behavior is +not desired, the \s-1OUTPUT\s0 section may contain a \f(CW\*(C`SETMAGIC: DISABLE\*(C'\fR line +to disable it for the remainder of the parameters in the \s-1OUTPUT\s0 section. +Likewise, \f(CW\*(C`SETMAGIC: ENABLE\*(C'\fR can be used to reenable it for the +remainder of the \s-1OUTPUT\s0 section. See perlguts for more details +about 'set' magic. +.SS "The \s-1NO_OUTPUT\s0 Keyword" +.IX Subsection "The NO_OUTPUT Keyword" +The \s-1NO_OUTPUT\s0 can be placed as the first token of the \s-1XSUB.\s0 This keyword +indicates that while the C subroutine we provide an interface to has +a non\-\f(CW\*(C`void\*(C'\fR return type, the return value of this C subroutine should not +be returned from the generated Perl subroutine. +.PP +With this keyword present \*(L"The \s-1RETVAL\s0 Variable\*(R" is created, and in the +generated call to the subroutine this variable is assigned to, but the value +of this variable is not going to be used in the auto-generated code. +.PP +This keyword makes sense only if \f(CW\*(C`RETVAL\*(C'\fR is going to be accessed by the +user-supplied code. It is especially useful to make a function interface +more Perl-like, especially when the C return value is just an error condition +indicator. For example, +.PP +.Vb 5 +\& NO_OUTPUT int +\& delete_file(char *name) +\& POSTCALL: +\& if (RETVAL != 0) +\& croak("Error %d while deleting file \*(Aq%s\*(Aq", RETVAL, name); +.Ve +.PP +Here the generated \s-1XS\s0 function returns nothing on success, and will \fBdie()\fR +with a meaningful error message on error. +.SS "The \s-1CODE:\s0 Keyword" +.IX Subsection "The CODE: Keyword" +This keyword is used in more complicated XSUBs which require +special handling for the C function. The \s-1RETVAL\s0 variable is +still declared, but it will not be returned unless it is specified +in the \s-1OUTPUT:\s0 section. +.PP +The following \s-1XSUB\s0 is for a C function which requires special handling of +its parameters. The Perl usage is given first. +.PP +.Vb 1 +\& $status = rpcb_gettime( "localhost", $timep ); +.Ve +.PP +The \s-1XSUB\s0 follows. +.PP +.Vb 9 +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t timep +\& CODE: +\& RETVAL = rpcb_gettime( host, &timep ); +\& OUTPUT: +\& timep +\& RETVAL +.Ve +.SS "The \s-1INIT:\s0 Keyword" +.IX Subsection "The INIT: Keyword" +The \s-1INIT:\s0 keyword allows initialization to be inserted into the \s-1XSUB\s0 before +the compiler generates the call to the C function. Unlike the \s-1CODE:\s0 keyword +above, this keyword does not affect the way the compiler handles \s-1RETVAL.\s0 +.PP +.Vb 8 +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t &timep +\& INIT: +\& printf("# Host is %s\en", host ); +\& OUTPUT: +\& timep +.Ve +.PP +Another use for the \s-1INIT:\s0 section is to check for preconditions before +making a call to the C function: +.PP +.Vb 9 +\& long long +\& lldiv(a,b) +\& long long a +\& long long b +\& INIT: +\& if (a == 0 && b == 0) +\& XSRETURN_UNDEF; +\& if (b == 0) +\& croak("lldiv: cannot divide by 0"); +.Ve +.SS "The \s-1NO_INIT\s0 Keyword" +.IX Subsection "The NO_INIT Keyword" +The \s-1NO_INIT\s0 keyword is used to indicate that a function +parameter is being used only as an output value. The \fBxsubpp\fR +compiler will normally generate code to read the values of +all function parameters from the argument stack and assign +them to C variables upon entry to the function. \s-1NO_INIT\s0 +will tell the compiler that some parameters will be used for +output rather than for input and that they will be handled +before the function terminates. +.PP +The following example shows a variation of the \fBrpcb_gettime()\fR function. +This function uses the timep variable only as an output variable and does +not care about its initial contents. +.PP +.Vb 6 +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t &timep = NO_INIT +\& OUTPUT: +\& timep +.Ve +.SS "The \s-1TYPEMAP:\s0 Keyword" +.IX Subsection "The TYPEMAP: Keyword" +Starting with Perl 5.16, you can embed typemaps into your \s-1XS\s0 code +instead of or in addition to typemaps in a separate file. Multiple +such embedded typemaps will be processed in order of appearance in +the \s-1XS\s0 code and like local typemap files take precedence over the +default typemap, the embedded typemaps may overwrite previous +definitions of \s-1TYPEMAP, INPUT,\s0 and \s-1OUTPUT\s0 stanzas. The syntax for +embedded typemaps is +.PP +.Vb 3 +\& TYPEMAP: < 1 ) +\& host = (char *)SvPV_nolen(ST(1)); +\& RETVAL = rpcb_gettime( host, &timep ); +\& OUTPUT: +\& timep +\& RETVAL +.Ve +.SS "The C_ARGS: Keyword" +.IX Subsection "The C_ARGS: Keyword" +The C_ARGS: keyword allows creating of \s-1XSUBS\s0 which have different +calling sequence from Perl than from C, without a need to write +\&\s-1CODE:\s0 or \s-1PPCODE:\s0 section. The contents of the C_ARGS: paragraph is +put as the argument to the called C function without any change. +.PP +For example, suppose that a C function is declared as +.PP +.Vb 1 +\& symbolic nth_derivative(int n, symbolic function, int flags); +.Ve +.PP +and that the default flags are kept in a global C variable +\&\f(CW\*(C`default_flags\*(C'\fR. Suppose that you want to create an interface which +is called as +.PP +.Vb 1 +\& $second_deriv = $function\->nth_derivative(2); +.Ve +.PP +To do this, declare the \s-1XSUB\s0 as +.PP +.Vb 6 +\& symbolic +\& nth_derivative(function, n) +\& symbolic function +\& int n +\& C_ARGS: +\& n, function, default_flags +.Ve +.SS "The \s-1PPCODE:\s0 Keyword" +.IX Subsection "The PPCODE: Keyword" +The \s-1PPCODE:\s0 keyword is an alternate form of the \s-1CODE:\s0 keyword and is used +to tell the \fBxsubpp\fR compiler that the programmer is supplying the code to +control the argument stack for the XSUBs return values. Occasionally one +will want an \s-1XSUB\s0 to return a list of values rather than a single value. +In these cases one must use \s-1PPCODE:\s0 and then explicitly push the list of +values on the stack. The \s-1PPCODE:\s0 and \s-1CODE:\s0 keywords should not be used +together within the same \s-1XSUB.\s0 +.PP +The actual difference between \s-1PPCODE:\s0 and \s-1CODE:\s0 sections is in the +initialization of \f(CW\*(C`SP\*(C'\fR macro (which stands for the \fIcurrent\fR Perl +stack pointer), and in the handling of data on the stack when returning +from an \s-1XSUB.\s0 In \s-1CODE:\s0 sections \s-1SP\s0 preserves the value which was on +entry to the \s-1XSUB: SP\s0 is on the function pointer (which follows the +last parameter). In \s-1PPCODE:\s0 sections \s-1SP\s0 is moved backward to the +beginning of the parameter list, which allows \f(CW\*(C`PUSH*()\*(C'\fR macros +to place output values in the place Perl expects them to be when +the \s-1XSUB\s0 returns back to Perl. +.PP +The generated trailer for a \s-1CODE:\s0 section ensures that the number of return +values Perl will see is either 0 or 1 (depending on the \f(CW\*(C`void\*(C'\fRness of the +return value of the C function, and heuristics mentioned in +\&\*(L"The \s-1RETVAL\s0 Variable\*(R"). The trailer generated for a \s-1PPCODE:\s0 section +is based on the number of return values and on the number of times +\&\f(CW\*(C`SP\*(C'\fR was updated by \f(CW\*(C`[X]PUSH*()\*(C'\fR macros. +.PP +Note that macros \f(CWST(i)\fR, \f(CW\*(C`XST_m*()\*(C'\fR and \f(CW\*(C`XSRETURN*()\*(C'\fR work equally +well in \s-1CODE:\s0 sections and \s-1PPCODE:\s0 sections. +.PP +The following \s-1XSUB\s0 will call the C \fBrpcb_gettime()\fR function +and will return its two output values, timep and status, to +Perl as a single list. +.PP +.Vb 11 +\& void +\& rpcb_gettime(host) +\& char *host +\& PREINIT: +\& time_t timep; +\& bool_t status; +\& PPCODE: +\& status = rpcb_gettime( host, &timep ); +\& EXTEND(SP, 2); +\& PUSHs(sv_2mortal(newSViv(status))); +\& PUSHs(sv_2mortal(newSViv(timep))); +.Ve +.PP +Notice that the programmer must supply the C code necessary +to have the real \fBrpcb_gettime()\fR function called and to have +the return values properly placed on the argument stack. +.PP +The \f(CW\*(C`void\*(C'\fR return type for this function tells the \fBxsubpp\fR compiler that +the \s-1RETVAL\s0 variable is not needed or used and that it should not be created. +In most scenarios the void return type should be used with the \s-1PPCODE:\s0 +directive. +.PP +The \s-1\fBEXTEND\s0()\fR macro is used to make room on the argument +stack for 2 return values. The \s-1PPCODE:\s0 directive causes the +\&\fBxsubpp\fR compiler to create a stack pointer available as \f(CW\*(C`SP\*(C'\fR, and it +is this pointer which is being used in the \s-1\fBEXTEND\s0()\fR macro. +The values are then pushed onto the stack with the \fBPUSHs()\fR +macro. +.PP +Now the \fBrpcb_gettime()\fR function can be used from Perl with +the following statement. +.PP +.Vb 1 +\& ($status, $timep) = rpcb_gettime("localhost"); +.Ve +.PP +When handling output parameters with a \s-1PPCODE\s0 section, be sure to handle +\&'set' magic properly. See perlguts for details about 'set' magic. +.SS "Returning Undef And Empty Lists" +.IX Subsection "Returning Undef And Empty Lists" +Occasionally the programmer will want to return simply +\&\f(CW\*(C`undef\*(C'\fR or an empty list if a function fails rather than a +separate status value. The \fBrpcb_gettime()\fR function offers +just this situation. If the function succeeds we would like +to have it return the time and if it fails we would like to +have undef returned. In the following Perl code the value +of \f(CW$timep\fR will either be undef or it will be a valid time. +.PP +.Vb 1 +\& $timep = rpcb_gettime( "localhost" ); +.Ve +.PP +The following \s-1XSUB\s0 uses the \f(CW\*(C`SV *\*(C'\fR return type as a mnemonic only, +and uses a \s-1CODE:\s0 block to indicate to the compiler +that the programmer has supplied all the necessary code. The +\&\fBsv_newmortal()\fR call will initialize the return value to undef, making that +the default return value. +.PP +.Vb 10 +\& SV * +\& rpcb_gettime(host) +\& char * host +\& PREINIT: +\& time_t timep; +\& bool_t x; +\& CODE: +\& ST(0) = sv_newmortal(); +\& if( rpcb_gettime( host, &timep ) ) +\& sv_setnv( ST(0), (double)timep); +.Ve +.PP +The next example demonstrates how one would place an explicit undef in the +return value, should the need arise. +.PP +.Vb 10 +\& SV * +\& rpcb_gettime(host) +\& char * host +\& PREINIT: +\& time_t timep; +\& bool_t x; +\& CODE: +\& if( rpcb_gettime( host, &timep ) ){ +\& ST(0) = sv_newmortal(); +\& sv_setnv( ST(0), (double)timep); +\& } +\& else{ +\& ST(0) = &PL_sv_undef; +\& } +.Ve +.PP +To return an empty list one must use a \s-1PPCODE:\s0 block and +then not push return values on the stack. +.PP +.Vb 12 +\& void +\& rpcb_gettime(host) +\& char *host +\& PREINIT: +\& time_t timep; +\& PPCODE: +\& if( rpcb_gettime( host, &timep ) ) +\& PUSHs(sv_2mortal(newSViv(timep))); +\& else{ +\& /* Nothing pushed on stack, so an empty +\& * list is implicitly returned. */ +\& } +.Ve +.PP +Some people may be inclined to include an explicit \f(CW\*(C`return\*(C'\fR in the above +\&\s-1XSUB,\s0 rather than letting control fall through to the end. In those +situations \f(CW\*(C`XSRETURN_EMPTY\*(C'\fR should be used, instead. This will ensure that +the \s-1XSUB\s0 stack is properly adjusted. Consult perlapi for other +\&\f(CW\*(C`XSRETURN\*(C'\fR macros. +.PP +Since \f(CW\*(C`XSRETURN_*\*(C'\fR macros can be used with \s-1CODE\s0 blocks as well, one can +rewrite this example as: +.PP +.Vb 11 +\& int +\& rpcb_gettime(host) +\& char *host +\& PREINIT: +\& time_t timep; +\& CODE: +\& RETVAL = rpcb_gettime( host, &timep ); +\& if (RETVAL == 0) +\& XSRETURN_UNDEF; +\& OUTPUT: +\& RETVAL +.Ve +.PP +In fact, one can put this check into a \s-1POSTCALL:\s0 section as well. Together +with \s-1PREINIT:\s0 simplifications, this leads to: +.PP +.Vb 7 +\& int +\& rpcb_gettime(host) +\& char *host +\& time_t timep; +\& POSTCALL: +\& if (RETVAL == 0) +\& XSRETURN_UNDEF; +.Ve +.SS "The \s-1REQUIRE:\s0 Keyword" +.IX Subsection "The REQUIRE: Keyword" +The \s-1REQUIRE:\s0 keyword is used to indicate the minimum version of the +\&\fBxsubpp\fR compiler needed to compile the \s-1XS\s0 module. An \s-1XS\s0 module which +contains the following statement will compile with only \fBxsubpp\fR version +1.922 or greater: +.PP +.Vb 1 +\& REQUIRE: 1.922 +.Ve +.SS "The \s-1CLEANUP:\s0 Keyword" +.IX Subsection "The CLEANUP: Keyword" +This keyword can be used when an \s-1XSUB\s0 requires special cleanup procedures +before it terminates. When the \s-1CLEANUP:\s0 keyword is used it must follow +any \s-1CODE:,\s0 or \s-1OUTPUT:\s0 blocks which are present in the \s-1XSUB.\s0 The code +specified for the cleanup block will be added as the last statements in +the \s-1XSUB.\s0 +.SS "The \s-1POSTCALL:\s0 Keyword" +.IX Subsection "The POSTCALL: Keyword" +This keyword can be used when an \s-1XSUB\s0 requires special procedures +executed after the C subroutine call is performed. When the \s-1POSTCALL:\s0 +keyword is used it must precede \s-1OUTPUT:\s0 and \s-1CLEANUP:\s0 blocks which are +present in the \s-1XSUB.\s0 +.PP +See examples in \*(L"The \s-1NO_OUTPUT\s0 Keyword\*(R" and \*(L"Returning Undef And Empty Lists\*(R". +.PP +The \s-1POSTCALL:\s0 block does not make a lot of sense when the C subroutine +call is supplied by user by providing either \s-1CODE:\s0 or \s-1PPCODE:\s0 section. +.SS "The \s-1BOOT:\s0 Keyword" +.IX Subsection "The BOOT: Keyword" +The \s-1BOOT:\s0 keyword is used to add code to the extension's bootstrap +function. The bootstrap function is generated by the \fBxsubpp\fR compiler and +normally holds the statements necessary to register any XSUBs with Perl. +With the \s-1BOOT:\s0 keyword the programmer can tell the compiler to add extra +statements to the bootstrap function. +.PP +This keyword may be used any time after the first \s-1MODULE\s0 keyword and should +appear on a line by itself. The first blank line after the keyword will +terminate the code block. +.PP +.Vb 4 +\& BOOT: +\& # The following message will be printed when the +\& # bootstrap function executes. +\& printf("Hello from the bootstrap!\en"); +.Ve +.SS "The \s-1VERSIONCHECK:\s0 Keyword" +.IX Subsection "The VERSIONCHECK: Keyword" +The \s-1VERSIONCHECK:\s0 keyword corresponds to \fBxsubpp\fR's \f(CW\*(C`\-versioncheck\*(C'\fR and +\&\f(CW\*(C`\-noversioncheck\*(C'\fR options. This keyword overrides the command line +options. Version checking is enabled by default. When version checking is +enabled the \s-1XS\s0 module will attempt to verify that its version matches the +version of the \s-1PM\s0 module. +.PP +To enable version checking: +.PP +.Vb 1 +\& VERSIONCHECK: ENABLE +.Ve +.PP +To disable version checking: +.PP +.Vb 1 +\& VERSIONCHECK: DISABLE +.Ve +.PP +Note that if the version of the \s-1PM\s0 module is an \s-1NV\s0 (a floating point +number), it will be stringified with a possible loss of precision +(currently chopping to nine decimal places) so that it may not match +the version of the \s-1XS\s0 module anymore. Quoting the \f(CW$VERSION\fR declaration +to make it a string is recommended if long version numbers are used. +.SS "The \s-1PROTOTYPES:\s0 Keyword" +.IX Subsection "The PROTOTYPES: Keyword" +The \s-1PROTOTYPES:\s0 keyword corresponds to \fBxsubpp\fR's \f(CW\*(C`\-prototypes\*(C'\fR and +\&\f(CW\*(C`\-noprototypes\*(C'\fR options. This keyword overrides the command line options. +Prototypes are disabled by default. When prototypes are enabled, XSUBs will +be given Perl prototypes. This keyword may be used multiple times in an \s-1XS\s0 +module to enable and disable prototypes for different parts of the module. +Note that \fBxsubpp\fR will nag you if you don't explicitly enable or disable +prototypes, with: +.PP +.Vb 1 +\& Please specify prototyping behavior for Foo.xs (see perlxs manual) +.Ve +.PP +To enable prototypes: +.PP +.Vb 1 +\& PROTOTYPES: ENABLE +.Ve +.PP +To disable prototypes: +.PP +.Vb 1 +\& PROTOTYPES: DISABLE +.Ve +.SS "The \s-1PROTOTYPE:\s0 Keyword" +.IX Subsection "The PROTOTYPE: Keyword" +This keyword is similar to the \s-1PROTOTYPES:\s0 keyword above but can be used to +force \fBxsubpp\fR to use a specific prototype for the \s-1XSUB.\s0 This keyword +overrides all other prototype options and keywords but affects only the +current \s-1XSUB.\s0 Consult \*(L"Prototypes\*(R" in perlsub for information about Perl +prototypes. +.PP +.Vb 10 +\& bool_t +\& rpcb_gettime(timep, ...) +\& time_t timep = NO_INIT +\& PROTOTYPE: $;$ +\& PREINIT: +\& char *host = "localhost"; +\& CODE: +\& if( items > 1 ) +\& host = (char *)SvPV_nolen(ST(1)); +\& RETVAL = rpcb_gettime( host, &timep ); +\& OUTPUT: +\& timep +\& RETVAL +.Ve +.PP +If the prototypes are enabled, you can disable it locally for a given +\&\s-1XSUB\s0 as in the following example: +.PP +.Vb 4 +\& void +\& rpcb_gettime_noproto() +\& PROTOTYPE: DISABLE +\& ... +.Ve +.SS "The \s-1ALIAS:\s0 Keyword" +.IX Subsection "The ALIAS: Keyword" +The \s-1ALIAS:\s0 keyword allows an \s-1XSUB\s0 to have two or more unique Perl names +and to know which of those names was used when it was invoked. The Perl +names may be fully-qualified with package names. Each alias is given an +index. The compiler will setup a variable called \f(CW\*(C`ix\*(C'\fR which contain the +index of the alias which was used. When the \s-1XSUB\s0 is called with its +declared name \f(CW\*(C`ix\*(C'\fR will be 0. +.PP +The following example will create aliases \f(CW\*(C`FOO::gettime()\*(C'\fR and +\&\f(CW\*(C`BAR::getit()\*(C'\fR for this function. +.PP +.Vb 11 +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t &timep +\& ALIAS: +\& FOO::gettime = 1 +\& BAR::getit = 2 +\& INIT: +\& printf("# ix = %d\en", ix ); +\& OUTPUT: +\& timep +.Ve +.SS "The \s-1OVERLOAD:\s0 Keyword" +.IX Subsection "The OVERLOAD: Keyword" +Instead of writing an overloaded interface using pure Perl, you +can also use the \s-1OVERLOAD\s0 keyword to define additional Perl names +for your functions (like the \s-1ALIAS:\s0 keyword above). However, the +overloaded functions must be defined in such a way as to accept the number +of parameters supplied by perl's overload system. For most overload +methods, it will be three parameters; for the \f(CW\*(C`nomethod\*(C'\fR function it will +be four. However, the bitwise operators \f(CW\*(C`&\*(C'\fR, \f(CW\*(C`|\*(C'\fR, \f(CW\*(C`^\*(C'\fR, and \f(CW\*(C`~\*(C'\fR may be +called with three \fIor\fR five arguments (see overload). +.PP +If any +function has the \s-1OVERLOAD:\s0 keyword, several additional lines +will be defined in the c file generated by xsubpp in order to +register with the overload magic. +.PP +Since blessed objects are actually stored as \s-1RV\s0's, it is useful +to use the typemap features to preprocess parameters and extract +the actual \s-1SV\s0 stored within the blessed \s-1RV.\s0 See the sample for +T_PTROBJ_SPECIAL below. +.PP +To use the \s-1OVERLOAD:\s0 keyword, create an \s-1XS\s0 function which takes +three input parameters (or use the C\-style '...' definition) like +this: +.PP +.Vb 7 +\& SV * +\& cmp (lobj, robj, swap) +\& My_Module_obj lobj +\& My_Module_obj robj +\& IV swap +\& OVERLOAD: cmp <=> +\& { /* function defined here */} +.Ve +.PP +In this case, the function will overload both of the three way +comparison operators. For all overload operations using non-alpha +characters, you must type the parameter without quoting, separating +multiple overloads with whitespace. Note that "\*(L" (the stringify +overload) should be entered as \e\*(R"\e" (i.e. escaped). +.PP +Since, as mentioned above, bitwise operators may take extra arguments, you +may want to use something like \f(CW\*(C`(lobj, robj, swap, ...)\*(C'\fR (with +literal \f(CW\*(C`...\*(C'\fR) as your parameter list. +.SS "The \s-1FALLBACK:\s0 Keyword" +.IX Subsection "The FALLBACK: Keyword" +In addition to the \s-1OVERLOAD\s0 keyword, if you need to control how +Perl autogenerates missing overloaded operators, you can set the +\&\s-1FALLBACK\s0 keyword in the module header section, like this: +.PP +.Vb 1 +\& MODULE = RPC PACKAGE = RPC +\& +\& FALLBACK: TRUE +\& ... +.Ve +.PP +where \s-1FALLBACK\s0 can take any of the three values \s-1TRUE, FALSE,\s0 or +\&\s-1UNDEF.\s0 If you do not set any \s-1FALLBACK\s0 value when using \s-1OVERLOAD,\s0 +it defaults to \s-1UNDEF.\s0 \s-1FALLBACK\s0 is not used except when one or +more functions using \s-1OVERLOAD\s0 have been defined. Please see +\&\*(L"fallback\*(R" in overload for more details. +.SS "The \s-1INTERFACE:\s0 Keyword" +.IX Subsection "The INTERFACE: Keyword" +This keyword declares the current \s-1XSUB\s0 as a keeper of the given +calling signature. If some text follows this keyword, it is +considered as a list of functions which have this signature, and +should be attached to the current \s-1XSUB.\s0 +.PP +For example, if you have 4 C functions \fBmultiply()\fR, \fBdivide()\fR, \fBadd()\fR, +\&\fBsubtract()\fR all having the signature: +.PP +.Vb 1 +\& symbolic f(symbolic, symbolic); +.Ve +.PP +you can make them all to use the same \s-1XSUB\s0 using this: +.PP +.Vb 7 +\& symbolic +\& interface_s_ss(arg1, arg2) +\& symbolic arg1 +\& symbolic arg2 +\& INTERFACE: +\& multiply divide +\& add subtract +.Ve +.PP +(This is the complete \s-1XSUB\s0 code for 4 Perl functions!) Four generated +Perl function share names with corresponding C functions. +.PP +The advantage of this approach comparing to \s-1ALIAS:\s0 keyword is that there +is no need to code a switch statement, each Perl function (which shares +the same \s-1XSUB\s0) knows which C function it should call. Additionally, one +can attach an extra function \fBremainder()\fR at runtime by using +.PP +.Vb 3 +\& CV *mycv = newXSproto("Symbolic::remainder", +\& XS_Symbolic_interface_s_ss, _\|_FILE_\|_, "$$"); +\& XSINTERFACE_FUNC_SET(mycv, remainder); +.Ve +.PP +say, from another \s-1XSUB.\s0 (This example supposes that there was no +\&\s-1INTERFACE_MACRO:\s0 section, otherwise one needs to use something else instead of +\&\f(CW\*(C`XSINTERFACE_FUNC_SET\*(C'\fR, see the next section.) +.SS "The \s-1INTERFACE_MACRO:\s0 Keyword" +.IX Subsection "The INTERFACE_MACRO: Keyword" +This keyword allows one to define an \s-1INTERFACE\s0 using a different way +to extract a function pointer from an \s-1XSUB.\s0 The text which follows +this keyword should give the name of macros which would extract/set a +function pointer. The extractor macro is given return type, \f(CW\*(C`CV*\*(C'\fR, +and \f(CW\*(C`XSANY.any_dptr\*(C'\fR for this \f(CW\*(C`CV*\*(C'\fR. The setter macro is given cv, +and the function pointer. +.PP +The default value is \f(CW\*(C`XSINTERFACE_FUNC\*(C'\fR and \f(CW\*(C`XSINTERFACE_FUNC_SET\*(C'\fR. +An \s-1INTERFACE\s0 keyword with an empty list of functions can be omitted if +\&\s-1INTERFACE_MACRO\s0 keyword is used. +.PP +Suppose that in the previous example functions pointers for +\&\fBmultiply()\fR, \fBdivide()\fR, \fBadd()\fR, \fBsubtract()\fR are kept in a global C array +\&\f(CW\*(C`fp[]\*(C'\fR with offsets being \f(CW\*(C`multiply_off\*(C'\fR, \f(CW\*(C`divide_off\*(C'\fR, \f(CW\*(C`add_off\*(C'\fR, +\&\f(CW\*(C`subtract_off\*(C'\fR. Then one can use +.PP +.Vb 4 +\& #define XSINTERFACE_FUNC_BYOFFSET(ret,cv,f) \e +\& ((XSINTERFACE_CVT_ANON(ret))fp[CvXSUBANY(cv).any_i32]) +\& #define XSINTERFACE_FUNC_BYOFFSET_set(cv,f) \e +\& CvXSUBANY(cv).any_i32 = CAT2( f, _off ) +.Ve +.PP +in C section, +.PP +.Vb 10 +\& symbolic +\& interface_s_ss(arg1, arg2) +\& symbolic arg1 +\& symbolic arg2 +\& INTERFACE_MACRO: +\& XSINTERFACE_FUNC_BYOFFSET +\& XSINTERFACE_FUNC_BYOFFSET_set +\& INTERFACE: +\& multiply divide +\& add subtract +.Ve +.PP +in \s-1XSUB\s0 section. +.SS "The \s-1INCLUDE:\s0 Keyword" +.IX Subsection "The INCLUDE: Keyword" +This keyword can be used to pull other files into the \s-1XS\s0 module. The other +files may have \s-1XS\s0 code. \s-1INCLUDE:\s0 can also be used to run a command to +generate the \s-1XS\s0 code to be pulled into the module. +.PP +The file \fIRpcb1.xsh\fR contains our \f(CW\*(C`rpcb_gettime()\*(C'\fR function: +.PP +.Vb 6 +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t &timep +\& OUTPUT: +\& timep +.Ve +.PP +The \s-1XS\s0 module can use \s-1INCLUDE:\s0 to pull that file into it. +.PP +.Vb 1 +\& INCLUDE: Rpcb1.xsh +.Ve +.PP +If the parameters to the \s-1INCLUDE:\s0 keyword are followed by a pipe (\f(CW\*(C`|\*(C'\fR) then +the compiler will interpret the parameters as a command. This feature is +mildly deprecated in favour of the \f(CW\*(C`INCLUDE_COMMAND:\*(C'\fR directive, as documented +below. +.PP +.Vb 1 +\& INCLUDE: cat Rpcb1.xsh | +.Ve +.PP +Do not use this to run perl: \f(CW\*(C`INCLUDE: perl |\*(C'\fR will run the perl that +happens to be the first in your path and not necessarily the same perl that is +used to run \f(CW\*(C`xsubpp\*(C'\fR. See \*(L"The \s-1INCLUDE_COMMAND:\s0 Keyword\*(R". +.SS "The \s-1INCLUDE_COMMAND:\s0 Keyword" +.IX Subsection "The INCLUDE_COMMAND: Keyword" +Runs the supplied command and includes its output into the current \s-1XS\s0 +document. \f(CW\*(C`INCLUDE_COMMAND\*(C'\fR assigns special meaning to the \f(CW$^X\fR token +in that it runs the same perl interpreter that is running \f(CW\*(C`xsubpp\*(C'\fR: +.PP +.Vb 1 +\& INCLUDE_COMMAND: cat Rpcb1.xsh +\& +\& INCLUDE_COMMAND: $^X \-e ... +.Ve +.SS "The \s-1CASE:\s0 Keyword" +.IX Subsection "The CASE: Keyword" +The \s-1CASE:\s0 keyword allows an \s-1XSUB\s0 to have multiple distinct parts with each +part acting as a virtual \s-1XSUB.\s0 \s-1CASE:\s0 is greedy and if it is used then all +other \s-1XS\s0 keywords must be contained within a \s-1CASE:.\s0 This means nothing may +precede the first \s-1CASE:\s0 in the \s-1XSUB\s0 and anything following the last \s-1CASE:\s0 is +included in that case. +.PP +A \s-1CASE:\s0 might switch via a parameter of the \s-1XSUB,\s0 via the \f(CW\*(C`ix\*(C'\fR \s-1ALIAS:\s0 +variable (see \*(L"The \s-1ALIAS:\s0 Keyword\*(R"), or maybe via the \f(CW\*(C`items\*(C'\fR variable +(see \*(L"Variable-length Parameter Lists\*(R"). The last \s-1CASE:\s0 becomes the +\&\fBdefault\fR case if it is not associated with a conditional. The following +example shows \s-1CASE\s0 switched via \f(CW\*(C`ix\*(C'\fR with a function \f(CW\*(C`rpcb_gettime()\*(C'\fR +having an alias \f(CW\*(C`x_gettime()\*(C'\fR. When the function is called as +\&\f(CW\*(C`rpcb_gettime()\*(C'\fR its parameters are the usual \f(CW\*(C`(char *host, time_t *timep)\*(C'\fR, +but when the function is called as \f(CW\*(C`x_gettime()\*(C'\fR its parameters are +reversed, \f(CW\*(C`(time_t *timep, char *host)\*(C'\fR. +.PP +.Vb 10 +\& long +\& rpcb_gettime(a,b) +\& CASE: ix == 1 +\& ALIAS: +\& x_gettime = 1 +\& INPUT: +\& # \*(Aqa\*(Aq is timep, \*(Aqb\*(Aq is host +\& char *b +\& time_t a = NO_INIT +\& CODE: +\& RETVAL = rpcb_gettime( b, &a ); +\& OUTPUT: +\& a +\& RETVAL +\& CASE: +\& # \*(Aqa\*(Aq is host, \*(Aqb\*(Aq is timep +\& char *a +\& time_t &b = NO_INIT +\& OUTPUT: +\& b +\& RETVAL +.Ve +.PP +That function can be called with either of the following statements. Note +the different argument lists. +.PP +.Vb 1 +\& $status = rpcb_gettime( $host, $timep ); +\& +\& $status = x_gettime( $timep, $host ); +.Ve +.SS "The \s-1EXPORT_XSUB_SYMBOLS:\s0 Keyword" +.IX Subsection "The EXPORT_XSUB_SYMBOLS: Keyword" +The \s-1EXPORT_XSUB_SYMBOLS:\s0 keyword is likely something you will never need. +In perl versions earlier than 5.16.0, this keyword does nothing. Starting +with 5.16, \s-1XSUB\s0 symbols are no longer exported by default. That is, they +are \f(CW\*(C`static\*(C'\fR functions. If you include +.PP +.Vb 1 +\& EXPORT_XSUB_SYMBOLS: ENABLE +.Ve +.PP +in your \s-1XS\s0 code, the XSUBs following this line will not be declared \f(CW\*(C`static\*(C'\fR. +You can later disable this with +.PP +.Vb 1 +\& EXPORT_XSUB_SYMBOLS: DISABLE +.Ve +.PP +which, again, is the default that you should probably never change. +You cannot use this keyword on versions of perl before 5.16 to make +XSUBs \f(CW\*(C`static\*(C'\fR. +.SS "The & Unary Operator" +.IX Subsection "The & Unary Operator" +The \f(CW\*(C`&\*(C'\fR unary operator in the \s-1INPUT:\s0 section is used to tell \fBxsubpp\fR +that it should convert a Perl value to/from C using the C type to the left +of \f(CW\*(C`&\*(C'\fR, but provide a pointer to this value when the C function is called. +.PP +This is useful to avoid a \s-1CODE:\s0 block for a C function which takes a parameter +by reference. Typically, the parameter should be not a pointer type (an +\&\f(CW\*(C`int\*(C'\fR or \f(CW\*(C`long\*(C'\fR but not an \f(CW\*(C`int*\*(C'\fR or \f(CW\*(C`long*\*(C'\fR). +.PP +The following \s-1XSUB\s0 will generate incorrect C code. The \fBxsubpp\fR compiler will +turn this into code which calls \f(CW\*(C`rpcb_gettime()\*(C'\fR with parameters \f(CW\*(C`(char +*host, time_t timep)\*(C'\fR, but the real \f(CW\*(C`rpcb_gettime()\*(C'\fR wants the \f(CW\*(C`timep\*(C'\fR +parameter to be of type \f(CW\*(C`time_t*\*(C'\fR rather than \f(CW\*(C`time_t\*(C'\fR. +.PP +.Vb 6 +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t timep +\& OUTPUT: +\& timep +.Ve +.PP +That problem is corrected by using the \f(CW\*(C`&\*(C'\fR operator. The \fBxsubpp\fR compiler +will now turn this into code which calls \f(CW\*(C`rpcb_gettime()\*(C'\fR correctly with +parameters \f(CW\*(C`(char *host, time_t *timep)\*(C'\fR. It does this by carrying the +\&\f(CW\*(C`&\*(C'\fR through, so the function call looks like \f(CW\*(C`rpcb_gettime(host, &timep)\*(C'\fR. +.PP +.Vb 6 +\& bool_t +\& rpcb_gettime(host,timep) +\& char *host +\& time_t &timep +\& OUTPUT: +\& timep +.Ve +.SS "Inserting \s-1POD,\s0 Comments and C Preprocessor Directives" +.IX Subsection "Inserting POD, Comments and C Preprocessor Directives" +C preprocessor directives are allowed within \s-1BOOT:, PREINIT: INIT:, CODE:, +PPCODE:, POSTCALL:,\s0 and \s-1CLEANUP:\s0 blocks, as well as outside the functions. +Comments are allowed anywhere after the \s-1MODULE\s0 keyword. The compiler will +pass the preprocessor directives through untouched and will remove the +commented lines. \s-1POD\s0 documentation is allowed at any point, both in the +C and \s-1XS\s0 language sections. \s-1POD\s0 must be terminated with a \f(CW\*(C`=cut\*(C'\fR command; +\&\f(CW\*(C`xsubpp\*(C'\fR will exit with an error if it does not. It is very unlikely that +human generated C code will be mistaken for \s-1POD,\s0 as most indenting styles +result in whitespace in front of any line starting with \f(CW\*(C`=\*(C'\fR. Machine +generated \s-1XS\s0 files may fall into this trap unless care is taken to +ensure that a space breaks the sequence \*(L"\en=\*(R". +.PP +Comments can be added to XSUBs by placing a \f(CW\*(C`#\*(C'\fR as the first +non-whitespace of a line. Care should be taken to avoid making the +comment look like a C preprocessor directive, lest it be interpreted as +such. The simplest way to prevent this is to put whitespace in front of +the \f(CW\*(C`#\*(C'\fR. +.PP +If you use preprocessor directives to choose one of two +versions of a function, use +.PP +.Vb 3 +\& #if ... version1 +\& #else /* ... version2 */ +\& #endif +.Ve +.PP +and not +.PP +.Vb 4 +\& #if ... version1 +\& #endif +\& #if ... version2 +\& #endif +.Ve +.PP +because otherwise \fBxsubpp\fR will believe that you made a duplicate +definition of the function. Also, put a blank line before the +#else/#endif so it will not be seen as part of the function body. +.SS "Using \s-1XS\s0 With \*(C+" +.IX Subsection "Using XS With " +If an \s-1XSUB\s0 name contains \f(CW\*(C`::\*(C'\fR, it is considered to be a \*(C+ method. +The generated Perl function will assume that +its first argument is an object pointer. The object pointer +will be stored in a variable called \s-1THIS.\s0 The object should +have been created by \*(C+ with the \fBnew()\fR function and should +be blessed by Perl with the \fBsv_setref_pv()\fR macro. The +blessing of the object by Perl can be handled by a typemap. An example +typemap is shown at the end of this section. +.PP +If the return type of the \s-1XSUB\s0 includes \f(CW\*(C`static\*(C'\fR, the method is considered +to be a static method. It will call the \*(C+ +function using the \fBclass::method()\fR syntax. If the method is not static +the function will be called using the \s-1THIS\-\s0>\fBmethod()\fR syntax. +.PP +The next examples will use the following \*(C+ class. +.PP +.Vb 6 +\& class color { +\& public: +\& color(); +\& ~color(); +\& int blue(); +\& void set_blue( int ); +\& +\& private: +\& int c_blue; +\& }; +.Ve +.PP +The XSUBs for the \fBblue()\fR and \fBset_blue()\fR methods are defined with the class +name but the parameter for the object (\s-1THIS,\s0 or \*(L"self\*(R") is implicit and is +not listed. +.PP +.Vb 2 +\& int +\& color::blue() +\& +\& void +\& color::set_blue( val ) +\& int val +.Ve +.PP +Both Perl functions will expect an object as the first parameter. In the +generated \*(C+ code the object is called \f(CW\*(C`THIS\*(C'\fR, and the method call will +be performed on this object. So in the \*(C+ code the \fBblue()\fR and \fBset_blue()\fR +methods will be called as this: +.PP +.Vb 1 +\& RETVAL = THIS\->blue(); +\& +\& THIS\->set_blue( val ); +.Ve +.PP +You could also write a single get/set method using an optional argument: +.PP +.Vb 10 +\& int +\& color::blue( val = NO_INIT ) +\& int val +\& PROTOTYPE $;$ +\& CODE: +\& if (items > 1) +\& THIS\->set_blue( val ); +\& RETVAL = THIS\->blue(); +\& OUTPUT: +\& RETVAL +.Ve +.PP +If the function's name is \fB\s-1DESTROY\s0\fR then the \*(C+ \f(CW\*(C`delete\*(C'\fR function will be +called and \f(CW\*(C`THIS\*(C'\fR will be given as its parameter. The generated \*(C+ code for +.PP +.Vb 2 +\& void +\& color::DESTROY() +.Ve +.PP +will look like this: +.PP +.Vb 1 +\& color *THIS = ...; // Initialized as in typemap +\& +\& delete THIS; +.Ve +.PP +If the function's name is \fBnew\fR then the \*(C+ \f(CW\*(C`new\*(C'\fR function will be called +to create a dynamic \*(C+ object. The \s-1XSUB\s0 will expect the class name, which +will be kept in a variable called \f(CW\*(C`CLASS\*(C'\fR, to be given as the first +argument. +.PP +.Vb 2 +\& color * +\& color::new() +.Ve +.PP +The generated \*(C+ code will call \f(CW\*(C`new\*(C'\fR. +.PP +.Vb 1 +\& RETVAL = new color(); +.Ve +.PP +The following is an example of a typemap that could be used for this \*(C+ +example. +.PP +.Vb 2 +\& TYPEMAP +\& color * O_OBJECT +\& +\& OUTPUT +\& # The Perl object is blessed into \*(AqCLASS\*(Aq, which should be a +\& # char* having the name of the package for the blessing. +\& O_OBJECT +\& sv_setref_pv( $arg, CLASS, (void*)$var ); +\& +\& INPUT +\& O_OBJECT +\& if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) +\& $var = ($type)SvIV((SV*)SvRV( $arg )); +\& else{ +\& warn(\e"${Package}::$func_name() \-\- \e" +\& \e"$var is not a blessed SV reference\e"); +\& XSRETURN_UNDEF; +\& } +.Ve +.SS "Interface Strategy" +.IX Subsection "Interface Strategy" +When designing an interface between Perl and a C library a straight +translation from C to \s-1XS\s0 (such as created by \f(CW\*(C`h2xs \-x\*(C'\fR) is often sufficient. +However, sometimes the interface will look +very C\-like and occasionally nonintuitive, especially when the C function +modifies one of its parameters, or returns failure inband (as in \*(L"negative +return values mean failure\*(R"). In cases where the programmer wishes to +create a more Perl-like interface the following strategy may help to +identify the more critical parts of the interface. +.PP +Identify the C functions with input/output or output parameters. The XSUBs for +these functions may be able to return lists to Perl. +.PP +Identify the C functions which use some inband info as an indication +of failure. They may be +candidates to return undef or an empty list in case of failure. If the +failure may be detected without a call to the C function, you may want to use +an \s-1INIT:\s0 section to report the failure. For failures detectable after the C +function returns one may want to use a \s-1POSTCALL:\s0 section to process the +failure. In more complicated cases use \s-1CODE:\s0 or \s-1PPCODE:\s0 sections. +.PP +If many functions use the same failure indication based on the return value, +you may want to create a special typedef to handle this situation. Put +.PP +.Vb 1 +\& typedef int negative_is_failure; +.Ve +.PP +near the beginning of \s-1XS\s0 file, and create an \s-1OUTPUT\s0 typemap entry +for \f(CW\*(C`negative_is_failure\*(C'\fR which converts negative values to \f(CW\*(C`undef\*(C'\fR, or +maybe \fBcroak()\fRs. After this the return value of type \f(CW\*(C`negative_is_failure\*(C'\fR +will create more Perl-like interface. +.PP +Identify which values are used by only the C and \s-1XSUB\s0 functions +themselves, say, when a parameter to a function should be a contents of a +global variable. If Perl does not need to access the contents of the value +then it may not be necessary to provide a translation for that value +from C to Perl. +.PP +Identify the pointers in the C function parameter lists and return +values. Some pointers may be used to implement input/output or +output parameters, they can be handled in \s-1XS\s0 with the \f(CW\*(C`&\*(C'\fR unary operator, +and, possibly, using the \s-1NO_INIT\s0 keyword. +Some others will require handling of types like \f(CW\*(C`int *\*(C'\fR, and one needs +to decide what a useful Perl translation will do in such a case. When +the semantic is clear, it is advisable to put the translation into a typemap +file. +.PP +Identify the structures used by the C functions. In many +cases it may be helpful to use the T_PTROBJ typemap for +these structures so they can be manipulated by Perl as +blessed objects. (This is handled automatically by \f(CW\*(C`h2xs \-x\*(C'\fR.) +.PP +If the same C type is used in several different contexts which require +different translations, \f(CW\*(C`typedef\*(C'\fR several new types mapped to this C type, +and create separate \fItypemap\fR entries for these new types. Use these +types in declarations of return type and parameters to XSUBs. +.SS "Perl Objects And C Structures" +.IX Subsection "Perl Objects And C Structures" +When dealing with C structures one should select either +\&\fBT_PTROBJ\fR or \fBT_PTRREF\fR for the \s-1XS\s0 type. Both types are +designed to handle pointers to complex objects. The +T_PTRREF type will allow the Perl object to be unblessed +while the T_PTROBJ type requires that the object be blessed. +By using T_PTROBJ one can achieve a form of type-checking +because the \s-1XSUB\s0 will attempt to verify that the Perl object +is of the expected type. +.PP +The following \s-1XS\s0 code shows the \fBgetnetconfigent()\fR function which is used +with \s-1ONC+ TIRPC.\s0 The \fBgetnetconfigent()\fR function will return a pointer to a +C structure and has the C prototype shown below. The example will +demonstrate how the C pointer will become a Perl reference. Perl will +consider this reference to be a pointer to a blessed object and will +attempt to call a destructor for the object. A destructor will be +provided in the \s-1XS\s0 source to free the memory used by \fBgetnetconfigent()\fR. +Destructors in \s-1XS\s0 can be created by specifying an \s-1XSUB\s0 function whose name +ends with the word \fB\s-1DESTROY\s0\fR. \s-1XS\s0 destructors can be used to free memory +which may have been malloc'd by another \s-1XSUB.\s0 +.PP +.Vb 1 +\& struct netconfig *getnetconfigent(const char *netid); +.Ve +.PP +A \f(CW\*(C`typedef\*(C'\fR will be created for \f(CW\*(C`struct netconfig\*(C'\fR. The Perl +object will be blessed in a class matching the name of the C +type, with the tag \f(CW\*(C`Ptr\*(C'\fR appended, and the name should not +have embedded spaces if it will be a Perl package name. The +destructor will be placed in a class corresponding to the +class of the object and the \s-1PREFIX\s0 keyword will be used to +trim the name to the word \s-1DESTROY\s0 as Perl will expect. +.PP +.Vb 1 +\& typedef struct netconfig Netconfig; +\& +\& MODULE = RPC PACKAGE = RPC +\& +\& Netconfig * +\& getnetconfigent(netid) +\& char *netid +\& +\& MODULE = RPC PACKAGE = NetconfigPtr PREFIX = rpcb_ +\& +\& void +\& rpcb_DESTROY(netconf) +\& Netconfig *netconf +\& CODE: +\& printf("Now in NetconfigPtr::DESTROY\en"); +\& free( netconf ); +.Ve +.PP +This example requires the following typemap entry. Consult +perlxstypemap for more information about adding new typemaps +for an extension. +.PP +.Vb 2 +\& TYPEMAP +\& Netconfig * T_PTROBJ +.Ve +.PP +This example will be used with the following Perl statements. +.PP +.Vb 2 +\& use RPC; +\& $netconf = getnetconfigent("udp"); +.Ve +.PP +When Perl destroys the object referenced by \f(CW$netconf\fR it will send the +object to the supplied \s-1XSUB DESTROY\s0 function. Perl cannot determine, and +does not care, that this object is a C struct and not a Perl object. In +this sense, there is no difference between the object created by the +\&\fBgetnetconfigent()\fR \s-1XSUB\s0 and an object created by a normal Perl subroutine. +.SS "Safely Storing Static Data in \s-1XS\s0" +.IX Subsection "Safely Storing Static Data in XS" +Starting with Perl 5.8, a macro framework has been defined to allow +static data to be safely stored in \s-1XS\s0 modules that will be accessed from +a multi-threaded Perl. +.PP +Although primarily designed for use with multi-threaded Perl, the macros +have been designed so that they will work with non-threaded Perl as well. +.PP +It is therefore strongly recommended that these macros be used by all +\&\s-1XS\s0 modules that make use of static data. +.PP +The easiest way to get a template set of macros to use is by specifying +the \f(CW\*(C`\-g\*(C'\fR (\f(CW\*(C`\-\-global\*(C'\fR) option with h2xs (see h2xs). +.PP +Below is an example module that makes use of the macros. +.PP +.Vb 4 +\& #define PERL_NO_GET_CONTEXT +\& #include "EXTERN.h" +\& #include "perl.h" +\& #include "XSUB.h" +\& +\& /* Global Data */ +\& +\& #define MY_CXT_KEY "BlindMice::_guts" XS_VERSION +\& +\& typedef struct { +\& int count; +\& char name[3][100]; +\& } my_cxt_t; +\& +\& START_MY_CXT +\& +\& MODULE = BlindMice PACKAGE = BlindMice +\& +\& BOOT: +\& { +\& MY_CXT_INIT; +\& MY_CXT.count = 0; +\& strcpy(MY_CXT.name[0], "None"); +\& strcpy(MY_CXT.name[1], "None"); +\& strcpy(MY_CXT.name[2], "None"); +\& } +\& +\& int +\& newMouse(char * name) +\& PREINIT: +\& dMY_CXT; +\& CODE: +\& if (MY_CXT.count >= 3) { +\& warn("Already have 3 blind mice"); +\& RETVAL = 0; +\& } +\& else { +\& RETVAL = ++ MY_CXT.count; +\& strcpy(MY_CXT.name[MY_CXT.count \- 1], name); +\& } +\& OUTPUT: +\& RETVAL +\& +\& char * +\& get_mouse_name(index) +\& int index +\& PREINIT: +\& dMY_CXT; +\& CODE: +\& if (index > MY_CXT.count) +\& croak("There are only 3 blind mice."); +\& else +\& RETVAL = MY_CXT.name[index \- 1]; +\& OUTPUT: +\& RETVAL +\& +\& void +\& CLONE(...) +\& CODE: +\& MY_CXT_CLONE; +.Ve +.PP +\fI\s-1MY_CXT REFERENCE\s0\fR +.IX Subsection "MY_CXT REFERENCE" +.IP "\s-1MY_CXT_KEY\s0" 5 +.IX Item "MY_CXT_KEY" +This macro is used to define a unique key to refer to the static data +for an \s-1XS\s0 module. The suggested naming scheme, as used by h2xs, is to +use a string that consists of the module name, the string \*(L"::_guts\*(R" +and the module version number. +.Sp +.Vb 1 +\& #define MY_CXT_KEY "MyModule::_guts" XS_VERSION +.Ve +.IP "typedef my_cxt_t" 5 +.IX Item "typedef my_cxt_t" +This struct typedef \fImust\fR always be called \f(CW\*(C`my_cxt_t\*(C'\fR. The other +\&\f(CW\*(C`CXT*\*(C'\fR macros assume the existence of the \f(CW\*(C`my_cxt_t\*(C'\fR typedef name. +.Sp +Declare a typedef named \f(CW\*(C`my_cxt_t\*(C'\fR that is a structure that contains +all the data that needs to be interpreter-local. +.Sp +.Vb 3 +\& typedef struct { +\& int some_value; +\& } my_cxt_t; +.Ve +.IP "\s-1START_MY_CXT\s0" 5 +.IX Item "START_MY_CXT" +Always place the \s-1START_MY_CXT\s0 macro directly after the declaration +of \f(CW\*(C`my_cxt_t\*(C'\fR. +.IP "\s-1MY_CXT_INIT\s0" 5 +.IX Item "MY_CXT_INIT" +The \s-1MY_CXT_INIT\s0 macro initializes storage for the \f(CW\*(C`my_cxt_t\*(C'\fR struct. +.Sp +It \fImust\fR be called exactly once, typically in a \s-1BOOT:\s0 section. If you +are maintaining multiple interpreters, it should be called once in each +interpreter instance, except for interpreters cloned from existing ones. +(But see \*(L"\s-1MY_CXT_CLONE\*(R"\s0 below.) +.IP "dMY_CXT" 5 +.IX Item "dMY_CXT" +Use the dMY_CXT macro (a declaration) in all the functions that access +\&\s-1MY_CXT.\s0 +.IP "\s-1MY_CXT\s0" 5 +.IX Item "MY_CXT" +Use the \s-1MY_CXT\s0 macro to access members of the \f(CW\*(C`my_cxt_t\*(C'\fR struct. For +example, if \f(CW\*(C`my_cxt_t\*(C'\fR is +.Sp +.Vb 3 +\& typedef struct { +\& int index; +\& } my_cxt_t; +.Ve +.Sp +then use this to access the \f(CW\*(C`index\*(C'\fR member +.Sp +.Vb 2 +\& dMY_CXT; +\& MY_CXT.index = 2; +.Ve +.IP "aMY_CXT/pMY_CXT" 5 +.IX Item "aMY_CXT/pMY_CXT" +\&\f(CW\*(C`dMY_CXT\*(C'\fR may be quite expensive to calculate, and to avoid the overhead +of invoking it in each function it is possible to pass the declaration +onto other functions using the \f(CW\*(C`aMY_CXT\*(C'\fR/\f(CW\*(C`pMY_CXT\*(C'\fR macros, eg +.Sp +.Vb 5 +\& void sub1() { +\& dMY_CXT; +\& MY_CXT.index = 1; +\& sub2(aMY_CXT); +\& } +\& +\& void sub2(pMY_CXT) { +\& MY_CXT.index = 2; +\& } +.Ve +.Sp +Analogously to \f(CW\*(C`pTHX\*(C'\fR, there are equivalent forms for when the macro is the +first or last in multiple arguments, where an underscore represents a +comma, i.e. \f(CW\*(C`_aMY_CXT\*(C'\fR, \f(CW\*(C`aMY_CXT_\*(C'\fR, \f(CW\*(C`_pMY_CXT\*(C'\fR and \f(CW\*(C`pMY_CXT_\*(C'\fR. +.IP "\s-1MY_CXT_CLONE\s0" 5 +.IX Item "MY_CXT_CLONE" +By default, when a new interpreter is created as a copy of an existing one +(eg via \f(CW\*(C`threads\->create()\*(C'\fR), both interpreters share the same physical +my_cxt_t structure. Calling \f(CW\*(C`MY_CXT_CLONE\*(C'\fR (typically via the package's +\&\f(CW\*(C`CLONE()\*(C'\fR function), causes a byte-for-byte copy of the structure to be +taken, and any future dMY_CXT will cause the copy to be accessed instead. +.IP "\s-1MY_CXT_INIT_INTERP\s0(my_perl)" 5 +.IX Item "MY_CXT_INIT_INTERP(my_perl)" +.PD 0 +.IP "dMY_CXT_INTERP(my_perl)" 5 +.IX Item "dMY_CXT_INTERP(my_perl)" +.PD +These are versions of the macros which take an explicit interpreter as an +argument. +.PP +Note that these macros will only work together within the \fIsame\fR source +file; that is, a dMY_CTX in one source file will access a different structure +than a dMY_CTX in another source file. +.SS "Thread-aware system interfaces" +.IX Subsection "Thread-aware system interfaces" +Starting from Perl 5.8, in C/\*(C+ level Perl knows how to wrap +system/library interfaces that have thread-aware versions +(e.g. \fBgetpwent_r()\fR) into frontend macros (e.g. \fBgetpwent()\fR) that +correctly handle the multithreaded interaction with the Perl +interpreter. This will happen transparently, the only thing +you need to do is to instantiate a Perl interpreter. +.PP +This wrapping happens always when compiling Perl core source +(\s-1PERL_CORE\s0 is defined) or the Perl core extensions (\s-1PERL_EXT\s0 is +defined). When compiling \s-1XS\s0 code outside of the Perl core, the wrapping +does not take place before Perl 5.28. Starting in that release you can +.PP +.Vb 1 +\& #define PERL_REENTRANT +.Ve +.PP +in your code to enable the wrapping. It is advisable to do so if you +are using such functions, as intermixing the \f(CW\*(C`_r\*(C'\fR\-forms (as Perl compiled +for multithreaded operation will do) and the \f(CW\*(C`_r\*(C'\fR\-less forms is neither +well-defined (inconsistent results, data corruption, or even crashes +become more likely), nor is it very portable. Unfortunately, not all +systems have all the \f(CW\*(C`_r\*(C'\fR forms, but using this \f(CW\*(C`#define\*(C'\fR gives you +whatever protection that Perl is aware is available on each system. +.SH "EXAMPLES" +.IX Header "EXAMPLES" +File \f(CW\*(C`RPC.xs\*(C'\fR: Interface to some \s-1ONC+ RPC\s0 bind library functions. +.PP +.Vb 4 +\& #define PERL_NO_GET_CONTEXT +\& #include "EXTERN.h" +\& #include "perl.h" +\& #include "XSUB.h" +\& +\& #include +\& +\& typedef struct netconfig Netconfig; +\& +\& MODULE = RPC PACKAGE = RPC +\& +\& SV * +\& rpcb_gettime(host="localhost") +\& char *host +\& PREINIT: +\& time_t timep; +\& CODE: +\& ST(0) = sv_newmortal(); +\& if( rpcb_gettime( host, &timep ) ) +\& sv_setnv( ST(0), (double)timep ); +\& +\& Netconfig * +\& getnetconfigent(netid="udp") +\& char *netid +\& +\& MODULE = RPC PACKAGE = NetconfigPtr PREFIX = rpcb_ +\& +\& void +\& rpcb_DESTROY(netconf) +\& Netconfig *netconf +\& CODE: +\& printf("NetconfigPtr::DESTROY\en"); +\& free( netconf ); +.Ve +.PP +File \f(CW\*(C`typemap\*(C'\fR: Custom typemap for \s-1RPC\s0.xs. (cf. perlxstypemap) +.PP +.Vb 2 +\& TYPEMAP +\& Netconfig * T_PTROBJ +.Ve +.PP +File \f(CW\*(C`RPC.pm\*(C'\fR: Perl module for the \s-1RPC\s0 extension. +.PP +.Vb 1 +\& package RPC; +\& +\& require Exporter; +\& require DynaLoader; +\& @ISA = qw(Exporter DynaLoader); +\& @EXPORT = qw(rpcb_gettime getnetconfigent); +\& +\& bootstrap RPC; +\& 1; +.Ve +.PP +File \f(CW\*(C`rpctest.pl\*(C'\fR: Perl test program for the \s-1RPC\s0 extension. +.PP +.Vb 1 +\& use RPC; +\& +\& $netconf = getnetconfigent(); +\& $a = rpcb_gettime(); +\& print "time = $a\en"; +\& print "netconf = $netconf\en"; +\& +\& $netconf = getnetconfigent("tcp"); +\& $a = rpcb_gettime("poplar"); +\& print "time = $a\en"; +\& print "netconf = $netconf\en"; +.Ve +.SH "CAVEATS" +.IX Header "CAVEATS" +\&\s-1XS\s0 code has full access to system calls including C library functions. +It thus has the capability of interfering with things that the Perl core +or other modules have set up, such as signal handlers or file handles. +It could mess with the memory, or any number of harmful things. Don't. +.PP +Some modules have an event loop, waiting for user-input. It is highly +unlikely that two such modules would work adequately together in a +single Perl application. +.PP +In general, the perl interpreter views itself as the center of the +universe as far as the Perl program goes. \s-1XS\s0 code is viewed as a +help-mate, to accomplish things that perl doesn't do, or doesn't do fast +enough, but always subservient to perl. The closer \s-1XS\s0 code adheres to +this model, the less likely conflicts will occur. +.PP +One area where there has been conflict is in regards to C locales. (See +perllocale.) perl, with one exception and unless told otherwise, +sets up the underlying locale the program is running in to the locale +passed +into it from the environment. This is an important difference from a +generic C language program, where the underlying locale is the \*(L"C\*(R" +locale unless the program changes it. As of v5.20, this underlying +locale is completely hidden from pure Perl code outside the lexical +scope of \f(CW\*(C`use\ locale\*(C'\fR except for a couple of function calls in the +\&\s-1POSIX\s0 module which of necessity use it. But the underlying locale, with +that +one exception is exposed to \s-1XS\s0 code, affecting all C library routines +whose behavior is locale-dependent. Your \s-1XS\s0 code better not assume that +the underlying locale is \*(L"C\*(R". The exception is the +\&\f(CW\*(C`LC_NUMERIC\*(C'\fR +locale category, and the reason it is an exception is that experience +has shown that it can be problematic for \s-1XS\s0 code, whereas we have not +had reports of problems with the +other locale categories. And the reason +for this one category being problematic is that the character used as a +decimal point can vary. Many European languages use a comma, whereas +English, and hence Perl are expecting a dot (U+002E: \s-1FULL STOP\s0). Many +modules can handle only the radix character being a dot, and so perl +attempts to make it so. Up through Perl v5.20, the attempt was merely +to set \f(CW\*(C`LC_NUMERIC\*(C'\fR upon startup to the \f(CW"C"\fR locale. Any +\&\fBsetlocale()\fR otherwise would change +it; this caused some failures. Therefore, starting in v5.22, perl tries +to keep \f(CW\*(C`LC_NUMERIC\*(C'\fR always set to \f(CW"C"\fR for \s-1XS\s0 code. +.PP +To summarize, here's what to expect and how to handle locales in \s-1XS\s0 code: +.IP "Non-locale-aware \s-1XS\s0 code" 4 +.IX Item "Non-locale-aware XS code" +Keep in mind that even if you think your code is not locale-aware, it +may call a library function that is. Hopefully the man page for such +a function will indicate that dependency, but the documentation is +imperfect. +.Sp +The current locale is exposed to \s-1XS\s0 code except possibly \f(CW\*(C`LC_NUMERIC\*(C'\fR +(explained in the next paragraph). +There have not been reports of problems with the other categories. +Perl initializes things on start-up so that the current locale is the +one which is indicated by the user's environment in effect at that time. +See \*(L"\s-1ENVIRONMENT\*(R"\s0 in perllocale. +.Sp +However, up through v5.20, Perl initialized things on start-up so that +\&\f(CW\*(C`LC_NUMERIC\*(C'\fR was set to the \*(L"C\*(R" locale. But if any code anywhere +changed it, it would stay changed. This means that your module can't +count on \f(CW\*(C`LC_NUMERIC\*(C'\fR being something in particular, and you can't +expect floating point numbers (including version strings) to have dots +in them. If you don't allow for a non-dot, your code could break if +anyone anywhere changed the locale. For this reason, v5.22 changed +the behavior so that Perl tries to keep \f(CW\*(C`LC_NUMERIC\*(C'\fR in the \*(L"C\*(R" locale +except around the operations internally where it should be something +else. Misbehaving \s-1XS\s0 code will always be able to change the locale +anyway, but the most common instance of this is checked for and +handled. +.IP "Locale-aware \s-1XS\s0 code" 4 +.IX Item "Locale-aware XS code" +If the locale from the user's environment is desired, there should be no +need for \s-1XS\s0 code to set the locale except for \f(CW\*(C`LC_NUMERIC\*(C'\fR, as perl has +already set the others up. \s-1XS\s0 code should avoid changing the locale, as +it can adversely affect other, unrelated, code and may not be +thread-safe. To minimize problems, the macros +\&\*(L"\s-1STORE_LC_NUMERIC_SET_TO_NEEDED\*(R"\s0 in perlapi, +\&\*(L"\s-1STORE_LC_NUMERIC_FORCE_TO_UNDERLYING\*(R"\s0 in perlapi, and +\&\*(L"\s-1RESTORE_LC_NUMERIC\*(R"\s0 in perlapi should be used to affect any needed +change. +.Sp +But, starting with Perl v5.28, locales are thread-safe on platforms that +support this functionality. Windows has this starting with Visual +Studio 2005. Many other modern platforms support the thread-safe \s-1POSIX +2008\s0 functions. The C \f(CW\*(C`#define\*(C'\fR \f(CW\*(C`USE_THREAD_SAFE_LOCALE\*(C'\fR will be +defined iff this build is using these. From Perl-space, the read-only +variable \f(CW\*(C`${SAFE_LOCALES}\*(C'\fR is 1 if either the build is not threaded, or +if \f(CW\*(C`USE_THREAD_SAFE_LOCALE\*(C'\fR is defined; otherwise it is 0. +.Sp +The way this works under-the-hood is that every thread has a choice of +using a locale specific to it (this is the Windows and \s-1POSIX 2008\s0 +functionality), or the global locale that is accessible to all threads +(this is the functionality that has always been there). The +implementations for Windows and \s-1POSIX\s0 are completely different. On +Windows, the runtime can be set up so that the standard +\&\f(CWsetlocale(3)\fR function either only knows about the global locale or +the locale for this thread. On \s-1POSIX,\s0 \f(CW\*(C`setlocale\*(C'\fR always deals with +the global locale, and other functions have been created to handle +per-thread locales. Perl makes this transparent to perl-space code. It +continues to use \f(CW\*(C`POSIX::setlocale()\*(C'\fR, and the interpreter translates +that into the per-thread functions. +.Sp +All other locale-senstive functions automatically use the per-thread +locale, if that is turned on, and failing that, the global locale. Thus +calls to \f(CW\*(C`setlocale\*(C'\fR are ineffective on \s-1POSIX\s0 systems for the current +thread if that thread is using a per-thread locale. If perl is compiled +for single-thread operation, it does not use the per-thread functions, +so \f(CW\*(C`setlocale\*(C'\fR does work as expected. +.Sp +If you have loaded the \f(CW\*(C`POSIX\*(C'\fR module you can use the methods given +in perlcall to call \f(CW\*(C`POSIX::setlocale\*(C'\fR to safely +change or query the locale (on systems where it is safe to do so), or +you can use the new 5.28 function \*(L"Perl_setlocale\*(R" in perlapi instead, +which is a drop-in replacement for the system \f(CWsetlocale(3)\fR, and +handles single-threaded and multi-threaded applications transparently. +.Sp +There are some locale-related library calls that still aren't +thread-safe because they return data in a buffer global to all threads. +In the past, these didn't matter as locales weren't thread-safe at all. +But now you have to be aware of them in case your module is called in a +multi-threaded application. The known ones are +.Sp +.Vb 8 +\& asctime() +\& ctime() +\& gcvt() [POSIX.1\-2001 only (function removed in POSIX.1\-2008)] +\& getdate() +\& wcrtomb() if its final argument is NULL +\& wcsrtombs() if its final argument is NULL +\& wcstombs() +\& wctomb() +.Ve +.Sp +Some of these shouldn't really be called in a Perl application, and for +others there are thread-safe versions of these already implemented: +.Sp +.Vb 3 +\& asctime_r() +\& ctime_r() +\& Perl_langinfo() +.Ve +.Sp +The \f(CW\*(C`_r\*(C'\fR forms are automatically used, starting in Perl 5.28, if you +compile your code, with +.Sp +.Vb 1 +\& #define PERL_REENTRANT +.Ve +.Sp +See also \*(L"Perl_langinfo\*(R" in perlapi. +You can use the methods given in perlcall, to get the best available +locale-safe versions of these +.Sp +.Vb 3 +\& POSIX::localeconv() +\& POSIX::wcstombs() +\& POSIX::wctomb() +.Ve +.Sp +And note, that some items returned by \f(CW\*(C`Localeconv\*(C'\fR are available +through \*(L"Perl_langinfo\*(R" in perlapi. +.Sp +The others shouldn't be used in a threaded application. +.Sp +Some modules may call a non-perl library that is locale-aware. This is +fine as long as it doesn't try to query or change the locale using the +system \f(CW\*(C`setlocale\*(C'\fR. But if these do call the system \f(CW\*(C`setlocale\*(C'\fR, +those calls may be ineffective. Instead, +\&\f(CW\*(C`Perl_setlocale\*(C'\fR works in all circumstances. +Plain setlocale is ineffective on multi-threaded \s-1POSIX 2008\s0 systems. It +operates only on the global locale, whereas each thread has its own +locale, paying no attention to the global one. Since converting +these non-Perl libraries to \f(CW\*(C`Perl_setlocale\*(C'\fR is out of the question, +there is a new function in v5.28 +\&\f(CW\*(C`switch_to_global_locale\*(C'\fR that will +switch the thread it is called from so that any system \f(CW\*(C`setlocale\*(C'\fR +calls will have their desired effect. The function +\&\f(CW\*(C`sync_locale\*(C'\fR must be called before returning to +perl. +.Sp +This thread can change the locale all it wants and it won't affect any +other thread, except any that also have been switched to the global +locale. This means that a multi-threaded application can have a single +thread using an alien library without a problem; but no more than a +single thread can be so-occupied. Bad results likely will happen. +.Sp +In perls without multi-thread locale support, some alien libraries, +such as \f(CW\*(C`Gtk\*(C'\fR change locales. This can cause problems for the Perl +core and other modules. For these, before control is returned to +perl, starting in v5.20.1, calling the function +\&\fBsync_locale()\fR from \s-1XS\s0 should be sufficient to +avoid most of these problems. Prior to this, you need a pure Perl +statement that does this: +.Sp +.Vb 1 +\& POSIX::setlocale(LC_ALL, POSIX::setlocale(LC_ALL)); +.Ve +.Sp +or use the methods given in perlcall. +.SH "XS VERSION" +.IX Header "XS VERSION" +This document covers features supported by \f(CW\*(C`ExtUtils::ParseXS\*(C'\fR +(also known as \f(CW\*(C`xsubpp\*(C'\fR) 3.13_01. +.SH "AUTHOR" +.IX Header "AUTHOR" +Originally written by Dean Roehrich <\fIroehrich@cray.com\fR>. +.PP +Maintained since 1996 by The Perl Porters <\fIperlbug@perl.org\fR>. diff --git a/data/miniconda3/man/man1/perlxstut.1 b/data/miniconda3/man/man1/perlxstut.1 new file mode 100644 index 0000000000000000000000000000000000000000..b3fb01f3b66479c1adad33314732f53dd3a3c17b --- /dev/null +++ b/data/miniconda3/man/man1/perlxstut.1 @@ -0,0 +1,1553 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLXSTUT 1" +.TH PERLXSTUT 1 "2020-12-18" "perl v5.32.1" "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" +perlxstut \- Tutorial for writing XSUBs +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This tutorial will educate the reader on the steps involved in creating +a Perl extension. The reader is assumed to have access to perlguts, +perlapi and perlxs. +.PP +This tutorial starts with very simple examples and becomes more complex, +with each new example adding new features. Certain concepts may not be +completely explained until later in the tutorial in order to slowly ease +the reader into building extensions. +.PP +This tutorial was written from a Unix point of view. Where I know them +to be otherwise different for other platforms (e.g. Win32), I will list +them. If you find something that was missed, please let me know. +.SH "SPECIAL NOTES" +.IX Header "SPECIAL NOTES" +.SS "make" +.IX Subsection "make" +This tutorial assumes that the make program that Perl is configured to +use is called \f(CW\*(C`make\*(C'\fR. Instead of running \*(L"make\*(R" in the examples that +follow, you may have to substitute whatever make program Perl has been +configured to use. Running \fBperl \-V:make\fR should tell you what it is. +.SS "Version caveat" +.IX Subsection "Version caveat" +When writing a Perl extension for general consumption, one should expect that +the extension will be used with versions of Perl different from the +version available on your machine. Since you are reading this document, +the version of Perl on your machine is probably 5.005 or later, but the users +of your extension may have more ancient versions. +.PP +To understand what kinds of incompatibilities one may expect, and in the rare +case that the version of Perl on your machine is older than this document, +see the section on \*(L"Troubleshooting these Examples\*(R" for more information. +.PP +If your extension uses some features of Perl which are not available on older +releases of Perl, your users would appreciate an early meaningful warning. +You would probably put this information into the \fI\s-1README\s0\fR file, but nowadays +installation of extensions may be performed automatically, guided by \fI\s-1CPAN\s0.pm\fR +module or other tools. +.PP +In MakeMaker-based installations, \fIMakefile.PL\fR provides the earliest +opportunity to perform version checks. One can put something like this +in \fIMakefile.PL\fR for this purpose: +.PP +.Vb 8 +\& eval { require 5.007 } +\& or die < \*(AqMytest\*(Aq, +\& VERSION_FROM => \*(AqMytest.pm\*(Aq, # finds $VERSION +\& LIBS => [\*(Aq\*(Aq], # e.g., \*(Aq\-lm\*(Aq +\& DEFINE => \*(Aq\*(Aq, # e.g., \*(Aq\-DHAVE_SOMETHING\*(Aq +\& INC => \*(Aq\*(Aq, # e.g., \*(Aq\-I/usr/include/other\*(Aq +\& ); +.Ve +.PP +The file Mytest.pm should start with something like this: +.PP +.Vb 1 +\& package Mytest; +\& +\& use 5.008008; +\& use strict; +\& use warnings; +\& +\& require Exporter; +\& +\& our @ISA = qw(Exporter); +\& our %EXPORT_TAGS = ( \*(Aqall\*(Aq => [ qw( +\& +\& ) ] ); +\& +\& our @EXPORT_OK = ( @{ $EXPORT_TAGS{\*(Aqall\*(Aq} } ); +\& +\& our @EXPORT = qw( +\& +\& ); +\& +\& our $VERSION = \*(Aq0.01\*(Aq; +\& +\& require XSLoader; +\& XSLoader::load(\*(AqMytest\*(Aq, $VERSION); +\& +\& # Preloaded methods go here. +\& +\& 1; +\& _\|_END_\|_ +\& # Below is the stub of documentation for your module. You better +\& # edit it! +.Ve +.PP +The rest of the .pm file contains sample code for providing documentation for +the extension. +.PP +Finally, the Mytest.xs file should look something like this: +.PP +.Vb 4 +\& #define PERL_NO_GET_CONTEXT +\& #include "EXTERN.h" +\& #include "perl.h" +\& #include "XSUB.h" +\& +\& #include "ppport.h" +\& +\& MODULE = Mytest PACKAGE = Mytest +.Ve +.PP +Let's edit the .xs file by adding this to the end of the file: +.PP +.Vb 4 +\& void +\& hello() +\& CODE: +\& printf("Hello, world!\en"); +.Ve +.PP +It is okay for the lines starting at the \*(L"\s-1CODE:\*(R"\s0 line to not be indented. +However, for readability purposes, it is suggested that you indent \s-1CODE:\s0 +one level and the lines following one more level. +.PP +Now we'll run "\f(CW\*(C`perl Makefile.PL\*(C'\fR". This will create a real Makefile, +which make needs. Its output looks something like: +.PP +.Vb 5 +\& % perl Makefile.PL +\& Checking if your kit is complete... +\& Looks good +\& Writing Makefile for Mytest +\& % +.Ve +.PP +Now, running make will produce output that looks something like this (some +long lines have been shortened for clarity and some extraneous lines have +been deleted): +.PP +.Vb 10 +\& % make +\& cp lib/Mytest.pm blib/lib/Mytest.pm +\& perl xsubpp \-typemap typemap Mytest.xs > Mytest.xsc && \e +\& mv Mytest.xsc Mytest.c +\& Please specify prototyping behavior for Mytest.xs (see perlxs manual) +\& cc \-c Mytest.c +\& Running Mkbootstrap for Mytest () +\& chmod 644 Mytest.bs +\& rm \-f blib/arch/auto/Mytest/Mytest.so +\& cc \-shared \-L/usr/local/lib Mytest.o \-o blib/arch/auto/Mytest/Mytest.so +\& +\& chmod 755 blib/arch/auto/Mytest/Mytest.so +\& cp Mytest.bs blib/arch/auto/Mytest/Mytest.bs +\& chmod 644 blib/arch/auto/Mytest/Mytest.bs +\& Manifying blib/man3/Mytest.3pm +\& % +.Ve +.PP +You can safely ignore the line about \*(L"prototyping behavior\*(R" \- it is +explained in \*(L"The \s-1PROTOTYPES:\s0 Keyword\*(R" in perlxs. +.PP +Perl has its own special way of easily writing test scripts, but for this +example only, we'll create our own test script. Create a file called hello +that looks like this: +.PP +.Vb 1 +\& #! /opt/perl5/bin/perl +\& +\& use ExtUtils::testlib; +\& +\& use Mytest; +\& +\& Mytest::hello(); +.Ve +.PP +Now we make the script executable (\f(CW\*(C`chmod +x hello\*(C'\fR), run the script +and we should see the following output: +.PP +.Vb 3 +\& % ./hello +\& Hello, world! +\& % +.Ve +.SS "\s-1EXAMPLE 2\s0" +.IX Subsection "EXAMPLE 2" +Now let's add to our extension a subroutine that will take a single numeric +argument as input and return 1 if the number is even or 0 if the number +is odd. +.PP +Add the following to the end of Mytest.xs: +.PP +.Vb 7 +\& int +\& is_even(input) +\& int input +\& CODE: +\& RETVAL = (input % 2 == 0); +\& OUTPUT: +\& RETVAL +.Ve +.PP +There does not need to be whitespace at the start of the "\f(CW\*(C`int input\*(C'\fR\*(L" +line, but it is useful for improving readability. Placing a semi-colon at +the end of that line is also optional. Any amount and kind of whitespace +may be placed between the \*(R"\f(CW\*(C`int\*(C'\fR\*(L" and \*(R"\f(CW\*(C`input\*(C'\fR". +.PP +Now re-run make to rebuild our new shared library. +.PP +Now perform the same steps as before, generating a Makefile from the +Makefile.PL file, and running make. +.PP +In order to test that our extension works, we now need to look at the +file Mytest.t. This file is set up to imitate the same kind of testing +structure that Perl itself has. Within the test script, you perform a +number of tests to confirm the behavior of the extension, printing \*(L"ok\*(R" +when the test is correct, \*(L"not ok\*(R" when it is not. +.PP +.Vb 2 +\& use Test::More tests => 4; +\& BEGIN { use_ok(\*(AqMytest\*(Aq) }; +\& +\& ######################### +\& +\& # Insert your test code below, the Test::More module is use()ed here +\& # so read its man page ( perldoc Test::More ) for help writing this +\& # test script. +\& +\& is(&Mytest::is_even(0), 1); +\& is(&Mytest::is_even(1), 0); +\& is(&Mytest::is_even(2), 1); +.Ve +.PP +We will be calling the test script through the command "\f(CW\*(C`make test\*(C'\fR". You +should see output that looks something like this: +.PP +.Vb 7 +\& %make test +\& PERL_DL_NONLAZY=1 /usr/bin/perl "\-MExtUtils::Command::MM" "\-e" +\& "test_harness(0, \*(Aqblib/lib\*(Aq, \*(Aqblib/arch\*(Aq)" t/*.t +\& t/Mytest....ok +\& All tests successful. +\& Files=1, Tests=4, 0 wallclock secs ( 0.03 cusr + 0.00 csys = 0.03 CPU) +\& % +.Ve +.SS "What has gone on?" +.IX Subsection "What has gone on?" +The program h2xs is the starting point for creating extensions. In later +examples we'll see how we can use h2xs to read header files and generate +templates to connect to C routines. +.PP +h2xs creates a number of files in the extension directory. The file +Makefile.PL is a perl script which will generate a true Makefile to build +the extension. We'll take a closer look at it later. +.PP +The .pm and .xs files contain the meat of the extension. The .xs file holds +the C routines that make up the extension. The .pm file contains routines +that tell Perl how to load your extension. +.PP +Generating the Makefile and running \f(CW\*(C`make\*(C'\fR created a directory called blib +(which stands for \*(L"build library\*(R") in the current working directory. This +directory will contain the shared library that we will build. Once we have +tested it, we can install it into its final location. +.PP +Invoking the test script via "\f(CW\*(C`make test\*(C'\fR" did something very important. +It invoked perl with all those \f(CW\*(C`\-I\*(C'\fR arguments so that it could find the +various files that are part of the extension. It is \fIvery\fR important that +while you are still testing extensions that you use "\f(CW\*(C`make test\*(C'\fR\*(L". If you +try to run the test script all by itself, you will get a fatal error. +Another reason it is important to use \*(R"\f(CW\*(C`make test\*(C'\fR\*(L" to run your test +script is that if you are testing an upgrade to an already-existing version, +using \*(R"\f(CW\*(C`make test\*(C'\fR" ensures that you will test your new extension, not the +already-existing version. +.PP +When Perl sees a \f(CW\*(C`use extension;\*(C'\fR, it searches for a file with the same name +as the \f(CW\*(C`use\*(C'\fR'd extension that has a .pm suffix. If that file cannot be found, +Perl dies with a fatal error. The default search path is contained in the +\&\f(CW@INC\fR array. +.PP +In our case, Mytest.pm tells perl that it will need the Exporter and Dynamic +Loader extensions. It then sets the \f(CW@ISA\fR and \f(CW@EXPORT\fR arrays and the +\&\f(CW$VERSION\fR scalar; finally it tells perl to bootstrap the module. Perl +will call its dynamic loader routine (if there is one) and load the shared +library. +.PP +The two arrays \f(CW@ISA\fR and \f(CW@EXPORT\fR are very important. The \f(CW@ISA\fR +array contains a list of other packages in which to search for methods (or +subroutines) that do not exist in the current package. This is usually +only important for object-oriented extensions (which we will talk about +much later), and so usually doesn't need to be modified. +.PP +The \f(CW@EXPORT\fR array tells Perl which of the extension's variables and +subroutines should be placed into the calling package's namespace. Because +you don't know if the user has already used your variable and subroutine +names, it's vitally important to carefully select what to export. Do \fInot\fR +export method or variable names \fIby default\fR without a good reason. +.PP +As a general rule, if the module is trying to be object-oriented then don't +export anything. If it's just a collection of functions and variables, then +you can export them via another array, called \f(CW@EXPORT_OK\fR. This array +does not automatically place its subroutine and variable names into the +namespace unless the user specifically requests that this be done. +.PP +See perlmod for more information. +.PP +The \f(CW$VERSION\fR variable is used to ensure that the .pm file and the shared +library are \*(L"in sync\*(R" with each other. Any time you make changes to +the .pm or .xs files, you should increment the value of this variable. +.SS "Writing good test scripts" +.IX Subsection "Writing good test scripts" +The importance of writing good test scripts cannot be over-emphasized. You +should closely follow the \*(L"ok/not ok\*(R" style that Perl itself uses, so that +it is very easy and unambiguous to determine the outcome of each test case. +When you find and fix a bug, make sure you add a test case for it. +.PP +By running "\f(CW\*(C`make test\*(C'\fR\*(L", you ensure that your Mytest.t script runs and uses +the correct version of your extension. If you have many test cases, +save your test files in the \*(R"t\*(L" directory and use the suffix \*(R".t\*(L". +When you run \*(R"\f(CW\*(C`make test\*(C'\fR", all of these test files will be executed. +.SS "\s-1EXAMPLE 3\s0" +.IX Subsection "EXAMPLE 3" +Our third extension will take one argument as its input, round off that +value, and set the \fIargument\fR to the rounded value. +.PP +Add the following to the end of Mytest.xs: +.PP +.Vb 10 +\& void +\& round(arg) +\& double arg +\& CODE: +\& if (arg > 0.0) { +\& arg = floor(arg + 0.5); +\& } else if (arg < 0.0) { +\& arg = ceil(arg \- 0.5); +\& } else { +\& arg = 0.0; +\& } +\& OUTPUT: +\& arg +.Ve +.PP +Edit the Makefile.PL file so that the corresponding line looks like this: +.PP +.Vb 1 +\& \*(AqLIBS\*(Aq => [\*(Aq\-lm\*(Aq], # e.g., \*(Aq\-lm\*(Aq +.Ve +.PP +Generate the Makefile and run make. Change the test number in Mytest.t to +\&\*(L"9\*(R" and add the following tests: +.PP +.Vb 5 +\& $i = \-1.5; &Mytest::round($i); is( $i, \-2.0 ); +\& $i = \-1.1; &Mytest::round($i); is( $i, \-1.0 ); +\& $i = 0.0; &Mytest::round($i); is( $i, 0.0 ); +\& $i = 0.5; &Mytest::round($i); is( $i, 1.0 ); +\& $i = 1.2; &Mytest::round($i); is( $i, 1.0 ); +.Ve +.PP +Running "\f(CW\*(C`make test\*(C'\fR" should now print out that all nine tests are okay. +.PP +Notice that in these new test cases, the argument passed to round was a +scalar variable. You might be wondering if you can round a constant or +literal. To see what happens, temporarily add the following line to Mytest.t: +.PP +.Vb 1 +\& &Mytest::round(3); +.Ve +.PP +Run "\f(CW\*(C`make test\*(C'\fR" and notice that Perl dies with a fatal error. Perl won't +let you change the value of constants! +.SS "What's new here?" +.IX Subsection "What's new here?" +.IP "\(bu" 4 +We've made some changes to Makefile.PL. In this case, we've specified an +extra library to be linked into the extension's shared library, the math +library libm in this case. We'll talk later about how to write XSUBs that +can call every routine in a library. +.IP "\(bu" 4 +The value of the function is not being passed back as the function's return +value, but by changing the value of the variable that was passed into the +function. You might have guessed that when you saw that the return value +of round is of type \*(L"void\*(R". +.SS "Input and Output Parameters" +.IX Subsection "Input and Output Parameters" +You specify the parameters that will be passed into the \s-1XSUB\s0 on the line(s) +after you declare the function's return value and name. Each input parameter +line starts with optional whitespace, and may have an optional terminating +semicolon. +.PP +The list of output parameters occurs at the very end of the function, just +after the \s-1OUTPUT:\s0 directive. The use of \s-1RETVAL\s0 tells Perl that you +wish to send this value back as the return value of the \s-1XSUB\s0 function. In +Example 3, we wanted the \*(L"return value\*(R" placed in the original variable +which we passed in, so we listed it (and not \s-1RETVAL\s0) in the \s-1OUTPUT:\s0 section. +.SS "The \s-1XSUBPP\s0 Program" +.IX Subsection "The XSUBPP Program" +The \fBxsubpp\fR program takes the \s-1XS\s0 code in the .xs file and translates it into +C code, placing it in a file whose suffix is .c. The C code created makes +heavy use of the C functions within Perl. +.SS "The \s-1TYPEMAP\s0 file" +.IX Subsection "The TYPEMAP file" +The \fBxsubpp\fR program uses rules to convert from Perl's data types (scalar, +array, etc.) to C's data types (int, char, etc.). These rules are stored +in the typemap file ($PERLLIB/ExtUtils/typemap). There's a brief discussion +below, but all the nitty-gritty details can be found in perlxstypemap. +If you have a new-enough version of perl (5.16 and up) or an upgraded +\&\s-1XS\s0 compiler (\f(CW\*(C`ExtUtils::ParseXS\*(C'\fR 3.13_01 or better), then you can inline +typemaps in your \s-1XS\s0 instead of writing separate files. +Either way, this typemap thing is split into three parts: +.PP +The first section maps various C data types to a name, which corresponds +somewhat with the various Perl types. The second section contains C code +which \fBxsubpp\fR uses to handle input parameters. The third section contains +C code which \fBxsubpp\fR uses to handle output parameters. +.PP +Let's take a look at a portion of the .c file created for our extension. +The file name is Mytest.c: +.PP +.Vb 10 +\& XS(XS_Mytest_round) +\& { +\& dXSARGS; +\& if (items != 1) +\& Perl_croak(aTHX_ "Usage: Mytest::round(arg)"); +\& PERL_UNUSED_VAR(cv); /* \-W */ +\& { +\& double arg = (double)SvNV(ST(0)); /* XXXXX */ +\& if (arg > 0.0) { +\& arg = floor(arg + 0.5); +\& } else if (arg < 0.0) { +\& arg = ceil(arg \- 0.5); +\& } else { +\& arg = 0.0; +\& } +\& sv_setnv(ST(0), (double)arg); /* XXXXX */ +\& SvSETMAGIC(ST(0)); +\& } +\& XSRETURN_EMPTY; +\& } +.Ve +.PP +Notice the two lines commented with \*(L"\s-1XXXXX\*(R".\s0 If you check the first part +of the typemap file (or section), you'll see that doubles are of type +T_DOUBLE. In the \s-1INPUT\s0 part of the typemap, an argument that is T_DOUBLE +is assigned to the variable arg by calling the routine SvNV on something, +then casting it to double, then assigned to the variable arg. Similarly, +in the \s-1OUTPUT\s0 section, once arg has its final value, it is passed to the +sv_setnv function to be passed back to the calling subroutine. These two +functions are explained in perlguts; we'll talk more later about what +that \*(L"\s-1\fBST\s0\fR\|(0)\*(R" means in the section on the argument stack. +.SS "Warning about Output Arguments" +.IX Subsection "Warning about Output Arguments" +In general, it's not a good idea to write extensions that modify their input +parameters, as in Example 3. Instead, you should probably return multiple +values in an array and let the caller handle them (we'll do this in a later +example). However, in order to better accommodate calling pre-existing C +routines, which often do modify their input parameters, this behavior is +tolerated. +.SS "\s-1EXAMPLE 4\s0" +.IX Subsection "EXAMPLE 4" +In this example, we'll now begin to write XSUBs that will interact with +pre-defined C libraries. To begin with, we will build a small library of +our own, then let h2xs write our .pm and .xs files for us. +.PP +Create a new directory called Mytest2 at the same level as the directory +Mytest. In the Mytest2 directory, create another directory called mylib, +and cd into that directory. +.PP +Here we'll create some files that will generate a test library. These will +include a C source file and a header file. We'll also create a Makefile.PL +in this directory. Then we'll make sure that running make at the Mytest2 +level will automatically run this Makefile.PL file and the resulting Makefile. +.PP +In the mylib directory, create a file mylib.h that looks like this: +.PP +.Vb 1 +\& #define TESTVAL 4 +\& +\& extern double foo(int, long, const char*); +.Ve +.PP +Also create a file mylib.c that looks like this: +.PP +.Vb 2 +\& #include +\& #include "./mylib.h" +\& +\& double +\& foo(int a, long b, const char *c) +\& { +\& return (a + b + atof(c) + TESTVAL); +\& } +.Ve +.PP +And finally create a file Makefile.PL that looks like this: +.PP +.Vb 7 +\& use ExtUtils::MakeMaker; +\& $Verbose = 1; +\& WriteMakefile( +\& NAME => \*(AqMytest2::mylib\*(Aq, +\& SKIP => [qw(all static static_lib dynamic dynamic_lib)], +\& clean => {\*(AqFILES\*(Aq => \*(Aqlibmylib$(LIB_EXT)\*(Aq}, +\& ); +\& +\& +\& sub MY::top_targets { +\& \*(Aq +\& all :: static +\& +\& pure_all :: static +\& +\& static :: libmylib$(LIB_EXT) +\& +\& libmylib$(LIB_EXT): $(O_FILES) +\& $(AR) cr libmylib$(LIB_EXT) $(O_FILES) +\& $(RANLIB) libmylib$(LIB_EXT) +\& +\& \*(Aq; +\& } +.Ve +.PP +Make sure you use a tab and not spaces on the lines beginning with \*(L"$(\s-1AR\s0)\*(R" +and \*(L"$(\s-1RANLIB\s0)\*(R". Make will not function properly if you use spaces. +It has also been reported that the \*(L"cr\*(R" argument to $(\s-1AR\s0) is unnecessary +on Win32 systems. +.PP +We will now create the main top-level Mytest2 files. Change to the directory +above Mytest2 and run the following command: +.PP +.Vb 1 +\& % h2xs \-O \-n Mytest2 ./Mytest2/mylib/mylib.h +.Ve +.PP +This will print out a warning about overwriting Mytest2, but that's okay. +Our files are stored in Mytest2/mylib, and will be untouched. +.PP +The normal Makefile.PL that h2xs generates doesn't know about the mylib +directory. We need to tell it that there is a subdirectory and that we +will be generating a library in it. Let's add the argument \s-1MYEXTLIB\s0 to +the WriteMakefile call so that it looks like this: +.PP +.Vb 8 +\& WriteMakefile( +\& \*(AqNAME\*(Aq => \*(AqMytest2\*(Aq, +\& \*(AqVERSION_FROM\*(Aq => \*(AqMytest2.pm\*(Aq, # finds $VERSION +\& \*(AqLIBS\*(Aq => [\*(Aq\*(Aq], # e.g., \*(Aq\-lm\*(Aq +\& \*(AqDEFINE\*(Aq => \*(Aq\*(Aq, # e.g., \*(Aq\-DHAVE_SOMETHING\*(Aq +\& \*(AqINC\*(Aq => \*(Aq\*(Aq, # e.g., \*(Aq\-I/usr/include/other\*(Aq +\& \*(AqMYEXTLIB\*(Aq => \*(Aqmylib/libmylib$(LIB_EXT)\*(Aq, +\& ); +.Ve +.PP +and then at the end add a subroutine (which will override the pre-existing +subroutine). Remember to use a tab character to indent the line beginning +with \*(L"cd\*(R"! +.PP +.Vb 6 +\& sub MY::postamble { +\& \*(Aq +\& $(MYEXTLIB): mylib/Makefile +\& cd mylib && $(MAKE) $(PASSTHRU) +\& \*(Aq; +\& } +.Ve +.PP +Let's also fix the \s-1MANIFEST\s0 file so that it accurately reflects the contents +of our extension. The single line that says \*(L"mylib\*(R" should be replaced by +the following three lines: +.PP +.Vb 3 +\& mylib/Makefile.PL +\& mylib/mylib.c +\& mylib/mylib.h +.Ve +.PP +To keep our namespace nice and unpolluted, edit the .pm file and change +the variable \f(CW@EXPORT\fR to \f(CW@EXPORT_OK\fR. Finally, in the +\&.xs file, edit the #include line to read: +.PP +.Vb 1 +\& #include "mylib/mylib.h" +.Ve +.PP +And also add the following function definition to the end of the .xs file: +.PP +.Vb 7 +\& double +\& foo(a,b,c) +\& int a +\& long b +\& const char * c +\& OUTPUT: +\& RETVAL +.Ve +.PP +Now we also need to create a typemap because the default Perl doesn't +currently support the \f(CW\*(C`const char *\*(C'\fR type. Include a new \s-1TYPEMAP\s0 +section in your \s-1XS\s0 code before the above function: +.PP +.Vb 3 +\& TYPEMAP: < +.Ve +.PP +Also add the following code segment to Mytest.t while incrementing the \*(L"9\*(R" +tests to \*(L"11\*(R": +.PP +.Vb 4 +\& @a = &Mytest::statfs("/blech"); +\& ok( scalar(@a) == 1 && $a[0] == 2 ); +\& @a = &Mytest::statfs("/"); +\& is( scalar(@a), 7 ); +.Ve +.SS "New Things in this Example" +.IX Subsection "New Things in this Example" +This example added quite a few new concepts. We'll take them one at a time. +.IP "\(bu" 4 +The \s-1INIT:\s0 directive contains code that will be placed immediately after +the argument stack is decoded. C does not allow variable declarations at +arbitrary locations inside a function, +so this is usually the best way to declare local variables needed by the \s-1XSUB.\s0 +(Alternatively, one could put the whole \f(CW\*(C`PPCODE:\*(C'\fR section into braces, and +put these declarations on top.) +.IP "\(bu" 4 +This routine also returns a different number of arguments depending on the +success or failure of the call to statfs. If there is an error, the error +number is returned as a single-element array. If the call is successful, +then a 7\-element array is returned. Since only one argument is passed into +this function, we need room on the stack to hold the 7 values which may be +returned. +.Sp +We do this by using the \s-1PPCODE:\s0 directive, rather than the \s-1CODE:\s0 directive. +This tells \fBxsubpp\fR that we will be managing the return values that will be +put on the argument stack by ourselves. +.IP "\(bu" 4 +When we want to place values to be returned to the caller onto the stack, +we use the series of macros that begin with \*(L"\s-1XPUSH\*(R".\s0 There are five +different versions, for placing integers, unsigned integers, doubles, +strings, and Perl scalars on the stack. In our example, we placed a +Perl scalar onto the stack. (In fact this is the only macro which +can be used to return multiple values.) +.Sp +The XPUSH* macros will automatically extend the return stack to prevent +it from being overrun. You push values onto the stack in the order you +want them seen by the calling program. +.IP "\(bu" 4 +The values pushed onto the return stack of the \s-1XSUB\s0 are actually mortal \s-1SV\s0's. +They are made mortal so that once the values are copied by the calling +program, the \s-1SV\s0's that held the returned values can be deallocated. +If they were not mortal, then they would continue to exist after the \s-1XSUB\s0 +routine returned, but would not be accessible. This is a memory leak. +.IP "\(bu" 4 +If we were interested in performance, not in code compactness, in the success +branch we would not use \f(CW\*(C`XPUSHs\*(C'\fR macros, but \f(CW\*(C`PUSHs\*(C'\fR macros, and would +pre-extend the stack before pushing the return values: +.Sp +.Vb 1 +\& EXTEND(SP, 7); +.Ve +.Sp +The tradeoff is that one needs to calculate the number of return values +in advance (though overextending the stack will not typically hurt +anything but memory consumption). +.Sp +Similarly, in the failure branch we could use \f(CW\*(C`PUSHs\*(C'\fR \fIwithout\fR extending +the stack: the Perl function reference comes to an \s-1XSUB\s0 on the stack, thus +the stack is \fIalways\fR large enough to take one return value. +.SS "\s-1EXAMPLE 6\s0" +.IX Subsection "EXAMPLE 6" +In this example, we will accept a reference to an array as an input +parameter, and return a reference to an array of hashes. This will +demonstrate manipulation of complex Perl data types from an \s-1XSUB.\s0 +.PP +This extension is somewhat contrived. It is based on the code in +the previous example. It calls the statfs function multiple times, +accepting a reference to an array of filenames as input, and returning +a reference to an array of hashes containing the data for each of the +filesystems. +.PP +Return to the Mytest directory and add the following code to the end of +Mytest.xs: +.PP +.Vb 8 +\& SV * +\& multi_statfs(paths) +\& SV * paths +\& INIT: +\& AV * results; +\& SSize_t numpaths = 0, n; +\& int i; +\& struct statfs buf; +\& +\& SvGETMAGIC(paths); +\& if ((!SvROK(paths)) +\& || (SvTYPE(SvRV(paths)) != SVt_PVAV) +\& || ((numpaths = av_top_index((AV *)SvRV(paths))) < 0)) +\& { +\& XSRETURN_UNDEF; +\& } +\& results = (AV *)sv_2mortal((SV *)newAV()); +\& CODE: +\& for (n = 0; n <= numpaths; n++) { +\& HV * rh; +\& STRLEN l; +\& char * fn = SvPV(*av_fetch((AV *)SvRV(paths), n, 0), l); +\& +\& i = statfs(fn, &buf); +\& if (i != 0) { +\& av_push(results, newSVnv(errno)); +\& continue; +\& } +\& +\& rh = (HV *)sv_2mortal((SV *)newHV()); +\& +\& hv_store(rh, "f_bavail", 8, newSVnv(buf.f_bavail), 0); +\& hv_store(rh, "f_bfree", 7, newSVnv(buf.f_bfree), 0); +\& hv_store(rh, "f_blocks", 8, newSVnv(buf.f_blocks), 0); +\& hv_store(rh, "f_bsize", 7, newSVnv(buf.f_bsize), 0); +\& hv_store(rh, "f_ffree", 7, newSVnv(buf.f_ffree), 0); +\& hv_store(rh, "f_files", 7, newSVnv(buf.f_files), 0); +\& hv_store(rh, "f_type", 6, newSVnv(buf.f_type), 0); +\& +\& av_push(results, newRV_inc((SV *)rh)); +\& } +\& RETVAL = newRV_inc((SV *)results); +\& OUTPUT: +\& RETVAL +.Ve +.PP +And add the following code to Mytest.t, while incrementing the \*(L"11\*(R" +tests to \*(L"13\*(R": +.PP +.Vb 3 +\& $results = Mytest::multi_statfs([ \*(Aq/\*(Aq, \*(Aq/blech\*(Aq ]); +\& ok( ref $results\->[0] ); +\& ok( ! ref $results\->[1] ); +.Ve +.SS "New Things in this Example" +.IX Subsection "New Things in this Example" +There are a number of new concepts introduced here, described below: +.IP "\(bu" 4 +This function does not use a typemap. Instead, we declare it as accepting +one SV* (scalar) parameter, and returning an SV* value, and we take care of +populating these scalars within the code. Because we are only returning +one value, we don't need a \f(CW\*(C`PPCODE:\*(C'\fR directive \- instead, we use \f(CW\*(C`CODE:\*(C'\fR +and \f(CW\*(C`OUTPUT:\*(C'\fR directives. +.IP "\(bu" 4 +When dealing with references, it is important to handle them with caution. +The \f(CW\*(C`INIT:\*(C'\fR block first calls SvGETMAGIC(paths), in case +paths is a tied variable. Then it checks that \f(CW\*(C`SvROK\*(C'\fR returns +true, which indicates that paths is a valid reference. (Simply +checking \f(CW\*(C`SvROK\*(C'\fR won't trigger \s-1FETCH\s0 on a tied variable.) It +then verifies that the object referenced by paths is an array, using \f(CW\*(C`SvRV\*(C'\fR +to dereference paths, and \f(CW\*(C`SvTYPE\*(C'\fR to discover its type. As an added test, +it checks that the array referenced by paths is non-empty, using the +\&\f(CW\*(C`av_top_index\*(C'\fR function (which returns \-1 if the array is empty). The +\&\s-1XSRETURN_UNDEF\s0 macro is used to abort the \s-1XSUB\s0 and return the undefined value +whenever all three of these conditions are not met. +.IP "\(bu" 4 +We manipulate several arrays in this \s-1XSUB.\s0 Note that an array is represented +internally by an AV* pointer. The functions and macros for manipulating +arrays are similar to the functions in Perl: \f(CW\*(C`av_top_index\*(C'\fR returns the +highest index in an AV*, much like $#array; \f(CW\*(C`av_fetch\*(C'\fR fetches a single scalar +value from an array, given its index; \f(CW\*(C`av_push\*(C'\fR pushes a scalar value onto the +end of the array, automatically extending the array as necessary. +.Sp +Specifically, we read pathnames one at a time from the input array, and +store the results in an output array (results) in the same order. If +statfs fails, the element pushed onto the return array is the value of +errno after the failure. If statfs succeeds, though, the value pushed +onto the return array is a reference to a hash containing some of the +information in the statfs structure. +.Sp +As with the return stack, it would be possible (and a small performance win) +to pre-extend the return array before pushing data into it, since we know +how many elements we will return: +.Sp +.Vb 1 +\& av_extend(results, numpaths); +.Ve +.IP "\(bu" 4 +We are performing only one hash operation in this function, which is storing +a new scalar under a key using \f(CW\*(C`hv_store\*(C'\fR. A hash is represented by an HV* +pointer. Like arrays, the functions for manipulating hashes from an \s-1XSUB\s0 +mirror the functionality available from Perl. See perlguts and perlapi +for details. +.IP "\(bu" 4 +To create a reference, we use the \f(CW\*(C`newRV_inc\*(C'\fR function. Note that you can +cast an AV* or an HV* to type SV* in this case (and many others). This +allows you to take references to arrays, hashes and scalars with the same +function. Conversely, the \f(CW\*(C`SvRV\*(C'\fR function always returns an SV*, which may +need to be cast to the appropriate type if it is something other than a +scalar (check with \f(CW\*(C`SvTYPE\*(C'\fR). +.IP "\(bu" 4 +At this point, xsubpp is doing very little work \- the differences between +Mytest.xs and Mytest.c are minimal. +.SS "\s-1EXAMPLE 7\s0 (Coming Soon)" +.IX Subsection "EXAMPLE 7 (Coming Soon)" +\&\s-1XPUSH\s0 args \s-1AND\s0 set \s-1RETVAL AND\s0 assign return value to array +.SS "\s-1EXAMPLE 8\s0 (Coming Soon)" +.IX Subsection "EXAMPLE 8 (Coming Soon)" +Setting $! +.SS "\s-1EXAMPLE 9\s0 Passing open files to XSes" +.IX Subsection "EXAMPLE 9 Passing open files to XSes" +You would think passing files to an \s-1XS\s0 is difficult, with all the +typeglobs and stuff. Well, it isn't. +.PP +Suppose that for some strange reason we need a wrapper around the +standard C library function \f(CW\*(C`fputs()\*(C'\fR. This is all we need: +.PP +.Vb 5 +\& #define PERLIO_NOT_STDIO 0 +\& #define PERL_NO_GET_CONTEXT +\& #include "EXTERN.h" +\& #include "perl.h" +\& #include "XSUB.h" +\& +\& #include +\& +\& int +\& fputs(s, stream) +\& char * s +\& FILE * stream +.Ve +.PP +The real work is done in the standard typemap. +.PP +\&\fBBut\fR you lose all the fine stuff done by the perlio layers. This +calls the stdio function \f(CW\*(C`fputs()\*(C'\fR, which knows nothing about them. +.PP +The standard typemap offers three variants of PerlIO *: +\&\f(CW\*(C`InputStream\*(C'\fR (T_IN), \f(CW\*(C`InOutStream\*(C'\fR (T_INOUT) and \f(CW\*(C`OutputStream\*(C'\fR +(T_OUT). A bare \f(CW\*(C`PerlIO *\*(C'\fR is considered a T_INOUT. If it matters +in your code (see below for why it might) #define or typedef +one of the specific names and use that as the argument or result +type in your \s-1XS\s0 file. +.PP +The standard typemap does not contain PerlIO * before perl 5.7, +but it has the three stream variants. Using a PerlIO * directly +is not backwards compatible unless you provide your own typemap. +.PP +For streams coming \fIfrom\fR perl the main difference is that +\&\f(CW\*(C`OutputStream\*(C'\fR will get the output PerlIO * \- which may make +a difference on a socket. Like in our example... +.PP +For streams being handed \fIto\fR perl a new file handle is created +(i.e. a reference to a new glob) and associated with the PerlIO * +provided. If the read/write state of the PerlIO * is not correct then you +may get errors or warnings from when the file handle is used. +So if you opened the PerlIO * as \*(L"w\*(R" it should really be an +\&\f(CW\*(C`OutputStream\*(C'\fR if open as \*(L"r\*(R" it should be an \f(CW\*(C`InputStream\*(C'\fR. +.PP +Now, suppose you want to use perlio layers in your \s-1XS.\s0 We'll use the +perlio \f(CW\*(C`PerlIO_puts()\*(C'\fR function as an example. +.PP +In the C part of the \s-1XS\s0 file (above the first \s-1MODULE\s0 line) you +have +.PP +.Vb 3 +\& #define OutputStream PerlIO * +\& or +\& typedef PerlIO * OutputStream; +.Ve +.PP +And this is the \s-1XS\s0 code: +.PP +.Vb 8 +\& int +\& perlioputs(s, stream) +\& char * s +\& OutputStream stream +\& CODE: +\& RETVAL = PerlIO_puts(stream, s); +\& OUTPUT: +\& RETVAL +.Ve +.PP +We have to use a \f(CW\*(C`CODE\*(C'\fR section because \f(CW\*(C`PerlIO_puts()\*(C'\fR has the arguments +reversed compared to \f(CW\*(C`fputs()\*(C'\fR, and we want to keep the arguments the same. +.PP +Wanting to explore this thoroughly, we want to use the stdio \f(CW\*(C`fputs()\*(C'\fR +on a PerlIO *. This means we have to ask the perlio system for a stdio +\&\f(CW\*(C`FILE *\*(C'\fR: +.PP +.Vb 10 +\& int +\& perliofputs(s, stream) +\& char * s +\& OutputStream stream +\& PREINIT: +\& FILE *fp = PerlIO_findFILE(stream); +\& CODE: +\& if (fp != (FILE*) 0) { +\& RETVAL = fputs(s, fp); +\& } else { +\& RETVAL = \-1; +\& } +\& OUTPUT: +\& RETVAL +.Ve +.PP +Note: \f(CW\*(C`PerlIO_findFILE()\*(C'\fR will search the layers for a stdio +layer. If it can't find one, it will call \f(CW\*(C`PerlIO_exportFILE()\*(C'\fR to +generate a new stdio \f(CW\*(C`FILE\*(C'\fR. Please only call \f(CW\*(C`PerlIO_exportFILE()\*(C'\fR if +you want a \fInew\fR \f(CW\*(C`FILE\*(C'\fR. It will generate one on each call and push a +new stdio layer. So don't call it repeatedly on the same +file. \f(CW\*(C`PerlIO_findFILE()\*(C'\fR will retrieve the stdio layer once it has been +generated by \f(CW\*(C`PerlIO_exportFILE()\*(C'\fR. +.PP +This applies to the perlio system only. For versions before 5.7, +\&\f(CW\*(C`PerlIO_exportFILE()\*(C'\fR is equivalent to \f(CW\*(C`PerlIO_findFILE()\*(C'\fR. +.SS "Troubleshooting these Examples" +.IX Subsection "Troubleshooting these Examples" +As mentioned at the top of this document, if you are having problems with +these example extensions, you might see if any of these help you. +.IP "\(bu" 4 +In versions of 5.002 prior to the gamma version, the test script in Example +1 will not function properly. You need to change the \*(L"use lib\*(R" line to +read: +.Sp +.Vb 1 +\& use lib \*(Aq./blib\*(Aq; +.Ve +.IP "\(bu" 4 +In versions of 5.002 prior to version 5.002b1h, the test.pl file was not +automatically created by h2xs. This means that you cannot say \*(L"make test\*(R" +to run the test script. You will need to add the following line before the +\&\*(L"use extension\*(R" statement: +.Sp +.Vb 1 +\& use lib \*(Aq./blib\*(Aq; +.Ve +.IP "\(bu" 4 +In versions 5.000 and 5.001, instead of using the above line, you will need +to use the following line: +.Sp +.Vb 1 +\& BEGIN { unshift(@INC, "./blib") } +.Ve +.IP "\(bu" 4 +This document assumes that the executable named \*(L"perl\*(R" is Perl version 5. +Some systems may have installed Perl version 5 as \*(L"perl5\*(R". +.SH "See also" +.IX Header "See also" +For more information, consult perlguts, perlapi, perlxs, perlmod, +and perlpod. +.SH "Author" +.IX Header "Author" +Jeff Okamoto <\fIokamoto@corp.hp.com\fR> +.PP +Reviewed and assisted by Dean Roehrich, Ilya Zakharevich, Andreas Koenig, +and Tim Bunce. +.PP +PerlIO material contributed by Lupe Christoph, with some clarification +by Nick Ing-Simmons. +.PP +Changes for h2xs as of Perl 5.8.x by Renee Baecker +.SS "Last Changed" +.IX Subsection "Last Changed" +2012\-01\-20 diff --git a/data/miniconda3/man/man1/perlxstypemap.1 b/data/miniconda3/man/man1/perlxstypemap.1 new file mode 100644 index 0000000000000000000000000000000000000000..3be9423b7864dc4bd27bfd11f8050f568cb68820 --- /dev/null +++ b/data/miniconda3/man/man1/perlxstypemap.1 @@ -0,0 +1,791 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PERLXSTYPEMAP 1" +.TH PERLXSTYPEMAP 1 "2020-12-18" "perl v5.32.1" "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" +perlxstypemap \- Perl XS C/Perl type mapping +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The more you think about interfacing between two languages, the more +you'll realize that the majority of programmer effort has to go into +converting between the data structures that are native to either of +the languages involved. This trumps other matter such as differing +calling conventions because the problem space is so much greater. +There are simply more ways to shove data into memory than there are +ways to implement a function call. +.PP +Perl \s-1XS\s0' attempt at a solution to this is the concept of typemaps. +At an abstract level, a Perl \s-1XS\s0 typemap is nothing but a recipe for +converting from a certain Perl data structure to a certain C +data structure and vice versa. Since there can be C types that +are sufficiently similar to one another to warrant converting with +the same logic, \s-1XS\s0 typemaps are represented by a unique identifier, +henceforth called an \fB\s-1XS\s0 type\fR in this document. You can then tell +the \s-1XS\s0 compiler that multiple C types are to be mapped with the same +\&\s-1XS\s0 typemap. +.PP +In your \s-1XS\s0 code, when you define an argument with a C type or when +you are using a \f(CW\*(C`CODE:\*(C'\fR and an \f(CW\*(C`OUTPUT:\*(C'\fR section together with a +C return type of your \s-1XSUB,\s0 it'll be the typemapping mechanism that +makes this easy. +.SS "Anatomy of a typemap" +.IX Subsection "Anatomy of a typemap" +In more practical terms, the typemap is a collection of code +fragments which are used by the \fBxsubpp\fR compiler to map C function +parameters and values to Perl values. The typemap file may consist +of three sections labelled \f(CW\*(C`TYPEMAP\*(C'\fR, \f(CW\*(C`INPUT\*(C'\fR, and \f(CW\*(C`OUTPUT\*(C'\fR. +An unlabelled initial section is assumed to be a \f(CW\*(C`TYPEMAP\*(C'\fR section. +The \s-1INPUT\s0 section tells the compiler how to translate Perl values +into variables of certain C types. The \s-1OUTPUT\s0 section tells the +compiler how to translate the values from certain C types into values +Perl can understand. The \s-1TYPEMAP\s0 section tells the compiler which +of the \s-1INPUT\s0 and \s-1OUTPUT\s0 code fragments should be used to map a given +C type to a Perl value. The section labels \f(CW\*(C`TYPEMAP\*(C'\fR, \f(CW\*(C`INPUT\*(C'\fR, or +\&\f(CW\*(C`OUTPUT\*(C'\fR must begin in the first column on a line by themselves, +and must be in uppercase. +.PP +Each type of section can appear an arbitrary number of times +and does not have to appear at all. For example, a typemap may +commonly lack \f(CW\*(C`INPUT\*(C'\fR and \f(CW\*(C`OUTPUT\*(C'\fR sections if all it needs to +do is associate additional C types with core \s-1XS\s0 types like T_PTROBJ. +Lines that start with a hash \f(CW\*(C`#\*(C'\fR are considered comments and ignored +in the \f(CW\*(C`TYPEMAP\*(C'\fR section, but are considered significant in \f(CW\*(C`INPUT\*(C'\fR +and \f(CW\*(C`OUTPUT\*(C'\fR. Blank lines are generally ignored. +.PP +Traditionally, typemaps needed to be written to a separate file, +conventionally called \f(CW\*(C`typemap\*(C'\fR in a \s-1CPAN\s0 distribution. With +ExtUtils::ParseXS (the \s-1XS\s0 compiler) version 3.12 or better which +comes with perl 5.16, typemaps can also be embedded directly into +\&\s-1XS\s0 code using a HERE-doc like syntax: +.PP +.Vb 3 +\& TYPEMAP: <int_member)); +\& hv_stores(hash, "float_member", newSVnv(in\->float_member)); +\& /* ... */ +\& +\& /* mortalize as thy stack is not refcounted */ +\& sv_setsv(out, sv_2mortal(newRV_noinc((SV*)hash))); +\& } +.Ve +.Sp +The conversion from Perl to C is left as an exercise to the reader, +but the prototype would be: +.Sp +.Vb 2 +\& static foo_t * +\& XS_unpack_foo_tPtr(SV *in); +.Ve +.Sp +Instead of an actual C function that has to fetch the thread context +using \f(CW\*(C`dTHX\*(C'\fR, you can define macros of the same name and avoid the +overhead. Also, keep in mind to possibly free the memory allocated by +\&\f(CW\*(C`XS_unpack_foo_tPtr\*(C'\fR. +.IP "T_PACKEDARRAY" 4 +.IX Item "T_PACKEDARRAY" +T_PACKEDARRAY is similar to T_PACKED. In fact, the \f(CW\*(C`INPUT\*(C'\fR (Perl +to \s-1XSUB\s0) typemap is identical, but the \f(CW\*(C`OUTPUT\*(C'\fR typemap passes +an additional argument to the \f(CW\*(C`XS_pack_$ntype\*(C'\fR function. This +third parameter indicates the number of elements in the output +so that the function can handle C arrays sanely. The variable +needs to be declared by the user and must have the name +\&\f(CW\*(C`count_$ntype\*(C'\fR where \f(CW$ntype\fR is the normalized C type name +as explained above. The signature of the function would be for +the example above and \f(CW\*(C`foo_t **\*(C'\fR: +.Sp +.Vb 2 +\& static void +\& XS_pack_foo_tPtrPtr(SV *out, foo_t *in, UV count_foo_tPtrPtr); +.Ve +.Sp +The type of the third parameter is arbitrary as far as the typemap +is concerned. It just has to be in line with the declared variable. +.Sp +Of course, unless you know the number of elements in the +\&\f(CW\*(C`sometype **\*(C'\fR C array, within your \s-1XSUB,\s0 the return value from +\&\f(CW\*(C`foo_t ** XS_unpack_foo_tPtrPtr(...)\*(C'\fR will be hard to decipher. +Since the details are all up to the \s-1XS\s0 author (the typemap user), +there are several solutions, none of which particularly elegant. +The most commonly seen solution has been to allocate memory for +N+1 pointers and assign \f(CW\*(C`NULL\*(C'\fR to the (N+1)th to facilitate +iteration. +.Sp +Alternatively, using a customized typemap for your purposes in +the first place is probably preferable. +.IP "T_DATAUNIT" 4 +.IX Item "T_DATAUNIT" +\&\s-1NOT YET\s0 +.IP "T_CALLBACK" 4 +.IX Item "T_CALLBACK" +\&\s-1NOT YET\s0 +.IP "T_ARRAY" 4 +.IX Item "T_ARRAY" +This is used to convert the perl argument list to a C array +and for pushing the contents of a C array onto the perl +argument stack. +.Sp +The usual calling signature is +.Sp +.Vb 1 +\& @out = array_func( @in ); +.Ve +.Sp +Any number of arguments can occur in the list before the array but +the input and output arrays must be the last elements in the list. +.Sp +When used to pass a perl list to C the \s-1XS\s0 writer must provide a +function (named after the array type but with 'Ptr' substituted for +\&'*') to allocate the memory required to hold the list. A pointer +should be returned. It is up to the \s-1XS\s0 writer to free the memory on +exit from the function. The variable \f(CW\*(C`ix_$var\*(C'\fR is set to the number +of elements in the new array. +.Sp +When returning a C array to Perl the \s-1XS\s0 writer must provide an integer +variable called \f(CW\*(C`size_$var\*(C'\fR containing the number of elements in the +array. This is used to determine how many elements should be pushed +onto the return argument stack. This is not required on input since +Perl knows how many arguments are on the stack when the routine is +called. Ordinarily this variable would be called \f(CW\*(C`size_RETVAL\*(C'\fR. +.Sp +Additionally, the type of each element is determined from the type of +the array. If the array uses type \f(CW\*(C`intArray *\*(C'\fR xsubpp will +automatically work out that it contains variables of type \f(CW\*(C`int\*(C'\fR and +use that typemap entry to perform the copy of each element. All +pointer '*' and 'Array' tags are removed from the name to determine +the subtype. +.IP "T_STDIO" 4 +.IX Item "T_STDIO" +This is used for passing perl filehandles to and from C using +\&\f(CW\*(C`FILE *\*(C'\fR structures. +.IP "T_INOUT" 4 +.IX Item "T_INOUT" +This is used for passing perl filehandles to and from C using +\&\f(CW\*(C`PerlIO *\*(C'\fR structures. The file handle can used for reading and +writing. This corresponds to the \f(CW\*(C`+<\*(C'\fR mode, see also T_IN +and T_OUT. +.Sp +See perliol for more information on the Perl \s-1IO\s0 abstraction +layer. Perl must have been built with \f(CW\*(C`\-Duseperlio\*(C'\fR. +.Sp +There is no check to assert that the filehandle passed from Perl +to C was created with the right \f(CW\*(C`open()\*(C'\fR mode. +.Sp +Hint: The perlxstut tutorial covers the T_INOUT, T_IN, and T_OUT +\&\s-1XS\s0 types nicely. +.IP "T_IN" 4 +.IX Item "T_IN" +Same as T_INOUT, but the filehandle that is returned from C to Perl +can only be used for reading (mode \f(CW\*(C`<\*(C'\fR). +.IP "T_OUT" 4 +.IX Item "T_OUT" +Same as T_INOUT, but the filehandle that is returned from C to Perl +is set to use the open mode \f(CW\*(C`+>\*(C'\fR. diff --git a/data/miniconda3/man/man1/piconv.1 b/data/miniconda3/man/man1/piconv.1 new file mode 100644 index 0000000000000000000000000000000000000000..42ffd1eda1ab9a50c2266ae321ddbb8c1e2b8533 --- /dev/null +++ b/data/miniconda3/man/man1/piconv.1 @@ -0,0 +1,245 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PICONV 1" +.TH PICONV 1 "2023-12-23" "perl v5.32.1" "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" +piconv \-\- iconv(1), reinvented in perl +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 6 +\& piconv [\-f from_encoding] [\-t to_encoding] +\& [\-p|\-\-perlqq|\-\-htmlcref|\-\-xmlcref] [\-C N|\-c] [\-D] [\-S scheme] +\& [\-s string|file...] +\& piconv \-l +\& piconv \-r encoding_alias +\& piconv \-h +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBpiconv\fR is perl version of \fBiconv\fR, a character encoding converter +widely available for various Unixen today. This script was primarily +a technology demonstrator for Perl 5.8.0, but you can use piconv in the +place of iconv for virtually any case. +.PP +piconv converts the character encoding of either \s-1STDIN\s0 or files +specified in the argument and prints out to \s-1STDOUT.\s0 +.PP +Here is the list of options. Some options can be in short format (\-f) +or long (\-\-from) one. +.IP "\-f,\-\-from \fIfrom_encoding\fR" 4 +.IX Item "-f,--from from_encoding" +Specifies the encoding you are converting from. Unlike \fBiconv\fR, +this option can be omitted. In such cases, the current locale is used. +.IP "\-t,\-\-to \fIto_encoding\fR" 4 +.IX Item "-t,--to to_encoding" +Specifies the encoding you are converting to. Unlike \fBiconv\fR, +this option can be omitted. In such cases, the current locale is used. +.Sp +Therefore, when both \-f and \-t are omitted, \fBpiconv\fR just acts +like \fBcat\fR. +.IP "\-s,\-\-string \fIstring\fR" 4 +.IX Item "-s,--string string" +uses \fIstring\fR instead of file for the source of text. +.IP "\-l,\-\-list" 4 +.IX Item "-l,--list" +Lists all available encodings, one per line, in case-insensitive +order. Note that only the canonical names are listed; many aliases +exist. For example, the names are case-insensitive, and many standard +and common aliases work, such as \*(L"latin1\*(R" for \*(L"\s-1ISO\-8859\-1\*(R",\s0 or \*(L"ibm850\*(R" +instead of \*(L"cp850\*(R", or \*(L"winlatin1\*(R" for \*(L"cp1252\*(R". See Encode::Supported +for a full discussion. +.IP "\-r,\-\-resolve \fIencoding_alias\fR" 4 +.IX Item "-r,--resolve encoding_alias" +Resolve \fIencoding_alias\fR to Encode canonical encoding name. +.IP "\-C,\-\-check \fIN\fR" 4 +.IX Item "-C,--check N" +Check the validity of the stream if \fIN\fR = 1. When \fIN\fR = \-1, something +interesting happens when it encounters an invalid character. +.IP "\-c" 4 +.IX Item "-c" +Same as \f(CW\*(C`\-C 1\*(C'\fR. +.IP "\-p,\-\-perlqq" 4 +.IX Item "-p,--perlqq" +Transliterate characters missing in encoding to \ex{\s-1HHHH\s0} where \s-1HHHH\s0 is the +hexadecimal Unicode code point. +.IP "\-\-htmlcref" 4 +.IX Item "--htmlcref" +Transliterate characters missing in encoding to &#NNN; where \s-1NNN\s0 is the +decimal Unicode code point. +.IP "\-\-xmlcref" 4 +.IX Item "--xmlcref" +Transliterate characters missing in encoding to &#xHHHH; where \s-1HHHH\s0 is the +hexadecimal Unicode code point. +.IP "\-h,\-\-help" 4 +.IX Item "-h,--help" +Show usage. +.IP "\-D,\-\-debug" 4 +.IX Item "-D,--debug" +Invokes debugging mode. Primarily for Encode hackers. +.IP "\-S,\-\-scheme \fIscheme\fR" 4 +.IX Item "-S,--scheme scheme" +Selects which scheme is to be used for conversion. Available schemes +are as follows: +.RS 4 +.IP "from_to" 4 +.IX Item "from_to" +Uses Encode::from_to for conversion. This is the default. +.IP "decode_encode" 4 +.IX Item "decode_encode" +Input strings are \fBdecode()\fRd then \fBencode()\fRd. A straight two-step +implementation. +.IP "perlio" 4 +.IX Item "perlio" +The new perlIO layer is used. \s-1NI\-S\s0' favorite. +.Sp +You should use this option if you are using \s-1UTF\-16\s0 and others which +linefeed is not $/. +.RE +.RS 4 +.Sp +Like the \fI\-D\fR option, this is also for Encode hackers. +.RE +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\fBiconv\fR\|(1) +\&\fBlocale\fR\|(3) +Encode +Encode::Supported +Encode::Alias +PerlIO diff --git a/data/miniconda3/man/man1/pl2pm.1 b/data/miniconda3/man/man1/pl2pm.1 new file mode 100644 index 0000000000000000000000000000000000000000..ec068442078d804f656b485871041ea3dd136d3b --- /dev/null +++ b/data/miniconda3/man/man1/pl2pm.1 @@ -0,0 +1,158 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PL2PM 1" +.TH PL2PM 1 "2023-12-23" "perl v5.32.1" "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" +pl2pm \- Rough tool to translate Perl4 .pl files to Perl5 .pm modules. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBpl2pm\fR \fIfiles\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBpl2pm\fR is a tool to aid in the conversion of Perl4\-style .pl +library files to Perl5\-style library modules. Usually, your old .pl +file will still work fine and you should only use this tool if you +plan to update your library to use some of the newer Perl 5 features, +such as AutoLoading. +.SH "LIMITATIONS" +.IX Header "LIMITATIONS" +It's just a first step, but it's usually a good first step. +.SH "AUTHOR" +.IX Header "AUTHOR" +Larry Wall diff --git a/data/miniconda3/man/man1/pod2html.1 b/data/miniconda3/man/man1/pod2html.1 new file mode 100644 index 0000000000000000000000000000000000000000..d39c66c801e2b37e3ee5862b05bf2e22bab3ced7 --- /dev/null +++ b/data/miniconda3/man/man1/pod2html.1 @@ -0,0 +1,367 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "POD2HTML 1" +.TH POD2HTML 1 "2023-12-23" "perl v5.32.1" "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" +pod2html \- convert .pod files to .html files +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 8 +\& pod2html \-\-help \-\-htmldir= \-\-htmlroot= +\& \-\-infile= \-\-outfile= +\& \-\-podpath=:...: \-\-podroot= +\& \-\-cachedir= \-\-flush \-\-recurse \-\-norecurse +\& \-\-quiet \-\-noquiet \-\-verbose \-\-noverbose +\& \-\-index \-\-noindex \-\-backlink \-\-nobacklink +\& \-\-header \-\-noheader \-\-poderrors \-\-nopoderrors +\& \-\-css= \-\-title= +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Converts files from pod format (see perlpod) to \s-1HTML\s0 format. +.SH "ARGUMENTS" +.IX Header "ARGUMENTS" +pod2html takes the following arguments: +.IP "help" 4 +.IX Item "help" +.Vb 1 +\& \-\-help +.Ve +.Sp +Displays the usage message. +.IP "htmldir" 4 +.IX Item "htmldir" +.Vb 1 +\& \-\-htmldir=name +.Ve +.Sp +Sets the directory to which all cross references in the resulting \s-1HTML\s0 file +will be relative. Not passing this causes all links to be absolute since this +is the value that tells Pod::Html the root of the documentation tree. +.Sp +Do not use this and \-\-htmlroot in the same call to pod2html; they are mutually +exclusive. +.IP "htmlroot" 4 +.IX Item "htmlroot" +.Vb 1 +\& \-\-htmlroot=URL +.Ve +.Sp +Sets the base \s-1URL\s0 for the \s-1HTML\s0 files. When cross-references are made, the +\&\s-1HTML\s0 root is prepended to the \s-1URL.\s0 +.Sp +Do not use this if relative links are desired: use \-\-htmldir instead. +.Sp +Do not pass both this and \-\-htmldir to pod2html; they are mutually exclusive. +.IP "infile" 4 +.IX Item "infile" +.Vb 1 +\& \-\-infile=name +.Ve +.Sp +Specify the pod file to convert. Input is taken from \s-1STDIN\s0 if no +infile is specified. +.IP "outfile" 4 +.IX Item "outfile" +.Vb 1 +\& \-\-outfile=name +.Ve +.Sp +Specify the \s-1HTML\s0 file to create. Output goes to \s-1STDOUT\s0 if no outfile +is specified. +.IP "podroot" 4 +.IX Item "podroot" +.Vb 1 +\& \-\-podroot=name +.Ve +.Sp +Specify the base directory for finding library pods. +.IP "podpath" 4 +.IX Item "podpath" +.Vb 1 +\& \-\-podpath=name:...:name +.Ve +.Sp +Specify which subdirectories of the podroot contain pod files whose +\&\s-1HTML\s0 converted forms can be linked-to in cross-references. +.IP "cachedir" 4 +.IX Item "cachedir" +.Vb 1 +\& \-\-cachedir=name +.Ve +.Sp +Specify which directory is used for storing cache. Default directory is the +current working directory. +.IP "flush" 4 +.IX Item "flush" +.Vb 1 +\& \-\-flush +.Ve +.Sp +Flush the cache. +.IP "backlink" 4 +.IX Item "backlink" +.Vb 1 +\& \-\-backlink +.Ve +.Sp +Turn =head1 directives into links pointing to the top of the \s-1HTML\s0 file. +.IP "nobacklink" 4 +.IX Item "nobacklink" +.Vb 1 +\& \-\-nobacklink +.Ve +.Sp +Do not turn =head1 directives into links pointing to the top of the \s-1HTML\s0 file +(default behaviour). +.IP "header" 4 +.IX Item "header" +.Vb 1 +\& \-\-header +.Ve +.Sp +Create header and footer blocks containing the text of the \*(L"\s-1NAME\*(R"\s0 section. +.IP "noheader" 4 +.IX Item "noheader" +.Vb 1 +\& \-\-noheader +.Ve +.Sp +Do not create header and footer blocks containing the text of the \*(L"\s-1NAME\*(R"\s0 +section (default behaviour). +.IP "poderrors" 4 +.IX Item "poderrors" +.Vb 1 +\& \-\-poderrors +.Ve +.Sp +Include a \*(L"\s-1POD ERRORS\*(R"\s0 section in the outfile if there were any \s-1POD\s0 errors in +the infile (default behaviour). +.IP "nopoderrors" 4 +.IX Item "nopoderrors" +.Vb 1 +\& \-\-nopoderrors +.Ve +.Sp +Do not include a \*(L"\s-1POD ERRORS\*(R"\s0 section in the outfile if there were any \s-1POD\s0 +errors in the infile. +.IP "index" 4 +.IX Item "index" +.Vb 1 +\& \-\-index +.Ve +.Sp +Generate an index at the top of the \s-1HTML\s0 file (default behaviour). +.IP "noindex" 4 +.IX Item "noindex" +.Vb 1 +\& \-\-noindex +.Ve +.Sp +Do not generate an index at the top of the \s-1HTML\s0 file. +.IP "recurse" 4 +.IX Item "recurse" +.Vb 1 +\& \-\-recurse +.Ve +.Sp +Recurse into subdirectories specified in podpath (default behaviour). +.IP "norecurse" 4 +.IX Item "norecurse" +.Vb 1 +\& \-\-norecurse +.Ve +.Sp +Do not recurse into subdirectories specified in podpath. +.IP "css" 4 +.IX Item "css" +.Vb 1 +\& \-\-css=URL +.Ve +.Sp +Specify the \s-1URL\s0 of cascading style sheet to link from resulting \s-1HTML\s0 file. +Default is none style sheet. +.IP "title" 4 +.IX Item "title" +.Vb 1 +\& \-\-title=title +.Ve +.Sp +Specify the title of the resulting \s-1HTML\s0 file. +.IP "quiet" 4 +.IX Item "quiet" +.Vb 1 +\& \-\-quiet +.Ve +.Sp +Don't display mostly harmless warning messages. +.IP "noquiet" 4 +.IX Item "noquiet" +.Vb 1 +\& \-\-noquiet +.Ve +.Sp +Display mostly harmless warning messages (default behaviour). But this is not +the same as \*(L"verbose\*(R" mode. +.IP "verbose" 4 +.IX Item "verbose" +.Vb 1 +\& \-\-verbose +.Ve +.Sp +Display progress messages. +.IP "noverbose" 4 +.IX Item "noverbose" +.Vb 1 +\& \-\-noverbose +.Ve +.Sp +Do not display progress messages (default behaviour). +.SH "AUTHOR" +.IX Header "AUTHOR" +Tom Christiansen, . +.SH "BUGS" +.IX Header "BUGS" +See Pod::Html for a list of known bugs in the translator. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +perlpod, Pod::Html +.SH "COPYRIGHT" +.IX Header "COPYRIGHT" +This program is distributed under the Artistic License. diff --git a/data/miniconda3/man/man1/pod2text.1 b/data/miniconda3/man/man1/pod2text.1 new file mode 100644 index 0000000000000000000000000000000000000000..de396b8857e5c55078afef9cde291a0dd8a1c493 --- /dev/null +++ b/data/miniconda3/man/man1/pod2text.1 @@ -0,0 +1,330 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "POD2TEXT 1" +.TH POD2TEXT 1 "2023-12-23" "perl v5.32.1" "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" +pod2text \- Convert POD data to formatted ASCII text +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +pod2text [\fB\-aclostu\fR] [\fB\-\-code\fR] [\fB\-\-errors\fR=\fIstyle\fR] [\fB\-i\fR \fIindent\fR] + [\fB\-q\fR\ \fIquotes\fR] [\fB\-\-nourls\fR] [\fB\-\-stderr\fR] [\fB\-w\fR\ \fIwidth\fR] + [\fIinput\fR [\fIoutput\fR ...]] +.PP +pod2text \fB\-h\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBpod2text\fR is a front-end for Pod::Text and its subclasses. It uses them +to generate formatted \s-1ASCII\s0 text from \s-1POD\s0 source. It can optionally use +either termcap sequences or \s-1ANSI\s0 color escape sequences to format the text. +.PP +\&\fIinput\fR is the file to read for \s-1POD\s0 source (the \s-1POD\s0 can be embedded in +code). If \fIinput\fR isn't given, it defaults to \f(CW\*(C`STDIN\*(C'\fR. \fIoutput\fR, if +given, is the file to which to write the formatted output. If \fIoutput\fR +isn't given, the formatted output is written to \f(CW\*(C`STDOUT\*(C'\fR. Several \s-1POD\s0 +files can be processed in the same \fBpod2text\fR invocation (saving module +load and compile times) by providing multiple pairs of \fIinput\fR and +\&\fIoutput\fR files on the command line. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-a\fR, \fB\-\-alt\fR" 4 +.IX Item "-a, --alt" +Use an alternate output format that, among other things, uses a different +heading style and marks \f(CW\*(C`=item\*(C'\fR entries with a colon in the left margin. +.IP "\fB\-\-code\fR" 4 +.IX Item "--code" +Include any non-POD text from the input file in the output as well. Useful +for viewing code documented with \s-1POD\s0 blocks with the \s-1POD\s0 rendered and the +code left intact. +.IP "\fB\-c\fR, \fB\-\-color\fR" 4 +.IX Item "-c, --color" +Format the output with \s-1ANSI\s0 color escape sequences. Using this option +requires that Term::ANSIColor be installed on your system. +.IP "\fB\-\-errors\fR=\fIstyle\fR" 4 +.IX Item "--errors=style" +Set the error handling style. \f(CW\*(C`die\*(C'\fR says to throw an exception on any +\&\s-1POD\s0 formatting error. \f(CW\*(C`stderr\*(C'\fR says to report errors on standard error, +but not to throw an exception. \f(CW\*(C`pod\*(C'\fR says to include a \s-1POD ERRORS\s0 +section in the resulting documentation summarizing the errors. \f(CW\*(C`none\*(C'\fR +ignores \s-1POD\s0 errors entirely, as much as possible. +.Sp +The default is \f(CW\*(C`die\*(C'\fR. +.IP "\fB\-i\fR \fIindent\fR, \fB\-\-indent=\fR\fIindent\fR" 4 +.IX Item "-i indent, --indent=indent" +Set the number of spaces to indent regular text, and the default indentation +for \f(CW\*(C`=over\*(C'\fR blocks. Defaults to 4 spaces if this option isn't given. +.IP "\fB\-h\fR, \fB\-\-help\fR" 4 +.IX Item "-h, --help" +Print out usage information and exit. +.IP "\fB\-l\fR, \fB\-\-loose\fR" 4 +.IX Item "-l, --loose" +Print a blank line after a \f(CW\*(C`=head1\*(C'\fR heading. Normally, no blank line is +printed after \f(CW\*(C`=head1\*(C'\fR, although one is still printed after \f(CW\*(C`=head2\*(C'\fR, +because this is the expected formatting for manual pages; if you're +formatting arbitrary text documents, using this option is recommended. +.IP "\fB\-m\fR \fIwidth\fR, \fB\-\-left\-margin\fR=\fIwidth\fR, \fB\-\-margin\fR=\fIwidth\fR" 4 +.IX Item "-m width, --left-margin=width, --margin=width" +The width of the left margin in spaces. Defaults to 0. This is the margin +for all text, including headings, not the amount by which regular text is +indented; for the latter, see \fB\-i\fR option. +.IP "\fB\-\-nourls\fR" 4 +.IX Item "--nourls" +Normally, L<> formatting codes with a \s-1URL\s0 but anchor text are formatted +to show both the anchor text and the \s-1URL.\s0 In other words: +.Sp +.Vb 1 +\& L +.Ve +.Sp +is formatted as: +.Sp +.Vb 1 +\& foo +.Ve +.Sp +This flag, if given, suppresses the \s-1URL\s0 when anchor text is given, so this +example would be formatted as just \f(CW\*(C`foo\*(C'\fR. This can produce less +cluttered output in cases where the URLs are not particularly important. +.IP "\fB\-o\fR, \fB\-\-overstrike\fR" 4 +.IX Item "-o, --overstrike" +Format the output with overstrike printing. Bold text is rendered as +character, backspace, character. Italics and file names are rendered as +underscore, backspace, character. Many pagers, such as \fBless\fR, know how +to convert this to bold or underlined text. +.IP "\fB\-q\fR \fIquotes\fR, \fB\-\-quotes\fR=\fIquotes\fR" 4 +.IX Item "-q quotes, --quotes=quotes" +Sets the quote marks used to surround C<> text to \fIquotes\fR. If +\&\fIquotes\fR is a single character, it is used as both the left and right +quote. Otherwise, it is split in half, and the first half of the string +is used as the left quote and the second is used as the right quote. +.Sp +\&\fIquotes\fR may also be set to the special value \f(CW\*(C`none\*(C'\fR, in which case no +quote marks are added around C<> text. +.IP "\fB\-s\fR, \fB\-\-sentence\fR" 4 +.IX Item "-s, --sentence" +Assume each sentence ends with two spaces and try to preserve that spacing. +Without this option, all consecutive whitespace in non-verbatim paragraphs +is compressed into a single space. +.IP "\fB\-\-stderr\fR" 4 +.IX Item "--stderr" +By default, \fBpod2text\fR dies if any errors are detected in the \s-1POD\s0 input. +If \fB\-\-stderr\fR is given and no \fB\-\-errors\fR flag is present, errors are +sent to standard error, but \fBpod2text\fR does not abort. This is +equivalent to \f(CW\*(C`\-\-errors=stderr\*(C'\fR and is supported for backward +compatibility. +.IP "\fB\-t\fR, \fB\-\-termcap\fR" 4 +.IX Item "-t, --termcap" +Try to determine the width of the screen and the bold and underline +sequences for the terminal from termcap, and use that information in +formatting the output. Output will be wrapped at two columns less than the +width of your terminal device. Using this option requires that your system +have a termcap file somewhere where Term::Cap can find it and requires that +your system support termios. With this option, the output of \fBpod2text\fR +will contain terminal control sequences for your current terminal type. +.IP "\fB\-u\fR, \fB\-\-utf8\fR" 4 +.IX Item "-u, --utf8" +By default, \fBpod2text\fR tries to use the same output encoding as its input +encoding (to be backward-compatible with older versions). This option +says to instead force the output encoding to \s-1UTF\-8.\s0 +.Sp +Be aware that, when using this option, the input encoding of your \s-1POD\s0 +source should be properly declared unless it's US-ASCII. Pod::Simple +will attempt to guess the encoding and may be successful if it's +Latin\-1 or \s-1UTF\-8,\s0 but it will warn, which by default results in a +\&\fBpod2text\fR failure. Use the \f(CW\*(C`=encoding\*(C'\fR command to declare the +encoding. See \fBperlpod\fR\|(1) for more information. +.IP "\fB\-w\fR, \fB\-\-width=\fR\fIwidth\fR, \fB\-\fR\fIwidth\fR" 4 +.IX Item "-w, --width=width, -width" +The column at which to wrap text on the right-hand side. Defaults to 76, +unless \fB\-t\fR is given, in which case it's two columns less than the width of +your terminal device. +.SH "EXIT STATUS" +.IX Header "EXIT STATUS" +As long as all documents processed result in some output, even if that +output includes errata (a \f(CW\*(C`POD ERRORS\*(C'\fR section generated with +\&\f(CW\*(C`\-\-errors=pod\*(C'\fR), \fBpod2text\fR will exit with status 0. If any of the +documents being processed do not result in an output document, \fBpod2text\fR +will exit with status 1. If there are syntax errors in a \s-1POD\s0 document +being processed and the error handling style is set to the default of +\&\f(CW\*(C`die\*(C'\fR, \fBpod2text\fR will abort immediately with exit status 255. +.SH "DIAGNOSTICS" +.IX Header "DIAGNOSTICS" +If \fBpod2text\fR fails with errors, see Pod::Text and Pod::Simple for +information about what those errors might mean. Internally, it can also +produce the following diagnostics: +.IP "\-c (\-\-color) requires Term::ANSIColor be installed" 4 +.IX Item "-c (--color) requires Term::ANSIColor be installed" +(F) \fB\-c\fR or \fB\-\-color\fR were given, but Term::ANSIColor could not be +loaded. +.ie n .IP "Unknown option: %s" 4 +.el .IP "Unknown option: \f(CW%s\fR" 4 +.IX Item "Unknown option: %s" +(F) An unknown command line option was given. +.PP +In addition, other Getopt::Long error messages may result from invalid +command-line options. +.SH "ENVIRONMENT" +.IX Header "ENVIRONMENT" +.IP "\s-1COLUMNS\s0" 4 +.IX Item "COLUMNS" +If \fB\-t\fR is given, \fBpod2text\fR will take the current width of your screen +from this environment variable, if available. It overrides terminal width +information in \s-1TERMCAP.\s0 +.IP "\s-1TERMCAP\s0" 4 +.IX Item "TERMCAP" +If \fB\-t\fR is given, \fBpod2text\fR will use the contents of this environment +variable if available to determine the correct formatting sequences for your +current terminal device. +.SH "AUTHOR" +.IX Header "AUTHOR" +Russ Allbery . +.SH "COPYRIGHT AND LICENSE" +.IX Header "COPYRIGHT AND LICENSE" +Copyright 1999\-2001, 2004, 2006, 2008, 2010, 2012\-2019 Russ Allbery + +.PP +This program is free software; you may redistribute it and/or modify it +under the same terms as Perl itself. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +Pod::Text, Pod::Text::Color, Pod::Text::Overstrike, +Pod::Text::Termcap, Pod::Simple, \fBperlpod\fR\|(1) +.PP +The current version of this script is always available from its web site at +. It is also part of the +Perl core distribution as of 5.6.0. diff --git a/data/miniconda3/man/man1/podchecker.1 b/data/miniconda3/man/man1/podchecker.1 new file mode 100644 index 0000000000000000000000000000000000000000..9115f2afbc536eb5d0822838666c9849f3ed1038 --- /dev/null +++ b/data/miniconda3/man/man1/podchecker.1 @@ -0,0 +1,198 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "PODCHECKER 1" +.TH PODCHECKER 1 "2023-12-23" "perl v5.32.1" "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" +podchecker \- check the syntax of POD format documentation files +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBpodchecker\fR [\fB\-help\fR] [\fB\-man\fR] [\fB\-(no)warnings\fR] [\fIfile\fR\ ...] +.SH "OPTIONS AND ARGUMENTS" +.IX Header "OPTIONS AND ARGUMENTS" +.IP "\fB\-help\fR" 8 +.IX Item "-help" +Print a brief help message and exit. +.IP "\fB\-man\fR" 8 +.IX Item "-man" +Print the manual page and exit. +.IP "\fB\-warnings\fR \fB\-nowarnings\fR" 8 +.IX Item "-warnings -nowarnings" +Turn on/off printing of warnings. Repeating \fB\-warnings\fR increases the +warning level, i.e. more warnings are printed. Currently increasing to +level two causes flagging of unescaped \*(L"<,>\*(R" characters. +.IP "\fIfile\fR" 8 +.IX Item "file" +The pathname of a \s-1POD\s0 file to syntax-check (defaults to standard input). +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBpodchecker\fR will read the given input files looking for \s-1POD\s0 +syntax errors in the \s-1POD\s0 documentation and will print any errors +it find to \s-1STDERR.\s0 At the end, it will print a status message +indicating the number of errors found. +.PP +Directories are ignored, an appropriate warning message is printed. +.PP +\&\fBpodchecker\fR invokes the \fB\fBpodchecker()\fB\fR function exported by \fBPod::Checker\fR +Please see \*(L"\fBpodchecker()\fR\*(R" in Pod::Checker for more details. +.SH "RETURN VALUE" +.IX Header "RETURN VALUE" +\&\fBpodchecker\fR returns a 0 (zero) exit status if all specified +\&\s-1POD\s0 files are ok. +.SH "ERRORS" +.IX Header "ERRORS" +\&\fBpodchecker\fR returns the exit status 1 if at least one of +the given \s-1POD\s0 files has syntax errors. +.PP +The status 2 indicates that at least one of the specified +files does not contain \fIany\fR \s-1POD\s0 commands. +.PP +Status 1 overrides status 2. If you want unambiguous +results, call \fBpodchecker\fR with one single argument only. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +Pod::Simple and Pod::Checker +.SH "AUTHORS" +.IX Header "AUTHORS" +Please report bugs using . +.PP +Brad Appleton , +Marek Rouchal +.PP +Based on code for \fB\fBPod::Text::pod2text\fB\|(1)\fR written by +Tom Christiansen diff --git a/data/miniconda3/man/man1/shasum.1 b/data/miniconda3/man/man1/shasum.1 new file mode 100644 index 0000000000000000000000000000000000000000..34a07a6e78689113a797584c0e1c90f414fcb885 --- /dev/null +++ b/data/miniconda3/man/man1/shasum.1 @@ -0,0 +1,223 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "SHASUM 1" +.TH SHASUM 1 "2023-12-23" "perl v5.32.1" "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" +shasum \- Print or Check SHA Checksums +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 3 +\& Usage: shasum [OPTION]... [FILE]... +\& Print or check SHA checksums. +\& With no FILE, or when FILE is \-, read standard input. +\& +\& \-a, \-\-algorithm 1 (default), 224, 256, 384, 512, 512224, 512256 +\& \-b, \-\-binary read in binary mode +\& \-c, \-\-check read SHA sums from the FILEs and check them +\& \-\-tag create a BSD\-style checksum +\& \-t, \-\-text read in text mode (default) +\& \-U, \-\-UNIVERSAL read in Universal Newlines mode +\& produces same digest on Windows/Unix/Mac +\& \-0, \-\-01 read in BITS mode +\& ASCII \*(Aq0\*(Aq interpreted as 0\-bit, +\& ASCII \*(Aq1\*(Aq interpreted as 1\-bit, +\& all other characters ignored +\& +\& The following five options are useful only when verifying checksums: +\& \-\-ignore\-missing don\*(Aqt fail or report status for missing files +\& \-q, \-\-quiet don\*(Aqt print OK for each successfully verified file +\& \-s, \-\-status don\*(Aqt output anything, status code shows success +\& \-\-strict exit non\-zero for improperly formatted checksum lines +\& \-w, \-\-warn warn about improperly formatted checksum lines +\& +\& \-h, \-\-help display this help and exit +\& \-v, \-\-version output version information and exit +\& +\& When verifying SHA\-512/224 or SHA\-512/256 checksums, indicate the +\& algorithm explicitly using the \-a option, e.g. +\& +\& shasum \-a 512224 \-c checksumfile +\& +\& The sums are computed as described in FIPS PUB 180\-4. When checking, +\& the input should be a former output of this program. The default +\& mode is to print a line with checksum, a character indicating type +\& (\`*\*(Aq for binary, \` \*(Aq for text, \`U\*(Aq for UNIVERSAL, \`^\*(Aq for BITS), +\& and name for each FILE. The line starts with a \`\e\*(Aq character if the +\& FILE name contains either newlines or backslashes, which are then +\& replaced by the two\-character sequences \`\en\*(Aq and \`\e\e\*(Aq respectively. +\& +\& Report shasum bugs to mshelor@cpan.org +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Running \fIshasum\fR is often the quickest way to compute \s-1SHA\s0 message +digests. The user simply feeds data to the script through files or +standard input, and then collects the results from standard output. +.PP +The following command shows how to compute digests for typical inputs +such as the \s-1NIST\s0 test vector \*(L"abc\*(R": +.PP +.Vb 1 +\& perl \-e "print qq(abc)" | shasum +.Ve +.PP +Or, if you want to use \s-1SHA\-256\s0 instead of the default \s-1SHA\-1,\s0 simply say: +.PP +.Vb 1 +\& perl \-e "print qq(abc)" | shasum \-a 256 +.Ve +.PP +Since \fIshasum\fR mimics the behavior of the combined \s-1GNU\s0 \fIsha1sum\fR, +\&\fIsha224sum\fR, \fIsha256sum\fR, \fIsha384sum\fR, and \fIsha512sum\fR programs, +you can install this script as a convenient drop-in replacement. +.PP +Unlike the \s-1GNU\s0 programs, \fIshasum\fR encompasses the full \s-1SHA\s0 standard by +allowing partial-byte inputs. This is accomplished through the \s-1BITS\s0 +option (\fI\-0\fR). The following example computes the \s-1SHA\-224\s0 digest of +the 7\-bit message \fI0001100\fR: +.PP +.Vb 1 +\& perl \-e "print qq(0001100)" | shasum \-0 \-a 224 +.Ve +.SH "AUTHOR" +.IX Header "AUTHOR" +Copyright (C) 2003\-2018 Mark Shelor . +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\fIshasum\fR is implemented using the Perl module Digest::SHA. diff --git a/data/miniconda3/man/man1/xdotool.1 b/data/miniconda3/man/man1/xdotool.1 new file mode 100644 index 0000000000000000000000000000000000000000..63b2b3bedcf3e1a5364278afc587ff1389da7f26 --- /dev/null +++ b/data/miniconda3/man/man1/xdotool.1 @@ -0,0 +1,1252 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" +.\" Standard preamble: +.\" ======================================================================== +.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" '' +. ds C` +. ds C' +'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 >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" 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 "XDOTOOL 1" +.TH XDOTOOL 1 "2021-10-22" "" "" +.\" 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" +xdotool \- command\-line X11 automation tool +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBxdotool\fR \fIcmd\fR \fIargs...\fR +.PP +Notation: Some documentation uses \fI[window]\fR to denote an optional +window argument. This case means that the argument, if not present, will +default to \*(L"%1\*(R". See \*(L"\s-1WINDOW STACK\*(R"\s0 for what \*(L"%1\*(R" means. +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBxdotool\fR lets you programmatically (or manually) simulate keyboard input and +mouse activity, move and resize windows, etc. It does this using X11's +\&\s-1XTEST\s0 extension and other Xlib functions. +.PP +There is some support for Extended Window Manager Hints (aka \s-1EWMH\s0 or NetWM). +See the \*(L"\s-1EXTENDED WINDOW MANAGER HINTS\*(R"\s0 section for more information. +.SH "KEYBOARD COMMANDS" +.IX Header "KEYBOARD COMMANDS" +.IP "\fBkey\fR \fI[options]\fR \fIkeystroke\fR [\fIkeystroke\fR ...]" 4 +.IX Item "key [options] keystroke [keystroke ...]" +Options: +.RS 4 +.IP "\fB\-\-window window\fR" 4 +.IX Item "--window window" +Send keystrokes to a specific window id. You can use +\&\*(L"\s-1WINDOW STACK\*(R"\s0 references like \*(L"%1\*(R" and \*(L"%@\*(R" here. If there is a window stack, +then \*(L"%1\*(R" is the default, otherwise the current window is used. +.Sp +See also: \*(L"\s-1SENDEVENT NOTES\*(R"\s0 and \*(L"\s-1WINDOW STACK\*(R"\s0 +.IP "\fB\-\-clearmodifiers\fR" 4 +.IX Item "--clearmodifiers" +Clear modifiers before sending keystrokes. See \s-1CLEARMODIFIERS\s0 below. +.IP "\fB\-\-delay milliseconds\fR" 4 +.IX Item "--delay milliseconds" +Delay between keystrokes. Default is 12ms. +.RE +.RS 4 +.Sp +Type a given keystroke. Examples being \*(L"alt+r\*(R", \*(L"Control_L+J\*(R", +\&\*(L"ctrl+alt+n\*(R", \*(L"BackSpace\*(R". +.Sp +Generally, any valid X Keysym string will work. Multiple keys are +separated by '+'. Aliases exist for \*(L"alt\*(R", \*(L"ctrl\*(R", \*(L"shift\*(R", \*(L"super\*(R", +and \*(L"meta\*(R" which all map to Foo_L, such as Alt_L and Control_L, etc. +.Sp +In cases where your keyboard doesn't actually have the key you want to type, +xdotool will automatically find an unused keycode and use that to type the key. +.Sp +With respect to \*(L"\s-1COMMAND CHAINING\*(R"\s0, this command consumes the remainder of the +arguments or until a new xdotool command is seen, because no xdotool commands +are valid keystrokes. +.Sp +Example: Send the keystroke \*(L"F2\*(R" + xdotool key F2 +.Sp +Example: Send 'a' with an accent over it (not on English keyboards, but still +works with xdotool) + xdotool key Aacute +.Sp +Example: Send ctrl+l and then BackSpace as separate keystrokes: + xdotool key ctrl+l BackSpace +.Sp +Example: Send ctrl+c to all windows matching title 'gdb' (See \*(L"\s-1COMMAND CHAINING\*(R"\s0) + xdotool search \-\-name gdb key ctrl+c +.RE +.IP "\fBkeydown\fR \fI[options]\fR \fIkeystroke\fR" 4 +.IX Item "keydown [options] keystroke" +Same as above, except only keydown (press) events are sent. +.IP "\fBkeyup\fR \fIkeystroke\fR" 4 +.IX Item "keyup keystroke" +Same as above, except only keyup (release) events are sent. +.IP "\fBtype\fR \fI[options]\fR \fIsomething to type\fR" 4 +.IX Item "type [options] something to type" +Options: +.RS 4 +.IP "\fB\-\-window windowid\fR" 4 +.IX Item "--window windowid" +Send keystrokes to a specific window id. See \*(L"\s-1SENDEVENT NOTES\*(R"\s0 below. The +default, if no window is given, depends on the window stack. If the window +stack is empty the current window is typed at using \s-1XTEST.\s0 Otherwise, the +default is \*(L"%1\*(R" (see \*(L"\s-1WINDOW STACK\*(R"\s0). +.IP "\fB\-\-delay milliseconds\fR" 4 +.IX Item "--delay milliseconds" +Delay between keystrokes. Default is 12ms. +.IP "\fB\-\-clearmodifiers\fR" 4 +.IX Item "--clearmodifiers" +Clear modifiers before sending keystrokes. See \s-1CLEARMODIFIERS\s0 below. +.RE +.RS 4 +.Sp +Types as if you had typed it. Supports newlines and tabs (\s-1ASCII\s0 newline and +tab). Each keystroke is separated by a delay given by the \fB\-\-delay\fR option. +.Sp +With respect to \*(L"\s-1COMMAND CHAINING\*(R"\s0, this command consumes the remainder of the +arguments and types them. That is, no commands can chain after 'type'. +.Sp +Example: to type 'Hello world!' you would do: + xdotool type 'Hello world!' +.RE +.SH "MOUSE COMMANDS" +.IX Header "MOUSE COMMANDS" +.IP "\fBmousemove\fR \fI[options]\fR \fIx y \s-1OR\s0 'restore'\fR" 4 +.IX Item "mousemove [options] x y OR 'restore'" +Move the mouse to the specific X and Y coordinates on the screen. +.Sp +You can move the mouse to the previous location if you specify 'restore' +instead of an X and Y coordinate. Restoring only works if you have moved +previously in this same command invocation. Further, it does not work with the +\&\-\-window option. +.Sp +For example, to click the top-left corner of the screen and move the mouse to +the original position before you moved it, use this: + xdotool mousemove 0 0 click 1 mousemove restore +.RS 4 +.IP "\fB\-\-window \s-1WINDOW\s0\fR" 4 +.IX Item "--window WINDOW" +Specify a window to move relative to. Coordinates 0,0 are at the top left of +the window you choose. +.Sp +\&\*(L"\s-1WINDOW STACK\*(R"\s0 references are valid here, such as \f(CW%1\fR and %@. Though, using %@ +probably doesn't make sense. +.IP "\fB\-\-screen \s-1SCREEN\s0\fR" 4 +.IX Item "--screen SCREEN" +Move the mouse to the specified screen to move to. This is only useful if you +have multiple screens and \s-1ARE NOT\s0 using Xinerama. +.Sp +The default is the current screen. If you specify \-\-window, the \-\-screen flag +is ignored. +.IP "\fB\-\-polar\fR" 4 +.IX Item "--polar" +Use polar coordinates. This makes 'x' an angle (in degrees, 0\-360, etc) and 'y' +the distance. +.Sp +Rotation starts at 'up' (0 degrees) and rotates clockwise: 90 = right, 180 = +down, 270 = left. +.Sp +The origin defaults to the center of the current screen. If you specify a +\&\-\-window, then the origin is the center of that window. +.IP "\fB\-\-clearmodifiers\fR" 4 +.IX Item "--clearmodifiers" +See \s-1CLEARMODIFIERS\s0 +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +After sending the mouse move request, wait until the mouse is actually +moved. If no movement is necessary, we will not wait. This is useful for +scripts that depend on actions being completed before moving on. +.Sp +Note: We wait until the mouse moves at all, not necessarily that it +actually reaches your intended destination. Some applications lock the +mouse cursor to certain regions of the screen, so waiting for any movement is +better in the general case than waiting for a specific target. +.RE +.RS 4 +.RE +.IP "\fBmousemove_relative\fR [options] \fIx\fR \fIy\fR" 4 +.IX Item "mousemove_relative [options] x y" +Move the mouse x,y pixels relative to the current position of the mouse cursor. +.RS 4 +.IP "\fB\-\-polar\fR" 4 +.IX Item "--polar" +Use polar coordinates. This makes 'x' an angle (in degrees, 0\-360, etc) and 'y' +the distance. +.Sp +Rotation starts at 'up' (0 degrees) and rotates clockwise: 90 = right, 180 = +down, 270 = left. +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +After sending the mouse move request, wait until the mouse is actually +moved. If no movement is necessary, we will not wait. This is useful for +scripts that depend on actions being completed before moving on. +.Sp +Note that we wait until the mouse moves at all, not necessarily that it +actually reaches your intended destination. Some applications lock the mouse +cursor to certain regions of the screen, so waiting for any movement is better +in the general case than waiting for a specific target. +.IP "\fB\-\-clearmodifiers\fR" 4 +.IX Item "--clearmodifiers" +See \s-1CLEARMODIFIERS\s0 +.RE +.RS 4 +.RE +.IP "\fBclick\fR \fI[options]\fR \fIbutton\fR" 4 +.IX Item "click [options] button" +Send a click, that is, a mousedown followed by mouseup for the given button +with a short delay between the two (currently 12ms). +.Sp +Buttons generally map this way: Left mouse is 1, middle is 2, right is 3, +wheel up is 4, wheel down is 5. +.RS 4 +.IP "\fB\-\-clearmodifiers\fR" 4 +.IX Item "--clearmodifiers" +Clear modifiers before clicking. See \s-1CLEARMODIFIERS\s0 below. +.IP "\fB\-\-repeat\fR \s-1REPEAT\s0" 4 +.IX Item "--repeat REPEAT" +Specify how many times to click. Default is 1. For a double-click, use +\&'\-\-repeat 2' +.IP "\fB\-\-delay\fR \s-1MILLISECONDS\s0" 4 +.IX Item "--delay MILLISECONDS" +Specify how long, in milliseconds, to delay between clicks. This option is not +used if the \fI\-\-repeat\fR flag is set to 1 (default). +.IP "\fB\-\-window\fR \s-1WINDOW\s0" 4 +.IX Item "--window WINDOW" +Specify a window to send a click to. See \*(L"\s-1SENDEVENT NOTES\*(R"\s0 below for caveats. Uses the +current mouse position when generating the event. +.Sp +The default, if no window is given, depends on the window stack. If the window +stack is empty the current window is typed at using \s-1XTEST.\s0 Otherwise, the +default is \*(L"%1\*(R" (see \*(L"\s-1WINDOW STACK\*(R"\s0). +.RE +.RS 4 +.RE +.IP "\fBmousedown\fR \fI[options]\fR \fIbutton\fR" 4 +.IX Item "mousedown [options] button" +Same as \fBclick\fR, except only a mouse down is sent. +.IP "\fBmouseup\fR \fI[options]\fR \fIbutton\fR" 4 +.IX Item "mouseup [options] button" +Same as \fBclick\fR, except only a mouse up is sent. +.IP "\fBgetmouselocation\fR \fI[\-\-shell]\fR" 4 +.IX Item "getmouselocation [--shell]" +Outputs the x, y, screen, and window id of the mouse cursor. Screen numbers will +be nonzero if you have multiple monitors and are not using Xinerama. +.Sp +This command updates the window stack with the window id of the window directly underneath the mouse. +.RS 4 +.IP "\fB\-\-shell\fR" 4 +.IX Item "--shell" +This makes getmouselocation output shell data you can eval. Example: +.Sp +.Vb 5 +\& % xdotool getmouselocation \-\-shell +\& X=880 +\& Y=443 +\& SCREEN=0 +\& WINDOW=16777250 +\& +\& % eval $(xdotool getmouselocation \-\-shell) +\& % echo $X,$Y +\& 714,324 +.Ve +.RE +.RS 4 +.RE +.IP "\fBbehave_screen_edge\fR \fI[options]\fR \fIwhere\fR \fIcommand ...\fR" 4 +.IX Item "behave_screen_edge [options] where command ..." +Bind an action to events when the mouse hits the screen edge or corner. +.Sp +Options are: +.RS 4 +.IP "\fI\-\-delay \s-1MILLISECONDS\s0\fR" 4 +.IX Item "--delay MILLISECONDS" +Delay in milliseconds before running the command. This allows you to require +a given edge or corner to be held for a short period before your command will +run. If you leave the edge or corner before the delay expires then the time +will reset. +.IP "\fI\-\-quiesce \s-1MILLISECONDS\s0\fR" 4 +.IX Item "--quiesce MILLISECONDS" +Delay in milliseconds before the next command will run. This helps prevent +accidentally running your command extra times; especially useful if you have +a very short \-\-delay (like the default of 0). +.RE +.RS 4 +.Sp +Event timeline +.Sp +.Vb 5 +\& * Mouse hits an edge or corner. +\& * If delay is nonzero, the mouse must stay in this edge or corner until delay time expires. +\& * If still in the edge/corner, trigger. +\& * If quiesce is nonzero, then there is a cool\-down period where the next +\& trigger cannot occur +.Ve +.Sp +Valid 'where' values are: +.IP "left" 4 +.IX Item "left" +.PD 0 +.IP "top-left" 4 +.IX Item "top-left" +.IP "top" 4 +.IX Item "top" +.IP "top-right" 4 +.IX Item "top-right" +.IP "right" 4 +.IX Item "right" +.IP "bottom-left" 4 +.IX Item "bottom-left" +.IP "bottom" 4 +.IX Item "bottom" +.IP "bottom-right" 4 +.IX Item "bottom-right" +.RE +.RS 4 +.PD +.Sp +Examples: + # Activate google-chrome when you move the mouse to the bottom-left corner: + xdotool behave_screen_edge bottom-left \e + search \-\-class google-chrome windowactivate +.Sp +.Vb 2 +\& # Go to the next workspace (right). Known to work in GNOME (metacity and compiz) +\& xdotool behave_screen_edge \-\-delay 500 bottom\-right key XF86Forward +\& +\& # Activate firefox and do a web search in a new tab for text in your clipboard +\& xdotool behave_screen_edge \-\-delay 1000 top\-left \e +\& search \-\-classname Navigator \e +\& windowactivate \-\-sync key \-\-delay 250 ctrl+t ctrl+k ctrl+v Return +.Ve +.RE +.SH "WINDOW COMMANDS" +.IX Header "WINDOW COMMANDS" +.IP "\fBsearch\fR \fI[options]\fR \fIpattern\fR" 4 +.IX Item "search [options] pattern" +Search for windows with titles, names, or classes with a regular expression +pattern. The output is line-delimited list of X window identifiers. If you +are using \*(L"\s-1COMMAND CHAINING\*(R"\s0, the search command will only write window +ids to stdout if it is the last (or only) command in the chain; otherwise, it +is silent. +.Sp +The result is saved to the window stack for future chained commands. See +\&\*(L"\s-1WINDOW STACK\*(R"\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for details. +.Sp +Patterns are \s-1POSIX\s0 extended regular expressions (\s-1ERE\s0), e. g. \*(L"Chrom(e|ium)$\*(R" for +windows ending in \*(L"Chrome\*(R" or \*(L"Chromium\*(R". See \fBregex\fR\|(7) for syntax details. +Matches are case-insensitive. +.Sp +The default options are \f(CW\*(C`\-\-name \-\-class \-\-classname \-\-role\*(C'\fR +(unless you specify one or more of \-\-name, \-\-class, \-\-classname, or \-\-role). +.Sp +The options available are: +.RS 4 +.IP "\fB\-\-class\fR" 4 +.IX Item "--class" +Match against the window class. +.IP "\fB\-\-classname\fR" 4 +.IX Item "--classname" +Match against the window classname. +.IP "\fB\-\-role\fR" 4 +.IX Item "--role" +Match against the window role. +.IP "\fB\-\-maxdepth\fR N" 4 +.IX Item "--maxdepth N" +Set recursion/child search depth. Default is \-1, +meaning infinite. 0 means no depth, only root windows will be searched. If you +only want toplevel windows, set maxdepth of 1 (or 2, depending on how your +window manager does decorations). +.IP "\fB\-\-name\fR" 4 +.IX Item "--name" +Match against the window name. This is the same string that is displayed in the +window titlebar. +.IP "\fB\-\-onlyvisible\fR" 4 +.IX Item "--onlyvisible" +Show only visible windows in the results. This means ones with map state +IsViewable. +.IP "\fB\-\-pid \s-1PID\s0\fR" 4 +.IX Item "--pid PID" +Match windows that belong to a specific process id. This may not work for some +X applications that do not set this metadata on its windows. +.IP "\fB\-\-screen N\fR" 4 +.IX Item "--screen N" +Select windows only on a specific screen. Default is to +search all screens. Only meaningful if you have multiple displays and are not +using Xinerama. +.IP "\fB\-\-desktop N\fR" 4 +.IX Item "--desktop N" +Only match windows on a certain desktop. 'N' is a number. The default +is to search all desktops. +.IP "\fB\-\-limit N\fR" 4 +.IX Item "--limit N" +Stop searching after finding N matching windows. Specifying a limit will help +speed up your search if you only want a few results. +.Sp +The default is no search limit (which is equivalent to '\-\-limit 0') +.IP "\fB\-\-title\fR" 4 +.IX Item "--title" +\&\s-1DEPRECATED.\s0 See \-\-name. +.IP "\fB\-\-all\fR" 4 +.IX Item "--all" +Require that all conditions be met. For example: +.Sp +.Vb 1 +\& xdotool search \-\-all \-\-pid 1424 \-\-name "Hello World" +.Ve +.Sp +This will match only windows that have \*(L"Hello World\*(R" as a name and are owned by +pid 1424. +.IP "\fB\-\-any\fR" 4 +.IX Item "--any" +Match windows that match any condition (logically, 'or'). This is on by +default. For example: +.Sp +.Vb 1 +\& xdotool search \-\-any \-\-pid 1424 \-\-name "Hello World" +.Ve +.Sp +This will match any windows owned by pid 1424 or windows with name \*(L"Hello +World\*(R" +.IP "\fB\-\-sync \fR" 4 +.IX Item "--sync " +Block until there are results. This is useful when you are launching an +application and want to wait until the application window is visible. +For example: +.Sp +.Vb 2 +\& google\-chrome & +\& xdotool search \-\-sync \-\-onlyvisible \-\-class "google\-chrome" +.Ve +.RE +.RS 4 +.RE +.IP "\fBselectwindow\fR" 4 +.IX Item "selectwindow" +Get the window id (for a client) by clicking on it. Useful for having scripts +query you humans for what window to act on. For example, killing a window by +clicking on it: +.Sp +.Vb 1 +\& xdotool selectwindow windowkill +.Ve +.IP "\fBbehave\fR \fIwindow\fR \fIaction\fR \fIcommand ...\fR" 4 +.IX Item "behave window action command ..." +Bind an action to an event on a window. This lets you run additional xdotool +commands whenever a matched event occurs. +.Sp +The command run as a result of the behavior is run with \f(CW%1\fR being the window +that was acted upon. Examples follow after the event list. +.Sp +The following are valid events: +.RS 4 +.IP "\fBmouse-enter\fR" 4 +.IX Item "mouse-enter" +Fires when the mouse enters a window. This is similar to 'mouse over' events in +javascript, if that helps. +.IP "\fBmouse-leave\fR" 4 +.IX Item "mouse-leave" +Fires when the mouse leaves a window. This is the opposite of 'mouse\-enter' +.IP "\fBmouse-click\fR" 4 +.IX Item "mouse-click" +Fires when the mouse is clicked. Specifically, when the mouse button is released. +.IP "\fBfocus\fR" 4 +.IX Item "focus" +Fires when the window gets input focus. +.IP "\fBblur\fR" 4 +.IX Item "blur" +Fires when the window loses focus. +.RE +.RS 4 +.Sp +Examples: +.Sp +.Vb 3 +\& # Print the cursor location whenever the mouse enters a currently\-visible +\& # window: +\& xdotool search \-\-onlyvisible . behave %@ mouse\-enter getmouselocation +\& +\& # Print the window title and pid whenever an xterm gets focus +\& xdotool search \-\-class xterm behave %@ focus getwindowname getwindowpid +\& +\& # Emulate focus\-follows\-mouse +\& xdotool search . behave %@ mouse\-enter windowfocus +.Ve +.RE +.IP "\fBgetwindowpid\fR \fI[window]\fR" 4 +.IX Item "getwindowpid [window]" +Output the \s-1PID\s0 owning a given window. This requires effort from the application +owning a window and may not work for all windows. This uses _NET_WM_PID +property of the window. See \*(L"\s-1EXTENDED WINDOW MANAGER HINTS\*(R"\s0 below for more +information. +.Sp +If no window is given, the default is '%1'. If no windows are on the stack, then +this is an error. See \*(L"\s-1WINDOW STACK\*(R"\s0 for more details. +.Sp +Example: Find the \s-1PID\s0 for all xterms: + xdotool search \-\-class xterm getwindowpid %@ +.IP "\fBgetwindowname\fR \fI[window]\fR" 4 +.IX Item "getwindowname [window]" +Output the name of a given window, also known as the title. This is the text +displayed in the window's titlebar by your window manager. +.Sp +If no window is given, the default is '%1'. If no windows are on the stack, then +this is an error. See \*(L"\s-1WINDOW STACK\*(R"\s0 for more details. +.IP "\fBgetwindowgeometry\fR [options] \fI[window]\fR" 4 +.IX Item "getwindowgeometry [options] [window]" +Output the geometry (location and position) of a window. The values include: x, +y, width, height, and screen number. +.RS 4 +.IP "\fB\-\-shell\fR" 4 +.IX Item "--shell" +Output values suitable for 'eval' in a shell. +.RE +.RS 4 +.RE +.IP "\fBgetwindowfocus\fR [\-f]" 4 +.IX Item "getwindowfocus [-f]" +Prints the window id of the currently focused window. Saves the result to the +window stack. See \*(L"\s-1WINDOW STACK\*(R"\s0 for more details. +.Sp +If the current window has no \s-1WM_CLASS\s0 property, we assume it is not a normal +top-level window and traverse up the parents until we find a window with a +\&\s-1WM_CLASS\s0 set and return that window id. +.Sp +If you really want the window currently having focus and don't care if it has a +\&\s-1WM_CLASS\s0 setting, then use 'getwindowfocus \-f' +.IP "\fBwindowsize\fR [options] [window] width height" 4 +.IX Item "windowsize [options] [window] width height" +Set the window size of the given window. If no window is given, \f(CW%1\fR is the +default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.Sp +Percentages are valid for width and height. They are relative to the geometry +of the screen the window is on. For example, to make a window the full width of +the screen, but half height: +.Sp +.Vb 1 +\& xdotool windowsize I 100% 50% +.Ve +.Sp +Percentages are valid with \-\-usehints and still mean pixel-width relative to +the screen size. +.Sp +The options available are: +.RS 4 +.IP "\fB\-\-usehints\fR" 4 +.IX Item "--usehints" +Use window sizing hints (when available) to set width and height. This is +useful on terminals for setting the size based on row/column of text rather +than pixels. +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +After sending the window size request, wait until the window is actually +resized. If no change is necessary, we will not wait. This is useful for +scripts that depend on actions being completed before moving on. +.Sp +Note: Because many window managers may ignore or alter the original resize +request, we will wait until the size changes from its original size, not +necessary to the requested size. +.RE +.RS 4 +.Sp +Example: To set a terminal to be 80x24 characters, you would use: + xdotool windowsize \-\-usehints \fIsome_windowid\fR 80 24 +.RE +.IP "\fBwindowmove\fR \fI[options]\fR \fI[window]\fR \fIx\fR \fIy\fR" 4 +.IX Item "windowmove [options] [window] x y" +Move the window to the given position. If no window is given, \f(CW%1\fR is the +default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.Sp +If the given x coordinate is literally 'x', then the window's current x +position will be unchanged. The same applies for 'y'. +.Sp +Examples: +.Sp +.Vb 4 +\& xdotool getactivewindow windowmove 100 100 # Moves to 100,100 +\& xdotool getactivewindow windowmove x 100 # Moves to x,100 +\& xdotool getactivewindow windowmove 100 y # Moves to 100,y +\& xdotool getactivewindow windowmove 100 y # Moves to 100,y +.Ve +.Sp +Percentages are valid for width and height. They are relative to the geometry +of the screen the window is on. For example, to make a window the full width of +the screen, but half height: +.Sp +.Vb 1 +\& xdotool windowmove I 100% 50% +.Ve +.RS 4 +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +After sending the window move request, wait until the window is actually +moved. If no movement is necessary, we will not wait. This is useful for +scripts that depend on actions being completed before moving on. +.IP "\fB\-\-relative\fR" 4 +.IX Item "--relative" +Make movement relative to the current window position. +.RE +.RS 4 +.RE +.IP "\fBwindowfocus\fR \fI[options]\fR \fI[window]\fR" 4 +.IX Item "windowfocus [options] [window]" +Focus a window. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW STACK\*(R"\s0 +and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.Sp +Uses XSetInputFocus which may be ignored by some window managers or programs. +.RS 4 +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +After sending the window focus request, wait until the window is actually +focused. This is useful for scripts that depend on actions being completed +before moving on. +.RE +.RS 4 +.RE +.IP "\fBwindowmap\fR \fI[options]\fR \fI[window]\fR" 4 +.IX Item "windowmap [options] [window]" +Map a window. In X11 terminology, mapping a window means making it visible on +the screen. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and +\&\*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.RS 4 +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +After requesting the window map, wait until the window is actually mapped +(visible). This is useful for scripts that depend on actions being completed +before moving on. +.RE +.RS 4 +.RE +.IP "\fBwindowminimize\fR \fI[options]\fR \fI[window]\fR" 4 +.IX Item "windowminimize [options] [window]" +Minimize a window. In X11 terminology, this is called 'iconify.' +If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and +\&\*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.RS 4 +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +After requesting the window minimize, wait until the window is actually +minimized. This is useful for scripts that depend on actions being completed +before moving on. +.RE +.RS 4 +.RE +.IP "\fBwindowraise\fR \fI[window_id=%1]\fR" 4 +.IX Item "windowraise [window_id=%1]" +Raise the window to the top of the stack. This may not work on all window +managers. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and +\&\*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.IP "\fBwindowreparent\fR \fI[source_window]\fR \fIdestination_window\fR" 4 +.IX Item "windowreparent [source_window] destination_window" +Reparent a window. This moves the \fIsource_window\fR to be a child window of +\&\fIdestination_window\fR. If no source is given, \f(CW%1\fR is the default. +\&\*(L"\s-1WINDOW STACK\*(R"\s0 window references (like \f(CW%1\fR) are valid for both \fIsource_window\fR +and \fIdestination_window\fR See \*(L"\s-1WINDOW STACK\*(R"\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more +details. +.IP "\fBwindowclose\fR \fI[window]\fR" 4 +.IX Item "windowclose [window]" +Close a window. This action will destroy the window, but will not try +to kill the client controlling it. If no window is given, \f(CW%1\fR is the +default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.IP "\fBwindowquit\fR \fI[window]\fR" 4 +.IX Item "windowquit [window]" +Close a window gracefully. This action sends a request, allowing the +application to apply close confirmation mechanics. If no window is given, \f(CW%1\fR +is the default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.IP "\fBwindowkill\fR \fI[window]\fR" 4 +.IX Item "windowkill [window]" +Kill a window. This action will destroy the window and kill the client +controlling it. If no window is given, \f(CW%1\fR is the default. See \s-1WINDOW +STACK\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.IP "\fBwindowunmap\fR \fI[options]\fR \fI[window_id=%1]\fR" 4 +.IX Item "windowunmap [options] [window_id=%1]" +Unmap a window, making it no longer appear on your screen. If no window is +given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more +details. +.RS 4 +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +After requesting the window unmap, wait until the window is actually unmapped +(hidden). This is useful for scripts that depend on actions being completed +before moving on. +.RE +.RS 4 +.RE +.IP "\fBset_window\fR \fI[options]\fR \fI[windowid=%1]\fR" 4 +.IX Item "set_window [options] [windowid=%1]" +Set properties about a window. If no window is given, \f(CW%1\fR is the default. See +\&\*(L"\s-1WINDOW STACK\*(R"\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.Sp +Options: +.RS 4 +.IP "\fB\-\-name newname\fR" 4 +.IX Item "--name newname" +Set window \s-1WM_NAME\s0 (the window title, usually) +.IP "\fB\-\-icon\-name newiconname\fR" 4 +.IX Item "--icon-name newiconname" +Set window \s-1WM_ICON_NAME\s0 (the window title when minimized, usually) +.IP "\fB\-\-role newrole\fR" 4 +.IX Item "--role newrole" +Set window \s-1WM_WINDOW_ROLE\s0 +.IP "\fB\-\-classname newclassname\fR" 4 +.IX Item "--classname newclassname" +Set window class name (not to be confused with window class) +.IP "\fB\-\-class newclass\fR" 4 +.IX Item "--class newclass" +Set window class (not to be confused with window class name) +.IP "\fB\-\-urgency value\fR" 4 +.IX Item "--urgency value" +Set window urgency hint. If the value is 1, the window will be marked urgent, +and the window manager will somehow highlight it for the user's attention. +If the value is 0, the window will be marked non-urgent. +.IP "\fB\-\-overrideredirect value\fR" 4 +.IX Item "--overrideredirect value" +Set window's override_redirect value. This value is a hint to the window +manager for whether or not it should be managed. If the redirect value is 0, +then the window manager will draw borders and treat this window normally. If +the value is 1, the window manager will ignore this window. +.Sp +If you change this value, your window manager may not notice the change until +the window is mapped again, so you may want to issue 'windowunmap' and +\&'windowmap' to make the window manager take note. +.RE +.RS 4 +.RE +.SH "DESKTOP AND WINDOW COMMANDS" +.IX Header "DESKTOP AND WINDOW COMMANDS" +These commands follow the \s-1EWMH\s0 standard. See the section \*(L"\s-1EXTENDED WINDOW +MANAGER HINTS\*(R"\s0 for more information. +.IP "\fBwindowactivate\fR \fI[options]\fR \fI[window]\fR" 4 +.IX Item "windowactivate [options] [window]" +Activate the window. This command is different from windowfocus: +if the window is on another desktop, we will switch to that desktop. It also +uses a different method for bringing the window up. I recommend trying this +command before using windowfocus, as it will work on more window managers. +.Sp +If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and +\&\*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.RS 4 +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +After sending the window activation, wait until the window is actually +activated. This is useful for scripts that depend on actions being completed +before moving on. +.RE +.RS 4 +.RE +.IP "\fBgetactivewindow\fR" 4 +.IX Item "getactivewindow" +Output the current active window. This command is often more reliable than +getwindowfocus. The result is saved to the window stack. See \*(L"\s-1WINDOW STACK\*(R"\s0 +for more details. +.IP "\fBwindowstate\fR \fI[\-\-add \s-1PROPERTY\s0]\fR \fI[\-\-remove \s-1PROPERTY\s0]\fR \fI[\-\-toggle \s-1PROPERTY\s0]\fR \fI[window]\fR" 4 +.IX Item "windowstate [--add PROPERTY] [--remove PROPERTY] [--toggle PROPERTY] [window]" +Change a property on a window. +.Sp +Some properties may have no effect some windows or in some window managers. +.Sp +Properties can be any of: +.RS 4 +.IP "\s-1MODAL\s0 \- makes the window into a modal" 4 +.IX Item "MODAL - makes the window into a modal" +.PD 0 +.IP "\s-1STICKY\s0 \- makes the window appear on all workspaces" 4 +.IX Item "STICKY - makes the window appear on all workspaces" +.IP "\s-1MAXIMIZED_VERT\s0 \- sizes the window maximized vertically" 4 +.IX Item "MAXIMIZED_VERT - sizes the window maximized vertically" +.IP "\s-1MAXIMIZED_HORZ\s0 \- sizes the window maximized horizontally" 4 +.IX Item "MAXIMIZED_HORZ - sizes the window maximized horizontally" +.IP "\s-1ABOVE\s0 \- Show window above all others (always on top)" 4 +.IX Item "ABOVE - Show window above all others (always on top)" +.IP "\s-1BELOW\s0 \- Show window below all others" 4 +.IX Item "BELOW - Show window below all others" +.IP "\s-1SKIP_TASKBAR\s0 \- hides the window from the taskbar" 4 +.IX Item "SKIP_TASKBAR - hides the window from the taskbar" +.IP "\s-1SKIP_PAGER\s0 \- hides the window from the window pager" 4 +.IX Item "SKIP_PAGER - hides the window from the window pager" +.IP "\s-1FULLSCREEN\s0 \- makes window fullscreen" 4 +.IX Item "FULLSCREEN - makes window fullscreen" +.IP "\s-1HIDDEN\s0 \- unmaps the window" 4 +.IX Item "HIDDEN - unmaps the window" +.IP "\s-1SHADED\s0 \- rolls the window up" 4 +.IX Item "SHADED - rolls the window up" +.IP "\s-1DEMANDS_ATTENTION\s0 \- marks window urgent or needing attention" 4 +.IX Item "DEMANDS_ATTENTION - marks window urgent or needing attention" +.RE +.RS 4 +.PD +.Sp +This feature requires a window manager which supports \s-1EWMH.\s0 Most window managers +probably support this :) +.RE +.IP "\fBgetwindowclassname\fR \fI[window]\fR" 4 +.IX Item "getwindowclassname [window]" +Prints the class name for the window. +.IP "\fBset_num_desktops\fR \fInumber\fR" 4 +.IX Item "set_num_desktops number" +Changes the number of desktops or workspaces. +.IP "\fBget_num_desktops\fR" 4 +.IX Item "get_num_desktops" +Output the current number of desktops. +.IP "\fBget_desktop_viewport\fR \fI[\-\-shell]\fR" 4 +.IX Item "get_desktop_viewport [--shell]" +Report the current viewport's position. If \-\-shell is given, the output is +friendly to shell eval. +.Sp +Viewports are sometimes used instead of 'virtual desktops' on some window +managers. A viewport is simply a view on a very large desktop area. +.IP "\fBset_desktop_viewport\fR \fIx\fR \fIy\fR" 4 +.IX Item "set_desktop_viewport x y" +Move the viewport to the given position. Not all requests will be obeyed \- some +windowmangers only obey requests that align to workspace boundaries, such as +the screen size. +.Sp +For example, if your screen is 1280x800, you can move to the 2nd workspace by doing: + xdotool set_desktop_viewport 1280 0 +.IP "\fBset_desktop\fR \fI[options]\fR \fIdesktop_number\fR" 4 +.IX Item "set_desktop [options] desktop_number" +Change the current view to the specified desktop. +.RS 4 +.IP "\fB\-\-relative\fR" 4 +.IX Item "--relative" +Use relative movements instead of absolute. This lets you move relative to the +current desktop. +.RE +.RS 4 +.RE +.IP "\fBget_desktop\fR" 4 +.IX Item "get_desktop" +Output the current desktop in view. +.IP "\fBset_desktop_for_window\fR \fI[window]\fR \fIdesktop_number\fR" 4 +.IX Item "set_desktop_for_window [window] desktop_number" +Move a window to a different desktop. If no window is given, \f(CW%1\fR is the +default. See \*(L"\s-1WINDOW STACK\*(R"\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.IP "\fBget_desktop_for_window\fR \fI[window]\fR" 4 +.IX Item "get_desktop_for_window [window]" +Output the desktop currently containing the given window. Move a window to a +different desktop. If no window is given, \f(CW%1\fR is the default. See \s-1WINDOW +STACK\s0 and \*(L"\s-1COMMAND CHAINING\*(R"\s0 for more details. +.SH "MISCELLANEOUS COMMANDS" +.IX Header "MISCELLANEOUS COMMANDS" +.IP "\fBexec\fR \fI[options]\fR \fIcommand\fR \fI[...]\fR" 4 +.IX Item "exec [options] command [...]" +Execute a program. This is often useful when combined with behave_screen_edge +to do things like locking your screen. +.Sp +Options: +.RS 4 +.IP "\fB\-\-sync\fR" 4 +.IX Item "--sync" +Block until the child process exits. The child process exit status is then +passed to the parent process (xdotool) which copies it. +.RE +.RS 4 +.Sp +Examples: + # Lock the screen when the mouse sits in the top-right corner + xdotool behave_screen_edge \-\-delay 1000 top-right \e + exec gnome-screensaver-command \-\-lock + # Substitute 'xscreensaver\-command \-lock' if you use that program. +.Sp +.Vb 3 +\& # The following will fail to move the mouse because we use \*(Aq\-\-sync\*(Aq and +\& # /bin/false exits nonzero: +\& xdotool exec \-\-sync /bin/false mousemove 0 0 +\& +\& # This succeeds, though, since we do not use \-\-sync on the exec command. +\& xdotool exec /bin/false mousemove 0 0 +.Ve +.RE +.IP "\fBsleep\fR \fIseconds\fR" 4 +.IX Item "sleep seconds" +Sleep for a specified period. Fractions of seconds (like 1.3, or 0.4) are +valid, here. +.SH "SCRIPTS" +.IX Header "SCRIPTS" +xdotool can read a list of commands via stdin or a file if you want. A script +will fail when any command fails. +.PP +Truthfully, 'script' mode isn't fully fleshed out and may fall below your +expectations. If you have suggestions, please email the list or file a bug (See +\&\s-1CONTACT\s0). +.PP +Scripts can use positional arguments (Represented by \f(CW$1\fR, \f(CW$2\fR, ...) and +environment variables (like \f(CW$HOME\fR or \f(CW$WINDOWID\fR). Quoting arguments should work +as expected. +.PP +Scripts are processed for parameter and environment variable expansion and then +run as if you had invoked xdotool with the entire script on one line (using +\&\s-1COMMAND CHAINING\s0). +.IP "\(bu" 4 +Read commands from a file: +.Sp +.Vb 1 +\& xdotool filename +.Ve +.IP "\(bu" 4 +Read commands from stdin: +.Sp +.Vb 1 +\& xdotool \- +.Ve +.IP "\(bu" 4 +Read commands from a redirected file +.Sp +.Vb 1 +\& xdotool \- < myfile +.Ve +.PP +You can also write scripts that only execute xdotool. Example: +.PP +.Vb 2 +\& #!/usr/local/bin/xdotool +\& search \-\-onlyvisible \-\-classname $1 +\& +\& windowsize %@ $2 $3 +\& windowraise %@ +\& +\& windowmove %1 0 0 +\& windowmove %2 $2 0 +\& windowmove %3 0 $3 +\& windowmove %4 $2 $3 +.Ve +.PP +This script will take all windows matched by the classname query given by arg1 +($1) and sizes/moves them into a 2x2 grid with windows sized by the 2nd and 3rd +parameters. +.PP +Here's an example usage: +.PP +.Vb 1 +\& % ./myscript xterm 600 400 +.Ve +.PP +Running it like this will take 4 visible xterms, raise them, and move them into +a 2x2 tile grid with each window 600x400 pixels in size. +.SH "CLEARMODIFIERS" +.IX Header "CLEARMODIFIERS" +Any command taking the \fI\-\-clearmodifiers\fR flag will attempt to clear any +active input modifiers during the command and restore them afterwards. +.PP +For example, if you were to run this command: + xdotool key a +.PP +The result would be 'a' or 'A' depending on whether or not you were holding the +shift key on your keyboard. Often it is undesirable to have any modifiers +active, so you can tell xdotool to clear any active modifiers. +.PP +The order of operations if you hold shift while running 'xdotool key \-\-clearmodifiers a' is this: +.IP "1. Query for all active modifiers (finds shift, in this case)" 4 +.IX Item "1. Query for all active modifiers (finds shift, in this case)" +.PD 0 +.IP "2. Try to clear shift by sending 'key up' for the shift key" 4 +.IX Item "2. Try to clear shift by sending 'key up' for the shift key" +.IP "3. Runs normal 'xdotool key a'" 4 +.IX Item "3. Runs normal 'xdotool key a'" +.IP "4. Restore shift key by sending 'key down' for shift" 4 +.IX Item "4. Restore shift key by sending 'key down' for shift" +.PD +.PP +The \fI\-\-clearmodifiers\fR flag can currently clear of the following: +.IP "\(bu" 4 +any key in your active keymap that has a modifier associated with it. +(See \fBxmodmap\fR\|(1)'s 'xmodmap \-pm' output) +.IP "\(bu" 4 +mouse buttons (1, 2, 3, 4, and 5) +.IP "\(bu" 4 +caps lock +.SH "SENDEVENT NOTES" +.IX Header "SENDEVENT NOTES" +If you are trying to send key input to a specific window, and it does not +appear to be working, then it's likely your application is ignoring the events +xdotool is generating. This is fairly common. +.PP +Sending keystrokes to a specific window uses a different \s-1API\s0 than simply typing +to the active window. If you specify 'xdotool type \-\-window 12345 hello' +xdotool will generate key events and send them directly to window 12345. +However, X11 servers will set a special flag on all events generated in this +way (see XEvent.xany.send_event in X11's manual). Many programs observe this +flag and reject these events. +.PP +It is important to note that for key and mouse events, we only use +XSendEvent when a specific window is targeted. Otherwise, we use \s-1XTEST\s0. +.PP +Some programs can be configured to accept events even if they are generated by +xdotool. Seek the documentation of your application for help. +.PP +Specific application notes (from the author's testing): +* Firefox 3 seems to ignore all input when it does not have focus. +* xterm can be configured while running with ctrl+leftclick, 'Allow SendEvents' +* gnome-terminal appears to accept generated input by default. +.SH "WINDOW STACK" +.IX Header "WINDOW STACK" +Certain commands (search, getactivewindow, getwindowfocus) will find windows +for you. These results generally printed to stdout, but they are also saved +to memory for future use during the lifetime of the xdotool process. See +\&\*(L"\s-1COMMAND CHAINING\*(R"\s0 for more information. +.PP +The only modifications support for the window stack are to replace it. That is, +two of two sequential searches, only the last one's results will be the window +stack. +.SH "COMMAND CHAINING" +.IX Header "COMMAND CHAINING" +xdotool supports running multiple commands on a single invocation. Generally, +you'll start with a search command (see \*(L"\s-1WINDOW STACK\*(R"\s0) and then perform a +set of actions on those results. +.PP +To query the window stack, you can use special notation \*(L"%N\*(R" where N is a +number or the '@' symbol. If \f(CW%N\fR is given, the Nth window will be selected from +the window stack. Generally you will only want the first window or all windows. +Note that the order of windows in the window stack corresponds to the window +stacking order, i.e. the bottom-most window will be reported first (see +\&\fBXQueryTree\fR\|(3)). Thus the order of the windows in the window stack may not be +consistent across invocations. +.PP +The notation described above is used as the \*(L"window\*(R" argument for any given +command. +.PP +For example, to resize all xterms to 80x24: +.PP +.Vb 1 +\& xdotool search \-\-class xterm \-\- windowsize \-\-usehints %@ 80 24 +.Ve +.PP +Resize move the current window: +.PP +.Vb 1 +\& xdotool getactivewindow windowmove 0 0 +.Ve +.PP +In all cases, the default window argument, if omitted, will default to \*(L"%1\*(R". It is +obviously an error if you omit the window argument and the window stack is empty. If you +try to use the window stack and it is empty, it is also an error. +.PP +To activate the first firefox window found: +.PP +.Vb 1 +\& xdotool search \-\-class firefox windowactivate +.Ve +.PP +These would error: +.PP +.Vb 3 +\& xdotool windowactivate +\& xdotool windowactivate %1 +\& xdotool windowactivate %@ +.Ve +.PP +When xdotool exits, the current window stack is lost. +.PP +Additionally, commands that modify the \*(L"\s-1WINDOW STACK\*(R"\s0 will not print the +results if they are not the last command. For example: +.PP +.Vb 3 +\& # Output the active window: +\& % xdotool getactivewindow +\& 20971533 +\& +\& # Output the pid of the active window, but not the active window id: +\& % xdotool getactivewindow getwindowpid +\& 4686 +.Ve +.SH "EXTENDED WINDOW MANAGER HINTS" +.IX Header "EXTENDED WINDOW MANAGER HINTS" +The following pieces of the \s-1EWMH\s0 standard are supported: +.IP "_NET_SUPPORTED" 4 +.IX Item "_NET_SUPPORTED" +Asks the window manager what is supported +.IP "_NET_CURRENT_DESKTOP" 4 +.IX Item "_NET_CURRENT_DESKTOP" +Query and set the current desktop. Support for this enables these commands: +\&\f(CW\*(C`set_desktop\*(C'\fR, \f(CW\*(C`get_desktop\*(C'\fR. +.IP "_NET_WM_DESKTOP" 4 +.IX Item "_NET_WM_DESKTOP" +Query and set what desktop a window is living in. Support for this enables +these commands: \f(CW\*(C`set_desktop_for_window\*(C'\fR, \f(CW\*(C`get_desktop_for_window\*(C'\fR. +.IP "_NET_ACTIVE_WINDOW" 4 +.IX Item "_NET_ACTIVE_WINDOW" +Allows you to query and set the active window by asking the window manager to +bring it forward. Support for this enables these commands: \f(CW\*(C`windowactivate\*(C'\fR, \f(CW\*(C`getactivewindow\*(C'\fR. +.IP "_NET_WM_PID" 4 +.IX Item "_NET_WM_PID" +This feature is application dependent, not window-manager dependent. Query the +\&\s-1PID\s0 owning a given window. Support for this enables these commands: +\&\f(CW\*(C`getwindowpid\*(C'\fR. +.SH "SUPPORTED FEATURES" +.IX Header "SUPPORTED FEATURES" +xdotool (and libxdo) will try to function under all circumstances. However, there may +be some cases where functionality is not provided by your X server or by your +window manager. In these cases, xdotool will try to detect and tell you if an action +requires a feature not currently supported by your system. +.PP +For window-manager specific features, see \*(L"\s-1EXTENDED WINDOW MANAGER HINTS\*(R"\s0. +.IP "\s-1XTEST\s0" 4 +.IX Item "XTEST" +If your X server does not support \s-1XTEST,\s0 then some typing and mouse movement +features may not work. Specifically, typing and mouse actions that act on the +\&\*(L"current window\*(R" (window 0 in libxdo) are unlikely to work. +.Sp +In most cases, \s-1XTEST\s0 is a feature you can enable on your X server if it is +not enabled by default. +.Sp +You can see the list of supported X extensions by typing 'xdpyinfo' and looking +the text 'number of extensions: ...' +.SH "BUGS" +.IX Header "BUGS" +Typing unusual symbols under non-us keybindings is known to +occasionally send the wrong character. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\fBxprop\fR\|(1), \fBxwininfo\fR\|(1), +.PP +Project site: +.PP +Source code and Issues: +.PP +\&\s-1EWMH\s0 specification: +.SH "CONTACT" +.IX Header "CONTACT" +Please send questions to xdotool\-users@googlegroups.com. File bugs and feature requests at the following \s-1URL:\s0 +.PP + +.PP +Alternately, if you prefer email, feel free to file bugs by emailing the list. +What works for you :) +.SH "AUTHOR" +.IX Header "AUTHOR" +xdotool was written by Jordan Sissel. +.PP +This manual page was written originally by Daniel Kahn Gillmor + for the Debian project (but may be +used by others). It is maintained by Jordan Sissel. +.PP +Patches, ideas, and other contributions by many, nice folks. See the \s-1CHANGELIST\s0 +file for who provided what.