CAM::App

Web database application framework
Download

CAM::App Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Clotho Advanced Media Inc.
  • Publisher web site:
  • http://search.cpan.org/~clotho/

CAM::App Tags


CAM::App Description

Web database application framework CAM::App is a web database application framework.SYNOPSISYou can either directly instantiate this module, or create a subclass, creating overridden methods as needed.Direct use: use CAM::App; require "Config.pm"; # user-edited config hash my $app = CAM::App->new(Config->new(), CGI->new()); $app->authenticate() or $app->error("Login failed"); my $tmpl = $app->template("message.tmpl"); my $ans = $app->getCGI()->param('ans'); if (!$ans) { $tmpl->addParams(msg => "What is your favorite color?"); } elsif ($ans eq "blue") { $tmpl->addParams(msg => "Very good."); } else { $tmpl->addParams(msg => "AIIEEEEE!"); } $tmpl->print();Subclass: (then use just like above, replacing CAM::App with my::App) package my::App; use CAM::App; @ISA = qw(CAM::App); sub init { my $self = shift; my $basedir = ".."; $self->{config}->{cgidir} = "."; $self->{config}->{basedir} = $basedir; $self->{config}->{htmldir} = "$basedir/html"; $self->{config}->{templatedir} = "$basedir/tmpls"; $self->{config}->{libdir} = "$basedir/lib"; $self->{config}->{sqldir} = "$basedir/lib/sql"; $self->{config}->{error_template} = "error_tmpl.html"; $self->addDB("App", "live", "dbi:mysql:database=app", "me", "mypass"); $self->addDB("App", "dev", "dbi:mysql:database=appdev", "me", "mypass"); return $self->SUPER::init(); } sub authenticate { my $self = shift; return(($self->getCGI()->param('passwd') || "") eq "secret"); } sub selectDB { my ($self, $params) = @_; my $key = $self->{config}->{myURL} =~ m,^http://dev.foo.com/, ? "dev" : "live"; return @{$params->{$key}}; }CAM::App is a framework for web-based, database-driven applications. This package abstracts away a lot of the tedious interaction with the application configuration state. It is quite generic, and is designed to be subclassed with more specific functions overriding its behavior. Requirements: · Perl


CAM::App Related Software