CGI::ACL - Decide whether to allow a client to run this script
Version 0.04
Does what it says on the tin.
use CGI::Lingua; use CGI::ACL; my $acl = CGI::ACL->new(); # ... my $denied = $acl->all_denied(info => CGI::Lingua->new(supported => 'en'));
Creates a CGI::ACL object.
Give an IP (or CIDR) that we allow to connect to us
use CGI::ACL; # Allow Google to connect to us my $acl = CGI::ACL->new()->allow_ip(ip => '8.35.80.39');
Give a country, or a reference to a list of countries, that we will not allow to access us
use CGI::ACL; # Don't allow the UK to connect to us my $acl = CGI::ACL->new()->deny_country('GB'); # Don't allow any countries to connect to us (a sort of 'default deny') my $acl = CGI::ACL->new()->deny_country('*');
Give a country, or a reference to a list of countries, that we will allow to access us
use CGI::ACL; # Allow only the UK and US to connect to us my @allow_list = ('GB', 'US'); my $acl = CGI::ACL->new()->deny_country('*')->allow_country(country => \@allow_list);
If any of the restrictions return false then return false, which should allow access. Note that by default localhost isn't allowed access, call allow_ip('127.0.0.1') to enable it.
use CGI::Lingua; use CGI::ACL; # Allow Google to connect to us my $acl = CGI::ACL->new()->allow_ip(ip => '8.35.80.39'); if($acl->all_denied()) { print 'You are not allowed to view this site'; return; } $acl = CGI::ACL->new()->deny_country(country => 'br'); if($acl->all_denied(lingua => CGI::Lingua->new(supported => ['en']))) { print 'Brazilians cannot view this site for now'; return; }
Nigel Horne, <njh at bandsman.co.uk>
<njh at bandsman.co.uk>
Please report any bugs or feature requests to bug-cgi-acl at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-ACL. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-cgi-acl at rt.cpan.org
CGI::Lingua
You can find documentation for this module with the perldoc command.
perldoc CGI::ACL
You can also look for information at:
MetaCPAN
https://metacpan.org/release/CGI-ACL
RT: CPAN's request tracker
https://rt.cpan.org/NoAuth/Bugs.html?Dist=CGI-ACL
CPANTS
http://cpants.cpanauthors.org/dist/CGI-ACL
CPAN Testers' Matrix
http://matrix.cpantesters.org/?dist=CGI-ACL
CPAN Ratings
http://cpanratings.perl.org/d/CGI-ACL
CPAN Testers Dependencies
http://deps.cpantesters.org/?module=CGI::ACL
Copyright 2017-2021 Nigel Horne.
This program is released under the following licence: GPL2
To install CGI::ACL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::ACL
CPAN shell
perl -MCPAN -e shell install CGI::ACL
For more information on module installation, please visit the detailed CPAN module installation guide.