Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Since I'm sitting in the mod_perl handlers talk at ApacheCon 2003 (being given by Rich Bowen, author of Acme::Apache::Werewolf), your request is granted:

package Acme::Apache::ThereCastle; use strict; use Apache::Constants qw(:common); use IP::Country::Fast; + use vars qw($VERSION); $VERSION = '1.00'; + sub handler { my $r = shift; my $castle = $r->dir_config('CastleHome'); + my $whois = IP::Country::Fast->new(); my $country = $whois->inet_atocc($r->get_remote_host); return FORBIDDEN unless $country eq $castle; return OK; } + =head1 NAME + Acme::Apache::ThereCastle + =head1 SYNOPSIS + <Directory /transylvania> PerlAccessHandler Acme::Apache::ThereCastle PerlSetVar CastleHome RO </Directory> =head1 DESCRIPTION This mod_perl handler performs the important function of only allowing people to access a directory from the right part of the world. =head1 USAGE In your configuration file, put the following configuration <Directory /transylvania> PerlAccessHandler Acme::Apache::ThereCastle PerlSetVar CastleHome RO </directory> Set the CastleHome variable to match the country which should have access to your protected directory. This will keep the peasants from storming your castle. =head1 AUTHOR Michael Kellen =head1 COPYRIGHT This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =head1 SEE ALSO Acme::Apache::Werewolf IP::Country Young Frankenstein (1974) =cut 1;

My parents just came back from a planet where the dominant life form had no
bilateral symmetry, and all I got was this stupid F-Shirt.

In reply to Acme::Apache::ThereCastle by idsfa
in thread Acme::Apache::Werewolf by rob_au

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2023-02-08 20:01 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (43 votes). Check out past polls.