Toolkit/Role/UsernameChecker.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 42 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Antispam::Toolkit::Role::UsernameChecker;
2 BEGIN {
3 $Antispam::Toolkit::Role::UsernameChecker::VERSION = '0.08';
4 }
5  
6 use strict;
7 use warnings;
8 use namespace::autoclean;
9  
10 use Antispam::Toolkit::Types qw( NonEmptyStr );
11 use Carp qw( croak );
12 use List::AllUtils qw( any );
13  
14 use Moose::Role;
15 use MooseX::Params::Validate qw( validated_hash );
16  
17 requires 'check_username';
18  
19 around check_username => sub {
20 my $orig = shift;
21 my $self = shift;
22 my %p = validated_hash(
23 \@_,
24 username => { isa => NonEmptyStr, optional => 1 },
25 );
26  
27 return $self->$orig(%p);
28 };
29  
30 1;
31  
32 # ABSTRACT: A role for classes which check whether an username is associated with spam
33  
34  
35  
36 =pod
37  
38 =head1 NAME
39  
40 Antispam::Toolkit::Role::UsernameChecker - A role for classes which check whether an username is associated with spam
41  
42 =head1 VERSION
43  
44 version 0.08
45  
46 =head1 SYNOPSIS
47  
48 package MyUsernameChecker;
49  
50 use Moose;
51  
52 with 'Antispam::Toolkit::Role::UsernameChecker';
53  
54 sub check_username { ... }
55  
56 =head1 DESCRIPTION
57  
58 This role specifies an interface for classes which check whether a specific
59 username is associated with spam.
60  
61 =head1 REQUIRED METHODS
62  
63 Classes which consume this method must provide one method:
64  
65 =head2 $checker->check_username( username => ... )
66  
67 This method implements the actual spam checking for a username. The username
68 will be passed as a named parameter.
69  
70 =head1 METHODS
71  
72 This role provides an around modifier for the C<< $checker->check_username()
73 >> method. The modifier does validation on all the parameters, so there's no
74 need to implement this in the class itself.
75  
76 =head1 BUGS
77  
78 See L<Antispam::Toolkit> for bug reporting details.
79  
80 =head1 AUTHOR
81  
82 Dave Rolsky <autarch@urth.org>
83  
84 =head1 COPYRIGHT AND LICENSE
85  
86 This software is Copyright (c) 2011 by Dave Rolsky.
87  
88 This is free software, licensed under:
89  
90 The Artistic License 2.0 (GPL Compatible)
91  
92 =cut
93  
94  
95 __END__