| Apache2-WebApp-Toolkit documentation | Contained in the Apache2-WebApp-Toolkit distribution. |
Apache2::WebApp::Plugin - Base class for WebApp Toolkit plugins
my $obj = $c->plugin('Name')->method( ... ); # Apache2::WebApp::Plugin::Name->method
or
$c->plugin('Name')->method( ... );
A simple mechanism for loading WebApp Toolkit plugins.
There are many plugins that provide additional functionality to your web application.
Apache2::WebApp::Plugin::CGI - Common methods for dealing with HTTP requests.
Apache2::WebApp::Plugin::Cookie - Common methods for creating and manipulating web browser cookies.
Apache2::WebApp::Plugin::DateTime - Common methods for dealing with Date/Time.
Apache2::WebApp::Plugin::DBI - Database interface wrapper for MySQL, PostGre, and Oracle.
Apache2::WebApp::Plugin::File - Common methods for processing and outputting files.
Apache2::WebApp::Plugin::Filters - Common methods for filtering HTTP request parameters.
Apache2::WebApp::Plugin::JSON - JSON module wrapper.
Apache2::WebApp::Plugin::Mail - Methods for sending template based multi-format e-mail.
Apache2::WebApp::Plugin::Memcached - Cache::Memcached module wrapper.
Apache2::WebApp::Plugin::Session - Provides session handling methods.
Apache2::WebApp::Plugin::Session::File - Store persistent data on the filesystem.
Apache2::WebApp::Plugin::Session::Memcached - Store persistent data using memcached (memory cache daemon).
Apache2::WebApp::Plugin::Session::MySQL - Store persistent data in a MySQL database.
Apache2::WebApp::Plugin::Validate - Common methods used for validating user input.
Perl one liner using CPAN.pm:
perl -MCPAN -e 'install Apache2::WebApp::Plugin::Name'
Use of CPAN.pm in interactive mode:
$> perl -MCPAN -e shell cpan> install Apache2::WebApp::Plugin::Name cpan> quit
Just like the manual installation of Perl modules, the user may need root access during this process to insure write permission is allowed within the intstallation directory.
Marc S. Brooks, <mbrooks@cpan.org> http://mbrooks.info
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Apache2-WebApp-Toolkit documentation | Contained in the Apache2-WebApp-Toolkit distribution. |
#----------------------------------------------------------------------------+ # # Apache2::WebApp::Plugin - Base class for WebApp Toolkit plugins # # DESCRIPTION # A simple mechanism for loading WebApp Toolkit plugins. # # AUTHOR # Marc S. Brooks <mbrooks@cpan.org> # # This module is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # #----------------------------------------------------------------------------+ package Apache2::WebApp::Plugin; use strict; use warnings; use base 'Apache2::WebApp::Base'; use Params::Validate qw( :all ); our $VERSION = 0.02; our $AUTOLOAD; #~~~~~~~~~~~~~~~~~~~~~~~~~~[ OBJECT METHODS ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #----------------------------------------------------------------------------+ # load($name) # # Include the class (plugin('class')) if it hasn't already been included. sub load { my ( $self, $name ) = validate_pos( @_, { type => OBJECT }, { type => SCALAR } ); $name =~ s/\b(\w)/\u$1/g; my $package = "Apache2::WebApp::Plugin::$name"; unless ( $package->can('isa') ) { eval "require $package"; $self->error("Failed to load package '$package': $@") if $@; } if ( $package->can('new') ) { $self->{ uc($name) } = $package->new; } return $self->{ uc($name) }; } #----------------------------------------------------------------------------+ # AUTOLOAD() # # Provides pseudo-methods for read-only access to various internal methods. sub AUTOLOAD { my $self = shift; my $method; ($method = $AUTOLOAD) =~ s/.*:://g; return if ($method eq 'DESTROY'); return $self->{ uc($method) }; } 1; __END__