POD2-RU

 view release on metacpan or  search on metacpan

lib/POD2/RU/perlfunc.pod  view on Meta::CPAN


=item Keywords related to classes and object-orientation
X<object> X<class> X<package>

=for Pod::Functions =Objects

C<bless>, C<dbmclose>, C<dbmopen>, C<package>, C<ref>, C<tie>, C<tied>,
C<untie>, C<use>

=item Low-level socket functions
X<socket> X<sock>

=for Pod::Functions =Socket

C<accept>, C<bind>, C<connect>, C<getpeername>, C<getsockname>,
C<getsockopt>, C<listen>, C<recv>, C<send>, C<setsockopt>, C<shutdown>,
C<socket>, C<socketpair>

=item System V interprocess communication functions
X<IPC> X<System V> X<semaphore> X<shared memory> X<memory> X<message>

=for Pod::Functions =SysV

C<msgctl>, C<msgget>, C<msgrcv>, C<msgsnd>, C<semctl>, C<semget>, C<semop>,
C<shmctl>, C<shmget>, C<shmread>, C<shmwrite>

=item Fetching user and group info
X<user> X<group> X<password> X<uid> X<gid>  X<passwd> X</etc/passwd>

=for Pod::Functions =User

C<endgrent>, C<endhostent>, C<endnetent>, C<endpwent>, C<getgrent>,
C<getgrgid>, C<getgrnam>, C<getlogin>, C<getpwent>, C<getpwnam>,
C<getpwuid>, C<setgrent>, C<setpwent>

=item Fetching network info
X<network> X<protocol> X<host> X<hostname> X<IP> X<address> X<service>

=for Pod::Functions =Network

C<endprotoent>, C<endservent>, C<gethostbyaddr>, C<gethostbyname>,
C<gethostent>, C<getnetbyaddr>, C<getnetbyname>, C<getnetent>,
C<getprotobyname>, C<getprotobynumber>, C<getprotoent>,
C<getservbyname>, C<getservbyport>, C<getservent>, C<sethostent>,
C<setnetent>, C<setprotoent>, C<setservent>

=item Time-related functions
X<time> X<date>

=for Pod::Functions =Time

C<gmtime>, C<localtime>, C<time>, C<times>

=item Non-function keywords

=for Pod::Functions =!Non-functions

C<and>, C<AUTOLOAD>, C<BEGIN>, C<CHECK>, C<cmp>, C<CORE>, C<__DATA__>,
C<default>, C<DESTROY>, C<else>, C<elseif>, C<elsif>, C<END>, C<__END__>,
C<eq>, C<for>, C<foreach>, C<ge>, C<given>, C<gt>, C<if>, C<INIT>, C<le>,
C<lt>, C<ne>, C<not>, C<or>, C<UNITCHECK>, C<unless>, C<until>, C<when>,
C<while>, C<x>, C<xor>

=back

=head2 Portability
X<portability> X<Unix> X<portable>

Perl was born in Unix and can therefore access all common Unix
system calls.  In non-Unix environments, the functionality of some
Unix system calls may not be available or details of the available
functionality may differ slightly.  The Perl functions affected
by this are:

C<-X>, C<binmode>, C<chmod>, C<chown>, C<chroot>, C<crypt>,
C<dbmclose>, C<dbmopen>, C<dump>, C<endgrent>, C<endhostent>,
C<endnetent>, C<endprotoent>, C<endpwent>, C<endservent>, C<exec>,
C<fcntl>, C<flock>, C<fork>, C<getgrent>, C<getgrgid>, C<gethostbyname>,
C<gethostent>, C<getlogin>, C<getnetbyaddr>, C<getnetbyname>, C<getnetent>,
C<getppid>, C<getpgrp>, C<getpriority>, C<getprotobynumber>,
C<getprotoent>, C<getpwent>, C<getpwnam>, C<getpwuid>,
C<getservbyport>, C<getservent>, C<getsockopt>, C<glob>, C<ioctl>,
C<kill>, C<link>, C<lstat>, C<msgctl>, C<msgget>, C<msgrcv>,
C<msgsnd>, C<open>, C<pipe>, C<readlink>, C<rename>, C<select>, C<semctl>,
C<semget>, C<semop>, C<setgrent>, C<sethostent>, C<setnetent>,
C<setpgrp>, C<setpriority>, C<setprotoent>, C<setpwent>,
C<setservent>, C<setsockopt>, C<shmctl>, C<shmget>, C<shmread>,
C<shmwrite>, C<socket>, C<socketpair>,
C<stat>, C<symlink>, C<syscall>, C<sysopen>, C<system>,
C<times>, C<truncate>, C<umask>, C<unlink>,
C<utime>, C<wait>, C<waitpid>

