Dear Home Owner, このページをアンテナに追加 RSSフィード

 | 

2006-02-26

Plagger::Plugin::Publish::Pipe  Plagger::Plugin::Publish::Pipe - Dear Home Owner, を含むブックマーク はてなブックマーク -  Plagger::Plugin::Publish::Pipe - Dear Home Owner,  Plagger::Plugin::Publish::Pipe - Dear Home Owner, のブックマークコメント

lib/Plagger/Plugin/Publish/Pipe.pm

package Plagger::Plugin::Publish::Pipe;
use strict;
use base qw( Plagger::Plugin );

sub register {
    my($self, $context) = @_;
    $context->register_hook(
        $self,
        'publish.feed' => \&feed,
    );
}

sub feed {
    my($self, $context, $args) = @_;

    open my $out, "|" . $self->conf->{command} or $context->error("Can't open pipe: $!");
    for my $entry ($args->{feed}->entries) {
	print $out $entry->title . "\n";
	print $out $entry->permalink . "\n\n";
    }
    close $out;
}

1;

config.yaml

  - module: Publish::Pipe
    config:
      command: /usr/bin/lpr
      # command: /usr/bin/wall
      # command: /usr/bin/fax
      # (for OSX users) command: /usr/bin/say

Example result

http://f.hatena.ne.jp/images/fotolife/y/youpy/20060226/20060226213716.png

トラックバック - http://subtech.g.hatena.ne.jp/youpy/20060226
 |