Pod-Perldoc

 view release on metacpan or  search on metacpan

corpus/perlfunc.pod  view on Meta::CPAN

C<IPC::SysV>, and the C<IPC::Shareable> module from CPAN.

Portability issues: L<perlport/shmread> and L<perlport/shmwrite>.

=item shutdown SOCKET,HOW
X<shutdown>

Shuts down a socket connection in the manner indicated by HOW, which
has the same interpretation as in the syscall of the same name.

    shutdown(SOCKET, 0);    # I/we have stopped reading data
    shutdown(SOCKET, 1);    # I/we have stopped writing data
    shutdown(SOCKET, 2);    # I/we have stopped using this socket

This is useful with sockets when you want to tell the other
side you're done writing but not done reading, or vice versa.
It's also a more insistent form of close because it also
disables the file descriptor in any forked copies in other
processes.

Returns C<1> for success; on error, returns C<undef> if
the first argument is not a valid filehandle, or returns C<0> and sets
C<$!> for any other failure.

=item sin EXPR
X<sin> X<sine> X<asin> X<arcsine>

=item sin

Returns the sine of EXPR (expressed in radians).  If EXPR is omitted,
returns sine of C<$_>.

For the inverse sine operation, you may use the C<Math::Trig::asin>
function, or use this relation:

    sub asin { atan2($_[0], sqrt(1 - $_[0] * $_[0])) }

=item sleep EXPR
X<sleep> X<pause>

=item sleep

Causes the script to sleep for (integer) EXPR seconds, or forever if no 
argument is given.  Returns the integer number of seconds actually slept.  

May be interrupted if the process receives a signal such as C<SIGALRM>.

    eval {
        local $SIG{ALARM} = sub { die "Alarm!\n" };
        sleep;
    };
    die $@ unless $@ eq "Alarm!\n";

You probably cannot mix C<alarm> and C<sleep> calls, because C<sleep>
is often implemented using C<alarm>.

On some older systems, it may sleep up to a full second less than what
you requested, depending on how it counts seconds.  Most modern systems
always sleep the full amount.  They may appear to sleep longer than that,
however, because your process might not be scheduled right away in a
busy multitasking system.

For delays of finer granularity than one second, the Time::HiRes module
(from CPAN, and starting from Perl 5.8 part of the standard
distribution) provides usleep().  You may also use Perl's four-argument
version of select() leaving the first three arguments undefined, or you
might be able to use the C<syscall> interface to access setitimer(2) if
your system supports it. See L<perlfaq8> for details.

See also the POSIX module's C<pause> function.

=item socket SOCKET,DOMAIN,TYPE,PROTOCOL
X<socket>

Opens a socket of the specified kind and attaches it to filehandle
SOCKET.  DOMAIN, TYPE, and PROTOCOL are specified the same as for
the syscall of the same name.  You should C<use Socket> first
to get the proper definitions imported.  See the examples in
L<perlipc/"Sockets: Client/Server Communication">.

On systems that support a close-on-exec flag on files, the flag will
be set for the newly opened file descriptor, as determined by the
value of $^F.  See L<perlvar/$^F>.

=item socketpair SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL
X<socketpair>

Creates an unnamed pair of sockets in the specified domain, of the
specified type.  DOMAIN, TYPE, and PROTOCOL are specified the same as
for the syscall of the same name.  If unimplemented, raises an exception.
Returns true if successful.

On systems that support a close-on-exec flag on files, the flag will
be set for the newly opened file descriptors, as determined by the value
of $^F.  See L<perlvar/$^F>.

Some systems defined C<pipe> in terms of C<socketpair>, in which a call
to C<pipe(Rdr, Wtr)> is essentially:

    use Socket;
    socketpair(Rdr, Wtr, AF_UNIX, SOCK_STREAM, PF_UNSPEC);
    shutdown(Rdr, 1);        # no more writing for reader
    shutdown(Wtr, 0);        # no more reading for writer

See L<perlipc> for an example of socketpair use.  Perl 5.8 and later will
emulate socketpair using IP sockets to localhost if your system implements
sockets but not socketpair.

Portability issues: L<perlport/socketpair>.

=item sort SUBNAME LIST
X<sort> X<qsort> X<quicksort> X<mergesort>

=item sort BLOCK LIST

=item sort LIST

In list context, this sorts the LIST and returns the sorted list value.
In scalar context, the behaviour of C<sort()> is undefined.

If SUBNAME or BLOCK is omitted, C<sort>s in standard string comparison



( run in 0.456 second using v1.01-cache-2.11-cpan-98e64b0badf )