ASP4x-Captcha-Imager

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

Changes
example/example.png
inc/Module/Install.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
lib/ASP4x/Captcha/Imager.pm
Makefile.PL
MANIFEST
META.yml
t/010-basic/000-setup.t
t/010-basic/010-compile.t
t/010-basic/020-basic.t
t/010-basic/030-form.t

inc/Module/Install/Metadata.pm  view on Meta::CPAN

#line 1
package Module::Install::Metadata;

use strict 'vars';
use Module::Install::Base;

use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
	$VERSION = '0.79';
	$ISCORE  = 1;
	@ISA     = qw{Module::Install::Base};
}

inc/Module/Install/Metadata.pm  view on Meta::CPAN

	my $type = shift;
	push @{ $self->{values}{no_index}{$type} }, @_ if $type;
	return $self->{values}{no_index};
}

sub read {
	my $self = shift;
	$self->include_deps( 'YAML::Tiny', 0 );

	require YAML::Tiny;
	my $data = YAML::Tiny::LoadFile('META.yml');

	# Call methods explicitly in case user has already set some values.
	while ( my ( $key, $value ) = each %$data ) {
		next unless $self->can($key);
		if ( ref $value eq 'HASH' ) {
			while ( my ( $module, $version ) = each %$value ) {
				$self->can($key)->($self, $module => $version );
			}
		} else {
			$self->can($key)->($self, $value);
		}
	}
	return $self;

lib/ASP4x/Captcha/Imager.pm  view on Meta::CPAN

        color   => $color,
        '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/010-basic/000-setup.t  view on Meta::CPAN


my $dbh = DBI->connect("DBI:SQLite:dbname=$dbfile", "", "", {
  RaiseError => 1,
});

my $ok = $dbh->do(<<"SQL");
create table asp_sessions (
  session_id    char(32) not null primary key,
  modified_on   timestamp not null default( datetime('now','localtime') ),
  created_on    datetime not null default( datetime('now','localtime') ),
  session_data  blob
)
SQL

ok($ok, "created table");

my $id = md5_hex( rand() );
$dbh->do(<<"SQL");
insert into asp_sessions (session_id, session_data) values ('$id','test')
SQL

my $sth = $dbh->prepare("SELECT * FROM asp_sessions WHERE session_id = ?");
$sth->execute( $id );
ok( my $rec = $sth->fetchrow_hashref, "fetched record" );
$sth->finish();

$dbh->disconnect();

t/conf/asp4-config.json  view on Meta::CPAN

    "handler_root":     "@ServerRoot@/handlers",
    "page_cache_root":  "/tmp/PAGE_CACHE",
    "handler_resolver": "ASP4::HandlerResolver",
    "handler_runner":   "ASP4::HandlerRunner",
    "filter_resolver":  "ASP4::FilterResolver",
    "request_filters": [
    ],
    "disable_persistence": [
    ]
  },
  "data_connections": {
    "session": {
      "manager":          "ASP4::SessionStateManager",
      "cookie_name":      "session-id",
      "cookie_domain":    "*",
      "session_timeout":  "*",
      "dsn":              "DBI:SQLite:dbname=/tmp/db_asp4captcha",
      "username":         "",
      "password":         ""
    },
    "main": {



( run in 0.289 second using v1.01-cache-2.11-cpan-8d75d55dd25 )