Perl Source Code Builder

The Perl source code builder can be launched using the Code - Bulders - Perl menu item, or by selecting the Perl code builder option of the Perl sidekick.

The builder contains a dropdown with the various categories of Perl modules such as Array, File, Hash, Input / Ouput, etc.

Once a function type is selected from the function category dropdown window, all functions of that type are then displayed in the list section of the screen. Clicking on a function in the list section displays applicable information about the function such as signature and description.

Clicking the "Copy to Editor" button copies the function to the currently active editor and displays the function signature as a tooltip.

EditRocket provides information on the following Perl Library routines in the Perl source code builder:

Array
File
Hash
Input / Output
List
Miscellaneous
Network Info
Numeric
Process
Regular Expression
Socket
String
System V
Time
User and Group Info

Array

pop ARRAY - Pops and returns the last value of the array, shortening the array by 1.

push ARRAY,LIST - Treats ARRAY as a stack, and pushes the values of LIST onto the end of ARRAY.

shift ARRAY - Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down.

splice ARRAY,OFFSET or splice ARRAY,OFFSET,LENGTH or splice ARRAY,OFFSET,LENGTH,LIST - Removes the elements designated by OFFSET and LENGTH from an array, and replaces them with the elements of LIST, if any.

unshift ARRAY,LIST - repends list to the front of the array, and returns the new number of elements in the array.

File

chdir EXPR - Changes the working directory to EXPR, if possible. If EXPR is omitted, changes to home directory. Returns TRUE upon success, FALSE otherwise.

chmod LIST - Changes the permissions of a list of files.

chown LIST - Changes the owner (and group) of a list of files.

chroot FILENAME - Makes the named directory the new root directory for all further pathnames that begin with a "/" by your process and all its children.

fcntl FILEHANDLE,FUNCTION,SCALAR -

glob EXPR - Returns the value of EXPR with filename expansions such as the standard Unix shell /bin/sh would do.

ioctl FILEHANDLE,FUNCTION,SCALAR -

link OLDFILE,NEWFILE - Creates a new filename linked to the old filename. Returns TRUE for success, FALSE otherwise.

lstat EXPR or lstat FILEHANDLE -

mkdir FILENAME,MODE - Creates the directory specified by FILENAME, with permissions specified by MODE (as modified by umask). If it succeeds it returns TRUE, otherwise it returns FALSE and sets $! (errno).

open FILEHANDLE or open FILEHANDLE,EXPR - Opens the file whose filename is given by EXPR, and associates it with FILEHANDLE.

opendir DIRHANDLE,EXPR - Opens a directory named EXPR for processing by readdir(), telldir(), seekdir(), rewinddir(), and closedir(). Returns TRUE if successful.

readlink EXPR - Returns the value of a symbolic link, if symbolic links are implemented. If not, gives a fatal error.

rename OLDNAME,NEWNAME - Changes the name of a file. Returns 1 for success, 0 otherwise.

rmdir FILENAME - Deletes the directory specified by FILENAME if that directory is empty. If it succeeds it returns TRUE, otherwise it returns FALSE and sets $! (errno).

stat FILEHANDLE or stat EXPR - Returns a 13-element list giving the status info for a file, either the file opened via FILEHANDLE, or named by EXPR.

symlink OLDFILE,NEWFILE - Creates a new filename symbolically linked to the old filename. Returns 1 for success, 0 otherwise.

umask EXPR - Sets the umask for the process to EXPR and returns the previous value.

unlink LIST - Deletes a list of files. Returns the number of files successfully deleted.

utime LIST - Changes the access and modification times on each file of a list of files. The first two elements of the list must be the NUMERICAL access and modification times, in that order. Returns the number of files successfully changed.

Hash

delete EXPR - Deletes the specified key(s) and their associated values from a hash.

each HASH - When called in list context, returns a 2-element list consisting of the key and value for the next element of a hash, so that you can iterate over it. When called in scalar context, returns the key for only the next element in the hash.

exists EXPR - Returns TRUE if the specified hash key exists in its hash array, even if the corresponding value is undefined.

