root/HTTP-Server-Simple-Authen/trunk/server.pl

Revision 1754 (checked in by miyagawa, 15 years ago)

Now it works with subclasses that overrides handle_request; API change for conditional authentication

  • Property svn:keywords set to Id Revision
Line 
1 #!/usr/bin/perl -w
2 use strict;
3 use lib 'lib';
4
5 package MyServer;
6 use base qw( HTTP::Server::Simple::Authen HTTP::Server::Simple::CGI );
7
8 use Authen::Simple::Passwd;
9 sub authen_handler {
10     Authen::Simple::Passwd->new(passwd => '/etc/passwd');
11 }
12
13 sub handle_request {
14     my $self = shift;
15     my $user = $self->authenticate();
16     return unless defined $user;
17     print "Hello World";
18 }
19
20 MyServer->new->run;
21
Note: See TracBrowser for help on using the browser.