r19090 - in /branches/upstream/libnet-akismet-perl: ./ current/ current/lib/ current/lib/Net/ current/t/

yvesago-guest at users.alioth.debian.org yvesago-guest at users.alioth.debian.org
Wed Apr 23 16:59:44 UTC 2008


Author: yvesago-guest
Date: Wed Apr 23 16:59:43 2008
New Revision: 19090

URL: http://svn.debian.org/wsvn/?sc=1&rev=19090
Log:
[svn-inject] Installing original source of libnet-akismet-perl

Added:
    branches/upstream/libnet-akismet-perl/
    branches/upstream/libnet-akismet-perl/current/
    branches/upstream/libnet-akismet-perl/current/Changes
    branches/upstream/libnet-akismet-perl/current/MANIFEST
    branches/upstream/libnet-akismet-perl/current/META.yml
    branches/upstream/libnet-akismet-perl/current/Makefile.PL
    branches/upstream/libnet-akismet-perl/current/README
    branches/upstream/libnet-akismet-perl/current/lib/
    branches/upstream/libnet-akismet-perl/current/lib/Net/
    branches/upstream/libnet-akismet-perl/current/lib/Net/Akismet.pm
    branches/upstream/libnet-akismet-perl/current/t/
    branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-coverage.t
    branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-podcheck.t
    branches/upstream/libnet-akismet-perl/current/t/Net-Akismet.t

Added: branches/upstream/libnet-akismet-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-akismet-perl/current/Changes?rev=19090&op=file
==============================================================================
--- branches/upstream/libnet-akismet-perl/current/Changes (added)
+++ branches/upstream/libnet-akismet-perl/current/Changes Wed Apr 23 16:59:43 2008
@@ -1,0 +1,14 @@
+Revision history for Perl extension Net::Akismet.
+
+0.03  Mon Aug 27 10:28:28 EEST 2007
+	- proper user agent handling, patch by John Belmonte, rt bug #28939
+
+0.02  Sun Jul 2 23:12:27 2006
+	- fixed install problems with perl <5.8.4
+	- some new test added (thanks to Peter Pentchev)
+
+0.01  Wed Jan 11 13:31:42 2006
+	- original version; created by h2xs 1.23 with options
+		-AX --skip-exporter --use-new-tests -n Net::Akismet
+
+$Id: Changes 33 2007-08-27 07:30:07Z humperdink $

Added: branches/upstream/libnet-akismet-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-akismet-perl/current/MANIFEST?rev=19090&op=file
==============================================================================
--- branches/upstream/libnet-akismet-perl/current/MANIFEST (added)
+++ branches/upstream/libnet-akismet-perl/current/MANIFEST Wed Apr 23 16:59:43 2008
@@ -1,0 +1,9 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+t/Net-Akismet.t
+t/Net-Akismet-podcheck.t
+t/Net-Akismet-coverage.t
+lib/Net/Akismet.pm
+META.yml                                 Module meta-data (added by MakeMaker)

Added: branches/upstream/libnet-akismet-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-akismet-perl/current/META.yml?rev=19090&op=file
==============================================================================
--- branches/upstream/libnet-akismet-perl/current/META.yml (added)
+++ branches/upstream/libnet-akismet-perl/current/META.yml Wed Apr 23 16:59:43 2008
@@ -1,0 +1,11 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Net-Akismet
+version:      0.03
+version_from: lib/Net/Akismet.pm
+installdirs:  site
+requires:
+    LWP:                           5.09
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30_01

Added: branches/upstream/libnet-akismet-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-akismet-perl/current/Makefile.PL?rev=19090&op=file
==============================================================================
--- branches/upstream/libnet-akismet-perl/current/Makefile.PL (added)
+++ branches/upstream/libnet-akismet-perl/current/Makefile.PL Wed Apr 23 16:59:43 2008
@@ -1,0 +1,13 @@
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    NAME              => 'Net::Akismet',
+    VERSION_FROM      => 'lib/Net/Akismet.pm', # finds $VERSION
+    PREREQ_PM         => {
+		'LWP'	=> '5.09',
+	}, 
+    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM  => 'lib/Net/Akismet.pm', # retrieve abstract from module
+       AUTHOR         => 'Nikolay Bachiyski <nbachiyski at developer.bg>') : ()),
+);

