Plexus Support Routines

plexus.pl

This outlines the support routines available in plexus.pl.

&error

&error($status, $msg)

Where $status is defined in the config file in %code. $msg is an arbitrary message to be included in the output.

&debug

&debug($msg)

&debug places the $msg in /tmp/plexus.debug if the $debug variable is true (defined in the config file). It's not very efficient and should only be used for debugging.

decode.pl

This outlines the support routines available in decode.pl.

&loadmask

&loadmask(*image)

Loads the data pointed to by $image{'filename'} into $image{'bits'} for use by &pixel. The $image{'width'} and $image{'height'} elements must be set before the call. The element $image{'scanlen'} is also returned.

&pixel

&pixel(*image, $x, $y)

Returns the bit at $x,$y in %image. Must have been already been loaded by &loadmask or equivalent.

&region

&region($file, $width, $height, $x, $y)

Loads the image pointed to by $file and returns the pixel value at $x,$y. The data from $file is cached for performance.

grep.pl

This outlines the support routines available in grep.pl.

&grep

&grep($matched, $flags, $pat, *FH)

Iterates over the data stream FH looking for $pat. On matches (inverted by the v flag) it calls the routine pointed to by $matched which has access to $_. If $matched returns true the grep is halted at the current point in the input stream. The $flags available are:

i
Ignore case in pattern match.
v
Reverse the sense of the pattern test (match lines not containing $pat).
p
Paragraph mode ($_ contains the surrounding paragraph if any line matches).

mime.pl

This outlines the support routines available in mime.pl.

&MIME_header

&MIME_header($status, $content)

Outputs the MIME headers required for HTTP/1.0. In addition to the standard headers (Date, Server, MIME-version, Content-type) any additional headers in %out_headers are output (Last-Modified and Content-encoding are the most common ones).

&fmt_date

&fmt_date($time)

Returns a MIME compliant formatted date string given $time in seconds since the epoch.

&parse_headers

&parse_headers(*headers)

Reads from <NS> and processes RFC822 mail headers into an internal format in %headers.

&add_header

&add_header(*headers, $header_string)

Parses $header_string into the internal header format stored in %headers. This is mostly used for adding headers to %out_headers that is used by &MIME_headers.

&unparse_headers

&unparse_headers(*headers)

Outputs RFC822 compliant headers from the internal format in %headers.

________________________________________

Tony Sanders