Added my site, even though it's in an early state
[ikiwiki.git] / IkiWiki / Plugin / fortune.pm
blobf481c7eacea7240b3b8032311d3c4e9b307bfe63
1 #!/usr/bin/perl
2 # Include a fortune in a page
3 package IkiWiki::Plugin::fortune;
5 use warnings;
6 use strict;
7 use IkiWiki 3.00;
9 sub import {
10 hook(type => "getsetup", id => "fortune", call => \&getsetup);
11 hook(type => "preprocess", id => "fortune", call => \&preprocess);
14 sub getsetup () {
15 return
16 plugin => {
17 safe => 1,
18 rebuild => undef,
19 section => "widget",
23 sub preprocess (@) {
24 $ENV{PATH}="$ENV{PATH}:/usr/games:/usr/local/games";
25 my $f = `fortune 2>/dev/null`;
27 if ($?) {
28 error gettext("fortune failed");
30 else {
31 return "<pre>$f</pre>\n";