Added: branches/upstream/libnet-akismet-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-akismet-perl/current/README?rev=19090&op=file
==============================================================================
--- branches/upstream/libnet-akismet-perl/current/README (added)
+++ branches/upstream/libnet-akismet-perl/current/README Wed Apr 23 16:59:43 2008
@@ -1,0 +1,35 @@
+Net-Akismet version 0.01
+========================
+
+Net::Akismet is meant to provide perl interface to the Akismet web service.
+
+Akismet is blog comment and trackback spam blocker, free for personal use. More info on http://akismet.com/
+
+The module allows you to either check if an item is spam or report certain comment as spam/false postivie.
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+  libwww-perl
+
+COPYRIGHT AND LICENCE
+
+Put the correct copyright and licence information here.
+
+Copyright (C) 2006 by Nikolay Bachiyski
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.7 or,
+at your option, any later version of Perl 5 you may have available.
+
+$Id: README 15 2006-01-11 13:31:47Z humperdink $

Added: branches/upstream/libnet-akismet-perl/current/lib/Net/Akismet.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-akismet-perl/current/lib/Net/Akismet.pm?rev=19090&op=file
==============================================================================
--- branches/upstream/libnet-akismet-perl/current/lib/Net/Akismet.pm (added)
+++ branches/upstream/libnet-akismet-perl/current/lib/Net/Akismet.pm Wed Apr 23 16:59:43 2008
@@ -1,0 +1,282 @@
+package Net::Akismet;
+
+=head1 NAME
+
+Net::Akismet - Perl interface to Akismet - comment and trackback spam fighter
+
+=cut
+
+use 5.006;
+use warnings;
+use strict;
+use integer;
+
+use LWP::UserAgent;
+use HTTP::Request::Common;
+
+our $VERSION	= '0.03';
+
+my $UA_SUFFIX	= "Perl-Net-Akismet/$VERSION";
+
+=head1 SYNOPSIS
+
+	my $akismet = Net::Akismet->new(
+			KEY => 'secret-baba-API-key',
+			URL => 'http://example.blog.net/',
+		) or die('Key verification failure!');
+
+	my $verdict = $akismet->check(
+			USER_IP 		=> '10.10.10.11',
+			USER_AGENT 		=> 'Mozilla/5.0',
+			COMMENT_CONTENT		=> 'Run, Lola, Run, the spam will catch you!',
+			COMMENT_AUTHOR		=> 'dosser',
+			COMENT_AUTHOR_EMAIL	=> 'dosser at subway.de',
+			REFERRER		=> 'http://lola.home/',
+		) or die('Is the server here?');
+
+	if ('true' eq $verdict) {
+
+		print "I found spam. I am a spam-founder!\n";
+	}
+
+=head1 METHODS
+
+=over 8
+
+=item B<new()>
+
+	Net::Akismet->new(PARAM => ...);
+
+Acceptable parameters:
+
+=over 4
+
+=item  KEY
+
+The API key being verified for use with the API.
+
+=item  URL
+
+The front page or home URL of the instance making the request.  For a blog or wiki this would be the front page.
+
+=item  USER_AGENT
+
+If supplied the value is prepended to this module's identification string to become something like:
+
+	your-killer-app/0.042 Perl-Net-Akismet/0.01 libwww-perl/5.8
+
+Otherwise just Akismet Perl's user agent string will be sent.
+
+=back
+
+If verification of the key was unsuccessful C<new()> returns C<undef>.
+
+=cut
+
+sub new {
+
+	my $that 	= shift;
+	my $class 	= ref $that || $that;
+	my %params	= @_;
+
+	my $self = \%params;
+
+	$self->{ua} = LWP::UserAgent->new() or return undef;
+
+	my $key 	= $self->{KEY} or return undef;
+	my $url		= $self->{URL} or return undef;
+
+	# NOTE: trailing space leaves LWP::UserAgent agent string in place
+	my $agent = "$UA_SUFFIX ";
+	$agent = "$params{USER_AGENT} $agent" if $params{USER_AGENT};
+	$self->{ua}->agent($agent);
+
+	bless $self, $class;
+
+	return $self->_verify_key()? $self : undef;
+}
+
+sub _verify_key {
+
+	my $self 	= shift;
+
+
+	my $response = $self->{ua}->request(
+			POST 'http://rest.akismet.com/1.1/verify-key', 
+			[
+				key		=> $self->{KEY},
+				blog 	=> $self->{URL},
+			]
+	);
+
+	($response && $response->is_success() && 'valid' eq $response->content()) or return undef;
+		
+	return 1;
+}
+
+=item B<check()>
+
+	$akismet->check(USER_IP => ..., COMMENT_CONTENT => ..., ...)
+
+To be or not to be... C<check> is meant to tell you.  Give it enough details about the comment and expect C<'true'>, C<'false'> or C<undef> as a result.  C<'true'> means B<spam>, C<'false'> means B<not spam>, C<undef> is returned on errror in submission of the comment. 
+
+Acceptable comment characteristics:
+
+=over 4
+
+=item  USER_IP
+
+B<Required.>  Represents the IP address of the comment submitter.
+
+=item  COMMENT_USER_AGENT
+
+B<Required.>  User agent string from the comment submitter's request.
+
+=item  COMMENT_CONTENT
+
+Comment text.
+
+=item  REFERRER
+
+HTTP C<Referer> header.
+
+=item  PERMALINK
+
+Permanent link to the subject of the comment.
+
+=item  COMMENT_TYPE
+
+May be blank, 'comment', 'trackback', 'pingback', or a made up value like 'registration'.
+
+=item  COMMENT_AUTHOR
+
+Name of submitter.
+
+=item  COMMENT_AUTHOR_EMAIL
+
+Submitter e-mail.
+
+=item  COMMENT_AUTHOR_URL
+
+Submitter web page.
+
+=back
+
+
+=cut
+
+sub check {
+
+	my $self = shift;
+
+	$self->_submit('comment-check', {@_}) or return undef;
+
+	('true' eq $self->{response} || 'false' eq $self->{response}) or return undef;
+
+	return $self->{response};
+}
+
+=item B<spam()>
+
+Reports a certain comment as spam.  Accepts the same arguments as C<check()>.
+
+In case of failed submission returns C<undef>, otherwise - a perl-known truth.
+
+=cut
+
+sub spam {
+
+	my $self = shift;
+
+	return $self->_submit('submit-spam', {@_});
+}
+
+=item B<ham()>
+
+This call is intended for the marking of false positives, things that were incorrectly marked as spam.  It takes identical arguments as C<check()> and C<spam()>.
+
+In case of failed submission returns C<undef>, otherwise - a perl-known truth.
+
+=cut
+
+sub ham {
+
+	my $self = shift;
+
+	return $self->_submit('submit-ham', {@_});
+}
+
+sub _submit {
+
+	my $self = shift;
+
+	my $action = shift || 'comment-check';
+
+	my $comment = shift;
+
+	$comment->{USER_IP} && $comment->{COMMENT_USER_AGENT} || return undef;
+
+	my $response = $self->{ua}->request(
+    	POST "http://$self->{KEY}.rest.akismet.com/1.1/$action",
+            [
+                blog 					=> $self->{URL},
+				user_ip					=> $comment->{USER_IP},
+				user_agent				=> $comment->{COMMENT_USER_AGENT},
+				referrer				=> $comment->{REFERRER},
+				permalink				=> $comment->{PERMALINK},
+				comment_type			=> $comment->{COMMENT_TYPE},
+				comment_author			=> $comment->{COMMENT_AUTHOR},
+				comment_author_email	=> $comment->{COMMENT_AUTHOR_EMAIL},
+				comment_author_url 		=> $comment->{COMMENT_AUTHOR_URL},
+				comment_content			=> $comment->{COMMENT_CONTENT},
+            ]
+    );
+
+	($response && $response->is_success()) or return undef;
+	
+	$self->{response} = $response->content();
+
+	return 1;
+}
+
+1;
+
+=back
+
+=head1 NOTES
+
+Although almost all comment characteristics are optional, performance can drop dramatically if you exclude certain elements.  So please, supply as much comment detail as possible.
+
+=head1 SEE ALSO
+
+=over 4
+
+=item * http://akismet.com/
+
+=item * http://akismet.com/development/api/
+
+=back
+
+=head1 AUTHOR
+
+Nikolay Bachiyski E<lt>nbachiyski at developer.bgE<gt>
+
+=head2 Help, modifications and bugfixes from:
+
+=over 4
+
+=item * Peter Pentchev
+
+=item * John Belmonte 
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006, 2007 by Nikolay Bachiyski
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
+
+$Id: Akismet.pm 32 2007-08-27 07:21:34Z humperdink $
+
+=cut

