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();

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


$webserver->endconfig();
$webserver->prepare();

# Everything ready to run - notify user
$webserver->print_banner;
while(1) {
    my $workCount = $webserver->run();
    if(!$workCount) {
        sleep(0.1);
    }
}

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.

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.

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.

This is done in a while loop or similar calling run().

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.