NAME

Bric::App::Util - A class to house general application functions.

VERSION

$Revision: 1.15.4.1 $

DATE

$Date: 2003/03/12 16:20:47 $

SYNOPSIS

use Bric::App::Util;

DESCRIPTION

Utility functions.

INTERFACE

Constructors

NONE

Destructors

Public Class Methods

(1 || undef) = add_msg($txt)

Add a new warning message to the current list of messages.

Throws:

NONE

Side Effects:

Notes:

NONE

$txt = get_msg($num)
(@txt_list || $txt_list) = get_msg()

Return warning message number '$num' or if $num is not given return all error messages.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

($txt || undef) = next_msg

Returns the next warning message in the list. If there are no more messages, it will return undef.

Throws:

NONE

Side Effects:

Notes:

NONE

$num = num_msg

Returns the current number of warning messages.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

clear_msg

Clears out all the error messages remaining. This should be called after all messages have been processed.

Throws:

NONE

Side Effects:

Notes:

NONE

my $aref = mk_aref($arg)

Returns an array reference. If $arg is an anonymous array, it is simply returned. If it's a defined scalar, it's returned as the single value in an anonymous array. If it's undef, an empty anonymous array will be returned.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

my $value = get_pref($pref_name)

Returns a preference value.

Throws:

Side Effects: NONE.

Notes: Uses Bric::Util::Pref->lookup_val() internally.

my $pkg = get_package_name

Returns the package name given a short name.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

(1 || 0) = set_redirect($loc)
$loc = get_redirect
$loc = del_redirect

Get/Set/Delete a redirect to happen during the next page load that includes the 'header.mc' header element.

Throws:

NONE

Side Effects:

Notes:

This only works with pages that use the 'header.mc' element.

(1 || 0) = do_queued_redirect

If there is a redirected set, then redirect the browser, otherwise return.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

(1 || 0) = redirect

Redirect to a different location.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

(1 || 0) = redirect_onload()

Uses a JavaScript function call to redirect the browser to a different location. Will not clear out the buffer, first, so stuff sent ahead will still draw in the browser.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

log_history($args)

Log the current URL for historical purposes.

Throws:

NONE

Side Effects:

Populates the history key of the session data.

Notes:

NONE

$uri = last_page($n);

Grab the $n-th page visited. Argument $n defaults to 1, or the very last page (A $n value of 0 is the current page). Only MAX_HISTORY pages are saved.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$uri = pop_page;

Grab the $n-th page visited. Argument $n defaults to 1, or the very last page (A $n value of 0 is the current page). Only MAX_HISTORY pages are saved.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

Public Instance Methods

NONE

Private Methods

NONE

Private Class Methods

NONE

Private Instance Methods

NONE

NOTES

NONE

AUTHOR

Garth Webb <garth@perijove.com> David Wheeler <david@wheeler.net>

SEE ALSO

perl, Bric