From: Ivan Tubert-Brohman Date: Wed, 12 Oct 2005 19:20:18 +0000 (-0400) Subject: POD index entries with X<> X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d74e8afc9309529cf5c6c4390fc311850865d506;p=p5sagit%2Fp5-mst-13.2.git POD index entries with X<> Message-ID: <434D9A32.4050305@cpan.org> p4raw-id: //depot/perl@25748 --- diff --git a/pod/perldata.pod b/pod/perldata.pod index d828d4a..82ad855 100644 --- a/pod/perldata.pod +++ b/pod/perldata.pod @@ -5,6 +5,7 @@ perldata - Perl data types =head1 DESCRIPTION =head2 Variable names +X X X X Perl has three built-in data types: scalars, arrays of scalars, and associative arrays of scalars, known as "hashes". A scalar is a @@ -27,6 +28,7 @@ to locate the namespace in which to look up the final identifier for a simple identifier, an expression that produces a reference to the value at runtime. This is described in more detail below and in L. +X Perl also has its own built-in variables whose names don't follow these rules. They have strange names so they don't accidentally @@ -36,11 +38,13 @@ containing only digits after the C<$> (see L and L). In addition, several special variables that provide windows into the inner working of Perl have names containing punctuation characters and control characters. These are documented in L. +X 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 "the" in that it indicates a single value is expected. +X $days # the simple scalar value "days" $days[28] # the 29th element of array @days @@ -50,12 +54,14 @@ single value is expected. Entire arrays (and slices of arrays and hashes) are denoted by '@', which works much like the word "these" or "those" does in English, in that it indicates multiple values are expected. +X @days # ($days[0], $days[1],... $days[n]) @days[3,4,5] # same as ($days[3],$days[4],$days[5]) @days{'a','c'} # same as ($days{'a'},$days{'c'}) Entire hashes are denoted by '%': +X %days # (key1, val1, key2, val2 ...) @@ -72,6 +78,7 @@ subroutine name, a format name, or a label. This means that $foo and @foo are two different variables. It also means that C<$foo[1]> is a part of @foo, not a part of $foo. This may seem a bit weird, but that's okay, because it is weird. +X Because variable references always start with '$', '@', or '%', the "reserved" words aren't in fact reserved with respect to variable @@ -83,6 +90,8 @@ uppercase filehandles also improves readability and protects you from conflict with future reserved words. Case I significant--"FOO", "Foo", and "foo" are all different names. Names that start with a letter or underscore may also contain digits and underscores. +X +X It is possible to replace such an alphanumeric name with an expression that returns a reference to the appropriate type. For a description @@ -96,6 +105,7 @@ significance to Perl. For instance, C<$$> is the current process id.) =head2 Context +X X X The interpretation of operations and values in Perl sometimes depends on the requirements of the context around the operation or value. @@ -148,6 +158,7 @@ for how you would dynamically discern your function's calling context. =head2 Scalar values +X X X X 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 @@ -172,6 +183,7 @@ A scalar value is interpreted as TRUE in the Boolean sense if it is not the null string or the number 0 (or its string equivalent, "0"). The Boolean context is just a special kind of scalar context where no conversion to a string or a number is ever performed. +X X X X X There are actually two varieties of null strings (sometimes referred to as "empty" strings), a defined one and an undefined one. The @@ -186,6 +198,7 @@ rare cases of autovivification as explained in L. You can use the defined() operator to determine whether a scalar value is defined (this has no meaning on arrays or hashes), and the undef() operator to produce an undefined value. +X X X X X 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 @@ -220,6 +233,7 @@ Shortening an array this way destroys intervening values. Lengthening an array that was previously shortened does not recover values that were in those elements. (It used to do so in Perl 4, but we had to break this to make sure destructors were called when expected.) +X<$#> X 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 @@ -235,6 +249,7 @@ 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: +X scalar(@whatever) == $#whatever - $[ + 1; @@ -242,6 +257,7 @@ Version 5 of Perl changed the semantics of C<$[>: files that don't set the value of C<$[> no longer need to worry about whether another file changed its value. (In other words, use of C<$[> is deprecated.) So in general you can assume that +X<$[> scalar(@whatever) == $#whatever + 1; @@ -262,6 +278,7 @@ of sixteen buckets has been touched, and presumably contains all 10,000 of your items. This isn't supposed to happen. If a tied hash is evaluated in scalar context, a fatal error will result, since this bucket usage information is currently not available for tied hashes. +X X X You can preallocate space for a hash by assigning to the keys() function. This rounds up the allocated buckets to the next power of two: @@ -269,6 +286,7 @@ This rounds up the allocated buckets to the next power of two: keys(%users) = 1000; # allocate 1024 buckets =head2 Scalar value constructors +X X Numeric literals are specified in any of the following floating point or integer formats: @@ -287,6 +305,7 @@ You are allowed to use underscores (underbars) in numeric literals between digits for legibility. 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. +X String literals are usually delimited by either single or double quotes. They work much like quotes in the standard Unix shells: @@ -295,6 +314,7 @@ substitution; single-quoted strings are not (except for C<\'> and C<\\>). The usual C-style backslash rules apply for making characters such as newline, tab, etc., as well as some more exotic forms. See L for a list. +X Hexadecimal, octal, or binary, representations in string literals (e.g. '0xff') are not automatically converted to their integer @@ -310,6 +330,7 @@ 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 "The price is $Z<>100." +X $Price = '$100'; # not interpolated print "The price is $Price.\n"; # interpolated @@ -322,6 +343,7 @@ 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: +X $who = "Larry"; print PASSWD "${who}::0:0:Superuser:/:/bin/perl\n"; @@ -341,6 +363,7 @@ expression. This means for example that C<$version{2.0}++> is equivalent to C<$version{2}++>, not to C<$version{'2.0'}++>. =head3 Version Strings +X X X B Version Strings (v-strings) have been deprecated. They will be removed in some future release after Perl 5.8.1. The marginal @@ -375,6 +398,8 @@ Multi-number v-strings like C and C<65.66.67> continue to be v-strings always. =head3 Special Literals +X X<__END__> X<__DATA__> X X +X X X<^D> X<^Z> The special literals __FILE__, __LINE__, and __PACKAGE__ represent the current filename, line number, and package name at that @@ -382,6 +407,7 @@ point in your program. 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 C directive), __PACKAGE__ is the undefined value. +X<__FILE__> X<__LINE__> X<__PACKAGE__> X X X 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 @@ -404,6 +430,7 @@ as it is seen (during compilation), at which point the corresponding __DATA__ (or __END__) token has not yet been seen. =head3 Barewords +X A word that has no other interpretation in the grammar will be treated as if it were a quoted string. These are known as @@ -422,6 +449,7 @@ end of the enclosing block. An inner block may countermand this by saying C. =head3 Array Joining Delimiter +X X X<$"> Arrays and slices are interpolated into double-quoted strings by joining the elements with the delimiter specified in the C<$"> @@ -448,6 +476,7 @@ which used to be here, that's been moved to L. =head2 List value constructors +X List values are denoted by separating individual values by commas (and enclosing the list in parentheses where precedence requires it): @@ -660,6 +689,7 @@ are used. For example: print "Darwin's First Name is ", $scientists{"Darwin"}, "\n"; =head2 Slices +X X X A common way to access an array or a hash is one scalar element at a time. You can also subscript a list to get a single element from it. @@ -736,6 +766,7 @@ hash indicates whether you are getting back a singular value (a scalar) or a plural one (a list). =head2 Typeglobs and Filehandles +X X X<*> Perl uses an internal type called a I to hold an entire symbol table entry. The type prefix of a typeglob is a C<*>, because diff --git a/pod/perldebug.pod b/pod/perldebug.pod index 91b72ff..2e21941 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -1,4 +1,5 @@ =head1 NAME +X X perldebug - Perl debugging @@ -19,6 +20,7 @@ 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: +X<-d> $ perl -d -e 42 @@ -59,6 +61,7 @@ The debugger understands the following commands: =over 12 =item h +X Prints out a summary help message @@ -80,6 +83,7 @@ You may change the pager which is used via C command. =item p expr +X Same as C in the current package. In particular, because this is just Perl's own C function, this means that nested @@ -89,6 +93,7 @@ The C filehandle is opened to F, regardless of where STDOUT may be redirected to. =item x [maxdepth] expr +X Evaluates its expression in list context and dumps out the result in a pretty-printed fashion. Nested data structures are printed out @@ -104,6 +109,7 @@ dumped only I levels deep, as if the C option had been temporarily set to I. =item V [pkg [vars]] +X Display all (or some) variables in package (defaulting to C
) using a data pretty-printer (hashes show their keys and values so @@ -118,10 +124,12 @@ Use C<~pattern> and C for positive and negative regexes. This is similar to calling the C command on each applicable var. =item X [vars] +X Same as C. =item y [level [vars]] +X Display all (or some) lexical variables (mnemonic: C variables) in the current scope or I scopes higher. You can limit the @@ -132,16 +140,19 @@ is pretty-printed in the same style as for C and the format is controlled by the same options. =item T +X X X Produce a stack backtrace. See below for details on its output. =item s [expr] +X X 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. =item n [expr] +X Next. Executes over subroutine calls, until the beginning of the next statement. If an expression is supplied that includes @@ -149,6 +160,7 @@ function calls, those functions will be executed with stops before each statement. =item r +X Continue until the return from the current subroutine. Dump the return value if the C option is set (default). @@ -158,11 +170,13 @@ Dump the return value if the C option is set (default). Repeat last C or C command. =item c [line|sub] +X Continue, optionally inserting a one-time-only breakpoint at the specified line or subroutine. =item l +X List next window of lines. @@ -184,19 +198,23 @@ List first window of lines from subroutine. I may be a variable that contains a code reference. =item - +X List previous window of lines. =item v [line] +X View a few lines of code around the current line. =item . +X Return the internal debugger pointer to the line last executed, and print out that line. =item f filename +X Switch to viewing a different file or C statement. If I is not a full pathname found in the values of %INC, it is considered @@ -219,27 +237,35 @@ Search backwards for pattern; final ? is optional. The search is case-insensitive by default. =item L [abw] +X List (default all) actions, breakpoints and watch expressions =item S [[!]regex] +X List subroutine names [not] matching the regex. =item t +X Toggle trace mode (see also the C option). =item t expr +X Trace through execution of C. See L for examples. =item b +X +X Sets breakpoint on current line =item b [line] [condition] +X +X Set a breakpoint before the given line. If a condition is specified, it's evaluated each time the statement is reached: a @@ -252,34 +278,47 @@ don't use C: b 33 /pattern/i =item b subname [condition] +X +X Set a breakpoint before the first line of the named subroutine. I may be a variable containing a code reference (in this case I is not supported). =item b postpone subname [condition] +X +X Set a breakpoint at first line of subroutine after it is compiled. =item b load filename +X +X Set a breakpoint before the first executed line of the I, which should be a full pathname found amongst the %INC values. =item b compile subname +X +X Sets a breakpoint before the first statement executed after the specified subroutine is compiled. =item B line +X +X Delete a breakpoint from the specified I. =item B * +X +X Delete all installed breakpoints. =item a [line] command +X Set an action to be done before the line is executed. If I is omitted, set an action on the line about to be executed. @@ -297,39 +336,48 @@ For example, this will print out $foo every time line a 53 print "DB FOUND $foo\n" =item A line +X Delete an action from the specified line. =item A * +X Delete all installed actions. =item w expr +X Add a global watch-expression. We hope you know what one of these is, because they're supposed to be obvious. =item W expr +X Delete watch-expression =item W * +X Delete all watch-expressions. =item o +X Display all options =item o booloption ... +X Set each listed Boolean option to the value C<1>. =item o anyoption? ... +X Print out the value of one or more options. =item o option=value ... +X Set the value of one or more options. If the value has internal whitespace, it should be quoted. For example, you could set C for a list of these. =item < ? +X<< debugger command, < >> List out all pre-prompt Perl command actions. =item < [ command ] +X<< debugger command, < >> Set an action (Perl command) to happen before every debugger prompt. A multi-line command may be entered by backslashing the newlines. =item < * +X<< debugger command, < >> Delete all pre-prompt Perl command actions. =item << command +X<< debugger command, << >> Add an action (Perl command) to happen before every debugger prompt. A multi-line command may be entered by backwhacking the newlines. =item > ? +X<< debugger command, > >> List out post-prompt Perl command actions. =item > command +X<< debugger 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 @@ -379,16 +433,19 @@ command may be entered by backslashing the newlines (we bet you couldn't've guessed this by now). =item > * +X<< debugger command, > >> Delete all post-prompt Perl command actions. =item >> command +X<<< debugger 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. =item { ? +X List out pre-prompt debugger commands. @@ -403,28 +460,34 @@ what you mean to do, write it as with C<;{ ... }> or even C. =item { * +X Delete all pre-prompt debugger commands. =item {{ command +X 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. =item ! number +X Redo a previous command (defaults to the previous command). =item ! -number +X Redo number'th previous command. =item ! pattern +X Redo last command that started with pattern. See C, too. =item !! cmd +X Run cmd in a subprocess (reads from DB::IN, writes to DB::OUT) See C, also. Note that the user's current shell (well, @@ -433,16 +496,20 @@ with proper interpretation of exit status or signal and coredump information. =item source file +X Read and execute debugger commands from I. I may itself contain C commands. =item H -number +X Display last n commands. Only commands longer than one character are listed. If I is omitted, list them all. =item q or ^D +X +X Quit. ("quit" doesn't work for this, unless you've made an alias) This is the only supported way to exit the debugger, though typing @@ -453,6 +520,7 @@ off the end the script. You may also need to set $finished to 0 if you want to step through global destruction. =item R +X Restart the debugger by Cing a new session. We try to maintain your history across this, but internal settings and command-line options @@ -463,14 +531,17 @@ actions, debugger options, and the Perl command-line options B<-w>, B<-I>, and B<-e>. =item |dbcmd +X Run the debugger command, piping DB::OUT into your current pager. =item ||dbcmd +X Same as C<|dbcmd> but DB::OUT is temporarily C X X C, C, C, C, C, C, C, C, C, C, C, C, C, C, @@ -133,6 +143,7 @@ C, C C, C, C, C, C, C, C =item Functions for filehandles, files, or directories +X X X X X X C<-I>, C, C, C, C, C, C, C, C, C, C, C, C, @@ -140,6 +151,7 @@ C, C, C, C, C, C, C, C, C =item Keywords related to the control flow of your Perl program +X C, C, C, C, C, C, C, C, C, C, C, C, C, C @@ -154,38 +166,45 @@ C, C, C, C, C, C, C, C, C, C, C =item Functions for processes and process groups +X X X C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C =item Keywords related to perl modules +X C, C, C, C, C, C =item Keywords related to classes and object-orientedness +X X X C, C, C, C, C, C, C, C, C =item Low-level socket functions +X X C, C, C, C, C, C, C, C, C, C, C, C, C =item System V interprocess communication functions +X X X X X X C, C, C, C, C, C, C, C, C, C, C =item Fetching user and group info +X X X X X X X C, C, C, C, C, C, C, C, C, C, C, C, C =item Fetching network info +X X X X X X
X C, C, C, C, C, C, C, C, @@ -194,10 +213,12 @@ C, C, C, C, C, C, C =item Time-related functions +X