keys HASH - Returns a list consisting of all the keys of the named hash.

values HASH - Returns a list consisting of all the values of the named hash.

Input / Output

binmode FILEHANDLE - Arranges for the file to be read or written in binary mode in operating systems that distinguish between binary and text files.

close FILEHANDLE - Closes the file or pipe associated with the file handle, returning TRUE only if stdio successfully flushes buffers and closes the system file descriptor.

closedir DIRHANDLE - Closes a directory opened by opendir() and returns the success of that system call.

dbmclose HASH - Breaks the binding between a DBM file and a hash.

dbmopen HASH,DBNAME,MODE - This binds a dbm(3), ndbm(3), sdbm(3), gdbm(3), or Berkeley DB file to a hash.

die LIST - Outside an eval(), prints the value of LIST to STDERR and exits with the current value of $! (errno). If $! is 0, exits with the value of ($? >> 8) (backtick `command` status). If ($? >> 8) is 0, exits with 255. Inside an eval(), the error message is stuffed into $@ and the eval() is terminated with the undefined value.

eof FILEHANDLE - Returns 1 if the next read on FILEHANDLE will return end of file, or if FILEHANDLE is not open.

fileno FILEHANDLE - Returns the file descriptor for a filehandle.

flock FILEHANDLE,OPERATION - Calls flock(2), or an emulation of it, on FILEHANDLE. Returns TRUE for success, FALSE on failure.

format - Declare a picture format for use by the write() function.

getc FILEHANDLE - Returns the next character from the input file attached to FILEHANDLE, or the undefined value at end of file, or if there was an error.

print FILEHANDLE LIST - Prints a string or a comma-separated list of strings. Returns TRUE if successful.

printf FILEHANDLE,FORMAT,LIST or printf FORMAT,LIST -

read FILEHANDLE,SCALAR,LENGTH or read FILEHANDLE,SCALAR,LENGTH,OFFSET - Attempts to read LENGTH bytes of data into variable SCALAR from the specified FILEHANDLE.

readdir DIRHANDLE - Returns the next directory entry for a directory opened by opendir().

rewinddir DIRHANDLE - Sets the current position to the beginning of the directory for the readdir() routine on DIRHANDLE.

seek FILEHANDLE,POSITION,WHENCE - Sets FILEHANDLE's position

seekdir DIRHANDLE,POS - Sets the current position for the readdir() routine on DIRHANDLE.

select FILEHANDLE or select RBITS,WBITS,EBITS,TIMEOUT - Returns the currently selected filehandle.

syscall LIST - Calls the system call specified as the first element of the list, passing the remaining elements as arguments to the system call.

sysread FILEHANDLE,SCALAR,LENGTH or sysread FILEHANDLE,SCALAR,LENGTH,OFFSET - Attempts to read LENGTH bytes of data into variable SCALAR from the specified FILEHANDLE, using the system call read(2).

-

syswrite FILEHANDLE,SCALAR,LENGTH or syswrite FILEHANDLE,SCALAR,LENGTH,OFFSET - Attempts to write LENGTH bytes of data from variable SCALAR to the specified FILEHANDLE, using the system call write(2).

tell FILEHANDLE - Returns the current position for FILEHANDLE.

telldir DIRHANDLE - Returns the current position of the readdir() routines on DIRHANDLE.

truncate FILEHANDLE,LENGTH or truncate EXPR,LENGTH - Truncates the file opened on FILEHANDLE, or named by EXPR, to the specified length.

warn LIST - Produces a message on STDERR just like die(), but doesn't exit or throw an exception.

write FILEHANDLE or write EXPR - Writes a formatted record (possibly multi-line) to the specified FILEHANDLE, using the format associated with that file.

List

grep BLOCK LIST or grep EXPR,LIST - Evaluates the BLOCK or EXPR for each element of LIST (locally setting $_ to each element) and returns the list value consisting of those elements for which the expression evaluated to TRUE.

join EXPR,LIST - Joins the separate strings of LIST into a single string with fields separated by the value of EXPR, and returns the string.