Added: branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-coverage.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-coverage.t?rev=19090&op=file
==============================================================================
--- branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-coverage.t (added)
+++ branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-coverage.t Wed Apr 23 16:59:43 2008
@@ -1,0 +1,15 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl Net-Akismet-coverage.t'
+
+BEGIN {
+	eval 'use Test::Pod::Coverage tests => 1';
+	if ($@) {
+		use Test;
+		plan tests => 1;
+		skip('Test::Pod::Coverage not found');
+		exit(0);
+	}
+}
+
+
+pod_coverage_ok('Net::Akismet');

Added: branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-podcheck.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-podcheck.t?rev=19090&op=file
==============================================================================
--- branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-podcheck.t (added)
+++ branches/upstream/libnet-akismet-perl/current/t/Net-Akismet-podcheck.t Wed Apr 23 16:59:43 2008
@@ -1,0 +1,27 @@
+# $Id: Net-Akismet-podcheck.t 135 2006-01-27 17:54:46Z roam $
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl Net-Akismet-coverage.t'
+
+use Pod::Checker;
+use Test;
+plan tests => 6;
+
+my ($c, $res);
+
+$c = new Pod::Checker '-warnings' => 1;
+ok($c);
+$res = $c->parse_from_file('lib/Net/Akismet.pm', \*STDERR);
+if ($res == -1) {
+	warn "No POD data found in Net::Akismet\n";
+}
+ok(!$res);
+ok($c->num_errors() == 0 && $c->num_warnings() == 0);
+
+$c = new Pod::Checker '-warnings' => 5;
+ok($c);
+$res = $c->parse_from_file('lib/Net/Akismet.pm', \*STDERR);
+if ($res == -1) {
+	warn "No POD data found in Net::Akismet\n";
+}
+ok(!$res);
+ok($c->num_errors() == 0 && $c->num_warnings() == 0);

Added: branches/upstream/libnet-akismet-perl/current/t/Net-Akismet.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-akismet-perl/current/t/Net-Akismet.t?rev=19090&op=file
==============================================================================
--- branches/upstream/libnet-akismet-perl/current/t/Net-Akismet.t (added)
+++ branches/upstream/libnet-akismet-perl/current/t/Net-Akismet.t Wed Apr 23 16:59:43 2008
@@ -1,0 +1,15 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl Net-Akismet.t'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test::More tests => 1;
+BEGIN { use_ok('Net::Akismet') };
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+




More information about the Pkg-perl-cvs-commits mailing list