⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 posix.pod

📁 UNIX下perl实现代码
💻 POD
📖 第 1 页 / 共 4 页
字号:
Returns the value of the specified enironment variable.The same information is available through the C<%ENV> array.=item geteuidReturns the effective user identifier.  Identical to Perl's builtin C<$E<gt>>variable, see L<perlvar/$EUID>.=item getgidReturns the user's real group identifier.  Similar to Perl's builtinvariable C<$)>, see L<perlvar/$GID>.=item getgrgidThis is identical to Perl's builtin C<getgrgid()> function forreturning group entries by group identifiers, seeL<perlfunc/getgrgid>.=item getgrnamThis is identical to Perl's builtin C<getgrnam()> function forreturning group entries by group names, see L<perlfunc/getgrnam>.=item getgroupsReturns the ids of the user's supplementary groups.  Similar to Perl'sbuiltin variable C<$)>, see L<perlvar/$GID>.=item getloginThis is identical to Perl's builtin C<getlogin()> function forreturning the user name associated with the current session, seeL<perlfunc/getlogin>.=item getpgrpThis is identical to Perl's builtin C<getpgrp()> function forreturning the prcess group identifier of the current process, seeL<perlfunc/getpgrp>.=item getpidReturns the process identifier.  Identical to Perl's builtinvariable C<$$>, see L<perlvar/$PID>.=item getppidThis is identical to Perl's builtin C<getppid()> function forreturning the process identifier of the parent process of the currentprocess , see L<perlfunc/getppid>.=item getpwnamThis is identical to Perl's builtin C<getpwnam()> function forreturning user entries by user names, see L<perlfunc/getpwnam>.=item getpwuidThis is identical to Perl's builtin C<getpwuid()> function forreturning user entries by user identifiers, see L<perlfunc/getpwuid>.=item getsReturns one line from C<STDIN>, similar to E<lt>E<gt>, also knownas the C<readline()> function, see L<perlfunc/readline>.B<NOTE>: if you have C programs that still use C<gets()>, be veryafraid.  The C<gets()> function is a source of endless grief becauseit has no buffer overrun checks.  It should B<never> be used.  TheC<fgets()> function should be preferred instead.=item getuidReturns the user's identifier.  Identical to Perl's builtin C<$E<lt>> variable,see L<perlvar/$UID>.=item gmtimeThis is identical to Perl's builtin C<gmtime()> function forconverting seconds since the epoch to a date in Greenwich Mean Time,see L<perlfunc/gmtime>.=item isalnumThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:isalnum:]]/> construct instead, or possibly the C</\w/> construct.=item isalphaThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:isalpha:]]/> construct instead.=item isattyReturns a boolean indicating whether the specified filehandle is connectedto a tty.  Similar to the C<-t> operator, see L<perlfunc/-X>.=item iscntrlThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:iscntrl:]]/> construct instead.=item isdigitThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:isdigit:]]/> construct instead, or the C</\d/> construct.=item isgraphThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:isgraph:]]/> construct instead.=item islowerThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:islower:]]/> construct instead.  Do B<not> use C</a-z/>.=item isprintThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:isprint:]]/> construct instead.=item ispunctThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:ispunct:]]/> construct instead.=item isspaceThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:isspace:]]/> construct instead, or the C</\s/> construct.=item isupperThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:isupper:]]/> construct instead.  Do B<not> use C</A-Z/>.=item isxdigitThis is identical to the C function, except that it can apply to a singlecharacter or to a whole string.  Consider using regular expressions and theC</[[:isxdigit:]]/> construct instead, or simply C</[0-9a-f]/i>.=item killThis is identical to Perl's builtin C<kill()> function for sendingsignals to processes (often to terminate them), see L<perlfunc/kill>.=item labs(For returning absolute values of long integers.)labs() is C-specific, see L<perlfunc/abs> instead.=item ldexpThis is identical to the C function C<ldexp()>for multiplying floating point numbers with powers of two.	$x_quadrupled = POSIX::ldexp($x, 2);=item ldiv(For computing dividends of long integers.)ldiv() is C-specific, use C</> and C<int()> instead.=item linkThis is identical to Perl's builtin C<link()> functionfor creating hard links into files, see L<perlfunc/link>.=item localeconvGet numeric formatting information.  Returns a reference to a hashcontaining the current locale formatting values.Here is how to query the database for the B<de> (Deutsch or German) locale.	$loc = POSIX::setlocale( &POSIX::LC_ALL, "de" );	print "Locale = $loc\n";	$lconv = POSIX::localeconv();	print "decimal_point	= ", $lconv->{decimal_point},	"\n";	print "thousands_sep	= ", $lconv->{thousands_sep},	"\n";	print "grouping	= ", $lconv->{grouping},	"\n";	print "int_curr_symbol	= ", $lconv->{int_curr_symbol},	"\n";	print "currency_symbol	= ", $lconv->{currency_symbol},	"\n";	print "mon_decimal_point = ", $lconv->{mon_decimal_point}, "\n";	print "mon_thousands_sep = ", $lconv->{mon_thousands_sep}, "\n";	print "mon_grouping	= ", $lconv->{mon_grouping},	"\n";	print "positive_sign	= ", $lconv->{positive_sign},	"\n";	print "negative_sign	= ", $lconv->{negative_sign},	"\n";	print "int_frac_digits	= ", $lconv->{int_frac_digits},	"\n";	print "frac_digits	= ", $lconv->{frac_digits},	"\n";	print "p_cs_precedes	= ", $lconv->{p_cs_precedes},	"\n";	print "p_sep_by_space	= ", $lconv->{p_sep_by_space},	"\n";	print "n_cs_precedes	= ", $lconv->{n_cs_precedes},	"\n";	print "n_sep_by_space	= ", $lconv->{n_sep_by_space},	"\n";	print "p_sign_posn	= ", $lconv->{p_sign_posn},	"\n";	print "n_sign_posn	= ", $lconv->{n_sign_posn},	"\n";=item localtimeThis is identical to Perl's builtin C<localtime()> function forconverting seconds since the epoch to a date see L<perlfunc/localtime>.=item logThis is identical to Perl's builtin C<log()> function,returning the natural (I<e>-based) logarithm of the numerical argument,see L<perlfunc/log>.=item log10This is identical to the C function C<log10()>,returning the 10-base logarithm of the numerical argument.You can also use    sub log10 { log($_[0]) / log(10) }or    sub log10 { log($_[0]) / 2.30258509299405 }  or    sub log10 { log($_[0]) * 0.434294481903252 }=item longjmplongjmp() is C-specific: use L<perlfunc/die> instead.=item lseekMove the file's read/write position.  This uses file descriptors such asthose obtained by calling C<POSIX::open>.	$fd = POSIX::open( "foo", &POSIX::O_RDONLY );	$off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET );Returns C<undef> on failure.=item mallocmalloc() is C-specific.  Perl does memory management transparently.=item mblenThis is identical to the C function C<mblen()>.Perl does not have any support for the wide and multibytecharacters of the C standards, so this might be a rather useless function.=item mbstowcsThis is identical to the C function C<mbstowcs()>.Perl does not have any support for the wide and multibytecharacters of the C standards, so this might be a rather useless function.=item mbtowcThis is identical to the C function C<mbtowc()>.Perl does not have any support for the wide and multibytecharacters of the C standards, so this might be a rather useless function.=item memchrmemchr() is C-specific, see L<perlfunc/index> instead.=item memcmpmemcmp() is C-specific, use C<eq> instead, see L<perlop>.=item memcpymemcpy() is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>.=item memmovememmove() is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>.=item memsetmemset() is C-specific, use C<x> instead, see L<perlop>.=item mkdirThis is identical to Perl's builtin C<mkdir()> functionfor creating directories, see L<perlfunc/mkdir>.=item mkfifoThis is similar to the C function C<mkfifo()> for creatingFIFO special files.	if (mkfifo($path, $mode)) { ....Returns C<undef> on failure.  The C<$mode> is similar to themode of C<mkdir()>, see L<perlfunc/mkdir>.=item mktimeConvert date/time info to a calendar time.Synopsis:	mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)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<mktime()> manpage for detailsabout these and the other arguments.Calendar time for December 12, 1995, at 10:30 am.	$time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 );	print "Date = ", POSIX::ctime($time_t);Returns C<undef> on failure.=item modfReturn the integral and fractional parts of a floating-point number.	($fractional, $integral) = POSIX::modf( 3.14 );=item niceThis is similar to the C function C<nice()>, for changingthe scheduling preference of the current process.  Positivearguments mean more polite process, negative values moreneedy process.  Normal user processes can only be more polite.Returns C<undef> on failure.=item offsetofoffsetof() is C-specific, you probably want to see L<perlfunc/pack> instead.=item openOpen a file for reading for writing.  This returns file descriptors, notPerl filehandles.  Use C<POSIX::close> to close the file.Open a file read-only with mode 0666.	$fd = POSIX::open( "foo" );Open a file for read and write.	$fd = POSIX::open( "foo", &POSIX::O_RDWR );Open a file for write, with truncation.	$fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC );Create a new file with mode 0640.  Set up the file for writing.	$fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 );Returns C<undef> on failure.See also L<perlfunc/sysopen>.=item opendirOpen a directory for reading.	$dir = POSIX::opendir( "/tmp" );	@files = POSIX::readdir( $dir );	POSIX::closedir( $dir );Returns C<undef> on failure.=item pathconfRetrieves the value of a configurable limit on a file or directory.The following will determine the maximum length of the longest allowablepathname on the filesystem which holds C</tmp>.	$path_max = POSIX::pathconf( "/tmp", &POSIX::_PC_PATH_MAX );Returns C<undef> on failure.=item pauseThis is similar to the C function C<pause()>, which suspendsthe execution of the current process until a signal is received.Returns C<undef> on failure.=item perrorThis is identical to the C function C<perror()>, which outputs to thestandard error stream the specified message followed by ": " and thecurrent error string.  Use the C<warn()> function and the C<$!>variable instead, see L<perlfunc/warn> and L<perlvar/$ERRNO>.=item pipeCreate an interprocess channel.  This returns file descriptors like thosereturned by C<POSIX::open>.	($fd0, $fd1) = POSIX::pipe();	POSIX::write( $fd0, "hello", 5 );	POSIX::read( $fd1, $buf, 5 );See also L<perlfunc/pipe>.=item powComputes C<$x> raised to the power C<$exponent>.	$ret = POSIX::pow( $x, $exponent );You can also use the C<**> operator, see L<perlop>.=item printfFormats and prints the specified arguments to STDOUT.See also L<perlfunc/printf>.=item putcputc() is C-specific, see L<perlfunc/print> instead.=item putcharputchar() is C-specific, see L<perlfunc/print> instead.=item putsputs() is C-specific, see L<perlfunc/print> instead.=item qsortqsort() is C-specific, see L<perlfunc/sort> instead.=item raiseSends the specified signal to the current process.See also L<perlfunc/kill> and the C<$$> in L<perlvar/$PID>.=item randC<rand()> is non-portable, see L<perlfunc/rand> instead.=item readRead from a file.  This uses file descriptors such as those obtained bycalling C<POSIX::open>.  If the buffer C<$buf> is not large enough for theread then Perl will extend it to make room for the request.	$fd = POSIX::open( "foo", &POSIX::O_RDONLY );	$bytes = POSIX::read( $fd, $buf, 3 );Returns C<undef> on failure.See also L<perlfunc/sysread>.=item readdirThis is identical to Perl's builtin C<readdir()> functionfor reading directory entries, see L<perlfunc/readdir>.=item reallocrealloc() is C-specific.  Perl does memory management transparently.=item removeThis is identical to Perl's builtin C<unlink()> functionfor removing files, see L<perlfunc/unlink>.=item renameThis is identical to Perl's builtin C<rename()> functionfor renaming files, see L<perlfunc/rename>.=item rewindSeeks to the beginning of the file.=item rewinddir

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -