| Plagger documentation | Contained in the Plagger distribution. |
Plagger::Plugin::Publish::FOAFRoll - Publish foafroll RDF file using subscriptions
- module: Publish::FOAFRoll
config:
filename: /path/to/foafroll.rdf
link: http://example.org/
This plugin publishes foaf based blogroll (foafroll) using feeds found in the subscription.
File name to save foafroll files in. Recommended to name it foafroll.rdf or foafroll.xml. Required.
URL to use in foaf:homepage element. Optional.
URL to self reference the foafroll file. Optional.
Title of the foafroll. Optional and defaults to Plagger foafroll.
Tatsuhiko Miyagawa
| Plagger documentation | Contained in the Plagger distribution. |
package Plagger::Plugin::Publish::FOAFRoll; use strict; use base qw( Plagger::Plugin ); use File::Spec; sub init { my $self = shift; $self->SUPER::init(@_); my $output = $self->conf->{filename} or Plagger->context->error("filename is missing"); } sub register { my($self, $context) = @_; $context->register_hook( $self, 'publish.finalize' => \&finalize, ); } sub finalize { my($self, $context, $args) = @_; my $out = $self->templatize('foafroll.tt', { feeds => [ $context->subscription->feeds ], conf => $self->conf, }); my $path = $self->conf->{filename}; $context->log(info => "Writing FOAFRoll to $path"); open my $fh, ">:utf8", $path or $context->error("$path: $!"); print $fh $out; close $fh; } 1; __END__