Webmaster in a Nutshell

Previous Chapter 15
Perl Quick Reference
Next
 

15.20 System Interaction

alarm expr

Schedules a SIG2ALRM to be delivered after expr seconds.

chdir [ expr ]

Changes the working directory. Uses $ENV{"HOME"} or $ENV{"LOGNAME"} if expr is omitted.

chroot filename(dagger)

Changes the root directory for the process and its children.

die [ list ]

Prints the value of list to STDERR and exits with the current value of $! (errno). If $! is 0, exits with the value of ($? >> 8). If ($? >> 8) is 0, exits with 255. list defaults to "Died."

exec list

Executes the system command in list; does not return.

exit [ expr ]

Exits immediately with the value of expr, which defaults to 0 (zero). Calls END routines and object destructors before exiting.

fork

Does a fork(2) system call. Returns the process ID of the child to the parent process and zero to the child process.

getlogin

Returns the current login name as known by the system.

getpgrp [ pid ]

Returns the process group for process pid (0, or omitted, means the current process).

getppid

Returns the process ID of the parent process.

getpriority which, who

Returns the current priority for a process, process group, or user.

glob pat

Returns a list of filenames that match the shell pattern pat.

kill list

Sends a signal to a list of processes. The first element of the list must be the signal to send (either numeric, or its name as a string).

setpgrp pid, pgrp

Sets the process group for the pid (0 means the current process).

setpriority which, who, priority

Sets the current priority for a process, process group, or a user.

sleep [ expr ]

Causes the program to sleep for expr seconds, or forever if no expr. Returns the number of seconds actually slept.

syscall list

Calls the system call specified in the first element of the list, passing the rest of the list as arguments to the call.

system list

Does exactly the same thing as exec list except that a fork is performed first, and the parent process waits for the child process to complete.

times

Returns a 4-element array (0:$user, 1:$system, 2:$cuser, 3:$csystem) giving the user and system times, in seconds, for this process and the children of this process.

umask [ expr ]

Sets the umask for the process and returns the old one. If expr is omitted, returns current umask value.

wait

Waits for a child process to terminate and returns the process ID of the deceased process (-1 if none). The status is returned in $?.

waitpid pid, flags

Performs the same function as the corresponding system call.

warn [ list ]

Prints the message on STDERR like die, but doesn't exit. list defaults to "Warning: something's wrong".


Previous Home Next
Directory Reading Routines Book Index Networking

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell