The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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 $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. The STDOUT 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 and STDOUT 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.

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 current STDOUT. In between, the previous hooks output to STDOUT becomes the next hooks input on STDIN.

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.