map BLOCK LIST or map EXPR,LIST - Evaluates the BLOCK or EXPR for each element of LIST (locally setting $_ to each element) and returns the list value composed of the results of each such evaluation.

reverse LIST - In list context, returns a list value consisting of the elements of LIST in the opposite order. In scalar context, concatenates the elements of LIST, and returns a string value consisting of those bytes, but in the opposite order.

sort LIST or sort BLOCK LIST or sort SUBNAME LIST - Sorts the LIST and returns the sorted list value.

upack TEMPLATE,EXPR - Takes a string representing a structure and expands it out into a list value, returning the array value.

Miscellaneous

bless REF or bless REF,CLASSNAME - This function tells the thingy referenced by REF that it is now an object in the CLASSNAME package--or the current package if no CLASSNAME is specified

caller EXPR - Returns the context of the current subroutine call.

defined EXPR - Returns a Boolean value telling whether EXPR has a value other than the undefined value undef.

dump LABEL - This causes an immediate core dump.

eval EXPR or eval BLOCK - The value returned is the value of the last expression evaluated

exit EXPR - Evaluates EXPR and exits immediately with that value.

formline PICTURE,LIST - This is an internal function used by formats

local EXPR - A local modifies the listed variables to be local to the enclosing block, file, or eval.

my EXPR - A my() declares the listed variables to be local (lexically) to the enclosing block, file, or eval().

ref EXPR - Returns a TRUE value if EXPR is a reference, FALSE otherwise.

reset EXPR - clear all variables of a given name

scalar EXPR - Forces EXPR to be interpreted in scalar context and returns the value of EXPR.

tie VARIABLE,CLASSNAME,LIST - bind a variable to an object class

tied -

undef EXPR - Undefines the value of EXPR, which must be an lvalue.

untie VARIABLE - Breaks the binding between a variable and a package.

wantarray - Returns TRUE if the context of the currently executing subroutine is looking for a list value. Returns FALSE if the context is looking for a scalar. Returns the undefined value if the context is looking for no value (void context).

Network Info

Numeric

abs VALUE - Returns the absolute value of its argument.

atan2 Y,X - Returns the arctangent of Y/X in the range -PI to PI.

cos EXPR - Returns the cosine of EXPR (expressed in radians).

exp EXPR - Returns e (the natural logarithm base) to the power of EXPR.

hex EXPR - Interprets EXPR as a hex string and returns the corresponding value.

int EXPR - Returns the integer portion of EXPR.

log EXPR - Returns the natural logarithm (base e) of EXPR.

oct EXPR - Interprets EXPR as an octal string and returns the corresponding value.

rand EXPR - Returns a random fractional number greater than or equal to 0 and less than the value of EXPR.

sin EXPR - Returns the sine of EXPR (expressed in radians).

sqrt EXPR - Return the square root of EXPR.

srand EXPR - Sets the random number seed for the rand() operator.

Process

alarm SECONDS - Arranges to have a SIGALRM delivered to this process after the specified number of seconds have elapsed.

exec LIST or exec PROGRAM LIST - The exec() function executes a system command AND NEVER RETURNS

fork - create a new process just like this one

getpgrp PID - Returns the current process group for the specified PID.

getppid - Returns the process id of the parent process.

getpriority WHICH,WHO - Returns the current priority for a process, a process group, or a user.

kill LIST - Sends a signal to a list of processes.

pipe READHANDLE,WRITEHANDLE - Opens a pair of connected pipes like the corresponding system call.

setpgrp PID,PGRP - Sets the current process group for the specified PID, 0 for the current process.

setpriority WHICH,WHO,PRIORITY - Sets the current priority for a process, a process group, or a user.

sleep EXPR - Causes the script to sleep for EXPR seconds, or forever if no EXPR.

system LIST or system PROGRAM LIST - run a separate program

times - Returns a four-element list giving the user and system times, in seconds, for this process and the children of this process.

wait - Waits for a child process to terminate and returns the pid of the deceased process, or -1 if there are no child processes. The status is returned in $?.

waitpid PID,FLAGS - Waits for a particular child process to terminate and returns the pid of the deceased process, or -1 if there is no such child process. The status is returned in $?.

