Bric::App::Callback - The Bricolage callback base class


use Bric::App::Callback::Foo;
use Bric::App::Callback::Bar;


This is the base class from which all Bricolage callback classes inherit. Callback classes are created by simply subclassing Bric::App::Callback, registering themselves, and then creating callback methods using the Callback attribute on methods:

sub save : Callback {
    my $cb = shift;
    # the saving.

See the subclasses for examples.

Class Interface

Class Methods


my $lang = Bric::App::Callback->lang;
$lang = $cb->lang;

Returns the currently active Bric::Util::Language localization object. Can also be used as an instance method.


my $cache = Bric::App::Callback->cache;
$cache = $cb->cache;

Returns the currently active Bric::App::Cache object. Can also be used as an instance method.

Instance Methods



Sets the URL to redirect to after all callbacks have finished executing, but before the request is turned over to Mason for processing.


$cb->add_message( 'Template "[_1]" deployed.', $template->get_uri );

Add a status message to be displayed to the user. Pass in a list of values suitable for passing through $lang->maketext.


$cb->raise_status( HTTP_FORBIDDEN, 'Ya canna do that, captain!' );

In a non-Ajax request, this method simply passes the error message on to Bric::App::Util::add_msg(). In an Ajax request, however, it rolls back the current transaction sends the error message to the browser, along with the status, and aborts the request. This is useful for situations where a requested action cannot be carried out for one reason or another, such as the user not having the appropriate permission.


$cb->raise_conflict( q{You cannot move a story from a desk it's not on.} );

A shortcut for calling raise_status() and passing HTTP_CONFLICT as the furst argument.


$cb->raise_forbidden( q{I can't let you do that, Dave.} );

A shortcut for calling raise_status() and passing HTTP_FORBIDDEN as the furst argument.


Scott Lanning <>

See Also


This module provides a generalized parameter triggering callback architecture. Bric::App::Callback inherits from its Params::Callback class.


This module provides the interface for adding callback processing to Mason requests.


This module handles all Bricolage Apache requests, and loads all of the callback modules.

Copyright and License

Copyright (c) 2003-2004 World Health Organization and Kineticode, Inc. See Bric::License for complete license terms and conditions.