NAME

Maplat::Web - the Maplat WebGUI

SYNOPSIS

The webgui module is the one responsible for loading all actual rendering modules, dispatches calls and handles the browser requests.

my $config = XMLin($configfile,
                  ForceArray => [ 'module', 'redirect', 'menu', 'view', 'userlevel' ],);

$APPNAME = $config->{appname};
print "Changing application name to '$APPNAME'\n\n";

my @modlist = @{$config->{module}};
my $webserver = MaplatWeb->new($config->{server}->{port});
$webserver->startconfig($config->{server});

foreach my $module (@modlist) {
    $webserver->configure($module->{modname}, $module->{pm}, %{$module->{options}});
}


$webserver->endconfig();

# Everything ready to run - notify user
$webserver->run();

DESCRIPTION

This webgui is "the root of all evil". It loads and configures the rendering modules, dispatches browser requests and callbacks/hooks and renders the occasional 404 error messages if no applicable module for the the browsers request is found.

WARNING

Warning! If you are upgrading from 0.91 or lower, beware: There are a few incompatible changes in the server initialization! Please see the Example in the tarball for details.

Configuration and Startup

Configuration is done in stages from the main application, after new(), the first thing to call is startconfig() to prepare the webserver for module configuration. It takes one argument, the maplat specific part of the webserver configuration.

After that, for each module to load, configure() is called, during which the module is loaded and configured.

Next thing is to call endconfig(), which notifies the webserver that all required modules are loaded (the webserver then automatically calls reload() to load all cached data).

After a call to prepare() and an optional call to print_banner() (which the author strongly recommends *grin*) the webserver is ready to handle browser requests.

SEE ALSO

Maplat::Worker

Please also take a look in the example provided in the tarball available on CPAN.

AUTHOR

Rene Schickbauer, <rene.schickbauer@magnapowertrain.com>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Rene Schickbauer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.