1. Trang chủ
  2. » Công Nghệ Thông Tin

perl the complete reference second edition phần 9 pdf

125 410 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 125
Dung lượng 742,82 KB

Nội dung

setgrent setgrent Sets (or resets) the enumeration to the beginning of the set of group entries. This function should be called before the first call to getgrent. Effects U Returns in Scalar Context Returns in List Context Nothing See also Chapter(s) Function(s) Module(s) Chapter 11 getgrent, endgrent Win32API::Net sethostent sethostent STAYOPEN Sets (or resets) the enumeration to the beginning of the set of host entries. This function should be called before the first call to gethostent. The STAYOPEN argument is optional and unused on most systems. Effects U Returns in Scalar Context Returns in List Context Nothing See also Chapter(s) Function(s) Module(s) Chapter 11 gethostent, endhostent setnetent setnetent STAYOPEN Sets (or resets) the enumeration to the beginning of the set of network entries. This function should be called before the first call to getnetent. The STAYOPEN argument is optional and unused on most systems. 960 Perl: The Complete Reference TEAMFLY Team-Fly ® Appendix A: Function Reference 961 APPENDIXES Effects U Returns in Scalar Context Returns in List Context Nothing See also Chapter(s) Function(s) Module(s) Chapter 12 getnetent, endnetent setpgrp setpgrp PID, PGRP Sets the current process group for the process PID. You can use a value of 0 for PID to change the process group of the current process. If both arguments are omitted, defaults to values of 0. Causes a fatal error if the system does not support the function. Effects $!, XT, U Returns in Scalar Context Returns in List Context undef on failure New parent process ID See also Chapter(s) Function(s) Module(s) Chapter 15 getpgrp setpriority setpriority WHICH, WHO, PRIORITY Sets the priority for a process (PRIO_PROCESS), process group (PRIO_PGRP), or user (PRIO_USER). The argument WHICH specifies what entity to set the priority for, and WHO is the process ID or user ID to set. A value of 0 for WHO defines the current process, process group, or user. Produces a fatal error on systems that don’t support the system setpriority( ) function. Effects $!, XT, U Returns in Scalar Context Returns in List Context 0 on error 1 on success See also Chapter(s) Function(s) Module(s) Chapter 14 getpriority Win32::Process setprotoent setprotoent STAYOPEN Sets (or resets) the enumeration to the beginning of the set of protocol entries. This function should be called before the first call to getprotoent. The STAYOPEN argument is optional and unused on most systems. Effects U Returns in Scalar Context Returns in List Context Nothing See also Chapter(s) Function(s) Module(s) Chapter 12 getprotoent, endprotoent setpwent setpwent Sets (or resets) the enumeration to the beginning of the set of password entries. This function should be called before the first call to getpwent. Effects U Returns in Scalar Context Returns in List Context Nothing See also Chapter(s) Function(s) Module(s) Chapter 11 getpwent, endpwent Win32API::Net setservent setservent STAYOPEN Sets (or resets) the enumeration to the beginning of the set of service entries. This function should be called before the first call to getservent. The STAYOPEN argument is optional and unused on most systems. 962 Perl: The Complete Reference Effects U Returns in Scalar Context Returns in List Context Nothing See also Chapter(s) Function(s) Module(s) Chapter 12 getservent, endservent setsockopt setsockopt SOCKET, LEVEL, OPTNAME, OPTVAL Sets the socket option OPTNAME with a value of OPTVAL on SOCKET at the specified LEVEL. You will need to import the Socket module for the valid values for OPTNAME shown in Table A-13. Appendix A: Function Reference 963 APPENDIXES OPTNAME Description SO_DEBUG Enable/disable recording of debugging information. SO_REUSEADDR Enable/disable local address reuse. SO_KEEPALIVE Enable/disable keep connections alive. SO_DONTROUTE Enable/disable routing bypass for outgoing messages. SO_LINGER Linger on close if data is present. SO_BROADCAST Enable/disable permission to transmit broadcast messages. SO_OOBINLINE Enable/disable reception of out-of-band data in band. SO_SNDBUF Set buffer size for output. SO_RCVBUF Set buffer size for input. SO_TYPE Get the type of the socket (get only). SO_ERROR Get and clear error on the socket (get only). Table A-13. Socket Options 964 Perl: The Complete Reference Effects $!, XA, U Returns in Scalar Context Returns in List Context undef on failure 1 on success See also Chapter(s) Function(s) Module(s) Chapter 12 getsockopt, socket IO::Socket shift shift ARRAY shift Returns the first value in an array, deleting it and shifting the elements of the array list to the left by one. If ARRAY is not specified, shifts the @_ array within a subroutine, or @ARGV otherwise. shift is essentially identical to pop, except values are taken from the start of the array instead of the end. Effects None Returns in Scalar Context Returns in List Context undef if the array is empty First element in the array See also Chapter(s) Function(s) Module(s) Chapter 8 pop, push, unshift IO::Socket shmctl shmctl ID, CMD, ARG Controls the shared memory segment referred to by ID, using CMD with ARG. You will need to import the IPC::SysV module to get the command tokens defined in Table A-14. Appendix A: Function Reference 965 APPENDIXES Effects $!, U Returns in Scalar Context Returns in List Context undef on failure 0 but true if the return value from the shmctl( ) is 0 Value returned by system See also Chapter(s) Function(s) Module(s) Chapter 14 shmget, shmread IPC::SysV shmget shmget KEY, SIZE, FLAGS shmget KEY Returns the shared memory segment ID for the segment matching KEY. A new shared memory segment is created of at least SIZE bytes, providing that either KEY does not Command Description IPC_STAT Places the current value of each member of the data structure associated with ID into the scalar ARG IPC_SET Sets the value of the following members of the data structure associated with ID to the corresponding values found in the packed scalar ARG IPC_RMID Removes the shared memory identifier specified by ID from the system and destroys the shared memory segment and data structure associated with it SHM_LOCK Locks the shared memory segment specified by ID in memory SHM_UNLOCK Unlocks the shared memory segment specified by ID Table A-14. Commands for Controlling Shared Memory Segments 966 Perl: The Complete Reference already have a segment associated with it or that KEY is equal to the constant IPC_PRIVATE. Effects $!, U Returns in Scalar Context Returns in List Context Shared memory ID See also Chapter(s) Function(s) Module(s) Chapter 14 shmctl, shmread, shmwrite IPC::SysV shmread shmread ID, VAR, POS, SIZE Reads the shared memory segment ID into the scalar VAR at position POS for up to SIZE bytes. Effects $!, U Returns in Scalar Context Returns in List Context 0 on failure 1 on success See also Chapter(s) Function(s) Module(s) Chapter 14 shmctl, shmget, shmwrite IPC::SysV shmwrite shmwrite ID, STRING, POS, SIZE Writes STRING from the position POS for SIZE bytes into the shared memory segment specified by ID. The SIZE is greater than the length of STRING. shmwrite appends null bytes to fill out to SIZE bytes. Appendix A: Function Reference 967 APPENDIXES Effects $!, U Returns in Scalar Context Returns in List Context 0 on false 1 on success See also Chapter(s) Function(s) Module(s) Chapter 14 shmctl, shmget, shmread IPC::SysV shutdown shutdown SOCKET, HOW Disables a socket connection according to the value of HOW. The valid values for HOW are identical to the system call of the same name. A value of 0 indicates that you have stopped reading information from the socket. A value of 1 indicates that you’ve stopped writing to the socket. A value of 2 indicates that you have stopped using the socket altogether. Effects $!, XA, U Returns in Scalar Context Returns in List Context 0 on failure 1 on success See also Chapter(s) Function(s) Module(s) Chapter 12 accept IO::Socket sin sin EXPR sin 968 Perl: The Complete Reference Returns the sine of EXPR, or $_ if not specified. Effects $_ Returns in Scalar Context Returns in List Context Floating point See also Chapter(s) Function(s) Module(s) Chapter 8 atan2, cos Math::Trig sleep sleep EXPR sleep Pauses the script for EXPR seconds, or forever if EXPR is not specified. Returns the number of seconds actually slept. Can be interrupted by a signal handler, but you should avoid using sleep with alarm, since many systems use alarm for the sleep implementation. Effects None Returns in Scalar Context Returns in List Context Integer, number of seconds actually slept See also Chapter(s) Function(s) Module(s) Chapter 14 alarm, select IO::Select socket socket SOCKET, DOMAIN, TYPE, PROTOCOL Opens a socket in DOMAIN, of TYPE, using PROTOCOL, and attaches it to the filehandle SOCKET. You will need to import the Socket module to get the correct definitions. For most systems, DOMAIN will be PF_INET for a TCP/IP-based socket. TYPE will generally be one of SOCK_STREAM for streams-based connections (TCP/IP) or SOCK_DGRAM for a datagram connection (UDP/IP). Values for PROTOCOL are system defined, but valid values include TCP for TCP/IP, UDP for UDP, and RDP for the “reliable” datagram protocol. Appendix A: Function Reference 969 APPENDIXES Consider using the IO::Socket module instead to create both client and server sockets, since it handles all of this detail for you. Effects $!, XA, XT, U Returns in Scalar Context Returns in List Context 0 on failure 1 on success See also Chapter(s) Function(s) Module(s) Chapter 12 accept, bind IO::Socket socketpair socketpair SOCKET1, SOCKET2, DOMAIN, TYPE, PROTOCOL Creates an unnamed pair of connected sockets in the specified DOMAIN, of the specified TYPE, using PROTOCOL. If the system socketpair( ) function is not implemented, then it causes a fatal error. Effects $!, XA, XT, U Returns in Scalar Context Returns in List Context 0 on failure 1 on success See also Chapter(s) Function(s) Module(s) Chapter 12 pipe, socket IPC::Open2, IPC::Open3, IO::Socket sort sort SUBNAME LIST sort BLOCK LIST sort LIST Sorts LIST according to the subroutine SUBNAME or the anonymous subroutine specified by BLOCK. If no SUBNAME or BLOCK is specified, then it sorts according to normal alphabetical sequence. If BLOCK or SUBNAME is specified, then the [...]... specified, then Perl checks for any shell metacharacters and, if found, passes PROGRAM unchanged to the user’s default command shell If there are no metacharacters, then the value is split into words and passed as an entire command with arguments to the system execvp function Perl: The Complete Reference The return value is the exit status of the program as returned by the wait function To obtain the actual... Perl Library 99 3 Copyright 2001 The McGraw-Hill Companies, Inc Click Here for Terms of Use 99 4 Perl: The Complete Reference he standard Perl library comes with a range of modules that have been deemed useful, if not essential, to developing Perl applications Some of these modules, such as AutoLoader, AutoSplit, and much of the ExtUtils hierarchy, are an essential part of the development process Others... open), and the mode of opening is defined by the MODE argument Appendix A: Function Reference 97 7 If the file has to be created, and the O_CREAT flag has been specified in MODE, then the file is created with the permissions of PERMS The value of PERMS must be specified in traditional Unix-style hexadecimal If PERMS is not specified, then Perl uses a default mode of 0666 (read/write on user/group/other)... returning the process ID of the deceased process If PID does not exist, then it returns -1 The exit status of the process is contained in $? If you import the POSIX module, you can specify flags by name, although all Perl implementations support a value of 0 Table A-18 lists the flags supported under Perl: The Complete Reference Solaris You will need to check your implementation for the flags your operating... APPENDIXES Effects 98 6 Perl: The Complete Reference unpack unpack FORMAT, EXPR Unpacks the binary string EXPR using the format specified in FORMAT Basically reverses the operation of pack, returning the list of packed values according to the supplied format You can also prefix any format field with a % to indicate that you want a 16-bit checksum of the value of EXPR, instead of the value Effects... Appendix A: Function Reference 99 1 warn warn LIST Prints the value of LIST to STDERR Basically the same as the die function except that no call is made to the exit and no exception is raised within an eval statement This can be useful to raise an error without causing the script to terminate prematurely If the variable $@ contains a value (from a previous eval call) and LIST is empty, then the value of $@... and LIST 97 2 Perl: The Complete Reference sqrt sqrt EXPR sqrt Returns the square root of EXPR, or $_ if omitted Effects $_, $@ Returns in Scalar Context Returns in List Context Floating point number See also Chapter(s) Function(s) Module(s) Chapter 8 srand srand EXPR srand Sets the seed value for the random number generator to EXPR or to a random value based on the time, process ID, and other values... Chapter(s) Function(s) Chapter 6 require, no, package Module(s) APPENDIXES Effects 98 8 Perl: The Complete Reference utime utime ATIME, MTIME, LIST Sets the access and modification times specified by ATIME and MTIME for the list of files in LIST The values of ATIME and MTIME must be numerical The inode modification time is set to the current time Effects $!, XT, U Returns in Scalar Context Returns in List... Table A-17 Appendix A: Function Reference Value Constant Description 0 SEEK_SET Sets the new position absolutely to POSITION bytes within the file 1 SEEK_CUR Sets the new position to the current position plus POSITION bytes within the file 2 SEEK_END 97 9 Sets the new position to POSITION bytes, relative to the end of the file Table A-17 Offset Values and Constants for seek Effects $!, XA Returns in Scalar... characters from the end of the string If LEN is specified, returns that number of bytes, or all bytes up until end-of-string if not specified If LEN is negative, leaves that many characters off the end of the string If REPLACEMENT is specified, replaces the substring with the REPLACEMENT string If you specify a substring that passes beyond the end of the string, it returns only the valid element of the original . open), and the mode of opening is defined by the MODE argument. 97 6 Perl: The Complete Reference If the file has to be created, and the O_CREAT flag has been specified in MODE, then the file is. SUBNAME is specified, then the 97 0 Perl: The Complete Reference subroutine should return an integer less than, greater than, or equal to zero, according to how the elements of the array are to be. Module(s) Chapters 7, 8 print, printf Appendix A: Function Reference 97 1 APPENDIXES 97 2 Perl: The Complete Reference sqrt sqrt EXPR sqrt Returns the square root of EXPR, or $_ if omitted. Effects $_,

Ngày đăng: 13/08/2014, 22:21

TỪ KHÓA LIÊN QUAN