The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

OpenFrame::Application - Base class for all OpenFrame applications

SYNOPSIS

  package MyCompany::MyApplication;

  use OpenFrame::Application;
  use base qw (OpenFrame::Application);

  our $epoints = { example => ['param'] };

  sub default {
    my $self = shift;
    my $session = shift;
    my $request = shift;
    my $config = shift;
    $self->{message} = "no parameters for this call";
  }

  sub example {
    my $self = shift;
    my $session = shift;
    my $request = shift;
    my $config = shift;
    $self->{message} = "parameters are passed";
  }

DESCRIPTION

OpenFrame::Application is the base class for all OpenFrame applications.

To add functionality to the application, we entry points are used. To explain what we have done here, is to explain the OpenFrame application system. Every application has a list of entry points. Entry points define what is required to trigger certain states within the application. The requirements are parameters passed on the command line. For every entry point, there should be a subroutine which defines what happens at that point.

The entry points are passed itself, the session, an abstract request, and per-application configuration.

Inside your templating system, after this application gets executed, you should be able to do something like the code below, and have it display the message in the appropriate place.

  <html>
    <head>
     <title>My First Application</title>
    </head>
    <body>
      Message is: [% application.myapp.message %]
    </body>
  </html>

You'll notice that the templating system wants points to something called 'application.myapp.message'. The reason for this is pretty simple. The templating system is always provided with the users session as parameters. The application is stored persistantly in the location given by the name field of the config file. So if you point your templating system at application.<name>.<field> it will get the correct field of the correct application.

AUTHOR

James A. Duncan <jduncan@fotango.com>

COPYRIGHT

Copyright (C) 2001, Fotango Ltd.

This module is free software; you can redistribute it or modify it under the same terms as Perl itself.