📄 posix.pod
字号:
This is identical to Perl's builtin C<rewinddir()> function forrewinding directory entry streams, see L<perlfunc/rewinddir>.=item rmdirThis is identical to Perl's builtin C<rmdir()> functionfor removing (empty) directories, see L<perlfunc/rmdir>.=item scanfscanf() is C-specific, use E<lt>E<gt> and regular expressions instead,see L<perlre>.=item setgidSets the real group identifier for this process.Identical to assigning a value to the Perl's builtin C<$)> variable,see L<perlvar/$UID>.=item setjmpC<setjmp()> is C-specific: use C<eval {}> instead,see L<perlfunc/eval>.=item setlocaleModifies and queries program's locale. The following examples assume use POSIX qw(setlocale LC_ALL LC_CTYPE);has been issued.The following will set the traditional UNIX system locale behavior(the second argument C<"C">). $loc = setlocale( LC_ALL, "C" );The following will query the current LC_CTYPE category. (No secondargument means 'query'.) $loc = setlocale( LC_CTYPE );The following will set the LC_CTYPE behaviour according to the localeenvironment variables (the second argument C<"">).Please see your systems L<setlocale(3)> documentation for the localeenvironment variables' meaning or consult L<perllocale>. $loc = setlocale( LC_CTYPE, "" );The following will set the LC_COLLATE behaviour to ArgentinianSpanish. B<NOTE>: The naming and availability of locales depends onyour operating system. Please consult L<perllocale> for how to findout which locales are available in your system. $loc = setlocale( LC_ALL, "es_AR.ISO8859-1" );=item setpgidThis is similar to the C function C<setpgid()> forsetting the process group identifier of the current process.Returns C<undef> on failure.=item setsidThis is identical to the C function C<setsid()> forsetting the session identifier of the current process.=item setuidSets the real user identifier for this process.Identical to assigning a value to the Perl's builtin C<$E<lt>> variable,see L<perlvar/$UID>.=item sigactionDetailed signal management. This uses C<POSIX::SigAction> objects for theC<action> and C<oldaction> arguments. Consult your system's C<sigaction>manpage for details.Synopsis: sigaction(sig, action, oldaction = 0)Returns C<undef> on failure.=item siglongjmpsiglongjmp() is C-specific: use L<perlfunc/die> instead.=item sigpendingExamine signals that are blocked and pending. This uses C<POSIX::SigSet>objects for the C<sigset> argument. Consult your system's C<sigpending>manpage for details.Synopsis: sigpending(sigset)Returns C<undef> on failure.=item sigprocmaskChange and/or examine calling process's signal mask. This usesC<POSIX::SigSet> objects for the C<sigset> and C<oldsigset> arguments.Consult your system's C<sigprocmask> manpage for details.Synopsis: sigprocmask(how, sigset, oldsigset = 0)Returns C<undef> on failure.=item sigsetjmpC<sigsetjmp()> is C-specific: use C<eval {}> instead,see L<perlfunc/eval>.=item sigsuspendInstall a signal mask and suspend process until signal arrives. This usesC<POSIX::SigSet> objects for the C<signal_mask> argument. Consult yoursystem's C<sigsuspend> manpage for details.Synopsis: sigsuspend(signal_mask)Returns C<undef> on failure.=item sinThis is identical to Perl's builtin C<sin()> functionfor returning the sine of the numerical argument,see L<perlfunc/sin>. See also L<Math::Trig>.=item sinhThis is identical to the C function C<sinh()>for returning the hyperbolic sine of the numerical argument.See also L<Math::Trig>.=item sleepThis is identical to Perl's builtin C<sleep()> functionfor suspending the execution of the current for processfor certain number of seconds, see L<perlfunc/sleep>.=item sprintfThis is similar to Perl's builtin C<sprintf()> functionfor returning a string that has the arguments formatted as requested,see L<perlfunc/sprintf>.=item sqrtThis is identical to Perl's builtin C<sqrt()> function.for returning the square root of the numerical argument,see L<perlfunc/sqrt>.=item srandGive a seed the pseudorandom number generator, see L<perlfunc/srand>.=item sscanfsscanf() is C-specific, use regular expressions instead,see L<perlre>.=item statThis is identical to Perl's builtin C<stat()> functionfor retutning information about files and directories.=item strcatstrcat() is C-specific, use C<.=> instead, see L<perlop>.=item strchrstrchr() is C-specific, see L<perlfunc/index> instead.=item strcmpstrcmp() is C-specific, use C<eq> or C<cmp> instead, see L<perlop>.=item strcollThis is identical to the C function C<strcoll()>for collating (comparing) strings transformed usingthe C<strxfrm()> function. Not really needed sincePerl can do this transparently, see L<perllocale>.=item strcpystrcpy() is C-specific, use C<=> instead, see L<perlop>.=item strcspnstrcspn() is C-specific, use regular expressions instead,see L<perlre>.=item strerrorReturns the error string for the specified errno.Identical to the string form of the C<$!>, see L<perlvar/$ERRNO>.=item strftimeConvert date and time information to string. Returns the string.Synopsis: strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero.I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. Theyear (C<year>) is given in years since 1900. I.e., the year 1995 is 95; theyear 2001 is 101. Consult your system's C<strftime()> manpage for detailsabout these and the other arguments.If you want your code to be portable, your format (C<fmt>) argumentshould use only the conversion specifiers defined by the ANSI Cstandard. These are C<aAbBcdHIjmMpSUwWxXyYZ%>.The given arguments are made consistentas though by calling C<mktime()> before calling your system'sC<strftime()> function, except that the C<isdst> value is not affected.The string for Tuesday, December 12, 1995. $str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 ); print "$str\n";=item strlenstrlen() is C-specific, use C<length()> instead, see L<perlfunc/length>.=item strncatstrncat() is C-specific, use C<.=> instead, see L<perlop>.=item strncmpstrncmp() is C-specific, use C<eq> instead, see L<perlop>.=item strncpystrncpy() is C-specific, use C<=> instead, see L<perlop>.=item strpbrkstrpbrk() is C-specific, use regular expressions instead,see L<perlre>.=item strrchrstrrchr() is C-specific, see L<perlfunc/rindex> instead.=item strspnstrspn() is C-specific, use regular expressions instead,see L<perlre>.=item strstrThis is identical to Perl's builtin C<index()> function,see L<perlfunc/index>.=item strtodString to double translation. Returns the parsed number and the numberof characters in the unparsed portion of the string. TrulyPOSIX-compliant systems set $! ($ERRNO) to indicate a translationerror, so clear $! before calling strtod. However, non-POSIX systemsmay not check for overflow, and therefore will never set $!.strtod should respect any POSIX I<setlocale()> settings.To parse a string $str as a floating point number use $! = 0; ($num, $n_unparsed) = POSIX::strtod($str);The second returned item and $! can be used to check for valid input: if (($str eq '') || ($n_unparsed != 0) || !$!) { die "Non-numeric input $str" . $! ? ": $!\n" : "\n"; }When called in a scalar context strtod returns the parsed number.=item strtokstrtok() is C-specific, use regular expressions instead, seeL<perlre>, or L<perlfunc/split>.=item strtolString to (long) integer translation. Returns the parsed number andthe number of characters in the unparsed portion of the string. TrulyPOSIX-compliant systems set $! ($ERRNO) to indicate a translationerror, so clear $! before calling strtol. However, non-POSIX systemsmay not check for overflow, and therefore will never set $!.strtol should respect any POSIX I<setlocale()> settings.To parse a string $str as a number in some base $base use $! = 0; ($num, $n_unparsed) = POSIX::strtol($str, $base);The base should be zero or between 2 and 36, inclusive. When the baseis zero or omitted strtol will use the string itself to determine thebase: a leading "0x" or "0X" means hexadecimal; a leading "0" meansoctal; any other leading characters mean decimal. Thus, "1234" isparsed as a decimal number, "01234" as an octal number, and "0x1234"as a hexadecimal number.The second returned item and $! can be used to check for valid input: if (($str eq '') || ($n_unparsed != 0) || !$!) { die "Non-numeric input $str" . $! ? ": $!\n" : "\n"; }When called in a scalar context strtol returns the parsed number.=item strtoulString to unsigned (long) integer translation. strtoul() is identicalto strtol() except that strtoul() only parses unsigned integers. SeeL</strtol> for details.Note: Some vendors supply strtod() and strtol() but not strtoul().Other vendors that do supply strtoul() parse "-1" as a valid value.=item strxfrmString transformation. Returns the transformed string. $dst = POSIX::strxfrm( $src );Used in conjunction with the C<strcoll()> function, see L</strcoll>.Not really needed since Perl can do this transparently, seeL<perllocale>.=item sysconfRetrieves values of system configurable variables.The following will get the machine's clock speed. $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK );Returns C<undef> on failure.=item systemThis is identical to Perl's builtin C<system()> function, seeL<perlfunc/system>.=item tanThis is identical to the C function C<tan()>, returning thetangent of the numerical argument. See also L<Math::Trig>.=item tanhThis is identical to the C function C<tanh()>, returning thehyperbolic tangent of the numerical argument. See also L<Math::Trig>.=item tcdrainThis is similar to the C function C<tcdrain()> for drainingthe output queue of its argument stream.Returns C<undef> on failure.=item tcflowThis is similar to the C function C<tcflow()> for controllingthe flow of its argument stream.Returns C<undef> on failure.=item tcflushThis is similar to the C function C<tcflush()> for flushingthe I/O buffers of its argumeny stream.Returns C<undef> on failure.=item tcgetpgrpThis is identical to the C function C<tcgetpgrp()> for returning theprocess group identifier of the foreground process group of the controllingterminal.=item tcsendbreakThis is similar to the C function C<tcsendbreak()> for sendinga break on its argument stream.Returns C<undef> on failure.=item tcsetpgrpThis is similar to the C function C<tcsetpgrp()> for setting theprocess group identifier of the foreground process group of the controllingterminal.Returns C<undef> on failure.=item timeThis is identical to Perl's builtin C<time()> functionfor returning the number of seconds since the epoch(whatever it is for the system), see L<perlfunc/time>.=item timesThe times() function returns elapsed realtime since some point in the past(such as system startup), user and system times for this process, and userand system times used by child processes. All times are returned in clockticks. ($realtime, $user, $system, $cuser, $csystem) = POSIX::times();Note: Perl's builtin C<times()> function returns four values, measured inseconds.=item tmpfileUse method C<IO::File::new_tmpfile()> instead, or see L<File::Temp>.=item tmpnamReturns a name for a temporary file. $tmpfile = POSIX::tmpnam();For security reasons, which are probably detailed in your system'sdocumentation for the C library tmpnam() function, this interfaceshould not be used; instead see L<File::Temp>.=item tolowerThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string. Consider using the C<lc()> function,see L<perlfunc/lc>, or the equivalent C<\L> operator inside doublequotishstrings.=item toupperThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string. Consider using the C<uc()> function,see L<perlfunc/uc>, or the equivalent C<\U> operator inside doublequotishstrings.=item ttynameThis is identical to the C function C<ttyname()> for returning thename of the current terminal.=item tznameRetrieves the time conversion information from the C<tzname> variable. POSIX::tzset(); ($std, $dst) = POSIX::tzname();=item tzsetThis is identical to the C function C<tzset()> for settingthe current timezone based on the environment variable C<TZ>,to be used by C<ctime()>, C<localtime()>, C<mktime()>, and C<strftime()>functions.=item umaskThis is identical to Perl's builtin C<umask()> functionfor setting (and querying) the file creation permission mask,see L<perlfunc/umask>.=item unameGet name of current operating system. ($sysname, $nodename, $release, $version, $machine) = POSIX::uname();Note that the actual meanings of the various fields are notthat well standardized, do not expect any great portability.The C<$sysname> might be the name of the operating system,the C<$nodename> might be the name of the host, the C<$release>might be the (major) release number of the operating system,the C<$version> might be the (minor) release number of the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -