aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-01-17 14:56:48 -0500
committerJoey Hess <joey@gnu.kitenet.net>2009-01-17 14:56:48 -0500
commitcd2ddb57a5a20e308cee912e26f2383733c11b3c (patch)
tree69df04604836860bd40405b81aee11468efa8567
parent4bede22e4f2189a570ea43dec3b087052ef85edc (diff)
downloadikiwiki-cd2ddb57a5a20e308cee912e26f2383733c11b3c.tar
ikiwiki-cd2ddb57a5a20e308cee912e26f2383733c11b3c.tar.gz
load rpc xml lib on the fly
This way, enabling the plugin via websetup is safe, it can't leave ikiwiki in a broken state.
-rw-r--r--IkiWiki/Plugin/blogspam.pm11
-rwxr-xr-xt/syntax.t4
2 files changed, 11 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm
index 6e68a9856..4005e9f2a 100644
--- a/IkiWiki/Plugin/blogspam.pm
+++ b/IkiWiki/Plugin/blogspam.pm
@@ -4,8 +4,6 @@ package IkiWiki::Plugin::blogspam;
use warnings;
use strict;
use IkiWiki 3.00;
-require RPC::XML;
-require RPC::XML::Client;
my $defaulturl='http://test.blogspam.net:8888/';
@@ -47,6 +45,15 @@ sub getsetup () {
sub checkcontent (@) {
my %params=@_;
+
+ eval q{
+ use RPC::XML;
+ use RPC::XML::Client;
+ };
+ if ($@) {
+ warn($@);
+ return undef;
+ }
if (exists $config{blogspam_pagespec}) {
return undef
diff --git a/t/syntax.t b/t/syntax.t
index 9d5cbc373..d09d17f7f 100755
--- a/t/syntax.t
+++ b/t/syntax.t
@@ -5,8 +5,8 @@ use Test::More;
my @progs="ikiwiki.in";
my @libs="IkiWiki.pm";
-# monotone, external, blogspam, amazon_s3 skipped since they need perl modules
-push @libs, map { chomp; $_ } `find IkiWiki -type f -name \\*.pm | grep -v monotone.pm | grep -v external.pm | grep -v blogspam.pm | grep -v amazon_s3.pm`;
+# monotone, external, amazon_s3 skipped since they need perl modules
+push @libs, map { chomp; $_ } `find IkiWiki -type f -name \\*.pm | grep -v monotone.pm | grep -v external.pm | grep -v amazon_s3.pm`;
push @libs, 'IkiWiki/Plugin/skeleton.pm.example';
plan(tests => (@progs + @libs));