X-Git-Url: http://git.shiar.net/gitweb.cgi/perl/plp/.git/blobdiff_plain/0bf81ada5160669ea620d0c8030829f0bbdfd311..a4dab1e4ec41edfa4ba07128f9ee5ff97a53c3ee:/PLP/HowTo.pod?ds=sidebyside diff --git a/PLP/HowTo.pod b/PLP/HowTo.pod index 93bacb2..e86e68f 100644 --- a/PLP/HowTo.pod +++ b/PLP/HowTo.pod @@ -39,7 +39,8 @@ used in this document are available (for free) at CPAN: http://search.cpan.org/ Use DBI, and alternatively, one of the many simplifying modules. Drivers for DBI are in the DBD:: namespace. DBI loads the driver automatically, but it has -to be available. +to be available. If you need a fast full-featured file-base database, use +DBD::SQLite, it's the instant database :). <: use DBIx::Simple; # and read its documentation for examples. @@ -64,10 +65,38 @@ Use CGI.pm, which can be used with CGI::Upload to make things easier my $page = get 'http://foo.com/bar.html'; :> +=head2 implement basic authentication + +This only works with PLP under mod_perl. For CGI installations, it's useless. + + <: + use MIME::Base64; + + BEGIN { + my $r = Apache->request; + + my ($type, $login) = split / /, $r->header_in('Authorization'); + my ($user, $pass) = split /:/, decode_base64 $login, 2; + + unless ($user eq 'foo' and $pass eq 'bar') { + $header{Status} = '401 Authorization Required'; + $header{WWW_Authenticate} = 'Basic realm="Top secret :)"'; + print '