Regular Expression

pos SCALAR - find or set the offset for the last/next m//g search

quotemeta EXPR - Returns the value of EXPR with all non-alphanumeric characters backslashed.

split /PATTERN/,EXPR,LIMIT or split /PATTERN/,EXPR or split /PATTERN/ - Splits a string into an array of strings, and returns it.

study SCALAR - Takes extra time to study SCALAR ($_ if unspecified) in anticipation of doing many pattern matches on the string before it is next modified.

Socket

accept NEWSOCKET,GENERICSOCKET - Accepts an incoming socket connect

bind SOCKET,NAME - Binds a network address to a socket, just as the bind system call does. Returns TRUE if it succeeded, FALSE otherwise.

connect SOCKET,NAME - Attempts to connect to a remote socket, just as the connect system call does. Returns TRUE if it succeeded, FALSE otherwise.

getpeername SOCKET - Returns the packed sockaddr address of other end of the SOCKET connection.

getsockname SOCKET - Returns the packed sockaddr address of this end of the SOCKET connection.

getsockopt SOCKET,LEVEL,OPTNAME - Returns the socket option requested, or undef if there is an error.

listen SOCKET,QUEUESIZE - Does the same thing that the listen system call does. Returns TRUE if it succeeded, FALSE otherwise.

recv SOCKET,SCALAR,LEN,FLAGS - Receives a message on a socket. Attempts to receive LENGTH bytes of data into variable SCALAR from the specified SOCKET filehandle.

send SOCKET,MSG,FLAGS or send SOCKET,MSG,FLAGS,TO - Sends a message on a socket.

setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL - Sets the socket option requested. Returns undefined if there is an error.

shutdown SOCKET,HOW - Shuts down a socket connection in the manner indicated by HOW

socket SOCKET,DOMAIN,TYPE,PROTOCOL - Opens a socket of the specified kind and attaches it to filehandle

socketpair SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL - Creates an unnamed pair of sockets in the specified domain, of the specified type.

String

chomp VARIABLE or chomp LIST - remove a trailing record separator from a string

chop VARIABLE or chop LIST - remove the last character from a string

chr NUMBER - Returns the character represented by that NUMBER in the character set.

crypt PLAINTEXT,SALT - Encrypts a string

lc EXPR - Returns an lowercased version of EXPR.

lcfirst EXPR - Returns the value of EXPR with the first character lowercased.

length EXPR - Returns the length in bytes of the value of EXPR.

ord EXPR - Returns the numeric ascii value of the first character of EXPR.

pack TEMPLATE,LIST - convert a list into a binary representation

reverse LIST - flip a string or a list

rindex STR,SUBSTR,POSITION or rindex STR,SUBSTR - right-to-left substring search

sprintf FORMAT, LIST - formatted print into a string

substr EXPR,OFFSET or substr EXPR,OFFSET,LEN or substr EXPR,OFFSET,LEN,REPLACEMENT - get or alter a portion of a string

uc EXPR - returns upper case version of string

ucfirst EXPR - Returns the value of EXPR with the first character uppercased.

vec EXPR,OFFSET,BITS - Treats the string in EXPR as a vector of unsigned integers, and returns the value of the bit field specified by OFFSET

System V

msgctl ID,CMD,ARG -

msgget KEY,FLAGS -

msgrcv ID,VAR,SIZE,TYPE,FLAGS -

msgsnd ID,MSG,FLAGS -

semctl ID,SEMNUM,CMD,ARG -

semget KEY,NSEMS,FLAGS -

semop KEY,OPSTRING -

shmctl ID,CMD,ARG -

shmget KEY,SIZE,FLAGS -

shmread ID,VAR,POS,SIZE -

shmwrite ID,STRING,POS,SIZE -

Time

gmtime EXPR - Converts a time as returned by the time function to a 9-element array with the time localized for the standard Greenwich time zone.

localtime EXPR - Converts a time as returned by the time function to a 9-element array with the time analyzed for the local time zone.

time - Returns the number of non-leap seconds since whatever time the system considers to be the epoch

User and Group Info