For more information about the portability of these functions, see
L<perlport> and other available platform-specific documentation.

=head2 Alphabetical Listing of Perl Functions

=over 

=item -X FILEHANDLE
X<-r>X<-w>X<-x>X<-o>X<-R>X<-W>X<-X>X<-O>X<-e>X<-z>X<-s>X<-f>X<-d>X<-l>X<-p>
X<-S>X<-b>X<-c>X<-t>X<-u>X<-g>X<-k>X<-T>X<-B>X<-M>X<-A>X<-C>

=item -X EXPR

=item -X DIRHANDLE

=item -X

=for Pod::Functions a file test (-r, -x, etc)

A file test, where X is one of the letters listed below.  This unary
operator takes one argument, either a filename, a filehandle, or a dirhandle, 
and tests the associated file to see if something is true about it.  If the
argument is omitted, tests C<$_>, except for C<-t>, which tests STDIN.
Unless otherwise documented, it returns C<1> for true and C<''> for false, or
the undefined value if the file doesn't exist.  Despite the funny
names, precedence is the same as any other named unary operator.  The
operator may be any of:

    -r  File is readable by effective uid/gid.

lib/POD2/RU/perlfunc.pod  view on Meta::CPAN

pragma: in that case pretty much any characters can be sent.

=item setpgrp PID,PGRP
X<setpgrp> X<group>

=for Pod::Functions set the process group of a process

Sets the current process group for the specified PID, C<0> for the current
process.  Raises an exception when used on a machine that doesn't
implement POSIX setpgid(2) or BSD setpgrp(2).  If the arguments are omitted,
it defaults to C<0,0>.  Note that the BSD 4.2 version of C<setpgrp> does not
accept any arguments, so only C<setpgrp(0,0)> is portable.  See also
C<POSIX::setsid()>.

Portability issues: L<perlport/setpgrp>.

=item setpriority WHICH,WHO,PRIORITY
X<setpriority> X<priority> X<nice> X<renice>

=for Pod::Functions set a process's nice value

Sets the current priority for a process, a process group, or a user.
(See setpriority(2).)  Raises an exception when used on a machine
that doesn't implement setpriority(2).

Portability issues: L<perlport/setpriority>.

=item setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL
X<setsockopt>

=for Pod::Functions set some socket options

Sets the socket option requested.  Returns C<undef> on error.
Use integer constants provided by the C<Socket> module for
LEVEL and OPNAME.  Values for LEVEL can also be obtained from
getprotobyname.  OPTVAL might either be a packed string or an integer.
An integer OPTVAL is shorthand for pack("i", OPTVAL).

An example disabling Nagle's algorithm on a socket:

    use Socket qw(IPPROTO_TCP TCP_NODELAY);
    setsockopt($socket, IPPROTO_TCP, TCP_NODELAY, 1);

Portability issues: L<perlport/setsockopt>.

=item shift ARRAY
X<shift>

=item shift EXPR

=item shift

=for Pod::Functions remove the first element of an array, and return it

Shifts the first value of the array off and returns it, shortening the
array by 1 and moving everything down.  If there are no elements in the
array, returns the undefined value.  If ARRAY is omitted, shifts the
C<@_> array within the lexical scope of subroutines and formats, and the
C<@ARGV> array outside a subroutine and also within the lexical scopes
established by the C<eval STRING>, C<BEGIN {}>, C<INIT {}>, C<CHECK {}>,
C<UNITCHECK {}>, and C<END {}> constructs.

Starting with Perl 5.14, C<shift> can take a scalar EXPR, which must hold a
reference to an unblessed array.  The argument will be dereferenced
automatically.  This aspect of C<shift> is considered highly experimental.
The exact behaviour may change in a future version of Perl.

