Atsushi Kobayashi > CGI-MiniFramework > CGI::MiniFramework

Download:
CGI-MiniFramework-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

CGI::MiniFramework - CGI framework of a minimum composition.

VERSION ^

This documentation refers to CGI::MiniFramework version 0.01

SYNOPSIS ^

    ### In "webapp.cgi"...
    #! /usr/bin/perl
    
    use strict;
    use warnings;
    use CGI::MiniFramework;

    my $f = CGI::MiniFramework->new(
        PREFIX       => 'App',
        DEFAULT      => 'WebApp',
        DEFAULT_MODE => 'index',
    );
    print $f->run();

    ### Dispatch Module...
    package App::WebApp
    ....
    sub new {
        my($class,$self)=(shift,{@_});
        bless($self,$class);
        $self;
    }

    sub setup {
        my $self = shift;
        my $mode = shift;
        my %run_mode = (
            'index' => 'do_index',
        );
        return $run_mode{$mode};
    }

    sub do_index {
        return "Welcom CGI::MiniFramework !!";
    }
    1;

DESCRIPTION ^

CGI::MiniFramework is CGI framework of a minimum composition. CGI::MiniFramework doesn't depend on other modules excluding strict and warning. You copies it onto an arbitrary place if you want to use this. You ended the preparation to use this framework only by this.

The easy one is easily done. Please do it difficult by another framework.

METHOD ^

new

  my $f = CGI::MiniFramework->new(
      PREFIX       => 'App',
      DEFAULT      => 'Index',
      DEFAULT_MODE => 'index',
  );

Creates and returns new CGI::MiniFramework object.

OPTIONS

PREFIX is a definite article applied to the name of the module. DEFAULT is a name of the module used by default. DEFAULT_MODE is a mode executed by default.

run

  print $f->run();

The application is executed. The return value of the method of the run must be output data.

This method executes your script in the next order.

The First ,setup method. You must are preparing setup method. This method should return run mode method. The Second ,pre_run method If you are preparing. It is possible to preprocess it by this pre_run method. The Third ,run mode method. This run mode method is your main process. The Fourth ,teardown method If you are preparing. It is possible to postprocessing it by this teardown method. If error_mode method is set when it makes an error of your run mode method, it is executed.

init

The module and the mode are set. If DEFAULT is defined, it is set. If DEFAULT_MODE is defined, it is set. If DEFAULT_MODE is not defined, start becomes the mode of default.

get_object

The object that becomes a target is made and it is returned.

module

It is Getter/Setter of the $MODULE.

mode

It is Getter/Setter of the $MODE.

error

It is Getter/Setter of the $ERROR_MSG.

DEPENDENCIES ^

strict warnings

However,If you don't want to use even it, you can exclude it. Though I don't think that it is good.

BUGS AND LIMITATIONS ^

There are no known bugs in this module. Please report problems to Atsushi Kobayashi (<nekokak@cpan.org>) Patches are welcome.

AUTHOR ^

Atsushi Kobayashi, <nekokak@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2005 by Atsushi Kobayashi (<nekokak at users.sourceforge.jp>). All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

syntax highlighting: