WWW::SolveMedia - an interface to the Solve Media puzzle API
use WWW::SolveMedia; my $c = WWW::SolveMedia->new( 'my challenge key', 'my verification key', 'my hash key' ); # output widget print $c->get_html(); # check answer my $result = $c->check_answer( $ENV{REMOTE_ADDR}, $challenge, $response ); if( $result->{is_valid} ){ print "Yay!"; }else{ print "Dang it :-("; }
A Solve Media Puzzle can determine whether the user is a computer or human. It is typically used on websites to prevent abuse and block bots.
Create a new object. You need to pass in your Solve Media API keys (available for free at the Solve Media website, see below).
Generate HTML to place on your web page.
error_p
If set, this will cause the Solve Media widget to display an error message.
ssl_p
If set, the generated html widget will use https instead of http. You should set this to match your web page, to prevent the user's browser from displaying a warning.
widget_opts
Optional. A reference to a hash of options for the widget. The Solve Media widget supports the following options:
theme
Styling theme to use. For example 'red', 'purple', 'black', 'white'.
size
Size of the widget. 'standard', 'small', 'medium', 'large'.
lang
Language to use. 'en',
See the Solve Media web site (below) for complete documentation on options.
After the user has filled in and submitted the form, check the answer to determine whether they are human. returns a hashref containing is_valid and error.
is_valid
error
client_ip
the user's IP address in dotted quad format. can often be found in $ENV{REMOTE_ADDR}.
challenge
the puzzle challenge-id. can be found in the form field adcopy_challenge
adcopy_challenge
answer
the user's answer. can be found in the form field adcopy_response
adcopy_response
boolean result.
if the user failed the test, this will contain a terse message explaining.
There are no known bugs in the module.
http://www.solvemedia.com/
This software may be copied and distributed under the terms found in the Perl "Artistic License".
A copy of the "Artistic License" may be found in the standard Perl distribution.
To install WWW::SolveMedia, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::SolveMedia
CPAN shell
perl -MCPAN -e shell install WWW::SolveMedia
For more information on module installation, please visit the detailed CPAN module installation guide.