=item mkdir FILENAME
+=item mkdir
+
Creates the directory specified by FILENAME, with permissions
specified by MASK (as modified by C<umask>). If it succeeds it
returns true, otherwise it returns false and sets C<$!> (errno).
-If omitted, MASK defaults to 0777.
+If omitted, MASK defaults to 0777. If omitted, FILENAME defaults
+to C<$_>.
In general, it is better to create directories with permissive MASK,
and let the user modify that with their C<umask>, than it is to supply
}
}
-See L<perliol/> for detailed info on PerlIO.
+See L<perliol> for detailed info on PerlIO.
You may also, in the Bourne shell tradition, specify an EXPR beginning
with C<< '>&' >>, in which case the rest of the string is interpreted
U A Unicode character number. Encodes to UTF-8 internally
(or UTF-EBCDIC in EBCDIC platforms).
- w A BER compressed integer. Its bytes represent an unsigned
- integer in base 128, most significant digit first, with as
- few digits as possible. Bit eight (the high bit) is set
- on each byte except the last.
+ w A BER compressed integer (not an ASN.1 BER, see perlpacktut for
+ details). Its bytes represent an unsigned integer in base 128,
+ most significant digit first, with as few digits as possible. Bit
+ eight (the high bit) is set on each byte except the last.
x A null byte.
X Back up a byte.
- @ Null fill to absolute position, counted from the start of
- the innermost ()-group.
+ @ Null fill or truncate to absolute position, counted from the
+ start of the innermost ()-group.
+ . Null fill or truncate to absolute position specified by value.
( Start of a ()-group.
Some letters in the TEMPLATE may optionally be followed by one or
nNvV Treat integers as signed instead of unsigned.
+ @. Specify position as byte offset in the internal
+ representation of the packed string. Efficient but
+ dangerous.
+
> sSiIlLqQ Force big-endian byte-order on the type.
jJfFdDpP (The "big end" touches the construct.)
Each letter may optionally be followed by a number giving a repeat
count. With all types except C<a>, C<A>, C<Z>, C<b>, C<B>, C<h>,
-C<H>, C<@>, C<x>, C<X> and C<P> the pack function will gobble up that
-many values from the LIST. A C<*> for the repeat count means to use
-however many items are left, except for C<@>, C<x>, C<X>, where it is
-equivalent to C<0>, and C<u>, where it is equivalent to 1 (or 45, what
-is the same). A numeric repeat count may optionally be enclosed in
-brackets, as in C<pack 'C[80]', @arr>.
+C<H>, C<@>, C<.>, C<x>, C<X> and C<P> the pack function will gobble up
+that many values from the LIST. A C<*> for the repeat count means to
+use however many items are left, except for C<@>, C<x>, C<X>, where it
+is equivalent to C<0>, for <.> where it means relative to string start
+and C<u>, where it is equivalent to 1 (or 45, which is the same).
+A numeric repeat count may optionally be enclosed in brackets, as in
+C<pack 'C[80]', @arr>.
One can replace the numeric repeat count by a template enclosed in brackets;
then the packed length of this template in bytes is used as a count.
byte (so the packed result will be one longer than the byte C<length>
of the item).
+When used with C<@>, the repeat count represents an offset from the start
+of the innermost () group.
+
+When used with C<.>, the repeat count is used to determine the starting
+position from where the value offset is calculated. If the repeat count
+is 0, it's relative to the current position. If the repeat count is C<*>,
+the offset is relative to the start of the packed string. And if its an
+integer C<n> the offset is relative to the start of the n-th innermost
+() group (or the start of the string if C<n> is bigger then the group
+level).
+
The repeat count for C<u> is interpreted as the maximal number of bytes
to encode per line of output, with 0, 1 and 2 replaced by 45. The repeat
count should not be more than 65.
is the string "\0a\0\0bc".
-
=item *
C<x> and C<X> accept C<!> modifier. In this case they act as
$bar = pack('s@4l', 12, 34);
# short 12, zero fill to position 4, long 34
# $foo eq $bar
+ $baz = pack('s.l', 12, 4, 34);
+ # short 12, zero fill to position 4, long 34
$foo = pack('nN', 42, 4711);
# pack big-endian 16- and 32-bit unsigned integers
behind the scenes. Before C<require> looks for a "F<.pm>" extension,
it will first look for a filename with a "F<.pmc>" extension. A file
with this extension is assumed to be Perl bytecode generated by
-L<B::Bytecode|B::Bytecode>. If this file is found, and it's modification
+L<B::Bytecode|B::Bytecode>. If this file is found, and its modification
time is newer than a coinciding "F<.pm>" non-compiled file, it will be
loaded in place of that non-compiled file ending in a "F<.pm>" extension.
is implementation-dependent. See also L<perlport> for notes on the
portability of C<select>.
+On error, C<select> returns C<undef> and sets C<$!>.
+
+Note: on some Unixes, the select(2) system call may report a socket file
+descriptor as "ready for reading", when actually no data is available,
+thus a subsequent read blocks. It can be avoided using always the
+O_NONBLOCK flag on the socket. See select(2) and fcntl(2) for further
+details.
+
B<WARNING>: One should not attempt to mix buffered I/O (like C<read>
or <FH>) with C<select>, except as permitted by POSIX, and even
then only on POSIX systems. You have to use C<sysread> instead.