NAME
Modwheel - Very extensible publishing-system
SYNOPSIS
A CGI session of Modwheel can be written like this:
use Modwheel::Session;
use IO::Handle;
use CGI;
*STDOUT->autoflush( );
my $modwheel_config = {
prefix => '/opt/modwheel',
configfile => 'modwheelcfg.yml',
site => 'modwheeltest',
locale => 'en_EN',
};
my ($modwheel, $db, $user, $object, $template) =
modwheel_session($modwheel_config, qw(db user template object));
$db->connect or exit;
# A user-session can also be created, if there is none, the session is anonymous.
#$user->login($username, $password);
# The page is the page to process, it has to be in the templatedir directory.
my $page = shift @ARGV || 'index.html';
my $directory_id = $db->path_to_id($directory_path);
$directory_id ||= Modwheel::Object::MW_TREE_ROOT;
my $cgi = new CGI;
$template->init(input => $page, parent => $directory_id, param => $cgi);
print $template->process();
$db->disconnect;
DESCRIPTION
Modwheel is a publishing system for use with web, print, TeX, or whatever medium you have a need to publish in. It is designed to be very extensible and will in the future have drop-in support for several relational databases and templating systems.
Modwheel is currently in a very early alpha development stage.
The current development version of Modwheel should work with MySQL/PostgreSQL and the TemplateToolkit, although porting to other databases or templating systems. shouldn't be much work.
CONSTRUCTOR
Modwheel->new()
-
Creates a new Modwheel object.
Arguments:
It requires a hash of configuration options as argument. The configuration keys are:
prefix - The base Modwheel directory. (i.e /opt/modwheel) configfile - Name of the configuration file. (i.e config/modwheelconfig.yml) logmode - Where log messages goes. Can be stderr, apache, or off. site - The site to use. Must have a corresponding site directive in the config file. locale - The locale to use. (i.e en_EN) debug - Turn on debugging features. apache - Apache request object, required if logmode is apache.
Returns:
A new Modwheel object if everything was OK. Returns no value if there was an error.
ACCESSORS
$modwheel->debug()
-
Sets the debug status to either on or off. (1/0). If used without an argument returns the current debug status.
$modwheel->logmode()
-
How to log errors and warnings.
$modwheel->set_logmode($mode)
-
Sets the current logmode. Can be: stderr, apache or off. If logmode is apache, the apache request object must be set with set_apache. If logmode is off no logging will happen, but error() will still be set on error.
$modwheel->prefix()
-
Where to search for relative files.
$modwheel->set_prefix($prefix)
-
Set the current prefix.
- %{
$modwheel->config()
} -
The configuration data structure returned by YAML. Returns hash reference.
$modwheel->set_config($href)
-
Save the configuration data structure.
$modwheel->configfile()
-
The YAML configuration file to use.
$modwheel->set_configfile($file)
-
Set the YAML configuration file to use.
$modwheel->configcachetype($type)
-
Not yet implemented.
$modwheel->site()
-
The name of the current site to use. This is the name used when getting site configuration with siteconfig(). If no site is specified, it uses the defaultsite specified in the global section of the configuration.
$modwheel->set_site($site)
-
Set the current site.
- {
$modwheel->siteconfig()
-
Returns the current siteconfig using the site() name..
- $r =
$modwheel->apache()
-
We use the log_error method in this object to log errors and warning if we are running under the Apache environment and logmode is set to 'apache'.
$modwheel->set_apache(Apache::*$r)
-
Save the apache request object to use.
$modwheel->error()
-
Holds the last error string passed to log().
$modwheel->locale()
-
The locale to use.
INSTANCE METHODS
$modwheel->set_locale($locale)
-
Sets the current locale using POSIX::setlocale.
$modwheel->setup_locale_globally()
-
If no custom locale is passed when creating a Modwheel object, it sets up the locale using either the locale specified in the current siteconfig or the locale specified in the global section of the configuration file.
$modwheel->parseconfig()
-
Example:
$modwheel->set_config("/opt/modwheel/testconfig.yml"); my $config = $modwheel->parseconfig(); $modwheel->set_config($config);
We use YAML for parsing our configuration file specified in configfile(). Exits if the configuration file does not exist. Returns: Hashref to the data structure returned by YAML::LoadFile.
$modwheel->dumpconfig()
-
Dumps a scalar string representation of the configurations YAML data structure.
$modwheel->logerror(@strings)
-
Log an error.
$modwheel->logwarn(@strings)
-
Log a warning.
$modwheel->loginform(@strings)
-
Log some informative text.
$modwheel->log(string facility, string logstr)
-
The private logging function, shouldnÕt be used directly. Use the logerror/logwarn/loginform functions instead.
$modwheel->throw($exception)
-
Throw an exception. Adds the exception to the exceptions array.
$modwheel->exception()
-
Pop a exception off the exceptions array.
$modwheel->catch($exception)
-
Search the exceptions array for an exception. Returns 1 if found and 0 if not found.
$modwheel->catch_like($regex)
-
Like catch() but searches the exceptions array by using regular expression.
EXPORT
None.
HISTORY
SEE ALSO
The README included in the Modwheel distribution.
The Modwheel website: http://www.0x61736b.net/Modwheel/
AUTHORS
Ask Solem, ask@0x61736b.net.
COPYRIGHT, LICENSE
Copyright (C) 2007 by Ask Solem ask@0x61736b.net
.
All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 617:
Non-ASCII character seen before =encoding in 'shouldnÕt'. Assuming CP1252