NAME
Contentment - A Mason/Perl-based content management system
DESCRIPTION
General configuration information and some general-purpose methods can be found in this module.
- $conf = Contentment->configuration
-
Reads the configuration files ETC_DIR/Contentment.defaults.conf and ETC_DIR/Contentment.conf.
- my $module = Contentment->security
-
Fetch the configured security module.
- my $context = Contentment->context
-
This method returns the singleton object for Contentment::Context.
- my $result = Contentment->run_plugin($plugin, @args)
-
This method loads the given plugin
$plugin
and runs it with the given@args
and returns the result$result
. The$plugin
variable is a complete package and method name. The method name is stripped and the package name is "used". Then, the method is called. - $result = Contentment->capture_streams($in, $out, $code, @args)
-
This is a helpful method for redirecting input and output for some bit of code. The
$in
must be a readable file handle and$out
must be a writable file handle. The$code
is a CODE reference to be run.First, the
STDIN
file handle will be saved and then redirected to use$in
. TheSTDOUT
file handle will be saved and then redirected to use$out
.Next, the
$code
will be run in this environment and any additional arguments given will be based to the subroutine.Finally,
STDIN
andSTDOUT
are restored and any result returned by$code
is returned. If an exception is raised while running$code
, then the file handles are safely restored before this method rethrows the exception. - $cache = $context->cache($namespace)
-
Returns a Cache::Cache interface that can be used to cache generated output, etc.
- Contentment->call_hooks($dir, @args)
-
Run the appropriate generator on all files in /content/hooks/$dir and all subdirectories. The given
@args
are passed each time.The first hook will be given the input from the current
STDIN
and the last hook will generate output straight to the currentSTDOUT
. In between, the previous hooks output toSTDOUT
becomes the next hooks input onSTDIN
.Logs, but otherwise ignores, any errors that occur.
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@users.sourceforge.net>
COPYRIGHT AND LICENSE
Copyright 2005 Andrew Sterling Hanenkamp. All Rights Reserved.
Contentment is distributed and licensed under the same terms as Perl itself.