Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ishigaki (7238)

ishigaki
  (email not shown publicly)
http://ppm.tcool.org/

Journal of ishigaki (7238)

Saturday December 23, 2006
01:31 PM

#news on irc.perl.org

[ #31995 ]

I started running yet another plagger bot at #news on irc.perl.org, since jbisbee's bot has been down for a month or so. Here's bot's config.yaml (a bit modified; and the num of spaces are not correct because of the "nbsp"s).


global:
    plugin_path: myplugins
    timezone: Asia/Tokyo
    log:
        level: debug

plugins:
    - module: Subscription::Config
        config:
            feed:
                - http://search.cpan.org/uploads.rdf
                - http://www.perlcast.com/rss/current.xml
                - http://www.perlfoundation.org/perl-foundation.rdf
                - http://jobs.perl.org/rss/standard.rss
                - http://use.perl.org/journal.pl?op=top&content_type=rss
                - http://use.perl.org/useperl.rdf
                - http://www.perl.com/pace/perlnews.rdf
                - http://annocpan.org/recent.rss
                - http://log.perl.org/index.rdf
                - http://perlmonks.org/?node_id=30175

    - module: CustomFeed::PerlMonks

    - module: Filter::PerlNews

    - module: Filter::Rule
        rule:
            - module: Deduped
                path: .plagger-perlnews/irc.db

    - module: Notify::IRC
        config:
            daemon_port: 9992
            nickname: rssbot2
            server_host: irc.perl.org
            server_port: 6667
            server_channels:
                - #news
            charset: utf8
            announce: action

and Filter::PerlNews (this is an ad hoc plugin, not (and will not be) uploaded in the official svn tree):


package Plagger::Plugin::Filter::PerlNews;

use strict;
use base qw( Plagger::Plugin );

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

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

        my $title = $args->{feed}->title;

        $title =~ s/^AnnoCPAN Recent Notes/AnnoCPAN/;
        $title =~ s/^Perl.com Perl.com/Perl.com/;
        $title =~ s/^use Perl Journals/Journals/;
        $title =~ s/^jobs\.perl\.org/Jobs/;
        $title =~ s/^The Perl Foundation/PerlFoundation/;
        $title =~ s/^search\.cpan\.org/CPAN/;
        $title =~ s/^Perl Monks Newest Nodes/PerlMonks/;

        $args->{feed}->title( $title );

        my @entries = reverse @{ $args->{feed}->{entries} };

        $args->{feed}->{entries} = \@entries;
}

1;

Actually you can do this without writing a plugin. If you prefer, replace the last part with this:


    - module: Notify::IRC
        config:
            daemon_port: 9992
            nickname: rssbot2
            server_host: irc.perl.org
            server_port: 6667
            server_channels:
                - #news
            charset: utf8
            announce: action
        rule:
            expression: $args->{feed}->{title} =~ s/^AnnoCPAN Recent Notes/AnnoCPAN/;

or, more clearly:


    - module: Filter::Rule
        rule:
            expression: $args->{feed}->{title} =~ s/^AnnoCPAN Recent Notes/AnnoCPAN/;

    - module: Notify::IRC
        config:
            daemon_port: 9992
            nickname: rssbot2
            server_host: irc.perl.org
            server_port: 6667
            server_channels:
                - #news
            charset: utf8
            announce: action

Since this rule/expression stuff is not well-documented and a bit too magical, I prefer the first, though I totally agree we shouldn't include this kind of ad hoc plugins in the svn tree.

Suggestions and corrections are welcome ;)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.