Antispam-Toolkit
view release on metacpan or search on metacpan
lib/Antispam/Toolkit/Role/BerkeleyDB.pm view on Meta::CPAN
use Antispam::Toolkit::Types qw( Bool File NonEmptyStr DataFile );
use BerkeleyDB;
use DateTime;
BEGIN {
die 'The ' . __PACKAGE__ . ' role requires a BerkeleyDB linked against Berkeley DB 4.4+'
unless $BerkeleyDB::db_version >= 4.4;
}
use Moose::Role;
use MooseX::Params::Validate qw( validated_list );
with 'Antispam::Toolkit::Role::Database';
has database => (
is => 'ro',
isa => File,
coerce => 1,
required => 1,
);
lib/Antispam/Toolkit/Role/BerkeleyDB.pm view on Meta::CPAN
my $db_file = $self->database();
return
$db_file->basename() . ' - '
. DateTime->from_epoch( epoch => $db_file->stat()->mtime() )
->iso8601();
}
sub build {
my $class = shift;
my ( $file, $database, $update ) = validated_list(
\@_,
file => {
isa => DataFile,
coerce => 1,
},
database => {
isa => File,
coerce => 1,
},
update => {
lib/Antispam/Toolkit/Role/ContentChecker.pm view on Meta::CPAN
}
use strict;
use warnings;
use namespace::autoclean;
use Antispam::Toolkit::Types qw( ArrayRef NonEmptyStr );
use List::AllUtils qw( first );
use Moose::Role;
use MooseX::Params::Validate qw( validated_hash );
requires qw( check_content _build_accepted_content_types );
has _accepted_content_types => (
is => 'bare',
isa => ArrayRef [NonEmptyStr],
init_arg => undef,
lazy => 1,
builder => '_build_accepted_content_types',
);
around check_content => sub {
my $orig = shift;
my $self = shift;
my %p = validated_hash(
\@_,
content_type => { isa => NonEmptyStr },
content => { isa => NonEmptyStr },
);
return
unless first { $_ eq $p{content_type} }
@{ $self->_accepted_content_types() };
return $self->$orig(@_);
lib/Antispam/Toolkit/Role/EmailChecker.pm view on Meta::CPAN
use strict;
use warnings;
use namespace::autoclean;
use Antispam::Toolkit::Types qw( NonEmptyStr );
use Carp qw( croak );
use List::AllUtils qw( any );
use Moose::Role;
use MooseX::Params::Validate qw( validated_hash );
requires 'check_email';
around check_email => sub {
my $orig = shift;
my $self = shift;
my %p = validated_hash(
\@_,
email => { isa => NonEmptyStr, optional => 1 },
);
return $self->$orig(%p);
};
1;
# ABSTRACT: A role for classes which check whether an email is associated with spam
lib/Antispam/Toolkit/Role/IPChecker.pm view on Meta::CPAN
use strict;
use warnings;
use namespace::autoclean;
use Antispam::Toolkit::Types qw( NonEmptyStr );
use Carp qw( croak );
use List::AllUtils qw( any );
use Moose::Role;
use MooseX::Params::Validate qw( validated_hash );
requires 'check_ip';
around check_ip => sub {
my $orig = shift;
my $self = shift;
my %p = validated_hash(
\@_,
ip => { isa => NonEmptyStr, optional => 1 },
);
return $self->$orig(%p);
};
1;
# ABSTRACT: A role for classes which check whether an ip address is associated with spam
lib/Antispam/Toolkit/Role/URIChecker.pm view on Meta::CPAN
$Antispam::Toolkit::Role::URIChecker::VERSION = '0.08';
}
use strict;
use warnings;
use namespace::autoclean;
use Antispam::Toolkit::Types qw( NonEmptyStr );
use Moose::Role;
use MooseX::Params::Validate qw( validated_hash );
requires 'check_uri';
around check_uri => sub {
my $orig = shift;
my $self = shift;
my %p = validated_hash(
\@_,
uri => { isa => NonEmptyStr },
);
$self->$orig(%p);
};
1;
# ABSTRACT: A role for classes which check whether a uri is spam
lib/Antispam/Toolkit/Role/UsernameChecker.pm view on Meta::CPAN
use strict;
use warnings;
use namespace::autoclean;
use Antispam::Toolkit::Types qw( NonEmptyStr );
use Carp qw( croak );
use List::AllUtils qw( any );
use Moose::Role;
use MooseX::Params::Validate qw( validated_hash );
requires 'check_username';
around check_username => sub {
my $orig = shift;
my $self = shift;
my %p = validated_hash(
\@_,
username => { isa => NonEmptyStr, optional => 1 },
);
return $self->$orig(%p);
};
1;
# ABSTRACT: A role for classes which check whether an username is associated with spam
( run in 0.857 second using v1.01-cache-2.11-cpan-a5abf4f5562 )