ASP4x-Captcha-Imager
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as
# the caller loaded module this in the documented manner.
# If not set, the caller may NOT have loaded the bundled version, and thus
# they may not have a MI version that works with the Makefile.PL. This would
# result in false errors or unexpected behaviour. And we don't want that.
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
unless ( $INC{$file} ) { die <<"END_DIE" }
Please invoke ${\__PACKAGE__} with:
use inc::${\__PACKAGE__};
not:
use ${\__PACKAGE__};
lib/ASP4x/Captcha/Imager.pm view on Meta::CPAN
'x' => ( $idx * $charWidth ) + int(rand() * 8) + $charWidth,
'y' => ($img->getheight / 2) + int(rand() * 8) - 4,
);
}# end for()
$img->filter( type => 'gaussian', stddev => 1 );
}# end for()
# Render the image as PNG:
my $str = "";
$img->write(type=>'png', data => \$str)
or die $img->errstr;
$Response->Expires( -30 );
$Response->AddHeader( pragma => 'no-cache' );
$Response->SetHeader('content-type' => 'image/png');
$Response->ContentType( 'image/png' );
$Response->Write( $str );
}# end run()
sub generate_pair
{
t/conf/asp4-config.json view on Meta::CPAN
},
"settings": {
"captcha_key": "Captcha-Is-Teh-Awesome",
"captcha_font": "@ServerRoot@/etc/LiberationSans-Regular.ttf",
"captcha_width": 140,
"captcha_height": 40,
"captcha_bg_color": "FFFFFF",
"captcha_length": 4
}
},
"errors": {
"error_handler": "ASP4::ErrorHandler",
"mail_errors_to": "you@your-server.com",
"mail_errors_from": "root@localhost",
"smtp_server": "localhost"
},
"web": {
"application_name": "ASP4xCaptcha",
"application_root": "@ServerRoot@",
"www_root": "@ServerRoot@/htdocs",
"handler_root": "@ServerRoot@/handlers",
"page_cache_root": "/tmp/PAGE_CACHE",
"handler_resolver": "ASP4::HandlerResolver",
"handler_runner": "ASP4::HandlerRunner",
( run in 0.578 second using v1.01-cache-2.11-cpan-49f99fa48dc )