CGI::Framework

CGI::Framework is a simple-to-use, lightweight web CGI framework.
Download

CGI::Framework Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Mina Naguib
  • Publisher web site:
  • http://search.cpan.org/~mnaguib/EasyTCP-0.26/EasyTCP.pm

CGI::Framework Tags


CGI::Framework Description

CGI::Framework is a simple-to-use, lightweight web CGI framework. CGI::Framework is a simple-to-use, lightweight web CGI framework. It is primarily a glue between HTML::Template, CGI::Session, CGI, Locale::Maketext and some magic.SYNOPSIS use CGI::Framework; use vars qw($f); # # Setup the initial framework instance # $f = new CGI::Framework ( sessions_dir => "/tmp", templates_dir => "/home/stuff/myproject/templates", initial_template => "enterusername", ) || die "Failed to create a new CGI::Framework instance: $@n"; # # Get the instance to "do it's magic", including handling the verification of the # just-submitting form, preparing the data for the upcoming template to be sent, and any cleanup # $f->dispatch(); # # This sub is automatically called after the "enterusername" template is submitted by the client # sub validate_enterusername { my $f = shift; if (!$f->form("username")) { $f->add_error("You must enter a username"); } elsif (!$f->form("password")) { $f->add_error("You must enter your password"); } else { if ($f->form("username") eq "mina" && $f->form("password") eq "verysecret") { $f->session("username", "mina"); $f->session("authenticated", "1"); } else { $f->add_error("Authentication failed"); } } } # # This sub is automatically called before the "mainmenu" template is sent # sub pre_mainmenu { my $f = shift; $f->assert_session("authenticated"); $f->html("somevariable", "somevalue"); $f->html("name", $f->session("username")); } # # This sub is automatically called after the "logout" template is sent # sub post_logout { my $f = shift; $f->clear_session(); } Requirements: · Perl


CGI::Framework Related Software