To avoid confusing would-be users of your code who are running earlier
versions of Perl with mysterious syntax errors, put this sort of thing at
the top of your file to signal that your code will work I<only> on Perls of
a recent vintage:

    use 5.014;	# so push/pop/etc work on scalars (experimental)

See also C<unshift>, C<push>, and C<pop>.  C<shift> and C<unshift> do the
same thing to the left end of an array that C<pop> and C<push> do to the
right end.

=item shmctl ID,CMD,ARG
X<shmctl>

=for Pod::Functions SysV shared memory operations

Calls the System V IPC function shmctl.  You'll probably have to say

    use IPC::SysV;

first to get the correct constant definitions.  If CMD is C<IPC_STAT>,
then ARG must be a variable that will hold the returned C<shmid_ds>
structure.  Returns like ioctl: C<undef> for error; "C<0> but
true" for zero; and the actual return value otherwise.
See also L<perlipc/"SysV IPC"> and C<IPC::SysV> documentation.

Portability issues: L<perlport/shmctl>.

=item shmget KEY,SIZE,FLAGS
X<shmget>

=for Pod::Functions get SysV shared memory segment identifier

Calls the System V IPC function shmget.  Returns the shared memory
segment id, or C<undef> on error.
See also L<perlipc/"SysV IPC"> and C<IPC::SysV> documentation.

Portability issues: L<perlport/shmget>.

=item shmread ID,VAR,POS,SIZE
X<shmread>
X<shmwrite>

=for Pod::Functions read SysV shared memory

=item shmwrite ID,STRING,POS,SIZE

=for Pod::Functions write SysV shared memory

Reads or writes the System V shared memory segment ID starting at
position POS for size SIZE by attaching to it, copying in/out, and
detaching from it.  When reading, VAR must be a variable that will
hold the data read.  When writing, if STRING is too long, only SIZE
bytes are used; if STRING is too short, nulls are written to fill out

lib/POD2/RU/perlfunc.pod  view on Meta::CPAN

X<wait>

=for Pod::Functions wait for any child process to die

Behaves like wait(2) on your system: it waits for a child
process to terminate and returns the pid of the deceased process, or
C<-1> if there are no child processes.  The status is returned in C<$?>
and C<${^CHILD_ERROR_NATIVE}>.
Note that a return value of C<-1> could mean that child processes are
being automatically reaped, as described in L<perlipc>.

If you use wait in your handler for $SIG{CHLD} it may accidentally for the
child created by qx() or system().  See L<perlipc> for details.

Portability issues: L<perlport/wait>.

=item waitpid PID,FLAGS
X<waitpid>

=for Pod::Functions wait for a particular child process to die

Waits for a particular child process to terminate and returns the pid of
the deceased process, or C<-1> if there is no such child process.  On some
systems, a value of 0 indicates that there are processes still running.
The status is returned in C<$?> and C<${^CHILD_ERROR_NATIVE}>.  If you say

    use POSIX ":sys_wait_h";
    #...
    do {
        $kid = waitpid(-1, WNOHANG);
    } while $kid > 0;

then you can do a non-blocking wait for all pending zombie processes.
Non-blocking wait is available on machines supporting either the
waitpid(2) or wait4(2) syscalls.  However, waiting for a particular
pid with FLAGS of C<0> is implemented everywhere.  (Perl emulates the
system call by remembering the status values of processes that have
exited but have not been harvested by the Perl script yet.)

Note that on some systems, a return value of C<-1> could mean that child
processes are being automatically reaped.  See L<perlipc> for details,
and for other examples.

Portability issues: L<perlport/waitpid>.

=item wantarray
X<wantarray> X<context>

=for Pod::Functions get void vs scalar vs list context of current subroutine call

Returns true if the context of the currently executing subroutine or
C<eval> is looking for a list value.  Returns false if the context is
looking for a scalar.  Returns the undefined value if the context is
looking for no value (void context).

    return unless defined wantarray; # don't bother doing more
    my @a = complex_calculation();
    return wantarray ? @a : "@a";

C<wantarray()>'s result is unspecified in the top level of a file,
in a C<BEGIN>, C<UNITCHECK>, C<CHECK>, C<INIT> or C<END> block, or
in a C<DESTROY> method.

This function should have been named wantlist() instead.

