package Captcha::NocaptchaMailru;
use strict;
use warnings;
use LWP::UserAgent;
use JSON;
use URI::Escape;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(
nocaptcha_generate_captcha
sub _get_json_by_url {
my $agent = LWP::UserAgent->new();
my $resp = $agent->get($_[0]);
return 'request failed' unless $resp->is_success;
my $json = eval {
decode_json($resp->
decoded_content);
};
return 'JSON parsing failed' if $@;
return $json;
}
sub _pack_params {
my ($hash) = @_;
my @pairs;
for my $key (keys %$hash) {
push @pairs, join('