| 1 | package Net::Mollom::ContentCheck; | ||
| 2 | 9 | ▶ | use Any::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 9 | has is_spam => (is => 'rw', isa => 'Bool'); | |
| 5 | 9 | has is_ham => (is => 'rw', isa => 'Bool'); | |
| 6 | 9 | has is_unsure => (is => 'rw', isa => 'Bool'); | |
| 7 | 9 | has quality => (is => 'rw', isa => 'Num'); | |
| 8 | 9 | has session_id => (is => 'rw', isa => 'Str'); | |
| 9 | |||
| 10 | 9 | ▶ | no Any::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 9 | __PACKAGE__->meta->make_immutable; | |
| 12 | |||
| 13 | =head1 NAME | ||
| 14 | |||
| 15 | Net::Mollom::ContentCheck | ||
| 16 | |||
| 17 | =head1 SYNOPSIS | ||
| 18 | |||
| 19 | The results of the C<mollom.checkContent> XML-RPC call. | ||
| 20 | |||
| 21 | my $mollom = Net::Mollom->new(...); | ||
| 22 | my $check = $mollom->check_content( | ||
| 23 | post_title => $title, | ||
| 24 | post_body => $body, | ||
| 25 | ); | ||
| 26 | |||
| 27 | if( $check->is_spam ) { | ||
| 28 | warn "someone's trying to sell us v1@grA!" | ||
| 29 | } elsif( $check->quality < .5 ) { | ||
| 30 | warn "someone might be trying to flame us!" | ||
| 31 | } | ||
| 32 | |||
| 33 | =head1 METHODS | ||
| 34 | |||
| 35 | You should not construct an object of this class by yourself. Instead | ||
| 36 | it should be done by L<Net::Mollom>'s call to C<check_content()>. After | ||
| 37 | you get one, these are the methods you can call. | ||
| 38 | |||
| 39 | =head2 is_spam | ||
| 40 | |||
| 41 | Returns true if the content sent was spam. | ||
| 42 | |||
| 43 | =head2 is_ham | ||
| 44 | |||
| 45 | Returns true if the content sent was not spam. | ||
| 46 | |||
| 47 | =head2 is_unsure | ||
| 48 | |||
| 49 | Returns true if Mollom isn't completely sure if this comment was spam or ham. | ||
| 50 | |||
| 51 | =head2 quality | ||
| 52 | |||
| 53 | A real number between 0 and 1 that's shows the quality of the content | ||
| 54 | posted. 0 being the worst and 1 being the best. | ||
| 55 | |||
| 56 | =head2 session_id | ||
| 57 | |||
| 58 | The ID of the Mollom session that this check was part of. This can be | ||
| 59 | saved and used later (ie, you need to call C<send_feedback> for some | ||
| 60 | content after some time in the future). | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | 9 | 1; | |