| CAS-Apache documentation | Contained in the CAS-Apache distribution. |
CAS::Apache::UserForms - The great new CAS::Apache::UserForms!
Version 0.01
Quick summary of what the module does.
Perhaps a little code snippet.
use CAS::Apache::UserForms;
my $foo = CAS::Apache::UserForms->new();
...
A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module.
Sean P. Quinlan, <gilant at gmail.com>
Please report any bugs or feature requests to
bug-cas-apache-userforms at rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CAS-Apache.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc CAS::Apache
You can also look for information at:
Copyright 2006 Sean P. Quinlan, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| CAS-Apache documentation | Contained in the CAS-Apache distribution. |
package CAS::Apache::UserForms; use warnings FATAL => 'all', NONFATAL => 'redefine'; use strict;
our $VERSION = '0.01'; use Apache2::Const qw(OK SERVER_ERROR REDIRECT); use base qw(CAS::Apache); use CAS::Apache::Auth ();
sub handler { my $apache2 = shift; die unless ref $apache2; my $request = $apache2->uri(); die unless $request; $request =~ m{/(\w+)$}; my $page = $1; unless ($page) { die "Unable to determine page requested in $request"; } # unless it's a CAS page my $CR_gen_response = \&{$page}; unless (defined &$CR_gen_response) { die "$page is not available through __PACKAGE__"; } # see if method is defined in this namespace # $apache2->unparsed_uri to find args $apache2->content_type('text/html'); my ($status, $html) = &$CR_gen_response($apache2); return $status unless $status == OK; print $html; # warn "HTML printed\n"; return OK; } # handler sub welcome { my $apache2 = shift || die 'Request object required'; my $cgi = CGI->new; my $html = $cgi->start_html("CAS default welcome page"); $html .= <<HTML; <h1>Welcome to the Central Authorization Server</h1> HTML $html .= $cgi->end_html; return (OK, $html); } # welcome sub preferences { my $apache2 = shift || die 'Request object required'; my $cgi = CGI->new; my $html = $cgi->start_html("Foo"); $html .= <<HTML; <h1>Bar</h1> HTML $html .= $cgi->end_html; return (OK, $html); } # preferences sub forgot_password { my $apache2 = shift || die 'Request object required'; my $cgi = CGI->new; my $html = $cgi->start_html("Foo"); $html .= <<HTML; <h1>Bar</h1> HTML $html .= $cgi->end_html; return (OK, $html); } # forgot_password sub edit_account { my $apache2 = shift || die 'Request object required'; my $cgi = CGI->new; my $user_table = _gen_user_table($cgi); my $html = $cgi->start_html("Foo"); $html .= <<HTML; <h1>Bar</h1> HTML $html .= $cgi->end_html; return (OK, $html); } # edit_account ## ## Support functions ## sub _gen_user_table { my $cgi = shift; my $username = $cgi->textfield(-name => 'Username', -size => 12, -maxlength => 12); my $password = $cgi->textfield(-name => 'Username', -size => 12, -maxlength => 12); my $check_pass = $cgi->textfield(-name => 'Username', -size => 12, -maxlength => 12); my $table = <<HTML; <table class="form_table" id="user_table"> <tr id="username_row"><td class="left"> <span class="bold">Choose Your Username:</span><br /> <span class="small">(5-12 characters)</span> </td><td class="right"> $username </td></tr> HTML } # _gen_user_table
1; # End of CAS::Apache::UserForms