POD2-RU
view release on metacpan or search on metacpan
lib/POD2/RU/perlfunc.pod view on Meta::CPAN
X<context>
A named array in scalar context is quite different from what would at
first glance appear to be a list in scalar context. You can't get a list
like C<(1,2,3)> into being in scalar context, because the compiler knows
the context at compile time. It would generate the scalar comma operator
there, not the list construction version of the comma. That means it
was never a list to start with.
In general, functions in Perl that serve as wrappers for system calls ("syscalls")
of the same name (like chown(2), fork(2), closedir(2), etc.) return
true when they succeed and C<undef> otherwise, as is usually mentioned
in the descriptions below. This is different from the C interfaces,
which return C<-1> on failure. Exceptions to this rule include C<wait>,
C<waitpid>, and C<syscall>. System calls also set the special C<$!>
variable on failure. Other functions do not, except accidentally.
Extension modules can also hook into the Perl parser to define new
kinds of keyword-headed expression. These may look like functions, but
may also look completely different. The syntax following the keyword
is defined entirely by the extension. If you are an implementor, see
lib/POD2/RU/perlfunc.pod view on Meta::CPAN
=for Pod::Functions =Binary
C<pack>, C<read>, C<syscall>, C<sysread>, C<sysseek>, C<syswrite>, C<unpack>,
C<vec>
=item Functions for filehandles, files, or directories
X<file> X<filehandle> X<directory> X<pipe> X<link> X<symlink>
=for Pod::Functions =File
C<-I<X>>, C<chdir>, C<chmod>, C<chown>, C<chroot>, C<fcntl>, C<glob>,
C<ioctl>, C<link>, C<lstat>, C<mkdir>, C<open>, C<opendir>,
C<readlink>, C<rename>, C<rmdir>, C<stat>, C<symlink>, C<sysopen>,
C<umask>, C<unlink>, C<utime>
=item Keywords related to the control flow of your Perl program
X<control flow>
=for Pod::Functions =Flow
C<break>, C<caller>, C<continue>, C<die>, C<do>,
lib/POD2/RU/perlfunc.pod view on Meta::CPAN
=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>,
lib/POD2/RU/perlfunc.pod view on Meta::CPAN
You can actually chop anything that's an lvalue, including an assignment.
If you chop a list, each element is chopped. Only the value of the
last C<chop> is returned.
Note that C<chop> returns the last character. To return all but the last
character, use C<substr($string, 0, -1)>.
See also L</chomp>.
=item chown LIST
X<chown> X<owner> X<user> X<group>
=for Pod::Functions change the ownership on a list of files
Changes the owner (and group) of a list of files. The first two
elements of the list must be the I<numeric> uid and gid, in that
order. A value of -1 in either position is interpreted by most
systems to leave that value unchanged. Returns the number of files
successfully changed.
$cnt = chown $uid, $gid, 'foo', 'bar';
chown $uid, $gid, @filenames;
On systems that support fchown(2), you may pass filehandles among the
files. On systems that don't support fchown(2), passing filehandles raises
an exception. Filehandles must be passed as globs or glob references to be
recognized; barewords are considered filenames.
Here's an example that looks up nonnumeric uids in the passwd file:
print "User: ";
chomp($user = <STDIN>);
print "Files: ";
chomp($pattern = <STDIN>);
($login,$pass,$uid,$gid) = getpwnam($user)
or die "$user not in passwd file";
@ary = glob($pattern); # expand filenames
chown $uid, $gid, @ary;
On most systems, you are not allowed to change the ownership of the
file unless you're the superuser, although you should be able to change
the group to any of your secondary groups. On insecure systems, these
restrictions may be relaxed, but this is not a portable assumption.
On POSIX systems, you can detect this condition this way:
use POSIX qw(sysconf _PC_CHOWN_RESTRICTED);
$can_chown_giveaway = not sysconf(_PC_CHOWN_RESTRICTED);
Portability issues: L<perlport/chmod>.
=item chr NUMBER
X<chr> X<character> X<ASCII> X<Unicode>
=item chr
=for Pod::Functions get character this number represents
lib/POD2/RU/perlunicode.pod view on Meta::CPAN
these situations is that the answers are highly dependent on the operating
system and the file system(s). For example, whether filenames can be
in Unicode and in exactly what kind of encoding, is not exactly a
portable concept. Similarly for C<qx> and C<system>: how well will the
"command-line interface" (and which of them?) handle Unicode?
=over 4
=item *
chdir, chmod, chown, chroot, exec, link, lstat, mkdir,
rename, rmdir, stat, symlink, truncate, unlink, utime, -X
=item *
%ENV
=item *
glob (aka the <*>)
( run in 2.029 seconds using v1.01-cache-2.11-cpan-71847e10f99 )