CGI::MiniFramework - CGI framework of a minimum composition.
This documentation refers to CGI::MiniFramework version 0.01
### 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;
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.
my $f = CGI::MiniFramework->new( PREFIX => 'App', DEFAULT => 'Index', DEFAULT_MODE => 'index', );
Creates and returns new CGI::MiniFramework object.
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.
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.
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.
start
The object that becomes a target is made and it is returned.
It is Getter/Setter of the $MODULE.
It is Getter/Setter of the $MODE.
It is Getter/Setter of the $ERROR_MSG.
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.
There are no known bugs in this module. Please report problems to Atsushi Kobayashi (<nekokak@cpan.org>) Patches are welcome.
Atsushi Kobayashi, <nekokak@cpan.org>
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.
To install CGI::MiniFramework, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::MiniFramework
CPAN shell
perl -MCPAN -e shell install CGI::MiniFramework
For more information on module installation, please visit the detailed CPAN module installation guide.