Skip to content

vti/plack-middleware-antibot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Plack::Middleware::Antibot - Prevent bots from submitting forms

SYNOPSIS

use Plack::Builder;

my $app = { ... };

builder {
    enable 'Antibot', filters => [qw/FakeField TooFast/];
    $app;
};

DESCRIPTION

Plack::Middleware::Antibot is a Plack middleware that prevents bots from submitting forms. Every filter implements its own checks, so see their documentation.

Plack::Middleware::Antibot uses scoring system (0 to 1) to determine if the client is a bot. Thus it can be configured to match any needs.

$env

Some filters set additional $env keys all prefixed with antibot.. For example TextCaptcha filter sets antibot.text_captcha to be shown to the user.

Options

max_score

When accumulated score reaches this amount, no more filters are run and bot is detected. 0.8 by default.

filters

enable 'Antibot', filters => ['FakeField'];

To specify filter arguments instead of a filter name pass an array references:

enable 'Antibot', filters => [['FakeField', field_name => 'my_fake_field']];

fall_through

enable 'Antibot', filters => ['FakeField'], fall_through => 1;

Sometimes it is needed to process detected bot yourself. This way in case of detection $env's key antibot.detected will be set.

Available filters

ISA

Plack::Middleware

METHODS

prepare_app

call($env)

INHERITED METHODS

wrap($app, @args)

AUTHOR

Viacheslav Tykhanovskyi, viacheslav.t@gmail.com

COPYRIGHT AND LICENSE

Copyright (C) 2015, Viacheslav Tykhanovskyi

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.