=item warn LIST
X<warn> X<warning> X<STDERR>

=for Pod::Functions print debugging info

Prints the value of LIST to STDERR.  If the last element of LIST does
not end in a newline, it appends the same file/line number text as C<die>
does.

If the output is empty and C<$@> already contains a value (typically from a
previous eval) that value is used after appending C<"\t...caught">
to C<$@>.  This is useful for staying almost, but not entirely similar to
C<die>.

If C<$@> is empty then the string C<"Warning: Something's wrong"> is used.

No message is printed if there is a C<$SIG{__WARN__}> handler
installed.  It is the handler's responsibility to deal with the message
as it sees fit (like, for instance, converting it into a C<die>).  Most
handlers must therefore arrange to actually display the
warnings that they are not prepared to deal with, by calling C<warn>
again in the handler.  Note that this is quite safe and will not
produce an endless loop, since C<__WARN__> hooks are not called from
inside one.

You will find this behavior is slightly different from that of
C<$SIG{__DIE__}> handlers (which don't suppress the error text, but can
instead call C<die> again to change it).

Using a C<__WARN__> handler provides a powerful way to silence all
warnings (even the so-called mandatory ones).  An example:

    # wipe out *all* compile-time warnings
    BEGIN { $SIG{'__WARN__'} = sub { warn $_[0] if $DOWARN } }
    my $foo = 10;
    my $foo = 20;          # no warning about duplicate my $foo,
                           # but hey, you asked for it!
    # no compile-time or run-time warnings before here
    $DOWARN = 1;

    # run-time warnings enabled after here
    warn "\$foo is alive and $foo!";     # does show up

See L<perlvar> for details on setting C<%SIG> entries and for more
examples.  See the Carp module for other kinds of warnings using its
carp() and cluck() functions.

=item write FILEHANDLE
X<write>

=item write EXPR

=item write

=for Pod::Functions print a picture record

Writes a formatted record (possibly multi-line) to the specified FILEHANDLE,
using the format associated with that file.  By default the format for
a file is the one having the same name as the filehandle, but the
format for the current output channel (see the C<select> function) may be set
explicitly by assigning the name of the format to the C<$~> variable.

Top of form processing is handled automatically:  if there is insufficient
room on the current page for the formatted record, the page is advanced by
writing a form feed, a special top-of-page format is used to format the new
page header before the record is written.  By default, the top-of-page
format is the name of the filehandle with "_TOP" appended.  This would be a
problem with autovivified filehandles, but it may be dynamically set to the
format of your choice by assigning the name to the C<$^> variable while
that filehandle is selected.  The number of lines remaining on the current
page is in variable C<$->, which can be set to C<0> to force a new page.

If FILEHANDLE is unspecified, output goes to the current default output
channel, which starts out as STDOUT but may be changed by the
C<select> operator.  If the FILEHANDLE is an EXPR, then the expression
is evaluated and the resulting string is used to look up the name of
the FILEHANDLE at run time.  For more on formats, see L<perlform>.

Note that write is I<not> the opposite of C<read>.  Unfortunately.

=item y///

=for Pod::Functions transliterate a string

The transliteration operator.  Same as C<tr///>.  See
L<perlop/"Quote and Quote-like Operators">.

=back

=head2 Non-function Keywords by Cross-reference

=head3 perldata

=over

=item __DATA__

=item __END__

These keywords are documented in L<perldata/"Special Literals">.

=back

=head3 perlmod

=over

=item BEGIN

=item CHECK

=item END

=item INIT

=item UNITCHECK

These compile phase keywords are documented in L<perlmod/"BEGIN, UNITCHECK, CHECK, INIT and END">.

=back

=head3 perlobj

=over

=item DESTROY

This method keyword is documented in L<perlobj/"Destructors">.

=back

=head3 perlop

=over

=item and

=item cmp

=item eq

=item ge

=item gt

=item if

=item le

=item lt

=item ne

=item not

=item or

=item x

=item xor

These operators are documented in L<perlop>.

=back

=head3 perlsub

=over

=item AUTOLOAD

This keyword is documented in L<perlsub/"Autoloading">.

=back

=head3 perlsyn

=over



( run in 0.595 second using v1.01-cache-2.11-cpan-39bf76dae61 )